Commit 62812518 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

account edition: cleanup, check for null

Change-Id: Id095715acc91b4140fe0e5e9ec81b5b3c75eca59
parent 47480ee3
...@@ -165,7 +165,7 @@ public class AccountEditionFragment extends BaseSupportFragment<AccountEditionPr ...@@ -165,7 +165,7 @@ public class AccountEditionFragment extends BaseSupportFragment<AccountEditionPr
} }
@Override @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onCreateOptionsMenu(Menu menu, @NonNull MenuInflater inflater) {
menu.clear(); menu.clear();
} }
...@@ -182,7 +182,10 @@ public class AccountEditionFragment extends BaseSupportFragment<AccountEditionPr ...@@ -182,7 +182,10 @@ public class AccountEditionFragment extends BaseSupportFragment<AccountEditionPr
} }
public boolean onBackPressed() { public boolean onBackPressed() {
if (mBinding == null)
return false;
mIsVisible = false; mIsVisible = false;
if (getActivity() instanceof HomeActivity) if (getActivity() instanceof HomeActivity)
((HomeActivity) getActivity()).setToolbarOutlineState(true); ((HomeActivity) getActivity()).setToolbarOutlineState(true);
if (mBinding.fragmentContainer.getVisibility() != View.VISIBLE) { if (mBinding.fragmentContainer.getVisibility() != View.VISIBLE) {
...@@ -213,14 +216,15 @@ public class AccountEditionFragment extends BaseSupportFragment<AccountEditionPr ...@@ -213,14 +216,15 @@ public class AccountEditionFragment extends BaseSupportFragment<AccountEditionPr
} }
private void setBackListenerEnabled(boolean enable) { private void setBackListenerEnabled(boolean enable) {
if (getActivity() instanceof HomeActivity) Activity activity = getActivity();
((HomeActivity) getActivity()).setAccountFragmentOnBackPressedListener(enable ? this : null); if (activity instanceof HomeActivity)
((HomeActivity) activity).setAccountFragmentOnBackPressedListener(enable ? this : null);
} }
private static class PreferencesPagerAdapter extends FragmentStatePagerAdapter { private static class PreferencesPagerAdapter extends FragmentStatePagerAdapter {
private Context mContext; private final Context mContext;
private String accountId; private final String accountId;
private boolean isJamiAccount; private final boolean isJamiAccount;
PreferencesPagerAdapter(FragmentManager fm, Context mContext, String accountId, boolean isJamiAccount) { PreferencesPagerAdapter(FragmentManager fm, Context mContext, String accountId, boolean isJamiAccount) {
super(fm); super(fm);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment