From e6308bab522cbf0e894a8e079a52c9d81ac5e139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C6=B0ng=20Phan?= Date: Sat, 26 Sep 2020 12:29:26 +0700 Subject: [PATCH] Cherish:Intitial for Android 11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hưng Phan --- res/values-ru/cherish_strings.xml | 596 -------------- res/values-uk/cherish_about.xml | 44 -- res/values-uk/cherish_strings.xml | 396 ---------- res/values-uk/dslv_strings.xml | 40 - res/values-vi/cherish_strings.xml | 721 ----------------- res/values/cherish_arrays.xml | 735 ------------------ res/values/cherish_strings.xml | 712 ----------------- res/xml/audio_panel.xml | 57 -- res/xml/battery_bar.xml | 75 -- res/xml/battery_light_settings.xml | 50 -- res/xml/cherish_settings.xml | 4 +- res/xml/cherish_settings_animations.xml | 85 -- res/xml/cherish_settings_button.xml | 8 +- res/xml/cherish_settings_clock.xml | 106 --- res/xml/cherish_settings_fod_picker.xml | 29 - res/xml/cherish_settings_gaming_mode.xml | 73 -- res/xml/cherish_settings_lockscreen.xml | 96 --- res/xml/cherish_settings_misc.xml | 72 -- res/xml/cherish_settings_notifications.xml | 76 -- res/xml/cherish_settings_power.xml | 61 -- res/xml/cherish_settings_pulse.xml | 145 ---- res/xml/cherish_settings_quicksettings.xml | 224 +----- res/xml/cherish_settings_recents.xml | 20 +- res/xml/cherish_settings_statusbar.xml | 154 +--- res/xml/cherish_settings_theme.xml | 129 --- res/xml/cherish_settings_volume.xml | 2 +- res/xml/custom_carrier_label.xml | 31 - res/xml/edgepulse_settings.xml | 137 ---- res/xml/heads_up_settings.xml | 53 -- res/xml/qs_header.xml | 66 -- res/xml/slim_recent_app_sidebar.xml | 23 - res/xml/slim_recent_app_sidebar_style.xml | 58 -- res/xml/slim_recents.xml | 150 ---- res/xml/slim_recents_blacklist.xml | 27 - .../fragments/AnimationsSettings.java | 231 ------ .../fragments/AudioPanelSettings.java | 61 -- .../fragments/BatteryLightSettings.java | 88 +-- .../settings/fragments/ClockSettings.java | 303 -------- .../fragments/CustomCarrierLabel.java | 163 ---- .../cherish/settings/fragments/EdgePulse.java | 132 ---- .../fragments/FODIconPickerFragment.java | 49 -- .../settings/fragments/GamingMode.java | 342 -------- .../fragments/GamingModeReceiver.java | 51 -- .../cherish/settings/fragments/HeadsUp.java | 411 ---------- .../IncallFeedbackPreferenceController.java | 41 - .../fragments/LockScreenSettings.java | 33 +- .../settings/fragments/MiscSettings.java | 12 +- .../fragments/NotificationSettings.java | 61 +- .../settings/fragments/PulseSettings.java | 252 ------ .../cherish/settings/fragments/QsHeader.java | 227 ------ .../settings/fragments/QuickSettings.java | 112 +-- .../settings/fragments/RecentsSettings.java | 82 +- .../fragments/SlimRecentAppSidebar.java | 38 - .../fragments/SlimRecentAppSidebarStyle.java | 106 --- .../settings/fragments/SlimRecents.java | 392 ---------- .../fragments/SlimRecentsBlacklist.java | 294 ------- .../settings/fragments/StatusBarSettings.java | 127 --- .../settings/fragments/ThemeSettings.java | 398 +--------- .../preferences/fragments/BatteryBar.java | 259 ------ 59 files changed, 20 insertions(+), 9500 deletions(-) delete mode 100644 res/values-ru/cherish_strings.xml delete mode 100644 res/values-uk/cherish_about.xml delete mode 100644 res/values-uk/cherish_strings.xml delete mode 100644 res/values-uk/dslv_strings.xml delete mode 100644 res/values-vi/cherish_strings.xml delete mode 100644 res/xml/audio_panel.xml delete mode 100644 res/xml/battery_bar.xml delete mode 100644 res/xml/cherish_settings_clock.xml delete mode 100644 res/xml/cherish_settings_fod_picker.xml delete mode 100644 res/xml/cherish_settings_gaming_mode.xml delete mode 100644 res/xml/cherish_settings_pulse.xml delete mode 100644 res/xml/custom_carrier_label.xml delete mode 100644 res/xml/edgepulse_settings.xml delete mode 100644 res/xml/heads_up_settings.xml delete mode 100644 res/xml/qs_header.xml delete mode 100644 res/xml/slim_recent_app_sidebar.xml delete mode 100644 res/xml/slim_recent_app_sidebar_style.xml delete mode 100644 res/xml/slim_recents.xml delete mode 100644 res/xml/slim_recents_blacklist.xml delete mode 100644 src/com/cherish/settings/fragments/AudioPanelSettings.java delete mode 100644 src/com/cherish/settings/fragments/ClockSettings.java delete mode 100644 src/com/cherish/settings/fragments/CustomCarrierLabel.java delete mode 100644 src/com/cherish/settings/fragments/EdgePulse.java delete mode 100644 src/com/cherish/settings/fragments/FODIconPickerFragment.java delete mode 100644 src/com/cherish/settings/fragments/GamingMode.java delete mode 100644 src/com/cherish/settings/fragments/GamingModeReceiver.java delete mode 100644 src/com/cherish/settings/fragments/HeadsUp.java delete mode 100644 src/com/cherish/settings/fragments/IncallFeedbackPreferenceController.java delete mode 100644 src/com/cherish/settings/fragments/PulseSettings.java delete mode 100644 src/com/cherish/settings/fragments/QsHeader.java delete mode 100644 src/com/cherish/settings/fragments/SlimRecentAppSidebar.java delete mode 100644 src/com/cherish/settings/fragments/SlimRecentAppSidebarStyle.java delete mode 100644 src/com/cherish/settings/fragments/SlimRecents.java delete mode 100644 src/com/cherish/settings/fragments/SlimRecentsBlacklist.java delete mode 100644 src/com/cherish/settings/preferences/fragments/BatteryBar.java diff --git a/res/values-ru/cherish_strings.xml b/res/values-ru/cherish_strings.xml deleted file mode 100644 index f7b7478..0000000 --- a/res/values-ru/cherish_strings.xml +++ /dev/null @@ -1,596 +0,0 @@ - - - - - Любимые настройки - - Кнопки - Аппаратные кнопки, Панель навигации - Жесты - Открытие камеры, свайп для скриншота - Экран блокировки - Визуализатор музыки, анимация зарядки, стиль часов - Прочее - Режим игры, управление громкостью - Анимации - Системные анимации - Меню кнопки питания - Расширенный перезапуск, непрозрачность меню питания - Темы - Системная тема, округленная, переключить тему - Быстрые настройки - Расположение плитки, яркость миуи, размытие - Недавние приложения - Недавние приложения в стиле Slim - Строка состояния - Часы, логотип, значки в строке состояния - Качель регулировки громкости - Качель регулировки громкости - Уведомления - Индикатор батареи, заголовок уведомлений - Подробнее о Crowdin - Возможности устройства - Категория QS - - OK - Сбросить - Отменить - Сохранить - - Выбор цвета - Нажмите на оттенок ниже, чтобы применить его - - - Hex: - #ff000000 - Набор - По умолчанию - - Информация о зарядке на экране блокировки - Показывать напряжение, ток зарядки и температуру аккумулятора на экране блокировки во время зарядки - - Заменить надпись \"Очистить все\" на красивую кнопку - Показывать кнопку вместо текста для очистки всех уведомлений в быстрых настройках - Цвета плиток быстрых настроек - Использовать цвет акцента для плиток быстрых настроек и фона - Размытие - Установить прозрачность размытия - Размытие за быстрыми настройками (бета) - Затемненный фон за быстрыми настройками - Интенсивность размытия - Установить интенсивность/радиус размытия - \u0025 - - Вибрация для индикации статуса вызова - - Отображать обложки мультимедиа - Уровень размытия обложки - - Быстрые настройки - Строки (портрет) - Строки (ландшафт) - Колонки (портрет) - Колонки (ландшафт) - - Названия плиток - Включить для отображения заголовка плиток - - Вибрировать при касании - Вибрировать при нажатии на плитки быстрых настроек - Ползунок яркости внизу - Показывает слайдер яркости внизу быстрых настроек - OneUI - Показать пробел над настройками панели действий для более легкого использования с одной стороны\nВНИМАНИЕ: перезапустите настройки, чтобы увидеть эффект - - Стиль часов - Выберите стиль часов - Скрыть - Обычный - Обычный (жирный) - Обычный (цветовой акцент) - Обычный (цветные минуты) - Обычный (цветные часы) - Вертикальный - Вертикальный (жирный) - Вертикальный (цветные часы) - Вертикальный (цветные минуты) - - Стиль даты - Стиль даты - Выберите стиль даты - Обычный - Полупрозрачный - Полупрозрачный (скругленный) - Пузырь - Скруглённый, простой и с акцентом - Скругленный, прозрачный и с акцентом - Градиент - Темный с акцентом границ - Тёмный с градиентными границами - - Значки строки состояния - Системные значки - Управление отображением значков в строке состояния - - Элементы строки состояния - Часы - Дата - Часы и дата - Настройка отображения часов и даты в строке состояния - Расположение часов - Справа - По центру - Слева - Стиль AM/PM - 24-часовой формат времени включен - Нормальный - Маленький - Скрывать - Отображать секунды - Отображать секунды в часах строки состояния - Дата - Отображать дату перед часами - Скрывать - Маленький - Нормальный - Стиль даты - Нормальный - Нижний регистр - Прописной - Пользовательский Java-формат - Формат даты - %1$s - Должен быть в формате даты, например, ММ/дд/гг - Введите строку - Справа от часов - Слева от часов - Расположение даты - Скрывать часы автоматически - Скрывать и показывать часы через регулярные промежутки времени - Скрывать длительность - Отображать длительность - - Анимация заряда батареи - Показывать анимацию при подключении зарядного устройства - Выключена - Вспышка - Батарея - Капля - Взрыв - Вода - Разделить загрузку - Желтая анимация - Ковид19 - Мойте руки - Наденьте вашу маску - Loading - - Уровень заряда батареи - Процент заряда батареи - - Стиль значка батареи - Вертикальный значок (по умолчанию) - Круг (пунктирный) - Круг - Текст - Не показывать значок батареи - Большой круг - Круг (сплошной) - - Процент использования батареи - Скрыт (по умолчанию) - Внутри значка - Рядом со значком - Процент использования батареи при зарядке - Всегда отображать процент использования батареи при зарядке - - Процент использования батареи - Выключен - Включен - Включен (внутри значка) - Включено (оценка уровня заряда) - - Индикация трафика - Настройка индикатора сетевого трафика - Сетевой траффик - Выберите тип сетевой активности - Исходящий - Входящий - Исходящий и входящий - Показывать индикатор сетевого трафика в строке состояния - Порог отображения сетевой активности (КБ/с) - Скрывать стрелки - Скрывать стрелки индикатора сетевого трафика - - Значки - Значок 4G - Заменить значок LTE на 4G - - Значок VoLTE - Отображать значок VoLTE (необходимо перезапустить интерфейс, чтобы изменения вступили в силу) - - Выбрать значок VoLTE - Значок по умолчанию - Значок VoLTE - Значок VoLTE в стиле OOS - Значок HD - Значок VoLTE в стиле Miui - Значок VoLTE в стиле Asus - EMUI - - Визуализация спектра музыки - Визуализатор музыки - - Вибрация при авторизации отпечатком - Вибрировать при успешном распозновании отпечатка пальца - - Расширенная перезагрузка - Когда устройство разблокировано, в меню питания доступны опции перезагрузки в режим восстановления и в загрузчик - - Индикация зарядки батареи - Включить - Индикация батареи в режиме \"Не беспокоить\" - Индикация при низком заряде батареи - Цвет индикации при зарядке - Низкий заряд батареи - Средний заряд батареи - Почти полный заряд батареи - Полный заряд батареи (100) - - Использовать старый стиль индикации мобильной сети - Объединить значки уровня сигнала и типа сети - - Системная тема - Выберите тему - Светлая - Тёмный Google - Соляризованная темная - Зелёная - Choco X - Тёмно-чёрный - Тёмно-серый - Материал Океан - Очистить источник - - Защитить меню питания - Защитить меню питания - Разрешить действия в меню питания только после идентификации - Экстренный вызов - Прозрачность меню питания/перезагрузки - Прозрачность меню кнопки питания - Затемнение фона - - Скруглённые углы - Регулировка закругленных углов и отступы - Разрешить настраиваемые закругленные углы - Радиус скругления углов - Отступ углов - Дополнительные отступы в строке состояния - Используйте базовые значения - Полезно, если устройство имеет закруглённые углы - - Медиа - Адаптивное воспроизведение - Приостанавливать воспроизведение при выключенном звуке и возобновлять его, увеличивая громкость в пределах таймаута - Таймаут воспроизведения - 30 сек. - 1 мин. - 2 мин. - 5 мин. - 10 мин. - - Логотип - Логотип оператора - Настройки отображения оператора - Пользовательский логотип - Введите свое название. Оставьте пустым, чтобы использовать текущее имя сети - Пользовательская метка не установлена - Имя оператора - Выключен - Экран блокировки - Строка состояния - Оба - - Меню кнопки питания - Отображать меню кнопки питания на защищенном экране блокировки - - Альтернативная панель недавних - При использовании свайпа вверх по кнопке \"Домой\" для открытия недавних поддерживается только стоковое отображение недавних приложений - Миниатюры - Включите, чтобы использовать другие экраны меню недавних - Настройки меню недавних приложений от Slim - Дополнительные настройки для Slim - Максимум запущенных приложений - Размер - Расширенный режим - Расширенный предпросмотр недавних приложений - Автоматически (по умолчанию) - Всегда - Никогда - Выключен - Цвет фона панели - Цвет фона карточки - Долгое нажатие в панели памяти - Очищать недавние приложения при длительном нажатии на панель памяти - Набор значков - Применить свой набор значков для приложений в панели - Наборы значков не установлены - Выбрать набор значков - Стандартные иконки - Радиус закругления карточки - - Показать слева - Показать панель недавних приложений с левого края - Чёрный список - Чёрный список приложений - Приложения не будут отображаться в панели - Добавить приложение - Нажмите здесь, чтобы добавить новое приложение; нажмите на добавленное приложение, чтобы удалить его - - Боковая панель приложений - Боковая панель недавних приложений - Отображать значки приложений с другого края - Быстрые клавиши на боковой панели - Выберите приложения для отображения на боковой панели - Вид боковой панели - Изменить вид боковой панели - Скрывать подписи значков - Цвет метки - Цвет фона - Размер - Открывать одновременно с недавними - Уменьшить подлагивание открытия недавних, отключив это - По умолчанию (на основе приложения) - - По умолчанию - Выбор приложения - Удалить - Удалить выбранный элемент? - Панель ОЗУ - Показывать использование ОЗУ - Показать полосу использования ОЗУ - Цвет шкалы - Цвет полосы памяти - Анимация - Перевести - Затухание - - Показывать заголовки уведомлений - Показывать ли заголовки уведомлений R (Требуется перезапуск SystemUI) - - Система - Анимация открытия активности - Анимация закрытия действия - Открытие задачи - Анимация открытия фоновой задачи - Анимация закрытия задачи - Анимация перемещения вперед - Анимация движения назад - Анимация открытия обоев - Закрытие обоев - Внутр. анимация открытия обоев - Обои внутри анимации закрытия - Длительность анимации - Предотвращение переопределения приложения - Предотвратить переопределение переходов в приложениях - По умолчанию - - Пробуждать во время зарядки - Разбудить устройство при подключении/отключении зарядного устройства - - Отключить быстрые настройки на экране блокировки - Запретить выдвигать панель на защищенном экране блокировки - - Быстрый доступ - Движение %1$s открывает переключатели - Всегда показывать быстрые настройки при вытягивании строки состояния - Выключено - Слева - Справа - Всегда - - При подключённой гарнитуре, входящий вызов воспроизводить через - Только гарнитура при активной музыке - Динамик и гарнитуру - - Принудительно разворачивать уведомления - Доступно для приложений поддерживающих расширенные уведомления - - Стиль переключателей настроек - По умолчанию - Material Design 2 - OnePlus - Узкий - Содержимое - Ретро - Заливка - Телеграм - - Игровой режим - Настроить параметры игрового режима - Автоматически включать для этих приложений - Добавить приложения для игрового режима - Игровой режим будет включен автоматически, когда эти приложения будут открыты, и выключен, когда они закроются - Блокировать уведомления - Блокировать все уведомления, кроме звонков - Заблокировать кнопки - Отключить аппаратные кнопки при включённом игровом режиме - Отключить автоматическую яркость - Фиксировать яркость экрана при включённом игровом режиме - Звонок в игровом режиме - Не изменять - Вибрация - Не беспокоить - Без звука - Индикация в игровом режиме - Отключена - Показывать уведомление - Показывать всплывающие сообщения - Показывать всплывающие сообщения и уведомления - Автоматический режим - Пытаться обнаружить и добавить игровые приложения автоматически - - Длительность - Уведомление будет показываться %d секунд - 2 секунды - 4 секунды - 5 секунд - 6 секунд - 8 секунд - 10 секунд - - Всплывающие - Всплытие - Выводить уведомления строки состояния - Добавить приложение - Список остановок - Отключить всплывающие уведомления от этих приложений - Чёрный список - Отключить всплывающие уведомления для этих приложений - - Таймер переноса - Свайп вверх по всплывающему уведомлению от этого приложения скроет его на одну минуту - Смахивание вверх отложит всплывающие уведомления от приложения на %d минут(ы) - Функция \"Отложить\" отключена - 1 мин. - 5 минут - 10 минут - 15 минут - 20 минут - - Меньше всплывающих уведомлений - Показывать всплывающие уведомления только для телефона, сообщений и будильника - - Посторонние - Выбор иконки FOD - Выберите вашу любимую иконку отпечатка пальца - Чтобы добавить свою иконку, выберите иконку в верхнем левом углу и с помощью приложения OnePlus 6T FP Customizer добавьте нужную иконку. - - Значки панели настроек - Стандартный фон - Акцент фона - Обычный - Обычный акцент - OnePlus - Random Background - Random Icon - Icon Random Bg Accent - Icon Accent Bg Random - - Панель громкости - Медиа - Кольцо - Уведомление - Будильник - Голос - Bluetooth - - Значок VoWiFi - Значок VoWiFi включен - Значок VoWiFi отключен - VoWiFi вместо значка VoLTE - Стиль иконки VoWiFi - Стандартная иконка - Значок EMUI - Asus иконка - OOS иконка - Иконка Motorola - - Текст нижнего колонтитула - Отображать текст внизу панели быстрых настроек - Пользовательский текст нижнего колонтитула - Выставьте пустым для строки по умолчанию #KeepEvolving - Слайдер яркости MIUI (бета) - Показывать ползунок яркости в панели быстрых настроек - - Dashboard conditions - Display condition cards in Settings screen - Dashboard suggestions - Display suggestion cards in Settings screen - - Volume Panel Style - AOSP - Compat - Oreo - Tiled - - co.potatoproject.plugin.volume.aosp - co.potatoproject.plugin.volume.compact - co.potatoproject.plugin.volume.oreo - co.potatoproject.plugin.volume.tiled - - Power menu - Power menu animation - Change the enter/exit animation of the power menu - Select power menu animation - AOSP (default) - Bottom - Top - Fly - Slide - Turn - Glow - 3D - Translucent (top) - Translucent (bottom) - Rotate - - Header image - Use a custom image for QS header - Image type - Automatic (Time based) - Static - Image collection - Disabled - Pick image from collection - Select an image from pre-installed image collections - Pick image from storage - Select an image from internal storage - Darken image - Image height offset - - Screen - Edge lighting - Light up the side edges of the screen on notification pulse - Edge light color - Automatic color - Sync color with wallpaper - Edge light pulse duration - Left Edge - Right Edge - Show on AoD - Keep showing on always on display. Until the screen is turned on - Hide AoD content - Hide other AoD content when bars are showing - Pulse for all doze events - Pulses for any doze wake and not just notifications when enabled - Accent color - Sync color with accent color - Repeat edge lighting - Repeat edge lighting animation on doze wake - Edge Light Animation - Restart - Reverse - Edge Light View - Solid - Faded - Show data usage in qs header - Shows data usage in quick settings header of sim used for data - - QS Header style - Black - Grey - Light Grey - Accent Based - Transparent - diff --git a/res/values-uk/cherish_about.xml b/res/values-uk/cherish_about.xml deleted file mode 100644 index 5da7d21..0000000 --- a/res/values-uk/cherish_about.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - Про - Про нас - CherishOS на основі Пікселя досвіду, з деяким доданим додатком. Ми приносимо прошивку з цим винятковим досвідом, баланс функцій і поліпшимо життя батареї. - Про CherishOS - Зустрітись з нашою командою - Кунг Фан - Засновник - Кунг Фан - Головний розробник - Поїхали! - Вебсайт - Сайт CherishOS для інформації та іншого. - http://cherish.github.io - Телеграм - CherishOS канал. - https://t.me/CherishOS - ГітХаб - Ми є відкритим кодом! - https://github.com/CherishOS/ - Підтримати - Пожертва не є необхідною, але кожна копійка від вас допоможе нам сплачувати рахунки за сервери. - https://paypal.me - - Офіційні пристрої - Супроводжуючі - офіційні пристрої та супроводжуючі - diff --git a/res/values-uk/cherish_strings.xml b/res/values-uk/cherish_strings.xml deleted file mode 100644 index 7a73c15..0000000 --- a/res/values-uk/cherish_strings.xml +++ /dev/null @@ -1,396 +0,0 @@ - - - - - Улюблені налаштування - - Кнопки - Жести - Екран блокування - Різне - Анімації - Меню живлення - Теми - Швидкі налаштування - Нещодавні додатки - Панель статусу - Клавіші регулювання гучності - Сповіщення - Функції пристрою - Категорія QS - - Добре - Скинути - Скасувати - Зберегти - - Палітра кольорів - Натисніть на колір нижче, щоб застосувати - - - Хекс: - #ff000000 - Встановити - Типово - - Інформація про заряджання - Відображення максимальної напруги струму і температуру акумулятора на екрані блокування під час зарядки - - Змінити напис Очистити все на декоративну кнопку - Показувати декоративну кнопку замість напису Очистити все для очистки повідомлень - Кольори плиток швидких налаштувань - Використовувати колір акценту для плиток швидких налаштувань і тла - Прозорість альфа - Встановлює прозорість розмиття - Розмиття позаду швидких налаштувань (бета-версія) - розмиття темного фону позаду швидких налаштувань - Інтенсивність ефекту розмиття - Встановлює інтенсивність/радіус розмиття - \u0025 - - Вібрація під час індексації статусу виклику - - Показувати обкладинку мультимедіа - Рівень розмитості медіа - - Швидкі налаштування - Рядки (портретна орієнтація) - Рядки (альбомна орієнтація) - Колонки (портретна орієнтація) - Колонки (ландшафтна орієнтація) - - Видимість назви - Відображення заголовка плиток - - Вібрація при дотику - Вібрація при дотику до плитки швидких налаштувань - Повзунок яскравості знизу - Показувати повзунок яскравості на панелі швидких налаштувань - OneUI - Показати пробіл над панеллю налаштувань для спрощення використання однією рукою\nПРИМІТКА: перезапустіть параметри, щоб побачити ефект - - Стиль годинника - Обрати стиль годинника - Приховати - Типово - За замовчуванням (жирний) - За замовчуванням (акцент годин) - За замовчуванням (акцент хвилин) - За замовчуванням (акцент годин) - Вертикальний - Вертикальний (жирний) - Вертикальні (акцент годин) - Вертикальні (акцент хвилин) - - Стиль дати - Стиль дати - Вибрати стиль дати - Типово - Напів-прозора коробка - Напівпрозорий (закруглений) - Q Бета пігулка - Закруглена, проста з акцентом - Закруглена, прозора з акцентом - Градієнт - Темний з акцентованими гранями - Темна з градієнтом кутів - - Значки статус бару - Системні значки - Керування відображенням значків в рядку стану - - Значки рядку стану - Годинник - Дата - Годинник і дата - Налаштування годинника і дати в рядку стану - Позиція годинника - Праворуч - По центру - Ліворуч - 12-годинний формат часу (AM/PM) - 24-годинний формат часу ввімкнено - Звичайний - Малий - Прихований - Показати секунди - Відображати годинник з секундами в рядку стану - Дата - Відображати користувацький формат дати перед годинником - Прихований - Малий - Звичайний - Стиль дати - Звичайний - Нижній регістр - Верхній регістр - Користувацький java формат - Формат дати - %1$s - Значення має відповідати формату дати, наприклад: ММ/ДД/РР - Введіть рядок - Праворуч від часу - Ліворуч від часу - Розташування дати - Автоматично приховувати годинник - Приховати і відображати годинник через регулярні проміжки часу - Приховати тривалість - Показати тривалість - - Анімація заряджання - Показувати анімацію при підключенні зарядного пристрою - Вимкнено - Спалах - Батарея - Крапля - Вибух - Вода - - Рівень заряду акумулятора - Відсоток заряду батареї - - Стиль батареї - Портретна іконка (за замовчуванням) - Кільце (пунктирне) - Кільце - Текст - Прихований - Велике коло - Коло (заповнене) - - Відсоток заряду батареї - Прихований (типово) - Всередині значка - Поруч зі значком - Показувати відсотки при заряджанні - Завжди показувати відсотки акумулятора під час заряджання - - Відсоток заряду батареї - Вимкнено - Ввімкнено - Увімкнено (всередині значка) - Увімкнено (приблизно) - Увімкнено (відсоток | оцінка) - - Індикатор трафіку - Налаштування індикатора трафіку - Мережевий трафік - Оберіть тип мережевої активності - Вихідний - Вхідний - Вихідний і вхідний - Відображати активність мережі у рядку стану - Автоматичне приховування індикатора мережевої активності (кБ/с) - Приховати стрілки - Приховати стрілки в індикаторі трафіку - - Значки - Значок 4G - Показувати значок 4G замість LTE в рядку стану - - VoLTE значок - Відображати значок VoLTE (потребує перезавантаження SystemUI, щоб зміни вступили в силу) - - Виберіть значок VoLTE - Типовий значок - VoLTE значок - VoLTE OOS значок - Значок HD - VoLTE Miui значок - VoLTE Asus значок - - Відображати візуалізатор музики - Візуалізатор музики - - Вібрація розпізнавання відбитку пальця - Вібрувати при успішному розпізнаванні відбитку пальця - - Розширене перезавантаження - Коли пристрій розблоковано, в меню живлення доступні опції перезавантаження в режим відновлення і завантажувач - - Індикація зарядки акумулятора - Увімкнений - Індикатор заряду в режимі \"Не турбувати\" - Блимання індикатора при низькому заряді - Колір індикатора під час заряджання - Низький заряд батареї - Помірний заряд батареї - Майже повний заряд батареї - Повний заряд батареї (100%) - - Використовувати старий стиль мобільних даних - Об\'єднати значки сигналу і типу підключення - - Тема системи - Обрати тему - Світлий - Темна Google - Термінова темна - Печена зелена - Чоко - Х - Насичена чорна - Темно-сірий - Матеріальний океан - - Акцент ПГБ | Градієнт Теми - Теми - Акканс-Градієнт-Тем - Вибір акценту - Градієнтний Мейкер - Вибір градієнту - Градієнтний ефект - - Захищене меню живлення - Захищене меню живлення - Дозволити меню живлення тільки після аутентифікації - Екстрений виклик - Прозорість меню вимкнення / перезавантаження - Прозорість меню живлення/перезавантаження - Затемнення фону при відображенні меню живлення - - Затемнення фону при відображенні меню живлення - Налаштувати закруглені кути та поля - Налаштувати закруглені кути - Радіус закруглення кутів - Відступ від кута - Відступ рядка стану - Використовувати значення фреймворку - Корисно, якщо пристрій уже має закруглені кути - - Медіа - Адаптивне відтворення - Призупиняти медіа, коли гучність вимкнено та відновіть його шляхом збільшення гучності в межах тайм-ауту - Тайм-аут відтворення - 30 секунд - 1 хвилина - 2 хвилини - 5 хвилин - 10 хвилин - - Відмітка - Мітка оператора - Власна назва оператора - Власна мітка оператора - Введіть свою назву оператора. Залиште порожнім, щоб використовувати поточне ім\'я мережі - Мітка оператора не встановлена - Колір мітки оператора - Вимкнено - Екран блокування - Панель стану - Обидва - - Меню живлення - Показувати меню живлення на екрані блокування - - Альтернативні панелі нещодавніх - При при свайпі вверх до домашньої навігації, відкриваються \"останні\" (підтримуються лише стокові додатки) - Панель нещодавніх додатків Slim - Увімкніть, щоб використовувати альтернативний вигляд нещодавніх - Налаштування меню нещодавніх додатків від Slim - Налаштувати додаткові налаштування для нещодавніх Slim - Максимальна дозволена кількість застосунків - Розмір - Розширений режим - Останні завдання розширеного \"режим перегляду\" - Авто (за замовчуванням) - Завжди - Ніколи - Вимкнено - Колір фону панелі - Колір фону картки - Довге натиснення на індикатор пам\'яті - Очищення нещодавніх довгим натисненням на індикатор пам\'яті - Набір значків - Застосувати користувацький набір іконок для додатків на панелі - Жодного набору значків не встановлено - Вибрати набір значків - Типові значки - Змінити радіус округлення - - Показати на лівому краю - Показати панель останніх програм на лівому краю - Чорний список - Чорний список додатків - Додаток не відображатиметься в панелі - Додати застосунки - Натисніть тут, щоб додати новий додаток; натисніть на додаток, щоб видалити його - - Бічна панель додатка - Бокова панель нещодавніх - Показувати ярлики додатків біля іншого краю - Бічна панель ярликів - Виберіть додатки для відображення в бічній панелі - Вид бічній панелі - Змінити вигляд бічній панелі - Сховати підписи значків - Колір підписів значків - Колір фону - Розмір - Відкривати одночасно з нещодавніми - Зменшити підлагування відкриття нещодавніх, вимкнувши це - За замовчуванням (залежно від додатку) - - Типово - Вибрати програму - Видалити - Видалити вибраний елемент? - Смуга використання Озу - Пам\'яті рядок - Показувати смугу використання ОЗП - Колір індикатора памяті - Колір тексту в індикаторі памяті - Анімація - Переклад - Блякнути - - Показувати сповіщення - Чи показувати заголовки сповіщень в стилі R (потрібен перезапуск SystemUI) - - Система - Анімація відкриття - Анімація закриття активності - Анімація відкриття задачі - Анімація відкриття фонової задачі - Анімація закриття задачі - Анімація переміщення на передній план - Анімація дії \"назад\" - Анімація відкриття шпалери - Анімація закриття шпалер - Анімація всередині відкриття шпалери - Анімація всередині закриття шпалери - Тривалість анімації - Запобігти перевизначення програми - Запобігти перевизначення переходів в програмах - Типово - - Прокидатися при зарядці - Розбудити пристрій, якщо підключено/відключено від ЗП - - Вимкнути швидкі налаштування на екрані блокування - Вимкнути швидкі налаштування на захищеному екрані блокування - - Швидкий доступ - %1$s край рядка стану витягує швидкі налаштування - Завжди витягати швидкі налаштування - Вимкнено - Ліворуч - Праворуч - Завжди - - При підключенні гарнітури відтворюється вхідний дзвінок - Навушники, лише якщо музика активна - Звук і динамік, і гарнітура - - Примусово розширені повідомлення - Примусити показувати розширені сповіщення для програм, які це підтримують - diff --git a/res/values-uk/dslv_strings.xml b/res/values-uk/dslv_strings.xml deleted file mode 100644 index 8b0c989..0000000 --- a/res/values-uk/dslv_strings.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - Жоден - Тривале натискання: - Виберіть дію при тривалому натисканні: - Вибрати дію: - Вибрати нову дію: - Скинути - Додати - Досягнуто максимальний розмір записів - Попередження - Неможливо видалити останній запис - Вимкнено\nДодайте запис, щоб увімкнути цю функцію - Вибраний додаток не повертає допустимий значок або не підтримує кадрування зображень. Використайте інший додаток. - Вибрану дію не можна додати двічі - Ярлик - кнопка - додаток - , вибір значка виведе параметри персоналізації - Щоб додати %1$s, виберіть піктограму Додати. Після того, як %1$s додано, вибраний рядок змінить ціль%2$s\n\nЩоб видалити %1$s, проведіть пальцем по рядку горизонтально вправи чи вліво. Змініть порядок %1$s в списку, пересунувши вертикально якір вліво.\n\nЩоб очистити значення, або скинути по замовчуванням - виберіть піктограму Скинути. - Видалення кожного %1$s в списку повністю вимкне функцію. - Видалення кожного %1$s в списку повністю вимкне другий шар pie. - Додатки - Обрати власну програму - Виберіть тип значка: - Типово - Світлини - Скинути всі записи за замовчуванням? - Допомога - Користувацький додаток - Головна - Назад - Меню - Відкрити перемикач IME - Меню живлення - Нещодавні - Вимкнути екран - Пошук у застосунку - diff --git a/res/values-vi/cherish_strings.xml b/res/values-vi/cherish_strings.xml deleted file mode 100644 index cb76404..0000000 --- a/res/values-vi/cherish_strings.xml +++ /dev/null @@ -1,721 +0,0 @@ - - - - - Thông Điệp Yêu Thương - - Phím - Phím cứng, Thanh điều hướng - Cử chỉ - Mở nhanh máy ảnh, vuốt để chụp màn hình - Màn hình khoá - Sóng nhạc, hiệu ứng sạc, kiểu đồng hồ - Khác - Chế độ chơi game, bảng điều khiển âm lượng - Hiệu ứng - Hoạt ảnh hệ thống - Trình đơn nguồn - Khởi động nâng cao, menu nguồn độ mờ - Chủ đề - Chủ đề hệ thống, tròn, chủ đề công tắc - Cài đặt nhanh - Bố cục gạch, độ sáng Miui, mờ - Ứng dụng gần đây - Kiểu Slim recents - Thanh trạng thái - Đồng hồ, nhà mạng, biểu tượng trạng thái - Phím Âm lượng - Phím Âm lượng - Thông báo - Đèn sạc, tiêu đề thông báo - Tìm hiểu thêm về CherishOS - Tính năng thiết bị - Kiểu Qs - - OK - Thiết lập lại - Huỷ - Lưu - - Bảng màu - Chạm vào màu sắc bên dưới để áp dụng - - - Hex: - #ff000000 - Thiết lập - Mặc định - Xanh - Đỏ - - Thông tin sạc màn hình khoá - Hiển thị điện áp bộ sạc tối đa hiện tại đã ước tính và nhiệt độ pin trên màn hình khóa trong khi sạc - - Thay thế xóa tất cả văn bản bằng nút đẹp - Hiển thị xóa tất cả nút thông báo trong cài đặt nhanh thay vì văn bản mặc định - Màu tiles QS - Sử dụng màu nhấn cho biểu tượng và hình nền của qs - Làm mờ alpha - Đặt độ trong suốt mờ - Làm mờ phía sau cài đặt nhanh (beta) - làm mờ nền tối phía sau cài đặt nhanh - Mức độ làm mờ - Đặt cường độ / bán kính mờ - \u0025 - - Rung để chỉ trạng thái cuộc gọi - - Hiển thị ảnh bìa đa phương tiện - Mức độ mờ ảnh bìa - - Cài đặt nhanh - Hàng (màn hình dọc) - Hàng (ngang) - Cột (màn hình dọc) - Cột (màn hình ngang) - - Hiển thị tiêu đề - Hiển thị các tiêu đề bên dưới ô cài đặt nhanh - - Rung khi chạm - Rung khi chạm các ô cài đặt nhanh - Thanh trượt chỉnh độ sáng ở dưới - Hiển thị thanh trượt độ sáng trong bảng cài đặt nhanh - OneUI - Hiển thị thanh hành động cài đặt trên miếng đệm để sử dụng dễ dàng hơn bằng một tay \ nNote: khởi động lại ứng dụng cài đặt để thấy hiệu quả - - Kiểu đồng hồ - Chọn kiểu đồng hồ - Ẩn - Mặc định - Mặc định (đậm) - Mặc định (màu ấn) - Đồng hồ dọc (Màu nhấn theo phút) - Mặc định (giờ nhấn) - Đồng hồ dọc - Xếp dọc (đậm) - Đồng hồ dọc (Màu nhấn theo giờ) - Đồng hồ dọc (Màu nhấn theo phút) - - Kiểu ngày - Kiểu ngày - Chọn kiểu đồng hồ - Mặc định - Hộp bán trong suốt - Hộp bán trong suốt (bo tròn) - Q Beta pill - Bo tròn, đơn giản và với màu nhấn - Bo tròn, trong suốt và với màu nhấn - Gradient - Tối với viền có dấu - Tối với viền chuyển màu - - Biểu tượng thanh trạng thái - Biểu tượng hệ thống - Kiểm soát những biểu tượng thanh trang thái được hiển thị - - Biểu tượng thanh trạng thái - Đồng hồ - Ngày - Đồng hồ & ngày - Tuỳ chỉnh đồng hồ và ngày trong thanh trạng thái - Vị trí đồng hồ - Phải - Giữa - Trái - Kiểu SA/CH - đồng hồ dạng 24-giờ được kích hoạt - Bình thường - Nhỏ - Ẩn - Hiển thị giây - Hiển thị giây trong đồng hồ trên thanh trạng thái - Ngày - Hiển thị ngày tùy chỉnh trước đồng hồ - Ẩn - Nhỏ - Bình thường - Kiểu ngày - Bình thường - Chữ thường - Chữ thường - Định dạng java tùy chỉnh - Định dạng ngày tháng - %1$s - Phải thuộc định dạng ngày, ví dụ MM/dd/yy - Nhập Chuỗi - Bên phải thời gian - Bên trái thời gian - Vị trí ngày - Tự ẩn đồng hồ - Ẩn và hiển thị đồng hồ trong khoảng thời gian đều đặn - Thời gian ẩn - Hiển thị thời gian - - Hiệu ứng sạc - Hiển thị hiệu ứng chớp khi thiết bị được cắm sạc - Tắt - Đèn flash - Pin - Bỏ - Nổ - Nước - Split Loading - Hoạt ảnh màu vàng - Covid19 - Rửa tay của bạn - Đeo khẩu trang - Đang tải - - Mức pin - Phần trăm pin - - Kiểu pin - Biểu tượng chân dung (mặc định) - Vòng tròn (Chấm) - Vòng tròn - Văn bản - Ẩn - Vòng tròn lớn - Vòng tròn (Đầy) - - Phần trăm pin - Ẩn (mặc định) - Bên trong biểu tượng pin - Bên cạnh biểu tượng pin - Hiển thị phần trăm pin lúc sạc - Luôn hiển thị dung lượng pin lúc sạc - Hiển thị tình trạng sạc pin - Hiển thị biểu tượng \u26A1\uFE0E gần văn bản pin khi sạc - - Biểu tượng pin - Ẩn biểu tượng pin - Ẩn biểu tượng pin khỏi tiêu đề cài đặt nhanh - Phần trăm pin - Tắt - Bật - Đã bật (biểu tượng bên trong) - Đã bật (ước tính) - Đã bật (phần trăm | ước tính) - - Hiển thị tốc độ mạng - Tùy chỉnh chỉ số lưu lượng mạng - Lưu thông mạng - Chọn kiểu hoạt động mạng - Tải lên - Tải xuống - Tải lên và Tải xuống - Hiện biểu tượng lưu lượng mạng trên thanh trạng thái - Tự động ẩn mạng (KB/s) - Ẩn mũi tên - Ẩn biểu tượng mũi tên chỉ lưu lượng mạng - - Biểu tượng - Biểu tượng 4G - Hiển thị biểu tượng 4G thay vì LTE - - Biểu tượng VoLTE - Hiển thị biểu tượng VoLTE (Cần khởi động lại SystemUI để có hiệu lực) - - Chọn biểu tượng VoLTE - Biểu tượng Mặc định - Biểu tượng VoLTE - Biểu tượng VoLTE OOS - Biểu tượng HD - Biểu tượng VoLTE Miui - Biểu tượng VoLTE Asus - EMUI - - Hiển thị trình trực quan âm nhạc - Trình hiển thị nhạc - - Rung khi xác thực dấu vân tay - Rung khi xác thực dấu vân tay thành công - - Khởi động lại nâng cao - Khi mở khóa, bao gồm các tùy chọn trong trình đơn nguồn để khởi động lại vào phục hồi hoặc trình nạp khởi động - - Đèn báo sạc pin - Bật - Đèn báo pin trong chế độ không làm phiền - Đèn nhấp nháy trên pin yếu - Màu đèn báo pin khi sạc - Pin yếu - Pin trung bình - Gần đầy pin - Pin đầy (100%) - - Sử dụng kiểu di động cũ - Hợp nhất các tín hiệu và loại biểu tượng - - Chủ đề hệ thống - Lựa chọn chủ đê - Sáng - Google dark - Solarized dark - Baked Green - Choco X - Đen tuyền - Màu xám đen - Material Ocean - Clear Spring - - Menu nguồn an toàn - Khóa menu nguồn - Chỉ cho phép hành động menu nguồn sau khi xác thực - Khẩn cấp - Menu nguồn trong suốt - Độ mờ của menu nguồn / khởi động lại - Nguồn/ khởi động lại hộp thoại mờ nền - - Góc tròn - Điều chỉnh các góc tròn và phần đệm - Tùy chỉnh các góc tròn - Bán kính góc tròn - Góc đệm nội dung - Thanh đệm thêm thanh trạng thái - Sử dụng các giá trị khung - Hữu ích nếu thiết bị thực sự có các góc tròn - - Âm nhạc/phương tiện - Phát lại thích ứng - Tạm dừng phương tiện khi âm lượng bị tắt và tiếp tục lại bằng cách tăng âm lượng trong thời gian chờ - Thời hạn phát lại - 30 giây - 1 phút - 2 phút - 5 phút - 10 phút - - Nhãn hiệu - Tên nhà mạng - Tùy chỉnh tên của nhà mạng - Tùy chỉnh tên nhà mạng - Nhập nhãn tùy chỉnh. Để trống để sử dụng tên mạng của bạn - Nhãn tùy chỉnh hiện không được đặt - Địa chỉ tên nhà mạng - Đã tắt - Màn hình khóa - Thanh trạng thái - Cả hai - - Menu nguồn - Cho phép truy cập menu nguồn trên màn hình khóa an toàn - - Thay thế gần đây - Khi sử dụng thao tác vuốt lên nút home điều hướng để mở đa nhiệm , chỉ mục gần đây gốc được hỗ trợ - Slim Recents - Cho phép sử dụng một màn hình đa nhiệm thay thế - Cài đặt slim recents - Tùy chỉnh các cài đặt bổ sung cho slim recents - Ứng dụng cho phép tối đa - Kích thước - Chế độ mở rộng - Chế độ xem trước các tác vụ gần đây mở rộng - Tự động (mặc định) - Luôn luôn - Chưa bao giờ - Tắt - Màu nền bảng ứng dụng gần đây - Màu nền thẻ - Nhấn giữ thanh hiển thị bộ nhớ - Xóa các mục gần đây bằng cách nhấn giữ thanh hiển thị bộ nhớ - Gói biểu tượng - Áp dụng một gói biểu tượng tuỳ chỉnh cho các ứng dụng trong bảng điều khiển - Chưa cài gói biểu tượng - Chọn gói biểu tượng - Biểu tượng mặc định - Độ bo góc - - Hiện bên trái góc - Hiện bảng điều khiển ứng dụng gần đây trên cạnh trái của góc màn hình - Danh sách đen - Ứng dụng danh sách đen - Ứng dụng không hiển thị trong bảng điều khiển - Thêm ứng dụng - Chạm vào đây để thêm, chạm vào ứng dụng đã thêm để xoá - - Thanh bên ứng dụng - Cạnh bên các ứng dụng đa nhiệm - Hiện các lối tắt ứng dụng trên cạnh khác - Phím tắt cạnh bên - Chọn ứng dụng hiện thị trên cạnh bên - Kiểu thanh bên - Thay đổi giao diện của thanh bên - Ẩn nhãn biểu tượng - Màu nhãn - Màu nền - Kích thước - Mở đồng thời với danh sách đa nhiệm - Giảm độ trễ khi mở đa nhiệm bằng cách tắt nó - Mặc định (dựa trên ứng dụng) - - Mặc định - Chọn ứng dụng - Xóa - Xóa mục đã chọn? - Thanh hiển thị bộ nhớ - Thanh hiển thị bộ nhớ - Hiển thị thanh tiến trình hiển thị RAM - Màu thanh bộ nhớ - Màu văn bản thanh bộ nhớ - Hoạt ảnh - Dịch - Mờ dần - - Hiển thị tiêu đề thông báo - Có hiển thị tiêu đề thông báo kiểu R hay không (Yêu cầu khởi động lại giao diện người dùng hệ thống) - - Hệ thống - Hoạt ảnh hành động mở - Hoạt ảnh hành động đóng - Hoạt ảnh mở tác vụ - Hoạt ảnh mở tác vụ phía sau - Hoạt ảnh đóng tác vụ - Hoạt ảnh di chuyển tới trước - Hoạt ảnh di chuyển ra sau - Hoạt ảnh mở hình nền - Hoạt ảnh đóng hình nền - Hoạt ảnh mở giữa hình nền - Hiệu ứng đóng bên trong ảnh nền - Thời lượng hoạt ảnh - Ngăn chặn ứng dụng ghi đè - Ngăn ứng dụng ghi đè các hiệu ứng chuyển động - Mặc định - - Bật màn hình khi sạc - Đánh thức thiết bị nếu đã cắm/đã rút sạc - - Vô hiệu hoá bảng cài đặt nhanh khi bị khoá - Vô hiệu hóa mở rộng cài đặt nhanh trên màn hình khóa an toàn - - Kéo xuống nhanh - Kéo từ cạnh %1$s thanh trạng thái xuống để truy cập cài đặt nhanh - Luôn hiển thị Cài đặt nhanh khi kéo xuống thanh trạng thái - Tắt - Trái - Phải - Luôn luôn - - Khi tai nghe được kết nối, cuộc gọi đến sẽ bật - Tai nghe chỉ hoạt động khi nhạc đang phát - Cả loa và tai nghe - - Buộc mở rộng thông báo - Chỉ có sẵn cho các ứng dụng hỗ trợ thông báo mở rộng - - Chuyển đổi ngoại hình - Mặc định - Material Design 2 - OnePlus - Hẹp - Bộ chứa - Retro - Stockish - Telegram - - Chế độ chơi game - Tùy chỉnh tùy chọn chế độ trò chơi - Tự động bật cho các ứng dụng này - Thêm ứng dụng cho chế độ chơi game - Chế độ chơi game sẽ tự động bật tắt đối với các ứng dụng này - Chặn thông báo - Chặn tất cả các thông báo nổi ngoại trừ cuộc gọi - Khóa phím - Vô hiệu hóa phím cứng khi chế độ trò chơi được bật - Vô hiệu hóa độ sáng tự động - Khóa độ sáng màn hình khi chế độ trò chơi được bật - Chuông trong chế độ trò chơi - Không thay đổi - Rung - Không làm phiền - Im lặng - Thông báo chế độ chơi game - Đã tắt - Hiển thị thông báo - Hiện thông báo nhanh - Hiện thông báo nhanh và thông báo - Chế độ động - Tự động phát hiện và thêm trò chơi - - Thời gian chờ - Thông báo nổi sẽ hiển thị trong %d giây - 2 giây - 4 giây - 5 giây - 6 giây - 8 giây - 10 giây - - Thông báo nổi - Thông báo nổi - Thông báo trên thanh trạng thái - Thêm ứng dụng - Danh sách dừng - Tắt thông báo nổi từ các ứng dụng này - Danh sách đen - Vô hiệu hóa thông báo nổi từ các ứng dụng này - - Thời gian tạm ngưng - Vuốt lên trên thông báo nổi sẽ báo lại thông báo đó trong 1 phút - Vuốt thông báo nổi lên trên sẽ báo lại thông báo đó trong vòng %d phút - Bộ đếm tạm ngưng bị vô hiệu - 1 phút - 5 phút - 10 phút - 15 phút - 20 phút - - Ít thông báo nổi hơn - Chỉ hiển thị thông báo cho ứng dụng quay số, ứng dụng nhắn tin và báo thức - - FOD - Công cụ chọn biểu tượng FOD - Chọn biểu tượng vân tay ưa thích - Để thêm biểu tượng của riêng bạn, hãy chọn biểu tượng trên cùng bên trái và sử dụng ứng dụng OnePlus 6T tuỳ biến FP để chọn biểu tượng bạn mong muốn. - - Cài đặt biểu tượng bảng điều khiển - Hình nền mặc định - Nền nhấn - Đơn giản - Giọng đồng bằng - OnePlus - Nền ngẫu nhiên - Biểu tượng ngẫu nhiên - Biểu tượng Dấu Bg Ngẫu nhiên - Biểu tượng Trọng âm Bg Ngẫu nhiên - - Bảng điều chỉnh âm lượng - Âm nhạc/phương tiện - Chuông báo - Thông báo - Báo thức - Giọng nói - Bluetooth - - Biểu tượng VoWifi - Kiểu biểu tượng VoWiFi - Biểu tượng VoWiFi đã tắt - VoWiFi thay vì icon VoLTE - Kiểu biểu tượng VoWiFi - Biểu tượng Mặc định - Biểu tượng EMUI - Biểu tượng Asus - Biểu tượng OOS - Biểu tượng Motorola - - QS văn bản cuối trang - Hiển thị văn bản ở dưới cùng của bảng cài đặt nhanh - Tùy chỉnh văn bản cuối trang - Đặt mặc định là #KeeptheLove - Thanh trượt độ sáng kiểu MIUI (beta) - Hiển thị thanh trượt độ sáng trong bảng điều khiển nhanh - - Bảng điều khiển điều kiện - Hiển thị thẻ gợi ý trong màn hình Cài đặt - Bảng điều khiển đề xuất - Hiển thị thẻ gợi ý trong màn hình Cài đặt - - Kiểu âm lượng - AOSP - Compat - Android 8 - Ô xếp - Mặc định - - co.potatoproject.plugin.volume.aosp - co.potatoproject.plugin.volume.compact - co.potatoproject.plugin.volume.oreo - co.potatoproject.plugin.volume.tiled - com.android.systemui.volume - - Trình đơn nguồn - Hoạt ảnh menu nguồn - Thay đổi hoạt ảnh Mở/Tắt trình đơn nguồn - Chọn hoạt ảnh menu nguồn - AOSP (mặc định) - Dưới cùng - Trên cùng - Bay - Trượt - Xoay - Phát sáng - 3D - Mờ (phía trên) - Mờ (dưới cùng) - Xoay - - Hình ảnh header - Sử dụng hình ảnh tùy chỉnh cho tiêu đề cài đặt nhanh - Kiểu ảnh - Tự động (Dựa trên thời gian) - Tĩnh - Bộ sưu tập ảnh - Tắt - Chọn hình ảnh từ bộ sưu tập - Chọn một hình ảnh từ bộ sưu tập hình ảnh được cài đặt sẵn - Chọn hình ảnh từ bộ nhớ - Chọn một hình ảnh từ bộ nhớ trong - Hình ảnh tối - Thu phóng kích thước hình ảnh - - Màn hình - Ánh sáng cạnh - Làm sáng các cạnh bên của màn hình trên thông báo đẩy - Đặt màu đèn - Màu sắc tự động - Đồng bộ màu với ảnh album - Thời gian sáng - Cạnh trái - Cạnh phải - Hiển thị trên màn hình AOD - Tiếp tục hiển thị. Cho đến khi màn hình được bật - Ẩn AOD - Ẩn nội dung AOD khi các thanh đang hiển thị - Pulse cho tất cả các sự kiện doze - Hiển thị xung cho chế độ thức và thông báo khi được bật - Màu nhấn - Đồng bộ màu sắc với màu accent - Lặp lại ánh sáng cạnh - Lặp lại hoạt ảnh ánh sáng cạnh doze wake - Hoạt ảnh Edge Light - Khởi động lại - Đảo vị trí - Bật sáng màn hình cạnh - Khối - Mờ dần - - Hiện thị mức sử dụng dữ liệu ở cài đặt nhanh - Đã tắt - Sử dụng hàng ngày - Sử dụng hàng tháng - - Kiểu tiêu đề cài đặt nhanh - Màu đen - Xám - Xám nhạt - Dựa vào màu hệ thống - Trong suốt - - Điều chỉnh độ sáng - Điều chỉnh độ sáng bằng cách trượt qua thanh trạng thái - - Hiệu ứng sạc - Hiển thị một hiệu ứng khi thiết bị được cắm sạc - - Mở khóa bằng vân tay - Mở khóa điện thoại bằng vân tay sau khi khởi động lại mà không cần PIN/Mật khẩu/Mẫu hình\nChú ý: nguy cơ của riêng bạn! - - Màn hình khóa - Lối tắt phía dưới - Tùy chỉnh các phím tắt dưới cùng bên trái và bên phải - - Sóng nhạc không hoạt động với một số nguồn âm thanh khi nghe trên loa thiết bị - Sóng nhạc - Sóng nhạc trên thanh điều hướng - Hiện thị sóng nhạc - Trình trực quan đồ họa âm thanh trên thanh điều hướng - Chế độ hiển thị - Khối mờ dần - Đường liền nét - Màu sắc - Chế độ màu - Màu nhấn - Tuỳ chỉnh - Đèn dung nham - Ảnh album - Chọn màu sắc - Bật làm mượt - Thanh hoạt cảnh mượt hơn - Thanh điều hướng sóng nhạc - Bộ cân bằng đồ họa âm thanh trên khu vực thanh điều hướng, cũng như nếu thanh bị ẩn - Sóng nhạc trên màn hình khoá - Trình trực quan đồ họa âm thanh trên thanh điều hướng - Hiển thị tương tác sóng nhạc - Trình trực quan đồ họa âm thanh trên thanh điều hướng - Nâng cao - Cài đặt chế độ khối mờ dần - Mức độ mạnh - Tốc độ đèn dung nham - Số đường liền nét - Số đường liền nét - Độ đậm đường liền nét - Cài đặt chế độ đường thẳng liền nét - Độ rộng thanh - Khoảng cách thanh - Kích thước khối - Khoảng cách khối - - - Hiển thị tiêu đề thông báo trung tâm - Có hiển thị tiêu đề thông báo kiểu R hay không (Yêu cầu khởi động lại giao diện người dùng hệ thống) - - Đèn pin - Nháy đèn pin khi có cuộc gọi - Tắt - Khi đổ chuông - Khi chuông đã im lặng - Khi hoàn toàn im lặng (không có chuông hoặc bộ rung) - Luôn luôn - Loại bỏ không làm phiền - Có nhấp nháy khi ở chế độ Không làm phiền không - Đánh giá - Đèn pin trên tỷ lệ nhấp nháy cuộc gọi - - Hãy ghép nối trước - Thanh hiển thị pin - Thanh pin - Hiển thị và tuỳ chỉnh thanh pin gần thanh trạng thái hoặc thanh điều hướng - Vị trí hiển thị thanh pin - Màu thanh pin - Kiểu thanh hiển thị pin - Độ dày thanh pin - Hiệu ứng sạc - Các hoạt ảnh khi sạc có thể dẫn đến một trải nghiệm không tốt cho người dùng. Bật tính năng theo ý riêng của bạn. - Ẩn - Thanh trạng thái - Phía trên thanh điều hướng - Phía dưới thanh điều hướng - Binh thường - Đối xứng giữa - Màu thanh pin khi sạc - Màu thanh pin khi pin yếu - Đảo ngược - Sử dụng màu chuyển sắc - Sử dụng màu chuyển sắc làm thang đo cho mức pin - Màu mức cao\" - Màu mức thấp\" - - Vị trí thanh trượt độ sáng - Mặc định - Đa-ni-ên - Meme mini - Tròn Meme - Meme tròn nét - Meme nét - - Kiểu giao diện - Mặc định - Không có bán kính bo góc - Chữ Nhật - Tròn rộng - Tròn vừa - - Kiểu thanh điều hướng - Mặc định - ASUS - OnePlus - One UI - Tecno Camon - diff --git a/res/values/cherish_arrays.xml b/res/values/cherish_arrays.xml index ac275c6..25e71c1 100644 --- a/res/values/cherish_arrays.xml +++ b/res/values/cherish_arrays.xml @@ -12,739 +12,4 @@ limitations under the License. --> - - - 1 - 2 - 3 - 4 - 5 - - - 1 - 2 - - - 1 - 2 - 3 - 4 - 5 - - - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - - - - @string/lockscreen_clock_hide - @string/lockscreen_clock_default - @string/lockscreen_clock_default_bold - @string/lockscreen_clock_default_accent - @string/lockscreen_clock_default_accent_hour - @string/lockscreen_clock_default_accent_min - @string/lockscreen_clock_sammy - @string/lockscreen_clock_sammy_bold - @string/lockscreen_clock_sammy_accent_hour - @string/lockscreen_clock_sammy_accent_min - - - - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - - - - - @string/lockscreen_date_selection_default - @string/lockscreen_date_selection_str_box - @string/lockscreen_date_selection_str_round - @string/lockscreen_date_selection_qbeta_style - @string/lockscreen_date_selection_str_accent - @string/lockscreen_date_selection_str_accent_transparent - @string/lockscreen_date_selection_str_gradient - @string/lockscreen_date_selection_str_border_accent - @string/lockscreen_date_selection_str_border_gradient - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - - - - - @string/status_bar_clock_style_left - @string/status_bar_clock_style_center - @string/status_bar_clock_style_right - - - 0 - 1 - 2 - - - @string/status_bar_am_pm_hidden - @string/status_bar_am_pm_small - @string/status_bar_am_pm_normal - - - 0 - 1 - 2 - - - @string/clock_date_display_none - @string/clock_date_display_small - @string/clock_date_display_normal - - - 0 - 1 - 2 - - - @string/clock_date_style_normal - @string/clock_date_style_lowercase - @string/clock_date_style_uppercase - - - 0 - 1 - 2 - - - dd/MM/yy - MM/dd/yy - yyyy-MM-dd - yyyy-dd-MM - dd-MM-yyyy - MM-dd-yyyy - MMM dd - MMM dd, yyyy - MMMM dd, yyyy - EEE - EEE dd - EEE dd/MM - EEE MM/dd - EEE dd MMM - EEE MMM dd - EEE MMMM dd - EEEE dd/MM - EEEE MM/dd - @string/clock_date_format_custom - - - - @string/clock_date_left - @string/clock_date_right - - - - 0 - 1 - - - - - @string/status_bar_battery_percentage_default - @string/status_bar_battery_percentage_text_inside - @string/status_bar_battery_percentage_text_next - - - - 0 - 1 - 2 - - - - @string/status_bar_battery_style_q - @string/status_bar_battery_style_dotted_circle - @string/status_bar_battery_style_filled_circle - @string/status_bar_battery_style_text - @string/status_bar_battery_style_hidden - @string/status_bar_battery_style_circle - @string/status_bar_battery_style_big_circle - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - - - - - @string/battery_percentage_off - @string/battery_percentage_next - @string/battery_percentage_inside - @string/battery_percentage_estimate - @string/battery_percentage_percentage_estimate - - - - 0 - 1 - 2 - 3 - 4 - - - - - @string/show_network_traffic_up - @string/show_network_traffic_down - @string/show_network_traffic_all - - - - 1 - 2 - 0 - - - - - @string/volte_icon_emui - @string/volte_icon_asus - @string/volte_icon_miui - @string/volte_icon_hd - @string/volte_icon_oos - @string/volte_icon_volte - @string/volte_icon_vo - - - - 6 - 5 - 4 - 3 - 2 - 1 - 0 - - - - - @string/lockscreen_charging_animation_off - @string/lockscreen_charging_animation_flash - @string/lockscreen_charging_animation_battery - @string/lockscreen_charging_animation_drop - @string/lockscreen_charging_animation_explosion - @string/lockscreen_charging_animation_water - @string/lockscreen_charging_animation_split - @string/lockscreen_charging_animation_yellow - @string/lockscreen_charging_animation_covid - @string/lockscreen_charging_animation_wash - @string/lockscreen_charging_animation_wear - @string/lockscreen_charging_animation_loading - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - - - - - @string/theme_type_light - @string/theme_type_pitch_black - @string/theme_type_solarized_dark - @string/theme_type_baked_green - @string/theme_type_choco_x - @string/theme_type_du_pitchblack - @string/theme_type_dark_grey - @string/theme_type_material_ocean - @string/theme_type_clear_spring - - - - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - - - - - @string/adaptive_playback_timeout_30_secs - @string/adaptive_playback_timeout_1_min - @string/adaptive_playback_timeout_2_min - @string/adaptive_playback_timeout_5_min - @string/adaptive_playback_timeout_10_min - - - 30000 - 60000 - 120000 - 300000 - 600000 - - - - - @string/recent_panel_expanded_mode_auto - @string/recent_panel_expanded_mode_always - @string/recent_panel_expanded_mode_never - @string/recent_panel_expanded_mode_disabled - - - 0 - 1 - 2 - 3 - - - - @string/slim_recents_enter_exit_animation_translate - @string/slim_recents_enter_exit_animation_fade - - - 0 - 1 - - - - - @string/quick_pulldown_off - @string/quick_pulldown_right - @string/quick_pulldown_left - @string/quick_pulldown_always - - - - 0 - 1 - 2 - 3 - - - - - @string/ringtone_focus_mode_stock - @string/ringtone_focus_mode_dynamic - - - 1 - 0 - - - - - @string/switch_default - @string/switch_md2 - @string/switch_oneplus - @string/switch_narrow - @string/switch_contained - @string/switch_retro - @string/switch_stockish - @string/switch_telegram - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - - - - - @string/gaming_mode_ringer_off_title - @string/gaming_mode_ringer_vibrate_title - @string/gaming_mode_ringer_dnd_title - @string/gaming_mode_ringer_silent_title - - - 0 - 1 - 2 - 3 - - - - @string/gaming_mode_notifications_off_title - @string/gaming_mode_notifications_notif_title - @string/gaming_mode_notifications_toast_title - @string/gaming_mode_notifications_all_title - - - 0 - 1 - 2 - 3 - - - - - @string/heads_up_time_out_2sec - @string/heads_up_time_out_4sec - @string/heads_up_time_out_5sec - @string/heads_up_time_out_6sec - @string/heads_up_time_out_8sec - @string/heads_up_time_out_10sec - - - - 2000 - 4000 - 5000 - 6000 - 8000 - 10000 - - - - - @string/disabled - @string/heads_up_snooze_1min - @string/heads_up_snooze_5min - @string/heads_up_snooze_10min - @string/heads_up_snooze_15min - @string/heads_up_snooze_20min - - - - 0 - 60000 - 300000 - 600000 - 900000 - 1200000 - - - - - @string/theming_settings_dashboard_icons_default2 - @string/theming_settings_dashboard_icons_default_accent2 - @string/theming_settings_dashboard_icons_plain - @string/theming_settings_dashboard_icons_plain_accent - @string/theming_settings_dashboard_icons_default_oneplus - @string/theming_settings_dashboard_icons_bg_random - @string/theming_settings_dashboard_icons_random - @string/theming_settings_dashboard_icons_random_bg_accent - @string/theming_settings_dashboard_icons_accent_bg_random - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - - - - - @string/vowifi_icon_disabled - @string/vowifi_icon_enabled - @string/vowifi_icon_enabled_volte_disabled - - - - 0 - 1 - 2 - - - - - @string/vowifi_icon_default - @string/vowifi_icon_oneplus - @string/vowifi_icon_moto - @string/vowifi_icon_asus - @string/vowifi_icon_emui - - - - 0 - 1 - 2 - 3 - 4 - - - - - @string/volume_panel_default - @string/volume_panel_aosp - @string/volume_panel_compat - @string/volume_panel_oreo - @string/volume_panel_tiled - - - - @string/volume_panel_default_val - @string/volume_panel_aosp_val - @string/volume_panel_compat_val - @string/volume_panel_oreo_val - @string/volume_panel_tiled_val - - - - - @string/power_menu_animation_aosp - @string/power_menu_animation_bottom - @string/power_menu_animation_top - @string/power_menu_animation_fly - @string/power_menu_animation_turn - @string/power_menu_animation_slide - @string/power_menu_animation_xylon - @string/power_menu_animation_card - @string/power_menu_animation_translucent_top - @string/power_menu_animation_translucent_bottom - @string/power_menu_animation_rotate - - - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - - - - - @string/daylight_header_provider_title - @string/file_header_provider_title - - - @string/daylight_header_provider - @string/file_header_provider - - - - - @string/pulse_ambient_light_anim_restart - @string/pulse_ambient_light_anim_reverse - - - - 0 - 1 - - - - - @string/pulse_ambient_light_layout_solid - @string/pulse_ambient_light_layout_faded - - - - 0 - 1 - - - - - @string/qs_header_black - @string/qs_header_grey - @string/qs_header_lightgrey - @string/qs_header_accent - @string/qs_header_transparent - - - 0 - 1 - 2 - 3 - 4 - - - - - @string/qs_datausage_disabled - @string/qs_datausage_daily - @string/qs_datausage_monthly - - - 0 - 1 - 2 - - - - - @string/pulse_render_mode_fading_bars - @string/pulse_render_mode_solid_lines - - - - 0 - 1 - - - - @string/pulse_color_accent - @string/pulse_color_custom - @string/pulse_color_lava_lamp - @string/pulse_color_auto - - - - 0 - 1 - 2 - 3 - - - - @string/led_color_green - @string/led_color_red - - - - #FF00FF00 - #FFFF0000 - - - - - @string/flashlight_on_call_disabled - @string/flashlight_on_call_ringer - @string/flashlight_on_call_no_ringer - @string/flashlight_on_call_silent - @string/flashlight_on_call_always - - - - 0 - 1 - 2 - 3 - 4 - - - - - @string/sb_battery_bar_statusbar - @string/sb_battery_bar_topnav - @string/sb_battery_bar_bottomnav - - - - 1 - 2 - 3 - - - - @string/sb_battery_bar_reg - @string/sb_battery_bar_center - @string/sb_battery_bar_reversed - - - - 0 - 1 - 2 - - - - - @string/brightness_slider_style_default - @string/brightness_slider_style_daniel - @string/brightness_slider_style_mememini - @string/brightness_slider_style_memeround - @string/brightness_slider_style_memeroundstroke - @string/brightness_slider_style_memestroke - - - - 0 - 1 - 2 - 3 - 4 - 5 - - - - - @string/ui_style_default - @string/ui_style_no_corner_radius - @string/ui_style_rectangle - @string/ui_style_round_large - @string/ui_style_round_medium - - - - 0 - 1 - 2 - 3 - 4 - - - - - @string/navbar_default - @string/navbar_asus - @string/navbar_oneplus - @string/navbar_oneui - @string/navbar_tecno - - - - 0 - 1 - 2 - 3 - 4 - diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml index a0034fd..6d40caa 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -61,742 +61,30 @@ Green Red - - Lockscreen charging info - Display negociated charger max current and voltage and battery temperature on lockscreen while charging - - - Replace clear all text with nice button - Show clear all notifications button in quick settings instead of default text one - - QS tile colors - Use accent color for qs tile icons and background - Blur alpha - Sets the blur transparency - Blur behind quick settings (beta) - blurs darkened background behind quick settings - Blur intensity - Sets the blur intensity/radius - \u0025 - - - Vibrate to indicate call status - - - Display media cover art - Media art blur level - Quick settings - Rows (portrait) - Rows (landscape) - Columns (portrait) - Columns (landscape) - - - Title visibility - Show the titles underneath QS tiles - - - Vibrate on touch - Vibrate when touching QS tiles - Brightness slider at bottom - Show a brightness slider on bottom quick settings - OneUI - Show spacer above settings actionbar for easier use with one hand\nNOTE: restart settings app to see effect - - - Clock style - Select clock style - Hide - Default - Default (bold) - Default (accent) - Default (accent minutes) - Default (accent hours) - Sammy - Sammy (bold) - Sammy (accent hour) - Sammy (accent minute) - - - Date style - Date style - Select date style - Default - Semi-transparent box - Semi-transparent box (round) - Q Beta pill - Rounded, simple and with accent - Rounded, transparent and with accent - Gradient - Dark with accented borders - Dark with gradient borders Status bar icons - System icons - Control which status bar icons are shown Statusbar items - Clock - Date - Clock & Date - Customize clock and date in statusbar - Clock position - Right - Center - Left - AM/PM style - 24-hour clock is enabled - Normal - Small - Hidden - Show seconds - Display seconds in the clock - Date - Display custom date before the clock - Hidden - Small - Normal - Date style - Normal - Lowercase - Uppercase - Custom java format - Date format - %1$s - Must be in DateFormat eg. MM/dd/yy - Enter string - Right of time - Left of time - Date position - Auto-hide clock - Hide and show clock at regular intervals of time - Hide duration - Show duration - - - Charging animation - Display an animation when the device is plugged in - Off - Flash - Battery - Drop - Explosion - Water - Split Loading - Yellow Animation - Covid19 - Wash Your Hand - Wear Your Mask - Loading - - - Battery level - Battery percent - - - Battery style - Icon portrait (default) - Circle (Dotted) - Circle - Text - Hidden - Big circle - Circle (Filled) - - - Battery percentage - Hidden (default) - Inside the icon - Next to the icon - Battery percentage when charging - Always display battery percentage when charging - Show charging bolt - Show a \u26A1\uFE0E symbol near battery text when charging - - - Battery icon - Hide battery icon - Hides the battery icon from the QS header - Battery percentage - Disabled - Enabled - Enabled (inside icon) - Enabled (estimate) - Enabled (percent | estimate) - - - Traffic indicators - Customize network traffic indicators - Network traffic - Select net activity type - Uplink - Downlink - Uplink and Downlink - Show net activity in statusbar - Net activity autohide threshold (KB/s) - Hide arrows - Hide the network traffic indicator arrows - - - Icons - 4G icon - Display 4G icon in signal icon instead LTE - - - VoLTE icon - Display VoLTE icon (Needs a SystemUI restart to take effect) - - - Select VoLTE Icon - Default Icon - VoLTE Icon - VoLTE OOS Icon - HD Icon - VoLTE Miui Icon - VoLTE Asus Icon - EMUI Display music visualizer - Music visualizer - - - Fingerprint authentication vibration - Vibrate on successful fingerprint authentication - - - Advanced restart - When unlocked, include options in the power menu for restarting into recovery or bootloader - - - Battery charging light - Enable - Battery light in Do Not Disturb mode - Blinking light on low battery - Battery light color when charging - Low battery - Medium battery - Almost full battery - Full (100) battery - - - Use old mobile type style - Merge signal and type icons - - - System theme - Select theme - Light - Google dark - Solarized dark - Baked Green - Choco X - Pitch black - Dark Grey - Material Ocean - Clear Spring - Secure power menu - Secure power menu - Allow power menu action only after authentication - Emergency - Power Menu Transparency - Power/reboot menu opacity - Power/reboot dialog dim background amount Rounded corners - Adjust rounded corners and padding - Customize rounded corners - Rounded corner radius - Corner content padding - Statusbar extra padding - Use framework values - Useful if the device actually has rounded corners - - - Media - Adaptive playback - Pause media when volume is muted and resume it by increasing volume within the timeout - Playback timeout - 30 seconds - 1 minute - 2 minutes - 5 minutes - 10 minutes - - - Label - Carrier label - Customize the carrier label - Custom carrier label - Enter a custom label. Leave blank to use your network name - Custom label currently not set - Carrier label location - Disabled - Lockscreen - Statusbar - Both - - - Power menu - Allow accessing power menu on secure lock screen - - - Alternative recents - When using swipe up home navigation to open recents, only stock recents are supported - Slim Recents - Enable to use an alternative recents screen - Slim recents settings - Customize the additional settings for slim recents - Max allowed apps - Size - Expanded mode - Recent tasks expanded preview mode - Auto (Default) - Always - Never - Disabled - Panel background color - Card background color - Memory bar longpress gesture - Clear recents by long-pressing the memory bar - Icon Pack - Apply a custom icon pack for apps in the panel - No icon packs installed - Pick icon pack - Default icons - Card corner radius - - Show on the left edge - Show recent apps panel on the left edge of the screen - Blacklist - Apps blacklist - Apps to not show in the panel - Add app - Tap here to add, tap on added app to remove it - - - App Sidebar - Recents app sidebar - Show app shortcuts on the other edge - Sidebar shortcuts - Choose apps to show in the sidebar - Sidebar style - Change the look of the sidebar - Hide icon labels - Label color - Background color - Size - Open simultaneously with recents - Reduce recents opening lag by disabling this - Default (App based) - - - Default - Choose app - Delete - Remove selected item? - Memory Bar - Memory bar - Show a progress bar displaying RAM - Memory bar color - Memory bar text color - Animation - Translate - Fade - - - Show notification headers - Whether to show R style notification headers (Requires a SystemUI restart) - - System - Activity open animation - Activity close animation - Task open animation - Task open behind animation - Task close animation - Move to front animation - Move to back animation - Wallpaper open animation - Wallpaper close animation - Wallpaper intra open animation - Wallpaper intra close animation - Animation duration - Prevent app overrides - Prevent apps from overriding transitions - Default - - - Wake up on charge - Wake up the device if charger is plugged/unplugged - - - Disable quick settings when locked - Disable expanding quick settings on secure lock screens - - - Quick pulldown - %1$s edge of the status bar pulls down Quick Settings - Always show Quick Settings on status bar pulldown - Off - Left - Right - Always - - - When headset connected, incoming call plays on - Headset only if music is active - Both speaker and headset - - - Force expanded notifications - Force apps that support expanded notifications - - - Switch appearance - Default - Material Design 2 - OnePlus - Narrow - Contained - Retro - Stockish - Telegram - - - Gaming Mode - Customize gaming mode preferences - Automatically turn on for these apps - Add apps for Gaming mode - Gaming mode will turn on automatically when these apps are opened and turn off when they are closed - Block notifications - Block all headsup messages except calls - Lock buttons - Disable hardware buttons when Gaming mode is turned on - Disable automatic brightness - Lock screen brightness when Gaming mode is turned on - Ringer in gaming mode - Do not change - Vibrate - Do Not Disturb - Silent - Gaming mode indication - Disabled - Show notification - Show toasts - Show toasts and notification - Dynamic mode - Try detecting and adding gaming apps automatically - - - Time out - Peeking notifications will show for %d seconds - 2 seconds - 4 seconds - 5 seconds - 6 seconds - 8 seconds - 10 seconds - - - Heads Up - Headsup - Pop up statusbar notifications - Add app - Stoplist - Disable heads up in these applications - Blacklist - Disable heads up for these applications - - - Snooze timer - Swiping up on peeking notifications will snooze heads up from that application for 1 minute - Swiping up on peeking notifications will snooze heads up from that application for %d minutes - Snooze timer is disabled - 1 minute - 5 minutes - 10 minutes - 15 minutes - 20 minutes - - - Less boring heads up - Show heads up only for dialer, messaging and alarm app - - - FOD - FOD icon picker - Choose your favorite fingerprint icon - In order to add your own icon, select the top left icon and use the OnePlus 6T FP Customizer app to select the icon you want. - - - Settings dashboard icons - Default background - Accent background - Plain - Plain accent - OnePlus - Random Background - Random Icon - Icon Random Bg Accent - Icon Accent Bg Random - - - Volume panel - Media - Ring - Notification - Alarm - Voice - Bluetooth - - - VoWiFi icon - VoWiFi icon enabled - VoWiFi icon disabled - VoWiFi instead of VoLTE icon - VoWiFi icon style - Default Icon - EMUI Icon - Asus Icon - OOS Icon - Motorola Icon - - - QS footer text - Display text at bottom of QS panel - Customize footer text - Set to empty for default #KeeptheLove - - MIUI style brightness slider (beta) - Shows brightness slider below qs panel - - - Dashboard conditions - Display condition cards in Settings screen - Dashboard suggestions - Display suggestion cards in Settings screen - - - Volume Panel Style - AOSP - Compat - Oreo - Tiled - Default - - - co.potatoproject.plugin.volume.aosp - co.potatoproject.plugin.volume.compact - co.potatoproject.plugin.volume.oreo - co.potatoproject.plugin.volume.tiled - com.android.systemui.volume Power menu - Power menu animation - Change the enter/exit animation of the power menu - Select power menu animation - AOSP (default) - Bottom - Top - Fly - Slide - Turn - Glow - 3D - Translucent (top) - Translucent (bottom) - Rotate - Header image - Use a custom image for QS header - daylight - file - Image type - Automatic (Time based) - Static - Image collection - Disabled - Pick image from collection - Select an image from pre-installed image collections - Pick image from storage - Select an image from internal storage - Darken image - Image height offset - - - Screen - Edge lighting - Light up the side edges of the screen on notification pulse - Edge light color - Automatic color - Sync color with wallpaper - Edge light pulse duration - Left Edge - Right Edge - Show on AoD - Keep showing on always on display. Until the screen is turned on - Hide AoD content - Hide other AoD content when bars are showing - Pulse for all doze events - Pulses for any doze wake and not just notifications when enabled - Accent color - Sync color with accent color - Repeat edge lighting - Repeat edge lighting animation on doze wake - Edge Light Animation - Restart - Reverse - Edge Light View - Solid - Faded - - - Data Usage in QS Header - Disabled - Daily usage - Monthly usage - - - QS Header style - Black - Grey - Light Grey - Accent Based - Transparent - - - Brightness control - Adjust brightness by sliding across the status bar - - - Charging animation - Display an animation when the device is plugged in - - - Fingerprint unlock - Unlock device with fingerprint after reboot without PIN/Password/Pattern\nNote: at your own risk! Lockscreen - Lockscreen bottom shortcuts - Customize bottom left and right shortcuts - - - Pulse does not work with some audio sources when listening on device speaker - Pulse - Navigation bar audio graphic equalizer - Show Pulse - Audio graphic equalizer on the navigation bar - Render mode - Fading blocks - Solid lines - Color - Color mode - Accent - Custom - Lava lamp - Album art - Choose color - Turn on smoothing - Each bar is animated more smoothly - Navbar Pulse - Audio graphic equalizer on the navigation bar area, also if bar is hidden - Lockscreen Pulse - Audio graphic equalizer on the lockscreen - Ambient Pulse - Audio graphic equalizer on the ambient screen - Advanced - Fading blocks mode settings - Sanity level - Lava lamp speed - Solid lines count - Solid lines count - Solid lines opacity - Solid lines mode settings - Bar width - Bar spacing - Block size - Block spacing - - - true - - - Center notification headers - Whether to Center R style notification headers (Requires a SystemUI restart) - - - Flashlight - Blink Flashlight for incoming call - Disabled - When ringing - When ringer is silent - When entirely silent (no ringer or vibrator) - Always - Ignore DND - Whether to flash when in Do Not Disturb mode - Rate - Flashlight on call blink rate - - - Please enable first - Battery bar - Battery bar - Display and customize battery bar near status bar or navigation bar - Battery bar location - Battery bar color - Battery bar style - Battery bar thickness - Charging animation - The charging animation may result in a poor user experience. Enable at your own discretion. - Hide - Statusbar - Top of navbar - Bottom of navbar - Regular - Center-mirrored - Battery bar charging color - Battery bar low battery color - Reversed - Use gradient color - Use gradient color as a scale for the battery level - High level color" - Low level color" - - - Brightness slider style - Default - Daniel - Meme mini - Meme round - Meme round stroke - Meme stroke - - - UI Style - Default - No Corner Radius - Rectangle - Round Large - Round Medium - - - Navbar style - Default - ASUS - OnePlus - One UI - Tecno Camon diff --git a/res/xml/audio_panel.xml b/res/xml/audio_panel.xml deleted file mode 100644 index 8fe2edf..0000000 --- a/res/xml/audio_panel.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/res/xml/battery_bar.xml b/res/xml/battery_bar.xml deleted file mode 100644 index e879552..0000000 --- a/res/xml/battery_bar.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/xml/battery_light_settings.xml b/res/xml/battery_light_settings.xml index a8c5b9e..43c706c 100644 --- a/res/xml/battery_light_settings.xml +++ b/res/xml/battery_light_settings.xml @@ -17,54 +17,4 @@ - - - - - - - - - - - - - - - - diff --git a/res/xml/cherish_settings.xml b/res/xml/cherish_settings.xml index 044c63d..fc65045 100644 --- a/res/xml/cherish_settings.xml +++ b/res/xml/cherish_settings.xml @@ -1,5 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/xml/cherish_settings_button.xml b/res/xml/cherish_settings_button.xml index 9fc99bd..191beb9 100644 --- a/res/xml/cherish_settings_button.xml +++ b/res/xml/cherish_settings_button.xml @@ -1,5 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/res/xml/cherish_settings_fod_picker.xml b/res/xml/cherish_settings_fod_picker.xml deleted file mode 100644 index e648745..0000000 --- a/res/xml/cherish_settings_fod_picker.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - diff --git a/res/xml/cherish_settings_gaming_mode.xml b/res/xml/cherish_settings_gaming_mode.xml deleted file mode 100644 index cab2a8d..0000000 --- a/res/xml/cherish_settings_gaming_mode.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/xml/cherish_settings_lockscreen.xml b/res/xml/cherish_settings_lockscreen.xml index 4cdae8d..9a523c2 100644 --- a/res/xml/cherish_settings_lockscreen.xml +++ b/res/xml/cherish_settings_lockscreen.xml @@ -23,108 +23,12 @@ android:key="lockscreen_category" android:title="@string/lockscreen_category"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/xml/cherish_settings_misc.xml b/res/xml/cherish_settings_misc.xml index 7a7f36d..0f2bfd2 100644 --- a/res/xml/cherish_settings_misc.xml +++ b/res/xml/cherish_settings_misc.xml @@ -18,76 +18,4 @@ android:title="@string/misc_title" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"> - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/xml/cherish_settings_notifications.xml b/res/xml/cherish_settings_notifications.xml index 4db0f2f..a95f054 100644 --- a/res/xml/cherish_settings_notifications.xml +++ b/res/xml/cherish_settings_notifications.xml @@ -18,80 +18,4 @@ android:title="@string/notifications_title" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"> - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/xml/cherish_settings_power.xml b/res/xml/cherish_settings_power.xml index f63498f..15b2385 100644 --- a/res/xml/cherish_settings_power.xml +++ b/res/xml/cherish_settings_power.xml @@ -18,65 +18,4 @@ android:title="@string/powermenu_title" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"> - - - - - - - - - - - - - - - - - - - - diff --git a/res/xml/cherish_settings_pulse.xml b/res/xml/cherish_settings_pulse.xml deleted file mode 100644 index 42c13b6..0000000 --- a/res/xml/cherish_settings_pulse.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/res/xml/cherish_settings_quicksettings.xml b/res/xml/cherish_settings_quicksettings.xml index b38abd5..30b37f6 100644 --- a/res/xml/cherish_settings_quicksettings.xml +++ b/res/xml/cherish_settings_quicksettings.xml @@ -1,5 +1,5 @@ - - - - - - diff --git a/res/xml/cherish_settings_recents.xml b/res/xml/cherish_settings_recents.xml index 357ecf9..9f59e14 100644 --- a/res/xml/cherish_settings_recents.xml +++ b/res/xml/cherish_settings_recents.xml @@ -1,5 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/res/xml/cherish_settings_volume.xml b/res/xml/cherish_settings_volume.xml index 7a006cd..f490769 100644 --- a/res/xml/cherish_settings_volume.xml +++ b/res/xml/cherish_settings_volume.xml @@ -1,5 +1,5 @@ - - - - - - - - diff --git a/res/xml/edgepulse_settings.xml b/res/xml/edgepulse_settings.xml deleted file mode 100644 index 08be041..0000000 --- a/res/xml/edgepulse_settings.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/xml/heads_up_settings.xml b/res/xml/heads_up_settings.xml deleted file mode 100644 index 8f92741..0000000 --- a/res/xml/heads_up_settings.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/res/xml/qs_header.xml b/res/xml/qs_header.xml deleted file mode 100644 index 4daf713..0000000 --- a/res/xml/qs_header.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/res/xml/slim_recent_app_sidebar.xml b/res/xml/slim_recent_app_sidebar.xml deleted file mode 100644 index c0cb87c..0000000 --- a/res/xml/slim_recent_app_sidebar.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - diff --git a/res/xml/slim_recent_app_sidebar_style.xml b/res/xml/slim_recent_app_sidebar_style.xml deleted file mode 100644 index cd85f50..0000000 --- a/res/xml/slim_recent_app_sidebar_style.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/res/xml/slim_recents.xml b/res/xml/slim_recents.xml deleted file mode 100644 index fb7344b..0000000 --- a/res/xml/slim_recents.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/xml/slim_recents_blacklist.xml b/res/xml/slim_recents_blacklist.xml deleted file mode 100644 index f47bcd0..0000000 --- a/res/xml/slim_recents_blacklist.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - diff --git a/src/com/cherish/settings/fragments/AnimationsSettings.java b/src/com/cherish/settings/fragments/AnimationsSettings.java index a7ea9ec..14bf440 100644 --- a/src/com/cherish/settings/fragments/AnimationsSettings.java +++ b/src/com/cherish/settings/fragments/AnimationsSettings.java @@ -34,8 +34,6 @@ import androidx.preference.Preference.OnPreferenceChangeListener; import androidx.preference.SwitchPreference; import com.android.internal.logging.nano.MetricsProto; -import com.android.internal.util.cherish.AwesomeAnimationHelper; - import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; import com.android.settings.Utils; @@ -48,39 +46,6 @@ import java.util.HashSet; import java.util.List; public class AnimationsSettings extends SettingsPreferenceFragment implements OnPreferenceChangeListener { - - private static final String ANIMATION_DURATION = "animation_controls_duration"; - private static final String ACTIVITY_OPEN = "activity_open"; - private static final String ACTIVITY_CLOSE = "activity_close"; - private static final String TASK_OPEN = "task_open"; - private static final String TASK_OPEN_BEHIND = "task_open_behind"; - private static final String TASK_CLOSE = "task_close"; - private static final String TASK_MOVE_TO_FRONT = "task_move_to_front"; - private static final String TASK_MOVE_TO_BACK = "task_move_to_back"; - private static final String WALLPAPER_OPEN = "wallpaper_open"; - private static final String WALLPAPER_CLOSE = "wallpaper_close"; - private static final String WALLPAPER_INTRA_OPEN = "wallpaper_intra_open"; - private static final String WALLPAPER_INTRA_CLOSE = "wallpaper_intra_close"; - private static final String POWER_MENU_ANIMATIONS = "power_menu_animations"; - - private CustomSeekBarPreference mAnimDuration; - private ListPreference mPowerMenuAnimations; - - ListPreference mActivityOpenPref; - ListPreference mActivityClosePref; - ListPreference mTaskOpenPref; - ListPreference mTaskOpenBehind; - ListPreference mTaskClosePref; - ListPreference mTaskMoveToFrontPref; - ListPreference mTaskMoveToBackPref; - ListPreference mWallpaperOpen; - ListPreference mWallpaperClose; - ListPreference mWallpaperIntraOpen; - ListPreference mWallpaperIntraClose; - - private int[] mAnimations; - private String[] mAnimationsStrings; - private String[] mAnimationsNum; @Override public void onCreate(Bundle icicle) { @@ -88,209 +53,13 @@ public class AnimationsSettings extends SettingsPreferenceFragment implements On addPreferencesFromResource(R.xml.cherish_settings_animations); ContentResolver resolver = getActivity().getContentResolver(); - - mAnimDuration = (CustomSeekBarPreference) findPreference(ANIMATION_DURATION); - int animdef = Settings.Global.getInt(resolver, - Settings.Global.ANIMATION_CONTROLS_DURATION, 0); - mAnimDuration.setValue(animdef); - mAnimDuration.setOnPreferenceChangeListener(this); - - mAnimations = AwesomeAnimationHelper.getAnimationsList(); - int animqty = mAnimations.length; - mAnimationsStrings = new String[animqty]; - mAnimationsNum = new String[animqty]; - for (int i = 0; i < animqty; i++) { - mAnimationsStrings[i] = AwesomeAnimationHelper.getProperName(getActivity().getApplicationContext(), mAnimations[i]); - mAnimationsNum[i] = String.valueOf(mAnimations[i]); - } - - mActivityOpenPref = (ListPreference) findPreference(ACTIVITY_OPEN); - mActivityOpenPref.setSummary(getProperSummary(mActivityOpenPref)); - mActivityOpenPref.setEntries(mAnimationsStrings); - mActivityOpenPref.setEntryValues(mAnimationsNum); - mActivityOpenPref.setOnPreferenceChangeListener(this); - - mActivityClosePref = (ListPreference) findPreference(ACTIVITY_CLOSE); - mActivityClosePref.setSummary(getProperSummary(mActivityClosePref)); - mActivityClosePref.setEntries(mAnimationsStrings); - mActivityClosePref.setEntryValues(mAnimationsNum); - mActivityClosePref.setOnPreferenceChangeListener(this); - - mTaskOpenPref = (ListPreference) findPreference(TASK_OPEN); - mTaskOpenPref.setSummary(getProperSummary(mTaskOpenPref)); - mTaskOpenPref.setEntries(mAnimationsStrings); - mTaskOpenPref.setEntryValues(mAnimationsNum); - mTaskOpenPref.setOnPreferenceChangeListener(this); - - mTaskOpenBehind = (ListPreference) findPreference(TASK_OPEN_BEHIND); - mTaskOpenBehind.setSummary(getProperSummary(mTaskOpenBehind)); - mTaskOpenBehind.setEntries(mAnimationsStrings); - mTaskOpenBehind.setEntryValues(mAnimationsNum); - mTaskOpenBehind.setOnPreferenceChangeListener(this); - - mTaskClosePref = (ListPreference) findPreference(TASK_CLOSE); - mTaskClosePref.setSummary(getProperSummary(mTaskClosePref)); - mTaskClosePref.setEntries(mAnimationsStrings); - mTaskClosePref.setEntryValues(mAnimationsNum); - mTaskClosePref.setOnPreferenceChangeListener(this); - - mTaskMoveToFrontPref = (ListPreference) findPreference(TASK_MOVE_TO_FRONT); - mTaskMoveToFrontPref.setSummary(getProperSummary(mTaskMoveToFrontPref)); - mTaskMoveToFrontPref.setEntries(mAnimationsStrings); - mTaskMoveToFrontPref.setEntryValues(mAnimationsNum); - mTaskMoveToFrontPref.setOnPreferenceChangeListener(this); - - mTaskMoveToBackPref = (ListPreference) findPreference(TASK_MOVE_TO_BACK); - mTaskMoveToBackPref.setSummary(getProperSummary(mTaskMoveToBackPref)); - mTaskMoveToBackPref.setEntries(mAnimationsStrings); - mTaskMoveToBackPref.setEntryValues(mAnimationsNum); - mTaskMoveToBackPref.setOnPreferenceChangeListener(this); - - mWallpaperOpen = (ListPreference) findPreference(WALLPAPER_OPEN); - mWallpaperOpen.setSummary(getProperSummary(mWallpaperOpen)); - mWallpaperOpen.setEntries(mAnimationsStrings); - mWallpaperOpen.setEntryValues(mAnimationsNum); - mWallpaperOpen.setOnPreferenceChangeListener(this); - - mWallpaperClose = (ListPreference) findPreference(WALLPAPER_CLOSE); - mWallpaperClose.setSummary(getProperSummary(mWallpaperClose)); - mWallpaperClose.setEntries(mAnimationsStrings); - mWallpaperClose.setEntryValues(mAnimationsNum); - mWallpaperClose.setOnPreferenceChangeListener(this); - - mWallpaperIntraOpen = (ListPreference) findPreference(WALLPAPER_INTRA_OPEN); - mWallpaperIntraOpen.setSummary(getProperSummary(mWallpaperIntraOpen)); - mWallpaperIntraOpen.setEntries(mAnimationsStrings); - mWallpaperIntraOpen.setEntryValues(mAnimationsNum); - mWallpaperIntraOpen.setOnPreferenceChangeListener(this); - - mWallpaperIntraClose = (ListPreference) findPreference(WALLPAPER_INTRA_CLOSE); - mWallpaperIntraClose.setSummary(getProperSummary(mWallpaperIntraClose)); - mWallpaperIntraClose.setEntries(mAnimationsStrings); - mWallpaperIntraClose.setEntryValues(mAnimationsNum); - mWallpaperIntraClose.setOnPreferenceChangeListener(this); - - mPowerMenuAnimations = (ListPreference) findPreference(POWER_MENU_ANIMATIONS); - mPowerMenuAnimations.setValue(String.valueOf(Settings.System.getInt( - getContentResolver(), Settings.System.POWER_MENU_ANIMATIONS, 0))); - mPowerMenuAnimations.setSummary(mPowerMenuAnimations.getEntry()); - mPowerMenuAnimations.setOnPreferenceChangeListener(this); } @Override public boolean onPreferenceChange(Preference preference, Object newValue) { ContentResolver resolver = getActivity().getContentResolver(); - if (preference == mAnimDuration) { - int value = (Integer) newValue; - Settings.Global.putInt(resolver, - Settings.Global.ANIMATION_CONTROLS_DURATION, value); - return true; - } else if (preference == mActivityOpenPref) { - int val = Integer.parseInt((String) newValue); - Settings.Global.putInt(resolver, - Settings.Global.ACTIVITY_ANIMATION_CONTROLS[0], val); - preference.setSummary(getProperSummary(preference)); - return true; - } else if (preference == mActivityClosePref) { - int val = Integer.parseInt((String) newValue); - Settings.Global.putInt(resolver, - Settings.Global.ACTIVITY_ANIMATION_CONTROLS[1], val); - preference.setSummary(getProperSummary(preference)); - return true; - } else if (preference == mTaskOpenPref) { - int val = Integer.parseInt((String) newValue); - Settings.Global.putInt(resolver, - Settings.Global.ACTIVITY_ANIMATION_CONTROLS[2], val); - preference.setSummary(getProperSummary(preference)); - return true; - } else if (preference == mTaskClosePref) { - int val = Integer.parseInt((String) newValue); - Settings.Global.putInt(resolver, - Settings.Global.ACTIVITY_ANIMATION_CONTROLS[3], val); - preference.setSummary(getProperSummary(preference)); - return true; - } else if (preference == mTaskMoveToFrontPref) { - int val = Integer.parseInt((String) newValue); - Settings.Global.putInt(resolver, - Settings.Global.ACTIVITY_ANIMATION_CONTROLS[4], val); - preference.setSummary(getProperSummary(preference)); - return true; - } else if (preference == mTaskMoveToBackPref) { - int val = Integer.parseInt((String) newValue); - Settings.Global.putInt(resolver, - Settings.Global.ACTIVITY_ANIMATION_CONTROLS[5], val); - preference.setSummary(getProperSummary(preference)); - return true; - } else if (preference == mWallpaperOpen) { - int val = Integer.parseInt((String) newValue); - Settings.Global.putInt(resolver, - Settings.Global.ACTIVITY_ANIMATION_CONTROLS[6], val); - preference.setSummary(getProperSummary(preference)); - return true; - } else if (preference == mWallpaperClose) { - int val = Integer.parseInt((String) newValue); - Settings.Global.putInt(resolver, - Settings.Global.ACTIVITY_ANIMATION_CONTROLS[7], val); - preference.setSummary(getProperSummary(preference)); - return true; - } else if (preference == mWallpaperIntraOpen) { - int val = Integer.parseInt((String) newValue); - Settings.Global.putInt(resolver, - Settings.Global.ACTIVITY_ANIMATION_CONTROLS[8], val); - preference.setSummary(getProperSummary(preference)); - return true; - } else if (preference == mWallpaperIntraClose) { - int val = Integer.parseInt((String) newValue); - Settings.Global.putInt(resolver, - Settings.Global.ACTIVITY_ANIMATION_CONTROLS[9], val); - preference.setSummary(getProperSummary(preference)); - return true; - } else if (preference == mTaskOpenBehind) { - int val = Integer.parseInt((String) newValue); - Settings.Global.putInt(resolver, - Settings.Global.ACTIVITY_ANIMATION_CONTROLS[10], val); - preference.setSummary(getProperSummary(preference)); - return true; - } else if (preference == mPowerMenuAnimations) { - Settings.System.putInt(getContentResolver(), Settings.System.POWER_MENU_ANIMATIONS, - Integer.valueOf((String) newValue)); - mPowerMenuAnimations.setValue(String.valueOf(newValue)); - mPowerMenuAnimations.setSummary(mPowerMenuAnimations.getEntry()); - return true; - } return false; } - - private String getProperSummary(Preference preference) { - String mString = ""; - if (preference == mActivityOpenPref) { - mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[0]; - } else if (preference == mActivityClosePref) { - mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[1]; - } else if (preference == mTaskOpenPref) { - mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[2]; - } else if (preference == mTaskClosePref) { - mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[3]; - } else if (preference == mTaskMoveToFrontPref) { - mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[4]; - } else if (preference == mTaskMoveToBackPref) { - mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[5]; - } else if (preference == mWallpaperOpen) { - mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[6]; - } else if (preference == mWallpaperClose) { - mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[7]; - } else if (preference == mWallpaperIntraOpen) { - mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[8]; - } else if (preference == mWallpaperIntraClose) { - mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[9]; - } else if (preference == mTaskOpenBehind) { - mString = Settings.Global.ACTIVITY_ANIMATION_CONTROLS[10]; - } - - int mNum = Settings.Global.getInt(getActivity().getContentResolver(), - mString, 0); - return mAnimationsStrings[mNum]; - } @Override public int getMetricsCategory() { diff --git a/src/com/cherish/settings/fragments/AudioPanelSettings.java b/src/com/cherish/settings/fragments/AudioPanelSettings.java deleted file mode 100644 index 78c1bce..0000000 --- a/src/com/cherish/settings/fragments/AudioPanelSettings.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2014-2016 The Dirty Unicorns Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cherish.settings.fragments; - -import android.content.Context; -import android.content.ContentResolver; -import android.content.res.Resources; -import android.os.Bundle; -import android.os.UserHandle; -import android.provider.Settings; -import androidx.preference.ListPreference; -import androidx.preference.Preference; -import androidx.preference.PreferenceCategory; -import androidx.preference.PreferenceScreen; -import androidx.preference.Preference.OnPreferenceChangeListener; -import androidx.preference.SwitchPreference; - -import com.android.settings.R; -import com.android.settings.SettingsPreferenceFragment; -import com.android.internal.logging.nano.MetricsProto; -import com.android.settings.Utils; - -public class AudioPanelSettings extends SettingsPreferenceFragment implements - Preference.OnPreferenceChangeListener { - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.audio_panel); - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } - - @Override - public void onResume() { - super.onResume(); - } - - public boolean onPreferenceChange(Preference preference, Object objValue) { - return true; - } - -} diff --git a/src/com/cherish/settings/fragments/BatteryLightSettings.java b/src/com/cherish/settings/fragments/BatteryLightSettings.java index b3718b6..69d2166 100644 --- a/src/com/cherish/settings/fragments/BatteryLightSettings.java +++ b/src/com/cherish/settings/fragments/BatteryLightSettings.java @@ -36,67 +36,12 @@ import net.margaritov.preference.colorpicker.ColorPickerPreference; public class BatteryLightSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener { - private ColorPickerPreference mLowColor; - private ColorPickerPreference mMediumColor; - private ColorPickerPreference mFullColor; - private ColorPickerPreference mReallyFullColor; - private SystemSettingSwitchPreference mLowBatteryBlinking; - - private PreferenceCategory mColorCategory; - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.battery_light_settings); PreferenceScreen prefSet = getPreferenceScreen(); - mColorCategory = (PreferenceCategory) findPreference("battery_light_cat"); - - mLowBatteryBlinking = (SystemSettingSwitchPreference)prefSet.findPreference("battery_light_low_blinking"); - if (getResources().getBoolean( - com.android.internal.R.bool.config_ledCanPulse)) { - mLowBatteryBlinking.setChecked(Settings.System.getIntForUser(getContentResolver(), - Settings.System.BATTERY_LIGHT_LOW_BLINKING, 0, UserHandle.USER_CURRENT) == 1); - mLowBatteryBlinking.setOnPreferenceChangeListener(this); - } else { - prefSet.removePreference(mLowBatteryBlinking); - } - - if (getResources().getBoolean(com.android.internal.R.bool.config_multiColorBatteryLed)) { - int color = Settings.System.getIntForUser(getContentResolver(), - Settings.System.BATTERY_LIGHT_LOW_COLOR, 0xFFFF0000, - UserHandle.USER_CURRENT); - mLowColor = (ColorPickerPreference) findPreference("battery_light_low_color"); - mLowColor.setAlphaSliderEnabled(false); - mLowColor.setNewPreviewColor(color); - mLowColor.setOnPreferenceChangeListener(this); - - color = Settings.System.getIntForUser(getContentResolver(), - Settings.System.BATTERY_LIGHT_MEDIUM_COLOR, 0xFFFFFF00, - UserHandle.USER_CURRENT); - mMediumColor = (ColorPickerPreference) findPreference("battery_light_medium_color"); - mMediumColor.setAlphaSliderEnabled(false); - mMediumColor.setNewPreviewColor(color); - mMediumColor.setOnPreferenceChangeListener(this); - - color = Settings.System.getIntForUser(getContentResolver(), - Settings.System.BATTERY_LIGHT_FULL_COLOR, 0xFFFFFF00, - UserHandle.USER_CURRENT); - mFullColor = (ColorPickerPreference) findPreference("battery_light_full_color"); - mFullColor.setAlphaSliderEnabled(false); - mFullColor.setNewPreviewColor(color); - mFullColor.setOnPreferenceChangeListener(this); - - color = Settings.System.getIntForUser(getContentResolver(), - Settings.System.BATTERY_LIGHT_REALLYFULL_COLOR, 0xFF00FF00, - UserHandle.USER_CURRENT); - mReallyFullColor = (ColorPickerPreference) findPreference("battery_light_reallyfull_color"); - mReallyFullColor.setAlphaSliderEnabled(false); - mReallyFullColor.setNewPreviewColor(color); - mReallyFullColor.setOnPreferenceChangeListener(this); - } else { - prefSet.removePreference(mColorCategory); - } } @Override @@ -105,38 +50,7 @@ public class BatteryLightSettings extends SettingsPreferenceFragment implements } public boolean onPreferenceChange(Preference preference, Object newValue) { - if (preference.equals(mLowColor)) { - int color = ((Integer) newValue).intValue(); - Settings.System.putIntForUser(getContentResolver(), - Settings.System.BATTERY_LIGHT_LOW_COLOR, color, - UserHandle.USER_CURRENT); - return true; - } else if (preference.equals(mMediumColor)) { - int color = ((Integer) newValue).intValue(); - Settings.System.putIntForUser(getContentResolver(), - Settings.System.BATTERY_LIGHT_MEDIUM_COLOR, color, - UserHandle.USER_CURRENT); - return true; - } else if (preference.equals(mFullColor)) { - int color = ((Integer) newValue).intValue(); - Settings.System.putIntForUser(getContentResolver(), - Settings.System.BATTERY_LIGHT_FULL_COLOR, color, - UserHandle.USER_CURRENT); - return true; - } else if (preference.equals(mReallyFullColor)) { - int color = ((Integer) newValue).intValue(); - Settings.System.putIntForUser(getContentResolver(), - Settings.System.BATTERY_LIGHT_REALLYFULL_COLOR, color, - UserHandle.USER_CURRENT); - return true; - } else if (preference == mLowBatteryBlinking) { - boolean value = (Boolean) newValue; - Settings.System.putIntForUser(getActivity().getContentResolver(), - Settings.System.BATTERY_LIGHT_LOW_BLINKING, value ? 1 : 0, - UserHandle.USER_CURRENT); - mLowBatteryBlinking.setChecked(value); - return true; - } + return false; } } diff --git a/src/com/cherish/settings/fragments/ClockSettings.java b/src/com/cherish/settings/fragments/ClockSettings.java deleted file mode 100644 index 688ae22..0000000 --- a/src/com/cherish/settings/fragments/ClockSettings.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright (C) 2017-2018 The Dirty Unicorns Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cherish.settings.fragments; - -import android.app.AlertDialog; -import android.content.ContentResolver; -import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnCancelListener; -import android.content.res.Resources; -import android.database.ContentObserver; -import android.content.Intent; -import android.os.Bundle; -import android.os.UserHandle; -import androidx.preference.ListPreference; -import androidx.preference.SwitchPreference; -import androidx.preference.Preference; -import androidx.preference.PreferenceCategory; -import androidx.preference.PreferenceScreen; -import androidx.preference.Preference.OnPreferenceChangeListener; -import android.provider.Settings; -import android.text.format.DateFormat; -import android.util.Log; -import android.view.View; -import android.widget.EditText; - -import com.android.internal.logging.nano.MetricsProto; - -import com.android.settings.R; -import com.android.settings.SettingsPreferenceFragment; -import com.android.settings.Utils; - -import com.cherish.settings.preferences.SystemSettingSwitchPreference; - -import java.util.ArrayList; -import java.util.List; -import java.util.Date; - -public class ClockSettings extends SettingsPreferenceFragment - implements Preference.OnPreferenceChangeListener { - - private static final String STATUS_BAR_CLOCK_SECONDS = "status_bar_clock_seconds"; - private static final String STATUS_BAR_CLOCK_STYLE = "statusbar_clock_style"; - private static final String STATUS_BAR_AM_PM = "status_bar_am_pm"; - private static final String STATUS_BAR_CLOCK_DATE_DISPLAY = "clock_date_display"; - private static final String STATUS_BAR_CLOCK_DATE_STYLE = "clock_date_style"; - private static final String STATUS_BAR_CLOCK_DATE_FORMAT = "clock_date_format"; - private static final String STATUS_BAR_CLOCK_DATE_POSITION = "statusbar_clock_date_position"; - public static final int CLOCK_DATE_STYLE_LOWERCASE = 1; - public static final int CLOCK_DATE_STYLE_UPPERCASE = 2; - private static final int CUSTOM_CLOCK_DATE_FORMAT_INDEX = 18; - - private SystemSettingSwitchPreference mStatusBarSecondsShow; - private ListPreference mStatusBarClock; - private ListPreference mStatusBarAmPm; - private ListPreference mClockDateDisplay; - private ListPreference mClockDateStyle; - private ListPreference mClockDateFormat; - private ListPreference mClockDatePosition; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - addPreferencesFromResource(R.xml.cherish_settings_clock); - PreferenceScreen prefSet = getPreferenceScreen(); - ContentResolver resolver = getActivity().getContentResolver(); - - mStatusBarSecondsShow = (SystemSettingSwitchPreference) findPreference(STATUS_BAR_CLOCK_SECONDS); - mStatusBarClock = (ListPreference) findPreference(STATUS_BAR_CLOCK_STYLE); - mStatusBarAmPm = (ListPreference) findPreference(STATUS_BAR_AM_PM); - mClockDateDisplay = (ListPreference) findPreference(STATUS_BAR_CLOCK_DATE_DISPLAY); - mClockDateStyle = (ListPreference) findPreference(STATUS_BAR_CLOCK_DATE_STYLE); - mClockDatePosition = (ListPreference) findPreference(STATUS_BAR_CLOCK_DATE_POSITION); - - mStatusBarSecondsShow.setChecked((Settings.System.getInt(resolver, - Settings.System.STATUS_BAR_CLOCK_SECONDS, 0) == 1)); - mStatusBarSecondsShow.setOnPreferenceChangeListener(this); - - int clockStyle = Settings.System.getInt(resolver, - Settings.System.STATUSBAR_CLOCK_STYLE, 0); - mStatusBarClock.setValue(String.valueOf(clockStyle)); - mStatusBarClock.setSummary(mStatusBarClock.getEntry()); - mStatusBarClock.setOnPreferenceChangeListener(this); - - if (DateFormat.is24HourFormat(getActivity())) { - mStatusBarAmPm.setEnabled(false); - mStatusBarAmPm.setSummary(R.string.status_bar_am_pm_info); - } else { - int statusBarAmPm = Settings.System.getInt(resolver, - Settings.System.STATUSBAR_CLOCK_AM_PM_STYLE, 2); - mStatusBarAmPm.setValue(String.valueOf(statusBarAmPm)); - mStatusBarAmPm.setSummary(mStatusBarAmPm.getEntry()); - mStatusBarAmPm.setOnPreferenceChangeListener(this); - } - - int clockDateDisplay = Settings.System.getInt(resolver, - Settings.System.STATUSBAR_CLOCK_DATE_DISPLAY, 0); - mClockDateDisplay.setValue(String.valueOf(clockDateDisplay)); - mClockDateDisplay.setSummary(mClockDateDisplay.getEntry()); - mClockDateDisplay.setOnPreferenceChangeListener(this); - - int clockDateStyle = Settings.System.getInt(resolver, - Settings.System.STATUSBAR_CLOCK_DATE_STYLE, 0); - mClockDateStyle.setValue(String.valueOf(clockDateStyle)); - mClockDateStyle.setSummary(mClockDateStyle.getEntry()); - mClockDateStyle.setOnPreferenceChangeListener(this); - - mClockDateFormat = (ListPreference) findPreference(STATUS_BAR_CLOCK_DATE_FORMAT); - mClockDateFormat.setOnPreferenceChangeListener(this); - String value = Settings.System.getString(getActivity().getContentResolver(), - Settings.System.STATUSBAR_CLOCK_DATE_FORMAT); - if (value == null || value.isEmpty()) { - value = "EEE"; - } - int index = mClockDateFormat.findIndexOfValue((String) value); - if (index == -1) { - mClockDateFormat.setValueIndex(CUSTOM_CLOCK_DATE_FORMAT_INDEX); - } else { - mClockDateFormat.setValue(value); - } - - parseClockDateFormats(); - - int clockDatePosition = Settings.System.getInt(resolver, - Settings.System.STATUSBAR_CLOCK_DATE_POSITION, 0); - mClockDatePosition.setValue(String.valueOf(clockDatePosition)); - mClockDatePosition.setSummary(mClockDatePosition.getEntry()); - mClockDatePosition.setOnPreferenceChangeListener(this); - - setDateOptions(); - - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } - - @Override - public void onResume() { - super.onResume(); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - AlertDialog dialog; - ContentResolver resolver = getActivity().getContentResolver(); - if (preference == mStatusBarSecondsShow) { - boolean value = (Boolean) newValue; - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.STATUS_BAR_CLOCK_SECONDS, value ? 1 : 0); - return true; - } else if (preference == mStatusBarClock) { - int clockStyle = Integer.parseInt((String) newValue); - int index = mStatusBarClock.findIndexOfValue((String) newValue); - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.STATUSBAR_CLOCK_STYLE, clockStyle); - mStatusBarClock.setSummary(mStatusBarClock.getEntries()[index]); - return true; - } else if (preference == mStatusBarAmPm) { - int statusBarAmPm = Integer.valueOf((String) newValue); - int index = mStatusBarAmPm.findIndexOfValue((String) newValue); - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.STATUSBAR_CLOCK_AM_PM_STYLE, statusBarAmPm); - mStatusBarAmPm.setSummary(mStatusBarAmPm.getEntries()[index]); - return true; - } else if (preference == mClockDateDisplay) { - int clockDateDisplay = Integer.valueOf((String) newValue); - int index = mClockDateDisplay.findIndexOfValue((String) newValue); - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.STATUSBAR_CLOCK_DATE_DISPLAY, clockDateDisplay); - mClockDateDisplay.setSummary(mClockDateDisplay.getEntries()[index]); - setDateOptions(); - return true; - } else if (preference == mClockDateStyle) { - int clockDateStyle = Integer.valueOf((String) newValue); - int index = mClockDateStyle.findIndexOfValue((String) newValue); - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.STATUSBAR_CLOCK_DATE_STYLE, clockDateStyle); - mClockDateStyle.setSummary(mClockDateStyle.getEntries()[index]); - parseClockDateFormats(); - return true; - } else if (preference == mClockDateFormat) { - int index = mClockDateFormat.findIndexOfValue((String) newValue); - - if (index == CUSTOM_CLOCK_DATE_FORMAT_INDEX) { - AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); - alert.setTitle(R.string.clock_date_string_edittext_title); - alert.setMessage(R.string.clock_date_string_edittext_summary); - - final EditText input = new EditText(getActivity()); - String oldText = Settings.System.getString( - getActivity().getContentResolver(), - Settings.System.STATUSBAR_CLOCK_DATE_FORMAT); - if (oldText != null) { - input.setText(oldText); - } - alert.setView(input); - - alert.setPositiveButton(R.string.menu_save, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialogInterface, int whichButton) { - String value = input.getText().toString(); - if (value.equals("")) { - return; - } - Settings.System.putString(getActivity().getContentResolver(), - Settings.System.STATUSBAR_CLOCK_DATE_FORMAT, value); - return; - } - }); - - alert.setNegativeButton(R.string.menu_cancel, - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialogInterface, int which) { - return; - } - }); - dialog = alert.create(); - dialog.show(); - } else { - if ((String) newValue != null) { - Settings.System.putString(getActivity().getContentResolver(), - Settings.System.STATUSBAR_CLOCK_DATE_FORMAT, (String) newValue); - } - } - return true; - } else if (preference == mClockDatePosition) { - int val = Integer.parseInt((String) newValue); - int index = mClockDatePosition.findIndexOfValue((String) newValue); - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.STATUSBAR_CLOCK_DATE_POSITION, val); - mClockDatePosition.setSummary(mClockDatePosition.getEntries()[index]); - parseClockDateFormats(); - return true; - } else if (preference == mClockDatePosition) { - int val = Integer.parseInt((String) newValue); - int index = mClockDatePosition.findIndexOfValue((String) newValue); - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.STATUSBAR_CLOCK_DATE_POSITION, val); - mClockDatePosition.setSummary(mClockDatePosition.getEntries()[index]); - parseClockDateFormats(); - return true; - } - return false; - } - - private void parseClockDateFormats() { - String[] dateEntries = getResources().getStringArray(R.array.clock_date_format_entries_values); - CharSequence parsedDateEntries[]; - parsedDateEntries = new String[dateEntries.length]; - Date now = new Date(); - - int lastEntry = dateEntries.length - 1; - int dateFormat = Settings.System.getInt(getActivity() - .getContentResolver(), Settings.System.STATUSBAR_CLOCK_DATE_STYLE, 0); - for (int i = 0; i < dateEntries.length; i++) { - if (i == lastEntry) { - parsedDateEntries[i] = dateEntries[i]; - } else { - String newDate; - CharSequence dateString = DateFormat.format(dateEntries[i], now); - if (dateFormat == CLOCK_DATE_STYLE_LOWERCASE) { - newDate = dateString.toString().toLowerCase(); - } else if (dateFormat == CLOCK_DATE_STYLE_UPPERCASE) { - newDate = dateString.toString().toUpperCase(); - } else { - newDate = dateString.toString(); - } - - parsedDateEntries[i] = newDate; - } - } - mClockDateFormat.setEntries(parsedDateEntries); - } - - private void setDateOptions() { - int enableDateOptions = Settings.System.getInt(getActivity().getContentResolver(), - Settings.System.STATUSBAR_CLOCK_DATE_DISPLAY, 0); - if (enableDateOptions == 0) { - mClockDateStyle.setEnabled(false); - mClockDateFormat.setEnabled(false); - mClockDatePosition.setEnabled(false); - } else { - mClockDateStyle.setEnabled(true); - mClockDateFormat.setEnabled(true); - mClockDatePosition.setEnabled(true); - } - } -} \ No newline at end of file diff --git a/src/com/cherish/settings/fragments/CustomCarrierLabel.java b/src/com/cherish/settings/fragments/CustomCarrierLabel.java deleted file mode 100644 index 5e1207d..0000000 --- a/src/com/cherish/settings/fragments/CustomCarrierLabel.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2020 CherishOS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.cherish.settings.fragments; - -import android.app.AlertDialog; -import android.content.ContentResolver; -import android.content.DialogInterface; -import android.content.DialogInterface.OnCancelListener; -import android.content.Intent; -import android.content.res.Resources; -import android.os.Bundle; -import android.os.UserHandle; -import android.provider.Settings; -import android.text.InputFilter; -import android.text.Spannable; -import android.text.TextUtils; -import android.util.Log; -import android.view.Gravity; -import android.view.View; -import android.widget.EditText; -import androidx.preference.Preference; -import androidx.preference.PreferenceScreen; -import android.widget.LinearLayout; -import com.android.internal.logging.nano.MetricsProto; -import com.android.internal.util.cherish.CherishUtils; - -import com.android.settings.R; -import com.android.settings.SettingsPreferenceFragment; - -import com.cherish.settings.preferences.SystemSettingListPreference; - -public class CustomCarrierLabel extends SettingsPreferenceFragment - implements Preference.OnPreferenceChangeListener { - - public static final String TAG = "CarrierLabel"; - private static final String CUSTOM_CARRIER_LABEL = "custom_carrier_label"; - private static final String KEY_CARRIER_LABEL = "status_bar_show_carrier"; - - private PreferenceScreen mCustomCarrierLabel; - private String mCustomCarrierLabelText; - private SystemSettingListPreference mShowCarrierLabel; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - ContentResolver resolver = getActivity().getContentResolver(); - - addPreferencesFromResource(R.xml.custom_carrier_label); - PreferenceScreen prefSet = getPreferenceScreen(); - - mCustomCarrierLabel = (PreferenceScreen) findPreference(CUSTOM_CARRIER_LABEL); - updateCustomLabelTextSummary(); - - mShowCarrierLabel = (SystemSettingListPreference) findPreference(KEY_CARRIER_LABEL); - int showCarrierLabel = Settings.System.getInt(resolver, - Settings.System.STATUS_BAR_SHOW_CARRIER, 1); - CharSequence[] NonNotchEntries = { getResources().getString(R.string.show_carrier_disabled), - getResources().getString(R.string.show_carrier_keyguard), - getResources().getString(R.string.show_carrier_statusbar), getResources().getString( - R.string.show_carrier_enabled) }; - CharSequence[] NotchEntries = { getResources().getString(R.string.show_carrier_disabled), - getResources().getString(R.string.show_carrier_keyguard) }; - CharSequence[] NonNotchValues = {"0", "1" , "2", "3"}; - CharSequence[] NotchValues = {"0", "1"}; - mShowCarrierLabel.setEntries(CherishUtils.hasNotch(getActivity()) ? NotchEntries : NonNotchEntries); - mShowCarrierLabel.setEntryValues(CherishUtils.hasNotch(getActivity()) ? NotchValues : NonNotchValues); - mShowCarrierLabel.setValue(String.valueOf(showCarrierLabel)); - mShowCarrierLabel.setSummary(mShowCarrierLabel.getEntry()); - mShowCarrierLabel.setOnPreferenceChangeListener(this); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - ContentResolver resolver = getActivity().getContentResolver(); - if (preference == mShowCarrierLabel) { - int value = Integer.parseInt((String) newValue); - updateCarrierLabelSummary(value); - return true; - } - return false; - } - - private void updateCarrierLabelSummary(int value) { - Resources res = getResources(); - - if (value == 0) { - // Carrier Label disabled - mShowCarrierLabel.setSummary(res.getString(R.string.show_carrier_disabled)); - } else if (value == 1) { - mShowCarrierLabel.setSummary(res.getString(R.string.show_carrier_keyguard)); - } else if (value == 2) { - mShowCarrierLabel.setSummary(res.getString(R.string.show_carrier_statusbar)); - } else if (value == 3) { - mShowCarrierLabel.setSummary(res.getString(R.string.show_carrier_enabled)); - } - } - - public boolean onPreferenceTreeClick(Preference preference) { - ContentResolver resolver = getActivity().getContentResolver(); - boolean value; - if (preference == mCustomCarrierLabel) { - AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); - alert.setTitle(R.string.custom_carrier_label_title); - alert.setMessage(R.string.custom_carrier_label_explain); - LinearLayout container = new LinearLayout(getActivity()); - container.setOrientation(LinearLayout.VERTICAL); - LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT); - lp.setMargins(55, 20, 55, 20); - final EditText input = new EditText(getActivity()); - int maxLength = 25; - input.setLayoutParams(lp); - input.setGravity(android.view.Gravity.TOP| Gravity.START); - input.setText(TextUtils.isEmpty(mCustomCarrierLabelText) ? "" : mCustomCarrierLabelText); - input.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)}); - container.addView(input); - alert.setView(container); - alert.setPositiveButton(getString(android.R.string.ok), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int whichButton) { - String value = ((Spannable) input.getText()).toString().trim(); - Settings.System.putString(resolver, Settings.System.CUSTOM_CARRIER_LABEL, value); - updateCustomLabelTextSummary(); - Intent i = new Intent(); - i.setAction(Intent.ACTION_CUSTOM_CARRIER_LABEL_CHANGED); - getActivity().sendBroadcast(i); - } - }); - alert.setNegativeButton(getString(android.R.string.cancel), null); - alert.show(); - return true; - } - return false; - } - - private void updateCustomLabelTextSummary() { - mCustomCarrierLabelText = Settings.System.getString( - getContentResolver(), Settings.System.CUSTOM_CARRIER_LABEL); - if (TextUtils.isEmpty(mCustomCarrierLabelText)) { - mCustomCarrierLabel.setSummary(R.string.custom_carrier_label_notset); - } else { - mCustomCarrierLabel.setSummary(mCustomCarrierLabelText); - } - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } -} diff --git a/src/com/cherish/settings/fragments/EdgePulse.java b/src/com/cherish/settings/fragments/EdgePulse.java deleted file mode 100644 index c1f7988..0000000 --- a/src/com/cherish/settings/fragments/EdgePulse.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2020 CherishOS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cherish.settings.fragments; - -import android.content.ContentResolver; -import android.content.Context; -import android.os.Bundle; -import android.os.UserHandle; -import android.provider.Settings; -import androidx.preference.ListPreference; -import androidx.preference.Preference; -import androidx.preference.Preference.OnPreferenceChangeListener; -import androidx.preference.PreferenceScreen; -import androidx.preference.SwitchPreference; - -import com.android.internal.logging.nano.MetricsProto; - -import com.android.settings.R; -import com.android.settings.SettingsPreferenceFragment; - -import net.margaritov.preference.colorpicker.ColorPickerPreference; - -public class EdgePulse extends SettingsPreferenceFragment implements - OnPreferenceChangeListener { - - private static final String PULSE_AMBIENT_LIGHT_COLOR_LEFT = "pulse_ambient_light_color_left"; - private static final String PULSE_AMBIENT_LIGHT_COLOR_RIGHT = "pulse_ambient_light_color_right"; - private static final String AMBIENT_NOTIFICATION_LIGHT_ENABLED = "ambient_notification_light_enabled"; - private static final String AMBIENT_NOTIFICATION_LIGHT_HIDE_AOD = "ambient_notification_light_hide_aod"; - - private ColorPickerPreference mLeftEdgeLightColorPreference; - private ColorPickerPreference mRightEdgeLightColorPreference; - private SwitchPreference mAmbientNotifLight; - private SwitchPreference mAmbientContentHide; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.edgepulse_settings); - - ContentResolver resolver = getActivity().getContentResolver(); - PreferenceScreen prefScreen = getPreferenceScreen(); - - mLeftEdgeLightColorPreference = (ColorPickerPreference) findPreference(PULSE_AMBIENT_LIGHT_COLOR_LEFT); - mLeftEdgeLightColorPreference.setOnPreferenceChangeListener(this); - int leftEdgeLightColor = Settings.System.getInt(getContentResolver(), - Settings.System.PULSE_AMBIENT_LIGHT_COLOR_LEFT, 0xFF3980FF); - String leftEdgeLightColorHex = String.format("#%08x", (0xFF3980FF & leftEdgeLightColor)); - if (leftEdgeLightColorHex.equals("#ff3980ff")) { - mLeftEdgeLightColorPreference.setSummary(R.string.default_string); - } else { - mLeftEdgeLightColorPreference.setSummary(leftEdgeLightColorHex); - } - mLeftEdgeLightColorPreference.setNewPreviewColor(leftEdgeLightColor); - - mRightEdgeLightColorPreference = (ColorPickerPreference) findPreference(PULSE_AMBIENT_LIGHT_COLOR_RIGHT); - mRightEdgeLightColorPreference.setOnPreferenceChangeListener(this); - int rightEdgeLightColor = Settings.System.getInt(getContentResolver(), - Settings.System.PULSE_AMBIENT_LIGHT_COLOR_RIGHT, 0xFF3980FF); - String rightEdgeLightColorHex = String.format("#%08x", (0xFF3980FF & rightEdgeLightColor)); - if (rightEdgeLightColorHex.equals("#ff3980ff")) { - mRightEdgeLightColorPreference.setSummary(R.string.default_string); - } else { - mRightEdgeLightColorPreference.setSummary(rightEdgeLightColorHex); - } - mRightEdgeLightColorPreference.setNewPreviewColor(rightEdgeLightColor); - - mAmbientNotifLight = (SwitchPreference) findPreference(AMBIENT_NOTIFICATION_LIGHT_ENABLED); - mAmbientContentHide = (SwitchPreference) findPreference(AMBIENT_NOTIFICATION_LIGHT_HIDE_AOD); - boolean mAlwaysOnByDefault = getResources().getBoolean(com.android.internal.R.bool.config_dozeAlwaysOnEnabled); - boolean mAODDisabled = Settings.Secure.getIntForUser(resolver, - Settings.Secure.DOZE_ALWAYS_ON, mAlwaysOnByDefault ? 1 : 0, - UserHandle.USER_CURRENT) == 0; - if (!getResources().getBoolean(com.android.internal.R.bool.config_dozeAlwaysOnDisplayAvailable)) { - prefScreen.removePreference(mAmbientNotifLight); - prefScreen.removePreference(mAmbientContentHide); - } else if (!mAODDisabled) { - prefScreen.removePreference(mAmbientContentHide); - } - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - ContentResolver resolver = getActivity().getContentResolver(); - if (preference == mLeftEdgeLightColorPreference) { - String hex = ColorPickerPreference.convertToARGB( - Integer.valueOf(String.valueOf(newValue))); - if (hex.equals("#ff3980ff")) { - preference.setSummary(R.string.default_string); - } else { - preference.setSummary(hex); - } - int intHex = ColorPickerPreference.convertToColorInt(hex); - Settings.System.putInt(getContentResolver(), - Settings.System.PULSE_AMBIENT_LIGHT_COLOR_LEFT, intHex); - return true; - } else if (preference == mRightEdgeLightColorPreference) { - String hex = ColorPickerPreference.convertToARGB( - Integer.valueOf(String.valueOf(newValue))); - if (hex.equals("#ff3980ff")) { - preference.setSummary(R.string.default_string); - } else { - preference.setSummary(hex); - } - int intHex = ColorPickerPreference.convertToColorInt(hex); - Settings.System.putInt(getContentResolver(), - Settings.System.PULSE_AMBIENT_LIGHT_COLOR_RIGHT, intHex); - return true; - } - return false; - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } -} diff --git a/src/com/cherish/settings/fragments/FODIconPickerFragment.java b/src/com/cherish/settings/fragments/FODIconPickerFragment.java deleted file mode 100644 index 6705f56..0000000 --- a/src/com/cherish/settings/fragments/FODIconPickerFragment.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2020 The CherishOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cherish.settings.fragments; - -import android.content.res.Resources; -import android.os.Bundle; -import android.provider.Settings; - -import androidx.preference.Preference; -import androidx.preference.PreferenceCategory; -import androidx.preference.PreferenceScreen; - -import com.android.internal.logging.nano.MetricsProto; - -import com.android.settings.R; -import com.android.settings.SettingsPreferenceFragment; - -public class FODIconPickerFragment extends SettingsPreferenceFragment { - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.cherish_settings_fod_picker); - - getActivity().getActionBar().setTitle(R.string.fod_icon_picker_title); - - mFooterPreferenceMixin.createFooterPreference().setTitle(R.string.fod_icon_picker_footer); - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } -} diff --git a/src/com/cherish/settings/fragments/GamingMode.java b/src/com/cherish/settings/fragments/GamingMode.java deleted file mode 100644 index 4c6d82e..0000000 --- a/src/com/cherish/settings/fragments/GamingMode.java +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (C) 2019 crDroid Android Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cherish.settings.fragments; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.content.ContentResolver; -import android.content.Context; -import android.content.DialogInterface; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; -import android.database.ContentObserver; -import android.net.Uri; -import android.os.Bundle; -import android.os.Handler; -import android.os.Looper; -import android.os.UserHandle; -import android.provider.Settings; -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.ListView; - -import androidx.preference.ListPreference; -import androidx.preference.Preference; -import androidx.preference.PreferenceCategory; -import androidx.preference.PreferenceGroup; -import androidx.preference.PreferenceScreen; -import androidx.preference.SwitchPreference; - -import com.android.internal.logging.nano.MetricsProto; -import com.android.settings.R; -import com.android.settings.SettingsPreferenceFragment; - -import com.cherish.settings.preferences.PackageListAdapter; -import com.cherish.settings.preferences.PackageListAdapter.PackageItem; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class GamingMode extends SettingsPreferenceFragment - implements Preference.OnPreferenceClickListener { - - private static final int DIALOG_GAMING_APPS = 1; - private static final String GAMING_MODE_HW_KEYS = "gaming_mode_hw_keys_toggle"; - - private SwitchPreference mHardwareKeysDisable; - - private PackageListAdapter mPackageAdapter; - private PackageManager mPackageManager; - private PreferenceGroup mGamingPrefList; - private Preference mAddGamingPref; - - private String mGamingPackageList; - private Map mGamingPackages; - private Context mContext; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - // Get launch-able applications - addPreferencesFromResource(R.xml.cherish_settings_gaming_mode); - - mFooterPreferenceMixin.createFooterPreference().setTitle(R.string.add_gaming_mode_package_summary); - - final PreferenceScreen prefScreen = getPreferenceScreen(); - - mHardwareKeysDisable = (SwitchPreference) findPreference(GAMING_MODE_HW_KEYS); - - mPackageManager = getPackageManager(); - mPackageAdapter = new PackageListAdapter(getActivity()); - - mGamingPrefList = (PreferenceGroup) findPreference("gamingmode_applications"); - mGamingPrefList.setOrderingAsAdded(false); - - mGamingPackages = new HashMap(); - - mAddGamingPref = findPreference("add_gamingmode_packages"); - - mAddGamingPref.setOnPreferenceClickListener(this); - - mContext = getActivity().getApplicationContext(); - - SettingsObserver observer = new SettingsObserver(new Handler(Looper.getMainLooper())); - observer.observe(); - } - - @Override - public void onResume() { - super.onResume(); - refreshCustomApplicationPrefs(); - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } - - @Override - public int getDialogMetricsCategory(int dialogId) { - if (dialogId == DIALOG_GAMING_APPS) { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } - return 0; - } - - /** - * Utility classes and supporting methods - */ - @Override - public Dialog onCreateDialog(int id) { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - final Dialog dialog; - final ListView list = new ListView(getActivity()); - list.setAdapter(mPackageAdapter); - - builder.setTitle(R.string.profile_choose_app); - builder.setView(list); - dialog = builder.create(); - - switch (id) { - case DIALOG_GAMING_APPS: - list.setOnItemClickListener(new OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - // Add empty application definition, the user will be able to edit it later - PackageItem info = (PackageItem) parent.getItemAtPosition(position); - addCustomApplicationPref(info.packageName, mGamingPackages); - dialog.cancel(); - } - }); - } - return dialog; - } - - class SettingsObserver extends ContentObserver { - SettingsObserver(Handler handler) { - super(handler); - } - - void observe() { - ContentResolver resolver = mContext.getContentResolver(); - - resolver.registerContentObserver(Settings.System.getUriFor( - Settings.System.GAMING_MODE_ACTIVE), false, this, - UserHandle.USER_ALL); - } - - @Override - public void onChange(boolean selfChange, Uri uri) { - if (uri.equals(Settings.System.getUriFor( - Settings.System.GAMING_MODE_ACTIVE))) { - boolean enable = Settings.System.getInt(mContext.getContentResolver(), - Settings.System.GAMING_MODE_ACTIVE, 0) == 1; - } - } - } - - /** - * Application class - */ - private static class Package { - public String name; - /** - * Stores all the application values in one call - * @param name - */ - public Package(String name) { - this.name = name; - } - - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append(name); - return builder.toString(); - } - - public static Package fromString(String value) { - if (TextUtils.isEmpty(value)) { - return null; - } - - try { - Package item = new Package(value); - return item; - } catch (NumberFormatException e) { - return null; - } - } - - }; - - private void refreshCustomApplicationPrefs() { - if (!parsePackageList()) { - return; - } - - // Add the Application Preferences - if (mGamingPrefList != null) { - mGamingPrefList.removeAll(); - - for (Package pkg : mGamingPackages.values()) { - try { - Preference pref = createPreferenceFromInfo(pkg); - mGamingPrefList.addPreference(pref); - } catch (PackageManager.NameNotFoundException e) { - // Do nothing - } - } - } - - // Keep these at the top - mAddGamingPref.setOrder(0); - // Add 'add' options - mGamingPrefList.addPreference(mAddGamingPref); - } - - @Override - public boolean onPreferenceClick(Preference preference) { - if (preference == mAddGamingPref) { - showDialog(DIALOG_GAMING_APPS); - } else { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) - .setTitle(R.string.dialog_delete_title) - .setMessage(R.string.dialog_delete_message) - .setIconAttribute(android.R.attr.alertDialogIcon) - .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (preference == mGamingPrefList.findPreference(preference.getKey())) { - removeApplicationPref(preference.getKey(), mGamingPackages); - } - } - }) - .setNegativeButton(android.R.string.cancel, null); - - builder.show(); - } - return true; - } - - private void addCustomApplicationPref(String packageName, Map map) { - Package pkg = map.get(packageName); - if (pkg == null) { - pkg = new Package(packageName); - map.put(packageName, pkg); - savePackageList(false, map); - refreshCustomApplicationPrefs(); - } - } - - private Preference createPreferenceFromInfo(Package pkg) - throws PackageManager.NameNotFoundException { - PackageInfo info = mPackageManager.getPackageInfo(pkg.name, - PackageManager.GET_META_DATA); - Preference pref = - new Preference(getActivity()); - - pref.setKey(pkg.name); - pref.setTitle(info.applicationInfo.loadLabel(mPackageManager)); - pref.setIcon(info.applicationInfo.loadIcon(mPackageManager)); - pref.setPersistent(false); - pref.setOnPreferenceClickListener(this); - return pref; - } - - private void removeApplicationPref(String packageName, Map map) { - if (map.remove(packageName) != null) { - savePackageList(false, map); - refreshCustomApplicationPrefs(); - } - } - - private boolean parsePackageList() { - boolean parsed = false; - - final String gamingModeString = Settings.System.getString(getContentResolver(), - Settings.System.GAMING_MODE_VALUES); - - if (!TextUtils.equals(mGamingPackageList, gamingModeString)) { - mGamingPackageList = gamingModeString; - mGamingPackages.clear(); - parseAndAddToMap(gamingModeString, mGamingPackages); - parsed = true; - } - - return parsed; - } - - private void parseAndAddToMap(String baseString, Map map) { - if (baseString == null) { - return; - } - - final String[] array = TextUtils.split(baseString, "\\|"); - for (String item : array) { - if (TextUtils.isEmpty(item)) { - continue; - } - Package pkg = Package.fromString(item); - map.put(pkg.name, pkg); - } - } - - - private void savePackageList(boolean preferencesUpdated, Map map) { - String setting = map == mGamingPackages ? Settings.System.GAMING_MODE_VALUES : Settings.System.GAMING_MODE_DUMMY; - - List settings = new ArrayList(); - for (Package app : map.values()) { - settings.add(app.toString()); - } - final String value = TextUtils.join("|", settings); - if (preferencesUpdated) { - if (TextUtils.equals(setting, Settings.System.GAMING_MODE_VALUES)) { - mGamingPackageList = value; - } - } - Settings.System.putString(getContentResolver(), - setting, value); - } -} diff --git a/src/com/cherish/settings/fragments/GamingModeReceiver.java b/src/com/cherish/settings/fragments/GamingModeReceiver.java deleted file mode 100644 index abf08d2..0000000 --- a/src/com/cherish/settings/fragments/GamingModeReceiver.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2019 crDroid Android Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cherish.settings.fragments; - -import android.app.AlertDialog; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.provider.Settings; -import android.util.Log; -import android.text.TextUtils; - -import com.android.settings.R; -import com.android.internal.util.gaming.GamingModeController; - -public class GamingModeReceiver extends BroadcastReceiver { - - private static final String TAG = "GamingModeReceiver"; - private static final boolean DEBUG = false; - - public GamingModeReceiver() { - } - - @Override - public void onReceive(Context context, Intent intent) { - if (intent.getAction() != null && - intent.getAction().equals(GamingModeController.GAMING_MODE_TURN_OFF)) { - if (DEBUG) Log.d(TAG, "Received " + GamingModeController.GAMING_MODE_TURN_OFF); - Settings.System.putInt(context.getContentResolver(), Settings.System.GAMING_MODE_ACTIVE, 0); - } else if (intent.getAction() != null && - intent.getAction().equals(GamingModeController.GAMING_MODE_TURN_ON)) { - if (DEBUG) Log.d(TAG, "Received " + GamingModeController.GAMING_MODE_TURN_ON); - Settings.System.putInt(context.getContentResolver(), Settings.System.GAMING_MODE_ACTIVE, 1); - } - } -} diff --git a/src/com/cherish/settings/fragments/HeadsUp.java b/src/com/cherish/settings/fragments/HeadsUp.java deleted file mode 100644 index 9a255f3..0000000 --- a/src/com/cherish/settings/fragments/HeadsUp.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Copyright (C) 2014 The Nitrogen Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cherish.settings.fragments; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.content.DialogInterface; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; -import android.content.res.Resources; -import android.os.Bundle; -import androidx.preference.ListPreference; -import androidx.preference.Preference; -import androidx.preference.PreferenceGroup; -import androidx.preference.PreferenceScreen; -import androidx.preference.PreferenceViewHolder; -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.ListView; - -import com.android.internal.logging.nano.MetricsProto; -import com.android.settings.R; -import com.android.settings.SettingsPreferenceFragment; -import com.cherish.settings.preferences.PackageListAdapter; -import com.cherish.settings.preferences.PackageListAdapter.PackageItem; -import android.provider.Settings; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class HeadsUp extends SettingsPreferenceFragment - implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener { - - private static final int DIALOG_STOPLIST_APPS = 0; - private static final int DIALOG_BLACKLIST_APPS = 1; - private static final String PREF_HEADS_UP_TIME_OUT = "heads_up_time_out"; - private static final String PREF_HEADS_UP_SNOOZE_TIME = "heads_up_snooze_time"; - - private PackageListAdapter mPackageAdapter; - private PackageManager mPackageManager; - private PreferenceGroup mStoplistPrefList; - private PreferenceGroup mBlacklistPrefList; - private Preference mAddStoplistPref; - private Preference mAddBlacklistPref; - private ListPreference mHeadsUpTimeOut; - private ListPreference mHeadsUpSnoozeTime; - - private String mStoplistPackageList; - private String mBlacklistPackageList; - private Map mStoplistPackages; - private Map mBlacklistPackages; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - // Get launch-able applications - addPreferencesFromResource(R.xml.heads_up_settings); - mPackageManager = getPackageManager(); - mPackageAdapter = new PackageListAdapter(getActivity()); - - mStoplistPrefList = (PreferenceGroup) findPreference("stoplist_applications"); - mStoplistPrefList.setOrderingAsAdded(false); - - mBlacklistPrefList = (PreferenceGroup) findPreference("blacklist_applications"); - mBlacklistPrefList.setOrderingAsAdded(false); - - mStoplistPackages = new HashMap(); - mBlacklistPackages = new HashMap(); - - mAddStoplistPref = findPreference("add_stoplist_packages"); - mAddBlacklistPref = findPreference("add_blacklist_packages"); - - mAddStoplistPref.setOnPreferenceClickListener(this); - mAddBlacklistPref.setOnPreferenceClickListener(this); - - Resources systemUiResources; - try { - systemUiResources = getPackageManager().getResourcesForApplication("com.android.systemui"); - } catch (Exception e) { - return; - } - - int defaultTimeOut = systemUiResources.getInteger(systemUiResources.getIdentifier( - "com.android.systemui:integer/heads_up_notification_decay", null, null)); - mHeadsUpTimeOut = (ListPreference) findPreference(PREF_HEADS_UP_TIME_OUT); - mHeadsUpTimeOut.setOnPreferenceChangeListener(this); - int headsUpTimeOut = Settings.System.getInt(getContentResolver(), - Settings.System.HEADS_UP_TIMEOUT, defaultTimeOut); - mHeadsUpTimeOut.setValue(String.valueOf(headsUpTimeOut)); - updateHeadsUpTimeOutSummary(headsUpTimeOut); - - int defaultSnooze = systemUiResources.getInteger(systemUiResources.getIdentifier( - "com.android.systemui:integer/heads_up_default_snooze_length_ms", null, null)); - mHeadsUpSnoozeTime = (ListPreference) findPreference(PREF_HEADS_UP_SNOOZE_TIME); - mHeadsUpSnoozeTime.setOnPreferenceChangeListener(this); - int headsUpSnooze = Settings.System.getInt(getContentResolver(), - Settings.System.HEADS_UP_NOTIFICATION_SNOOZE, defaultSnooze); - mHeadsUpSnoozeTime.setValue(String.valueOf(headsUpSnooze)); - updateHeadsUpSnoozeTimeSummary(headsUpSnooze); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (preference == mHeadsUpTimeOut) { - int headsUpTimeOut = Integer.valueOf((String) newValue); - Settings.System.putInt(getContentResolver(), - Settings.System.HEADS_UP_TIMEOUT, - headsUpTimeOut); - updateHeadsUpTimeOutSummary(headsUpTimeOut); - return true; - } else if (preference == mHeadsUpSnoozeTime) { - int headsUpSnooze = Integer.valueOf((String) newValue); - Settings.System.putInt(getContentResolver(), - Settings.System.HEADS_UP_NOTIFICATION_SNOOZE, - headsUpSnooze); - updateHeadsUpSnoozeTimeSummary(headsUpSnooze); - return true; - } - return false; - } - - private void updateHeadsUpTimeOutSummary(int value) { - String summary = getResources().getString(R.string.heads_up_time_out_summary, - value / 1000); - mHeadsUpTimeOut.setSummary(summary); - } - - private void updateHeadsUpSnoozeTimeSummary(int value) { - if (value == 0) { - mHeadsUpSnoozeTime.setSummary(getResources().getString(R.string.heads_up_snooze_disabled_summary)); - } else if (value == 60000) { - mHeadsUpSnoozeTime.setSummary(getResources().getString(R.string.heads_up_snooze_summary_one_minute)); - } else { - String summary = getResources().getString(R.string.heads_up_snooze_summary, value / 60 / 1000); - mHeadsUpSnoozeTime.setSummary(summary); - } - } - - @Override - public void onResume() { - super.onResume(); - refreshCustomApplicationPrefs(); - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } - - @Override - public int getDialogMetricsCategory(int dialogId) { - if (dialogId == DIALOG_STOPLIST_APPS || dialogId == DIALOG_BLACKLIST_APPS ) { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } - return 0; - } - - /** - * Utility classes and supporting methods - */ - @Override - public Dialog onCreateDialog(int id) { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - final Dialog dialog; - final ListView list = new ListView(getActivity()); - list.setAdapter(mPackageAdapter); - - builder.setTitle(R.string.profile_choose_app); - builder.setView(list); - dialog = builder.create(); - - switch (id) { - case DIALOG_STOPLIST_APPS: - list.setOnItemClickListener(new OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - // Add empty application definition, the user will be able to edit it later - PackageItem info = (PackageItem) parent.getItemAtPosition(position); - addCustomApplicationPref(info.packageName, mStoplistPackages); - dialog.cancel(); - } - }); - break; - case DIALOG_BLACKLIST_APPS: - list.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, - View view, int position, long id) { - PackageItem info = (PackageItem) parent.getItemAtPosition(position); - addCustomApplicationPref(info.packageName, mBlacklistPackages); - dialog.cancel(); - } - }); - } - return dialog; - } - - /** - * Application class - */ - private static class Package { - public String name; - /** - * Stores all the application values in one call - * @param name - */ - public Package(String name) { - this.name = name; - } - - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append(name); - return builder.toString(); - } - - public static Package fromString(String value) { - if (TextUtils.isEmpty(value)) { - return null; - } - - try { - Package item = new Package(value); - return item; - } catch (NumberFormatException e) { - return null; - } - } - - }; - - private void refreshCustomApplicationPrefs() { - if (!parsePackageList()) { - return; - } - - // Add the Application Preferences - if (mStoplistPrefList != null && mBlacklistPrefList != null) { - mStoplistPrefList.removeAll(); - mBlacklistPrefList.removeAll(); - - for (Package pkg : mStoplistPackages.values()) { - try { - Preference pref = createPreferenceFromInfo(pkg); - mStoplistPrefList.addPreference(pref); - } catch (PackageManager.NameNotFoundException e) { - // Do nothing - } - } - - for (Package pkg : mBlacklistPackages.values()) { - try { - Preference pref = createPreferenceFromInfo(pkg); - mBlacklistPrefList.addPreference(pref); - } catch (PackageManager.NameNotFoundException e) { - // Do nothing - } - } - } - - // Keep these at the top - mAddStoplistPref.setOrder(0); - mAddBlacklistPref.setOrder(0); - // Add 'add' options - mStoplistPrefList.addPreference(mAddStoplistPref); - mBlacklistPrefList.addPreference(mAddBlacklistPref); - } - - @Override - public boolean onPreferenceClick(Preference preference) { - if (preference == mAddStoplistPref) { - showDialog(DIALOG_STOPLIST_APPS); - } else if (preference == mAddBlacklistPref) { - showDialog(DIALOG_BLACKLIST_APPS); - } else { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) - .setTitle(R.string.dialog_delete_title) - .setMessage(R.string.dialog_delete_message) - .setIconAttribute(android.R.attr.alertDialogIcon) - .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (preference == mBlacklistPrefList.findPreference(preference.getKey())) { - removeApplicationPref(preference.getKey(), mBlacklistPackages); - } else if (preference == mStoplistPrefList.findPreference(preference.getKey())) { - removeApplicationPref(preference.getKey(), mStoplistPackages); - } - } - }) - .setNegativeButton(android.R.string.cancel, null); - - builder.show(); - } - return true; - } - - private void addCustomApplicationPref(String packageName, Map map) { - Package pkg = map.get(packageName); - if (pkg == null) { - pkg = new Package(packageName); - map.put(packageName, pkg); - savePackageList(false, map); - refreshCustomApplicationPrefs(); - } - } - - private Preference createPreferenceFromInfo(Package pkg) - throws PackageManager.NameNotFoundException { - PackageInfo info = mPackageManager.getPackageInfo(pkg.name, - PackageManager.GET_META_DATA); - Preference pref = - new Preference(getActivity()); - - pref.setKey(pkg.name); - pref.setTitle(info.applicationInfo.loadLabel(mPackageManager)); - pref.setIcon(info.applicationInfo.loadIcon(mPackageManager)); - pref.setPersistent(false); - pref.setOnPreferenceClickListener(this); - return pref; - } - - private void removeApplicationPref(String packageName, Map map) { - if (map.remove(packageName) != null) { - savePackageList(false, map); - refreshCustomApplicationPrefs(); - } - } - - private boolean parsePackageList() { - boolean parsed = false; - - final String stoplistString = Settings.System.getString(getContentResolver(), - Settings.System.HEADS_UP_STOPLIST_VALUES); - final String blacklistString = Settings.System.getString(getContentResolver(), - Settings.System.HEADS_UP_BLACKLIST_VALUES); - - if (!TextUtils.equals(mStoplistPackageList, stoplistString)) { - mStoplistPackageList = stoplistString; - mStoplistPackages.clear(); - parseAndAddToMap(stoplistString, mStoplistPackages); - parsed = true; - } - - if (!TextUtils.equals(mBlacklistPackageList, blacklistString)) { - mBlacklistPackageList = blacklistString; - mBlacklistPackages.clear(); - parseAndAddToMap(blacklistString, mBlacklistPackages); - parsed = true; - } - - return parsed; - } - - private void parseAndAddToMap(String baseString, Map map) { - if (baseString == null) { - return; - } - - final String[] array = TextUtils.split(baseString, "\\|"); - for (String item : array) { - if (TextUtils.isEmpty(item)) { - continue; - } - Package pkg = Package.fromString(item); - map.put(pkg.name, pkg); - } - } - - - private void savePackageList(boolean preferencesUpdated, Map map) { - String setting = map == mStoplistPackages - ? Settings.System.HEADS_UP_STOPLIST_VALUES - : Settings.System.HEADS_UP_BLACKLIST_VALUES; - - List settings = new ArrayList(); - for (Package app : map.values()) { - settings.add(app.toString()); - } - final String value = TextUtils.join("|", settings); - if (preferencesUpdated) { - if (TextUtils.equals(setting, Settings.System.HEADS_UP_STOPLIST_VALUES)) { - mStoplistPackageList = value; - } else { - mBlacklistPackageList = value; - } - } - Settings.System.putString(getContentResolver(), - setting, value); - } -} diff --git a/src/com/cherish/settings/fragments/IncallFeedbackPreferenceController.java b/src/com/cherish/settings/fragments/IncallFeedbackPreferenceController.java deleted file mode 100644 index 2076ae7..0000000 --- a/src/com/cherish/settings/fragments/IncallFeedbackPreferenceController.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2019 The PixelExperience Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cherish.settings.fragments; - -import android.content.Context; -import android.telephony.TelephonyManager; - -import com.android.settings.core.BasePreferenceController; - -public class IncallFeedbackPreferenceController extends BasePreferenceController { - - public IncallFeedbackPreferenceController(Context context, String key) { - super(context, key); - } - - @Override - public int getAvailabilityStatus() { - return isVoiceCapable() ? AVAILABLE : UNSUPPORTED_ON_DEVICE; - } - - private boolean isVoiceCapable() { - TelephonyManager telephony = - (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); - return telephony != null && telephony.isVoiceCapable(); - } - -} \ No newline at end of file diff --git a/src/com/cherish/settings/fragments/LockScreenSettings.java b/src/com/cherish/settings/fragments/LockScreenSettings.java index a6315ab..2bcf7c0 100644 --- a/src/com/cherish/settings/fragments/LockScreenSettings.java +++ b/src/com/cherish/settings/fragments/LockScreenSettings.java @@ -42,13 +42,6 @@ import com.cherish.settings.preferences.SystemSettingListPreference; public class LockScreenSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener { - - private static final String FINGERPRINT_VIB = "fingerprint_success_vib"; - private static final String FOD_ICON_PICKER_CATEGORY = "fod_icon_picker_category"; - - private FingerprintManager mFingerprintManager; - private SwitchPreference mFingerprintVib; - private Preference mFODIconPicker; @Override public void onCreate(Bundle icicle) { @@ -58,33 +51,11 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements ContentResolver resolver = getActivity().getContentResolver(); final PreferenceScreen prefScreen = getPreferenceScreen(); Resources resources = getResources(); - - mFODIconPicker = (Preference) findPreference(FOD_ICON_PICKER_CATEGORY); - if (mFODIconPicker != null - && !getResources().getBoolean(com.android.internal.R.bool.config_supportsInDisplayFingerprint)) { - prefScreen.removePreference(mFODIconPicker); - } - - mFingerprintManager = (FingerprintManager) getActivity().getSystemService(Context.FINGERPRINT_SERVICE); - mFingerprintVib = (SwitchPreference) findPreference(FINGERPRINT_VIB); - if (!mFingerprintManager.isHardwareDetected()){ - prefScreen.removePreference(mFingerprintVib); - } else { - mFingerprintVib.setChecked((Settings.System.getInt(getContentResolver(), - Settings.System.FINGERPRINT_SUCCESS_VIB, 1) == 1)); - mFingerprintVib.setOnPreferenceChangeListener(this); - } - } public boolean onPreferenceChange(Preference preference, Object newValue) { ContentResolver resolver = getActivity().getContentResolver(); - if (preference == mFingerprintVib) { - boolean value = (Boolean) newValue; - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.FINGERPRINT_SUCCESS_VIB, value ? 1 : 0); - return true; - } + return false; } @@ -93,4 +64,4 @@ public class LockScreenSettings extends SettingsPreferenceFragment implements return MetricsProto.MetricsEvent.CHERISH_SETTINGS; } -} +} \ No newline at end of file diff --git a/src/com/cherish/settings/fragments/MiscSettings.java b/src/com/cherish/settings/fragments/MiscSettings.java index 2189ff9..cb450a4 100644 --- a/src/com/cherish/settings/fragments/MiscSettings.java +++ b/src/com/cherish/settings/fragments/MiscSettings.java @@ -45,22 +45,12 @@ public class MiscSettings extends SettingsPreferenceFragment implements addPreferencesFromResource(R.xml.cherish_settings_misc); - mGamingMode = (SystemSettingMasterSwitchPreference) findPreference(GAMING_MODE_ENABLED); - mGamingMode.setChecked((Settings.System.getInt(getActivity().getContentResolver(), - Settings.System.GAMING_MODE_ENABLED, 0) == 1)); - mGamingMode.setOnPreferenceChangeListener(this); - } @Override public boolean onPreferenceChange(Preference preference, Object objValue) { ContentResolver resolver = getActivity().getContentResolver(); - if (preference == mGamingMode) { - boolean value = (Boolean) objValue; - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.GAMING_MODE_ENABLED, value ? 1 : 0); - return true; - } + return false; } diff --git a/src/com/cherish/settings/fragments/NotificationSettings.java b/src/com/cherish/settings/fragments/NotificationSettings.java index 338d4bc..cde1f7f 100644 --- a/src/com/cherish/settings/fragments/NotificationSettings.java +++ b/src/com/cherish/settings/fragments/NotificationSettings.java @@ -21,17 +21,6 @@ import net.margaritov.preference.colorpicker.ColorPickerPreference; public class NotificationSettings extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener{ - private static final String PULSE_AMBIENT_LIGHT = "pulse_ambient_light"; - private static final String PREF_FLASH_ON_CALL = "flashlight_on_call"; - private static final String PREF_FLASH_ON_CALL_DND = "flashlight_on_call_ignore_dnd"; - private static final String PREF_FLASH_ON_CALL_RATE = "flashlight_on_call_rate"; - - private Preference mChargingLeds; - private SystemSettingMasterSwitchPreference mEdgePulse; - private SystemSettingListPreference mFlashOnCall; - private SystemSettingSwitchPreference mFlashOnCallIgnoreDND; - private CustomSeekBarPreference mFlashOnCallRate; - @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); @@ -39,61 +28,13 @@ public class NotificationSettings extends SettingsPreferenceFragment implements addPreferencesFromResource(R.xml.cherish_settings_notifications); PreferenceScreen prefScreen = getPreferenceScreen(); ContentResolver resolver = getActivity().getContentResolver(); - - mChargingLeds = (Preference) findPreference("charging_light"); - if (mChargingLeds != null - && !getResources().getBoolean( - com.android.internal.R.bool.config_intrusiveBatteryLed)) { - prefScreen.removePreference(mChargingLeds); - } - - mEdgePulse = (SystemSettingMasterSwitchPreference) findPreference(PULSE_AMBIENT_LIGHT); - mEdgePulse.setOnPreferenceChangeListener(this); - int edgePulse = Settings.System.getInt(getContentResolver(), - PULSE_AMBIENT_LIGHT, 0); - mEdgePulse.setChecked(edgePulse != 0); - - mFlashOnCallRate = (CustomSeekBarPreference) - findPreference(PREF_FLASH_ON_CALL_RATE); - int value = Settings.System.getInt(resolver, - Settings.System.FLASHLIGHT_ON_CALL_RATE, 1); - mFlashOnCallRate.setValue(value); - mFlashOnCallRate.setOnPreferenceChangeListener(this); - - mFlashOnCallIgnoreDND = (SystemSettingSwitchPreference) - findPreference(PREF_FLASH_ON_CALL_DND); - value = Settings.System.getInt(resolver, - Settings.System.FLASHLIGHT_ON_CALL, 0); - mFlashOnCallIgnoreDND.setVisible(value > 1); - mFlashOnCallRate.setVisible(value != 0); - - mFlashOnCall = (SystemSettingListPreference) - findPreference(PREF_FLASH_ON_CALL); - mFlashOnCall.setOnPreferenceChangeListener(this); } @Override public boolean onPreferenceChange(Preference preference, Object newValue) { ContentResolver resolver = getActivity().getContentResolver(); - if (preference == mEdgePulse) { - boolean value = (Boolean) newValue; - Settings.System.putInt(getContentResolver(), - PULSE_AMBIENT_LIGHT, value ? 1 : 0); - return true; - } else if (preference == mFlashOnCall) { - int value = Integer.parseInt((String) newValue); - Settings.System.putInt(resolver, - Settings.System.FLASHLIGHT_ON_CALL, value); - mFlashOnCallIgnoreDND.setVisible(value > 1); - mFlashOnCallRate.setVisible(value != 0); - return true; - } else if (preference == mFlashOnCallRate) { - int value = (Integer) newValue; - Settings.System.putInt(resolver, - Settings.System.FLASHLIGHT_ON_CALL_RATE, value); - return true; - } + return false; } diff --git a/src/com/cherish/settings/fragments/PulseSettings.java b/src/com/cherish/settings/fragments/PulseSettings.java deleted file mode 100644 index e6e15f8..0000000 --- a/src/com/cherish/settings/fragments/PulseSettings.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (C) 2020 The Dirty Unicorns Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cherish.settings.fragments; - -import java.util.ArrayList; -import java.util.List; - -import com.android.internal.logging.nano.MetricsProto; -import com.android.settings.R; -import com.android.settings.SettingsPreferenceFragment; -import com.android.settings.search.BaseSearchIndexProvider; -import com.android.settings.search.Indexable; -import com.android.settingslib.search.SearchIndexable; -import net.margaritov.preference.colorpicker.ColorPickerPreference; -import com.cherish.settings.preferences.SecureSettingListPreference; -import com.cherish.settings.preferences.SecureSettingSeekBarPreference; -import com.android.internal.util.cherish.CherishUtils; - -import android.content.Context; -import android.content.ContentResolver; -import android.graphics.Color; -import android.os.Bundle; -import android.os.UserHandle; - -import androidx.preference.PreferenceCategory; -import androidx.preference.ListPreference; -import androidx.preference.Preference; -import androidx.preference.PreferenceScreen; -import androidx.preference.Preference.OnPreferenceChangeListener; -import androidx.preference.SwitchPreference; - -import android.provider.SearchIndexableResource; -import android.provider.Settings; - -@SearchIndexable -public class PulseSettings extends SettingsPreferenceFragment implements - Preference.OnPreferenceChangeListener, Indexable { - private static final String TAG = PulseSettings.class.getSimpleName(); - private static final String NAVBAR_PULSE_ENABLED_KEY = "navbar_pulse_enabled"; - private static final String LOCKSCREEN_PULSE_ENABLED_KEY = "lockscreen_pulse_enabled"; - private static final String AMBIENT_PULSE_ENABLED_KEY = "ambient_pulse_enabled"; - private static final String PULSE_SMOOTHING_KEY = "pulse_smoothing_enabled"; - private static final String PULSE_COLOR_MODE_KEY = "pulse_color_mode"; - private static final String PULSE_COLOR_MODE_CHOOSER_KEY = "pulse_color_user"; - private static final String PULSE_COLOR_MODE_LAVA_SPEED_KEY = "pulse_lavalamp_speed"; - private static final String PULSE_RENDER_CATEGORY_SOLID = "pulse_2"; - private static final String PULSE_RENDER_CATEGORY_FADING = "pulse_fading_bars_category"; - private static final String PULSE_RENDER_MODE_KEY = "pulse_render_style"; - private static final int RENDER_STYLE_FADING_BARS = 0; - private static final int RENDER_STYLE_SOLID_LINES = 1; - private static final int COLOR_TYPE_ACCENT = 0; - private static final int COLOR_TYPE_USER = 1; - private static final int COLOR_TYPE_LAVALAMP = 2; - private static final int COLOR_TYPE_AUTO = 3; - - private SwitchPreference mNavbarPulse; - private SwitchPreference mLockscreenPulse; - private SwitchPreference mAmbientPulse; - private SwitchPreference mPulseSmoothing; - private Preference mRenderMode; - private ListPreference mColorModePref; - private ColorPickerPreference mColorPickerPref; - private Preference mLavaSpeedPref; - - private PreferenceCategory mFadingBarsCat; - private PreferenceCategory mSolidBarsCat; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - addPreferencesFromResource(R.xml.cherish_settings_pulse); - - mFooterPreferenceMixin.createFooterPreference() - .setTitle(R.string.pulse_help_policy_notice_summary); - - ContentResolver resolver = getContentResolver(); - - mNavbarPulse = (SwitchPreference) findPreference(NAVBAR_PULSE_ENABLED_KEY); - boolean navbarPulse = Settings.Secure.getIntForUser(resolver, - Settings.Secure.NAVBAR_PULSE_ENABLED, 0, UserHandle.USER_CURRENT) != 0; - mNavbarPulse.setChecked(navbarPulse); - mNavbarPulse.setOnPreferenceChangeListener(this); - - mLockscreenPulse = (SwitchPreference) findPreference(LOCKSCREEN_PULSE_ENABLED_KEY); - boolean lockscreenPulse = Settings.Secure.getIntForUser(resolver, - Settings.Secure.LOCKSCREEN_PULSE_ENABLED, 0, UserHandle.USER_CURRENT) != 0; - mLockscreenPulse.setChecked(lockscreenPulse); - mLockscreenPulse.setOnPreferenceChangeListener(this); - - mAmbientPulse = (SwitchPreference) findPreference(AMBIENT_PULSE_ENABLED_KEY); - boolean ambientPulse = Settings.Secure.getIntForUser(resolver, - Settings.Secure.AMBIENT_PULSE_ENABLED, 1, UserHandle.USER_CURRENT) != 0; - mAmbientPulse.setChecked(ambientPulse); - mAmbientPulse.setOnPreferenceChangeListener(this); - - mColorModePref = (ListPreference) findPreference(PULSE_COLOR_MODE_KEY); - mColorPickerPref = (ColorPickerPreference) findPreference(PULSE_COLOR_MODE_CHOOSER_KEY); - mLavaSpeedPref = findPreference(PULSE_COLOR_MODE_LAVA_SPEED_KEY); - mColorModePref.setOnPreferenceChangeListener(this); - mColorPickerPref.setDefaultValue(CherishUtils.getThemeAccentColor(getContext())); - int colorMode = Settings.Secure.getIntForUser(getContentResolver(), - Settings.Secure.PULSE_COLOR_MODE, COLOR_TYPE_ACCENT, UserHandle.USER_CURRENT); - if (colorMode == COLOR_TYPE_ACCENT) { - mColorPickerPref.setNewPreviewColor(CherishUtils.getThemeAccentColor(getContext())); - } - updateColorPrefs(colorMode); - - mRenderMode = findPreference(PULSE_RENDER_MODE_KEY); - mRenderMode.setOnPreferenceChangeListener(this); - mFadingBarsCat = (PreferenceCategory) findPreference( - PULSE_RENDER_CATEGORY_FADING); - mSolidBarsCat = (PreferenceCategory) findPreference( - PULSE_RENDER_CATEGORY_SOLID); - - mPulseSmoothing = (SwitchPreference) findPreference(PULSE_SMOOTHING_KEY); - - updateAllPrefs(); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - ContentResolver resolver = getContext().getContentResolver(); - if (preference == mNavbarPulse) { - boolean val = (Boolean) newValue; - Settings.Secure.putIntForUser(resolver, - Settings.Secure.NAVBAR_PULSE_ENABLED, val ? 1 : 0, UserHandle.USER_CURRENT); - updateAllPrefs(); - return true; - } else if (preference == mLockscreenPulse) { - boolean val = (Boolean) newValue; - Settings.Secure.putIntForUser(resolver, - Settings.Secure.LOCKSCREEN_PULSE_ENABLED, val ? 1 : 0, UserHandle.USER_CURRENT); - updateAllPrefs(); - return true; - } else if (preference == mAmbientPulse) { - boolean val = (Boolean) newValue; - Settings.Secure.putIntForUser(resolver, - Settings.Secure.AMBIENT_PULSE_ENABLED, val ? 1 : 0, UserHandle.USER_CURRENT); - updateAllPrefs(); - return true; - } else if (preference == mColorModePref) { - updateColorPrefs(Integer.valueOf(String.valueOf(newValue))); - return true; - } else if (preference == mRenderMode) { - updateRenderCategories(Integer.valueOf(String.valueOf(newValue))); - return true; - } - return false; - } - - private void updateAllPrefs() { - ContentResolver resolver = getContentResolver(); - - boolean navbarPulse = Settings.Secure.getIntForUser(resolver, - Settings.Secure.NAVBAR_PULSE_ENABLED, 0, UserHandle.USER_CURRENT) != 0; - boolean lockscreenPulse = Settings.Secure.getIntForUser(resolver, - Settings.Secure.LOCKSCREEN_PULSE_ENABLED, 0, UserHandle.USER_CURRENT) != 0; - boolean ambientPulse = Settings.Secure.getIntForUser(resolver, - Settings.Secure.AMBIENT_PULSE_ENABLED, 0, UserHandle.USER_CURRENT) != 0; - - mPulseSmoothing.setEnabled(navbarPulse || lockscreenPulse || ambientPulse); - - mColorModePref.setEnabled(navbarPulse || lockscreenPulse || ambientPulse); - if (navbarPulse || lockscreenPulse) { - int colorMode = Settings.Secure.getIntForUser(resolver, - Settings.Secure.PULSE_COLOR_MODE, COLOR_TYPE_ACCENT, UserHandle.USER_CURRENT); - updateColorPrefs(colorMode); - } else { - mColorPickerPref.setEnabled(false); - mLavaSpeedPref.setEnabled(false); - } - - mRenderMode.setEnabled(navbarPulse || lockscreenPulse || ambientPulse); - if (navbarPulse || lockscreenPulse || ambientPulse) { - int renderMode = Settings.Secure.getIntForUser(resolver, - Settings.Secure.PULSE_RENDER_STYLE, RENDER_STYLE_SOLID_LINES, UserHandle.USER_CURRENT); - updateRenderCategories(renderMode); - } else { - mFadingBarsCat.setEnabled(false); - mSolidBarsCat.setEnabled(false); - } - } - - private void updateColorPrefs(int val) { - switch (val) { - case COLOR_TYPE_ACCENT: - mColorPickerPref.setEnabled(false); - mLavaSpeedPref.setEnabled(false); - break; - case COLOR_TYPE_USER: - mColorPickerPref.setEnabled(true); - mLavaSpeedPref.setEnabled(false); - break; - case COLOR_TYPE_LAVALAMP: - mColorPickerPref.setEnabled(false); - mLavaSpeedPref.setEnabled(true); - break; - case COLOR_TYPE_AUTO: - mColorPickerPref.setEnabled(false); - mLavaSpeedPref.setEnabled(false); - break; - } - } - - private void updateRenderCategories(int mode) { - mFadingBarsCat.setEnabled(mode == RENDER_STYLE_FADING_BARS); - mSolidBarsCat.setEnabled(mode == RENDER_STYLE_SOLID_LINES); - } - - public static void reset(Context mContext) { - ContentResolver resolver = mContext.getContentResolver(); - Settings.Secure.putIntForUser(resolver, - Settings.Secure.LOCKSCREEN_PULSE_ENABLED, 1, UserHandle.USER_CURRENT); - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } - - public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = new BaseSearchIndexProvider() { - @Override - public List getXmlResourcesToIndex(Context context, - boolean enabled) { - final ArrayList result = new ArrayList<>(); - final SearchIndexableResource sir = new SearchIndexableResource(context); - sir.xmlResId = R.xml.cherish_settings_pulse; - result.add(sir); - return result; - } - - @Override - public List getNonIndexableKeys(Context context) { - final List keys = super.getNonIndexableKeys(context); - return keys; - } - }; -} diff --git a/src/com/cherish/settings/fragments/QsHeader.java b/src/com/cherish/settings/fragments/QsHeader.java deleted file mode 100644 index df59d34..0000000 --- a/src/com/cherish/settings/fragments/QsHeader.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (C) 2019 ion-OS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.cherish.settings.fragments; - -import android.app.Activity; -import android.content.ContentResolver; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.net.Uri; -import android.os.Bundle; -import android.provider.Settings; -import androidx.preference.ListPreference; -import androidx.preference.Preference; - -import com.android.internal.logging.nano.MetricsProto; - -import com.android.settings.R; -import com.android.settings.SettingsPreferenceFragment; - -import com.cherish.settings.preferences.CustomSeekBarPreference; -import com.cherish.settings.preferences.SystemSettingSwitchPreference; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class QsHeader extends SettingsPreferenceFragment - implements Preference.OnPreferenceChangeListener{ - - private static final String CUSTOM_HEADER_BROWSE = "custom_header_browse"; - private static final String DAYLIGHT_HEADER_PACK = "daylight_header_pack"; - private static final String CUSTOM_HEADER_IMAGE_SHADOW = "status_bar_custom_header_shadow"; - private static final String CUSTOM_HEADER_PROVIDER = "custom_header_provider"; - private static final String FILE_HEADER_SELECT = "file_header_select"; - - private static final int REQUEST_PICK_IMAGE = 0; - - private Preference mHeaderBrowse; - private ListPreference mDaylightHeaderPack; - private CustomSeekBarPreference mHeaderShadow; - private ListPreference mHeaderProvider; - private String mDaylightHeaderProvider; - private Preference mFileHeader; - private String mFileHeaderProvider; - - @Override - public void onResume() { - super.onResume(); - updateEnablement(); - } - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.qs_header); - ContentResolver resolver = getActivity().getContentResolver(); - - mDaylightHeaderProvider = getResources().getString(R.string.daylight_header_provider); - mFileHeaderProvider = getResources().getString(R.string.file_header_provider); - mHeaderBrowse = findPreference(CUSTOM_HEADER_BROWSE); - - mDaylightHeaderPack = (ListPreference) findPreference(DAYLIGHT_HEADER_PACK); - - List entries = new ArrayList(); - List values = new ArrayList(); - getAvailableHeaderPacks(entries, values); - mDaylightHeaderPack.setEntries(entries.toArray(new String[entries.size()])); - mDaylightHeaderPack.setEntryValues(values.toArray(new String[values.size()])); - - boolean headerEnabled = Settings.System.getInt(resolver, - Settings.System.STATUS_BAR_CUSTOM_HEADER, 0) != 0; - updateHeaderProviderSummary(headerEnabled); - mDaylightHeaderPack.setOnPreferenceChangeListener(this); - - mHeaderShadow = (CustomSeekBarPreference) findPreference(CUSTOM_HEADER_IMAGE_SHADOW); - final int headerShadow = Settings.System.getInt(resolver, - Settings.System.STATUS_BAR_CUSTOM_HEADER_SHADOW, 0); - mHeaderShadow.setValue((int)(((double) headerShadow / 255) * 100)); - mHeaderShadow.setOnPreferenceChangeListener(this); - - mHeaderProvider = (ListPreference) findPreference(CUSTOM_HEADER_PROVIDER); - mHeaderProvider.setOnPreferenceChangeListener(this); - - mFileHeader = findPreference(FILE_HEADER_SELECT); - - } - - private void updateHeaderProviderSummary(boolean headerEnabled) { - mDaylightHeaderPack.setSummary(getResources().getString(R.string.header_provider_disabled)); - if (headerEnabled) { - String settingHeaderPackage = Settings.System.getString(getContentResolver(), - Settings.System.STATUS_BAR_DAYLIGHT_HEADER_PACK); - if (settingHeaderPackage != null) { - int valueIndex = mDaylightHeaderPack.findIndexOfValue(settingHeaderPackage); - mDaylightHeaderPack.setValueIndex(valueIndex >= 0 ? valueIndex : 0); - mDaylightHeaderPack.setSummary(mDaylightHeaderPack.getEntry()); - } - } - } - - @Override - public boolean onPreferenceTreeClick(Preference preference) { - if (preference == mFileHeader) { - Intent intent = new Intent(Intent.ACTION_PICK); - intent.setType("image/*"); - startActivityForResult(intent, REQUEST_PICK_IMAGE); - return true; - } - return super.onPreferenceTreeClick(preference); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (preference == mDaylightHeaderPack) { - String value = (String) newValue; - Settings.System.putString(getContentResolver(), - Settings.System.STATUS_BAR_DAYLIGHT_HEADER_PACK, value); - int valueIndex = mDaylightHeaderPack.findIndexOfValue(value); - mDaylightHeaderPack.setSummary(mDaylightHeaderPack.getEntries()[valueIndex]); - } else if (preference == mHeaderShadow) { - Integer headerShadow = (Integer) newValue; - int realHeaderValue = (int) (((double) headerShadow / 100) * 255); - Settings.System.putInt(getContentResolver(), - Settings.System.STATUS_BAR_CUSTOM_HEADER_SHADOW, realHeaderValue); - } else if (preference == mHeaderProvider) { - String value = (String) newValue; - Settings.System.putString(getContentResolver(), - Settings.System.STATUS_BAR_CUSTOM_HEADER_PROVIDER, value); - int valueIndex = mHeaderProvider.findIndexOfValue(value); - mHeaderProvider.setSummary(mHeaderProvider.getEntries()[valueIndex]); - updateEnablement(); - } - return true; - } - - private boolean isBrowseHeaderAvailable() { - PackageManager pm = getPackageManager(); - Intent browse = new Intent(); - browse.setClassName("org.omnirom.omnistyle", "org.omnirom.omnistyle.PickHeaderActivity"); - return pm.resolveActivity(browse, 0) != null; - } - - private void getAvailableHeaderPacks(List entries, List values) { - Map headerMap = new HashMap(); - Intent i = new Intent(); - PackageManager packageManager = getPackageManager(); - i.setAction("org.omnirom.DaylightHeaderPack"); - for (ResolveInfo r : packageManager.queryIntentActivities(i, 0)) { - String packageName = r.activityInfo.packageName; - String label = r.activityInfo.loadLabel(getPackageManager()).toString(); - if (label == null) { - label = r.activityInfo.packageName; - } - headerMap.put(label, packageName); - } - i.setAction("org.omnirom.DaylightHeaderPack1"); - for (ResolveInfo r : packageManager.queryIntentActivities(i, 0)) { - String packageName = r.activityInfo.packageName; - String label = r.activityInfo.loadLabel(getPackageManager()).toString(); - if (r.activityInfo.name.endsWith(".theme")) { - continue; - } - if (label == null) { - label = packageName; - } - headerMap.put(label, packageName + "/" + r.activityInfo.name); - } - List labelList = new ArrayList(); - labelList.addAll(headerMap.keySet()); - Collections.sort(labelList); - for (String label : labelList) { - entries.add(label); - values.add(headerMap.get(label)); - } - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent result) { - if (requestCode == REQUEST_PICK_IMAGE) { - if (resultCode != Activity.RESULT_OK) { - return; - } - final Uri imageUri = result.getData(); - Settings.System.putString(getContentResolver(), Settings.System.STATUS_BAR_CUSTOM_HEADER_PROVIDER, "file"); - Settings.System.putString(getContentResolver(), Settings.System.STATUS_BAR_FILE_HEADER_IMAGE, imageUri.toString()); - } - } - - private void updateEnablement() { - String providerName = Settings.System.getString(getContentResolver(), - Settings.System.STATUS_BAR_CUSTOM_HEADER_PROVIDER); - if (providerName == null) { - providerName = mDaylightHeaderProvider; - } - if (!providerName.equals(mDaylightHeaderProvider)) { - providerName = mFileHeaderProvider; - } - int valueIndex = mHeaderProvider.findIndexOfValue(providerName); - mHeaderProvider.setValueIndex(valueIndex >= 0 ? valueIndex : 0); - mHeaderProvider.setSummary(mHeaderProvider.getEntry()); - mDaylightHeaderPack.setEnabled(providerName.equals(mDaylightHeaderProvider)); - mFileHeader.setEnabled(providerName.equals(mFileHeaderProvider)); - mHeaderBrowse.setEnabled(isBrowseHeaderAvailable() && providerName.equals(mFileHeaderProvider)); - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } -} diff --git a/src/com/cherish/settings/fragments/QuickSettings.java b/src/com/cherish/settings/fragments/QuickSettings.java index 0da22fb..52fd1a2 100644 --- a/src/com/cherish/settings/fragments/QuickSettings.java +++ b/src/com/cherish/settings/fragments/QuickSettings.java @@ -31,21 +31,6 @@ import java.util.ArrayList; public class QuickSettings extends SettingsPreferenceFragment implements OnPreferenceChangeListener { - private static final String QS_BLUR_ALPHA = "qs_blur_alpha"; - private static final String QS_BLUR_INTENSITY = "qs_blur_intensity"; - private static final String QUICK_PULLDOWN = "quick_pulldown"; - private static final String FOOTER_TEXT_STRING = "footer_text_string"; - private static final String STATUS_BAR_CUSTOM_HEADER = "status_bar_custom_header"; - private static final String QS_HIDE_BATTERY = "qs_hide_battery"; - private static final String QS_BATTERY_MODE = "qs_battery_mode"; - - private ListPreference mQuickPulldown; - private CustomSeekBarPreference mQSBlurAlpha; - private CustomSeekBarPreference mQSBlurIntensity; - private SystemSettingEditTextPreference mFooterString; - private SystemSettingMasterSwitchPreference mCustomHeader; - private SystemSettingSwitchPreference mHideBattery; - private SystemSettingListPreference mQsBatteryMode; @Override public void onCreate(Bundle icicle) { @@ -55,108 +40,13 @@ public class QuickSettings extends SettingsPreferenceFragment implements PreferenceScreen prefScreen = getPreferenceScreen(); ContentResolver resolver = getActivity().getContentResolver(); - mQSBlurAlpha = (CustomSeekBarPreference) findPreference(QS_BLUR_ALPHA); - int qsBlurAlpha = Settings.System.getInt(getContentResolver(), - Settings.System.QS_BLUR_ALPHA, 100); - mQSBlurAlpha.setValue(qsBlurAlpha); - mQSBlurAlpha.setOnPreferenceChangeListener(this); - - mQSBlurIntensity = (CustomSeekBarPreference) findPreference(QS_BLUR_INTENSITY); - int qsBlurIntensity = Settings.System.getInt(getContentResolver(), - Settings.System.QS_BLUR_INTENSITY, 30); - mQSBlurIntensity.setValue(qsBlurIntensity); - mQSBlurIntensity.setOnPreferenceChangeListener(this); - - mQuickPulldown = (ListPreference) findPreference(QUICK_PULLDOWN); - mQuickPulldown.setOnPreferenceChangeListener(this); - int quickPulldownValue = Settings.System.getIntForUser(resolver, - Settings.System.STATUS_BAR_QUICK_QS_PULLDOWN, 0, UserHandle.USER_CURRENT); - mQuickPulldown.setValue(String.valueOf(quickPulldownValue)); - updatePulldownSummary(quickPulldownValue); - - mCustomHeader = (SystemSettingMasterSwitchPreference) findPreference(STATUS_BAR_CUSTOM_HEADER); - int qsHeader = Settings.System.getInt(resolver, - Settings.System.STATUS_BAR_CUSTOM_HEADER, 0); - mCustomHeader.setChecked(qsHeader != 0); - mCustomHeader.setOnPreferenceChangeListener(this); - - mQsBatteryMode = (SystemSettingListPreference) findPreference(QS_BATTERY_MODE); - mHideBattery = (SystemSettingSwitchPreference) findPreference(QS_HIDE_BATTERY); - mHideBattery.setOnPreferenceChangeListener(this); - - mFooterString = (SystemSettingEditTextPreference) findPreference(FOOTER_TEXT_STRING); - mFooterString.setOnPreferenceChangeListener(this); - String footerString = Settings.System.getString(getContentResolver(), - FOOTER_TEXT_STRING); - if (footerString != null && footerString != "") - mFooterString.setText(footerString); - else { - mFooterString.setText("#KeepTheLove"); - Settings.System.putString(getActivity().getContentResolver(), - Settings.System.FOOTER_TEXT_STRING, "#KeepTheLove"); - - } } @Override public boolean onPreferenceChange(Preference preference, Object newValue) { ContentResolver resolver = getActivity().getContentResolver(); - if (preference == mQSBlurAlpha) { - int value = (Integer) newValue; - Settings.System.putInt(getContentResolver(), - Settings.System.QS_BLUR_ALPHA, value); - return true; - } else if (preference == mQSBlurIntensity) { - int value = (Integer) newValue; - Settings.System.putInt(getContentResolver(), - Settings.System.QS_BLUR_INTENSITY, value); - return true; - } else if (preference == mQuickPulldown) { - int quickPulldownValue = Integer.valueOf((String) newValue); - Settings.System.putIntForUser(resolver, Settings.System.STATUS_BAR_QUICK_QS_PULLDOWN, - quickPulldownValue, UserHandle.USER_CURRENT); - updatePulldownSummary(quickPulldownValue); - return true; - } else if (preference == mFooterString) { - String value = (String) newValue; - if (value != "" && value != null) - Settings.System.putString(getActivity().getContentResolver(), - Settings.System.FOOTER_TEXT_STRING, value); - else { - mFooterString.setText("#KeepTheLove"); - Settings.System.putString(getActivity().getContentResolver(), - Settings.System.FOOTER_TEXT_STRING, "#KeepTheLove"); - } - return true; - } else if (preference == mCustomHeader) { - boolean header = (Boolean) newValue; - Settings.System.putInt(resolver, - Settings.System.STATUS_BAR_CUSTOM_HEADER, header ? 1 : 0); - return true; - } else if (preference == mHideBattery) { - Boolean value = (Boolean) newValue; - Settings.System.putInt(getContentResolver(), - Settings.System.QS_HIDE_BATTERY, value ? 1 : 0); - mQsBatteryMode.setEnabled(!value); - return true; - } - return false; - } - private void updatePulldownSummary(int value) { - Resources res = getResources(); - if (value == 0) { - // quick pulldown deactivated - mQuickPulldown.setSummary(res.getString(R.string.quick_pulldown_off)); - } else if (value == 3) { - // quick pulldown always - mQuickPulldown.setSummary(res.getString(R.string.quick_pulldown_summary_always)); - } else { - String direction = res.getString(value == 2 - ? R.string.quick_pulldown_left - : R.string.quick_pulldown_right); - mQuickPulldown.setSummary(res.getString(R.string.quick_pulldown_summary, direction)); - } + return false; } @Override diff --git a/src/com/cherish/settings/fragments/RecentsSettings.java b/src/com/cherish/settings/fragments/RecentsSettings.java index 0b8b9eb..f7380a3 100644 --- a/src/com/cherish/settings/fragments/RecentsSettings.java +++ b/src/com/cherish/settings/fragments/RecentsSettings.java @@ -26,12 +26,6 @@ import com.android.settings.SettingsPreferenceFragment; public class RecentsSettings extends SettingsPreferenceFragment implements OnPreferenceChangeListener { - private static final String PREF_STOCK_RECENTS_CATEGORY = "stock_recents_category"; - private static final String PREF_ALTERNATIVE_RECENTS_CATEGORY = "alternative_recents_category"; - private static final String PREF_SWIPE_UP_ENABLED = "swipe_up_enabled_warning"; - - private PreferenceCategory mStockRecentsCategory; - private PreferenceCategory mAlternativeRecentsCategory; private Context mContext; @Override @@ -41,78 +35,8 @@ public class RecentsSettings extends SettingsPreferenceFragment implements addPreferencesFromResource(R.xml.cherish_settings_recents); ContentResolver resolver = getActivity().getContentResolver(); - - mStockRecentsCategory = (PreferenceCategory) findPreference(PREF_STOCK_RECENTS_CATEGORY); - mAlternativeRecentsCategory = - (PreferenceCategory) findPreference(PREF_ALTERNATIVE_RECENTS_CATEGORY); - - // Alternative recents en-/disabling - Preference.OnPreferenceChangeListener alternativeRecentsChangeListener = - new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - updateDependencies(preference, (Boolean) newValue); - return true; - } - }; - for (int i = 0; i < mAlternativeRecentsCategory.getPreferenceCount(); i++) { - Preference preference = mAlternativeRecentsCategory.getPreference(i); - if (preference instanceof SystemSettingMasterSwitchPreference) { - preference.setOnPreferenceChangeListener(alternativeRecentsChangeListener); - } - } - - updateDependencies(); - - // Warning for alternative recents when gesture navigation is enabled, - // which directly controls quickstep (launcher) recents. - final int navigationMode = getActivity().getResources() - .getInteger(com.android.internal.R.integer.config_navBarInteractionMode); - // config_navBarInteractionMode: - // 0: 3 button mode (supports slim recents) - // 1: 2 button mode (currently does not support alternative recents) - // 2: gesture only (currently does not support alternative recents) - if (navigationMode != 0) { - for (int i = 0; i < mAlternativeRecentsCategory.getPreferenceCount(); i++) { - Preference preference = mAlternativeRecentsCategory.getPreference(i); - if (PREF_SWIPE_UP_ENABLED.equals(preference.getKey())) { - // We want to have that one enabled - continue; - } - preference.setEnabled(false); - } - } else { - mAlternativeRecentsCategory.removePreference(findPreference(PREF_SWIPE_UP_ENABLED)); - } - } - - private void updateDependencies() { - updateDependencies(null, null); - } - - private void updateDependencies(Preference updatedPreference, Boolean newValue) { - // Disable stock recents category if alternative enabled - boolean alternativeRecentsEnabled = newValue != null && newValue; - if (!alternativeRecentsEnabled) { - for (int i = 0; i < mAlternativeRecentsCategory.getPreferenceCount(); i++) { - Preference preference = mAlternativeRecentsCategory.getPreference(i); - if (preference == updatedPreference) { - // Already used newValue - continue; - } - if (preference instanceof SystemSettingMasterSwitchPreference - && ((SystemSettingMasterSwitchPreference) preference).isChecked()) { - alternativeRecentsEnabled = true; - break; - } - } - } - if (mStockRecentsCategory != null) { - mStockRecentsCategory.setEnabled(!alternativeRecentsEnabled); - } - - } - + } + @Override public boolean onPreferenceChange(Preference preference, Object objValue) { @@ -124,4 +48,4 @@ public class RecentsSettings extends SettingsPreferenceFragment implements public int getMetricsCategory() { return MetricsProto.MetricsEvent.CHERISH_SETTINGS; } -} +} \ No newline at end of file diff --git a/src/com/cherish/settings/fragments/SlimRecentAppSidebar.java b/src/com/cherish/settings/fragments/SlimRecentAppSidebar.java deleted file mode 100644 index 850c394..0000000 --- a/src/com/cherish/settings/fragments/SlimRecentAppSidebar.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2018 Havoc-OS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.cherish.settings.fragments; - -import android.os.Bundle; - -import com.android.internal.logging.nano.MetricsProto; -import com.android.settings.SettingsPreferenceFragment; - -import com.android.settings.R; - -public class SlimRecentAppSidebar extends SettingsPreferenceFragment { - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.slim_recent_app_sidebar); - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } -} diff --git a/src/com/cherish/settings/fragments/SlimRecentAppSidebarStyle.java b/src/com/cherish/settings/fragments/SlimRecentAppSidebarStyle.java deleted file mode 100644 index fd4029d..0000000 --- a/src/com/cherish/settings/fragments/SlimRecentAppSidebarStyle.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2018 Havoc-OS - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.cherish.settings.fragments; - -import android.os.Bundle; -import android.os.UserHandle; -import android.provider.Settings; -import androidx.preference.Preference; - -import com.android.internal.logging.nano.MetricsProto; -import com.android.settings.SettingsPreferenceFragment; - -import com.android.settings.R; - -import net.margaritov.preference.colorpicker.ColorPickerPreference; - -public class SlimRecentAppSidebarStyle extends SettingsPreferenceFragment - implements Preference.OnPreferenceChangeListener { - - private static final String RECENT_APP_SIDEBAR_TEXT_COLOR = "recent_app_sidebar_text_color"; - private static final String RECENT_APP_SIDEBAR_BG_COLOR = "recent_app_sidebar_bg_color"; - - private ColorPickerPreference mRecentSidebarTextColor; - private ColorPickerPreference mRecentSidebarBgColor; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.slim_recent_app_sidebar_style); - - mRecentSidebarTextColor = (ColorPickerPreference) findPreference(RECENT_APP_SIDEBAR_TEXT_COLOR); - mRecentSidebarTextColor.setOnPreferenceChangeListener(this); - final int intColor = Settings.System.getInt(getContext().getContentResolver(), - Settings.System.RECENT_APP_SIDEBAR_TEXT_COLOR, 0xffffffff); - String hexColor = String.format("#%08x", (0xffffffff & intColor)); - if (hexColor.equals("#ffffffff")) { - mRecentSidebarTextColor.setSummary(R.string.default_string); - } else { - mRecentSidebarTextColor.setSummary(hexColor); - } - mRecentSidebarTextColor.setNewPreviewColor(intColor); - - mRecentSidebarBgColor = (ColorPickerPreference) findPreference(RECENT_APP_SIDEBAR_BG_COLOR); - mRecentSidebarBgColor.setOnPreferenceChangeListener(this); - final int intColorCard = Settings.System.getInt(getContext().getContentResolver(), - Settings.System.RECENT_APP_SIDEBAR_BG_COLOR, 0x00ffffff); - String hexColorCard = String.format("#%08x", (0x00ffffff & intColorCard)); - if (hexColorCard.equals("#00ffffff")) { - mRecentSidebarBgColor.setSummary(R.string.default_string); - } else { - mRecentSidebarBgColor.setSummary(hexColorCard); - } - mRecentSidebarBgColor.setNewPreviewColor(intColorCard); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (preference == mRecentSidebarTextColor) { - String hex = ColorPickerPreference.convertToARGB( - Integer.valueOf(String.valueOf(newValue))); - if (hex.equals("#ffffffff")) { - preference.setSummary(R.string.default_string); - } else { - preference.setSummary(hex); - } - int intHex = ColorPickerPreference.convertToColorInt(hex); - Settings.System.putIntForUser(getContext().getContentResolver(), - Settings.System.RECENT_APP_SIDEBAR_TEXT_COLOR, - intHex, UserHandle.USER_CURRENT); - return true; - } else if (preference == mRecentSidebarBgColor) { - String hex = ColorPickerPreference.convertToARGB( - Integer.valueOf(String.valueOf(newValue))); - if (hex.equals("#00ffffff")) { - preference.setSummary(R.string.default_string); - } else { - preference.setSummary(hex); - } - int intHex = ColorPickerPreference.convertToColorInt(hex); - Settings.System.putIntForUser(getContext().getContentResolver(), - Settings.System.RECENT_APP_SIDEBAR_BG_COLOR, - intHex, UserHandle.USER_CURRENT); - return true; - } - return false; - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } -} diff --git a/src/com/cherish/settings/fragments/SlimRecents.java b/src/com/cherish/settings/fragments/SlimRecents.java deleted file mode 100644 index e795ab5..0000000 --- a/src/com/cherish/settings/fragments/SlimRecents.java +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Copyright (C) 2017 AICP - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package com.cherish.settings.fragments; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.content.Context; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.content.res.Resources; -import androidx.preference.Preference; -import androidx.preference.SwitchPreference; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.os.UserHandle; -import android.provider.Settings; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.BaseAdapter; -import android.widget.ImageView; -import android.widget.ListView; -import android.widget.RadioButton; -import android.widget.TextView; -import android.widget.Toast; - -import com.android.internal.logging.nano.MetricsProto; -import com.android.settings.SettingsPreferenceFragment; -import com.android.settings.R; - -import net.margaritov.preference.colorpicker.ColorPickerPreference; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; - -public class SlimRecents extends SettingsPreferenceFragment - implements Preference.OnPreferenceChangeListener, DialogInterface.OnDismissListener { - - private static final String RECENT_PANEL_LEFTY_MODE = "recent_panel_lefty_mode"; - private static final String RECENT_ICON_PACK = "slim_icon_pack"; - private static final String RECENT_PANEL_BG_COLOR = "recent_panel_bg_color"; - private static final String RECENT_CARD_BG_COLOR = "recent_card_bg_color"; - private static final String SLIM_MEM_BAR_COLOR = "slim_mem_bar_color"; - private static final String SLIM_MEM_TEXT_COLOR = "slim_mem_text_color"; - - private SwitchPreference mRecentPanelLeftyMode; - private Preference mIconPack; - private ColorPickerPreference mRecentPanelBgColor; - private ColorPickerPreference mRecentCardBgColor; - private ColorPickerPreference mMemBarColor; - private ColorPickerPreference mMemTextColor; - - // Icon pack - private final static String[] sSupportedActions = new String[] { - "org.adw.launcher.THEMES", - "com.gau.go.launcherex.theme" - }; - private static final String[] sSupportedCategories = new String[] { - "com.fede.launcher.THEME_ICONPACK", - "com.anddoes.launcher.THEME", - "com.teslacoilsw.launcher.THEME" - }; - private AlertDialog mDialog; - private ListView mListView; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.slim_recents); - - mRecentPanelLeftyMode = (SwitchPreference) findPreference(RECENT_PANEL_LEFTY_MODE); - mRecentPanelLeftyMode.setOnPreferenceChangeListener(this); - mIconPack = findPreference(RECENT_ICON_PACK); - - // Recent panel background color - mRecentPanelBgColor = (ColorPickerPreference) findPreference(RECENT_PANEL_BG_COLOR); - mRecentPanelBgColor.setOnPreferenceChangeListener(this); - final int intColor = Settings.System.getInt(getContext().getContentResolver(), - Settings.System.RECENT_PANEL_BG_COLOR, 0x00ffffff); - String hexColor = String.format("#%08x", (0x00ffffff & intColor)); - if (hexColor.equals("#00ffffff")) { - mRecentPanelBgColor.setSummary(R.string.default_string); - } else { - mRecentPanelBgColor.setSummary(hexColor); - } - mRecentPanelBgColor.setNewPreviewColor(intColor); - - // Recent card background color - mRecentCardBgColor = (ColorPickerPreference) findPreference(RECENT_CARD_BG_COLOR); - mRecentCardBgColor.setOnPreferenceChangeListener(this); - final int intColorCard = Settings.System.getInt(getContext().getContentResolver(), - Settings.System.RECENT_CARD_BG_COLOR, 0x00ffffff); - String hexColorCard = String.format("#%08x", (0x00ffffff & intColorCard)); - if (hexColorCard.equals("#00ffffff")) { - mRecentCardBgColor.setSummary(R.string.default_auto_string); - } else { - mRecentCardBgColor.setSummary(hexColorCard); - } - mRecentCardBgColor.setNewPreviewColor(intColorCard); - - mMemBarColor = (ColorPickerPreference) findPreference(SLIM_MEM_BAR_COLOR); - mMemBarColor.setOnPreferenceChangeListener(this); - final int intMemColor = Settings.System.getInt(getContext().getContentResolver(), - Settings.System.SLIM_MEM_BAR_COLOR, 0xffffffff); - String hexMemColor = String.format("#%08x", (0xffffffff & intMemColor)); - if (hexMemColor.equals("#ffffffff")) { - mMemBarColor.setSummary(R.string.default_string); - } else { - mMemBarColor.setSummary(hexMemColor); - } - mMemBarColor.setNewPreviewColor(intMemColor); - - mMemTextColor = (ColorPickerPreference) findPreference(SLIM_MEM_TEXT_COLOR); - mMemTextColor.setOnPreferenceChangeListener(this); - final int intTextColor = Settings.System.getInt(getContext().getContentResolver(), - Settings.System.SLIM_MEM_TEXT_COLOR, 0xffffffff); - String hexTextColor = String.format("#%08x", (0xffffffff & intTextColor)); - if (hexTextColor.equals("#ffffffff")) { - mMemTextColor.setSummary(R.string.default_string); - } else { - mMemTextColor.setSummary(hexTextColor); - } - mMemTextColor.setNewPreviewColor(intTextColor); - } - - @Override - public void onResume() { - super.onResume(); - - boolean recentLeftyMode = Settings.System.getInt(getContext().getContentResolver(), - Settings.System.RECENT_PANEL_GRAVITY, Gravity.END) == Gravity.START; - mRecentPanelLeftyMode.setChecked(recentLeftyMode); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (preference == mRecentPanelLeftyMode) { - Settings.System.putInt(getContext().getContentResolver(), - Settings.System.RECENT_PANEL_GRAVITY, - ((Boolean) newValue) ? Gravity.START : Gravity.END); - return true; - } else if (preference == mRecentPanelBgColor) { - String hex = ColorPickerPreference.convertToARGB( - Integer.valueOf(String.valueOf(newValue))); - if (hex.equals("#00ffffff")) { - preference.setSummary(R.string.default_string); - } else { - preference.setSummary(hex); - } - int intHex = ColorPickerPreference.convertToColorInt(hex); - Settings.System.putIntForUser(getContext().getContentResolver(), - Settings.System.RECENT_PANEL_BG_COLOR, - intHex, UserHandle.USER_CURRENT); - return true; - } else if (preference == mRecentCardBgColor) { - String hex = ColorPickerPreference.convertToARGB( - Integer.valueOf(String.valueOf(newValue))); - if (hex.equals("#00ffffff")) { - preference.setSummary(R.string.default_auto_string); - } else { - preference.setSummary(hex); - } - int intHex = ColorPickerPreference.convertToColorInt(hex); - Settings.System.putIntForUser(getContext().getContentResolver(), - Settings.System.RECENT_CARD_BG_COLOR, - intHex, UserHandle.USER_CURRENT); - return true; - } else if (preference == mMemBarColor) { - String hex = ColorPickerPreference.convertToARGB( - Integer.valueOf(String.valueOf(newValue))); - if (hex.equals("#ffffffff")) { - preference.setSummary(R.string.default_string); - } else { - preference.setSummary(hex); - } - int intHex = ColorPickerPreference.convertToColorInt(hex); - Settings.System.putIntForUser(getContext().getContentResolver(), - Settings.System.SLIM_MEM_BAR_COLOR, - intHex, UserHandle.USER_CURRENT); - return true; - } else if (preference == mMemTextColor) { - String hex = ColorPickerPreference.convertToARGB( - Integer.valueOf(String.valueOf(newValue))); - if (hex.equals("#ffffffff")) { - preference.setSummary(R.string.default_string); - } else { - preference.setSummary(hex); - } - int intHex = ColorPickerPreference.convertToColorInt(hex); - Settings.System.putIntForUser(getContext().getContentResolver(), - Settings.System.SLIM_MEM_TEXT_COLOR, - intHex, UserHandle.USER_CURRENT); - return true; - } - return false; - } - - @Override - public boolean onPreferenceTreeClick(Preference preference) { - if (preference == mIconPack) { - pickIconPack(getContext()); - return true; - } else { - return super.onPreferenceTreeClick(preference); - } - } - - /** Slim Recents Icon Pack Dialog **/ - private void pickIconPack(final Context context) { - if (mDialog != null) { - return; - } - Map supportedPackages = getSupportedPackages(context); - if (supportedPackages.isEmpty()) { - Toast.makeText(context, R.string.no_iconpacks_summary, Toast.LENGTH_SHORT).show(); - return; - } - AlertDialog.Builder builder = new AlertDialog.Builder(context) - .setTitle(R.string.dialog_pick_iconpack_title) - .setOnDismissListener(this) - .setNegativeButton(R.string.cancel, null) - .setView(createDialogView(context, supportedPackages)); - mDialog = builder.show(); - } - - private View createDialogView(final Context context, Map supportedPackages) { - final LayoutInflater inflater = (LayoutInflater) context - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - final View view = inflater.inflate(R.layout.dialog_iconpack, null); - final IconAdapter adapter = new IconAdapter(context, supportedPackages); - - mListView = (ListView) view.findViewById(R.id.iconpack_list); - mListView.setAdapter(adapter); - mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, - int position, long id) { - if (adapter.isCurrentIconPack(position)) { - return; - } - String selectedPackage = adapter.getItem(position); - Settings.System.putString(getContext().getContentResolver(), - Settings.System.SLIM_RECENTS_ICON_PACK, selectedPackage); - mDialog.dismiss(); - } - }); - - return view; - } - - @Override - public void onDismiss(DialogInterface dialog) { - if (mDialog != null) { - mDialog = null; - } - } - - private static class IconAdapter extends BaseAdapter { - ArrayList mSupportedPackages; - LayoutInflater mLayoutInflater; - String mCurrentIconPack; - int mCurrentIconPackPosition = -1; - - IconAdapter(Context ctx, Map supportedPackages) { - mLayoutInflater = LayoutInflater.from(ctx); - mSupportedPackages = new ArrayList(supportedPackages.values()); - Collections.sort(mSupportedPackages, new Comparator() { - @Override - public int compare(IconPackInfo lhs, IconPackInfo rhs) { - return lhs.label.toString().compareToIgnoreCase(rhs.label.toString()); - } - }); - - Resources res = ctx.getResources(); - String defaultLabel = res.getString(R.string.default_iconpack_title); - Drawable icon = res.getDrawable(android.R.drawable.sym_def_app_icon); - mSupportedPackages.add(0, new IconPackInfo(defaultLabel, icon, "")); - mCurrentIconPack = Settings.System.getString(ctx.getContentResolver(), - Settings.System.SLIM_RECENTS_ICON_PACK); - } - - @Override - public int getCount() { - return mSupportedPackages.size(); - } - - @Override - public String getItem(int position) { - return (String) mSupportedPackages.get(position).packageName; - } - - @Override - public long getItemId(int position) { - return 0; - } - - public boolean isCurrentIconPack(int position) { - return mCurrentIconPackPosition == position; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - if (convertView == null) { - convertView = mLayoutInflater.inflate(R.layout.iconpack_view_radio, null); - } - IconPackInfo info = mSupportedPackages.get(position); - TextView txtView = (TextView) convertView.findViewById(R.id.title); - txtView.setText(info.label); - ImageView imgView = (ImageView) convertView.findViewById(R.id.icon); - imgView.setImageDrawable(info.icon); - RadioButton radioButton = (RadioButton) convertView.findViewById(R.id.radio); - boolean isCurrentIconPack = info.packageName.equals(mCurrentIconPack); - radioButton.setChecked(isCurrentIconPack); - if (isCurrentIconPack) { - mCurrentIconPackPosition = position; - } - return convertView; - } - } - - private Map getSupportedPackages(Context context) { - Intent i = new Intent(); - Map packages = new HashMap(); - PackageManager packageManager = context.getPackageManager(); - for (String action : sSupportedActions) { - i.setAction(action); - for (ResolveInfo r : packageManager.queryIntentActivities(i, 0)) { - IconPackInfo info = new IconPackInfo(r, packageManager); - packages.put(r.activityInfo.packageName, info); - } - } - i = new Intent(Intent.ACTION_MAIN); - for (String category : sSupportedCategories) { - i.addCategory(category); - for (ResolveInfo r : packageManager.queryIntentActivities(i, 0)) { - IconPackInfo info = new IconPackInfo(r, packageManager); - packages.put(r.activityInfo.packageName, info); - } - i.removeCategory(category); - } - return packages; - } - - private static class IconPackInfo { - String packageName; - CharSequence label; - Drawable icon; - - IconPackInfo(ResolveInfo r, PackageManager packageManager) { - packageName = r.activityInfo.packageName; - icon = r.loadIcon(packageManager); - label = r.loadLabel(packageManager); - } - - IconPackInfo(){ - } - - public IconPackInfo(String label, Drawable icon, String packageName) { - this.label = label; - this.icon = icon; - this.packageName = packageName; - } - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } -} diff --git a/src/com/cherish/settings/fragments/SlimRecentsBlacklist.java b/src/com/cherish/settings/fragments/SlimRecentsBlacklist.java deleted file mode 100644 index 4b75820..0000000 --- a/src/com/cherish/settings/fragments/SlimRecentsBlacklist.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (C) 2017 The ABC rom - * Copyright (C) 2017 AICP - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cherish.settings.fragments; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.content.ContentResolver; -import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnClickListener; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; -import android.os.Bundle; -import androidx.preference.Preference; -import androidx.preference.PreferenceGroup; -import androidx.preference.PreferenceScreen; -import android.provider.Settings; -import android.text.TextUtils; -import android.view.View; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.RadioButton; -import android.widget.ListView; - -import com.android.internal.logging.nano.MetricsProto; -import com.android.settings.SettingsPreferenceFragment; -import com.android.settings.R; -import com.cherish.settings.preferences.PackageListAdapter; -import com.cherish.settings.preferences.PackageListAdapter.PackageItem; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; -import java.util.List; - -public class SlimRecentsBlacklist extends SettingsPreferenceFragment implements - Preference.OnPreferenceClickListener { - - private static final String TAG = "SlimRecentsBlacklist"; - - private static final int DIALOG_BLACKLIST_APPS = 1; - - private PackageListAdapter mPackageAdapter; - private PackageManager mPackageManager; - private PreferenceGroup mBlacklistPrefList; - private Preference mAddBlacklistPref; - private String mBlacklistPackageList; - private Map mBlacklistPackages; - - private AlertDialog mDialog; - private ListView mListView; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - addPreferencesFromResource(R.xml.slim_recents_blacklist); - - initializeAllPreferences(); - } - - @Override - public Dialog onCreateDialog(int dialogId) { - switch (dialogId) { - case DIALOG_BLACKLIST_APPS: { - Dialog dialog; - AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); - final ListView list = new ListView(getActivity()); - list.setAdapter(mPackageAdapter); - alertDialog.setTitle(R.string.profile_choose_app); - alertDialog.setView(list); - dialog = alertDialog.create(); - list.setOnItemClickListener(new OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - // Add empty application definition, the user will be able to edit it later - PackageItem info = (PackageItem) parent.getItemAtPosition(position); - addCustomApplicationPref(info.packageName, mBlacklistPackages); - dialog.cancel(); - } - }); - return dialog; - } - } - return super.onCreateDialog(dialogId); - } - - @Override - public int getDialogMetricsCategory(int dialogId) { - switch (dialogId) { - case DIALOG_BLACKLIST_APPS: - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - default: - return 0; - } - } - - @Override - public int getMetricsCategory() { - return MetricsProto.MetricsEvent.CHERISH_SETTINGS; - } - - @Override - public void onResume() { - super.onResume(); - refreshCustomApplicationPrefs(); - } - - private void initializeAllPreferences() { - mPackageManager = getActivity().getPackageManager(); - mPackageAdapter = new PackageListAdapter(getActivity()); - //mBlacklistPrefList = (PreferenceGroup) findPreference("blacklist_applications"); - mBlacklistPrefList = getPreferenceScreen(); - mBlacklistPrefList.setOrderingAsAdded(false); - mBlacklistPackages = new HashMap(); - mAddBlacklistPref = findPreference("add_blacklist_packages"); - mAddBlacklistPref.setOnPreferenceClickListener(this); - } - - @Override - public boolean onPreferenceClick(Preference preference) { - if (preference == mAddBlacklistPref) { - showDialog(DIALOG_BLACKLIST_APPS); - } else { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) - .setTitle(R.string.dialog_delete_title) - .setMessage(R.string.dialog_delete_message) - //.setIconAttribute(android.R.attr.alertDialogIcon) - .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - removeApplicationPref(preference.getKey(), mBlacklistPackages); - } - }) - .setNegativeButton(android.R.string.cancel, null); - - builder.show(); - } - return true; - } - - /** - * Application class - */ - private static class Package { - public String name; - /** - * Stores all the application values in one call - * @param name - */ - public Package(String name) { - this.name = name; - } - - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append(name); - return builder.toString(); - } - - public static Package fromString(String value) { - if (TextUtils.isEmpty(value)) { - return null; - } - - try { - Package item = new Package(value); - return item; - } catch (NumberFormatException e) { - return null; - } - } - - }; - - private void refreshCustomApplicationPrefs() { - if (!parsePackageList()) { - return; - } - - // Add the Application Preferences - if (mBlacklistPrefList != null) { - mBlacklistPrefList.removeAll(); - - for (Package pkg : mBlacklistPackages.values()) { - try { - Preference pref = createPreferenceFromInfo(pkg); - mBlacklistPrefList.addPreference(pref); - } catch (PackageManager.NameNotFoundException e) { - // Do nothing - } - } - } - - // Keep these at the top - mAddBlacklistPref.setOrder(0); - // Add 'add' options - mBlacklistPrefList.addPreference(mAddBlacklistPref); - } - - private void addCustomApplicationPref(String packageName, Map map) { - Package pkg = map.get(packageName); - if (pkg == null) { - pkg = new Package(packageName); - map.put(packageName, pkg); - savePackageList(false, map); - refreshCustomApplicationPrefs(); - } - } - - private Preference createPreferenceFromInfo(Package pkg) - throws PackageManager.NameNotFoundException { - PackageInfo info = mPackageManager.getPackageInfo(pkg.name, - PackageManager.GET_META_DATA); - Preference pref = - new Preference(getActivity()); - - pref.setKey(pkg.name); - pref.setTitle(info.applicationInfo.loadLabel(mPackageManager)); - pref.setIcon(info.applicationInfo.loadIcon(mPackageManager)); - pref.setPersistent(false); - pref.setOnPreferenceClickListener(this); - return pref; - } - - private void removeApplicationPref(String packageName, Map map) { - if (map.remove(packageName) != null) { - savePackageList(false, map); - refreshCustomApplicationPrefs(); - } - } - - private boolean parsePackageList() { - boolean parsed = false; - final String blacklistString = Settings.System.getString(getActivity().getContentResolver(), - Settings.System.SLIM_RECENTS_BLACKLIST_VALUES); - - if (!TextUtils.equals(mBlacklistPackageList, blacklistString)) { - mBlacklistPackageList = blacklistString; - mBlacklistPackages.clear(); - parseAndAddToMap(blacklistString, mBlacklistPackages); - parsed = true; - } - - return parsed; - } - - private void parseAndAddToMap(String baseString, Map map) { - if (baseString == null) { - return; - } - - final String[] array = TextUtils.split(baseString, "\\|"); - for (String item : array) { - if (TextUtils.isEmpty(item)) { - continue; - } - Package pkg = Package.fromString(item); - map.put(pkg.name, pkg); - } - } - - private void savePackageList(boolean preferencesUpdated, Map map) { - String setting = Settings.System.SLIM_RECENTS_BLACKLIST_VALUES; - - List settings = new ArrayList(); - for (Package app : map.values()) { - settings.add(app.toString()); - } - final String value = TextUtils.join("|", settings); - if (preferencesUpdated) { - mBlacklistPackageList = value; - } - Settings.System.putString(getActivity().getContentResolver(), - setting, value); - } -} diff --git a/src/com/cherish/settings/fragments/StatusBarSettings.java b/src/com/cherish/settings/fragments/StatusBarSettings.java index 85c3d44..21d3f73 100644 --- a/src/com/cherish/settings/fragments/StatusBarSettings.java +++ b/src/com/cherish/settings/fragments/StatusBarSettings.java @@ -39,28 +39,6 @@ import java.util.Collections; public class StatusBarSettings extends SettingsPreferenceFragment implements OnPreferenceChangeListener { - private static final String STATUS_BAR_CLOCK = "status_bar_clock"; - private static final String STATUS_BAR_SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent"; - private static final String STATUS_BAR_BATTERY_TEXT_CHARGING = "status_bar_battery_text_charging"; - private static final String STATUS_BAR_BATTERY_CHARGING_BOLT = "status_bar_battery_charging_bolt"; - private static final String BATTERY_PERCENTAGE_HIDDEN = "0"; - private static final String STATUS_BAR_BATTERY_STYLE = "status_bar_battery_style"; - private static final String BATTERY_BAR = "battery_bar_settings"; - - private static final int BATTERY_STYLE_Q = 0; - private static final int BATTERY_STYLE_DOTTED_CIRCLE = 1; - private static final int BATTERY_STYLE_CIRCLE = 2; - private static final int BATTERY_STYLE_TEXT = 3; - private static final int BATTERY_STYLE_HIDDEN = 4; - - private SystemSettingMasterSwitchPreference mStatusBarClockShow; - private ListPreference mBatteryPercent; - private ListPreference mBatteryStyle; - private SwitchPreference mBatteryCharging; - private CustomSeekBarPreference mThreshold; - private SystemSettingSwitchPreference mNetMonitor; - private SwitchPreference mBatteryBolt; - private SystemSettingMasterSwitchPreference mBatteryBar; @Override public void onCreate(Bundle icicle) { @@ -71,119 +49,14 @@ public class StatusBarSettings extends SettingsPreferenceFragment implements ContentResolver resolver = getActivity().getContentResolver(); PreferenceScreen prefSet = getPreferenceScreen(); - - mStatusBarClockShow = (SystemSettingMasterSwitchPreference) findPreference(STATUS_BAR_CLOCK); - mStatusBarClockShow.setChecked((Settings.System.getInt(resolver, - Settings.System.STATUS_BAR_CLOCK, 1) == 1)); - mStatusBarClockShow.setOnPreferenceChangeListener(this); - - mBatteryPercent = (ListPreference) findPreference(STATUS_BAR_SHOW_BATTERY_PERCENT); - mBatteryCharging = (SwitchPreference) findPreference(STATUS_BAR_BATTERY_TEXT_CHARGING); - mBatteryCharging.setOnPreferenceChangeListener(this); - - mBatteryBolt = (SwitchPreference) findPreference(STATUS_BAR_BATTERY_CHARGING_BOLT); - mBatteryBolt.setOnPreferenceChangeListener(this); - - mBatteryStyle = (ListPreference) findPreference(STATUS_BAR_BATTERY_STYLE); - int batterystyle = Settings.System.getInt(resolver, - Settings.System.STATUS_BAR_BATTERY_STYLE, BATTERY_STYLE_Q); - mBatteryStyle.setOnPreferenceChangeListener(this); - - updateBatteryOptions(batterystyle); - - boolean isNetMonitorEnabled = Settings.System.getIntForUser(resolver, - Settings.System.NETWORK_TRAFFIC_STATE, 1, UserHandle.USER_CURRENT) == 1; - mNetMonitor = (SystemSettingSwitchPreference) findPreference("network_traffic_state"); - mNetMonitor.setChecked(isNetMonitorEnabled); - mNetMonitor.setOnPreferenceChangeListener(this); - - int value = Settings.System.getIntForUser(resolver, - Settings.System.NETWORK_TRAFFIC_AUTOHIDE_THRESHOLD, 1, UserHandle.USER_CURRENT); - mThreshold = (CustomSeekBarPreference) findPreference("network_traffic_autohide_threshold"); - mThreshold.setValue(value); - mThreshold.setOnPreferenceChangeListener(this); - mThreshold.setEnabled(isNetMonitorEnabled); - - mBatteryBar = (SystemSettingMasterSwitchPreference) - findPreference(BATTERY_BAR); - mBatteryBar.setOnPreferenceChangeListener(this); - boolean enabled = Settings.System.getInt(resolver, - Settings.System.BATTERY_BAR_LOCATION, 0) != 0; - mBatteryBar.setChecked(enabled); } @Override public boolean onPreferenceChange(Preference preference, Object objValue) { - if (preference == mStatusBarClockShow) { - boolean value = (Boolean) objValue; - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.STATUS_BAR_CLOCK, value ? 1 : 0); - return true; - } else if (preference == mBatteryStyle) { - int value = Integer.parseInt((String) objValue); - updateBatteryOptions(value); - return true; - } else if (preference == mNetMonitor) { - boolean value = (Boolean) objValue; - Settings.System.putIntForUser(getActivity().getContentResolver(), - Settings.System.NETWORK_TRAFFIC_STATE, value ? 1 : 0, - UserHandle.USER_CURRENT); - mNetMonitor.setChecked(value); - mThreshold.setEnabled(value); - return true; - } else if (preference == mThreshold) { - int val = (Integer) objValue; - Settings.System.putIntForUser(getContentResolver(), - Settings.System.NETWORK_TRAFFIC_AUTOHIDE_THRESHOLD, val, - UserHandle.USER_CURRENT); - return true; - } else if (preference == mBatteryCharging) { - boolean enabled = (Boolean) objValue; - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.STATUS_BAR_BATTERY_TEXT_CHARGING, - enabled ? 1 : 0); - updateBoltEnablement(); - return true; - } else if (preference == mBatteryBolt) { - boolean enabled = (Boolean) objValue; - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.STATUS_BAR_BATTERY_CHARGING_BOLT, - enabled ? 1 : 0); - return true; - } else if (preference == mBatteryBar) { - boolean enabled = (boolean) objValue; - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.BATTERY_BAR_LOCATION, enabled ? 1 : 0); - return true; - } return false; } - private void updateBatteryOptions(int batterystyle) { - boolean enabled = batterystyle != BATTERY_STYLE_TEXT && batterystyle != BATTERY_STYLE_HIDDEN; - if (batterystyle == BATTERY_STYLE_HIDDEN) { - mBatteryPercent.setValue(BATTERY_PERCENTAGE_HIDDEN); - mBatteryPercent.setSummary(mBatteryPercent.getEntry()); - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0); - } - mBatteryCharging.setEnabled(enabled); - mBatteryPercent.setEnabled(enabled); - updateBoltEnablement(); - } - - private void updateBoltEnablement() { - int batteryStyle = Settings.System.getInt(getActivity().getContentResolver(), - Settings.System.STATUS_BAR_BATTERY_STYLE, BATTERY_STYLE_Q); - boolean precentOnCharging = Settings.System.getInt(getActivity().getContentResolver(), - Settings.System.STATUS_BAR_BATTERY_TEXT_CHARGING, 1) == 1; - boolean textEnabled = batteryStyle == BATTERY_STYLE_TEXT || - (batteryStyle == BATTERY_STYLE_HIDDEN && precentOnCharging); - mBatteryBolt.setEnabled(textEnabled); - - } - @Override public int getMetricsCategory() { return MetricsProto.MetricsEvent.CHERISH_SETTINGS; diff --git a/src/com/cherish/settings/fragments/ThemeSettings.java b/src/com/cherish/settings/fragments/ThemeSettings.java index 50b3c1f..4120f6e 100644 --- a/src/com/cherish/settings/fragments/ThemeSettings.java +++ b/src/com/cherish/settings/fragments/ThemeSettings.java @@ -43,33 +43,6 @@ import net.margaritov.preference.colorpicker.ColorPickerPreference; public class ThemeSettings extends SettingsPreferenceFragment implements OnPreferenceChangeListener { - - private static final String PREF_THEME_SWITCH = "theme_switch"; - private static final String SYSUI_ROUNDED_SIZE = "sysui_rounded_size"; - private static final String SYSUI_ROUNDED_CONTENT_PADDING = "sysui_rounded_content_padding"; - private static final String SYSUI_STATUS_BAR_PADDING = "sysui_status_bar_padding"; - private static final String SYSUI_ROUNDED_FWVALS = "sysui_rounded_fwvals"; - private static final String SWITCH_STYLE = "switch_style"; - private static final String QS_TILE_STYLE = "qs_tile_style"; - private static final String QS_HEADER_STYLE = "qs_header_style"; - private static final String BRIGHTNESS_SLIDER_STYLE = "brightness_slider_style"; - private static final String NAVBAR_STYLE = "navbar_style"; - - private static final String UI_STYLE = "ui_style"; - - private UiModeManager mUiModeManager; - private IOverlayManager mOverlayService; - private ListPreference mThemeSwitch; - private CustomSeekBarPreference mCornerRadius; - private CustomSeekBarPreference mContentPadding; - private CustomSeekBarPreference mSBPadding; - private SwitchPreference mRoundedFwvals; - private ListPreference mSwitchStyle; - private ListPreference mQsTileStyle; - private ListPreference mQsHeaderStyle; - private ListPreference mBrightnessSliderStyle; - private ListPreference mUIStyle; - private ListPreference mNavbarStyle; @Override public void onCreate(Bundle icicle) { @@ -79,377 +52,14 @@ public class ThemeSettings extends SettingsPreferenceFragment implements PreferenceScreen prefScreen = getPreferenceScreen(); ContentResolver resolver = getActivity().getContentResolver(); - - Resources res = null; - Context ctx = getContext(); - float density = Resources.getSystem().getDisplayMetrics().density; - - try { - res = ctx.getPackageManager().getResourcesForApplication("com.android.systemui"); - } catch (NameNotFoundException e) { - e.printStackTrace(); - } - - mUIStyle = (ListPreference) findPreference(UI_STYLE); - int UIStyle = Settings.System.getInt(getActivity().getContentResolver(), - Settings.System.UI_STYLE, 0); - int UIStyleValue = getOverlayPosition(ThemesUtils.UI_THEMES); - if (UIStyleValue != 0) { - mUIStyle.setValue(String.valueOf(UIStyle)); - } - mUIStyle.setSummary(mUIStyle.getEntry()); - mUIStyle.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (preference == mUIStyle) { - String value = (String) newValue; - Settings.System.putInt(getActivity().getContentResolver(), Settings.System.UI_STYLE, Integer.valueOf(value)); - int valueIndex = mUIStyle.findIndexOfValue(value); - mUIStyle.setSummary(mUIStyle.getEntries()[valueIndex]); - String overlayName = getOverlayName(ThemesUtils.UI_THEMES); - if (overlayName != null) { - handleOverlays(overlayName, false, mOverlayService); - } - if (valueIndex > 0) { - handleOverlays(ThemesUtils.UI_THEMES[valueIndex], - true, mOverlayService); - } - return true; - } - return false; - } - }); - - mBrightnessSliderStyle = (ListPreference) findPreference(BRIGHTNESS_SLIDER_STYLE); - int BrightnessSliderStyle = Settings.System.getInt(getActivity().getContentResolver(), - Settings.System.BRIGHTNESS_SLIDER_STYLE, 0); - int BrightnessSliderStyleValue = getOverlayPosition(ThemesUtils.BRIGHTNESS_SLIDER_THEMES); - if (BrightnessSliderStyleValue != 0) { - mBrightnessSliderStyle.setValue(String.valueOf(BrightnessSliderStyle)); - } - mBrightnessSliderStyle.setSummary(mBrightnessSliderStyle.getEntry()); - mBrightnessSliderStyle.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (preference == mBrightnessSliderStyle) { - String value = (String) newValue; - Settings.System.putInt(getActivity().getContentResolver(), Settings.System.BRIGHTNESS_SLIDER_STYLE, Integer.valueOf(value)); - int valueIndex = mBrightnessSliderStyle.findIndexOfValue(value); - mBrightnessSliderStyle.setSummary(mBrightnessSliderStyle.getEntries()[valueIndex]); - String overlayName = getOverlayName(ThemesUtils.BRIGHTNESS_SLIDER_THEMES); - if (overlayName != null) { - handleOverlays(overlayName, false, mOverlayService); - } - if (valueIndex > 0) { - handleOverlays(ThemesUtils.BRIGHTNESS_SLIDER_THEMES[valueIndex], - true, mOverlayService); - } - return true; - } - return false; - } - }); - - mNavbarStyle = (ListPreference) findPreference(NAVBAR_STYLE); - int navbarStyle = Settings.System.getInt(getActivity().getContentResolver(), - Settings.System.NAVBAR_STYLE, 0); - int navbarStyleValue = getOverlayPosition(ThemesUtils.NAVBAR_STYLES); - if (navbarStyleValue != 0) { - mNavbarStyle.setValue(String.valueOf(navbarStyle)); - } - mNavbarStyle.setSummary(mNavbarStyle.getEntry()); - mNavbarStyle.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - if (preference == mNavbarStyle) { - String value = (String) newValue; - Settings.System.putInt(getActivity().getContentResolver(), Settings.System.NAVBAR_STYLE, Integer.valueOf(value)); - int valueIndex = mNavbarStyle.findIndexOfValue(value); - mNavbarStyle.setSummary(mNavbarStyle.getEntries()[valueIndex]); - String overlayName = getOverlayName(ThemesUtils.NAVBAR_STYLES); - if (overlayName != null) { - handleOverlays(overlayName, false, mOverlayService); - } - if (valueIndex > 0) { - handleOverlays(ThemesUtils.NAVBAR_STYLES[valueIndex], - true, mOverlayService); - } - return true; - } - return false; - } - }); - - // Rounded Corner Radius - mCornerRadius = (CustomSeekBarPreference) findPreference(SYSUI_ROUNDED_SIZE); - int resourceIdRadius = (int) ctx.getResources().getDimension(com.android.internal.R.dimen.rounded_corner_radius); - int cornerRadius = Settings.Secure.getIntForUser(ctx.getContentResolver(), Settings.Secure.SYSUI_ROUNDED_SIZE, - ((int) (resourceIdRadius / density)), UserHandle.USER_CURRENT); - mCornerRadius.setValue(cornerRadius); - mCornerRadius.setOnPreferenceChangeListener(this); - - // Rounded Content Padding - mContentPadding = (CustomSeekBarPreference) findPreference(SYSUI_ROUNDED_CONTENT_PADDING); - int resourceIdPadding = res.getIdentifier("com.android.systemui:dimen/rounded_corner_content_padding", null, - null); - int contentPadding = Settings.Secure.getIntForUser(ctx.getContentResolver(), - Settings.Secure.SYSUI_ROUNDED_CONTENT_PADDING, - (int) (res.getDimension(resourceIdPadding) / density), UserHandle.USER_CURRENT); - mContentPadding.setValue(contentPadding); - mContentPadding.setOnPreferenceChangeListener(this); - - // Status Bar Content Padding - mSBPadding = (CustomSeekBarPreference) findPreference(SYSUI_STATUS_BAR_PADDING); - int resourceIdSBPadding = res.getIdentifier("com.android.systemui:dimen/status_bar_extra_padding", null, - null); - int sbPadding = Settings.Secure.getIntForUser(ctx.getContentResolver(), - Settings.Secure.SYSUI_STATUS_BAR_PADDING, - (int) (res.getDimension(resourceIdSBPadding) / density), UserHandle.USER_CURRENT); - mSBPadding.setValue(sbPadding); - mSBPadding.setOnPreferenceChangeListener(this); - - // Rounded use Framework Values - mRoundedFwvals = (SwitchPreference) findPreference(SYSUI_ROUNDED_FWVALS); - mRoundedFwvals.setOnPreferenceChangeListener(this); - - mSwitchStyle = (ListPreference) findPreference(SWITCH_STYLE); - int switchStyle = Settings.System.getInt(resolver, - Settings.System.SWITCH_STYLE, 1); - int switchValueIndex = mSwitchStyle.findIndexOfValue(String.valueOf(switchStyle)); - mSwitchStyle.setValueIndex(switchValueIndex >= 0 ? switchValueIndex : 0); - mSwitchStyle.setSummary(mSwitchStyle.getEntry()); - mSwitchStyle.setOnPreferenceChangeListener(this); - - mQsTileStyle = (ListPreference) findPreference(QS_TILE_STYLE); - int qsTileStyle = Settings.System.getIntForUser(resolver, - Settings.System.QS_TILE_STYLE, 0, UserHandle.USER_CURRENT); - int valueIndex = mQsTileStyle.findIndexOfValue(String.valueOf(qsTileStyle)); - mQsTileStyle.setValueIndex(valueIndex >= 0 ? valueIndex : 0); - mQsTileStyle.setSummary(mQsTileStyle.getEntry()); - mQsTileStyle.setOnPreferenceChangeListener(this); - - mQsHeaderStyle = (ListPreference)findPreference(QS_HEADER_STYLE); - int qsHeaderStyle = Settings.System.getInt(resolver, - Settings.System.QS_HEADER_STYLE, 0); - int qsvalueIndex = mQsHeaderStyle.findIndexOfValue(String.valueOf(qsHeaderStyle)); - mQsHeaderStyle.setValueIndex(qsvalueIndex >= 0 ? qsvalueIndex : 0); - mQsHeaderStyle.setSummary(mQsHeaderStyle.getEntry()); - mQsHeaderStyle.setOnPreferenceChangeListener(this); - - - mOverlayService = IOverlayManager.Stub - .asInterface(ServiceManager.getService(Context.OVERLAY_SERVICE)); - mUiModeManager = getContext().getSystemService(UiModeManager.class); - setupThemeSwitchPref(); } @Override - public boolean onPreferenceChange(Preference preference, Object objValue) { - ContentResolver resolver = getActivity().getContentResolver(); - if (preference == mThemeSwitch) { - String theme_switch = (String) objValue; - final Context context = getContext(); - switch (theme_switch) { - case "1": - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.SOLARIZED_DARK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.BAKED_GREEN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.CHOCO_X); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.PITCH_BLACK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.DARK_GREY); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.MATERIAL_OCEAN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_NO, ThemesUtils.CLEAR_SPRING); - break; - case "2": - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING); - break; - case "3": - handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING); - break; - case "4": - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK); - handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING); - break; - case "5": - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN); - handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING); - break; - case "6": - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X); - handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING); - break; - case "7": - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK); - handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING); - break; - case "8": - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY); - handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING); - break; - case "9": - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.SOLARIZED_DARK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.BAKED_GREEN); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CHOCO_X); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.PITCH_BLACK); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.DARK_GREY); - handleBackgrounds(false, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.MATERIAL_OCEAN); - handleBackgrounds(true, context, UiModeManager.MODE_NIGHT_YES, ThemesUtils.CLEAR_SPRING); - break; - } - try { - mOverlayService.reloadAndroidAssets(UserHandle.USER_CURRENT); - mOverlayService.reloadAssets("com.android.settings", UserHandle.USER_CURRENT); - mOverlayService.reloadAssets("com.android.systemui", UserHandle.USER_CURRENT); - } catch (RemoteException ignored) { - } - } else if (preference == mCornerRadius) { - Settings.Secure.putIntForUser(getContext().getContentResolver(), Settings.Secure.SYSUI_ROUNDED_SIZE, - (int) objValue, UserHandle.USER_CURRENT); - } else if (preference == mContentPadding) { - Settings.Secure.putIntForUser(getContext().getContentResolver(), Settings.Secure.SYSUI_ROUNDED_CONTENT_PADDING, - (int) objValue, UserHandle.USER_CURRENT); - } else if (preference == mSBPadding) { - Settings.Secure.putIntForUser(getContext().getContentResolver(), Settings.Secure.SYSUI_STATUS_BAR_PADDING, - (int) objValue, UserHandle.USER_CURRENT); - } else if (preference == mRoundedFwvals) { - restoreCorners(); - } else if (preference == mSwitchStyle) { - String value = (String) objValue; - Settings.System.putInt(resolver, Settings.System.SWITCH_STYLE, Integer.valueOf(value)); - int valueIndex = mSwitchStyle.findIndexOfValue(value); - mSwitchStyle.setSummary(mSwitchStyle.getEntries()[valueIndex]); - } else if (preference == mQsTileStyle) { - int qsTileStyleValue = Integer.valueOf((String) objValue); - Settings.System.putIntForUser(resolver, - Settings.System.QS_TILE_STYLE, qsTileStyleValue, UserHandle.USER_CURRENT); - mQsTileStyle.setSummary(mQsTileStyle.getEntries()[qsTileStyleValue]); - } else if (preference == mQsHeaderStyle) { - String value = (String) objValue; - Settings.System.putInt(resolver, - Settings.System.QS_HEADER_STYLE, Integer.valueOf(value)); - int newIndex = mQsHeaderStyle.findIndexOfValue(value); - mQsHeaderStyle.setSummary(mQsHeaderStyle.getEntries()[newIndex]); - } - return true; + public boolean onPreferenceChange(Preference preference, Object newValue) { + ContentResolver resolver = getActivity().getContentResolver(); + + return false; } - - private void setupThemeSwitchPref() { - mThemeSwitch = (ListPreference) findPreference(PREF_THEME_SWITCH); - mThemeSwitch.setOnPreferenceChangeListener(this); - if (CherishUtils.isThemeEnabled("com.android.theme.clearspring.system")) { - mThemeSwitch.setValue("9"); - } else if (CherishUtils.isThemeEnabled("com.android.theme.darkgrey.system")) { - mThemeSwitch.setValue("7"); - } else if (CherishUtils.isThemeEnabled("com.android.theme.pitchblack.system")) { - mThemeSwitch.setValue("6"); - } else if (CherishUtils.isThemeEnabled("com.android.theme.materialocean.system")) { - mThemeSwitch.setValue("8"); - } else if (CherishUtils.isThemeEnabled("com.android.theme.chocox.system")) { - mThemeSwitch.setValue("5"); - } else if (CherishUtils.isThemeEnabled("com.android.theme.bakedgreen.system")) { - mThemeSwitch.setValue("4"); - } else if (CherishUtils.isThemeEnabled("com.android.theme.solarizeddark.system")) { - mThemeSwitch.setValue("3"); - } else if (mUiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_YES) { - mThemeSwitch.setValue("2"); - } else { - mThemeSwitch.setValue("1"); - } - } - - private void handleBackgrounds(Boolean state, Context context, int mode, String[] overlays) { - if (context != null) { - Objects.requireNonNull(context.getSystemService(UiModeManager.class)) - .setNightMode(mode); - } - for (int i = 0; i < overlays.length; i++) { - String background = overlays[i]; - try { - mOverlayService.setEnabled(background, state, USER_SYSTEM); - } catch (RemoteException e) { - e.printStackTrace(); - } - } - } - - private void restoreCorners() { - Resources res = null; - float density = Resources.getSystem().getDisplayMetrics().density; - Context ctx = getContext(); - - try { - res = ctx.getPackageManager().getResourcesForApplication("com.android.systemui"); - } catch (NameNotFoundException e) { - e.printStackTrace(); - } - - int resourceIdRadius = (int) ctx.getResources().getDimension(com.android.internal.R.dimen.rounded_corner_radius); - int resourceIdPadding = res.getIdentifier("com.android.systemui:dimen/rounded_corner_content_padding", null, - null); - int resourceIdSBPadding = res.getIdentifier("com.android.systemui:dimen/status_bar_extra_padding", null, - null); - mCornerRadius.setValue((int) (resourceIdRadius / density)); - mContentPadding.setValue((int) (res.getDimension(resourceIdPadding) / density)); - mSBPadding.setValue((int) (res.getDimension(resourceIdSBPadding) / density)); - } - - private String getOverlayName(String[] overlays) { - String overlayName = null; - for (int i = 0; i < overlays.length; i++) { - String overlay = overlays[i]; - if (CherishUtils.isThemeEnabled(overlay)) { - overlayName = overlay; - } - } - return overlayName; - } - - private int getOverlayPosition(String[] overlays) { - int position = -1; - for (int i = 0; i < overlays.length; i++) { - String overlay = overlays[i]; - if (CherishUtils.isThemeEnabled(overlay)) { - position = i; - } - } - return position; - } @Override public int getMetricsCategory() { diff --git a/src/com/cherish/settings/preferences/fragments/BatteryBar.java b/src/com/cherish/settings/preferences/fragments/BatteryBar.java deleted file mode 100644 index bf780ea..0000000 --- a/src/com/cherish/settings/preferences/fragments/BatteryBar.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (C) 2013 Android Open Kang Project - * Copyright (C) 2017 faust93 at monumentum@gmail.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.cherish.settings.fragments; - -import android.content.Context; -import android.content.Intent; -import android.content.ContentResolver; -import android.content.res.Resources; -import android.graphics.Color; -import android.net.ConnectivityManager; -import android.os.Bundle; -import android.os.UserManager; -import android.provider.SearchIndexableResource; -import android.provider.Settings; -import android.text.TextUtils; -import android.util.Log; -import android.view.View; - -import androidx.preference.ListPreference; -import androidx.preference.Preference; -import androidx.preference.PreferenceCategory; -import androidx.preference.PreferenceScreen; -import androidx.preference.Preference.OnPreferenceChangeListener; -import androidx.preference.SwitchPreference; - -import com.android.internal.logging.nano.MetricsProto.MetricsEvent; -import com.android.settings.R; -import com.android.settings.search.BaseSearchIndexProvider; -import com.android.settings.search.Indexable; -import com.android.settings.SettingsPreferenceFragment; -import com.android.settings.Utils; -import com.android.settingslib.search.SearchIndexable; - -import com.cherish.settings.preferences.CustomSeekBarPreference; - -import java.util.ArrayList; -import java.util.List; - -import net.margaritov.preference.colorpicker.ColorPickerPreference; - -@SearchIndexable -public class BatteryBar extends SettingsPreferenceFragment - implements Preference.OnPreferenceChangeListener, Indexable { - - private static final String PREF_BATT_BAR = "battery_bar_list"; - private static final String PREF_BATT_BAR_STYLE = "battery_bar_style"; - private static final String PREF_BATT_BAR_COLOR = "battery_bar_color"; - private static final String PREF_BATT_BAR_CHARGING_COLOR = "battery_bar_charging_color"; - private static final String PREF_BATT_BAR_LOW_COLOR_WARNING = "battery_bar_battery_low_color_warning"; - private static final String PREF_BATT_BAR_USE_GRADIENT_COLOR = "battery_bar_use_gradient_color"; - private static final String PREF_BATT_BAR_LOW_COLOR = "battery_bar_low_color"; - private static final String PREF_BATT_BAR_HIGH_COLOR = "battery_bar_high_color"; - private static final String PREF_BATT_BAR_WIDTH = "battery_bar_thickness"; - private static final String PREF_BATT_ANIMATE = "battery_bar_animate"; - - private Context mContext; - - private ListPreference mBatteryBar; - private ListPreference mBatteryBarStyle; - private CustomSeekBarPreference mBatteryBarThickness; - private SwitchPreference mBatteryBarChargingAnimation; - private SwitchPreference mBatteryBarUseGradient; - private ColorPickerPreference mBatteryBarColor; - private ColorPickerPreference mBatteryBarChargingColor; - private ColorPickerPreference mBatteryBarBatteryLowColor; - private ColorPickerPreference mBatteryBarBatteryLowColorWarn; - private ColorPickerPreference mBatteryBarBatteryHighColor; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - addPreferencesFromResource(R.xml.battery_bar); - - mContext = (Context) getActivity(); - final ContentResolver resolver = getActivity().getContentResolver(); - PreferenceScreen prefSet = getPreferenceScreen(); - - mBatteryBar = (ListPreference) findPreference(PREF_BATT_BAR); - mBatteryBar.setOnPreferenceChangeListener(this); - boolean enabled = Settings.System.getInt(resolver, - Settings.System.BATTERY_BAR_LOCATION, 0) != 0; - if (enabled) { - mBatteryBar.setValue((Settings.System.getInt(resolver, Settings.System.BATTERY_BAR_LOCATION, 0)) + ""); - mBatteryBar.setSummary(mBatteryBar.getEntry()); - } else { - mBatteryBar.setEnabled(false); - mBatteryBar.setSummary(R.string.enable_first); - } - - mBatteryBarStyle = (ListPreference) findPreference(PREF_BATT_BAR_STYLE); - mBatteryBarStyle.setOnPreferenceChangeListener(this); - mBatteryBarStyle.setValue((Settings.System.getInt(resolver, - Settings.System.BATTERY_BAR_STYLE, 0)) + ""); - mBatteryBarStyle.setSummary(mBatteryBarStyle.getEntry()); - - mBatteryBarColor = (ColorPickerPreference) prefSet.findPreference(PREF_BATT_BAR_COLOR); - mBatteryBarColor.setNewPreviewColor(Settings.System.getInt(resolver, - Settings.System.BATTERY_BAR_COLOR, Color.WHITE)); - mBatteryBarColor.setOnPreferenceChangeListener(this); - - mBatteryBarChargingColor = (ColorPickerPreference) prefSet.findPreference(PREF_BATT_BAR_CHARGING_COLOR); - mBatteryBarChargingColor.setNewPreviewColor(Settings.System.getInt(resolver, - Settings.System.BATTERY_BAR_CHARGING_COLOR, Color.WHITE)); - mBatteryBarChargingColor.setOnPreferenceChangeListener(this); - - mBatteryBarBatteryLowColorWarn = (ColorPickerPreference) prefSet.findPreference(PREF_BATT_BAR_LOW_COLOR_WARNING); - mBatteryBarBatteryLowColorWarn.setNewPreviewColor(Settings.System.getInt(resolver, - Settings.System.BATTERY_BAR_BATTERY_LOW_COLOR_WARNING,Color.WHITE)); - mBatteryBarBatteryLowColorWarn.setOnPreferenceChangeListener(this); - - mBatteryBarBatteryLowColor = (ColorPickerPreference) prefSet.findPreference(PREF_BATT_BAR_LOW_COLOR); - mBatteryBarBatteryLowColor.setNewPreviewColor(Settings.System.getInt(resolver, - Settings.System.BATTERY_BAR_LOW_COLOR, Color.WHITE)); - mBatteryBarBatteryLowColor.setOnPreferenceChangeListener(this); - - mBatteryBarBatteryHighColor = (ColorPickerPreference) prefSet.findPreference(PREF_BATT_BAR_HIGH_COLOR); - mBatteryBarBatteryHighColor.setNewPreviewColor(Settings.System.getInt(resolver, - Settings.System.BATTERY_BAR_HIGH_COLOR, Color.WHITE)); - mBatteryBarBatteryHighColor.setOnPreferenceChangeListener(this); - - mBatteryBarUseGradient = (SwitchPreference) findPreference(PREF_BATT_BAR_USE_GRADIENT_COLOR); - mBatteryBarUseGradient.setChecked(Settings.System.getInt(resolver, - Settings.System.BATTERY_BAR_USE_GRADIENT_COLOR, 0) == 1); - - mBatteryBarChargingAnimation = (SwitchPreference) findPreference(PREF_BATT_ANIMATE); - mBatteryBarChargingAnimation.setChecked(Settings.System.getInt(resolver, - Settings.System.BATTERY_BAR_ANIMATE, 0) == 1); - - mBatteryBarThickness = (CustomSeekBarPreference) prefSet.findPreference(PREF_BATT_BAR_WIDTH); - mBatteryBarThickness.setValue(Settings.System.getInt(resolver, - Settings.System.BATTERY_BAR_THICKNESS, 1)); - mBatteryBarThickness.setOnPreferenceChangeListener(this); - - updateBatteryBarOptions(); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - ContentResolver resolver = getActivity().getContentResolver(); - if (preference == mBatteryBarColor) { - int intHex = (Integer) newValue; - Settings.System.putInt(resolver, - Settings.System.BATTERY_BAR_COLOR, intHex); - return true; - } else if (preference == mBatteryBarChargingColor) { - int intHex = (Integer) newValue; - Settings.System.putInt(resolver, - Settings.System.BATTERY_BAR_CHARGING_COLOR, intHex); - return true; - } else if (preference == mBatteryBarBatteryLowColor) { - int intHex = (Integer) newValue; - Settings.System.putInt(resolver, - Settings.System.BATTERY_BAR_LOW_COLOR, intHex); - return true; - } else if (preference == mBatteryBarBatteryLowColorWarn) { - int intHex = (Integer) newValue; - Settings.System.putInt(resolver, - Settings.System.BATTERY_BAR_BATTERY_LOW_COLOR_WARNING, intHex); - return true; - } else if (preference == mBatteryBarBatteryHighColor) { - int intHex = (Integer) newValue; - Settings.System.putInt(resolver, - Settings.System.BATTERY_BAR_HIGH_COLOR, intHex); - return true; - } else if (preference == mBatteryBar) { - int val = Integer.parseInt((String) newValue); - int index = mBatteryBar.findIndexOfValue((String) newValue); - Settings.System.putInt(resolver, - Settings.System.BATTERY_BAR_LOCATION, val); - mBatteryBar.setSummary(mBatteryBar.getEntries()[index]); - updateBatteryBarOptions(); - return true; - } else if (preference == mBatteryBarStyle) { - int val = Integer.parseInt((String) newValue); - int index = mBatteryBarStyle.findIndexOfValue((String) newValue); - Settings.System.putInt(resolver, - Settings.System.BATTERY_BAR_STYLE, val); - mBatteryBarStyle.setSummary(mBatteryBarStyle.getEntries()[index]); - return true; - } else if (preference == mBatteryBarThickness) { - int val = (Integer) newValue; - Settings.System.putInt(resolver, - Settings.System.BATTERY_BAR_THICKNESS, val); - return true; - } - return false; - } - - public boolean onPreferenceTreeClick(Preference preference) { - ContentResolver resolver = getActivity().getContentResolver(); - if (preference == mBatteryBarChargingAnimation) { - boolean value = mBatteryBarChargingAnimation.isChecked(); - Settings.System.putInt(resolver, - Settings.System.BATTERY_BAR_ANIMATE, value ? 1 : 0); - return true; - } else if (preference == mBatteryBarUseGradient) { - boolean value = mBatteryBarUseGradient.isChecked(); - Settings.System.putInt(getContentResolver(), - Settings.System.BATTERY_BAR_USE_GRADIENT_COLOR, value ? 1 : 0); - return true; - } - return false; - } - - private void updateBatteryBarOptions() { - boolean enabled = Settings.System.getInt(getActivity().getContentResolver(), - Settings.System.BATTERY_BAR_LOCATION, 0) != 0; - mBatteryBarStyle.setEnabled(enabled); - mBatteryBarThickness.setEnabled(enabled); - mBatteryBarChargingAnimation.setEnabled(enabled); - mBatteryBarColor.setEnabled(enabled); - mBatteryBarChargingColor.setEnabled(enabled); - mBatteryBarUseGradient.setEnabled(enabled); - mBatteryBarBatteryLowColor.setEnabled(enabled); - mBatteryBarBatteryHighColor.setEnabled(enabled); - mBatteryBarBatteryLowColorWarn.setEnabled(enabled); - } - - @Override - public int getMetricsCategory() { - return MetricsEvent.CHERISH_SETTINGS; - } - - public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider() { - @Override - public List getXmlResourcesToIndex(Context context, - boolean enabled) { - ArrayList result = - new ArrayList(); - - SearchIndexableResource sir = new SearchIndexableResource(context); - sir.xmlResId = R.xml.battery_bar; - result.add(sir); - return result; - } - - @Override - public List getNonIndexableKeys(Context context) { - List keys = super.getNonIndexableKeys(context); - return keys; - } - }; -}