mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-25 06:58:39 +00:00
# added preference to base activity
# fixed very unlikely lifecycle bug in LoginActivity
This commit is contained in:
+9
@@ -6,6 +6,7 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@@ -53,6 +54,8 @@ public abstract class BaseActivity extends LoggableActivity {
|
||||
}
|
||||
|
||||
private static final String TAG = BaseActivity.class.getName();
|
||||
|
||||
protected AppPreferences preferences;
|
||||
|
||||
protected MenuItem menuItemLive;
|
||||
|
||||
@@ -65,6 +68,12 @@ public abstract class BaseActivity extends LoggableActivity {
|
||||
public BaseActivity() {
|
||||
this.sendingServiceConnection = new EventSendingServiceConnection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
this.preferences = AppPreferences.on(getApplicationContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
|
||||
+4
-3
@@ -177,9 +177,10 @@ public class LoginActivity extends BaseActivity implements EventSelectedListener
|
||||
|
||||
@Override
|
||||
public void onDialogPositiveButton(AttachedDialogFragment dialog) {
|
||||
AppPreferences preferences = AppPreferences.on(dialog.getActivity());
|
||||
preferences.setAuthor(loginDialog.getAuthor());
|
||||
switch (loginDialog.getSelectedLoginType()) {
|
||||
// We have to take the passed instance, LoginActivity.this might be a new instance!
|
||||
LoginDialog localLoginDialog = (LoginDialog) dialog;
|
||||
preferences.setAuthor(localLoginDialog.getAuthor());
|
||||
switch (localLoginDialog.getSelectedLoginType()) {
|
||||
case OFFICER:
|
||||
ExLog.i(TAG, "Communication with backend is active.");
|
||||
preferences.setSendingActive(true);
|
||||
|
||||
Reference in New Issue
Block a user