mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-28 20:06:29 +01:00
Small improvement
This commit is contained in:
@@ -44,6 +44,7 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -22,6 +22,7 @@ package eu.faircode.email;
|
||||
import static android.app.ActionBar.DISPLAY_SHOW_CUSTOM;
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.RecoverableSecurityException;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
@@ -36,6 +37,7 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.ResultReceiver;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -347,7 +349,7 @@ public class FragmentBase extends Fragment {
|
||||
try {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity != null) {
|
||||
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
InputMethodManager imm = Helper.getSystemService(activity, InputMethodManager.class);
|
||||
View focused = activity.getCurrentFocus();
|
||||
if (imm != null && focused != null)
|
||||
imm.hideSoftInputFromWindow(focused.getWindowToken(), 0);
|
||||
|
||||
@@ -1493,8 +1493,7 @@ public class Helper {
|
||||
|
||||
static void showKeyboard(final View view) {
|
||||
final Context context = view.getContext();
|
||||
InputMethodManager imm =
|
||||
(InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
InputMethodManager imm = Helper.getSystemService(context, InputMethodManager.class);
|
||||
if (imm == null)
|
||||
return;
|
||||
|
||||
@@ -1513,8 +1512,7 @@ public class Helper {
|
||||
|
||||
static void hideKeyboard(final View view) {
|
||||
final Context context = view.getContext();
|
||||
InputMethodManager imm =
|
||||
(InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
InputMethodManager imm = Helper.getSystemService(context, InputMethodManager.class);
|
||||
if (imm == null)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user