Commit 7ac64ace authored by Geoffrey Métais's avatar Geoffrey Métais

Avoid using app context from static call

(cherry picked from commit 5924da80)
parent 821b7902
......@@ -223,14 +223,13 @@ public class UiTools {
}
public static void setKeyboardVisibility(final View v, final boolean show) {
final InputMethodManager inputMethodManager = (InputMethodManager) VLCApplication.getAppContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
if (v == null) return;
final InputMethodManager inputMethodManager = (InputMethodManager) v.getContext().getApplicationContext().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);
if (show) inputMethodManager.showSoftInput(v, InputMethodManager.SHOW_FORCED);
else inputMethodManager.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment