From 957c1b2513e755f02ab091ba1eedd43e7e8b3700 Mon Sep 17 00:00:00 2001 From: Maxime Biais Date: Fri, 14 Nov 2014 16:00:30 +0100 Subject: [PATCH] first step at replacing PreferenceActivity by a PreferenceFragment + ActionBarActivity --- .../wordpress/android/util/ActivityUtils.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 WordPressUtils/src/main/java/org/wordpress/android/util/ActivityUtils.java diff --git a/WordPressUtils/src/main/java/org/wordpress/android/util/ActivityUtils.java b/WordPressUtils/src/main/java/org/wordpress/android/util/ActivityUtils.java new file mode 100644 index 000000000000..396e06c37459 --- /dev/null +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/ActivityUtils.java @@ -0,0 +1,16 @@ +package org.wordpress.android.util; + +import android.app.Activity; +import android.content.Context; +import android.view.inputmethod.InputMethodManager; + +public class ActivityUtils { + public static void hideKeyboard(Activity activity) { + if (activity != null && activity.getCurrentFocus() != null) { + InputMethodManager inputManager = (InputMethodManager) activity.getSystemService( + Context.INPUT_METHOD_SERVICE); + inputManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(), + InputMethodManager.HIDE_NOT_ALWAYS); + } + } +}