Prevent crash

pull/156/head
M66B 6 years ago
parent 6e54c67429
commit b80f7db3cb

@ -2942,6 +2942,8 @@ public class FragmentCompose extends FragmentBase {
ibReferenceEdit.setVisibility(text[1] == null ? View.GONE : View.VISIBLE); ibReferenceEdit.setVisibility(text[1] == null ? View.GONE : View.VISIBLE);
ibReferenceImages.setVisibility(ref_has_images && !show_images ? View.VISIBLE : View.GONE); ibReferenceImages.setVisibility(ref_has_images && !show_images ? View.VISIBLE : View.GONE);
final Context context = getContext();
new Handler().post(new Runnable() { new Handler().post(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -2955,12 +2957,13 @@ public class FragmentCompose extends FragmentBase {
target.requestFocus(); target.requestFocus();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean keyboard = prefs.getBoolean("keyboard", true); boolean keyboard = prefs.getBoolean("keyboard", true);
if (keyboard) { if (keyboard) {
InputMethodManager imm = InputMethodManager imm =
(InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(target, InputMethodManager.SHOW_IMPLICIT); if (imm != null)
imm.showSoftInput(target, InputMethodManager.SHOW_IMPLICIT);
} }
} }
}); });

Loading…
Cancel
Save