|
1 | 1 | package fr.free.nrw.commons.auth; |
2 | 2 |
|
3 | | -import static android.view.KeyEvent.KEYCODE_ENTER; |
4 | | -import static android.view.View.VISIBLE; |
5 | | -import static android.view.inputmethod.EditorInfo.IME_ACTION_DONE; |
6 | | -import static fr.free.nrw.commons.di.NetworkingModule.NAMED_COMMONS_WIKI_SITE; |
7 | | - |
8 | 3 | import android.accounts.AccountAuthenticatorActivity; |
9 | 4 | import android.app.ProgressDialog; |
10 | 5 | import android.content.Context; |
|
18 | 13 | import android.view.MenuItem; |
19 | 14 | import android.view.View; |
20 | 15 | import android.view.ViewGroup; |
| 16 | +import android.view.inputmethod.InputMethodManager; |
21 | 17 | import android.widget.Button; |
22 | 18 | import android.widget.EditText; |
23 | 19 | import android.widget.TextView; |
| 20 | + |
24 | 21 | import androidx.annotation.ColorRes; |
25 | 22 | import androidx.annotation.NonNull; |
26 | 23 | import androidx.annotation.Nullable; |
|
29 | 26 | import androidx.appcompat.app.AppCompatDelegate; |
30 | 27 | import androidx.core.app.NavUtils; |
31 | 28 | import androidx.core.content.ContextCompat; |
| 29 | + |
| 30 | +import com.google.android.material.textfield.TextInputLayout; |
| 31 | + |
| 32 | +import org.wikipedia.AppAdapter; |
| 33 | +import org.wikipedia.dataclient.ServiceFactory; |
| 34 | +import org.wikipedia.dataclient.WikiSite; |
| 35 | +import org.wikipedia.dataclient.mwapi.MwQueryResponse; |
| 36 | +import org.wikipedia.login.LoginClient; |
| 37 | +import org.wikipedia.login.LoginClient.LoginCallback; |
| 38 | +import org.wikipedia.login.LoginResult; |
| 39 | + |
| 40 | +import javax.inject.Inject; |
| 41 | +import javax.inject.Named; |
| 42 | + |
32 | 43 | import butterknife.BindView; |
33 | 44 | import butterknife.ButterKnife; |
34 | 45 | import butterknife.OnClick; |
35 | 46 | import butterknife.OnEditorAction; |
36 | 47 | import butterknife.OnFocusChange; |
37 | | -import com.google.android.material.textfield.TextInputLayout; |
38 | 48 | import fr.free.nrw.commons.BuildConfig; |
39 | 49 | import fr.free.nrw.commons.R; |
40 | 50 | import fr.free.nrw.commons.Utils; |
|
47 | 57 | import fr.free.nrw.commons.utils.ConfigUtils; |
48 | 58 | import fr.free.nrw.commons.utils.ViewUtil; |
49 | 59 | import io.reactivex.disposables.CompositeDisposable; |
50 | | -import javax.inject.Inject; |
51 | | -import javax.inject.Named; |
52 | | -import org.wikipedia.AppAdapter; |
53 | | -import org.wikipedia.dataclient.ServiceFactory; |
54 | | -import org.wikipedia.dataclient.WikiSite; |
55 | | -import org.wikipedia.dataclient.mwapi.MwQueryResponse; |
56 | | -import org.wikipedia.login.LoginClient; |
57 | | -import org.wikipedia.login.LoginClient.LoginCallback; |
58 | | -import org.wikipedia.login.LoginResult; |
59 | 60 | import retrofit2.Call; |
60 | 61 | import retrofit2.Callback; |
61 | 62 | import retrofit2.Response; |
62 | 63 | import timber.log.Timber; |
63 | 64 |
|
| 65 | +import static android.view.KeyEvent.KEYCODE_ENTER; |
| 66 | +import static android.view.View.VISIBLE; |
| 67 | +import static android.view.inputmethod.EditorInfo.IME_ACTION_DONE; |
| 68 | +import static fr.free.nrw.commons.di.NetworkingModule.NAMED_COMMONS_WIKI_SITE; |
| 69 | + |
64 | 70 | public class LoginActivity extends AccountAuthenticatorActivity { |
65 | 71 |
|
66 | 72 | @Inject |
@@ -383,6 +389,9 @@ public void askUserForTwoFactorAuth() { |
383 | 389 | progressDialog.dismiss(); |
384 | 390 | twoFactorContainer.setVisibility(VISIBLE); |
385 | 391 | twoFactorEdit.setVisibility(VISIBLE); |
| 392 | + twoFactorEdit.requestFocus(); |
| 393 | + InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); |
| 394 | + imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); |
386 | 395 | showMessageAndCancelDialog(R.string.login_failed_2fa_needed); |
387 | 396 | } |
388 | 397 |
|
|
0 commit comments