fragments: Be extra paranoid about the binding getting destroyed

Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
Samuel Holland 2018-01-16 23:12:49 -06:00
parent 54f201174d
commit 8dde6c3c0f

View File

@ -130,6 +130,7 @@ public class TunnelListFragment extends BaseFragment {
public void onRequestCreateConfig(@SuppressWarnings("unused") final View view) { public void onRequestCreateConfig(@SuppressWarnings("unused") final View view) {
startActivity(new Intent(getActivity(), TunnelCreatorActivity.class)); startActivity(new Intent(getActivity(), TunnelCreatorActivity.class));
if (binding != null)
binding.createMenu.collapse(); binding.createMenu.collapse();
} }
@ -138,6 +139,7 @@ public class TunnelListFragment extends BaseFragment {
intent.addCategory(Intent.CATEGORY_OPENABLE); intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*"); intent.setType("*/*");
startActivityForResult(intent, REQUEST_IMPORT); startActivityForResult(intent, REQUEST_IMPORT);
if (binding != null)
binding.createMenu.collapse(); binding.createMenu.collapse();
} }
@ -261,6 +263,7 @@ public class TunnelListFragment extends BaseFragment {
final int position, final long id) { final int position, final long id) {
if (actionMode != null) if (actionMode != null)
return false; return false;
if (binding != null)
binding.tunnelList.setItemChecked(position, true); binding.tunnelList.setItemChecked(position, true);
return true; return true;
} }
@ -268,6 +271,7 @@ public class TunnelListFragment extends BaseFragment {
@Override @Override
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
public boolean onTouch(final View view, final MotionEvent motionEvent) { public boolean onTouch(final View view, final MotionEvent motionEvent) {
if (binding != null)
binding.createMenu.collapse(); binding.createMenu.collapse();
return false; return false;
} }