Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
2ec5c91c
Commit
2ec5c91c
authored
Apr 25, 2019
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add change app language feature.
parent
0afc2bef
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
130 additions
and
76 deletions
+130
-76
AppLanguageView.kt
...va/chat/rocket/android/core/behaviours/AppLanguageView.kt
+12
-0
MainModule.kt
app/src/main/java/chat/rocket/android/main/di/MainModule.kt
+7
-0
MainPresenter.kt
...va/chat/rocket/android/main/presentation/MainPresenter.kt
+5
-25
MainActivity.kt
...src/main/java/chat/rocket/android/main/ui/MainActivity.kt
+27
-2
GetCurrentLanguageInteractor.kt
...ket/android/server/domain/GetCurrentLanguageInteractor.kt
+1
-1
SettingsPresenter.kt
...rocket/android/settings/presentation/SettingsPresenter.kt
+8
-2
SettingsFragment.kt
.../java/chat/rocket/android/settings/ui/SettingsFragment.kt
+70
-46
No files found.
app/src/main/java/chat/rocket/android/core/behaviours/AppLanguageView.kt
0 → 100644
View file @
2ec5c91c
package
chat.rocket.android.core.behaviours
interface
AppLanguageView
{
/**
* Updates the app language
*
* @param language The app language to be updated.
* @param country Opcional. The country code to be updated.
*/
fun
updateLanguage
(
language
:
String
,
country
:
String
?
=
null
)
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/main/di/MainModule.kt
View file @
2ec5c91c
package
chat.rocket.android.main.di
package
chat.rocket.android.main.di
import
androidx.lifecycle.LifecycleOwner
import
androidx.lifecycle.LifecycleOwner
import
chat.rocket.android.core.behaviours.AppLanguageView
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.dagger.scope.PerActivity
import
chat.rocket.android.dagger.scope.PerActivity
import
chat.rocket.android.main.presentation.MainNavigator
import
chat.rocket.android.main.presentation.MainNavigator
...
@@ -16,6 +17,12 @@ class MainModule {
...
@@ -16,6 +17,12 @@ class MainModule {
@PerActivity
@PerActivity
fun
provideMainNavigator
(
activity
:
MainActivity
)
=
MainNavigator
(
activity
)
fun
provideMainNavigator
(
activity
:
MainActivity
)
=
MainNavigator
(
activity
)
@Provides
@PerActivity
fun
appLanguageView
(
activity
:
MainActivity
):
AppLanguageView
{
return
activity
}
@Provides
@Provides
@PerActivity
@PerActivity
fun
provideJob
()
=
Job
()
fun
provideJob
()
=
Job
()
...
...
app/src/main/java/chat/rocket/android/main/presentation/MainPresenter.kt
View file @
2ec5c91c
package
chat.rocket.android.main.presentation
package
chat.rocket.android.main.presentation
import
android.content.Context
import
chat.rocket.android.core.behaviours.AppLanguageView
import
android.content.res.Configuration
import
chat.rocket.android.push.GroupedPush
import
chat.rocket.android.push.GroupedPush
import
chat.rocket.android.server.domain.GetCurrentLanguageInteractor
import
chat.rocket.android.server.domain.GetCurrentLanguageInteractor
import
chat.rocket.android.server.domain.RefreshPermissionsInteractor
import
chat.rocket.android.server.domain.RefreshPermissionsInteractor
import
chat.rocket.android.server.domain.RefreshSettingsInteractor
import
chat.rocket.android.server.domain.RefreshSettingsInteractor
import
chat.rocket.android.server.domain.SaveCurrentLanguageInteractor
import
chat.rocket.android.server.domain.SaveCurrentLanguageInteractor
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
java.util.Locale
import
javax.inject.Inject
import
javax.inject.Inject
import
javax.inject.Named
import
javax.inject.Named
class
MainPresenter
@Inject
constructor
(
class
MainPresenter
@Inject
constructor
(
@Named
(
"currentServer"
)
private
val
currentServerUrl
:
String
,
@Named
(
"currentServer"
)
private
val
currentServerUrl
:
String
,
private
val
mainNavigator
:
MainNavigator
,
private
val
mainNavigator
:
MainNavigator
,
private
val
appLanguageView
:
AppLanguageView
,
private
val
refreshSettingsInteractor
:
RefreshSettingsInteractor
,
private
val
refreshSettingsInteractor
:
RefreshSettingsInteractor
,
private
val
refreshPermissionsInteractor
:
RefreshPermissionsInteractor
,
private
val
refreshPermissionsInteractor
:
RefreshPermissionsInteractor
,
private
val
connectionManagerFactory
:
ConnectionManagerFactory
,
private
val
connectionManagerFactory
:
ConnectionManagerFactory
,
private
val
saveLanguageInteractor
:
SaveCurrentLanguageInteractor
,
private
var
getLanguageInteractor
:
GetCurrentLanguageInteractor
,
private
var
getLanguageInteractor
:
GetCurrentLanguageInteractor
,
private
val
groupedPush
:
GroupedPush
private
val
groupedPush
:
GroupedPush
)
{
)
{
...
@@ -39,28 +37,10 @@ class MainPresenter @Inject constructor(
...
@@ -39,28 +37,10 @@ class MainPresenter @Inject constructor(
fun
showChatList
(
chatRoomId
:
String
?
=
null
)
=
mainNavigator
.
toChatList
(
chatRoomId
)
fun
showChatList
(
chatRoomId
:
String
?
=
null
)
=
mainNavigator
.
toChatList
(
chatRoomId
)
fun
setLocale
(
language
:
String
,
baseContext
:
Context
)
{
val
locale
=
Locale
(
language
)
Locale
.
setDefault
(
locale
)
val
config
=
Configuration
()
config
.
locale
=
locale
baseContext
.
resources
.
updateConfiguration
(
config
,
baseContext
.
resources
.
displayMetrics
)
saveLanguageInteractor
.
save
(
language
)
}
fun
setLocaleWithRegion
(
lang
:
String
,
country
:
String
,
baseContext
:
Context
)
{
val
locale
=
Locale
(
lang
,
country
)
Locale
.
setDefault
(
locale
)
val
config
=
Configuration
()
config
.
locale
=
locale
baseContext
.
resources
.
updateConfiguration
(
config
,
baseContext
.
resources
.
displayMetrics
)
saveLanguageInteractor
.
save
(
lang
)
}
fun
loadLocale
(
baseContext
:
Context
)
{
fun
getAppLanguage
()
{
val
currentLanguage
=
getLanguageInteractor
.
get
()
getLanguageInteractor
.
get
()
?.
let
{
currentLanguage
->
if
(
currentLanguage
!=
null
)
{
appLanguageView
.
updateLanguage
(
currentLanguage
)
setLocale
(
currentLanguage
,
baseContext
)
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/main/ui/MainActivity.kt
View file @
2ec5c91c
...
@@ -3,10 +3,14 @@ package chat.rocket.android.main.ui
...
@@ -3,10 +3,14 @@ package chat.rocket.android.main.ui
import
android.app.Activity
import
android.app.Activity
import
android.app.NotificationManager
import
android.app.NotificationManager
import
android.content.Context
import
android.content.Context
import
android.content.res.Configuration
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.os.LocaleList
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.Fragment
import
chat.rocket.android.R
import
chat.rocket.android.R
import
chat.rocket.android.core.behaviours.AppLanguageView
import
chat.rocket.android.main.presentation.MainPresenter
import
chat.rocket.android.main.presentation.MainPresenter
import
chat.rocket.android.push.refreshPushToken
import
chat.rocket.android.push.refreshPushToken
import
chat.rocket.android.server.ui.INTENT_CHAT_ROOM_ID
import
chat.rocket.android.server.ui.INTENT_CHAT_ROOM_ID
...
@@ -15,10 +19,11 @@ import dagger.android.AndroidInjector
...
@@ -15,10 +19,11 @@ import dagger.android.AndroidInjector
import
dagger.android.DispatchingAndroidInjector
import
dagger.android.DispatchingAndroidInjector
import
dagger.android.HasActivityInjector
import
dagger.android.HasActivityInjector
import
dagger.android.support.HasSupportFragmentInjector
import
dagger.android.support.HasSupportFragmentInjector
import
java.util.*
import
javax.inject.Inject
import
javax.inject.Inject
class
MainActivity
:
AppCompatActivity
(),
HasActivityInjector
,
class
MainActivity
:
AppCompatActivity
(),
HasActivityInjector
,
HasSupportFragmentInjector
{
HasSupportFragmentInjector
,
AppLanguageView
{
@Inject
@Inject
lateinit
var
activityDispatchingAndroidInjector
:
DispatchingAndroidInjector
<
Activity
>
lateinit
var
activityDispatchingAndroidInjector
:
DispatchingAndroidInjector
<
Activity
>
@Inject
@Inject
...
@@ -30,11 +35,11 @@ class MainActivity : AppCompatActivity(), HasActivityInjector,
...
@@ -30,11 +35,11 @@ class MainActivity : AppCompatActivity(), HasActivityInjector,
AndroidInjection
.
inject
(
this
)
AndroidInjection
.
inject
(
this
)
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_main
)
setContentView
(
R
.
layout
.
activity_main
)
presenter
.
loadLocale
(
baseContext
)
refreshPushToken
()
refreshPushToken
()
with
(
presenter
)
{
with
(
presenter
)
{
connect
()
connect
()
getAppLanguage
()
intent
.
getStringExtra
(
INTENT_CHAT_ROOM_ID
).
let
{
intent
.
getStringExtra
(
INTENT_CHAT_ROOM_ID
).
let
{
clearNotificationsForChatRoom
(
it
)
clearNotificationsForChatRoom
(
it
)
showChatList
(
it
)
showChatList
(
it
)
...
@@ -53,6 +58,26 @@ class MainActivity : AppCompatActivity(), HasActivityInjector,
...
@@ -53,6 +58,26 @@ class MainActivity : AppCompatActivity(), HasActivityInjector,
override
fun
supportFragmentInjector
():
AndroidInjector
<
Fragment
>
=
override
fun
supportFragmentInjector
():
AndroidInjector
<
Fragment
>
=
fagmentDispatchingAndroidInjector
fagmentDispatchingAndroidInjector
override
fun
updateLanguage
(
language
:
String
,
country
:
String
?)
{
val
locale
:
Locale
=
if
(
country
!=
null
)
{
Locale
(
language
,
country
)
}
else
{
Locale
(
language
)
}
Locale
.
setDefault
(
locale
)
val
config
=
Configuration
()
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
config
.
locales
=
LocaleList
(
locale
)
}
else
{
config
.
locale
=
locale
}
createConfigurationContext
(
config
)
}
private
fun
clearAppNotifications
()
=
private
fun
clearAppNotifications
()
=
(
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
).
cancelAll
()
(
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
).
cancelAll
()
}
}
app/src/main/java/chat/rocket/android/server/domain/GetCurrentLanguageInteractor.kt
View file @
2ec5c91c
...
@@ -6,6 +6,6 @@ import javax.inject.Inject
...
@@ -6,6 +6,6 @@ import javax.inject.Inject
class
GetCurrentLanguageInteractor
@Inject
constructor
(
class
GetCurrentLanguageInteractor
@Inject
constructor
(
private
val
repository
:
CurrentLanguageRepository
private
val
repository
:
CurrentLanguageRepository
)
{
)
{
fun
get
():
String
?
=
repository
.
get
()
fun
get
():
String
?
=
repository
.
get
()
}
}
\ No newline at end of file
app/src/main/java/chat/rocket/android/settings/presentation/SettingsPresenter.kt
View file @
2ec5c91c
...
@@ -5,9 +5,11 @@ import chat.rocket.android.db.DatabaseManagerFactory
...
@@ -5,9 +5,11 @@ import chat.rocket.android.db.DatabaseManagerFactory
import
chat.rocket.android.helper.UserHelper
import
chat.rocket.android.helper.UserHelper
import
chat.rocket.android.main.presentation.MainNavigator
import
chat.rocket.android.main.presentation.MainNavigator
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.server.domain.AnalyticsTrackingInteractor
import
chat.rocket.android.server.domain.GetCurrentLanguageInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.GetCurrentServerInteractor
import
chat.rocket.android.server.domain.PermissionsInteractor
import
chat.rocket.android.server.domain.PermissionsInteractor
import
chat.rocket.android.server.domain.RemoveAccountInteractor
import
chat.rocket.android.server.domain.RemoveAccountInteractor
import
chat.rocket.android.server.domain.SaveCurrentLanguageInteractor
import
chat.rocket.android.server.domain.TokenRepository
import
chat.rocket.android.server.domain.TokenRepository
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
import
chat.rocket.android.server.infraestructure.RocketChatClientFactory
...
@@ -28,7 +30,6 @@ import timber.log.Timber
...
@@ -28,7 +30,6 @@ import timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Inject
import
javax.inject.Named
import
javax.inject.Named
class
SettingsPresenter
@Inject
constructor
(
class
SettingsPresenter
@Inject
constructor
(
private
val
view
:
SettingsView
,
private
val
view
:
SettingsView
,
private
val
strategy
:
CancelStrategy
,
private
val
strategy
:
CancelStrategy
,
...
@@ -42,7 +43,8 @@ class SettingsPresenter @Inject constructor(
...
@@ -42,7 +43,8 @@ class SettingsPresenter @Inject constructor(
getCurrentServerInteractor
:
GetCurrentServerInteractor
,
getCurrentServerInteractor
:
GetCurrentServerInteractor
,
removeAccountInteractor
:
RemoveAccountInteractor
,
removeAccountInteractor
:
RemoveAccountInteractor
,
databaseManagerFactory
:
DatabaseManagerFactory
,
databaseManagerFactory
:
DatabaseManagerFactory
,
connectionManagerFactory
:
ConnectionManagerFactory
connectionManagerFactory
:
ConnectionManagerFactory
,
private
val
saveLanguageInteractor
:
SaveCurrentLanguageInteractor
)
:
CheckServerPresenter
(
)
:
CheckServerPresenter
(
strategy
=
strategy
,
strategy
=
strategy
,
factory
=
rocketChatClientFactory
,
factory
=
rocketChatClientFactory
,
...
@@ -124,6 +126,10 @@ class SettingsPresenter @Inject constructor(
...
@@ -124,6 +126,10 @@ class SettingsPresenter @Inject constructor(
}
}
}
}
fun
saveLocale
(
language
:
String
)
{
saveLanguageInteractor
.
save
(
language
)
}
fun
toProfile
()
=
navigator
.
toProfile
()
fun
toProfile
()
=
navigator
.
toProfile
()
fun
toAdmin
()
=
tokenRepository
.
get
(
currentServer
)
?.
let
{
fun
toAdmin
()
=
tokenRepository
.
get
(
currentServer
)
?.
let
{
...
...
app/src/main/java/chat/rocket/android/settings/ui/SettingsFragment.kt
View file @
2ec5c91c
...
@@ -2,8 +2,11 @@ package chat.rocket.android.settings.ui
...
@@ -2,8 +2,11 @@ package chat.rocket.android.settings.ui
import
android.content.ActivityNotFoundException
import
android.content.ActivityNotFoundException
import
android.content.Intent
import
android.content.Intent
import
android.content.res.Configuration
import
android.net.Uri
import
android.net.Uri
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.os.LocaleList
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
...
@@ -17,8 +20,8 @@ import chat.rocket.android.BuildConfig
...
@@ -17,8 +20,8 @@ import chat.rocket.android.BuildConfig
import
chat.rocket.android.R
import
chat.rocket.android.R
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.AnalyticsManager
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.analytics.event.ScreenViewEvent
import
chat.rocket.android.core.behaviours.AppLanguageView
import
chat.rocket.android.helper.TextHelper.getDeviceAndAppInformation
import
chat.rocket.android.helper.TextHelper.getDeviceAndAppInformation
import
chat.rocket.android.main.presentation.MainPresenter
import
chat.rocket.android.settings.presentation.SettingsPresenter
import
chat.rocket.android.settings.presentation.SettingsPresenter
import
chat.rocket.android.settings.presentation.SettingsView
import
chat.rocket.android.settings.presentation.SettingsView
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.inflate
...
@@ -28,17 +31,16 @@ import dagger.android.support.AndroidSupportInjection
...
@@ -28,17 +31,16 @@ import dagger.android.support.AndroidSupportInjection
import
kotlinx.android.synthetic.main.app_bar.*
import
kotlinx.android.synthetic.main.app_bar.*
import
kotlinx.android.synthetic.main.fragment_settings.*
import
kotlinx.android.synthetic.main.fragment_settings.*
import
timber.log.Timber
import
timber.log.Timber
import
java.util.*
import
javax.inject.Inject
import
javax.inject.Inject
internal
const
val
TAG_SETTINGS_FRAGMENT
=
"SettingsFragment"
internal
const
val
TAG_SETTINGS_FRAGMENT
=
"SettingsFragment"
fun
newInstance
():
Fragment
=
SettingsFragment
()
fun
newInstance
():
Fragment
=
SettingsFragment
()
class
SettingsFragment
:
Fragment
(),
SettingsView
{
class
SettingsFragment
:
Fragment
(),
SettingsView
,
AppLanguageView
{
@Inject
lateinit
var
analyticsManager
:
AnalyticsManager
@Inject
lateinit
var
analyticsManager
:
AnalyticsManager
@Inject
lateinit
var
presenter
:
SettingsPresenter
@Inject
lateinit
var
presenter
:
SettingsPresenter
@Inject
lateinit
var
mainPresenter
:
MainPresenter
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
...
@@ -112,6 +114,27 @@ class SettingsFragment : Fragment(), SettingsView {
...
@@ -112,6 +114,27 @@ class SettingsFragment : Fragment(), SettingsView {
}
}
}
}
override
fun
updateLanguage
(
language
:
String
,
country
:
String
?)
{
val
locale
:
Locale
=
if
(
country
!=
null
)
{
Locale
(
language
,
country
)
}
else
{
Locale
(
language
)
}
Locale
.
setDefault
(
locale
)
val
config
=
Configuration
()
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
config
.
locales
=
LocaleList
(
locale
)
}
else
{
config
.
locale
=
locale
}
context
?.
createConfigurationContext
(
config
)
presenter
.
saveLocale
(
language
)
}
override
fun
invalidateToken
(
token
:
String
)
=
invalidateFirebaseToken
(
token
)
override
fun
invalidateToken
(
token
:
String
)
=
invalidateFirebaseToken
(
token
)
override
fun
showLoading
()
{
override
fun
showLoading
()
{
...
@@ -143,89 +166,90 @@ class SettingsFragment : Fragment(), SettingsView {
...
@@ -143,89 +166,90 @@ class SettingsFragment : Fragment(), SettingsView {
}
}
}
}
fun
changeLanguage
()
{
private
fun
contactSupport
()
{
val
uriText
=
"mailto:${"
support
@rocket
.
chat
"}"
+
"?subject="
+
Uri
.
encode
(
getString
(
R
.
string
.
msg_android_app_support
))
+
"&body="
+
Uri
.
encode
(
getDeviceAndAppInformation
())
with
(
Intent
(
Intent
.
ACTION_SENDTO
))
{
data
=
uriText
.
toUri
()
try
{
startActivity
(
Intent
.
createChooser
(
this
,
getString
(
R
.
string
.
msg_send_email
)))
}
catch
(
ex
:
ActivityNotFoundException
)
{
Timber
.
e
(
ex
)
}
}
}
private
fun
changeLanguage
()
{
val
languages
=
resources
.
getStringArray
(
R
.
array
.
languages
)
val
languages
=
resources
.
getStringArray
(
R
.
array
.
languages
)
context
?.
let
{
context
?.
let
{
AlertDialog
.
Builder
(
it
)
AlertDialog
.
Builder
(
it
)
.
setTitle
(
R
.
string
.
title_choose_language
)
.
setTitle
(
R
.
string
.
title_choose_language
)
.
setSingleChoiceItems
(
languages
,
-
1
)
{
dialog
,
which
->
.
setSingleChoiceItems
(
languages
,
-
1
)
{
dialog
,
option
->
when
(
which
)
{
when
(
option
)
{
0
->
{
0
->
{
mainPresenter
.
setLocale
(
"en"
,
it
)
updateLanguage
(
"en"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
1
->
{
1
->
{
mainPresenter
.
setLocale
(
"hi"
,
it
)
updateLanguage
(
"hi"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
2
->
{
2
->
{
mainPresenter
.
setLocale
(
"ja"
,
it
)
updateLanguage
(
"ja"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
3
->
{
3
->
{
mainPresenter
.
setLocale
(
"ru"
,
it
)
updateLanguage
(
"ru"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
4
->
{
4
->
{
mainPresenter
.
setLocale
(
"it"
,
it
)
updateLanguage
(
"it"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
5
->
{
5
->
{
mainPresenter
.
setLocaleWithRegion
(
"pt"
,
"BR"
,
it
)
updateLanguage
(
"pt"
,
"BR"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
6
->
{
6
->
{
mainPresenter
.
setLocaleWithRegion
(
"pt"
,
"PT"
,
it
)
updateLanguage
(
"pt"
,
"PT"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
7
->
{
7
->
{
mainPresenter
.
setLocale
(
"zh"
,
it
)
updateLanguage
(
"zh"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
8
->
{
8
->
{
mainPresenter
.
setLocale
(
"de"
,
it
)
updateLanguage
(
"de"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
9
->
{
9
->
{
mainPresenter
.
setLocale
(
"es"
,
it
)
updateLanguage
(
"es"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
10
->
{
10
->
{
mainPresenter
.
setLocale
(
"fa"
,
it
)
updateLanguage
(
"fa"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
11
->
{
11
->
{
mainPresenter
.
setLocale
(
"fr"
,
it
)
updateLanguage
(
"fr"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
12
->
{
12
->
{
mainPresenter
.
setLocale
(
"tr"
,
it
)
updateLanguage
(
"tr"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
13
->
{
13
->
{
mainPresenter
.
setLocale
(
"uk"
,
it
)
updateLanguage
(
"uk"
)
activity
?.
recreate
()
activity
?.
recreate
()
}
}
}
}
dialog
.
dismiss
()
dialog
.
dismiss
()
}
}
.
create
().
show
()
.
create
()
}
.
show
()
}
private
fun
contactSupport
()
{
val
uriText
=
"mailto:${"
support
@rocket
.
chat
"}"
+
"?subject="
+
Uri
.
encode
(
getString
(
R
.
string
.
msg_android_app_support
))
+
"&body="
+
Uri
.
encode
(
getDeviceAndAppInformation
())
with
(
Intent
(
Intent
.
ACTION_SENDTO
))
{
data
=
uriText
.
toUri
()
try
{
startActivity
(
Intent
.
createChooser
(
this
,
getString
(
R
.
string
.
msg_send_email
)))
}
catch
(
ex
:
ActivityNotFoundException
)
{
Timber
.
e
(
ex
)
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment