diff --git a/app/src/main/java/eu/faircode/email/FragmentAccounts.java b/app/src/main/java/eu/faircode/email/FragmentAccounts.java index 04d0f44f2d..80832a628a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccounts.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccounts.java @@ -272,7 +272,7 @@ public class FragmentAccounts extends FragmentBase { @Override public boolean onLongClick(View v) { FragmentDialogIdentity.onDrafts( - getActivity(), + getContext(), getViewLifecycleOwner(), getParentFragmentManager(), fabCompose, -1L); diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogIdentity.java b/app/src/main/java/eu/faircode/email/FragmentDialogIdentity.java index c6a8259a14..441d3e1b29 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogIdentity.java @@ -38,9 +38,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.constraintlayout.widget.Group; -import androidx.core.view.GravityCompat; -import androidx.core.widget.NestedScrollView; -import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; import androidx.lifecycle.LifecycleOwner; import androidx.localbroadcastmanager.content.LocalBroadcastManager; @@ -249,21 +246,7 @@ public class FragmentDialogIdentity extends FragmentDialogBase { }.execute(context, owner, args, "identity:compose"); } - static void onDrafts(FragmentActivity activity, LifecycleOwner owner, FragmentManager manager, FloatingActionButton fabCompose, long account) { - if (activity == null) - return; - - if (BuildConfig.DEBUG) { - DrawerLayoutEx drawerLayout = activity.findViewById(R.id.drawer_layout); - NestedScrollView drawerContainer = activity.findViewById(R.id.drawer_container); - if (drawerLayout != null && - drawerContainer != null && - !drawerLayout.isLocked(drawerContainer)) { - drawerLayout.openDrawer(GravityCompat.START); - return; - } - } - + static void onDrafts(Context context, LifecycleOwner owner, FragmentManager manager, FloatingActionButton fabCompose, long account) { Bundle args = new Bundle(); args.putLong("account", account); @@ -294,7 +277,7 @@ public class FragmentDialogIdentity extends FragmentDialogBase { if (drafts == null) return; - LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(activity); + LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context); lbm.sendBroadcast( new Intent(ActivityView.ACTION_VIEW_MESSAGES) .putExtra("account", drafts.account) @@ -306,6 +289,6 @@ public class FragmentDialogIdentity extends FragmentDialogBase { protected void onException(Bundle args, Throwable ex) { Log.unexpectedError(manager, ex); } - }.execute(activity, owner, args, "view:drafts"); + }.execute(context, owner, args, "view:drafts"); } } diff --git a/app/src/main/java/eu/faircode/email/FragmentFolders.java b/app/src/main/java/eu/faircode/email/FragmentFolders.java index ad3645cbbc..6492cd8678 100644 --- a/app/src/main/java/eu/faircode/email/FragmentFolders.java +++ b/app/src/main/java/eu/faircode/email/FragmentFolders.java @@ -376,7 +376,7 @@ public class FragmentFolders extends FragmentBase { @Override public boolean onLongClick(View v) { FragmentDialogIdentity.onDrafts( - getActivity(), + getContext(), getViewLifecycleOwner(), getParentFragmentManager(), fabCompose, account); diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index b85ea97867..d318ee5265 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -1507,7 +1507,7 @@ public class FragmentMessages extends FragmentBase @Override public boolean onLongClick(View v) { FragmentDialogIdentity.onDrafts( - getActivity(), + getContext(), getViewLifecycleOwner(), getParentFragmentManager(), fabCompose, account);