X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Futils%2FMisc.java;h=8698e0bc346f58d1763f3c5f658387eeb0102c2e;hp=3fae49f1665a6e28bd583a67d5564e351b9878b7;hb=e0a0823e0084b51cc5252f9f2f230efa956dc097;hpb=ec8e98c8095ed1368ae8b35c8b8ef6e59b9bcb2f diff --git a/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java b/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java index 3fae49f1..8698e0bc 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/Misc.java @@ -18,6 +18,7 @@ package net.ktnx.mobileledger.utils; import android.app.Activity; +import android.content.res.Configuration; import android.view.WindowManager; import androidx.fragment.app.Fragment; @@ -28,13 +29,13 @@ public class Misc { } public static void showSoftKeyboard(Activity activity) { // make the keyboard appear - activity.getWindow() - .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); + Configuration cf = activity.getResources() + .getConfiguration(); + if (cf.keyboardHidden == Configuration.KEYBOARDHIDDEN_YES) + activity.getWindow() + .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); } public static void showSoftKeyboard(Fragment fragment) { - // make the keyboard appear - fragment.getActivity() - .getWindow() - .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); + showSoftKeyboard(fragment.getActivity()); } }