Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update lists #403

Merged
merged 13 commits into from
Jan 28, 2017
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
<activity android:name="fr.gaulupeau.apps.Poche.ui.ArticlesListActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SEARCH" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<activity
android:name="fr.gaulupeau.apps.Poche.ui.ReadArticleActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class LegacySettingsHelper {
static final String CUSTOM_SSL_SETTINGS = "custom_ssl_settings";
static final String FONT_SIZE = "font_size";
static final String SERIF_FONT = "serif_font";
static final String LIST_LIMIT = "list_limit";
static final String USERNAME = "username";
static final String PASSWORD = "password";
static final String HTTP_AUTH_USERNAME = "http_auth_username";
Expand Down Expand Up @@ -74,8 +73,6 @@ static boolean migrateLegacySettings(Context cx, SharedPreferences pref) {
}
migrateBooleanPref(cx, SERIF_FONT, R.string.pref_key_ui_article_fontSerif, legacyPref, prefEditor);

migrateIntPref(cx, LIST_LIMIT, R.string.pref_key_ui_lists_limit, legacyPref, prefEditor, 50);

migrateStringPref(cx, THEME, R.string.pref_key_ui_theme, legacyPref, prefEditor);

migrateBooleanPref(cx, TTS_VISIBLE, R.string.pref_key_tts_visible, legacyPref, prefEditor);
Expand Down
18 changes: 14 additions & 4 deletions app/src/main/java/fr/gaulupeau/apps/Poche/data/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import fr.gaulupeau.apps.Poche.App;
import fr.gaulupeau.apps.Poche.network.ConnectivityChangeReceiver;
import fr.gaulupeau.apps.Poche.service.WallabagJobService;
import fr.gaulupeau.apps.Poche.ui.ArticlesListFragment;
import fr.gaulupeau.apps.Poche.ui.HttpSchemeHandlerActivity;
import fr.gaulupeau.apps.Poche.ui.Themes;
import fr.gaulupeau.apps.Poche.ui.preferences.ConnectionWizardActivity;
Expand Down Expand Up @@ -350,12 +351,21 @@ public void setArticleFontSerif(boolean value) {
setBoolean(R.string.pref_key_ui_article_fontSerif, value);
}

public int getArticlesListLimit() {
return getInt(R.string.pref_key_ui_lists_limit, 100);
public ArticlesListFragment.SortOrder getListSortOrder() {
String sortOrderParam = getString(R.string.pref_key_ui_lists_sortOrder);

ArticlesListFragment.SortOrder sortOrder = null;
if(sortOrderParam != null) {
try {
sortOrder = ArticlesListFragment.SortOrder.valueOf(sortOrderParam);
} catch(IllegalArgumentException ignored) {}
}

return sortOrder != null ? sortOrder : ArticlesListFragment.SortOrder.DESC;
}

public void setArticlesListLimit(int limit) {
setInt(R.string.pref_key_ui_lists_limit, limit);
public void setListSortOrder(ArticlesListFragment.SortOrder sortOrder) {
setString(R.string.pref_key_ui_lists_sortOrder, sortOrder.toString());
}

public Themes.Theme getTheme() {
Expand Down
Loading