#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;
|
package org.shadowice.flocke.andotp.Activities;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -44,6 +45,7 @@ import android.view.View;
|
||||||
import android.view.ViewStub;
|
import android.view.ViewStub;
|
||||||
import android.view.WindowManager.LayoutParams;
|
import android.view.WindowManager.LayoutParams;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
@ -193,11 +195,22 @@ public class AuthenticateActivity extends BaseActivity
|
||||||
|
|
||||||
private void checkBackgroundTask() {
|
private void checkBackgroundTask() {
|
||||||
TaskFragment taskFragment = findTaskFragment();
|
TaskFragment taskFragment = findTaskFragment();
|
||||||
if (taskFragment != null && !taskFragment.task.isCanceled()) {
|
if (taskFragment != null) {
|
||||||
|
if (taskFragment.task.isCanceled()) {
|
||||||
|
resetPasswordInput();
|
||||||
|
} else {
|
||||||
taskFragment.task.setCallback(this::handleResult);
|
taskFragment.task.setCallback(this::handleResult);
|
||||||
setupUiForTaskState(true);
|
setupUiForTaskState(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetPasswordInput() {
|
||||||
|
passwordInput.setText("");
|
||||||
|
passwordInput.requestFocus();
|
||||||
|
InputMethodManager keyboard = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
keyboard.showSoftInput(passwordInput, 0);
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private TaskFragment findTaskFragment() {
|
private TaskFragment findTaskFragment() {
|
||||||
|
|
Loading…
Reference in a new issue