Skip to content

Commit

Permalink
#109,#110: fixed not restored unit states after restoring minimized a…
Browse files Browse the repository at this point in the history
…pplication
  • Loading branch information
bugy committed Nov 5, 2017
1 parent fec2875 commit dce29cf
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions SheLi/src/main/java/net/buggy/shoplist/ShopListActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,34 @@ public void run() {
});
synchronizer.start();

if (savedInstanceState == null) {
if (savedInstanceState != null) {
restoreState(savedInstanceState);
}

initMenu();
}

@Override
protected void onStart() {
super.onStart();

if (activeUnits.isEmpty()) {
final UnitNavigator<ShopListActivity> navigator = navigators.get(0);
currentNavigatorName = navigator.getText();
navigator.navigate();

} else {
restoreState(savedInstanceState);

restartUnits();
}
}

initMenu();
@Override
protected void onStop() {
super.onStop();

for (UnitDescriptor unit : activeUnits) {
unit.getUnit().stop();
}
}

@Override
Expand Down Expand Up @@ -625,15 +640,6 @@ public void stopUnit(Unit unit) {
}
}

@Override
protected void onStop() {
for (UnitDescriptor unit : activeUnits) {
unit.getUnit().stop();
}

super.onStop();
}

private void stopUnit(UnitDescriptor descriptor) {
activeUnits.remove(descriptor);

Expand Down

0 comments on commit dce29cf

Please sign in to comment.