Show backup progress as a percentage.

This commit is contained in:
Cody Henthorne
2021-12-14 14:31:44 -05:00
committed by Greyson Parrelli
parent 4f73e36d72
commit 8014a70134
15 changed files with 310 additions and 46 deletions

View File

@@ -230,6 +230,31 @@ public class TextSecurePreferences {
MEDIA_DOWNLOAD_WIFI_PREF,
MEDIA_DOWNLOAD_ROAMING_PREF};
public static long getPreferencesToSaveToBackupCount(@NonNull Context context) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
long count = 0;
for (String booleanPreference : booleanPreferencesToBackup) {
if (preferences.contains(booleanPreference)) {
count++;
}
}
for (String stringPreference : stringPreferencesToBackup) {
if (preferences.contains(stringPreference)) {
count++;
}
}
for (String stringSetPreference : stringSetPreferencesToBackup) {
if (preferences.contains(stringSetPreference)) {
count++;
}
}
return count;
}
public static List<BackupProtos.SharedPreference> getPreferencesToSaveToBackup(@NonNull Context context) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
List<BackupProtos.SharedPreference> backupProtos = new ArrayList<>();