mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-09 22:01:02 +00:00
factoring commonalities between the different onReset() implementations and (temporarily?) re-activating the "Reload" menu item
This commit is contained in:
1 parent
ade3c5aed0
commit
0c76ad12ab
4 files changed
+12
-8
No files matched your search
@@ -6,7 +6,7 @@
|
||||
android:id="@+id/options_menu_reload"
|
||||
android:icon="@drawable/ic_menu_info_details"
|
||||
android:title="@string/options_menu_reload"
|
||||
android:visible="false"/>
|
||||
android:visible="true"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/options_menu_reset"
|
||||
|
||||
+8
-3
@@ -46,7 +46,6 @@ public class BaseActivity extends SendingServiceAwareActivity {
|
||||
case R.id.options_menu_reload:
|
||||
ExLog.i(this, TAG, "Clicked RESET");
|
||||
final boolean result = onReset();
|
||||
fadeActivity(LoginActivity.class, true);
|
||||
return result;
|
||||
|
||||
case R.id.options_menu_info:
|
||||
@@ -67,12 +66,18 @@ public class BaseActivity extends SendingServiceAwareActivity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Redefinitions should ensure this implementation is called, e.g., after user confirmation.
|
||||
* {@link #resetDataManager() Resets the data manager} (which all redefinitions must do) and then
|
||||
* fades this activity.
|
||||
*/
|
||||
protected boolean onReset() {
|
||||
resetDataManager();
|
||||
fadeActivity(LoginActivity.class, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void resetDataManager() {
|
||||
DataManager dataManager = (DataManager) DataManager.create(this);
|
||||
dataManager.resetAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -322,13 +322,13 @@ public class LoginActivity extends BaseActivity
|
||||
|
||||
@Override
|
||||
protected boolean onReset() {
|
||||
final boolean result = super.onReset();
|
||||
resetDataManager();
|
||||
Fragment courseAreaFragment = getFragmentManager().findFragmentByTag(CourseAreaListFragmentTag);
|
||||
if (courseAreaFragment != null) {
|
||||
getFragmentManager().beginTransaction().remove(courseAreaFragment).commitAllowingStateLoss();
|
||||
}
|
||||
recreate();
|
||||
return result;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-2
@@ -60,8 +60,7 @@ public abstract class SessionActivity extends BaseActivity {
|
||||
private void doLogout() {
|
||||
ExLog.i(this, TAG, "Do logout now!");
|
||||
preferences.isSetUp(false); //FIXME: Is that flag really needed or just data redundancy?
|
||||
super.onReset(); // consistently resets the InMemoryDataStore and the RaceStateService
|
||||
fadeActivity(LoginActivity.class, true);
|
||||
super.onReset(); // resets the data manager and fades the activity
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user