[Android] Util method setKeyboardVisibility
Geoffrey Métais
git at videolan.org
Fri Apr 1 15:36:17 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Apr 1 15:23:03 2016 +0200| [f9795130310b408925df91c7bcade7cfb4067fb8] | committer: Geoffrey Métais
Util method setKeyboardVisibility
> https://code.videolan.org/videolan/vlc-android/commit/f9795130310b408925df91c7bcade7cfb4067fb8
---
vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
index 3722e20..b63611c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java
@@ -23,6 +23,7 @@
package org.videolan.vlc.gui.helpers;
+import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.TypedArray;
@@ -41,6 +42,7 @@ import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.RotateAnimation;
+import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView;
import android.widget.TextView;
@@ -195,4 +197,17 @@ public class UiTools {
}
});
}
+
+ public static void setKeyboardVisibility(final View v, final boolean show) {
+ final InputMethodManager inputMethodManager = (InputMethodManager) VLCApplication.getAppContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
+ sHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ if (show)
+ inputMethodManager.showSoftInput(v, InputMethodManager.SHOW_FORCED);
+ else
+ inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
+ }
+ });
+ }
}
More information about the Android
mailing list