diff options
Diffstat (limited to 'org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java')
-rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java | 51 |
1 files changed, 13 insertions, 38 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java index 73efdcde..31f5749d 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java @@ -17,6 +17,7 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; +import android.os.Handler; import android.preference.PreferenceManager; import android.support.v4.app.DialogFragment; import android.support.v7.view.ActionMode; @@ -148,22 +149,9 @@ public class OnlineActivity extends CommonActivity { super.onCreate(savedInstanceState); -// SharedPreferences localPrefs = getSharedPreferences("localprefs", Context.MODE_PRIVATE); - SharedPreferences localPrefs = getSharedPreferences("localprefs", Context.MODE_PRIVATE); - boolean isOffline = localPrefs.getBoolean("offline_mode_active", false); - if (getIntent().getExtras() != null) { - if (getIntent().getBooleanExtra("forceSwitchOffline", false)) { - - NotificationManager nmgr = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); - nmgr.cancel(OfflineDownloadService.NOTIFY_DOWNLOAD_SUCCESS); - - isOffline = true; - } - } - Log.d(TAG, "m_isOffline=" + isOffline); setContentView(R.layout.activity_login); @@ -171,21 +159,21 @@ public class OnlineActivity extends CommonActivity { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); - //m_pullToRefreshAttacher = PullToRefreshAttacher.get(this); + if (getIntent().getExtras() != null) { + if (getIntent().getBooleanExtra("forceSwitchOffline", false)) { + isOffline = true; + } + } if (isOffline) { switchOfflineSuccess(); } else { checkTrial(false); - /* if (getIntent().getExtras() != null) { - Intent i = getIntent(); - } */ - if (savedInstanceState != null) { m_offlineModeStatus = savedInstanceState.getInt("offlineModeStatus"); } - + m_headlinesActionModeCallback = new HeadlinesActionModeCallback(); } } @@ -211,20 +199,8 @@ public class OnlineActivity extends CommonActivity { public void onClick(DialogInterface dialog, int which) { - ((OnlineActivity)getActivity()).setOfflineModeStatus(0); - - SharedPreferences localPrefs = getActivity().getSharedPreferences("localprefs", Context.MODE_PRIVATE); - SharedPreferences.Editor editor = localPrefs.edit(); - editor.putBoolean("offline_mode_active", true); - editor.apply(); + ((OnlineActivity)getActivity()).switchOfflineSuccess(); - Intent offline = new Intent( - getActivity(), - OfflineActivity.class); - offline.putExtra("initial", true); - startActivity(offline); - - getActivity().finish(); } }) .setNegativeButton(R.string.dialog_cancel, @@ -232,7 +208,7 @@ public class OnlineActivity extends CommonActivity { public void onClick(DialogInterface dialog, int which) { - ((OnlineActivity)getActivity()).setOfflineModeStatus(0); + ((OnlineActivity)getActivity()).cancelOfflineSync(); } }) @@ -240,10 +216,6 @@ public class OnlineActivity extends CommonActivity { } } - protected void setOfflineModeStatus(int status) { - m_offlineModeStatus = status; - } - protected void switchOffline() { if (m_offlineModeStatus == 2) { @@ -367,6 +339,9 @@ public class OnlineActivity extends CommonActivity { logout(); // setLoadingStatus(R.string.blank, false); + NotificationManager nmgr = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); + nmgr.cancel(OfflineDownloadService.NOTIFY_DOWNLOAD_SUCCESS); + SharedPreferences localPrefs = getSharedPreferences("localprefs", Context.MODE_PRIVATE); SharedPreferences.Editor editor = localPrefs.edit(); editor.putBoolean("offline_mode_active", true); @@ -1191,7 +1166,7 @@ public class OnlineActivity extends CommonActivity { @Override public void onResume() { super.onResume(); - + ApiCommon.trustAllHosts(m_prefs.getBoolean("ssl_trust_any", false), m_prefs.getBoolean("ssl_trust_any_host", false)); |