Start doing checkbox preferences with on/off summaries
This commit is contained in:
parent
1b83bf38ac
commit
1b6a643b9c
@ -128,9 +128,11 @@
|
||||
<string name="show_incompat_versions">Incompatible versions</string>
|
||||
<string name="show_incompat_versions_l">Show versions of apps that are incompatible with the device</string>
|
||||
<string name="rooted">Root</string>
|
||||
<string name="rooted_long">Show apps that require root privileges</string>
|
||||
<string name="rooted_on">Do not grey out apps requiring root privileges</string>
|
||||
<string name="rooted_off">Grey out apps requiring root privileges</string>
|
||||
<string name="ignoreTouch">Ignore Touchscreen</string>
|
||||
<string name="ignoreTouch_long">Always include apps that require touchscreen</string>
|
||||
<string name="ignoreTouch_on">Always include apps that require touchscreen</string>
|
||||
<string name="ignoreTouch_off">Filter apps normally</string>
|
||||
|
||||
<string name="category_all">All</string>
|
||||
<string name="category_whatsnew">What\'s New</string>
|
||||
@ -153,7 +155,8 @@
|
||||
<string name="showPermissions_long">Display a list of permissions an app needs</string>
|
||||
<string name="no_handler_app">You don\'t have any available app that can handle %s</string>
|
||||
<string name="compactlayout">Compact Layout</string>
|
||||
<string name="compactlayout_long">Only show app names and summaries in list</string>
|
||||
<string name="compactlayout_on">Show icons at regular size</string>
|
||||
<string name="compactlayout_off">Show icons at a smaller size</string>
|
||||
<string name="theme">Theme</string>
|
||||
<string name="theme_long">Choose a theme to use</string>
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
android:defaultValue="false" android:summary="@string/showPermissions_long"
|
||||
android:key="showPermissions"/>
|
||||
<CheckBoxPreference android:title="@string/compactlayout"
|
||||
android:defaultValue="false" android:summary="@string/compactlayout_long"
|
||||
android:defaultValue="false" android:summary="@string/compactlayout_off"
|
||||
android:key="compactlayout"/>
|
||||
<ListPreference android:title="@string/theme"
|
||||
android:summary="@string/theme_long" android:key="theme"
|
||||
@ -37,10 +37,10 @@
|
||||
android:defaultValue="false" android:summary="@string/show_incompat_versions_l"
|
||||
android:key="incompatibleVersions" />
|
||||
<CheckBoxPreference android:title="@string/rooted"
|
||||
android:defaultValue="true" android:summary="@string/rooted_long"
|
||||
android:defaultValue="true" android:summary="@string/rooted_on"
|
||||
android:key="rooted" />
|
||||
<CheckBoxPreference android:title="@string/ignoreTouch"
|
||||
android:defaultValue="false" android:summary="@string/ignoreTouch_long"
|
||||
android:defaultValue="false" android:summary="@string/ignoreTouch_off"
|
||||
android:key="ignoreTouchscreen" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/other">
|
||||
|
@ -32,6 +32,7 @@ public class Preferences implements SharedPreferences.OnSharedPreferenceChangeLi
|
||||
public static final String PREF_INCOMP_VER = "incompatibleVersions";
|
||||
public static final String PREF_THEME = "theme";
|
||||
public static final String PREF_COMPACT_LAYOUT = "compactlayout";
|
||||
public static final String PREF_IGN_TOUCH = "ignoreTouchscreen";
|
||||
|
||||
private static final boolean DEFAULT_COMPACT_LAYOUT = false;
|
||||
|
||||
|
@ -19,9 +19,9 @@
|
||||
package org.fdroid.fdroid;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.view.MenuItem;
|
||||
@ -53,8 +53,8 @@ public class PreferencesActivity extends PreferenceActivity implements
|
||||
getPreferenceScreen().getSharedPreferences()
|
||||
.registerOnSharedPreferenceChangeListener(
|
||||
(OnSharedPreferenceChangeListener)this);
|
||||
CheckBoxPreference onlyOnWifi = (CheckBoxPreference)
|
||||
findPreference(Preferences.PREF_UPD_WIFI_ONLY);
|
||||
Preference onlyOnWifi = findPreference(
|
||||
Preferences.PREF_UPD_WIFI_ONLY);
|
||||
onlyOnWifi.setEnabled(Integer.parseInt(((ListPreference)
|
||||
findPreference(Preferences.PREF_UPD_INTERVAL))
|
||||
.getValue()) > 0);
|
||||
@ -83,12 +83,27 @@ public class PreferencesActivity extends PreferenceActivity implements
|
||||
if (key.equals(Preferences.PREF_UPD_INTERVAL)) {
|
||||
int interval = Integer.parseInt(
|
||||
sharedPreferences.getString(key, "").toString());
|
||||
CheckBoxPreference onlyOnWifi = (CheckBoxPreference)
|
||||
findPreference(Preferences.PREF_UPD_WIFI_ONLY);
|
||||
Preference onlyOnWifi = findPreference(
|
||||
Preferences.PREF_UPD_WIFI_ONLY);
|
||||
onlyOnWifi.setEnabled(interval > 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.equals(Preferences.PREF_COMPACT_LAYOUT)) {
|
||||
Preference pref = findPreference(Preferences.PREF_COMPACT_LAYOUT);
|
||||
if (sharedPreferences.getBoolean(
|
||||
Preferences.PREF_COMPACT_LAYOUT, false)) {
|
||||
pref.setSummary(R.string.compactlayout_on);
|
||||
} else {
|
||||
pref.setSummary(R.string.compactlayout_off);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.equals(Preferences.PREF_COMPACT_LAYOUT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.equals(Preferences.PREF_INCOMP_VER)) {
|
||||
result ^= RESULT_RELOAD;
|
||||
setResult(result);
|
||||
@ -98,8 +113,27 @@ public class PreferencesActivity extends PreferenceActivity implements
|
||||
if (key.equals(Preferences.PREF_ROOTED)) {
|
||||
result ^= RESULT_REFILTER;
|
||||
setResult(result);
|
||||
Preference pref = findPreference(Preferences.PREF_ROOTED);
|
||||
if (sharedPreferences.getBoolean(
|
||||
Preferences.PREF_ROOTED, false)) {
|
||||
pref.setSummary(R.string.rooted_on);
|
||||
} else {
|
||||
pref.setSummary(R.string.rooted_off);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.equals(Preferences.PREF_IGN_TOUCH)) {
|
||||
Preference pref = findPreference(Preferences.PREF_IGN_TOUCH);
|
||||
if (sharedPreferences.getBoolean(
|
||||
Preferences.PREF_IGN_TOUCH, false)) {
|
||||
pref.setSummary(R.string.ignoreTouch_on);
|
||||
} else {
|
||||
pref.setSummary(R.string.ignoreTouch_off);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.equals(Preferences.PREF_THEME)) {
|
||||
result |= RESULT_RESTART;
|
||||
setResult(result);
|
||||
|
Loading…
x
Reference in New Issue
Block a user