(Hopefully) fixed crash when user moved on after loading the labels took too long
This commit is contained in:
parent
8057980f6c
commit
ccfeb5b479
@ -104,6 +104,8 @@ public class MainActivity extends AppCompatActivity
|
|||||||
|
|
||||||
private static WeakReference<MainActivity> instance;
|
private static WeakReference<MainActivity> instance;
|
||||||
|
|
||||||
|
private boolean active;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the activity is in two-pane mode, i.e. running on a tablet
|
* Whether or not the activity is in two-pane mode, i.e. running on a tablet
|
||||||
* device.
|
* device.
|
||||||
@ -196,7 +198,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private <F extends Fragment & ListHolder> void changeList(F listFragment) {
|
private <F extends Fragment & ListHolder> void changeList(F listFragment) {
|
||||||
|
if (active) {
|
||||||
FragmentTransaction transaction = getSupportFragmentManager()
|
FragmentTransaction transaction = getSupportFragmentManager()
|
||||||
.beginTransaction();
|
.beginTransaction();
|
||||||
transaction.replace(R.id.item_list, listFragment);
|
transaction.replace(R.id.item_list, listFragment);
|
||||||
@ -212,6 +214,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
listFragment.setActivateOnItemClick(true);
|
listFragment.setActivateOnItemClick(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void createDrawer(Toolbar toolbar) {
|
private void createDrawer(Toolbar toolbar) {
|
||||||
final ArrayList<IProfile> profiles = new ArrayList<>();
|
final ArrayList<IProfile> profiles = new ArrayList<>();
|
||||||
@ -337,7 +340,7 @@ public class MainActivity extends AppCompatActivity
|
|||||||
ListHolder listHolder = (ListHolder) listFragment;
|
ListHolder listHolder = (ListHolder) listFragment;
|
||||||
if (listHolder.showPreviousList()) {
|
if (listHolder.showPreviousList()) {
|
||||||
IDrawerItem drawerItem = drawer.getDrawerItem(listHolder.getCurrentLabel());
|
IDrawerItem drawerItem = drawer.getDrawerItem(listHolder.getCurrentLabel());
|
||||||
if (drawerItem != null){
|
if (drawerItem != null) {
|
||||||
drawer.setSelection(drawerItem);
|
drawer.setSelection(drawerItem);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -414,9 +417,16 @@ public class MainActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
updateNodeSwitch();
|
updateNodeSwitch();
|
||||||
Singleton.getMessageListener(this).resetNotification();
|
Singleton.getMessageListener(this).resetNotification();
|
||||||
|
active = true;
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
active = false;
|
||||||
|
}
|
||||||
|
|
||||||
public void addIdentityEntry(BitmessageAddress identity) {
|
public void addIdentityEntry(BitmessageAddress identity) {
|
||||||
IProfile newProfile = new ProfileDrawerItem()
|
IProfile newProfile = new ProfileDrawerItem()
|
||||||
.withIcon(new Identicon(identity))
|
.withIcon(new Identicon(identity))
|
||||||
|
Loading…
Reference in New Issue
Block a user