Skip to content
Snippets Groups Projects
Commit dbc646a1 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

migration cleanup

Change-Id: I3af1d23f9b8f658e9f199eac2ef5810030e14f8d
parent b5095505
No related branches found
No related tags found
No related merge requests found
...@@ -61,21 +61,19 @@ class AccountMigrationFragment : Fragment() { ...@@ -61,21 +61,19 @@ class AccountMigrationFragment : Fragment() {
} }
override fun onCreateView(inflater: LayoutInflater, parent: ViewGroup?, savedInstanceState: Bundle?): View { override fun onCreateView(inflater: LayoutInflater, parent: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FragAccountMigrationBinding.inflate(inflater, parent, false) return FragAccountMigrationBinding.inflate(inflater, parent, false).apply {
return binding!!.root ringPassword.setOnEditorActionListener { v: TextView, actionId: Int, event: KeyEvent? ->
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
binding!!.ringPassword.setOnEditorActionListener { v: TextView, actionId: Int, event: KeyEvent? ->
actionId == EditorInfo.IME_ACTION_NEXT && checkPassword(v, null) actionId == EditorInfo.IME_ACTION_NEXT && checkPassword(v, null)
} }
binding!!.ringPassword.onFocusChangeListener = View.OnFocusChangeListener { v: View, hasFocus: Boolean -> ringPassword.onFocusChangeListener = View.OnFocusChangeListener { v: View, hasFocus: Boolean ->
if (!hasFocus) { if (!hasFocus) {
checkPassword(v as TextView, null) checkPassword(v as TextView, null)
} }
} }
binding!!.ringMigrateBtn.setOnClickListener { initAccountMigration(binding!!.ringPassword.text.toString()) } ringMigrateBtn.setOnClickListener { initAccountMigration(ringPassword.text.toString()) }
binding!!.deleteBtn.setOnClickListener { initAccountDelete() } deleteBtn.setOnClickListener { initAccountDelete() }
binding = this
}.root
} }
override fun onResume() { override fun onResume() {
...@@ -150,17 +148,13 @@ class AccountMigrationFragment : Fragment() { ...@@ -150,17 +148,13 @@ class AccountMigrationFragment : Fragment() {
private fun handleMigrationState(newState: String) { private fun handleMigrationState(newState: String) {
migratingAccount = false migratingAccount = false
if (TextUtils.isEmpty(newState)) { mProgress?.let { progress ->
if (mProgress != null) { progress.dismiss()
mProgress!!.dismiss()
mProgress = null mProgress = null
} }
if (TextUtils.isEmpty(newState)) {
return return
} }
if (mProgress != null) {
mProgress!!.dismiss()
mProgress = null
}
val dialogBuilder: AlertDialog.Builder = MaterialAlertDialogBuilder(requireContext()) val dialogBuilder: AlertDialog.Builder = MaterialAlertDialogBuilder(requireContext())
dialogBuilder.setPositiveButton(android.R.string.ok) { dialog: DialogInterface?, id: Int -> } dialogBuilder.setPositiveButton(android.R.string.ok) { dialog: DialogInterface?, id: Int -> }
var success = false var success = false
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment