From cf3357d49b3bb9ebb5f4526aeb5cfb53b8fc900d Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 21 Mar 2012 09:38:58 +0300 Subject: [PATCH] add some preference key dependency tracking --- AndroidManifest.xml | 4 ++-- res/xml/preferences.xml | 3 ++- src/org/fox/ttrss/PreferencesActivity.java | 22 ++++++++++++++++++++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 18f6f664..8d7b08db 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="72" + android:versionName="0.5.7" > diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 91efa29b..291a5ce5 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -49,7 +49,7 @@ - + diff --git a/src/org/fox/ttrss/PreferencesActivity.java b/src/org/fox/ttrss/PreferencesActivity.java index 742320f7..41fb00f2 100644 --- a/src/org/fox/ttrss/PreferencesActivity.java +++ b/src/org/fox/ttrss/PreferencesActivity.java @@ -1,8 +1,13 @@ package org.fox.ttrss; +import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Bundle; +import android.preference.Preference; +import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceActivity; +import android.preference.PreferenceCategory; +import android.preference.PreferenceManager; public class PreferencesActivity extends PreferenceActivity { @@ -10,11 +15,24 @@ public class PreferencesActivity extends PreferenceActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + SharedPreferences prefs = PreferenceManager + .getDefaultSharedPreferences(getApplicationContext()); + addPreferencesFromResource(R.xml.preferences); if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_XLARGE) { - getPreferenceScreen().removePreference( - findPreference("tablet_article_swipe")); + PreferenceCategory category = (PreferenceCategory)findPreference("category_look_and_feel"); + category.removePreference(findPreference("tablet_article_swipe")); } + + findPreference("justify_article_text").setEnabled(!prefs.getBoolean("combined_mode", false)); + + findPreference("combined_mode").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + findPreference("justify_article_text").setEnabled(!newValue.toString().equals("true")); + return true; + } + }); } }