Browse Source

Prevent crash

main
M66B 6 years ago
parent
commit
351c6af58e
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      app/src/main/java/eu/faircode/email/FragmentCompose.java

+ 8
- 2
app/src/main/java/eu/faircode/email/FragmentCompose.java View File

@ -20,6 +20,7 @@ package eu.faircode.email;
*/ */
import android.Manifest; import android.Manifest;
import android.app.Activity;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -193,7 +194,9 @@ public class FragmentCompose extends FragmentEx {
public void onFocusChange(View view, boolean hasFocus) { public void onFocusChange(View view, boolean hasFocus) {
free = hasFocus; free = hasFocus;
getActivity().invalidateOptionsMenu();
Activity activity = getActivity();
if (activity != null)
activity.invalidateOptionsMenu();
grpHeader.setVisibility(hasFocus ? View.GONE : View.VISIBLE); grpHeader.setVisibility(hasFocus ? View.GONE : View.VISIBLE);
if (hasFocus) { if (hasFocus) {
@ -213,7 +216,10 @@ public class FragmentCompose extends FragmentEx {
if (grpHeader.getVisibility() == View.GONE) { if (grpHeader.getVisibility() == View.GONE) {
free = false; free = false;
getActivity().invalidateOptionsMenu();
Activity activity = getActivity();
if (activity != null)
activity.invalidateOptionsMenu();
grpHeader.setVisibility(View.VISIBLE); grpHeader.setVisibility(View.VISIBLE);
if (addresses) if (addresses)
grpAddresses.setVisibility(View.VISIBLE); grpAddresses.setVisibility(View.VISIBLE);


Loading…
Cancel
Save