Add mobile sync setting (#6349)
This commit is contained in:
parent
658c47f7a7
commit
6d72d7cebf
app/src/main/java/de/danoeh/antennapod/preferences
core/src/main
storage/preferences/src/main/java/de/danoeh/antennapod/storage/preferences
@ -140,6 +140,7 @@ public class PreferenceUpgrader {
|
|||||||
.putBoolean(UserPreferences.PREF_THEME_BLACK, true)
|
.putBoolean(UserPreferences.PREF_THEME_BLACK, true)
|
||||||
.apply();
|
.apply();
|
||||||
}
|
}
|
||||||
|
UserPreferences.setAllowMobileSync(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ public class SyncService extends Worker {
|
|||||||
|
|
||||||
private static OneTimeWorkRequest.Builder getWorkRequest() {
|
private static OneTimeWorkRequest.Builder getWorkRequest() {
|
||||||
Constraints.Builder constraints = new Constraints.Builder();
|
Constraints.Builder constraints = new Constraints.Builder();
|
||||||
if (UserPreferences.isAllowMobileFeedRefresh()) {
|
if (UserPreferences.isAllowMobileSync()) {
|
||||||
constraints.setRequiredNetworkType(NetworkType.CONNECTED);
|
constraints.setRequiredNetworkType(NetworkType.CONNECTED);
|
||||||
} else {
|
} else {
|
||||||
constraints.setRequiredNetworkType(NetworkType.UNMETERED);
|
constraints.setRequiredNetworkType(NetworkType.UNMETERED);
|
||||||
|
@ -93,6 +93,7 @@
|
|||||||
<item>@string/pref_mobileUpdate_auto_download</item>
|
<item>@string/pref_mobileUpdate_auto_download</item>
|
||||||
<item>@string/pref_mobileUpdate_streaming</item>
|
<item>@string/pref_mobileUpdate_streaming</item>
|
||||||
<item>@string/pref_mobileUpdate_images</item>
|
<item>@string/pref_mobileUpdate_images</item>
|
||||||
|
<item>@string/synchronization_pref</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="mobile_update_values">
|
<string-array name="mobile_update_values">
|
||||||
@ -101,10 +102,12 @@
|
|||||||
<item>auto_download</item>
|
<item>auto_download</item>
|
||||||
<item>streaming</item>
|
<item>streaming</item>
|
||||||
<item>images</item>
|
<item>images</item>
|
||||||
|
<item>sync</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="mobile_update_default_value">
|
<string-array name="mobile_update_default_value">
|
||||||
<item>images</item>
|
<item>images</item>
|
||||||
|
<item>sync</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="episode_cleanup_entries">
|
<string-array name="episode_cleanup_entries">
|
||||||
|
@ -507,6 +507,10 @@ public class UserPreferences {
|
|||||||
return isAllowMobileFor("feed_refresh");
|
return isAllowMobileFor("feed_refresh");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isAllowMobileSync() {
|
||||||
|
return isAllowMobileFor("sync");
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isAllowMobileEpisodeDownload() {
|
public static boolean isAllowMobileEpisodeDownload() {
|
||||||
return isAllowMobileFor("episode_download");
|
return isAllowMobileFor("episode_download");
|
||||||
}
|
}
|
||||||
@ -556,6 +560,10 @@ public class UserPreferences {
|
|||||||
setAllowMobileFor("images", allow);
|
setAllowMobileFor("images", allow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setAllowMobileSync(boolean allow) {
|
||||||
|
setAllowMobileFor("sync", allow);
|
||||||
|
}
|
||||||
|
|
||||||
public static int getParallelDownloads() {
|
public static int getParallelDownloads() {
|
||||||
return Integer.parseInt(prefs.getString(PREF_PARALLEL_DOWNLOADS, "4"));
|
return Integer.parseInt(prefs.getString(PREF_PARALLEL_DOWNLOADS, "4"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user