Merge branch 'master' of git@github.com:gothfox/Tiny-Tiny-RSS-for-Honeycomb.git

This commit is contained in:
Andrew Dolgov 2011-12-19 14:08:59 +03:00
commit adf1750387
4 changed files with 34 additions and 4 deletions

View File

@ -11,6 +11,8 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application <application
android:allowBackup="true"
android:backupAgent="PrefsBackupAgent"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:icon="@drawable/icon" android:icon="@drawable/icon"
android:label="@string/app_name" > android:label="@string/app_name" >
@ -43,6 +45,10 @@
<activity <activity
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:name="com.google.ads.AdActivity" /> android:name="com.google.ads.AdActivity" />
<meta-data android:name="com.google.android.backup.api_key"
android:value="AEdPqrEAAAAIwG6zsGB4qo6ZhjfwIJpm9WI7AqmWaoRXm6ZJnA" />
</application> </application>
</manifest> </manifest>

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();

View File

@ -0,0 +1,19 @@
package org.fox.ttrss;
import android.app.backup.BackupAgentHelper;
import android.app.backup.SharedPreferencesBackupHelper;
public class PrefsBackupAgent extends BackupAgentHelper {
// The name of the SharedPreferences file
static final String PREFS = "org.fox.ttrss_preferences";
// A key to uniquely identify the set of backup data
static final String PREFS_BACKUP_KEY = "prefs";
// Allocate a helper and add it to the backup agent
@Override
public void onCreate() {
SharedPreferencesBackupHelper helper = new SharedPreferencesBackupHelper(this, PREFS);
addHelper(PREFS_BACKUP_KEY, helper);
}
}