Merge "Add preference for background downloading"
This commit is contained in:
commit
6a78be9623
|
@ -982,6 +982,15 @@ save attachment.</string>
|
|||
<!-- General preference: Text zoom. Value is "huge" (+2) [CHAR LIMIT=32] -->
|
||||
<string name="general_preference_text_zoom_huge">Huge</string>
|
||||
|
||||
<!-- General preference: Allow downloading of attachments in background -->
|
||||
<!-- Title of general preference for downloading attachments in background [CHAR LIMIT=32] -->
|
||||
<string name="general_preference_background_attachments_label">
|
||||
Automatically fetch attachments</string>
|
||||
<!-- Summary of general preference for downloading attachments in background [CHAR LIMIT=64] -->
|
||||
<string name="general_preference_background_attachments_summary">
|
||||
Download attachments for Inbox messages. (Not available for POP3 accounts.)
|
||||
</string>
|
||||
|
||||
<!-- Generic string for "current position" / "total number" [CHAR LIMIT=12] -->
|
||||
<string name="position_of_count"><xliff:g example="1">%1$d</xliff:g> of <xliff:g
|
||||
example="12">%2$s</xliff:g></string>
|
||||
|
|
|
@ -36,5 +36,10 @@
|
|||
android:entryValues="@array/general_preference_text_zoom_values"
|
||||
android:dialogTitle="@string/general_preference_text_zoom_dialog_title" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="background_attachments"
|
||||
android:title="@string/general_preference_background_attachments_label"
|
||||
android:summary="@string/general_preference_background_attachments_summary" />
|
||||
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -39,6 +39,7 @@ public class Preferences {
|
|||
private static final String ONE_TIME_INITIALIZATION_PROGRESS = "oneTimeInitializationProgress";
|
||||
private static final String AUTO_ADVANCE_DIRECTION = "autoAdvance";
|
||||
private static final String TEXT_ZOOM = "textZoom";
|
||||
private static final String BACKGROUND_ATTACHMENTS = "backgroundAttachments";
|
||||
|
||||
public static final int AUTO_ADVANCE_NEWER = 0;
|
||||
public static final int AUTO_ADVANCE_OLDER = 1;
|
||||
|
@ -219,6 +220,14 @@ public class Preferences {
|
|||
mSharedPreferences.edit().putInt(TEXT_ZOOM, zoom).apply();
|
||||
}
|
||||
|
||||
public boolean getBackgroundAttachments() {
|
||||
return mSharedPreferences.getBoolean(BACKGROUND_ATTACHMENTS, false);
|
||||
}
|
||||
|
||||
public void setBackgroundAttachments(boolean allowed) {
|
||||
mSharedPreferences.edit().putBoolean(BACKGROUND_ATTACHMENTS, allowed).apply();
|
||||
}
|
||||
|
||||
public void save() {
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.android.email.Preferences;
|
|||
import com.android.email.R;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.Preference.OnPreferenceChangeListener;
|
||||
|
@ -29,10 +30,12 @@ public class GeneralPreferences extends PreferenceFragment implements OnPreferen
|
|||
|
||||
private static final String PREFERENCE_KEY_AUTO_ADVANCE = "auto_advance";
|
||||
private static final String PREFERENCE_KEY_TEXT_ZOOM = "text_zoom";
|
||||
private static final String PREFERENCE_KEY_BACKGROUND_ATTACHMENTS = "background_attachments";
|
||||
|
||||
private Preferences mPreferences;
|
||||
private ListPreference mAutoAdvance;
|
||||
private ListPreference mTextZoom;
|
||||
private CheckBoxPreference mBackgroundAttachments;
|
||||
|
||||
CharSequence[] mSizeSummaries;
|
||||
|
||||
|
@ -61,6 +64,9 @@ public class GeneralPreferences extends PreferenceFragment implements OnPreferen
|
|||
mPreferences.setTextZoom(mTextZoom.findIndexOfValue((String) newValue));
|
||||
reloadDynamicSummaries();
|
||||
return true;
|
||||
} else if (PREFERENCE_KEY_BACKGROUND_ATTACHMENTS.equals(key)) {
|
||||
mPreferences.setBackgroundAttachments((Boolean) newValue);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -75,6 +81,10 @@ public class GeneralPreferences extends PreferenceFragment implements OnPreferen
|
|||
mTextZoom.setValueIndex(mPreferences.getTextZoom());
|
||||
mTextZoom.setOnPreferenceChangeListener(this);
|
||||
|
||||
mBackgroundAttachments = (CheckBoxPreference)
|
||||
findPreference(PREFERENCE_KEY_BACKGROUND_ATTACHMENTS);
|
||||
mBackgroundAttachments.setChecked(mPreferences.getBackgroundAttachments());
|
||||
mBackgroundAttachments.setOnPreferenceChangeListener(this);
|
||||
reloadDynamicSummaries();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue