add some preference key dependency tracking

This commit is contained in:
Andrew Dolgov 2012-03-21 09:38:58 +03:00
parent 9a1dbdc74f
commit cf3357d49b
3 changed files with 24 additions and 5 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="71"
android:versionName="0.5.6" >
android:versionCode="72"
android:versionName="0.5.7" >
<uses-sdk android:minSdkVersion="7" />

View File

@ -49,7 +49,7 @@
</EditTextPreference>
</PreferenceCategory>
<PreferenceCategory android:title="@string/look_and_feel" >
<PreferenceCategory android:key="category_look_and_feel" android:title="@string/look_and_feel" >
<ListPreference
android:defaultValue="THEME_DARK"
@ -84,6 +84,7 @@
<CheckBoxPreference
android:defaultValue="false"
android:key="browse_cats_like_feeds"
android:dependency="enable_cats"
android:summary="@string/browse_cats_like_feeds_summary"
android:title="@string/browse_cats_like_feeds" />

View File

@ -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;
}
});
}
}