mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
Option to enable image caching.
This commit is contained in:
parent
0f6fdb1666
commit
5376494a68
5 changed files with 14 additions and 0 deletions
|
@ -8,6 +8,11 @@
|
||||||
android:key="enable_offline"
|
android:key="enable_offline"
|
||||||
android:title="@string/settings_enable_offline"
|
android:title="@string/settings_enable_offline"
|
||||||
android:summary="@string/settings_enable_offline_sum" />
|
android:summary="@string/settings_enable_offline_sum" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="enable_image_prefetch"
|
||||||
|
android:title="@string/settings_enable_image_prefetch"
|
||||||
|
android:summary="@string/settings_enable_image_prefetch_sum" />
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="offline_network_select"
|
android:key="offline_network_select"
|
||||||
android:title="@string/menu_network_select"
|
android:title="@string/menu_network_select"
|
||||||
|
|
|
@ -175,6 +175,8 @@
|
||||||
<string name="settings_cat_offline">Offline</string>
|
<string name="settings_cat_offline">Offline</string>
|
||||||
<string name="settings_enable_offline">Download Stories</string>
|
<string name="settings_enable_offline">Download Stories</string>
|
||||||
<string name="settings_enable_offline_sum">Periodically fetch stories in background</string>
|
<string name="settings_enable_offline_sum">Periodically fetch stories in background</string>
|
||||||
|
<string name="settings_enable_image_prefetch">Download Images</string>
|
||||||
|
<string name="settings_enable_image_prefetch_sum">Pre-fetch images for offline reading</string>
|
||||||
<string name="settings_keep_old_stories">Keep Stories after Reading</string>
|
<string name="settings_keep_old_stories">Keep Stories after Reading</string>
|
||||||
<string name="settings_keep_old_stories_sum">Disable to reduce storage usage</string>
|
<string name="settings_keep_old_stories_sum">Disable to reduce storage usage</string>
|
||||||
|
|
||||||
|
|
|
@ -414,6 +414,7 @@ public class NBSyncService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prefetchImages() {
|
private void prefetchImages() {
|
||||||
|
if (!PrefsUtils.isImagePrefetchEnabled(this)) return;
|
||||||
ImagePrefetchRunning = true;
|
ImagePrefetchRunning = true;
|
||||||
try {
|
try {
|
||||||
while (ImageQueue.size() > 0) {
|
while (ImageQueue.size() > 0) {
|
||||||
|
|
|
@ -48,6 +48,7 @@ public class PrefConstants {
|
||||||
public static final String STORIES_SHOW_PREVIEWS = "pref_show_content_preview";
|
public static final String STORIES_SHOW_PREVIEWS = "pref_show_content_preview";
|
||||||
|
|
||||||
public static final String ENABLE_OFFLINE = "enable_offline";
|
public static final String ENABLE_OFFLINE = "enable_offline";
|
||||||
|
public static final String ENABLE_IMAGE_PREFETCH = "enable_image_prefetch";
|
||||||
public static final String NETWORK_SELECT = "offline_network_select";
|
public static final String NETWORK_SELECT = "offline_network_select";
|
||||||
public static final String KEEP_OLD_STORIES = "keep_old_stories";
|
public static final String KEEP_OLD_STORIES = "keep_old_stories";
|
||||||
|
|
||||||
|
|
|
@ -369,6 +369,11 @@ public class PrefsUtils {
|
||||||
return prefs.getBoolean(PrefConstants.ENABLE_OFFLINE, false);
|
return prefs.getBoolean(PrefConstants.ENABLE_OFFLINE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isImagePrefetchEnabled(Context context) {
|
||||||
|
SharedPreferences prefs = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||||
|
return prefs.getBoolean(PrefConstants.ENABLE_IMAGE_PREFETCH, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares the user's setting for when background data use is allowed against the
|
* Compares the user's setting for when background data use is allowed against the
|
||||||
* current network status and sees if it is okay to sync.
|
* current network status and sees if it is okay to sync.
|
||||||
|
|
Loading…
Add table
Reference in a new issue