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"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
android:versionCode="155"
android:versionName="1.4.5" >
android:versionCode="156"
android:versionName="1.4.6" >
<uses-sdk
android:minSdkVersion="8"

View File

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

View File

@ -3,8 +3,10 @@ package org.fox.ttrss;
import org.fox.ttrss.util.DatabaseHelper;
import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.Display;
@ -26,25 +28,21 @@ public class CommonActivity extends FragmentActivity {
private boolean m_smallScreenMode = true;
private boolean m_compatMode = false;
protected SharedPreferences m_prefs;
protected void setSmallScreen(boolean smallScreen) {
Log.d(TAG, "m_smallScreenMode=" + smallScreen);
m_smallScreenMode = smallScreen;
}
public boolean getUnreadArticlesOnly() {
return GlobalState.getInstance().m_unreadArticlesOnly;
}
public boolean getUnreadOnly() {
return GlobalState.getInstance().m_unreadOnly;
return m_prefs.getBoolean("show_unread_only", false);
}
public void setUnreadOnly(boolean unread) {
GlobalState.getInstance().m_unreadOnly = unread;
}
public void setUnreadArticlesOnly(boolean unread) {
GlobalState.getInstance().m_unreadArticlesOnly = unread;
SharedPreferences.Editor editor = m_prefs.edit();
editor.putBoolean("show_unread_only", unread);
editor.commit();
}
public void setLoadingStatus(int status, boolean showProgress) {
@ -94,6 +92,9 @@ public class CommonActivity extends FragmentActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
m_prefs = PreferenceManager
.getDefaultSharedPreferences(getApplicationContext());
initDatabase();
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 Article m_activeArticle;
public int m_selectedArticleId;
public boolean m_unreadOnly = true;
public boolean m_unreadArticlesOnly = true;
public String m_sessionId;
public int m_apiLevel;
public boolean m_canUseProgress;

View File

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