Skip to content

Commit 9f550ef

Browse files
committed
Added delete account menu under settings.
NMC-3041
1 parent 36f791c commit 9f550ef

File tree

5 files changed

+52
-34
lines changed

5 files changed

+52
-34
lines changed

app/src/main/java/com/owncloud/android/ui/activity/SettingsActivity.java

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public void onCreate(Bundle savedInstanceState) {
199199

200200
// About
201201
// Not required in NMC
202-
//setupAboutCategory(appVersion);
202+
// setupAboutCategory(appVersion);
203203

204204
// Data Privacy
205205
setupDataPrivacyCategory(titleColor);
@@ -364,9 +364,10 @@ public void onBackPressed() {
364364

365365
private void setupSyncCategory(int titleColor) {
366366
final PreferenceCategory preferenceCategorySync = (PreferenceCategory) findPreference("sync");
367-
367+
preferenceCategorySync.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_category_sync),
368+
titleColor));
368369
setupAutoUploadPreference(preferenceCategorySync, titleColor);
369-
setupInternalTwoWaySyncPreference(titleColor);
370+
// setupInternalTwoWaySyncPreference(titleColor);
370371
}
371372

372373
/**
@@ -413,7 +414,6 @@ private void setupDataPrivacyCategory(int titleColor) {
413414
getResources().getString(R.string.privacy_policy));
414415
intent.putExtra(ExternalSiteWebView.EXTRA_URL, privacyUrl.toString());
415416
intent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
416-
intent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
417417
}
418418

419419
startActivity(intent);
@@ -440,7 +440,6 @@ private void setupDataPrivacyCategory(int titleColor) {
440440
getResources().getString(R.string.prefs_open_source));
441441
intent.putExtra(ExternalSiteWebView.EXTRA_URL, getResources().getString(R.string.sourcecode_url));
442442
intent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
443-
intent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
444443
startActivity(intent);
445444
return true;
446445
});
@@ -461,7 +460,7 @@ private void setupMoreCategory(int titleColor) {
461460
preferenceCategoryMore.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_category_more),
462461
titleColor));
463462

464-
setupCalendarPreference(preferenceCategoryMore);
463+
setupCalendarPreference(preferenceCategoryMore);
465464

466465
setupBackupPreference(titleColor);
467466

@@ -659,7 +658,7 @@ private void setupAutoUploadPreference(PreferenceCategory preferenceCategoryMore
659658

660659
private void setupInternalTwoWaySyncPreference(int titleColor) {
661660
Preference twoWaySync = findPreference("internal_two_way_sync");
662-
twoWaySync.setTitle(StringUtils.getColorSpan(getString(R.string.drawer_synced_folders),
661+
twoWaySync.setTitle(StringUtils.getColorSpan(getString(R.string.internal_two_way_sync),
663662
titleColor));
664663

665664
twoWaySync.setOnPreferenceClickListener(preference -> {
@@ -673,7 +672,7 @@ private void setupBackupPreference(int titleColor) {
673672
Preference pContactsBackup = findPreference("backup");
674673
if (pContactsBackup != null) {
675674
boolean showCalendarBackup = getResources().getBoolean(R.bool.show_calendar_backup);
676-
//NMC Customization
675+
// NMC Customization
677676
pContactsBackup.setTitle(StringUtils.getColorSpan(getString(R.string.actionbar_contacts), titleColor));
678677
pContactsBackup.setSummary(showCalendarBackup
679678
? getString(R.string.prefs_daily_backup_summary)
@@ -737,7 +736,7 @@ private void setupDetailsCategory(int titleColor, PreferenceScreen preferenceScr
737736
private void setupShowMediaScanNotifications(PreferenceCategory preferenceCategoryDetails,
738737
boolean fShowMediaScanNotifications, int titleColor) {
739738
SwitchPreference mShowMediaScanNotifications = (SwitchPreference) findPreference(PREFERENCE_SHOW_MEDIA_SCAN_NOTIFICATIONS);
740-
mShowMediaScanNotifications.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_storage_path),
739+
mShowMediaScanNotifications.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_enable_media_scan_notifications),
741740
titleColor));
742741
if (fShowMediaScanNotifications) {
743742
preferenceCategoryDetails.removePreference(mShowMediaScanNotifications);
@@ -835,7 +834,7 @@ private void setupLockPreference(PreferenceCategory preferenceCategoryDetails,
835834
}
836835

837836
private void setupAutoUploadCategory(int titleColor, PreferenceScreen preferenceScreen) {
838-
PreferenceCategory preferenceCategorySyncedFolders =
837+
final PreferenceCategory preferenceCategorySyncedFolders =
839838
(PreferenceCategory) findPreference("synced_folders_category");
840839
preferenceCategorySyncedFolders.setTitle(StringUtils.getColorSpan(getString(R.string.drawer_synced_folders),
841840
titleColor));
@@ -879,6 +878,7 @@ private void setUpServiceCategory(int titleColor) {
879878
preferenceCategoryService.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_category_service),
880879
titleColor));
881880
setupHelpPreference(titleColor);
881+
setupDeleteAccountPreference(titleColor);
882882
setupImprintPreference(titleColor);
883883
}
884884

@@ -898,6 +898,22 @@ private void setupHelpPreference(int titleColor) {
898898
}
899899
}
900900

901+
private void setupDeleteAccountPreference(int titleColor) {
902+
Preference pHelp = findPreference("delete_account");
903+
if (pHelp != null) {
904+
pHelp.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_delete_account),
905+
titleColor));
906+
pHelp.setOnPreferenceClickListener(preference -> {
907+
String helpWeb = getString(R.string.url_delete_account);
908+
if (!helpWeb.isEmpty()) {
909+
openLinkInWebView(helpWeb, R.string.prefs_delete_account);
910+
}
911+
return true;
912+
});
913+
914+
}
915+
}
916+
901917
private void setupImprintPreference(int titleColor) {
902918
Preference pImprint = findPreference("imprint");
903919
if (pImprint != null) {
@@ -921,7 +937,6 @@ private void openLinkInWebView(String url, @StringRes int title) {
921937
getResources().getString(title));
922938
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_URL, url);
923939
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
924-
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
925940
startActivity(externalWebViewIntent);
926941
}
927942

app/src/main/res/values-de/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,7 @@
10161016
<string name="prefs_category_data_privacy">Datenschutz</string>
10171017
<string name="privacy_settings">Datenschutz</string>
10181018
<string name="privacy_policy">Datenschutzbestimmungen</string>
1019+
<string name="prefs_delete_account">Konto endgültig löschen</string>
10191020
<string name="prefs_open_source">Verwendete OpenSource Software</string>
10201021
<string name="prefs_category_info">Info</string>
10211022
<string name="prefs_category_service">Bedienung</string>

app/src/main/res/values/setup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
<string name="url_imprint"></string>
100100
<string name="url_app_download">"https://play.google.com/store/apps/details?id=com.nextcloud.client"</string>
101101
<string name="url_server_install">https://nextcloud.com/install</string>
102+
<string name="url_delete_account">https://www.telekom.de/hilfe/vertrag-rechnung/login-daten-passwoerter/telekom-login-loeschen</string>
102103
<!-- using different key as existing url_imprint will be duplicated during the merge process
103104
because url_app_download will be changed in branding -->
104105
<string name="url_imprint_nmc">https://www.telekom.de/impressum</string>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,7 @@
12201220
<string name="prefs_category_data_privacy">Data Privacy</string>
12211221
<string name="privacy_settings">Privacy Settings</string>
12221222
<string name="privacy_policy">Privacy Policy</string>
1223+
<string name="prefs_delete_account">Delete account permanently</string>
12231224
<string name="prefs_open_source">Used OpenSource Software</string>
12241225
<string name="prefs_category_service">Service</string>
12251226
<string name="document_scan_pdf_generation_in_progress">Generating PDF…</string>

app/src/main/res/xml/preferences.xml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<!--
1+
<?xml version="1.0" encoding="utf-8"?><!--
32
~ Nextcloud - Android Client
43
~
54
~ SPDX-FileCopyrightText: 2017-2022 Tobias Kaminsky <tobias@kaminsky.me>
@@ -27,14 +26,11 @@
2726
<com.owncloud.android.ui.PreferenceCustomCategory
2827
android:key="general"
2928
android:title="@string/prefs_category_general">
30-
<ListPreference
31-
android:key="storage_path"
29+
<Preference
30+
android:key="data_storage_location"
3231
android:layout="@layout/custom_preference_layout"
33-
android:title="@string/prefs_storage_path" />
34-
<!-- <ListPreference
35-
android:title="@string/prefs_theme_title"
36-
android:key="darkMode"
37-
android:summary="%s" />-->
32+
android:summary="@string/prefs_data_storage_location_summary"
33+
android:title="@string/prefs_data_storage_location" />
3834
</com.owncloud.android.ui.PreferenceCustomCategory>
3935

4036
<com.owncloud.android.ui.PreferenceCustomCategory
@@ -54,7 +50,7 @@
5450
<com.owncloud.android.ui.PreferenceCustomCategory
5551
android:key="details"
5652
android:title="@string/prefs_category_details">
57-
<ListPreference
53+
<com.owncloud.android.ui.ListPreferenceDialog
5854
android:defaultValue="none"
5955
android:dialogTitle="@string/prefs_lock_title"
6056
android:key="lock"
@@ -66,10 +62,10 @@
6662
android:title="@string/prefs_show_hidden_files" />
6763
<com.owncloud.android.ui.ThemeableSwitchPreference
6864
android:defaultValue="true"
69-
android:title="@string/prefs_show_ecosystem_apps"
7065
android:key="show_ecosystem_apps"
7166
android:layout="@layout/custom_preference_layout"
72-
android:summary="@string/prefs_show_ecosystem_apps_summary"/>
67+
android:summary="@string/prefs_show_ecosystem_apps_summary"
68+
android:title="@string/prefs_show_ecosystem_apps" />
7369
<com.owncloud.android.ui.ThemeableSwitchPreference
7470
android:key="show_media_scan_notifications"
7571
android:layout="@layout/custom_preference_layout"
@@ -78,24 +74,24 @@
7874
</com.owncloud.android.ui.PreferenceCustomCategory>
7975

8076
<com.owncloud.android.ui.PreferenceCustomCategory
81-
android:title="@string/prefs_category_sync"
82-
android:key="sync">
77+
android:key="sync"
78+
android:title="@string/prefs_category_sync">
8379
<Preference
84-
android:title="@string/drawer_synced_folders"
8580
android:key="syncedFolders"
8681
android:layout="@layout/custom_preference_layout"
87-
android:summary="@string/prefs_sycned_folders_summary" />
82+
android:summary="@string/prefs_sycned_folders_summary"
83+
android:title="@string/drawer_synced_folders" />
8884

89-
<Preference
90-
android:title="@string/internal_two_way_sync"
91-
android:key="internal_two_way_sync"
92-
android:layout="@layout/custom_preference_layout"
93-
android:summary="@string/prefs_two_way_sync_summary" />
85+
<!-- <Preference
86+
android:title="@string/internal_two_way_sync"
87+
android:key="internal_two_way_sync"
88+
android:layout="@layout/custom_preference_layout"
89+
android:summary="@string/prefs_two_way_sync_summary" />-->
9490
</com.owncloud.android.ui.PreferenceCustomCategory>
9591

9692
<com.owncloud.android.ui.PreferenceCustomCategory
97-
android:title="@string/prefs_category_more"
98-
android:key="more">
93+
android:key="more"
94+
android:title="@string/prefs_category_more">
9995
<Preference
10096
android:key="backup"
10197
android:layout="@layout/custom_preference_layout"
@@ -160,6 +156,10 @@
160156
android:key="help"
161157
android:layout="@layout/custom_preference_layout"
162158
android:title="@string/prefs_help" />
159+
<Preference
160+
android:key="delete_account"
161+
android:layout="@layout/custom_preference_layout"
162+
android:title="@string/prefs_help" />
163163
<Preference
164164
android:key="imprint"
165165
android:layout="@layout/custom_preference_layout"

0 commit comments

Comments
 (0)