diff options
author | Danny Baumann <dannybaumann@web.de> | 2013-07-15 13:32:26 +0200 |
---|---|---|
committer | fuzz <fuzzzzzzzzzzzzzzzzzz@gmail.com> | 2013-07-27 21:44:37 +0900 |
commit | b55f7fa4641aff0fb837f4cd81dc1e66b1e885be (patch) | |
tree | b292a36d08ab70f3e5e67b4f18e3885648c5fa4a | |
parent | 5a29d4365a177b80fc1b912a9100d34d14cbc672 (diff) | |
download | packages_apps_settings-b55f7fa4641aff0fb837f4cd81dc1e66b1e885be.zip packages_apps_settings-b55f7fa4641aff0fb837f4cd81dc1e66b1e885be.tar.gz packages_apps_settings-b55f7fa4641aff0fb837f4cd81dc1e66b1e885be.tar.bz2 |
Make notification-shade-collapse-after-dismiss behaviour configurable.
Change-Id: Icbf706a582279b86d901fb727b58663713606521
30 files changed, 138 insertions, 121 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index eeee2a5..46c0142 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1550,8 +1550,6 @@ /> <!-- CyanogenMod activities Start --> - <activity android:name=".cyanogenmod.PowerWidget" /> - <activity android:name=".cyanogenmod.SystemSettings" /> <activity android:name="Settings$SystemSettingsActivity" android:label="@string/system_settings_title" diff --git a/res/values-af/cm_strings.xml b/res/values-af/cm_strings.xml index e32617c..e9d96ad 100644 --- a/res/values-af/cm_strings.xml +++ b/res/values-af/cm_strings.xml @@ -372,7 +372,6 @@ <string name="navigation_bar_menu_locked">Gesluit</string> <string name="power_widget_title">Kraglegstukke</string> <string name="title_expanded_widget">Kraglegstukke</string> - <string name="power_widget_behavior">Legstukgedrag</string> <string name="title_expanded_hide_onchange">Maak die kennisgewingslaai toe na wisseling</string> <string name="title_expanded_hide_indicator">Steek aanwysers weg</string> <string name="title_expanded_hide_scrollbar">Steek rolstaaf weg</string> diff --git a/res/values-cs/cm_strings.xml b/res/values-cs/cm_strings.xml index e4a3d2f..6167d19 100644 --- a/res/values-cs/cm_strings.xml +++ b/res/values-cs/cm_strings.xml @@ -468,7 +468,6 @@ <string name="power_widget_title">Power widget</string> <string name="title_expanded_widget">Aktivovat Power widget</string> - <string name="power_widget_behavior">Chování widgetu</string> <string name="title_expanded_hide_onchange">Skrýt oblast po změně</string> <string name="title_expanded_hide_indicator">Skrýt zvýraznění</string> <string name="title_expanded_hide_scrollbar">Skrýt posuvník</string> diff --git a/res/values-da/cm_strings.xml b/res/values-da/cm_strings.xml index 29535d6..8c37934 100644 --- a/res/values-da/cm_strings.xml +++ b/res/values-da/cm_strings.xml @@ -388,7 +388,6 @@ <string name="navigation_bar_menu_locked">Låst</string> <string name="power_widget_title">Strømwidget</string> <string name="title_expanded_widget">Strømwidget</string> - <string name="power_widget_behavior">Widget-adfærd</string> <string name="title_expanded_hide_onchange">Luk panel ved ændring</string> <string name="title_expanded_hide_indicator">Skjul indikatorer</string> <string name="title_expanded_hide_scrollbar">Skjul rullepanel</string> diff --git a/res/values-de/cm_strings.xml b/res/values-de/cm_strings.xml index 00daf21..92c9cd0 100644 --- a/res/values-de/cm_strings.xml +++ b/res/values-de/cm_strings.xml @@ -372,7 +372,6 @@ <string name="swap_volume_buttons_summary">Belegung der Lautstärketasten umkehren, wenn das Gerät gedreht wird</string> <string name="power_widget_title">Energie-Widget</string> <string name="title_expanded_widget">Energiesteuerung</string> - <string name="power_widget_behavior">Widget-Verhalten</string> <string name="title_expanded_hide_onchange">Nach Änd. schließen</string> <string name="title_expanded_hide_indicator">Indikator verbergen</string> <string name="title_expanded_hide_scrollbar">Scrollbar verbergen</string> diff --git a/res/values-el/cm_strings.xml b/res/values-el/cm_strings.xml index 81c805d..458a396 100644 --- a/res/values-el/cm_strings.xml +++ b/res/values-el/cm_strings.xml @@ -392,8 +392,6 @@ <string name="navigation_bar_menu_locked">Κλειδωμένο</string> <string name="power_widget_title">Power widget</string> <string name="title_expanded_widget">Power widget</string> - <string name="power_widget_behavior">Συμπεριφορά widget</string> - <string name="title_expanded_hide_onchange">Απόκρυψη μετά από αλλαγή</string> <string name="title_expanded_hide_indicator">Απόκρυψη ένδειξης</string> <string name="title_expanded_hide_scrollbar">Απόκρυψη μπάρας ολίσθισης</string> <string name="title_widget_picker">Πλήκτρα widget</string> diff --git a/res/values-es/cm_strings.xml b/res/values-es/cm_strings.xml index 8150e9a..7e9a908 100644 --- a/res/values-es/cm_strings.xml +++ b/res/values-es/cm_strings.xml @@ -402,7 +402,6 @@ <string name="navigation_bar_menu_locked">Bloqueada</string> <string name="power_widget_title">Controles de Energía</string> <string name="title_expanded_widget">Barra de energía</string> - <string name="power_widget_behavior">Comportamiento</string> <string name="title_expanded_hide_onchange">Ocultar al pulsar</string> <string name="title_expanded_hide_indicator">Ocultar indicadores</string> <string name="title_expanded_hide_scrollbar">Ocultar barra de desplazamiento</string> diff --git a/res/values-fi/cm_strings.xml b/res/values-fi/cm_strings.xml index 21e4e68..2724ef0 100644 --- a/res/values-fi/cm_strings.xml +++ b/res/values-fi/cm_strings.xml @@ -328,7 +328,6 @@ <string name="hardware_keys_action_in_app_search">Haku sovelluksessa</string> <string name="power_widget_title">Pikanäppäimet</string> <string name="title_expanded_widget">Pikanäppäimet</string> - <string name="power_widget_behavior">Näppäimen käytös</string> <string name="title_expanded_hide_indicator">Piilota osoittimet</string> <string name="title_expanded_hide_onchange">Piilota muutettaessa</string> <string name="title_expanded_hide_scrollbar">Piilota vierityspalkki</string> diff --git a/res/values-fr/cm_strings.xml b/res/values-fr/cm_strings.xml index 8fdffab..8f226e8 100644 --- a/res/values-fr/cm_strings.xml +++ b/res/values-fr/cm_strings.xml @@ -402,7 +402,6 @@ <string name="navigation_bar_menu_locked">Verrouillée</string> <string name="power_widget_title">Widget d\'alimentation</string> <string name="title_expanded_widget">Widget d\'alimentation</string> - <string name="power_widget_behavior">Comportement du widget</string> <string name="title_expanded_hide_onchange">Fermer après changement</string> <string name="title_expanded_hide_indicator">Cacher les notifications</string> <string name="title_expanded_hide_scrollbar">Cacher barre de défilement</string> diff --git a/res/values-hu/cm_strings.xml b/res/values-hu/cm_strings.xml index e4b4d8a..635b0c0 100644 --- a/res/values-hu/cm_strings.xml +++ b/res/values-hu/cm_strings.xml @@ -392,7 +392,6 @@ <string name="navigation_bar_menu_locked">Zárolt</string> <string name="power_widget_title">Energiagazdálkodás</string> <string name="title_expanded_widget">Engedélyezés</string> - <string name="power_widget_behavior">Viselkedés</string> <string name="title_expanded_hide_onchange">Elrejtés kapcsoló kiválasztásakor</string> <string name="title_expanded_hide_indicator">Jelölők elrejtése</string> <string name="title_expanded_hide_scrollbar">Görgetősáv elrejtése</string> diff --git a/res/values-it/cm_strings.xml b/res/values-it/cm_strings.xml index 89aca38..b47b974 100644 --- a/res/values-it/cm_strings.xml +++ b/res/values-it/cm_strings.xml @@ -394,7 +394,6 @@ <string name="navigation_bar_menu_locked">Bloccata</string> <string name="power_widget_title">Widget alimentazione</string> <string name="title_expanded_widget">Widget alimentazione</string> - <string name="power_widget_behavior">Comportamento widget</string> <string name="title_expanded_hide_onchange">Nascondi dopo modifica</string> <string name="title_expanded_hide_indicator">Nascondi indicatori</string> <string name="title_expanded_hide_scrollbar">Nascondi barra scorrimento</string> diff --git a/res/values-iw/cm_strings.xml b/res/values-iw/cm_strings.xml index 59ff823..00b761e 100644 --- a/res/values-iw/cm_strings.xml +++ b/res/values-iw/cm_strings.xml @@ -358,7 +358,6 @@ <string name="navigation_bar_menu_locked">נעול</string> <string name="power_widget_title">Power widget</string> <string name="title_expanded_widget">Power widget</string> - <string name="power_widget_behavior">התנהגות ה-Wigdet</string> <string name="title_expanded_hide_onchange">סגור את המגירה בשינוי</string> <string name="title_expanded_hide_indicator">Hide indicators</string> <string name="title_expanded_hide_scrollbar">הסתר את פס הגלילה</string> diff --git a/res/values-ja/cm_strings.xml b/res/values-ja/cm_strings.xml index 316743f..53424ac 100644 --- a/res/values-ja/cm_strings.xml +++ b/res/values-ja/cm_strings.xml @@ -150,7 +150,6 @@ <string name="navigation_bar_menu_locked">ロック中</string> <string name="power_widget_title">電源管理ウィジェット</string> <string name="title_expanded_widget">電源管理ウィジェットを表示</string> - <string name="power_widget_behavior">ウィジェットの挙動</string> <string name="title_expanded_hide_onchange">変更したら隠す</string> <string name="title_expanded_hide_scrollbar">スクロールバーを隠す</string> <string name="title_widget_picker">ウィジェットボタン</string> diff --git a/res/values-ko/cm_strings.xml b/res/values-ko/cm_strings.xml index e25c0b7..de9d298 100644 --- a/res/values-ko/cm_strings.xml +++ b/res/values-ko/cm_strings.xml @@ -319,7 +319,6 @@ <string name="navigation_bar_menu_locked">잠김</string> <string name="power_widget_title">전원 위젯</string> <string name="title_expanded_widget">전원 위젯</string> - <string name="power_widget_behavior">위젯 설정</string> <string name="title_expanded_hide_onchange">상태 변경 후 서랍 닫기</string> <string name="title_expanded_hide_indicator">상태 표시 숨기기</string> <string name="title_expanded_hide_scrollbar">스크롤바 숨기기</string> diff --git a/res/values-lt/cm_strings.xml b/res/values-lt/cm_strings.xml index e682992..9ec8e7c 100644 --- a/res/values-lt/cm_strings.xml +++ b/res/values-lt/cm_strings.xml @@ -357,7 +357,6 @@ <string name="navigation_bar_menu_locked">Užrakintas</string> <string name="power_widget_title">Valdiklis užuolaidoje</string> <string name="title_expanded_widget">Valdiklis užuolaidoje</string> - <string name="power_widget_behavior">Valdiklio elgsena</string> <string name="title_expanded_hide_onchange">Užverti užuolaidą pasirinkus</string> <string name="title_expanded_hide_indicator">Slepti indikatorius</string> <string name="title_expanded_hide_scrollbar">Slepti šliaužiklį</string> diff --git a/res/values-nb/cm_strings.xml b/res/values-nb/cm_strings.xml index 9c833ff..97d16e5 100644 --- a/res/values-nb/cm_strings.xml +++ b/res/values-nb/cm_strings.xml @@ -387,7 +387,6 @@ <string name="navigation_bar_menu_locked">Låst</string> <string name="power_widget_title">Strømkontroll</string> <string name="title_expanded_widget">Strømkontroll</string> - <string name="power_widget_behavior">Modul-oppførsel</string> <string name="title_expanded_hide_onchange">Lukk Varslingsskuffen ved endring</string> <string name="title_expanded_hide_indicator">Skjul indikator</string> <string name="title_expanded_hide_scrollbar">Skjul rullefelt</string> diff --git a/res/values-nl/cm_strings.xml b/res/values-nl/cm_strings.xml index dd527b6..dc7ab84 100644 --- a/res/values-nl/cm_strings.xml +++ b/res/values-nl/cm_strings.xml @@ -407,7 +407,6 @@ Let op:\nAangezien het beginvolume hoger is ingesteld dan het beltoonvolume, wor <string name="navigation_bar_menu_locked">Vergrendeld</string> <string name="power_widget_title">Energiewidget</string> <string name="title_expanded_widget">Energiewidget</string> - <string name="power_widget_behavior">Widgetgedrag</string> <string name="title_expanded_hide_onchange">Verbergen bij wijziging</string> <string name="title_expanded_hide_indicator">Indicatoren verbergen</string> <string name="title_expanded_hide_scrollbar">Schuifbalk verbergen</string> diff --git a/res/values-pl/cm_strings.xml b/res/values-pl/cm_strings.xml index eabc4ea..cd86ccd 100644 --- a/res/values-pl/cm_strings.xml +++ b/res/values-pl/cm_strings.xml @@ -362,7 +362,6 @@ <string name="navigation_bar_menu_locked">Zablokowano</string> <string name="power_widget_title">Widżet zasilania</string> <string name="title_expanded_widget">Widżet zasilania</string> - <string name="power_widget_behavior">Zachowanie widżetu</string> <string name="title_expanded_hide_onchange">Zamknij szufladę aplikacji po zmianie</string> <string name="title_expanded_hide_indicator">Ukryj wskaźniki</string> <string name="title_expanded_hide_scrollbar">Ukryj paski przewijania</string> diff --git a/res/values-pt/cm_strings.xml b/res/values-pt/cm_strings.xml index 115a2f5..18ce21a 100644 --- a/res/values-pt/cm_strings.xml +++ b/res/values-pt/cm_strings.xml @@ -354,7 +354,6 @@ <string name="hardware_keys_action_in_app_search">Busca dentro do app</string> <string name="power_widget_title">Widget de energia</string> <string name="title_expanded_widget">Mostrar widget de energia</string> - <string name="power_widget_behavior">Comportamendo de Widget</string> <string name="title_expanded_hide_onchange">Esconder ao mudar</string> <string name="title_expanded_hide_scrollbar">Esconder barra de rolagem</string> <string name="title_widget_picker">Botões do widget</string> @@ -746,4 +745,4 @@ controle adicionais. \'Remover\' apaga a linha selecionada. <string name="storage_rescan_media_complete">Varredura completada</string> <string name="notification_light_default_value">Padrão</string> <string name="display_lockscreen_rotation_title">Rotacionar tela de bloqueio</string> -</resources>
\ No newline at end of file +</resources> diff --git a/res/values-ro/cm_strings.xml b/res/values-ro/cm_strings.xml index 3f827f7..c22a0ef 100644 --- a/res/values-ro/cm_strings.xml +++ b/res/values-ro/cm_strings.xml @@ -345,7 +345,6 @@ <string name="hardware_keys_action_in_app_search">"Căutare în int. aplicaţiilor"</string> <string name="power_widget_title">"Power Widget"</string> <string name="title_expanded_widget">"Power widget"</string> - <string name="power_widget_behavior">"Comportament widget"</string> <string name="title_expanded_hide_onchange">"Închideţi sertarul la modificare"</string> <string name="title_expanded_hide_indicator">"Ascundeţi indicatorii"</string> <string name="title_expanded_hide_scrollbar">"Ascundeţi bara de defilare"</string> diff --git a/res/values-ru/cm_strings.xml b/res/values-ru/cm_strings.xml index 7e0da3f..8d18e0f 100644 --- a/res/values-ru/cm_strings.xml +++ b/res/values-ru/cm_strings.xml @@ -494,7 +494,6 @@ <!-- Power Widget #CM --> <string name="power_widget_title">Кнопки в панели уведомлений</string> <string name="title_expanded_widget">Кнопки в панели уведомлений</string> - <string name="power_widget_behavior">Поведение виджета</string> <string name="title_expanded_hide_onchange">Скрывать при изменении</string> <string name="title_expanded_hide_indicator">Скрывать индикаторы</string> <string name="title_expanded_hide_scrollbar">Скрывать полосу прокрутки</string> @@ -927,4 +926,4 @@ <string name="privacy_guard_manager_show_system_apps">Системные приложения</string> <string name="privacy_guard_manager_filter_permissions">Фильтр разрешений</string> -</resources>
\ No newline at end of file +</resources> diff --git a/res/values-tr/cm_strings.xml b/res/values-tr/cm_strings.xml index 2c30ee0..2dba3e7 100644 --- a/res/values-tr/cm_strings.xml +++ b/res/values-tr/cm_strings.xml @@ -387,7 +387,6 @@ <string name="navigation_bar_menu_locked">Kilitli</string> <string name="power_widget_title">Power widget</string> <string name="title_expanded_widget">Power widget</string> - <string name="power_widget_behavior">Widget davranışı</string> <string name="title_expanded_hide_onchange">Değişiklikte çekmeceyi kapat</string> <string name="title_expanded_hide_indicator">Göstericileri gizle</string> <string name="title_expanded_hide_scrollbar">Kaydırma çubuğu gizle</string> diff --git a/res/values-uk/cm_strings.xml b/res/values-uk/cm_strings.xml index 92d7693..4ebb135 100644 --- a/res/values-uk/cm_strings.xml +++ b/res/values-uk/cm_strings.xml @@ -347,7 +347,6 @@ <string name="navigation_bar_menu_locked">Заблоковано</string> <string name="power_widget_title">Кнопки в панелі сповіщень</string> <string name="title_expanded_widget">Кнопки в панелі сповіщень</string> - <string name="power_widget_behavior">Поведінка віджета</string> <string name="title_expanded_hide_onchange">Приховувати при зміні</string> <string name="title_expanded_hide_indicator">Приховувати індикатори</string> <string name="title_expanded_hide_scrollbar">Приховувати полосу прокрутки</string> diff --git a/res/values-zh-rCN/cm_strings.xml b/res/values-zh-rCN/cm_strings.xml index 662c311..9ebe6b0 100644 --- a/res/values-zh-rCN/cm_strings.xml +++ b/res/values-zh-rCN/cm_strings.xml @@ -387,7 +387,6 @@ <string name="navigation_bar_menu_locked">已锁定</string> <string name="power_widget_title">电控小部件</string> <string name="title_expanded_widget">电控小部件</string> - <string name="power_widget_behavior">小部件行为</string> <string name="title_expanded_hide_onchange">做出操作后关闭通知栏</string> <string name="title_expanded_hide_indicator">隐藏指示器</string> <string name="title_expanded_hide_scrollbar">隐藏滚动条</string> diff --git a/res/values/cm_arrays.xml b/res/values/cm_arrays.xml index bc0ec04..4b2c9bb 100644 --- a/res/values/cm_arrays.xml +++ b/res/values/cm_arrays.xml @@ -597,5 +597,25 @@ <item>50</item> <item>25</item> </integer-array> + + <!-- Status bar auto-collapse behaviour --> + <string-array name="notification_drawer_collapse_on_dismiss_entries" translatable="false"> + <item>@string/collapse_on_dismiss_never</item> + <item>@string/collapse_on_dismiss_if_empty</item> + <item>@string/collapse_on_dismiss_if_no_clearable</item> + </string-array> + + <string-array name="notification_drawer_collapse_on_dismiss_summaries" translatable="false"> + <item>@string/collapse_on_dismiss_never_summary</item> + <item>@string/collapse_on_dismiss_if_empty_summary</item> + <item>@string/collapse_on_dismiss_if_no_clearable_summary</item> + </string-array> + + <string-array name="notification_drawer_collapse_on_dismiss_values" translatable="false"> + <item>0</item> + <item>1</item> + <item>2</item> + </string-array> + </resources> diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index cc507c3..400f82e 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -164,6 +164,14 @@ <!-- Notification Drawer --> <string name="notification_drawer_title">Notification drawer</string> + <string name="notification_drawer_behaviour_title">Behaviour</string> + <string name="notification_drawer_collapse_on_dismiss_title">Auto-close drawer</string> + <string name="collapse_on_dismiss_never">Disabled</string> + <string name="collapse_on_dismiss_if_empty">If none remaining</string> + <string name="collapse_on_dismiss_if_no_clearable">If no removable remaining</string> + <string name="collapse_on_dismiss_never_summary">Leave notification tray open when removing notifications</string> + <string name="collapse_on_dismiss_if_empty_summary">Close notification tray when removing the last notification</string> + <string name="collapse_on_dismiss_if_no_clearable_summary">Close notification tray when removing the last removable notification</string> <string name="lock_screen_title">Lock screen</string> @@ -570,7 +578,6 @@ <!-- Power Widget --> <string name="power_widget_title">Power widget</string> <string name="title_expanded_widget">Power widget</string> - <string name="power_widget_behavior">Widget behavior</string> <string name="title_expanded_hide_onchange">Close drawer on change</string> <string name="title_expanded_hide_indicator">Hide indicators</string> <string name="title_expanded_hide_scrollbar">Hide scrollbar</string> @@ -668,8 +675,6 @@ <string name="status_bar_battery_status_percentage">Percentage</string> <string name="status_bar_battery_status_circle">Circle</string> <string name="status_bar_battery_status_circle_percentage">Circle with percentage</string> - - <!-- Status bar notification count --> <string name="status_bar_notif_count_title">Show notification count</string> <string name="status_bar_notif_count_summary">Display number of pending notifications</string> diff --git a/res/xml/power_widget_settings.xml b/res/xml/notification_drawer.xml index 7b464d3..6b6d689 100644 --- a/res/xml/power_widget_settings.xml +++ b/res/xml/notification_drawer.xml @@ -17,6 +17,19 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> + <!-- Notification drawer behaviour --> + <PreferenceCategory + android:title="@string/notification_drawer_behaviour_title"> + + <ListPreference + android:key="notification_drawer_collapse_on_dismiss" + android:title="@string/notification_drawer_collapse_on_dismiss_title" + android:dialogTitle="@string/notification_drawer_collapse_on_dismiss_title" + android:entries="@array/notification_drawer_collapse_on_dismiss_entries" + android:entryValues="@array/notification_drawer_collapse_on_dismiss_values" /> + + </PreferenceCategory> + <!-- Notification drawer Power Widget --> <PreferenceCategory android:title="@string/power_widget_title"> @@ -31,7 +44,7 @@ android:title="@string/title_widget_picker" android:summary="@string/summary_widget_picker" android:dependency="expanded_widget" - android:fragment="com.android.settings.cyanogenmod.PowerWidget$PowerWidgetChooser"> + android:fragment="com.android.settings.cyanogenmod.NotificationDrawer$PowerWidgetChooser"> </PreferenceScreen> <PreferenceScreen @@ -39,14 +52,9 @@ android:title="@string/title_widget_order" android:summary="@string/summary_widget_order" android:dependency="expanded_widget" - android:fragment="com.android.settings.cyanogenmod.PowerWidget$PowerWidgetOrder"> + android:fragment="com.android.settings.cyanogenmod.NotificationDrawer$PowerWidgetOrder"> </PreferenceScreen> - </PreferenceCategory> - - <PreferenceCategory - android:title="@string/power_widget_behavior"> - <CheckBoxPreference android:key="expanded_hide_onchange" android:title="@string/title_expanded_hide_onchange" @@ -69,4 +77,4 @@ </PreferenceCategory> -</PreferenceScreen>
\ No newline at end of file +</PreferenceScreen> diff --git a/res/xml/system_settings.xml b/res/xml/system_settings.xml index c5ffb5d..995cff2 100644 --- a/res/xml/system_settings.xml +++ b/res/xml/system_settings.xml @@ -31,7 +31,7 @@ <PreferenceScreen android:key="notification_drawer" - android:fragment="com.android.settings.cyanogenmod.PowerWidget" + android:fragment="com.android.settings.cyanogenmod.NotificationDrawer" android:title="@string/notification_drawer_title" /> <ListPreference diff --git a/src/com/android/settings/cyanogenmod/PowerWidget.java b/src/com/android/settings/cyanogenmod/NotificationDrawer.java index 33091b7..fd45989 100644 --- a/src/com/android/settings/cyanogenmod/PowerWidget.java +++ b/src/com/android/settings/cyanogenmod/NotificationDrawer.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.Set; import android.app.ListFragment; +import android.content.ContentResolver; import android.content.Context; import android.content.pm.PackageManager; import android.content.res.Resources; @@ -55,15 +56,17 @@ import com.android.settings.SettingsPreferenceFragment; import static com.android.internal.util.cm.QSUtils.deviceSupportsMobileData; -public class PowerWidget extends SettingsPreferenceFragment implements +public class NotificationDrawer extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener { private static final String TAG = "PowerWidget"; private static final String SEPARATOR = "OV=I=XseparatorX=I=VO"; + private static final String UI_COLLAPSE_BEHAVIOUR = "notification_drawer_collapse_on_dismiss"; private static final String UI_EXP_WIDGET = "expanded_widget"; private static final String UI_EXP_WIDGET_HIDE_ONCHANGE = "expanded_hide_onchange"; private static final String UI_EXP_WIDGET_HIDE_SCROLLBAR = "expanded_hide_scrollbar"; private static final String UI_EXP_WIDGET_HAPTIC_FEEDBACK = "expanded_haptic_feedback"; + private ListPreference mCollapseOnDismiss; private CheckBoxPreference mPowerWidget; private CheckBoxPreference mPowerWidgetHideOnChange; private CheckBoxPreference mPowerWidgetHideScrollBar; @@ -74,72 +77,85 @@ public class PowerWidget extends SettingsPreferenceFragment implements super.onCreate(savedInstanceState); if (getPreferenceManager() != null) { - addPreferencesFromResource(R.xml.power_widget_settings); + addPreferencesFromResource(R.xml.notification_drawer); + ContentResolver resolver = getActivity().getContentResolver(); PreferenceScreen prefSet = getPreferenceScreen(); + int collapseBehaviour = Settings.System.getInt(resolver, + Settings.System.STATUS_BAR_COLLAPSE_ON_DISMISS, + Settings.System.STATUS_BAR_COLLAPSE_IF_NO_CLEARABLE); + mCollapseOnDismiss = (ListPreference) prefSet.findPreference(UI_COLLAPSE_BEHAVIOUR); + mCollapseOnDismiss.setValue(String.valueOf(collapseBehaviour)); + mCollapseOnDismiss.setOnPreferenceChangeListener(this); + updateCollapseBehaviourSummary(collapseBehaviour); + mPowerWidget = (CheckBoxPreference) prefSet.findPreference(UI_EXP_WIDGET); + mPowerWidget.setOnPreferenceChangeListener(this); mPowerWidgetHideOnChange = (CheckBoxPreference) prefSet .findPreference(UI_EXP_WIDGET_HIDE_ONCHANGE); + mPowerWidgetHideOnChange.setOnPreferenceChangeListener(this); mPowerWidgetHideScrollBar = (CheckBoxPreference) prefSet .findPreference(UI_EXP_WIDGET_HIDE_SCROLLBAR); + mPowerWidgetHideScrollBar.setOnPreferenceChangeListener(this); mPowerWidgetHapticFeedback = (ListPreference) prefSet .findPreference(UI_EXP_WIDGET_HAPTIC_FEEDBACK); mPowerWidgetHapticFeedback.setOnPreferenceChangeListener(this); mPowerWidgetHapticFeedback.setSummary(mPowerWidgetHapticFeedback.getEntry()); - mPowerWidget.setChecked((Settings.System.getInt(getActivity().getApplicationContext() - .getContentResolver(), - Settings.System.EXPANDED_VIEW_WIDGET, 0) == 1)); - mPowerWidgetHideOnChange.setChecked((Settings.System.getInt(getActivity() - .getApplicationContext().getContentResolver(), - Settings.System.EXPANDED_HIDE_ONCHANGE, 0) == 1)); - mPowerWidgetHideScrollBar.setChecked((Settings.System.getInt(getActivity() - .getApplicationContext().getContentResolver(), - Settings.System.EXPANDED_HIDE_SCROLLBAR, 0) == 1)); + mPowerWidget.setChecked(Settings.System.getInt(resolver, + Settings.System.EXPANDED_VIEW_WIDGET, 0) == 1); + mPowerWidgetHideOnChange.setChecked(Settings.System.getInt(resolver, + Settings.System.EXPANDED_HIDE_ONCHANGE, 0) == 1); + mPowerWidgetHideScrollBar.setChecked(Settings.System.getInt(resolver, + Settings.System.EXPANDED_HIDE_SCROLLBAR, 0) == 1); mPowerWidgetHapticFeedback.setValue(Integer.toString(Settings.System.getInt( - getActivity().getApplicationContext().getContentResolver(), - Settings.System.EXPANDED_HAPTIC_FEEDBACK, 2))); + resolver, Settings.System.EXPANDED_HAPTIC_FEEDBACK, 2))); } } + private void updateCollapseBehaviourSummary(int setting) { + String[] summaries = getResources().getStringArray( + R.array.notification_drawer_collapse_on_dismiss_summaries); + mCollapseOnDismiss.setSummary(summaries[setting]); + } + + @Override public boolean onPreferenceChange(Preference preference, Object newValue) { - if (preference == mPowerWidgetHapticFeedback) { + ContentResolver resolver = getActivity().getContentResolver(); + + if (preference == mCollapseOnDismiss) { + int value = Integer.valueOf((String) newValue); + Settings.System.putInt(resolver, + Settings.System.STATUS_BAR_COLLAPSE_ON_DISMISS, value); + updateCollapseBehaviourSummary(value); + return true; + } else if (preference == mPowerWidget) { + boolean value = (Boolean) newValue; + Settings.System.putInt(resolver, + Settings.System.EXPANDED_VIEW_WIDGET, value ? 1 : 0); + return true; + } else if (preference == mPowerWidgetHideOnChange) { + boolean value = (Boolean) newValue; + Settings.System.putInt(resolver, + Settings.System.EXPANDED_HIDE_ONCHANGE, value ? 1 : 0); + return true; + } else if (preference == mPowerWidgetHideScrollBar) { + boolean value = (Boolean) newValue; + Settings.System.putInt(resolver, + Settings.System.EXPANDED_HIDE_SCROLLBAR, value ? 1 : 0); + return true; + } else if (preference == mPowerWidgetHapticFeedback) { int intValue = Integer.parseInt((String) newValue); int index = mPowerWidgetHapticFeedback.findIndexOfValue((String) newValue); - Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(), + Settings.System.putInt(resolver, Settings.System.EXPANDED_HAPTIC_FEEDBACK, intValue); mPowerWidgetHapticFeedback.setSummary(mPowerWidgetHapticFeedback.getEntries()[index]); return true; } - return false; - } - - public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { - boolean value; - - if (preference == mPowerWidget) { - value = mPowerWidget.isChecked(); - Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.EXPANDED_VIEW_WIDGET, - value ? 1 : 0); - } else if (preference == mPowerWidgetHideOnChange) { - value = mPowerWidgetHideOnChange.isChecked(); - Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.EXPANDED_HIDE_ONCHANGE, - value ? 1 : 0); - } else if (preference == mPowerWidgetHideScrollBar) { - value = mPowerWidgetHideScrollBar.isChecked(); - Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.EXPANDED_HIDE_SCROLLBAR, - value ? 1 : 0); - } else { - // If we didn't handle it, let preferences handle it. - return super.onPreferenceTreeClick(preferenceScreen, preference); - } - return true; + return false; } public static class PowerWidgetChooser extends SettingsPreferenceFragment diff --git a/src/com/android/settings/cyanogenmod/StatusBar.java b/src/com/android/settings/cyanogenmod/StatusBar.java index f9e911a..7b739ad 100644 --- a/src/com/android/settings/cyanogenmod/StatusBar.java +++ b/src/com/android/settings/cyanogenmod/StatusBar.java @@ -16,6 +16,7 @@ package com.android.settings.cyanogenmod; +import android.content.ContentResolver; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.ListPreference; @@ -49,7 +50,6 @@ public class StatusBar extends SettingsPreferenceFragment implements OnPreferenc private CheckBoxPreference mStatusBarClock; private CheckBoxPreference mStatusBarBrightnessControl; private CheckBoxPreference mStatusBarNotifCount; - private PreferenceCategory mPrefCategoryGeneral; @Override public void onCreate(Bundle savedInstanceState) { @@ -58,6 +58,7 @@ public class StatusBar extends SettingsPreferenceFragment implements OnPreferenc addPreferencesFromResource(R.xml.status_bar); PreferenceScreen prefSet = getPreferenceScreen(); + ContentResolver resolver = getActivity().getContentResolver(); mStatusBarClock = (CheckBoxPreference) prefSet.findPreference(STATUS_BAR_CLOCK); mStatusBarBrightnessControl = (CheckBoxPreference) prefSet.findPreference(STATUS_BAR_BRIGHTNESS_CONTROL); @@ -65,15 +66,15 @@ public class StatusBar extends SettingsPreferenceFragment implements OnPreferenc mStatusBarBattery = (ListPreference) prefSet.findPreference(STATUS_BAR_BATTERY); mStatusBarCmSignal = (ListPreference) prefSet.findPreference(STATUS_BAR_SIGNAL); - mStatusBarClock.setChecked((Settings.System.getInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.STATUS_BAR_CLOCK, 1) == 1)); + mStatusBarClock.setChecked(Settings.System.getInt(resolver, Settings.System.STATUS_BAR_CLOCK, 1) == 1); + mStatusBarClock.setOnPreferenceChangeListener(this); if (DateFormat.is24HourFormat(getActivity())) { ((PreferenceCategory) prefSet.findPreference(STATUS_BAR_CLOCK_CATEGORY)) .removePreference(prefSet.findPreference(STATUS_BAR_AM_PM)); } else { mStatusBarAmPm = (ListPreference) prefSet.findPreference(STATUS_BAR_AM_PM); - int statusBarAmPm = Settings.System.getInt(getActivity().getContentResolver(), + int statusBarAmPm = Settings.System.getInt(resolver, Settings.System.STATUS_BAR_AM_PM, 2); mStatusBarAmPm.setValue(String.valueOf(statusBarAmPm)); @@ -81,91 +82,84 @@ public class StatusBar extends SettingsPreferenceFragment implements OnPreferenc mStatusBarAmPm.setOnPreferenceChangeListener(this); } - mStatusBarBrightnessControl.setChecked((Settings.System.getInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.STATUS_BAR_BRIGHTNESS_CONTROL, 0) == 1)); + mStatusBarBrightnessControl.setChecked(Settings.System.getInt(resolver, + Settings.System.STATUS_BAR_BRIGHTNESS_CONTROL, 0) == 1); + mStatusBarBrightnessControl.setChecked(Settings.System.getInt(resolver, + Settings.System.STATUS_BAR_BRIGHTNESS_CONTROL, 0) == 1); + mStatusBarBrightnessControl.setOnPreferenceChangeListener(this); try { - if (Settings.System.getInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { + if (Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE) + == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { mStatusBarBrightnessControl.setEnabled(false); mStatusBarBrightnessControl.setSummary(R.string.status_bar_toggle_info); } } catch (SettingNotFoundException e) { } - int statusBarBattery = Settings.System.getInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.STATUS_BAR_BATTERY, 0); + int statusBarBattery = Settings.System.getInt(resolver, Settings.System.STATUS_BAR_BATTERY, 0); mStatusBarBattery.setValue(String.valueOf(statusBarBattery)); mStatusBarBattery.setSummary(mStatusBarBattery.getEntry()); mStatusBarBattery.setOnPreferenceChangeListener(this); - int signalStyle = Settings.System.getInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.STATUS_BAR_SIGNAL_TEXT, 0); + int signalStyle = Settings.System.getInt(resolver, Settings.System.STATUS_BAR_SIGNAL_TEXT, 0); mStatusBarCmSignal.setValue(String.valueOf(signalStyle)); mStatusBarCmSignal.setSummary(mStatusBarCmSignal.getEntry()); mStatusBarCmSignal.setOnPreferenceChangeListener(this); mStatusBarNotifCount = (CheckBoxPreference) prefSet.findPreference(STATUS_BAR_NOTIF_COUNT); - mStatusBarNotifCount.setChecked((Settings.System.getInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.STATUS_BAR_NOTIF_COUNT, 0) == 1)); + mStatusBarNotifCount.setChecked(Settings.System.getInt(resolver, + Settings.System.STATUS_BAR_NOTIF_COUNT, 0) == 1); + mStatusBarNotifCount.setOnPreferenceChangeListener(this); - mPrefCategoryGeneral = (PreferenceCategory) findPreference(STATUS_BAR_CATEGORY_GENERAL); + PreferenceCategory generalCategory = + (PreferenceCategory) findPreference(STATUS_BAR_CATEGORY_GENERAL); if (Utils.isWifiOnly(getActivity())) { - mPrefCategoryGeneral.removePreference(mStatusBarCmSignal); + generalCategory.removePreference(mStatusBarCmSignal); } if (Utils.isTablet(getActivity())) { - mPrefCategoryGeneral.removePreference(mStatusBarBrightnessControl); + generalCategory.removePreference(mStatusBarBrightnessControl); } - } + @Override public boolean onPreferenceChange(Preference preference, Object newValue) { + ContentResolver resolver = getActivity().getContentResolver(); if (mStatusBarAmPm != null && preference == mStatusBarAmPm) { int statusBarAmPm = Integer.valueOf((String) newValue); int index = mStatusBarAmPm.findIndexOfValue((String) newValue); - Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.STATUS_BAR_AM_PM, statusBarAmPm); + Settings.System.putInt(resolver, Settings.System.STATUS_BAR_AM_PM, statusBarAmPm); mStatusBarAmPm.setSummary(mStatusBarAmPm.getEntries()[index]); return true; } else if (preference == mStatusBarBattery) { int statusBarBattery = Integer.valueOf((String) newValue); int index = mStatusBarBattery.findIndexOfValue((String) newValue); - Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.STATUS_BAR_BATTERY, statusBarBattery); + Settings.System.putInt(resolver, Settings.System.STATUS_BAR_BATTERY, statusBarBattery); mStatusBarBattery.setSummary(mStatusBarBattery.getEntries()[index]); return true; } else if (preference == mStatusBarCmSignal) { int signalStyle = Integer.valueOf((String) newValue); int index = mStatusBarCmSignal.findIndexOfValue((String) newValue); - Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.STATUS_BAR_SIGNAL_TEXT, signalStyle); + Settings.System.putInt(resolver, Settings.System.STATUS_BAR_SIGNAL_TEXT, signalStyle); mStatusBarCmSignal.setSummary(mStatusBarCmSignal.getEntries()[index]); return true; - } - return false; - } - - public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { - boolean value; - - if (preference == mStatusBarClock) { - value = mStatusBarClock.isChecked(); - Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.STATUS_BAR_CLOCK, value ? 1 : 0); + } else if (preference == mStatusBarClock) { + boolean value = (Boolean) newValue; + Settings.System.putInt(resolver, Settings.System.STATUS_BAR_CLOCK, value ? 1 : 0); return true; } else if (preference == mStatusBarBrightnessControl) { - value = mStatusBarBrightnessControl.isChecked(); - Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(), + boolean value = (Boolean) newValue; + Settings.System.putInt(resolver, Settings.System.STATUS_BAR_BRIGHTNESS_CONTROL, value ? 1 : 0); return true; } else if (preference == mStatusBarNotifCount) { - value = mStatusBarNotifCount.isChecked(); - Settings.System.putInt(getActivity().getApplicationContext().getContentResolver(), - Settings.System.STATUS_BAR_NOTIF_COUNT, value ? 1 : 0); + boolean value = (Boolean) newValue; + Settings.System.putInt(resolver, Settings.System.STATUS_BAR_NOTIF_COUNT, value ? 1 : 0); return true; } + return false; } } |