mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 02:15:35 +03:00
Reduce dependency on Butterknife: remove usage of @OnClick and @OnTextChange
This commit is contained in:
parent
6cdb192955
commit
876359539f
23 changed files with 234 additions and 146 deletions
|
@ -24,7 +24,6 @@ import android.os.Build
|
|||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.Person
|
||||
import androidx.core.content.getSystemService
|
||||
import butterknife.OnClick
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.core.di.ScreenComponent
|
||||
|
@ -66,24 +65,32 @@ class DebugMenuActivity : VectorBaseActivity() {
|
|||
val string = buffer.toString(Charsets.ISO_8859_1)
|
||||
|
||||
renderQrCode(string)
|
||||
setupViews()
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
debug_test_text_view_link.setOnClickListener { testTextViewLink() }
|
||||
debug_show_sas_emoji.setOnClickListener { showSasEmoji() }
|
||||
debug_test_notification.setOnClickListener { testNotification() }
|
||||
debug_test_material_theme_light.setOnClickListener { testMaterialThemeLight() }
|
||||
debug_test_material_theme_dark.setOnClickListener { testMaterialThemeDark() }
|
||||
debug_test_crash.setOnClickListener { testCrash() }
|
||||
debug_scan_qr_code.setOnClickListener { scanQRCode() }
|
||||
}
|
||||
|
||||
private fun renderQrCode(text: String) {
|
||||
debug_qr_code.setData(text)
|
||||
}
|
||||
|
||||
@OnClick(R.id.debug_test_text_view_link)
|
||||
fun testTextViewLink() {
|
||||
private fun testTextViewLink() {
|
||||
startActivity(Intent(this, TestLinkifyActivity::class.java))
|
||||
}
|
||||
|
||||
@OnClick(R.id.debug_show_sas_emoji)
|
||||
fun showSasEmoji() {
|
||||
private fun showSasEmoji() {
|
||||
startActivity(Intent(this, DebugSasEmojiActivity::class.java))
|
||||
}
|
||||
|
||||
@OnClick(R.id.debug_test_notification)
|
||||
fun testNotification() {
|
||||
private fun testNotification() {
|
||||
val notificationManager = getSystemService<NotificationManager>()!!
|
||||
|
||||
// Create channel first
|
||||
|
@ -166,23 +173,19 @@ class DebugMenuActivity : VectorBaseActivity() {
|
|||
)
|
||||
}
|
||||
|
||||
@OnClick(R.id.debug_test_material_theme_light)
|
||||
fun testMaterialThemeLight() {
|
||||
private fun testMaterialThemeLight() {
|
||||
startActivity(Intent(this, DebugMaterialThemeLightActivity::class.java))
|
||||
}
|
||||
|
||||
@OnClick(R.id.debug_test_material_theme_dark)
|
||||
fun testMaterialThemeDark() {
|
||||
private fun testMaterialThemeDark() {
|
||||
startActivity(Intent(this, DebugMaterialThemeDarkActivity::class.java))
|
||||
}
|
||||
|
||||
@OnClick(R.id.debug_test_crash)
|
||||
fun testCrash() {
|
||||
private fun testCrash() {
|
||||
throw RuntimeException("Application crashed from user demand")
|
||||
}
|
||||
|
||||
@OnClick(R.id.debug_scan_qr_code)
|
||||
fun scanQRCode() {
|
||||
private fun scanQRCode() {
|
||||
if (checkPermissions(PERMISSIONS_FOR_TAKING_PHOTO, this, PERMISSION_REQUEST_CODE_LAUNCH_CAMERA)) {
|
||||
doScanQRCode()
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.view.MenuItem
|
|||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.annotation.MenuRes
|
||||
|
@ -176,6 +177,7 @@ abstract class VectorBaseActivity : AppCompatActivity(), HasScreenInjector {
|
|||
uiDisposables.add(this)
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
Timber.i("onCreate Activity ${javaClass.simpleName}")
|
||||
val vectorComponent = getVectorComponent()
|
||||
|
|
|
@ -25,9 +25,9 @@ import androidx.core.content.edit
|
|||
import androidx.core.view.isVisible
|
||||
import butterknife.BindView
|
||||
import butterknife.ButterKnife
|
||||
import butterknife.OnClick
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.di.DefaultSharedPreferences
|
||||
import kotlinx.android.synthetic.main.view_keys_backup_banner.view.*
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
|
@ -100,8 +100,7 @@ class KeysBackupBanner @JvmOverloads constructor(
|
|||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.view_keys_backup_banner_close)
|
||||
internal fun onCloseClicked() {
|
||||
private fun onCloseClicked() {
|
||||
state.let {
|
||||
when (it) {
|
||||
is State.Setup -> {
|
||||
|
@ -138,6 +137,7 @@ class KeysBackupBanner @JvmOverloads constructor(
|
|||
setOnClickListener(this)
|
||||
textView1.setOnClickListener(this)
|
||||
textView2.setOnClickListener(this)
|
||||
view_keys_backup_banner_close.setOnClickListener { onCloseClicked() }
|
||||
}
|
||||
|
||||
private fun renderInitial() {
|
||||
|
|
|
@ -25,7 +25,6 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
|||
import androidx.core.view.isVisible
|
||||
import butterknife.BindView
|
||||
import butterknife.ButterKnife
|
||||
import butterknife.OnClick
|
||||
import im.vector.app.R
|
||||
import kotlinx.android.synthetic.main.view_call_controls.view.*
|
||||
import org.matrix.android.sdk.api.session.call.CallState
|
||||
|
@ -59,40 +58,41 @@ class CallControlsView @JvmOverloads constructor(
|
|||
ConstraintLayout.inflate(context, R.layout.view_call_controls, this)
|
||||
// layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
ButterKnife.bind(this)
|
||||
|
||||
iv_icr_accept_call.setOnClickListener { acceptIncomingCall() }
|
||||
iv_icr_end_call.setOnClickListener { declineIncomingCall() }
|
||||
iv_end_call.setOnClickListener { endOngoingCall() }
|
||||
iv_mute_toggle.setOnClickListener { toggleMute() }
|
||||
iv_video_toggle.setOnClickListener { toggleVideo() }
|
||||
iv_leftMiniControl.setOnClickListener { returnToChat() }
|
||||
iv_more.setOnClickListener { moreControlOption() }
|
||||
}
|
||||
|
||||
@OnClick(R.id.iv_icr_accept_call)
|
||||
fun acceptIncomingCall() {
|
||||
private fun acceptIncomingCall() {
|
||||
interactionListener?.didAcceptIncomingCall()
|
||||
}
|
||||
|
||||
@OnClick(R.id.iv_icr_end_call)
|
||||
fun declineIncomingCall() {
|
||||
private fun declineIncomingCall() {
|
||||
interactionListener?.didDeclineIncomingCall()
|
||||
}
|
||||
|
||||
@OnClick(R.id.iv_end_call)
|
||||
fun endOngoingCall() {
|
||||
private fun endOngoingCall() {
|
||||
interactionListener?.didEndCall()
|
||||
}
|
||||
|
||||
@OnClick(R.id.iv_mute_toggle)
|
||||
fun toggleMute() {
|
||||
private fun toggleMute() {
|
||||
interactionListener?.didTapToggleMute()
|
||||
}
|
||||
|
||||
@OnClick(R.id.iv_video_toggle)
|
||||
fun toggleVideo() {
|
||||
private fun toggleVideo() {
|
||||
interactionListener?.didTapToggleVideo()
|
||||
}
|
||||
|
||||
@OnClick(R.id.iv_leftMiniControl)
|
||||
fun returnToChat() {
|
||||
private fun returnToChat() {
|
||||
interactionListener?.returnToChat()
|
||||
}
|
||||
|
||||
@OnClick(R.id.iv_more)
|
||||
fun moreControlOption() {
|
||||
private fun moreControlOption() {
|
||||
interactionListener?.didTapMore()
|
||||
}
|
||||
|
||||
|
|
|
@ -17,19 +17,18 @@ package im.vector.app.features.crypto.keysbackup.restore
|
|||
|
||||
import android.app.Activity
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.EditText
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import androidx.lifecycle.Observer
|
||||
import butterknife.BindView
|
||||
import butterknife.OnClick
|
||||
import butterknife.OnTextChanged
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.registerStartForActivityResult
|
||||
import im.vector.app.core.platform.VectorBaseFragment
|
||||
import im.vector.app.core.utils.startImportTextFromFileIntent
|
||||
import kotlinx.android.synthetic.main.fragment_keys_backup_restore_from_key.*
|
||||
import org.matrix.android.sdk.api.extensions.tryOrNull
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -64,17 +63,19 @@ class KeysBackupRestoreFromKeyFragment @Inject constructor()
|
|||
viewModel.recoveryCodeErrorText.observe(viewLifecycleOwner, Observer { newValue ->
|
||||
mKeyInputLayout.error = newValue
|
||||
})
|
||||
|
||||
keys_restore_button.setOnClickListener { onRestoreFromKey() }
|
||||
keys_backup_import.setOnClickListener { onImport() }
|
||||
keys_restore_key_enter_edittext.doOnTextChanged { text, _, _, _ -> onRestoreKeyTextEditChange(text) }
|
||||
}
|
||||
|
||||
@OnTextChanged(R.id.keys_restore_key_enter_edittext)
|
||||
fun onRestoreKeyTextEditChange(s: Editable?) {
|
||||
private fun onRestoreKeyTextEditChange(s: CharSequence?) {
|
||||
s?.toString()?.let {
|
||||
viewModel.updateCode(it)
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_restore_button)
|
||||
fun onRestoreFromKey() {
|
||||
private fun onRestoreFromKey() {
|
||||
val value = viewModel.recoveryCode.value
|
||||
if (value.isNullOrBlank()) {
|
||||
viewModel.recoveryCodeErrorText.value = context?.getString(R.string.keys_backup_recovery_code_empty_error_message)
|
||||
|
@ -83,8 +84,7 @@ class KeysBackupRestoreFromKeyFragment @Inject constructor()
|
|||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_backup_import)
|
||||
fun onImport() {
|
||||
private fun onImport() {
|
||||
startImportTextFromFileIntent(requireContext(), textFileStartForActivityResult)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
package im.vector.app.features.crypto.keysbackup.restore
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.SpannableString
|
||||
import android.text.style.ClickableSpan
|
||||
import android.view.View
|
||||
|
@ -25,14 +24,14 @@ import android.widget.EditText
|
|||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.text.set
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import androidx.lifecycle.Observer
|
||||
import butterknife.BindView
|
||||
import butterknife.OnClick
|
||||
import butterknife.OnTextChanged
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.showPassword
|
||||
import im.vector.app.core.platform.VectorBaseFragment
|
||||
import kotlinx.android.synthetic.main.fragment_keys_backup_restore_from_passphrase.*
|
||||
import javax.inject.Inject
|
||||
|
||||
class KeysBackupRestoreFromPassphraseFragment @Inject constructor() : VectorBaseFragment() {
|
||||
|
@ -54,8 +53,7 @@ class KeysBackupRestoreFromPassphraseFragment @Inject constructor() : VectorBase
|
|||
@BindView(R.id.keys_backup_passphrase_help_with_link)
|
||||
lateinit var helperTextWithLink: TextView
|
||||
|
||||
@OnClick(R.id.keys_backup_view_show_password)
|
||||
fun toggleVisibilityMode() {
|
||||
private fun toggleVisibilityMode() {
|
||||
viewModel.showPasswordMode.value = !(viewModel.showPasswordMode.value ?: false)
|
||||
}
|
||||
|
||||
|
@ -84,6 +82,11 @@ class KeysBackupRestoreFromPassphraseFragment @Inject constructor() : VectorBase
|
|||
}
|
||||
return@setOnEditorActionListener false
|
||||
}
|
||||
|
||||
keys_backup_view_show_password.setOnClickListener { toggleVisibilityMode() }
|
||||
keys_backup_passphrase_help_with_link.setOnClickListener { onUseRecoveryKey() }
|
||||
keys_backup_restore_with_passphrase_submit.setOnClickListener { onRestoreBackup() }
|
||||
keys_backup_passphrase_enter_edittext.doOnTextChanged { text, _, _, _ -> onPassphraseTextEditChange(text) }
|
||||
}
|
||||
|
||||
private fun spannableStringForHelperText(): SpannableString {
|
||||
|
@ -102,18 +105,15 @@ class KeysBackupRestoreFromPassphraseFragment @Inject constructor() : VectorBase
|
|||
return spanString
|
||||
}
|
||||
|
||||
@OnTextChanged(R.id.keys_backup_passphrase_enter_edittext)
|
||||
fun onPassphraseTextEditChange(s: Editable?) {
|
||||
private fun onPassphraseTextEditChange(s: CharSequence?) {
|
||||
s?.toString()?.let { viewModel.updatePassphrase(it) }
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_backup_passphrase_help_with_link)
|
||||
fun onUseRecoveryKey() {
|
||||
private fun onUseRecoveryKey() {
|
||||
sharedViewModel.moveToRecoverWithKey()
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_backup_restore_with_passphrase_submit)
|
||||
fun onRestoreBackup() {
|
||||
private fun onRestoreBackup() {
|
||||
val value = viewModel.passphrase.value
|
||||
if (value.isNullOrBlank()) {
|
||||
viewModel.passphraseErrorText.value = getString(R.string.passphrase_empty_error_message)
|
||||
|
|
|
@ -20,10 +20,10 @@ import android.view.View
|
|||
import android.widget.TextView
|
||||
import androidx.core.view.isVisible
|
||||
import butterknife.BindView
|
||||
import butterknife.OnClick
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.platform.VectorBaseFragment
|
||||
import im.vector.app.core.utils.LiveEvent
|
||||
import kotlinx.android.synthetic.main.fragment_keys_backup_restore_success.*
|
||||
import javax.inject.Inject
|
||||
|
||||
class KeysBackupRestoreSuccessFragment @Inject constructor() : VectorBaseFragment() {
|
||||
|
@ -56,10 +56,10 @@ class KeysBackupRestoreSuccessFragment @Inject constructor() : VectorBaseFragmen
|
|||
mSuccessText.text = context?.getString(R.string.keys_backup_restore_success_title_already_up_to_date)
|
||||
mSuccessDetailsText.isVisible = false
|
||||
}
|
||||
keys_backup_setup_done_button.setOnClickListener { onDone() }
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_backup_setup_done_button)
|
||||
fun onDone() {
|
||||
private fun onDone() {
|
||||
sharedViewModel.importRoomKeysFinishWithResult.value = LiveEvent(sharedViewModel.importKeyResult!!)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ import android.widget.Button
|
|||
import android.widget.TextView
|
||||
import androidx.lifecycle.Observer
|
||||
import butterknife.BindView
|
||||
import butterknife.OnClick
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.platform.VectorBaseFragment
|
||||
import im.vector.app.core.utils.LiveEvent
|
||||
import kotlinx.android.synthetic.main.fragment_keys_backup_setup_step1.*
|
||||
import javax.inject.Inject
|
||||
|
||||
class KeysBackupSetupStep1Fragment @Inject constructor() : VectorBaseFragment() {
|
||||
|
@ -51,15 +51,16 @@ class KeysBackupSetupStep1Fragment @Inject constructor() : VectorBaseFragment()
|
|||
advancedOptionText.visibility = if (showOption) View.VISIBLE else View.GONE
|
||||
manualExportButton.visibility = if (showOption) View.VISIBLE else View.GONE
|
||||
})
|
||||
|
||||
keys_backup_setup_step1_button.setOnClickListener { onButtonClick() }
|
||||
keys_backup_setup_step1_manualExport.setOnClickListener { onManualExportClick() }
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_backup_setup_step1_button)
|
||||
fun onButtonClick() {
|
||||
private fun onButtonClick() {
|
||||
viewModel.navigateEvent.value = LiveEvent(KeysBackupSetupSharedViewModel.NAVIGATE_TO_STEP_2)
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_backup_setup_step1_manualExport)
|
||||
fun onManualExportClick() {
|
||||
private fun onManualExportClick() {
|
||||
viewModel.navigateEvent.value = LiveEvent(KeysBackupSetupSharedViewModel.NAVIGATE_MANUAL_EXPORT)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,11 @@ import android.view.ViewGroup
|
|||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageView
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.transition.TransitionManager
|
||||
import butterknife.BindView
|
||||
import butterknife.OnClick
|
||||
import butterknife.OnTextChanged
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import com.nulabinc.zxcvbn.Zxcvbn
|
||||
import im.vector.app.R
|
||||
|
@ -34,6 +33,7 @@ import im.vector.app.core.extensions.showPassword
|
|||
import im.vector.app.core.platform.VectorBaseFragment
|
||||
import im.vector.app.core.ui.views.PasswordStrengthBar
|
||||
import im.vector.app.features.settings.VectorLocale
|
||||
import kotlinx.android.synthetic.main.fragment_keys_backup_setup_step2.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
@ -65,14 +65,12 @@ class KeysBackupSetupStep2Fragment @Inject constructor() : VectorBaseFragment()
|
|||
|
||||
private val zxcvbn = Zxcvbn()
|
||||
|
||||
@OnTextChanged(R.id.keys_backup_passphrase_enter_edittext)
|
||||
fun onPassphraseChanged() {
|
||||
private fun onPassphraseChanged() {
|
||||
viewModel.passphrase.value = mPassphraseTextEdit.text.toString()
|
||||
viewModel.confirmPassphraseError.value = null
|
||||
}
|
||||
|
||||
@OnTextChanged(R.id.keys_backup_passphrase_confirm_edittext)
|
||||
fun onConfirmPassphraseChanged() {
|
||||
private fun onConfirmPassphraseChanged() {
|
||||
viewModel.confirmPassphrase.value = mPassphraseConfirmTextEdit.text.toString()
|
||||
}
|
||||
|
||||
|
@ -85,6 +83,7 @@ class KeysBackupSetupStep2Fragment @Inject constructor() : VectorBaseFragment()
|
|||
|
||||
viewModel.shouldPromptOnBack = true
|
||||
bindViewToViewModel()
|
||||
setupViews()
|
||||
}
|
||||
|
||||
/* ==========================================================================================
|
||||
|
@ -159,13 +158,20 @@ class KeysBackupSetupStep2Fragment @Inject constructor() : VectorBaseFragment()
|
|||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_backup_view_show_password)
|
||||
fun toggleVisibilityMode() {
|
||||
private fun setupViews() {
|
||||
keys_backup_view_show_password.setOnClickListener { toggleVisibilityMode() }
|
||||
keys_backup_setup_step2_button.setOnClickListener { doNext() }
|
||||
keys_backup_setup_step2_skip_button.setOnClickListener { skipPassphrase() }
|
||||
|
||||
keys_backup_passphrase_enter_edittext.doOnTextChanged { _, _, _, _ -> onPassphraseChanged()}
|
||||
keys_backup_passphrase_confirm_edittext.doOnTextChanged { _, _, _, _ -> onConfirmPassphraseChanged()}
|
||||
}
|
||||
|
||||
private fun toggleVisibilityMode() {
|
||||
viewModel.showPasswordMode.value = !(viewModel.showPasswordMode.value ?: false)
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_backup_setup_step2_button)
|
||||
fun doNext() {
|
||||
private fun doNext() {
|
||||
when {
|
||||
viewModel.passphrase.value.isNullOrEmpty() -> {
|
||||
viewModel.passphraseError.value = context?.getString(R.string.passphrase_empty_error_message)
|
||||
|
@ -184,8 +190,7 @@ class KeysBackupSetupStep2Fragment @Inject constructor() : VectorBaseFragment()
|
|||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_backup_setup_step2_skip_button)
|
||||
fun skipPassphrase() {
|
||||
private fun skipPassphrase() {
|
||||
when {
|
||||
viewModel.passphrase.value.isNullOrEmpty() -> {
|
||||
// Generate a recovery key for the user
|
||||
|
|
|
@ -27,7 +27,6 @@ import androidx.core.view.isVisible
|
|||
import androidx.lifecycle.Observer
|
||||
import arrow.core.Try
|
||||
import butterknife.BindView
|
||||
import butterknife.OnClick
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.registerStartForActivityResult
|
||||
|
@ -36,6 +35,7 @@ import im.vector.app.core.utils.LiveEvent
|
|||
import im.vector.app.core.utils.copyToClipboard
|
||||
import im.vector.app.core.utils.selectTxtFileToWrite
|
||||
import im.vector.app.core.utils.startSharePlainTextIntent
|
||||
import kotlinx.android.synthetic.main.fragment_keys_backup_setup_step3.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -88,10 +88,17 @@ class KeysBackupSetupStep3Fragment @Inject constructor() : VectorBaseFragment()
|
|||
mRecoveryKeyTextView.isVisible = false
|
||||
}
|
||||
})
|
||||
|
||||
setupViews()
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_backup_setup_step3_button)
|
||||
fun onFinishButtonClicked() {
|
||||
private fun setupViews() {
|
||||
keys_backup_setup_step3_button.setOnClickListener { onFinishButtonClicked() }
|
||||
keys_backup_setup_step3_copy_button.setOnClickListener { onCopyButtonClicked() }
|
||||
keys_backup_recovery_key_text.setOnClickListener { onRecoveryKeyClicked() }
|
||||
}
|
||||
|
||||
private fun onFinishButtonClicked() {
|
||||
if (viewModel.megolmBackupCreationInfo == null) {
|
||||
// nothing
|
||||
} else {
|
||||
|
@ -103,8 +110,7 @@ class KeysBackupSetupStep3Fragment @Inject constructor() : VectorBaseFragment()
|
|||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_backup_setup_step3_copy_button)
|
||||
fun onCopyButtonClicked() {
|
||||
private fun onCopyButtonClicked() {
|
||||
val dialog = BottomSheetDialog(requireActivity())
|
||||
dialog.setContentView(R.layout.bottom_sheet_save_recovery_key)
|
||||
dialog.setCanceledOnTouchOutside(true)
|
||||
|
@ -155,8 +161,7 @@ class KeysBackupSetupStep3Fragment @Inject constructor() : VectorBaseFragment()
|
|||
dialog.show()
|
||||
}
|
||||
|
||||
@OnClick(R.id.keys_backup_recovery_key_text)
|
||||
fun onRecoveryKeyClicked() {
|
||||
private fun onRecoveryKeyClicked() {
|
||||
viewModel.recoveryKey.value?.let {
|
||||
viewModel.copyHasBeenMade = true
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.view.inputmethod.EditorInfo
|
|||
import androidx.autofill.HintConstants
|
||||
import androidx.core.text.isDigitsOnly
|
||||
import androidx.core.view.isVisible
|
||||
import butterknife.OnClick
|
||||
import com.airbnb.mvrx.Fail
|
||||
import com.airbnb.mvrx.Loading
|
||||
import com.airbnb.mvrx.Success
|
||||
|
@ -66,6 +65,7 @@ class LoginFragment @Inject constructor() : AbstractSSOLoginFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
setupSubmitButton()
|
||||
setupForgottenPasswordButton()
|
||||
setupPasswordReveal()
|
||||
|
||||
passwordField.setOnEditorActionListener { _, actionId, _ ->
|
||||
|
@ -77,6 +77,10 @@ class LoginFragment @Inject constructor() : AbstractSSOLoginFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupForgottenPasswordButton() {
|
||||
forgetPasswordButton.setOnClickListener { forgetPasswordClicked() }
|
||||
}
|
||||
|
||||
private fun setupAutoFill(state: LoginViewState) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
when (state.signMode) {
|
||||
|
@ -96,8 +100,7 @@ class LoginFragment @Inject constructor() : AbstractSSOLoginFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginSubmit)
|
||||
fun submit() {
|
||||
private fun submit() {
|
||||
cleanupUi()
|
||||
|
||||
val login = loginField.text.toString()
|
||||
|
@ -200,6 +203,7 @@ class LoginFragment @Inject constructor() : AbstractSSOLoginFragment() {
|
|||
}
|
||||
|
||||
private fun setupSubmitButton() {
|
||||
loginSubmit.setOnClickListener { submit() }
|
||||
Observable
|
||||
.combineLatest(
|
||||
loginField.textChanges().map { it.trim().isNotEmpty() },
|
||||
|
@ -216,8 +220,7 @@ class LoginFragment @Inject constructor() : AbstractSSOLoginFragment() {
|
|||
.disposeOnDestroyView()
|
||||
}
|
||||
|
||||
@OnClick(R.id.forgetPasswordButton)
|
||||
fun forgetPasswordClicked() {
|
||||
private fun forgetPasswordClicked() {
|
||||
loginViewModel.handle(LoginAction.PostViewEvent(LoginViewEvents.OnForgetPasswordClicked))
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.text.InputType
|
|||
import android.view.View
|
||||
import androidx.autofill.HintConstants
|
||||
import androidx.core.view.isVisible
|
||||
import butterknife.OnClick
|
||||
import com.airbnb.mvrx.args
|
||||
import com.google.i18n.phonenumbers.NumberParseException
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil
|
||||
|
@ -64,12 +63,18 @@ class LoginGenericTextInputFormFragment @Inject constructor() : AbstractLoginFra
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
setupViews()
|
||||
setupUi()
|
||||
setupSubmitButton()
|
||||
setupTil()
|
||||
setupAutoFill()
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
loginGenericTextInputFormOtherButton.setOnClickListener { onOtherButtonClicked() }
|
||||
loginGenericTextInputFormSubmit.setOnClickListener { submit() }
|
||||
}
|
||||
|
||||
private fun setupAutoFill() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
loginGenericTextInputFormTextInput.setAutofillHints(
|
||||
|
@ -126,8 +131,7 @@ class LoginGenericTextInputFormFragment @Inject constructor() : AbstractLoginFra
|
|||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginGenericTextInputFormOtherButton)
|
||||
fun onOtherButtonClicked() {
|
||||
private fun onOtherButtonClicked() {
|
||||
when (params.mode) {
|
||||
TextInputFormFragmentMode.ConfirmMsisdn -> {
|
||||
loginViewModel.handle(LoginAction.SendAgainThreePid)
|
||||
|
@ -138,8 +142,7 @@ class LoginGenericTextInputFormFragment @Inject constructor() : AbstractLoginFra
|
|||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginGenericTextInputFormSubmit)
|
||||
fun submit() {
|
||||
private fun submit() {
|
||||
cleanupUi()
|
||||
val text = loginGenericTextInputFormTextInput.text.toString()
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ package im.vector.app.features.login
|
|||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import butterknife.OnClick
|
||||
import com.airbnb.mvrx.Fail
|
||||
import com.airbnb.mvrx.Loading
|
||||
import com.airbnb.mvrx.Success
|
||||
|
@ -59,6 +58,8 @@ class LoginResetPasswordFragment @Inject constructor() : AbstractLoginFragment()
|
|||
}
|
||||
|
||||
private fun setupSubmitButton() {
|
||||
resetPasswordSubmit.setOnClickListener { submit() }
|
||||
|
||||
Observable
|
||||
.combineLatest(
|
||||
resetPasswordEmail.textChanges().map { it.isEmail() },
|
||||
|
@ -75,8 +76,7 @@ class LoginResetPasswordFragment @Inject constructor() : AbstractLoginFragment()
|
|||
.disposeOnDestroyView()
|
||||
}
|
||||
|
||||
@OnClick(R.id.resetPasswordSubmit)
|
||||
fun submit() {
|
||||
private fun submit() {
|
||||
cleanupUi()
|
||||
|
||||
if (showWarning) {
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
|
||||
package im.vector.app.features.login
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import butterknife.OnClick
|
||||
import com.airbnb.mvrx.Fail
|
||||
import com.airbnb.mvrx.Success
|
||||
import im.vector.app.R
|
||||
|
@ -32,12 +33,17 @@ class LoginResetPasswordMailConfirmationFragment @Inject constructor() : Abstrac
|
|||
|
||||
override fun getLayoutResId() = R.layout.fragment_login_reset_password_mail_confirmation
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
resetPasswordMailConfirmationSubmit.setOnClickListener { submit() }
|
||||
}
|
||||
|
||||
private fun setupUi(state: LoginViewState) {
|
||||
resetPasswordMailConfirmationNotice.text = getString(R.string.login_reset_password_mail_confirmation_notice, state.resetPasswordEmail)
|
||||
}
|
||||
|
||||
@OnClick(R.id.resetPasswordMailConfirmationSubmit)
|
||||
fun submit() {
|
||||
private fun submit() {
|
||||
loginViewModel.handle(LoginAction.ResetPasswordMailConfirmed)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
|
||||
package im.vector.app.features.login
|
||||
|
||||
import butterknife.OnClick
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import im.vector.app.R
|
||||
import kotlinx.android.synthetic.main.fragment_login_reset_password_success.*
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
|
@ -27,8 +29,13 @@ class LoginResetPasswordSuccessFragment @Inject constructor() : AbstractLoginFra
|
|||
|
||||
override fun getLayoutResId() = R.layout.fragment_login_reset_password_success
|
||||
|
||||
@OnClick(R.id.resetPasswordSuccessSubmit)
|
||||
fun submit() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
resetPasswordSuccessSubmit.setOnClickListener { submit() }
|
||||
}
|
||||
|
||||
private fun submit() {
|
||||
loginViewModel.handle(LoginAction.PostViewEvent(LoginViewEvents.OnResetPasswordMailConfirmationSuccessDone))
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ package im.vector.app.features.login
|
|||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import butterknife.OnClick
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.utils.openUrlInChromeCustomTab
|
||||
import kotlinx.android.synthetic.main.fragment_login_server_selection.*
|
||||
|
@ -35,9 +34,18 @@ class LoginServerSelectionFragment @Inject constructor() : AbstractLoginFragment
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
initViews()
|
||||
initTextViews()
|
||||
}
|
||||
|
||||
private fun initViews() {
|
||||
loginServerChoiceEmsLearnMore.setOnClickListener { learnMore() }
|
||||
loginServerChoiceMatrixOrg.setOnClickListener { selectMatrixOrg() }
|
||||
loginServerChoiceEms.setOnClickListener { selectEMS() }
|
||||
loginServerChoiceOther.setOnClickListener { selectOther() }
|
||||
loginServerIKnowMyIdSubmit.setOnClickListener { loginWithMatrixId() }
|
||||
}
|
||||
|
||||
private fun updateSelectedChoice(state: LoginViewState) {
|
||||
loginServerChoiceMatrixOrg.isChecked = state.serverType == ServerType.MatrixOrg
|
||||
}
|
||||
|
@ -49,28 +57,23 @@ class LoginServerSelectionFragment @Inject constructor() : AbstractLoginFragment
|
|||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginServerChoiceEmsLearnMore)
|
||||
fun learnMore() {
|
||||
private fun learnMore() {
|
||||
openUrlInChromeCustomTab(requireActivity(), null, EMS_LINK)
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginServerChoiceMatrixOrg)
|
||||
fun selectMatrixOrg() {
|
||||
private fun selectMatrixOrg() {
|
||||
loginViewModel.handle(LoginAction.UpdateServerType(ServerType.MatrixOrg))
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginServerChoiceEms)
|
||||
fun selectEMS() {
|
||||
private fun selectEMS() {
|
||||
loginViewModel.handle(LoginAction.UpdateServerType(ServerType.EMS))
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginServerChoiceOther)
|
||||
fun selectOther() {
|
||||
private fun selectOther() {
|
||||
loginViewModel.handle(LoginAction.UpdateServerType(ServerType.Other))
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginServerIKnowMyIdSubmit)
|
||||
fun loginWithMatrixId() {
|
||||
private fun loginWithMatrixId() {
|
||||
loginViewModel.handle(LoginAction.UpdateSignMode(SignMode.SignInWithMatrixId))
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import android.view.inputmethod.EditorInfo
|
|||
import android.widget.ArrayAdapter
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import butterknife.OnClick
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import com.jakewharton.rxbinding3.widget.textChanges
|
||||
import im.vector.app.BuildConfig
|
||||
|
@ -46,9 +45,16 @@ class LoginServerUrlFormFragment @Inject constructor() : AbstractLoginFragment()
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
setupViews()
|
||||
setupHomeServerField()
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
loginServerUrlFormLearnMore.setOnClickListener { learnMore() }
|
||||
loginServerUrlFormClearHistory.setOnClickListener { clearHistory() }
|
||||
loginServerUrlFormSubmit.setOnClickListener { submit() }
|
||||
}
|
||||
|
||||
private fun setupHomeServerField() {
|
||||
loginServerUrlFormHomeServerUrl.textChanges()
|
||||
.subscribe {
|
||||
|
@ -86,7 +92,7 @@ class LoginServerUrlFormFragment @Inject constructor() : AbstractLoginFragment()
|
|||
loginServerUrlFormNotice.text = getString(R.string.login_server_url_form_common_notice)
|
||||
}
|
||||
}
|
||||
val completions = state.knownCustomHomeServersUrls + if (BuildConfig.DEBUG) listOf("http://10.0.2.2:8080") else emptyList()
|
||||
val completions = state.knownCustomHomeServersUrls + if (BuildConfig.DEBUG) listOf("http://10.0.2.2:8080") else emptyList()
|
||||
loginServerUrlFormHomeServerUrl.setAdapter(ArrayAdapter(
|
||||
requireContext(),
|
||||
R.layout.item_completion_homeserver,
|
||||
|
@ -97,13 +103,11 @@ class LoginServerUrlFormFragment @Inject constructor() : AbstractLoginFragment()
|
|||
?: TextInputLayout.END_ICON_NONE
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginServerUrlFormLearnMore)
|
||||
fun learnMore() {
|
||||
private fun learnMore() {
|
||||
openUrlInChromeCustomTab(requireActivity(), null, EMS_LINK)
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginServerUrlFormClearHistory)
|
||||
fun clearHistory() {
|
||||
private fun clearHistory() {
|
||||
loginViewModel.handle(LoginAction.ClearHomeServerHistory)
|
||||
}
|
||||
|
||||
|
@ -112,8 +116,7 @@ class LoginServerUrlFormFragment @Inject constructor() : AbstractLoginFragment()
|
|||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@OnClick(R.id.loginServerUrlFormSubmit)
|
||||
fun submit() {
|
||||
private fun submit() {
|
||||
cleanupUi()
|
||||
|
||||
// Static check of homeserver url, empty, malformed, etc.
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
|
||||
package im.vector.app.features.login
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import butterknife.OnClick
|
||||
import com.airbnb.mvrx.withState
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.toReducedUrl
|
||||
|
@ -31,6 +32,17 @@ class LoginSignUpSignInSelectionFragment @Inject constructor() : AbstractSSOLogi
|
|||
|
||||
override fun getLayoutResId() = R.layout.fragment_login_signup_signin_selection
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
setupViews()
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
loginSignupSigninSubmit.setOnClickListener { submit() }
|
||||
loginSignupSigninSignIn.setOnClickListener { signIn() }
|
||||
}
|
||||
|
||||
private fun setupUi(state: LoginViewState) {
|
||||
when (state.serverType) {
|
||||
ServerType.MatrixOrg -> {
|
||||
|
@ -39,18 +51,18 @@ class LoginSignUpSignInSelectionFragment @Inject constructor() : AbstractSSOLogi
|
|||
loginSignupSigninTitle.text = getString(R.string.login_connect_to, state.homeServerUrl.toReducedUrl())
|
||||
loginSignupSigninText.text = getString(R.string.login_server_matrix_org_text)
|
||||
}
|
||||
ServerType.EMS -> {
|
||||
ServerType.EMS -> {
|
||||
loginSignupSigninServerIcon.setImageResource(R.drawable.ic_logo_element_matrix_services)
|
||||
loginSignupSigninServerIcon.isVisible = true
|
||||
loginSignupSigninTitle.text = getString(R.string.login_connect_to_modular)
|
||||
loginSignupSigninText.text = state.homeServerUrl.toReducedUrl()
|
||||
}
|
||||
ServerType.Other -> {
|
||||
ServerType.Other -> {
|
||||
loginSignupSigninServerIcon.isVisible = false
|
||||
loginSignupSigninTitle.text = getString(R.string.login_server_other_title)
|
||||
loginSignupSigninText.text = getString(R.string.login_connect_to, state.homeServerUrl.toReducedUrl())
|
||||
}
|
||||
ServerType.Unknown -> Unit /* Should not happen */
|
||||
ServerType.Unknown -> Unit /* Should not happen */
|
||||
}
|
||||
|
||||
when (state.loginMode) {
|
||||
|
@ -86,18 +98,15 @@ class LoginSignUpSignInSelectionFragment @Inject constructor() : AbstractSSOLogi
|
|||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginSignupSigninSubmit)
|
||||
fun submit() = withState(loginViewModel) { state ->
|
||||
private fun submit() = withState(loginViewModel) { state ->
|
||||
if (state.loginMode is LoginMode.Sso) {
|
||||
openInCustomTab(state.getSsoUrl(null))
|
||||
} else {
|
||||
loginViewModel.handle(LoginAction.UpdateSignMode(SignMode.SignUp))
|
||||
}
|
||||
Unit
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginSignupSigninSignIn)
|
||||
fun signIn() {
|
||||
private fun signIn() {
|
||||
loginViewModel.handle(LoginAction.UpdateSignMode(SignMode.SignIn))
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,10 @@
|
|||
|
||||
package im.vector.app.features.login
|
||||
|
||||
import butterknife.OnClick
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import im.vector.app.R
|
||||
import kotlinx.android.synthetic.main.fragment_login_splash.*
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
|
@ -27,8 +29,17 @@ class LoginSplashFragment @Inject constructor() : AbstractLoginFragment() {
|
|||
|
||||
override fun getLayoutResId() = R.layout.fragment_login_splash
|
||||
|
||||
@OnClick(R.id.loginSplashSubmit)
|
||||
fun getStarted() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
setupViews()
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
loginSplashSubmit.setOnClickListener { getStarted() }
|
||||
}
|
||||
|
||||
private fun getStarted() {
|
||||
loginViewModel.handle(LoginAction.PostViewEvent(LoginViewEvents.OpenServerSelection))
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ package im.vector.app.features.login.terms
|
|||
import android.os.Bundle
|
||||
import android.os.Parcelable
|
||||
import android.view.View
|
||||
import butterknife.OnClick
|
||||
import com.airbnb.mvrx.args
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.cleanup
|
||||
|
@ -55,6 +54,8 @@ class LoginTermsFragment @Inject constructor(
|
|||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
setupViews()
|
||||
loginTermsPolicyList.configureWith(policyController)
|
||||
policyController.listener = this
|
||||
|
||||
|
@ -68,6 +69,10 @@ class LoginTermsFragment @Inject constructor(
|
|||
loginTermsViewState = LoginTermsViewState(list)
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
loginTermsSubmit.setOnClickListener { submit() }
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
loginTermsPolicyList.cleanup()
|
||||
policyController.listener = null
|
||||
|
@ -99,8 +104,7 @@ class LoginTermsFragment @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.loginTermsSubmit)
|
||||
internal fun submit() {
|
||||
private fun submit() {
|
||||
loginViewModel.handle(LoginAction.AcceptTerms)
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,7 @@ import android.view.Menu
|
|||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.isVisible
|
||||
import butterknife.OnCheckedChanged
|
||||
import butterknife.OnTextChanged
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.di.ScreenComponent
|
||||
import im.vector.app.core.platform.VectorBaseActivity
|
||||
|
@ -43,6 +42,7 @@ class BugReportActivity : VectorBaseActivity() {
|
|||
|
||||
override fun initUiAndData() {
|
||||
configureToolbar(bugReportToolbar)
|
||||
setupViews()
|
||||
|
||||
if (bugReporter.screenshot != null) {
|
||||
bug_report_screenshot_preview.setImageBitmap(bugReporter.screenshot)
|
||||
|
@ -78,6 +78,11 @@ class BugReportActivity : VectorBaseActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
bug_report_edit_text.doOnTextChanged { _, _, _, _ -> textChanged() }
|
||||
bug_report_button_include_screenshot.setOnCheckedChangeListener { _, _ -> onSendScreenshotChanged() }
|
||||
}
|
||||
|
||||
override fun getMenuRes() = R.menu.bug_report
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
||||
|
@ -186,12 +191,10 @@ class BugReportActivity : VectorBaseActivity() {
|
|||
* UI Event
|
||||
* ========================================================================================== */
|
||||
|
||||
@OnTextChanged(R.id.bug_report_edit_text)
|
||||
internal fun textChanged() {
|
||||
private fun textChanged() {
|
||||
bug_report_text_input_layout.error = null
|
||||
}
|
||||
|
||||
@OnCheckedChanged(R.id.bug_report_button_include_screenshot)
|
||||
internal fun onSendScreenshotChanged() {
|
||||
bug_report_screenshot_preview.isVisible = bug_report_button_include_screenshot.isChecked && bugReporter.screenshot != null
|
||||
}
|
||||
|
|
|
@ -18,11 +18,12 @@ package im.vector.app.features.signout.hard
|
|||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import butterknife.OnClick
|
||||
import android.os.Bundle
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.platform.VectorBaseActivity
|
||||
import im.vector.app.features.MainActivity
|
||||
import im.vector.app.features.MainActivityArgs
|
||||
import kotlinx.android.synthetic.main.activity_signed_out.*
|
||||
import org.matrix.android.sdk.api.failure.GlobalError
|
||||
import timber.log.Timber
|
||||
|
||||
|
@ -33,8 +34,17 @@ class SignedOutActivity : VectorBaseActivity() {
|
|||
|
||||
override fun getLayoutRes() = R.layout.activity_signed_out
|
||||
|
||||
@OnClick(R.id.signedOutSubmit)
|
||||
fun submit() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setupViews()
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
signedOutSubmit.setOnClickListener { submit() }
|
||||
}
|
||||
|
||||
private fun submit() {
|
||||
// All is already cleared when we are here
|
||||
MainActivity.restartApp(this, MainActivityArgs())
|
||||
}
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
package im.vector.app.features.widgets.permissions
|
||||
|
||||
import android.content.DialogInterface
|
||||
import android.os.Bundle
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.style.BulletSpan
|
||||
import butterknife.OnClick
|
||||
import android.view.View
|
||||
import com.airbnb.mvrx.MvRx
|
||||
import com.airbnb.mvrx.activityViewModel
|
||||
import com.airbnb.mvrx.withState
|
||||
|
@ -50,6 +51,17 @@ class RoomWidgetPermissionBottomSheet : VectorBaseBottomSheetDialogFragment() {
|
|||
// Use this if you don't need the full activity view model
|
||||
var directListener: ((Boolean) -> Unit)? = null
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
setupViews()
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
widgetPermissionDecline.setOnClickListener { doDecline() }
|
||||
widgetPermissionContinue.setOnClickListener { doAccept() }
|
||||
}
|
||||
|
||||
override fun invalidate() = withState(viewModel) { state ->
|
||||
super.invalidate()
|
||||
val permissionData = state.permissionData() ?: return@withState
|
||||
|
@ -76,16 +88,14 @@ class RoomWidgetPermissionBottomSheet : VectorBaseBottomSheetDialogFragment() {
|
|||
widgetPermissionSharedInfo.text = infoBuilder
|
||||
}
|
||||
|
||||
@OnClick(R.id.widgetPermissionDecline)
|
||||
fun doDecline() {
|
||||
private fun doDecline() {
|
||||
viewModel.handle(RoomWidgetPermissionActions.BlockWidget)
|
||||
directListener?.invoke(false)
|
||||
// optimistic dismiss
|
||||
dismiss()
|
||||
}
|
||||
|
||||
@OnClick(R.id.widgetPermissionContinue)
|
||||
fun doAccept() {
|
||||
private fun doAccept() {
|
||||
viewModel.handle(RoomWidgetPermissionActions.AllowWidget)
|
||||
directListener?.invoke(true)
|
||||
// optimistic dismiss
|
||||
|
|
Loading…
Reference in a new issue