Skip to content

Commit 2c46d3d

Browse files
committed
Added delete account menu under settings.
NMC-3041
1 parent 097b3b6 commit 2c46d3d

File tree

6 files changed

+53
-35
lines changed

6 files changed

+53
-35
lines changed

app/src/main/java/com/owncloud/android/ui/AppVersionPreference.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class AppVersionPreference : Preference {
3737
var temp: String
3838
try {
3939
val pkg = context.packageManager.getPackageInfo(context.packageName, 0)
40-
temp = pkg.versionName
40+
temp = pkg.versionName ?: ""
4141
} catch (e: PackageManager.NameNotFoundException) {
4242
temp = ""
4343
Log_OC.e(TAG, "Error while showing about dialog", e)

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
@@ -207,7 +207,7 @@ public void onCreate(Bundle savedInstanceState) {
207207

208208
// About
209209
// Not required in NMC
210-
//setupAboutCategory(appVersion);
210+
// setupAboutCategory(appVersion);
211211

212212
// Data Privacy
213213
setupDataPrivacyCategory(titleColor);
@@ -388,9 +388,10 @@ public void onBackPressed() {
388388

389389
private void setupSyncCategory(int titleColor) {
390390
final PreferenceCategory preferenceCategorySync = (PreferenceCategory) findPreference("sync");
391-
391+
preferenceCategorySync.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_category_sync),
392+
titleColor));
392393
setupAutoUploadPreference(preferenceCategorySync, titleColor);
393-
setupInternalTwoWaySyncPreference(titleColor);
394+
// setupInternalTwoWaySyncPreference(titleColor);
394395
}
395396

396397
/**
@@ -437,7 +438,6 @@ private void setupDataPrivacyCategory(int titleColor) {
437438
getResources().getString(R.string.privacy_policy));
438439
intent.putExtra(ExternalSiteWebView.EXTRA_URL, privacyUrl.toString());
439440
intent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
440-
intent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
441441
}
442442

443443
startActivity(intent);
@@ -464,7 +464,6 @@ private void setupDataPrivacyCategory(int titleColor) {
464464
getResources().getString(R.string.prefs_open_source));
465465
intent.putExtra(ExternalSiteWebView.EXTRA_URL, getResources().getString(R.string.sourcecode_url));
466466
intent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
467-
intent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
468467
startActivity(intent);
469468
return true;
470469
});
@@ -485,7 +484,7 @@ private void setupMoreCategory(int titleColor) {
485484
preferenceCategoryMore.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_category_more),
486485
titleColor));
487486

488-
setupCalendarPreference(preferenceCategoryMore);
487+
setupCalendarPreference(preferenceCategoryMore);
489488

490489
setupBackupPreference(titleColor);
491490

@@ -683,7 +682,7 @@ private void setupAutoUploadPreference(PreferenceCategory preferenceCategoryMore
683682

684683
private void setupInternalTwoWaySyncPreference(int titleColor) {
685684
Preference twoWaySync = findPreference("internal_two_way_sync");
686-
twoWaySync.setTitle(StringUtils.getColorSpan(getString(R.string.drawer_synced_folders),
685+
twoWaySync.setTitle(StringUtils.getColorSpan(getString(R.string.internal_two_way_sync),
687686
titleColor));
688687

689688
twoWaySync.setOnPreferenceClickListener(preference -> {
@@ -697,7 +696,7 @@ private void setupBackupPreference(int titleColor) {
697696
Preference pContactsBackup = findPreference("backup");
698697
if (pContactsBackup != null) {
699698
boolean showCalendarBackup = getResources().getBoolean(R.bool.show_calendar_backup);
700-
//NMC Customization
699+
// NMC Customization
701700
pContactsBackup.setTitle(StringUtils.getColorSpan(getString(R.string.actionbar_contacts), titleColor));
702701
pContactsBackup.setSummary(showCalendarBackup
703702
? getString(R.string.prefs_daily_backup_summary)
@@ -761,7 +760,7 @@ private void setupDetailsCategory(int titleColor, PreferenceScreen preferenceScr
761760
private void setupShowMediaScanNotifications(PreferenceCategory preferenceCategoryDetails,
762761
boolean fShowMediaScanNotifications, int titleColor) {
763762
SwitchPreference mShowMediaScanNotifications = (SwitchPreference) findPreference(PREFERENCE_SHOW_MEDIA_SCAN_NOTIFICATIONS);
764-
mShowMediaScanNotifications.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_storage_path),
763+
mShowMediaScanNotifications.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_enable_media_scan_notifications),
765764
titleColor));
766765
if (fShowMediaScanNotifications) {
767766
preferenceCategoryDetails.removePreference(mShowMediaScanNotifications);
@@ -859,7 +858,7 @@ private void setupLockPreference(PreferenceCategory preferenceCategoryDetails,
859858
}
860859

861860
private void setupAutoUploadCategory(int titleColor, PreferenceScreen preferenceScreen) {
862-
PreferenceCategory preferenceCategorySyncedFolders =
861+
final PreferenceCategory preferenceCategorySyncedFolders =
863862
(PreferenceCategory) findPreference("synced_folders_category");
864863
preferenceCategorySyncedFolders.setTitle(StringUtils.getColorSpan(getString(R.string.drawer_synced_folders),
865864
titleColor));
@@ -903,6 +902,7 @@ private void setUpServiceCategory(int titleColor) {
903902
preferenceCategoryService.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_category_service),
904903
titleColor));
905904
setupHelpPreference(titleColor);
905+
setupDeleteAccountPreference(titleColor);
906906
setupImprintPreference(titleColor);
907907
}
908908

@@ -922,6 +922,22 @@ private void setupHelpPreference(int titleColor) {
922922
}
923923
}
924924

925+
private void setupDeleteAccountPreference(int titleColor) {
926+
Preference pHelp = findPreference("delete_account");
927+
if (pHelp != null) {
928+
pHelp.setTitle(StringUtils.getColorSpan(getString(R.string.prefs_delete_account),
929+
titleColor));
930+
pHelp.setOnPreferenceClickListener(preference -> {
931+
String helpWeb = getString(R.string.url_delete_account);
932+
if (!helpWeb.isEmpty()) {
933+
openLinkInWebView(helpWeb, R.string.prefs_delete_account);
934+
}
935+
return true;
936+
});
937+
938+
}
939+
}
940+
925941
private void setupImprintPreference(int titleColor) {
926942
Preference pImprint = findPreference("imprint");
927943
if (pImprint != null) {
@@ -945,7 +961,6 @@ private void openLinkInWebView(String url, @StringRes int title) {
945961
getResources().getString(title));
946962
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_URL, url);
947963
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
948-
externalWebViewIntent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
949964
startActivity(externalWebViewIntent);
950965
}
951966

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,7 @@
10281028
<string name="prefs_category_data_privacy">Datenschutz</string>
10291029
<string name="privacy_settings">Datenschutz</string>
10301030
<string name="privacy_policy">Datenschutzbestimmungen</string>
1031+
<string name="prefs_delete_account">Konto endgültig löschen</string>
10311032
<string name="prefs_open_source">Verwendete OpenSource Software</string>
10321033
<string name="prefs_category_info">Info</string>
10331034
<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
@@ -1266,6 +1266,7 @@
12661266
<string name="prefs_category_data_privacy">Data Privacy</string>
12671267
<string name="privacy_settings">Privacy Settings</string>
12681268
<string name="privacy_policy">Privacy Policy</string>
1269+
<string name="prefs_delete_account">Delete account permanently</string>
12691270
<string name="prefs_open_source">Used OpenSource Software</string>
12701271
<string name="prefs_category_service">Service</string>
12711272
<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)