From e94aae746d7de27841f656580527f747657341a6 Mon Sep 17 00:00:00 2001 From: kosyak Date: Sun, 21 Jul 2024 13:49:31 +0200 Subject: [PATCH] new settings screen --- .../conversations/ui/SettingsActivity.java | 16 +- .../conversations/ui/SettingsFragment.java | 10 - .../conversations/utils/Compatibility.java | 11 +- src/main/res/values/strings.xml | 9 +- src/main/res/xml/preferences.xml | 654 ++++++++++-------- 5 files changed, 374 insertions(+), 326 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java index 2a58795b3..8d0463a94 100644 --- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java @@ -17,6 +17,7 @@ import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceCategory; +import android.preference.PreferenceGroup; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; import android.provider.MediaStore; @@ -173,8 +174,8 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference PreferenceScreen mainPreferenceScreen = (PreferenceScreen) mSettingsFragment.findPreference("main_screen"); - PreferenceCategory attachmentsCategory = - (PreferenceCategory) mSettingsFragment.findPreference("attachments"); + PreferenceGroup attachmentsCategory = + (PreferenceGroup) mSettingsFragment.findPreference("attachments"); CheckBoxPreference locationPlugin = (CheckBoxPreference) mSettingsFragment.findPreference("use_share_location_plugin"); if (attachmentsCategory != null && locationPlugin != null) { @@ -190,14 +191,9 @@ public class SettingsActivity extends XmppActivity implements OnSharedPreference Intent intent = huaweiPreferenceScreen.getIntent(); // remove when Api version is above M (Version 6.0) or if the intent is not callable if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M || !isCallable(intent)) { - PreferenceCategory generalCategory = - (PreferenceCategory) mSettingsFragment.findPreference("general"); - generalCategory.removePreference(huaweiPreferenceScreen); - if (generalCategory.getPreferenceCount() == 0) { - if (mainPreferenceScreen != null) { - mainPreferenceScreen.removePreference(generalCategory); - } - } + PreferenceGroup notifications = + (PreferenceGroup) mSettingsFragment.findPreference("notification_category"); + notifications.removePreference(huaweiPreferenceScreen); } } diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsFragment.java b/src/main/java/eu/siacs/conversations/ui/SettingsFragment.java index 9378d82b7..d58394dbc 100644 --- a/src/main/java/eu/siacs/conversations/ui/SettingsFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/SettingsFragment.java @@ -41,16 +41,6 @@ public class SettingsFragment extends PreferenceFragment { } - @Override - public void onActivityCreated(Bundle bundle) { - super.onActivityCreated(bundle); - - final ListView listView = getActivity().findViewById(android.R.id.list); - if (listView != null) { - listView.setDivider(null); - } - } - public void setActivityIntent(final Intent intent) { boolean wasEmpty = TextUtils.isEmpty(page); if (intent != null) { diff --git a/src/main/java/eu/siacs/conversations/utils/Compatibility.java b/src/main/java/eu/siacs/conversations/utils/Compatibility.java index 23c935a2b..17dfdd0e3 100644 --- a/src/main/java/eu/siacs/conversations/utils/Compatibility.java +++ b/src/main/java/eu/siacs/conversations/utils/Compatibility.java @@ -14,6 +14,7 @@ import android.os.Build; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceCategory; +import android.preference.PreferenceGroup; import android.preference.PreferenceManager; import android.util.Log; @@ -113,18 +114,18 @@ public class Compatibility { } public static void removeUnusedPreferences(SettingsFragment settingsFragment) { - List categories = + List categories = Arrays.asList( - (PreferenceCategory) + (PreferenceGroup) settingsFragment.findPreference("notification_category"), - (PreferenceCategory) settingsFragment.findPreference("advanced")); + (PreferenceGroup) settingsFragment.findPreference("advanced")); for (String key : (runsTwentySix() ? UNUSED_SETTINGS_POST_TWENTYSIX : UNUSED_SETTINGS_PRE_TWENTYSIX)) { Preference preference = settingsFragment.findPreference(key); if (preference != null) { - for (PreferenceCategory category : categories) { + for (PreferenceGroup category : categories) { if (category != null) { category.removePreference(preference); } @@ -136,7 +137,7 @@ public class Compatibility { Preference preference = settingsFragment.findPreference(SettingsActivity.KEEP_FOREGROUND_SERVICE); if (preference != null) { - for (PreferenceCategory category : categories) { + for (PreferenceGroup category : categories) { if (category != null) { category.removePreference(preference); } diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 022ee687f..ea0d771a7 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -117,7 +117,7 @@ Accept all files Automatically accept all files when connected to Wi-Fi Attachments - Notification + Notifications Vibrate Vibrate when a new message arrives LED Notification @@ -135,7 +135,7 @@ Let your contacts know when you have received and read their messages Prevent Screenshots Hide app contents in the app switcher and block screenshots - UI + User interface OpenKeychain produced an error. Bad key for encryption. Accept @@ -589,7 +589,10 @@ Long Broadcast use Lets your contacts know when you use Conversations - Privacy + Appearance + Navigation + Input field + Privacy and data Theme Accent color Select the color palette diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index b881c5e80..d1b1790ec 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -4,9 +4,116 @@ android:background="?attr/color_background_secondary" android:key="main_screen"> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + android:defaultValue="@bool/skip_image_editor_screen" + android:key="skip_image_editor_screen" + android:summary="@string/pref_skip_image_editor_screen_summary" + android:title="@string/pref_skip_image_editor_screen" /> + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ + +