mirror of
https://github.com/nextcloud/talk-android
synced 2025-02-01 12:11:59 +00:00
replace LovelyDialog with material version
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
abf67ebfdb
commit
14ac0cb1f5
@ -60,6 +60,7 @@ import com.bluelinelabs.conductor.Controller
|
|||||||
import com.bluelinelabs.conductor.RouterTransaction
|
import com.bluelinelabs.conductor.RouterTransaction
|
||||||
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler
|
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler
|
||||||
import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler
|
import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler
|
||||||
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.google.android.material.textfield.TextInputLayout
|
import com.google.android.material.textfield.TextInputLayout
|
||||||
import com.nextcloud.talk.BuildConfig
|
import com.nextcloud.talk.BuildConfig
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
@ -91,7 +92,6 @@ import com.nextcloud.talk.utils.database.user.CurrentUserProviderNew
|
|||||||
import com.nextcloud.talk.utils.preferences.MagicUserInputModule
|
import com.nextcloud.talk.utils.preferences.MagicUserInputModule
|
||||||
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder
|
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder
|
||||||
import com.yarolegovich.lovelydialog.LovelySaveStateHandler
|
import com.yarolegovich.lovelydialog.LovelySaveStateHandler
|
||||||
import com.yarolegovich.lovelydialog.LovelyStandardDialog
|
|
||||||
import io.reactivex.Observer
|
import io.reactivex.Observer
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
@ -118,7 +118,6 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
|||||||
@Inject
|
@Inject
|
||||||
lateinit var currentUserProvider: CurrentUserProviderNew
|
lateinit var currentUserProvider: CurrentUserProviderNew
|
||||||
|
|
||||||
private var saveStateHandler: LovelySaveStateHandler? = null
|
|
||||||
private var currentUser: User? = null
|
private var currentUser: User? = null
|
||||||
private var credentials: String? = null
|
private var credentials: String? = null
|
||||||
private var proxyTypeChangeListener: OnPreferenceValueChangedListener<String>? = null
|
private var proxyTypeChangeListener: OnPreferenceValueChangedListener<String>? = null
|
||||||
@ -150,10 +149,6 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
|||||||
|
|
||||||
getCurrentUser()
|
getCurrentUser()
|
||||||
|
|
||||||
if (saveStateHandler == null) {
|
|
||||||
saveStateHandler = LovelySaveStateHandler()
|
|
||||||
}
|
|
||||||
|
|
||||||
registerChangeListeners()
|
registerChangeListeners()
|
||||||
|
|
||||||
setupSettingsScreen()
|
setupSettingsScreen()
|
||||||
@ -381,11 +376,6 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveViewState(view: View, outState: Bundle) {
|
|
||||||
saveStateHandler!!.saveInstanceState(outState)
|
|
||||||
super.onSaveViewState(view, outState)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRestoreViewState(view: View, savedViewState: Bundle) {
|
override fun onRestoreViewState(view: View, savedViewState: Bundle) {
|
||||||
super.onRestoreViewState(view, savedViewState)
|
super.onRestoreViewState(view, savedViewState)
|
||||||
if (LovelySaveStateHandler.wasDialogOnScreen(savedViewState)) {
|
if (LovelySaveStateHandler.wasDialogOnScreen(savedViewState)) {
|
||||||
@ -397,23 +387,27 @@ class SettingsController : NewBaseController(R.layout.controller_settings) {
|
|||||||
|
|
||||||
private fun showRemoveAccountWarning(savedInstanceState: Bundle?) {
|
private fun showRemoveAccountWarning(savedInstanceState: Bundle?) {
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
LovelyStandardDialog(activity, LovelyStandardDialog.ButtonLayout.HORIZONTAL)
|
val materialAlertDialogBuilder = MaterialAlertDialogBuilder(binding.messageText.context)
|
||||||
.setTopColorRes(R.color.nc_darkRed)
|
|
||||||
.setIcon(
|
|
||||||
DisplayUtils.getTintedDrawable(
|
|
||||||
resources,
|
|
||||||
R.drawable.ic_delete_black_24dp,
|
|
||||||
R.color.bg_default
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.setPositiveButtonColor(context!!.resources.getColor(R.color.nc_darkRed))
|
|
||||||
.setTitle(R.string.nc_settings_remove_account)
|
.setTitle(R.string.nc_settings_remove_account)
|
||||||
.setMessage(R.string.nc_settings_remove_confirmation)
|
.setMessage(R.string.nc_settings_remove_confirmation)
|
||||||
.setPositiveButton(R.string.nc_settings_remove, { removeCurrentAccount() })
|
.setPositiveButton(R.string.nc_settings_remove) { _, _ ->
|
||||||
.setNegativeButton(R.string.nc_cancel, null)
|
removeCurrentAccount()
|
||||||
.setInstanceStateHandler(ID_REMOVE_ACCOUNT_WARNING_DIALOG, saveStateHandler)
|
}
|
||||||
.setSavedInstanceState(savedInstanceState)
|
.setNegativeButton(R.string.nc_cancel) { _, _ ->
|
||||||
.show()
|
// unused atm
|
||||||
|
}
|
||||||
|
|
||||||
|
viewThemeUtils.colorMaterialAlertDialogBackground(
|
||||||
|
binding.messageText.context,
|
||||||
|
materialAlertDialogBuilder
|
||||||
|
)
|
||||||
|
|
||||||
|
val dialog = materialAlertDialogBuilder.show()
|
||||||
|
|
||||||
|
viewThemeUtils.colorTextButtons(
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_POSITIVE),
|
||||||
|
dialog.getButton(AlertDialog.BUTTON_NEGATIVE)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user