make sure show_unread_only setting persists, bump version

This commit is contained in:
Andrew Dolgov 2013-04-04 10:41:34 +04:00
parent 437afb42a1
commit 22302be4f9
5 changed files with 17 additions and 17 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss" package="org.fox.ttrss"
android:versionCode="155" android:versionCode="156"
android:versionName="1.4.5" > android:versionName="1.4.6" >
<uses-sdk <uses-sdk
android:minSdkVersion="8" android:minSdkVersion="8"

View File

@ -194,7 +194,6 @@ public class ArticlePager extends Fragment {
final Feed feed = m_feed; final Feed feed = m_feed;
final String sessionId = m_activity.getSessionId(); final String sessionId = m_activity.getSessionId();
final boolean showUnread = m_activity.getUnreadArticlesOnly();
int skip = 0; int skip = 0;
if (append) { if (append) {

View File

@ -3,8 +3,10 @@ package org.fox.ttrss;
import org.fox.ttrss.util.DatabaseHelper; import org.fox.ttrss.util.DatabaseHelper;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.util.Log; import android.util.Log;
import android.view.Display; import android.view.Display;
@ -26,27 +28,23 @@ public class CommonActivity extends FragmentActivity {
private boolean m_smallScreenMode = true; private boolean m_smallScreenMode = true;
private boolean m_compatMode = false; private boolean m_compatMode = false;
protected SharedPreferences m_prefs;
protected void setSmallScreen(boolean smallScreen) { protected void setSmallScreen(boolean smallScreen) {
Log.d(TAG, "m_smallScreenMode=" + smallScreen); Log.d(TAG, "m_smallScreenMode=" + smallScreen);
m_smallScreenMode = smallScreen; m_smallScreenMode = smallScreen;
} }
public boolean getUnreadArticlesOnly() {
return GlobalState.getInstance().m_unreadArticlesOnly;
}
public boolean getUnreadOnly() { public boolean getUnreadOnly() {
return GlobalState.getInstance().m_unreadOnly; return m_prefs.getBoolean("show_unread_only", false);
} }
public void setUnreadOnly(boolean unread) { public void setUnreadOnly(boolean unread) {
GlobalState.getInstance().m_unreadOnly = unread; SharedPreferences.Editor editor = m_prefs.edit();
editor.putBoolean("show_unread_only", unread);
editor.commit();
} }
public void setUnreadArticlesOnly(boolean unread) {
GlobalState.getInstance().m_unreadArticlesOnly = unread;
}
public void setLoadingStatus(int status, boolean showProgress) { public void setLoadingStatus(int status, boolean showProgress) {
TextView tv = (TextView) findViewById(R.id.loading_message); TextView tv = (TextView) findViewById(R.id.loading_message);
@ -94,6 +92,9 @@ public class CommonActivity extends FragmentActivity {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
m_prefs = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
initDatabase(); initDatabase();
m_compatMode = android.os.Build.VERSION.SDK_INT <= 10; m_compatMode = android.os.Build.VERSION.SDK_INT <= 10;

View File

@ -17,8 +17,6 @@ public class GlobalState extends Application {
public Feed m_activeFeed; public Feed m_activeFeed;
public Article m_activeArticle; public Article m_activeArticle;
public int m_selectedArticleId; public int m_selectedArticleId;
public boolean m_unreadOnly = true;
public boolean m_unreadArticlesOnly = true;
public String m_sessionId; public String m_sessionId;
public int m_apiLevel; public int m_apiLevel;
public boolean m_canUseProgress; public boolean m_canUseProgress;

View File

@ -133,10 +133,11 @@ public class OnlineActivity extends CommonActivity {
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
ApiRequest.disableConnectionReuseIfNecessary();
// we use that before parent onCreate so let's init locally
m_prefs = PreferenceManager m_prefs = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext()); .getDefaultSharedPreferences(getApplicationContext());
ApiRequest.disableConnectionReuseIfNecessary();
if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) { if (m_prefs.getString("theme", "THEME_DARK").equals("THEME_DARK")) {
setTheme(R.style.DarkTheme); setTheme(R.style.DarkTheme);
@ -1605,4 +1606,5 @@ public class OnlineActivity extends CommonActivity {
public String getLastContentImageHitTestUrl() { public String getLastContentImageHitTestUrl() {
return m_lastImageHitTestUrl; return m_lastImageHitTestUrl;
} }
} }