mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
Merge pull request #11589 from nextcloud/configurableCalendarBackup
Configurable calendar backup
This commit is contained in:
commit
5881d99ebf
4 changed files with 24 additions and 5 deletions
|
@ -4,11 +4,13 @@
|
|||
* @author Bartek Przybylski
|
||||
* @author David A. Velasco
|
||||
* @author Chris Narkiewicz
|
||||
* @author TSI-mc
|
||||
*
|
||||
* Copyright (C) 2011 Bartek Przybylski
|
||||
* Copyright (C) 2016 ownCloud Inc.
|
||||
* Copyright (C) 2016 Nextcloud
|
||||
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
|
||||
* Copyright (C) 2023 TSI-mc
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
|
@ -561,6 +563,13 @@ public class SettingsActivity extends PreferenceActivity
|
|||
private void setupBackupPreference() {
|
||||
Preference pContactsBackup = findPreference("backup");
|
||||
if (pContactsBackup != null) {
|
||||
boolean showCalendarBackup = getResources().getBoolean(R.bool.show_calendar_backup);
|
||||
pContactsBackup.setTitle(showCalendarBackup
|
||||
? getString(R.string.backup_title)
|
||||
: getString(R.string.contact_backup_title));
|
||||
pContactsBackup.setSummary(showCalendarBackup
|
||||
? getString(R.string.prefs_daily_backup_summary)
|
||||
: getString(R.string.prefs_daily_contact_backup_summary));
|
||||
pContactsBackup.setOnPreferenceClickListener(preference -> {
|
||||
ContactsPreferenceActivity.startActivityWithoutSidebar(this);
|
||||
return true;
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Mario Danic
|
||||
* @author TSI-mc
|
||||
* Copyright (C) 2017 Mario Danic
|
||||
* Copyright (C) 2017 Nextcloud GmbH.
|
||||
* Copyright (C) 2023 TSI-mc
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
|
@ -102,7 +104,8 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
|
|||
private CompoundButton.OnCheckedChangeListener calendarCheckedListener;
|
||||
private User user;
|
||||
private boolean showSidebar = true;
|
||||
|
||||
//flag to check if calendar backup should be shown and backup should be done or not
|
||||
private boolean showCalendarBackup = true;
|
||||
public static BackupFragment create(boolean showSidebar) {
|
||||
BackupFragment fragment = new BackupFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
|
@ -144,6 +147,8 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
|
|||
showSidebar = getArguments().getBoolean(ARG_SHOW_SIDEBAR);
|
||||
}
|
||||
|
||||
showCalendarBackup = requireContext().getResources().getBoolean(R.bool.show_calendar_backup);
|
||||
|
||||
final ContactsPreferenceActivity contactsPreferenceActivity = (ContactsPreferenceActivity) getActivity();
|
||||
user = contactsPreferenceActivity.getUser().orElseThrow(RuntimeException::new);
|
||||
|
||||
|
@ -151,7 +156,8 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
|
|||
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
viewThemeUtils.files.themeActionBar(requireContext(), actionBar, R.string.backup_title);
|
||||
viewThemeUtils.files.themeActionBar(requireContext(), actionBar,
|
||||
showCalendarBackup ? R.string.backup_title : R.string.contact_backup_title);
|
||||
}
|
||||
|
||||
|
||||
|
@ -164,6 +170,7 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
|
|||
binding.contacts.setChecked(isContactsBackupEnabled() && checkContactBackupPermission());
|
||||
binding.calendar.setChecked(isCalendarBackupEnabled() && checkCalendarBackupPermission(getContext()));
|
||||
|
||||
binding.calendar.setVisibility(showCalendarBackup ? View.VISIBLE : View.GONE);
|
||||
|
||||
setupCheckListeners();
|
||||
|
||||
|
@ -395,7 +402,7 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
|
|||
startContactsBackupJob();
|
||||
}
|
||||
|
||||
if (isCalendarBackupEnabled() && checkCalendarBackupPermission(requireContext())) {
|
||||
if (showCalendarBackup && isCalendarBackupEnabled() && checkCalendarBackupPermission(requireContext())) {
|
||||
startCalendarBackupJob();
|
||||
}
|
||||
|
||||
|
@ -651,7 +658,7 @@ public class BackupFragment extends FileFragment implements DatePickerDialog.OnD
|
|||
}
|
||||
|
||||
// calendars
|
||||
if (MimeTypeUtil.isCalendar(file)) {
|
||||
if (showCalendarBackup && MimeTypeUtil.isCalendar(file)) {
|
||||
calendarBackupsToRestore.add(file);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
<string name="contacts_backup_folder">/.Contacts-Backup</string>
|
||||
<integer name="contacts_backup_expire">-1</integer>
|
||||
<string name="calendar_backup_folder">/.Calendar-Backup</string>
|
||||
<!-- flag to enable/disable contact backup -->
|
||||
<bool name="show_calendar_backup">true</bool>
|
||||
|
||||
<!-- What's new -->
|
||||
<bool name="show_whats_new">true</bool>
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
<string name="prefs_calendar_contacts_no_store_error">Neither F-Droid nor Google Play is installed</string>
|
||||
<string name="prefs_calendar_contacts_sync_setup_successful">Calendar & contacts sync set up</string>
|
||||
<string name="prefs_daily_backup_summary">Daily backup of your calendar & contacts</string>
|
||||
<string name="prefs_daily_contact_backup_summary">Daily backup of your contacts</string>
|
||||
<string name="prefs_sycned_folders_summary">Manage folders for auto upload</string>
|
||||
<string name="prefs_help">Help</string>
|
||||
<string name="prefs_recommend">Recommend to a friend</string>
|
||||
|
@ -605,7 +606,7 @@
|
|||
<string name="contacts_preferences_backup_scheduled">Backup scheduled and will start shortly</string>
|
||||
<string name="contacts_preferences_import_scheduled">Import scheduled and will start shortly</string>
|
||||
<string name="backup_title">Contacts & calendar backup</string>
|
||||
|
||||
<string name="contact_backup_title">Contacts backup</string>
|
||||
<string name="drawer_logout">Log out</string>
|
||||
<string name="picture_set_as_no_app">No app found to set a picture with</string>
|
||||
<string name="privacy">Privacy</string>
|
||||
|
|
Loading…
Reference in a new issue