store offline mode status preference in a separate file to prevent

backing it up to the cloud
This commit is contained in:
Andrew Dolgov 2011-12-16 21:06:07 +03:00
parent 7f98676957
commit 288d90c4b0
2 changed files with 8 additions and 3 deletions

View File

@ -479,7 +479,9 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
registerReceiver(m_broadcastReceiver, filter); registerReceiver(m_broadcastReceiver, filter);
m_isOffline = m_prefs.getBoolean("offline_mode_active", false); SharedPreferences localPrefs = getSharedPreferences("localprefs", Context.MODE_PRIVATE);
m_isOffline = localPrefs.getBoolean("offline_mode_active", false);
Log.d(TAG, "m_isOffline=" + m_isOffline); Log.d(TAG, "m_isOffline=" + m_isOffline);
Log.d(TAG, "m_smallScreenMode=" + m_smallScreenMode); Log.d(TAG, "m_smallScreenMode=" + m_smallScreenMode);
@ -591,7 +593,8 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
public void onClick(DialogInterface dialog, public void onClick(DialogInterface dialog,
int which) { int which) {
SharedPreferences.Editor editor = m_prefs.edit(); SharedPreferences localPrefs = getSharedPreferences("localprefs", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = localPrefs.edit();
editor.putBoolean("offline_mode_active", true); editor.putBoolean("offline_mode_active", true);
editor.commit(); editor.commit();

View File

@ -5,6 +5,7 @@ import org.fox.ttrss.OnlineServices.RelativeArticle;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -215,7 +216,8 @@ public class OfflineActivity extends FragmentActivity implements
} }
private void switchOnline() { private void switchOnline() {
SharedPreferences.Editor editor = m_prefs.edit(); SharedPreferences localPrefs = getSharedPreferences("localprefs", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = localPrefs.edit();
editor.putBoolean("offline_mode_active", false); editor.putBoolean("offline_mode_active", false);
editor.commit(); editor.commit();