]> git.ktnx.net Git - mobile-ledger-staging.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/utils/Misc.java
showSoftKeyboard(fragment): delegate to showSoftKeyboard(fragment.getActivity())
[mobile-ledger-staging.git] / app / src / main / java / net / ktnx / mobileledger / utils / Misc.java
index ee6f5a746cf0f44761ee29bbf3bf3774084bc192..16ad9e2c3c933cc769077031170fce86d899101c 100644 (file)
 
 package net.ktnx.mobileledger.utils;
 
+import android.app.Activity;
+import android.view.WindowManager;
+
+import androidx.fragment.app.Fragment;
+
 public class Misc {
     public static boolean isZero(float f) {
         return (f < 0.005) && (f > -0.005);
     }
+    public static void showSoftKeyboard(Activity activity) {
+        // make the keyboard appear
+        activity.getWindow()
+                .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+    }
+    public static void showSoftKeyboard(Fragment fragment) {
+        showSoftKeyboard(fragment.getActivity());
+    }
 }