Skip to content

Commit 3824961

Browse files
author
farewelltospring
committed
Do not show frequency setting when backups are disabled
Also formatting
1 parent 293ceff commit 3824961

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

app/src/main/java/org/thoughtcrime/securesms/preferences/BackupFrequencyPickerDialogFragment.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ class BackupFrequencyPickerDialogFragment(private val defaultFrequency: BackupFr
1515

1616
override fun onCreateDialog(savedInstance: Bundle?): Dialog {
1717
val context = requireContext()
18-
val localizedFrequencyOptions = frequencyOptions.map { context.getString(it.getResourceId()) }.toTypedArray()
18+
val localizedFrequencyOptions = frequencyOptions
19+
.map { it.getResourceId() }
20+
.map { context.getString(it) }
21+
.toTypedArray()
1922
val defaultIndex = frequencyOptions.indexOf(defaultFrequency)
2023

2124
return MaterialAlertDialogBuilder(context)

app/src/main/java/org/thoughtcrime/securesms/preferences/BackupFrequencyV1.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ package org.thoughtcrime.securesms.preferences
88
import androidx.annotation.StringRes
99
import org.thoughtcrime.securesms.R
1010

11-
enum class BackupFrequencyV1(val days: Int?) {
11+
enum class BackupFrequencyV1(val days: Int) {
1212
DAILY(1),
1313
WEEKLY(7),
1414
MONTHLY(30),
@@ -25,4 +25,4 @@ enum class BackupFrequencyV1(val days: Int?) {
2525
NEVER -> R.string.BackupsPreferenceFragment__frequency_label_never
2626
}
2727
}
28-
}
28+
}

app/src/main/java/org/thoughtcrime/securesms/preferences/BackupsPreferenceFragment.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ public class BackupsPreferenceFragment extends Fragment {
5757
private View create;
5858
private View folder;
5959
private View verify;
60-
private View timer;
61-
private View frequencyView;
62-
private TextView timeLabel;
63-
private TextView frequencyLabel;
60+
private View timer;
61+
private View frequencyView;
62+
private TextView timeLabel;
63+
private TextView frequencyLabel;
6464
private TextView toggle;
6565
private TextView info;
6666
private TextView summary;
@@ -344,6 +344,7 @@ private void setBackupsEnabled() {
344344
create.setVisibility(View.VISIBLE);
345345
verify.setVisibility(View.VISIBLE);
346346
timer.setVisibility(View.VISIBLE);
347+
frequencyView.setVisibility(View.VISIBLE);
347348
updateTimeLabel();
348349
setBackupFolderName();
349350
}
@@ -354,6 +355,7 @@ private void setBackupsDisabled() {
354355
folder.setVisibility(View.GONE);
355356
verify.setVisibility(View.GONE);
356357
timer.setVisibility(View.GONE);
358+
frequencyView.setVisibility(View.GONE);
357359
AppDependencies.getJobManager().cancelAllInQueue(LocalBackupJob.QUEUE);
358360
}
359361
}

0 commit comments

Comments
 (0)