1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-01-11 21:58:35 -05:00

Don't show a disabled preference if there is nothing a user can do to enable it.

This commit is contained in:
Joe Steele 2013-04-04 12:00:18 -04:00
parent f363333c87
commit 0ecc49815f

View File

@ -17,6 +17,7 @@ import android.preference.CheckBoxPreference;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener; import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.text.TextUtils; import android.text.TextUtils;
import android.widget.Toast; import android.widget.Toast;
@ -94,6 +95,7 @@ public class Prefs extends K9PreferenceActivity {
private static final int ACTIVITY_CHOOSE_FOLDER = 1; private static final int ACTIVITY_CHOOSE_FOLDER = 1;
private static final String PREFERENCE_CATEGORY_MESSAGEVIEW_PREFERENCES = "messageview_preferences";
private ListPreference mLanguage; private ListPreference mLanguage;
private ListPreference mTheme; private ListPreference mTheme;
@ -282,11 +284,10 @@ public class Prefs extends K9PreferenceActivity {
mShowNext.setChecked(K9.messageViewShowNext()); mShowNext.setChecked(K9.messageViewShowNext());
mMobileOptimizedLayout = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_MOBILE_LAYOUT); mMobileOptimizedLayout = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_MOBILE_LAYOUT);
mMobileOptimizedLayout.setChecked(K9.mobileOptimizedLayout());
if (!MessageWebView.isSingleColumnLayoutSupported()) { if (!MessageWebView.isSingleColumnLayoutSupported()) {
mMobileOptimizedLayout.setEnabled(false); PreferenceCategory category = (PreferenceCategory) findPreference(PREFERENCE_CATEGORY_MESSAGEVIEW_PREFERENCES);
mMobileOptimizedLayout.setChecked(false); category.removePreference(mMobileOptimizedLayout);
} else {
mMobileOptimizedLayout.setChecked(K9.mobileOptimizedLayout());
} }
mQuietTimeEnabled = (CheckBoxPreference) findPreference(PREFERENCE_QUIET_TIME_ENABLED); mQuietTimeEnabled = (CheckBoxPreference) findPreference(PREFERENCE_QUIET_TIME_ENABLED);