Merge pull request #11148 from osmandapp/fix_dialogs_and_notifications_ui

Fix summary of Dialogs and notifications preference
This commit is contained in:
Vitaliy 2021-03-15 18:32:06 +02:00 committed by GitHub
commit 78ce26b77f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 6 deletions

View file

@ -48,7 +48,6 @@
android:layout="@layout/preference_with_descr"
android:persistent="false"
android:title="@string/dialogs_and_notifications_title"
android:summary="@string/shared_string_all"
app:fragment="net.osmand.plus.settings.fragments.DialogsAndNotificationsSettingsFragment"
tools:icon="@drawable/ic_action_notification" />

View file

@ -6,11 +6,6 @@ import android.os.Bundle;
import android.util.Pair;
import android.widget.ImageView;
import androidx.fragment.app.FragmentManager;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
import androidx.preference.SwitchPreferenceCompat;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.dialogs.ConfigureMapMenu;
@ -27,6 +22,11 @@ import net.osmand.plus.settings.datastorage.item.StorageItem;
import net.osmand.plus.settings.preferences.ListPreferenceEx;
import net.osmand.plus.settings.preferences.SwitchPreferenceEx;
import androidx.fragment.app.FragmentManager;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
import androidx.preference.SwitchPreferenceCompat;
import static net.osmand.plus.profiles.SelectProfileBottomSheet.PROFILE_KEY_ARG;
import static net.osmand.plus.profiles.SelectProfileBottomSheet.USE_LAST_PROFILE_ARG;
@ -213,6 +213,20 @@ public class GlobalSettingsFragment extends BaseSettingsFragment
private void setupDialogsAndNotificationsPref() {
Preference dialogsAndNotifications = (Preference) findPreference(DIALOGS_AND_NOTIFICATIONS_PREF_ID);
dialogsAndNotifications.setIcon(getPersistentPrefIcon(R.drawable.ic_action_notification));
if (getSettings() == null) {
return;
}
boolean showStartupMessages = !getSettings().DO_NOT_SHOW_STARTUP_MESSAGES.get();
boolean showDownloadMapDialog = getSettings().SHOW_DOWNLOAD_MAP_DIALOG.get();
String summary;
if (showStartupMessages && showDownloadMapDialog) {
summary = getString(R.string.shared_string_all);
} else if (showStartupMessages || showDownloadMapDialog) {
summary = getString(R.string.ltr_or_rtl_combine_via_slash, "1", "2");
} else {
summary = getString(R.string.shared_string_disabled);
}
dialogsAndNotifications.setSummary(summary);
}
private void setupEnableProxyPref() {