Make quick response UI in settings toggleable
b/16302932 Change-Id: I24b289ffbecd4f127e6109b56c0af7f9c4b00879
This commit is contained in:
parent
5c93d36616
commit
e9e2a21d87
@ -23,4 +23,7 @@
|
|||||||
<fraction name="manual_setup_disabled_alpha">40%</fraction>
|
<fraction name="manual_setup_disabled_alpha">40%</fraction>
|
||||||
<!-- Alpha value for 'manual setup' button when enabled -->
|
<!-- Alpha value for 'manual setup' button when enabled -->
|
||||||
<fraction name="manual_setup_enabled_alpha">100%</fraction>
|
<fraction name="manual_setup_enabled_alpha">100%</fraction>
|
||||||
|
|
||||||
|
<!-- Boolean value indicating if quick responses are supported -->
|
||||||
|
<bool name="quickresponse_supported">true</bool>
|
||||||
</resources>
|
</resources>
|
@ -178,6 +178,13 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
|
|||||||
// Load the preferences from an XML resource
|
// Load the preferences from an XML resource
|
||||||
addPreferencesFromResource(R.xml.account_settings_preferences);
|
addPreferencesFromResource(R.xml.account_settings_preferences);
|
||||||
|
|
||||||
|
if (!getResources().getBoolean(R.bool.quickresponse_supported)) {
|
||||||
|
final Preference quickResponsePref = findPreference(PREFERENCE_QUICK_RESPONSES);
|
||||||
|
if (quickResponsePref != null) {
|
||||||
|
getPreferenceScreen().removePreference(quickResponsePref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Start loading the account data, if provided in the arguments
|
// Start loading the account data, if provided in the arguments
|
||||||
// If not, activity must call startLoadingAccount() directly
|
// If not, activity must call startLoadingAccount() directly
|
||||||
Bundle b = getArguments();
|
Bundle b = getArguments();
|
||||||
@ -633,7 +640,9 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
|
|||||||
mAccountName = (EditTextPreference) findPreference(PREFERENCE_NAME);
|
mAccountName = (EditTextPreference) findPreference(PREFERENCE_NAME);
|
||||||
String senderName = mUiAccount.getSenderName();
|
String senderName = mUiAccount.getSenderName();
|
||||||
// In rare cases, sendername will be null; Change this to empty string to avoid NPE's
|
// In rare cases, sendername will be null; Change this to empty string to avoid NPE's
|
||||||
if (senderName == null) senderName = "";
|
if (senderName == null) {
|
||||||
|
senderName = "";
|
||||||
|
}
|
||||||
mAccountName.setSummary(senderName);
|
mAccountName.setSummary(senderName);
|
||||||
mAccountName.setText(senderName);
|
mAccountName.setText(senderName);
|
||||||
mAccountName.setOnPreferenceChangeListener(this);
|
mAccountName.setOnPreferenceChangeListener(this);
|
||||||
@ -671,7 +680,9 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
|
|||||||
mCheckFrequency.setSummary(mCheckFrequency.getEntry());
|
mCheckFrequency.setSummary(mCheckFrequency.getEntry());
|
||||||
mCheckFrequency.setOnPreferenceChangeListener(this);
|
mCheckFrequency.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
findPreference(PREFERENCE_QUICK_RESPONSES).setOnPreferenceClickListener(
|
final Preference quickResponsePref = findPreference(PREFERENCE_QUICK_RESPONSES);
|
||||||
|
if (quickResponsePref != null) {
|
||||||
|
quickResponsePref.setOnPreferenceClickListener(
|
||||||
new Preference.OnPreferenceClickListener() {
|
new Preference.OnPreferenceClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
@ -679,9 +690,10 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Add check window preference
|
// Add check window preference
|
||||||
PreferenceCategory dataUsageCategory =
|
final PreferenceCategory dataUsageCategory =
|
||||||
(PreferenceCategory) findPreference(PREFERENCE_CATEGORY_DATA_USAGE);
|
(PreferenceCategory) findPreference(PREFERENCE_CATEGORY_DATA_USAGE);
|
||||||
|
|
||||||
if (mServiceInfo.offerLookback) {
|
if (mServiceInfo.offerLookback) {
|
||||||
@ -707,7 +719,7 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
|
|||||||
mSyncWindow.setOnPreferenceChangeListener(this);
|
mSyncWindow.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
PreferenceCategory folderPrefs =
|
final PreferenceCategory folderPrefs =
|
||||||
(PreferenceCategory) findPreference(PREFERENCE_SYSTEM_FOLDERS);
|
(PreferenceCategory) findPreference(PREFERENCE_SYSTEM_FOLDERS);
|
||||||
if (folderPrefs != null) {
|
if (folderPrefs != null) {
|
||||||
if (mServiceInfo.requiresSetup) {
|
if (mServiceInfo.requiresSetup) {
|
||||||
@ -729,7 +741,7 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBoxPreference backgroundAttachments = (CheckBoxPreference)
|
final CheckBoxPreference backgroundAttachments = (CheckBoxPreference)
|
||||||
findPreference(PREFERENCE_BACKGROUND_ATTACHMENTS);
|
findPreference(PREFERENCE_BACKGROUND_ATTACHMENTS);
|
||||||
if (backgroundAttachments != null) {
|
if (backgroundAttachments != null) {
|
||||||
if (!mServiceInfo.offerAttachmentPreload) {
|
if (!mServiceInfo.offerAttachmentPreload) {
|
||||||
@ -842,7 +854,7 @@ public class AccountSettingsFragment extends MailAccountPrefsFragment
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Hide the outgoing account setup link if it's not activated
|
// Hide the outgoing account setup link if it's not activated
|
||||||
Preference prefOutgoing = findPreference(PREFERENCE_OUTGOING);
|
final Preference prefOutgoing = findPreference(PREFERENCE_OUTGOING);
|
||||||
if (prefOutgoing != null) {
|
if (prefOutgoing != null) {
|
||||||
if (mServiceInfo.usesSmtp && mAccount.mHostAuthSend != null) {
|
if (mServiceInfo.usesSmtp && mAccount.mHostAuthSend != null) {
|
||||||
prefOutgoing.setOnPreferenceClickListener(
|
prefOutgoing.setOnPreferenceClickListener(
|
||||||
|
Loading…
Reference in New Issue
Block a user