#635 - Reset password input field and refocus if coming back from cancelling authentication
This commit is contained in:
parent
75bc10e1aa
commit
d814dab8a8
1 changed files with 16 additions and 3 deletions
|
@ -23,6 +23,7 @@
|
|||
package org.shadowice.flocke.andotp.Activities;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -44,6 +45,7 @@ import android.view.View;
|
|||
import android.view.ViewStub;
|
||||
import android.view.WindowManager.LayoutParams;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ProgressBar;
|
||||
|
@ -193,12 +195,23 @@ public class AuthenticateActivity extends BaseActivity
|
|||
|
||||
private void checkBackgroundTask() {
|
||||
TaskFragment taskFragment = findTaskFragment();
|
||||
if (taskFragment != null && !taskFragment.task.isCanceled()) {
|
||||
taskFragment.task.setCallback(this::handleResult);
|
||||
setupUiForTaskState(true);
|
||||
if (taskFragment != null) {
|
||||
if (taskFragment.task.isCanceled()) {
|
||||
resetPasswordInput();
|
||||
} else {
|
||||
taskFragment.task.setCallback(this::handleResult);
|
||||
setupUiForTaskState(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void resetPasswordInput() {
|
||||
passwordInput.setText("");
|
||||
passwordInput.requestFocus();
|
||||
InputMethodManager keyboard = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
keyboard.showSoftInput(passwordInput, 0);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private TaskFragment findTaskFragment() {
|
||||
return (TaskFragment) getFragmentManager().findFragmentByTag(TAG_TASK_FRAGMENT);
|
||||
|
|
Loading…
Reference in a new issue