Commit dbc646a1 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

migration cleanup

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