diff options
45 files changed, 1209 insertions, 82 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index f33bb0b30..f8ef64f31 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -85,7 +85,7 @@ </intent-filter> </activity> - <activity android:name="com.android.launcher3.settings.SettingsActivity" + <activity android:name=".settings.SettingsActivity" android:label="@string/preferences_title"> <intent-filter> <action android:name="android.intent.action.MAIN" /> @@ -95,6 +95,16 @@ </activity> <activity + android:name=".settings.HiddenAppsActivity" + android:label="@string/hidden_apps_title" + android:exported="false"> + <intent-filter> + <action android:name=".settings.HiddenAppsActivity" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + <activity android:name="com.android.launcher3.ToggleWeightWatcher" android:label="@string/toggle_weight_watcher" android:enabled="@bool/debug_memory_enabled" diff --git a/res/layout/hidden_apps_list.xml b/res/layout/hidden_apps_list.xml new file mode 100644 index 000000000..fb0d4bffb --- /dev/null +++ b/res/layout/hidden_apps_list.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<ListView xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@android:id/list" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="5dp" + android:choiceMode="multipleChoice" />
\ No newline at end of file diff --git a/res/layout/hidden_apps_list_item.xml b/res/layout/hidden_apps_list_item.xml new file mode 100644 index 000000000..a00b07741 --- /dev/null +++ b/res/layout/hidden_apps_list_item.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<com.android.launcher3.widget.CheckableLinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="48dp" + android:gravity="center_vertical" + android:paddingRight="?android:attr/scrollbarSize" + android:background="?android:attr/selectableItemBackground" + android:descendantFocusability="blocksDescendants"> + + <ImageView android:id="@+id/icon" + android:layout_width="40dp" + android:layout_height="40dp" + android:layout_gravity="center" /> + + <TextView android:id="@+id/title" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginLeft="15dip" + android:layout_marginRight="6dip" + android:layout_marginTop="6dip" + android:layout_marginBottom="6dip" + android:layout_weight="1" + android:singleLine="true" + android:textAppearance="?android:attr/textAppearanceMedium" + android:ellipsize="marquee" + android:fadingEdge="horizontal" /> + + <com.android.launcher3.widget.InertCheckBox android:id="@+id/checkbox" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + +</com.android.launcher3.widget.CheckableLinearLayout>
\ No newline at end of file diff --git a/res/values-af/cm_strings.xml b/res/values-af/cm_strings.xml index e05069294..866924345 100644 --- a/res/values-af/cm_strings.xml +++ b/res/values-af/cm_strings.xml @@ -23,7 +23,7 @@ <string name="transition_effect_button_text">Rol effek</string> <string name="sort_mode_title">Titel</string> <string name="sort_mode_launch_count">Begin telling</string> - <string name="sort_mode_install_time">Installerings tyd</string> + <string name="sort_mode_install_time">Iinstalleer tyd</string> <string name="scrolling_page_outlines">Bladsy buitelyne</string> <string name="scrolling_fade_adjacent">Vervaag kant bladsye</string> <string name="wallpaper_scroll">Rol muurpapier</string> diff --git a/res/values-ar/cm_arrays.xml b/res/values-ar/cm_arrays.xml new file mode 100644 index 000000000..97cd1b0ba --- /dev/null +++ b/res/values-ar/cm_arrays.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.net--> +<!-- + Copyright (C) 2014 The CyanogenMod 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. +--> +<resources> + <string-array name="preferences_interface_general_icons_text_font_family_entries"> + <item>العادية</item> + <item>فاتح</item> + <item>مكثف</item> + </string-array> + <string-array name="transition_effect_entries"> + <item>لا شيء</item> + <item>تكبير</item> + <item>تصغير</item> + <item>تدوير للأعلى</item> + <item>تدوير لأسفل</item> + <item>مكعب لداخل</item> + <item>مكعب للخارج</item> + <item>جميع</item> + <item>Accordion</item> + <item>لف</item> + <item>اسطوانة الداخل</item> + <item>اسطوانة الخارج</item> + <item>دائري</item> + <item>نظرة عامّة</item> + </string-array> +</resources> diff --git a/res/values-ar/cm_strings.xml b/res/values-ar/cm_strings.xml new file mode 100644 index 000000000..c701b720c --- /dev/null +++ b/res/values-ar/cm_strings.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.net--> +<!-- + Copyright (C) 2014 The CyanogenMod 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. +--> +<resources> + <string name="application_copyright">حقوق الطبع والنشر \u00A9 2013 لي مشروع CyanogenMod</string> + <string name="sort_button_text">ترتيب</string> + <string name="filter_button_text">التصفية</string> + <string name="default_screen_button_text">الشاشة الافتراضية</string> + <string name="transition_effect_button_text">تأثير التمرير</string> + <string name="sort_mode_title">العنوان</string> + <string name="sort_mode_launch_count">عداد الإنطلاق</string> + <string name="sort_mode_install_time">وقت التثبيت</string> + <string name="scrolling_page_outlines">الخطوط العريضة لي الصفحة</string> + <string name="scrolling_fade_adjacent">تتلاشى الصفحات الجانبية</string> + <string name="wallpaper_scroll">تمرير الخلفية</string> + <string name="preferences_title">إعدادات</string> + <string name="preferences_application_title">التطبيق</string> + <string name="preferences_interface_homescreen_title">الشاشة الرئيسية</string> + <string name="preferences_interface_homescreen_search_title">شريط البحث</string> + <string name="preferences_interface_homescreen_search_summary">إستمرار إظهار شريط البحث في أعلى الشاشة</string> + <string name="preferences_interface_drawer_title">السحاب</string> + <string name="preferences_interface_dock_title">حوض</string> + <string name="preferences_interface_general_title">عام</string> + <string name="preferences_interface_general_icons_category">أيقونات</string> + <string name="preferences_interface_general_icons_large_title">أيقونات كبيرة</string> + <string name="preferences_interface_general_icons_large_summary">استخدام الرموز إضافية كبيرة لي التطبيق في الشاشة الرئيسية و السحاب</string> + <string name="preferences_interface_general_icons_text_style_title">نمط خط النص</string> + <string name="preferences_interface_general_icons_text_style_summary">شكل ونمط الخط لاستخدامه لرمز النص</string> + <string name="dialog_pick_iconpack_title">اختر حزمة الأيقونة</string> + <string name="default_iconpack_title">الإيقونات الافتراضية</string> + <string name="icon_packs_title">حزم الإيقونات</string> + <string name="no_iconpacks_summary">لا توجد حزم أيقونات لتثبيت</string> + <string name="all_apps_cling_cm">تخصيص السحاب</string> + <string name="all_apps_cling_summary">انقر فوق مؤشر الصفحة لعرض إعدادات التكوين الإضافي</string> +</resources> diff --git a/res/values-cs/cm_strings.xml b/res/values-cs/cm_strings.xml index 556317b40..a298ba60a 100644 --- a/res/values-cs/cm_strings.xml +++ b/res/values-cs/cm_strings.xml @@ -19,7 +19,7 @@ <string name="application_copyright">Copyright \u00A9 2014 CyanogenMod projekt</string> <string name="sort_button_text">Třídit</string> <string name="filter_button_text">Filtr</string> - <string name="default_screen_button_text">Výchozí plocha</string> + <string name="default_screen_button_text">Výchozí obrazovka</string> <string name="transition_effect_button_text">Efekt přechodu</string> <string name="sort_mode_title">Název</string> <string name="sort_mode_launch_count">Počet spuštění</string> diff --git a/res/values-fr/cm_arrays.xml b/res/values-fr/cm_arrays.xml index b26bf1f3b..15ef135ee 100644 --- a/res/values-fr/cm_arrays.xml +++ b/res/values-fr/cm_arrays.xml @@ -18,11 +18,11 @@ <resources> <string-array name="preferences_interface_general_icons_text_font_family_entries"> <item>Régulier</item> - <item>Light</item> + <item>Léger</item> <item>Condensé</item> </string-array> <string-array name="transition_effect_entries"> - <item>None</item> + <item>Aucun</item> <item>Zoom avant</item> <item>Zoom arrière</item> <item>Rotation vers le haut</item> diff --git a/res/values-fr/cm_strings.xml b/res/values-fr/cm_strings.xml index 19affe122..ea5d6de13 100644 --- a/res/values-fr/cm_strings.xml +++ b/res/values-fr/cm_strings.xml @@ -23,16 +23,18 @@ <string name="transition_effect_button_text">Effet de défilement</string> <string name="sort_mode_title">Titre</string> <string name="sort_mode_launch_count">Nombre de lancements</string> - <string name="sort_mode_install_time">Temps d\'installation</string> + <string name="sort_mode_install_time">Durée d\'installation</string> <string name="scrolling_page_outlines">Espacement des pages</string> <string name="scrolling_fade_adjacent">Estomper les pages adjacentes</string> <string name="wallpaper_scroll">Défilement du fond d\'écran</string> + <string name="preferences_title">Paramètres</string> <string name="preferences_application_title">Application</string> <string name="preferences_interface_homescreen_title">Écran d\'accueil</string> <string name="preferences_interface_homescreen_search_title">Barre de recherche</string> <string name="preferences_interface_homescreen_search_summary">Afficher la barre de recherche persistante en haut de l\'écran</string> <string name="preferences_interface_drawer_title">Liste d\'applications</string> <string name="preferences_interface_dock_title">Dock</string> + <string name="preferences_interface_general_title">Général</string> <string name="preferences_interface_general_icons_category">Icônes</string> <string name="preferences_interface_general_icons_large_title">Grandes icônes</string> <string name="preferences_interface_general_icons_large_summary">Utiliser des icônes extra-larges dans l\'écran d\'accueil et la liste d\'applications</string> diff --git a/res/values-hu/cm_arrays.xml b/res/values-hu/cm_arrays.xml index fa7e1e182..e7b15fe2c 100644 --- a/res/values-hu/cm_arrays.xml +++ b/res/values-hu/cm_arrays.xml @@ -18,11 +18,11 @@ <resources> <string-array name="preferences_interface_general_icons_text_font_family_entries"> <item>Szokásos</item> - <item>Light</item> + <item>Világos</item> <item>Tömörített</item> </string-array> <string-array name="transition_effect_entries"> - <item>None</item> + <item>Nincs</item> <item>Nagyítás befelé</item> <item>Nagyítás kifelé</item> <item>Forgatás felfelé</item> diff --git a/res/values-hu/cm_strings.xml b/res/values-hu/cm_strings.xml index 2f23226fb..ff2bad920 100644 --- a/res/values-hu/cm_strings.xml +++ b/res/values-hu/cm_strings.xml @@ -27,12 +27,14 @@ <string name="scrolling_page_outlines">Oldal körvonalak</string> <string name="scrolling_fade_adjacent">Elhalványuló váltás az oldalak közt</string> <string name="wallpaper_scroll">Háttérkép görgetése</string> + <string name="preferences_title">Beállítások</string> <string name="preferences_application_title">Alkamazás</string> <string name="preferences_interface_homescreen_title">Kezdőképernyő</string> <string name="preferences_interface_homescreen_search_title">Keresési sáv</string> <string name="preferences_interface_homescreen_search_summary">Állandó keresési sáv megjelenítése a képernyő felső </string> <string name="preferences_interface_drawer_title">Alkalmazásképernyők</string> <string name="preferences_interface_dock_title">Dokkoló</string> + <string name="preferences_interface_general_title">Általános</string> <string name="preferences_interface_general_icons_category">Ikonok</string> <string name="preferences_interface_general_icons_large_title">Nagyobb ikonok</string> <string name="preferences_interface_general_icons_large_summary">Extra méretű ikonok a kezdő ill. alkalmazás képernyőkön</string> diff --git a/res/values-it/cm_strings.xml b/res/values-it/cm_strings.xml index 5b4ed27fd..5e388d740 100644 --- a/res/values-it/cm_strings.xml +++ b/res/values-it/cm_strings.xml @@ -22,7 +22,7 @@ <string name="default_screen_button_text">Schermata predefinita</string> <string name="transition_effect_button_text">Effetto scorrimento</string> <string name="sort_mode_title">Titolo</string> - <string name="sort_mode_launch_count">Conteggio avvio</string> + <string name="sort_mode_launch_count">Numero avvii</string> <string name="sort_mode_install_time">Tempo installazione</string> <string name="scrolling_page_outlines">Contorni pagina</string> <string name="scrolling_fade_adjacent">Dissolvenza pagine laterali</string> diff --git a/res/values-iw/cm_strings.xml b/res/values-iw/cm_strings.xml index 2056c8915..32e38a205 100644 --- a/res/values-iw/cm_strings.xml +++ b/res/values-iw/cm_strings.xml @@ -22,7 +22,7 @@ <string name="default_screen_button_text">מסך ברירת מחדל</string> <string name="transition_effect_button_text">אפקט גלילה</string> <string name="sort_mode_title">כותרת</string> - <string name="sort_mode_launch_count">הפעל ספירה</string> + <string name="sort_mode_launch_count">מספר הפעלות</string> <string name="sort_mode_install_time">זמן התקנה</string> <string name="scrolling_page_outlines">תיאור דף</string> <string name="wallpaper_scroll">גלילת טפט</string> diff --git a/res/values-ja/cm_strings.xml b/res/values-ja/cm_strings.xml index bddeece9c..c32c7969c 100644 --- a/res/values-ja/cm_strings.xml +++ b/res/values-ja/cm_strings.xml @@ -45,5 +45,5 @@ <string name="icon_packs_title">アイコンパック</string> <string name="no_iconpacks_summary">アイコンパックがインストールされていません</string> <string name="all_apps_cling_cm">ドロワーをカスタマイズ</string> - <string name="all_apps_cling_summary">追加の構成設定を表示するには、ページインジケーターをタップします。</string> + <string name="all_apps_cling_summary">追加の構成設定を表示するには、ページインジケータをタップします。</string> </resources> diff --git a/res/values-lt/cm_arrays.xml b/res/values-lt/cm_arrays.xml new file mode 100644 index 000000000..47465cbdc --- /dev/null +++ b/res/values-lt/cm_arrays.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.net--> +<!-- + Copyright (C) 2014 The CyanogenMod 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. +--> +<resources> + <string-array name="preferences_interface_general_icons_text_font_family_entries"> + <item>Įprastas</item> + <item>Plonas</item> + <item>Suglaustas</item> + </string-array> + <string-array name="transition_effect_entries"> + <item>Joks</item> + <item>Padidinti</item> + <item>Pamažinti</item> + <item>Pasukti aukštyn</item> + <item>Pasukti žemyn</item> + <item>Kubo vidus</item> + <item>Kubo išorė</item> + <item>Krūva</item> + <item>Akordeonas</item> + <item>Apversti</item> + <item>Cilindro vidus</item> + <item>Cilindro išorė</item> + <item>Karuselė</item> + <item>Apžvalga</item> + </string-array> +</resources> diff --git a/res/values-lt/cm_strings.xml b/res/values-lt/cm_strings.xml new file mode 100644 index 000000000..9f046b2e1 --- /dev/null +++ b/res/values-lt/cm_strings.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.net--> +<!-- + Copyright (C) 2014 The CyanogenMod 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. +--> +<resources> + <string name="application_copyright">Autorinės teisės \u00A9 2014 „CyanogenMod“ projektas</string> + <string name="sort_button_text">Rūšiuoti</string> + <string name="filter_button_text">Filtras</string> + <string name="default_screen_button_text">Numatytasis ekranas</string> + <string name="transition_effect_button_text">Slinkimo efektas</string> + <string name="sort_mode_title">Pavadinimas</string> + <string name="sort_mode_launch_count">Paleidimų kiekis</string> + <string name="sort_mode_install_time">Įdiegimo laikas</string> + <string name="scrolling_page_outlines">Puslapio kontūrai</string> + <string name="scrolling_fade_adjacent">Išblukinti šoninius ekranus</string> + <string name="wallpaper_scroll">Slinkti foną</string> + <string name="preferences_title">Nustatymai</string> + <string name="preferences_application_title">Programa</string> + <string name="preferences_interface_homescreen_title">Pagrindinis ekranas</string> + <string name="preferences_interface_homescreen_search_title">Paieškos juosta</string> + <string name="preferences_interface_homescreen_search_summary">Rodyti nuolatinę paieškos juostą ekrano viršuje</string> + <string name="preferences_interface_drawer_title">Stalčius</string> + <string name="preferences_interface_dock_title">Dokas</string> + <string name="preferences_interface_general_title">Bendra</string> + <string name="preferences_interface_general_icons_category">Piktogramos</string> + <string name="preferences_interface_general_icons_large_title">Didesnės piktogramos</string> + <string name="preferences_interface_general_icons_large_summary">Naudoti didesnes programų piktogramas pagrindiniame ekrane ir stalčiuje</string> + <string name="preferences_interface_general_icons_text_style_title">Teksto šrifto stilius</string> + <string name="preferences_interface_general_icons_text_style_summary">Piktogramos teksto šrifto variantas ir stilius</string> + <string name="dialog_pick_iconpack_title">Pasirinkti piktogramų paketą</string> + <string name="default_iconpack_title">Numatytosios piktogramos</string> + <string name="icon_packs_title">Piktogramų paketai</string> + <string name="no_iconpacks_summary">Piktogramų paketai neįdiegti</string> + <string name="all_apps_cling_cm">Tinkinti savo stalčių</string> + <string name="all_apps_cling_summary">Bakstelėkite puslapio indikatorių norėdami peržiūrėti papildomus konfigūracijos nustatymus</string> +</resources> diff --git a/res/values-nl/cm_strings.xml b/res/values-nl/cm_strings.xml index 65e40748e..30ee40934 100644 --- a/res/values-nl/cm_strings.xml +++ b/res/values-nl/cm_strings.xml @@ -40,10 +40,10 @@ <string name="preferences_interface_general_icons_large_summary">Extra grote pictogrammen gebruiken voor apps op het startscherm en in het overzicht</string> <string name="preferences_interface_general_icons_text_style_title">Lettertypestijl</string> <string name="preferences_interface_general_icons_text_style_summary">Stijl van tekst bij pictogrammen</string> - <string name="dialog_pick_iconpack_title">Pictogrammenpakket kiezen</string> + <string name="dialog_pick_iconpack_title">Pictogrampakket kiezen</string> <string name="default_iconpack_title">Standaard</string> - <string name="icon_packs_title">Pictogrammen\npakketten</string> - <string name="no_iconpacks_summary">Geen pictogrammenpakketten geïnstalleerd</string> + <string name="icon_packs_title">Pictogram\npakket</string> + <string name="no_iconpacks_summary">Geen pictogrampakketten geïnstalleerd</string> <string name="all_apps_cling_cm">App-overzicht aanpassen</string> <string name="all_apps_cling_summary">Tik op de pagina-indicator voor extra instellingen</string> </resources> diff --git a/res/values-pt-rBR/cm_strings.xml b/res/values-pt-rBR/cm_strings.xml index 01590da37..573021061 100644 --- a/res/values-pt-rBR/cm_strings.xml +++ b/res/values-pt-rBR/cm_strings.xml @@ -19,11 +19,11 @@ <string name="application_copyright">Copyright \u00A9 2014 The CyanogenMod Project</string> <string name="sort_button_text">Ordenar</string> <string name="filter_button_text">Filtrar</string> - <string name="default_screen_button_text">Tela Padrão</string> - <string name="transition_effect_button_text">Efeito de Rolagem</string> + <string name="default_screen_button_text">Tela padrão</string> + <string name="transition_effect_button_text">Efeito de rolagem</string> <string name="sort_mode_title">Título</string> - <string name="sort_mode_launch_count">Contagem de inicialização</string> - <string name="sort_mode_install_time">Tempo de Instalação</string> + <string name="sort_mode_launch_count">Contador de inicialização</string> + <string name="sort_mode_install_time">Hora da instalação</string> <string name="scrolling_page_outlines">Contorno de página</string> <string name="scrolling_fade_adjacent">Esmaecer páginas laterais</string> <string name="wallpaper_scroll">Rolar papel de parede</string> diff --git a/res/values-pt-rPT/cm_arrays.xml b/res/values-pt-rPT/cm_arrays.xml index 91d707262..c720a9ef3 100644 --- a/res/values-pt-rPT/cm_arrays.xml +++ b/res/values-pt-rPT/cm_arrays.xml @@ -17,7 +17,7 @@ --> <resources> <string-array name="preferences_interface_general_icons_text_font_family_entries"> - <item>Regular</item> + <item>Normal</item> <item>Fino</item> <item>Condensado</item> </string-array> diff --git a/res/values-pt-rPT/cm_strings.xml b/res/values-pt-rPT/cm_strings.xml index 6376c63f5..980ee22c6 100644 --- a/res/values-pt-rPT/cm_strings.xml +++ b/res/values-pt-rPT/cm_strings.xml @@ -20,7 +20,7 @@ <string name="sort_button_text">Ordenar</string> <string name="filter_button_text">Filtrar</string> <string name="default_screen_button_text">Ecrã Padrão</string> - <string name="transition_effect_button_text">Efeito de deslocamento</string> + <string name="transition_effect_button_text">Efeito de transição</string> <string name="sort_mode_title">Título</string> <string name="sort_mode_launch_count">Contagem de inicializações</string> <string name="sort_mode_install_time">Data de instalação</string> diff --git a/res/values-ru/cm_strings.xml b/res/values-ru/cm_strings.xml index 7b84ade59..d3009928c 100644 --- a/res/values-ru/cm_strings.xml +++ b/res/values-ru/cm_strings.xml @@ -20,7 +20,7 @@ <string name="sort_button_text">Сортировка</string> <string name="filter_button_text">Фильтрация</string> <string name="default_screen_button_text">Экран по умолчанию</string> - <string name="transition_effect_button_text">Эффект перехода</string> + <string name="transition_effect_button_text">Эффект прокрутки</string> <string name="sort_mode_title">По названию</string> <string name="sort_mode_launch_count">По частоте использования</string> <string name="sort_mode_install_time">По времени установки</string> diff --git a/res/values-sr/cm_arrays.xml b/res/values-sr/cm_arrays.xml new file mode 100644 index 000000000..d64210d3f --- /dev/null +++ b/res/values-sr/cm_arrays.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.net--> +<!-- + Copyright (C) 2014 The CyanogenMod 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. +--> +<resources> + <string-array name="preferences_interface_general_icons_text_font_family_entries"> + <item>Обично</item> + <item>Светло</item> + <item>Кондензовано</item> + </string-array> + <string-array name="transition_effect_entries"> + <item>Без ефекта</item> + <item>Увећај</item> + <item>Умањи</item> + <item>Ротирај нагоре</item> + <item>Ротирај надоле</item> + <item>Коцка унутра</item> + <item>Коцка споља</item> + <item>Фабрички</item> + <item>Хармонијски</item> + <item>Флип</item> + <item>Цилиндар унутра</item> + <item>Цилиндар споља</item> + <item>Рингишпил</item> + <item>Прегледно</item> + </string-array> +</resources> diff --git a/res/values-sr/cm_strings.xml b/res/values-sr/cm_strings.xml new file mode 100644 index 000000000..94b204b37 --- /dev/null +++ b/res/values-sr/cm_strings.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.net--> +<!-- + Copyright (C) 2014 The CyanogenMod 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. +--> +<resources> + <string name="application_copyright">Copyright \u00A9 2014 The CyanogenMod Project</string> + <string name="sort_button_text">Врста</string> + <string name="filter_button_text">Филтер</string> + <string name="default_screen_button_text">Подразумевани екран</string> + <string name="transition_effect_button_text">Ефекат скроловања</string> + <string name="sort_mode_title">Наслов</string> + <string name="sort_mode_launch_count">Тачка покретања</string> + <string name="sort_mode_install_time">Време инсталирања</string> + <string name="scrolling_page_outlines">Контура странице</string> + <string name="scrolling_fade_adjacent">Замагљени крајеви страница</string> + <string name="wallpaper_scroll">Скроловање позадине</string> + <string name="preferences_title">Подешавања</string> + <string name="preferences_application_title">Апликације</string> + <string name="preferences_interface_homescreen_title">Почетни екран</string> + <string name="preferences_interface_homescreen_search_title">Табла за претраживање</string> + <string name="preferences_interface_homescreen_search_summary">Покажите упорну таблу за претраживање на врху екрана</string> + <string name="preferences_interface_drawer_title">Фиока</string> + <string name="preferences_interface_dock_title">Доцк</string> + <string name="preferences_interface_general_title">Oпште</string> + <string name="preferences_interface_general_icons_category">Иконе</string> + <string name="preferences_interface_general_icons_large_title">Веће иконе</string> + <string name="preferences_interface_general_icons_large_summary">Користите екстра велике апликационе иконе на почетном екрану и у фиоци</string> + <string name="preferences_interface_general_icons_text_style_title">Стил фонта текста</string> + <string name="preferences_interface_general_icons_text_style_summary">Варијанту и стил фонта користити за текст на иконама</string> + <string name="dialog_pick_iconpack_title">Одаберите пакет икона</string> + <string name="default_iconpack_title">Подразумеване иконе</string> + <string name="icon_packs_title">Пакети икона</string> + <string name="no_iconpacks_summary">Нема инсталираних пакета са иконама</string> + <string name="all_apps_cling_cm">Прилагодите фиоку</string> + <string name="all_apps_cling_summary">Додирните индикатор странице да видите додатна подешавања конфигурације</string> +</resources> diff --git a/res/values-tr/cm_strings.xml b/res/values-tr/cm_strings.xml index 266d2e9cb..fc9bd2eef 100644 --- a/res/values-tr/cm_strings.xml +++ b/res/values-tr/cm_strings.xml @@ -19,11 +19,7 @@ <string name="application_copyright">Telif Hakkı \u00A9 2014 CyanogenMod Projesi</string> <string name="sort_button_text">Sırala</string> <string name="filter_button_text">Filtrele</string> - <string name="default_screen_button_text">Varsayılan Ekran</string> - <string name="transition_effect_button_text">Kaydırma Efekti</string> <string name="sort_mode_title">Başlık</string> - <string name="sort_mode_launch_count">Çalıştırma Sayısı</string> - <string name="sort_mode_install_time">Kurulum Zamanı</string> <string name="scrolling_page_outlines">Sayfa anahatları</string> <string name="scrolling_fade_adjacent">Yan sayfaları soldur</string> <string name="wallpaper_scroll">Duvarkağıdını kaydır</string> diff --git a/res/values-zh-rCN/cm_arrays.xml b/res/values-zh-rCN/cm_arrays.xml new file mode 100644 index 000000000..0e02c2853 --- /dev/null +++ b/res/values-zh-rCN/cm_arrays.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Generated by crowdin.net--> +<!-- + Copyright (C) 2014 The CyanogenMod 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. +--> +<resources> + <string-array name="preferences_interface_general_icons_text_font_family_entries"> + <item>常规</item> + <item>Light</item> + <item>Condensed</item> + </string-array> + <string-array name="transition_effect_entries"> + <item>无</item> + <item>放大</item> + <item>缩小</item> + <item>向上旋转</item> + <item>向下旋转</item> + <item>立方体内部</item> + <item>立方体外部</item> + <item>堆叠</item> + <item>手风琴</item> + <item>翻转</item> + <item>圆柱体内部</item> + <item>圆柱体外部</item> + <item>旋转木马</item> + <item>概览</item> + </string-array> +</resources> diff --git a/res/values-zh-rCN/cm_strings.xml b/res/values-zh-rCN/cm_strings.xml index 338f166ae..d1d8cda25 100644 --- a/res/values-zh-rCN/cm_strings.xml +++ b/res/values-zh-rCN/cm_strings.xml @@ -27,6 +27,7 @@ <string name="scrolling_page_outlines">页概述</string> <string name="scrolling_fade_adjacent">边页淡出</string> <string name="wallpaper_scroll">滚动壁纸</string> + <string name="preferences_title">设置</string> <string name="preferences_application_title">应用程序</string> <string name="preferences_interface_homescreen_title">主屏</string> <string name="preferences_interface_homescreen_search_title">搜索栏</string> diff --git a/res/layout/tab_widget_indicator.xml b/res/values-zh-rHK/cm_strings.xml index de7c50ec4..fe9706723 100644 --- a/res/layout/tab_widget_indicator.xml +++ b/res/values-zh-rHK/cm_strings.xml @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2011 The Android Open Source Project +<!--Generated by crowdin.net--> +<!-- + Copyright (C) 2014 The CyanogenMod Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -13,7 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. --> - -<com.android.launcher3.AccessibleTabView - xmlns:android="http://schemas.android.com/apk/res/android" - style="@style/TabIndicator.AppsCustomize" /> +<resources> + <string name="application_copyright">版權所有 \u00A9 2013年 CyanogenMod 計畫</string> + <string name="default_screen_button_text">預設螢幕</string> + <string name="sort_mode_launch_count">啟動次數</string> + <string name="wallpaper_scroll">滾動牆紙</string> + <string name="default_iconpack_title">預設圖示</string> +</resources> diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 33da3d2e9..7f5de470f 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -52,9 +52,21 @@ <string name="preferences_interface_homescreen_title">Homescreen</string> <string name="preferences_interface_homescreen_search_title">Search bar</string> <string name="preferences_interface_homescreen_search_summary">Show persistent search bar at top of screen</string> + <string name="preferences_interface_homescreen_general_hide_icon_labels_title">Hide icon labels</string> + <string name="preferences_interface_homescreen_general_hide_icon_labels_summary">Hide icon labels on homescreen</string> <!-- Drawer --> <string name="preferences_interface_drawer_title">Drawer</string> + <string name="preferences_interface_drawer_summary">Apps and widgets drawer</string> + <string name="preferences_interface_drawer_apps_category">Apps</string> + <string name="preferences_interface_drawer_hidden_apps_title">Hidden apps</string> + <string name="preferences_interface_drawer_hidden_apps_summary">Hide apps from the drawer</string> + <string name="preferences_interface_drawer_hidden_apps_shortcuts_title">Remove shortcuts</string> + <string name="preferences_interface_drawer_hidden_apps_shortcuts_summary">Remove the shortcuts of hidden apps from the homescreen</string> + <string name="preferences_interface_drawer_hidden_apps_widgets_title">Remove widgets</string> + <string name="preferences_interface_drawer_hidden_apps_widgets_summary">Remove the widgets of hidden apps from the homescreen</string> + <string name="preferences_interface_drawer_hide_icon_labels_title">Hide icon labels</string> + <string name="preferences_interface_drawer_hide_icon_labels_summary">Hide icon labels in drawer</string> <!-- Dock --> <string name="preferences_interface_dock_title">Dock</string> @@ -78,4 +90,10 @@ <string name="all_apps_cling_cm">Customize your drawer</string> <!-- The description of how to access Trebuchet settings [CHAR_LIMIT=160] --> <string name="all_apps_cling_summary">Tap the page indicator to view additional configuration settings</string> + + <!-- Noun, menu item used to reset hidden apps list --> + <string name="menu_hidden_apps_delete">Reset</string> + + <!-- Hidden apps --> + <string name="hidden_apps_title">Hidden apps</string> </resources> diff --git a/res/values/preferences_defaults.xml b/res/values/preferences_defaults.xml index 288157381..98f571229 100644 --- a/res/values/preferences_defaults.xml +++ b/res/values/preferences_defaults.xml @@ -5,9 +5,13 @@ <bool name="preferences_interface_homescreen_scrolling_wallpaper_scroll_default">true</bool> <bool name="preferences_interface_homescreen_scrolling_page_outlines_default">@bool/config_workspaceDefaultShowOutlines</bool> <bool name="preferences_interface_homescreen_scrolling_fade_adjacent_default">@bool/config_workspaceFadeAdjacentScreens</bool> + <bool name="preferences_interface_homescreen_hide_icon_labels">false</bool> <string name="preferences_interface_drawer_scrolling_transition_effect">stack</string> <bool name="preferences_interface_drawer_scrolling_fade_adjacent_default">false</bool> + <bool name="preferences_interface_drawer_remove_hidden_apps_shortcuts_default">true</bool> + <bool name="preferences_interface_drawer_remove_hidden_apps_widgets_default">true</bool> + <bool name="preferences_interface_drawer_hide_icon_labels_default">false</bool> <bool name="preferences_interface_general_icons_large_default">@bool/config_largeIcons</bool> <string name="preferences_interface_general_icons_text_font_family_default">sans-serif-condensed</string> <integer name="preferences_interface_general_icons_text_font_style_default">0</integer> -</resources>
\ No newline at end of file +</resources> diff --git a/res/xml/preferences_drawer.xml b/res/xml/preferences_drawer.xml new file mode 100644 index 000000000..b22597516 --- /dev/null +++ b/res/xml/preferences_drawer.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 The Android Open Source 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. +--> + +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher3" + android:key="ui_drawer" + android:title="@string/preferences_interface_drawer_title"> + <PreferenceCategory android:title="@string/preferences_interface_drawer_apps_category"> + <Preference android:key="ui_drawer_hidden_apps" + android:title="@string/preferences_interface_drawer_hidden_apps_title" + android:summary="@string/preferences_interface_drawer_hidden_apps_summary"> + <intent android:action=".settings.HiddenAppsActivity"/> + </Preference> + <CheckBoxPreference android:key="ui_drawer_remove_hidden_apps_shortcuts" + android:title="@string/preferences_interface_drawer_hidden_apps_shortcuts_title" + android:summary="@string/preferences_interface_drawer_hidden_apps_shortcuts_summary" + android:defaultValue="@bool/preferences_interface_drawer_remove_hidden_apps_shortcuts_default" /> + <CheckBoxPreference android:key="ui_drawer_remove_hidden_apps_widgets" + android:title="@string/preferences_interface_drawer_hidden_apps_widgets_title" + android:summary="@string/preferences_interface_drawer_hidden_apps_widgets_summary" + android:defaultValue="@bool/preferences_interface_drawer_remove_hidden_apps_widgets_default" /> + </PreferenceCategory> + <PreferenceCategory android:title="@string/preferences_interface_general_icons_category"> + <CheckBoxPreference android:key="ui_drawer_hide_icon_labels" + android:title="@string/preferences_interface_drawer_hide_icon_labels_title" + android:summary="@string/preferences_interface_drawer_hide_icon_labels_summary" + android:defaultValue="@bool/preferences_interface_drawer_hide_icon_labels_default" /> + </PreferenceCategory> +</PreferenceScreen>
\ No newline at end of file diff --git a/res/xml/preferences_headers.xml b/res/xml/preferences_headers.xml index bc919b2d5..42a08a9bd 100644 --- a/res/xml/preferences_headers.xml +++ b/res/xml/preferences_headers.xml @@ -20,20 +20,22 @@ android:fragment="com.android.launcher3.settings.SettingsActivity$HomescreenFragment" android:title="@string/preferences_interface_homescreen_title" /> - <!--<header android:id="@+id/preferences_drawer_section" - android:title="@string/preferences_interface_drawer_title" /> - - <header android:id="@+id/preferences_dock_section" + <header android:id="@+id/preferences_drawer_section" + android:fragment="com.android.launcher3.settings.SettingsActivity$DrawerFragment" + android:title="@string/preferences_interface_drawer_title" + android:summary="@string/preferences_interface_drawer_summary" /> + + <!--<header android:id="@+id/preferences_dock_section" android:title="@string/preferences_interface_dock_title" />--> - + <header android:id="@+id/preferences_general_section" android:fragment="com.android.launcher3.settings.SettingsActivity$GeneralFragment" android:title="@string/preferences_interface_general_title" /> - + <header android:id="@+id/preferences_application_section" - android:title="@string/preferences_application_title" /> - + android:title="@string/preferences_application_title" /> + <header android:id="@+id/preferences_application_version" - android:summary="@string/application_copyright" /> + android:summary="@string/application_copyright" /> </preference-headers> diff --git a/res/xml/preferences_homescreen.xml b/res/xml/preferences_homescreen.xml index 8b2652b9a..4671a8a4a 100644 --- a/res/xml/preferences_homescreen.xml +++ b/res/xml/preferences_homescreen.xml @@ -22,4 +22,8 @@ android:title="@string/preferences_interface_homescreen_search_title" android:summary="@string/preferences_interface_homescreen_search_summary" android:defaultValue="@bool/preferences_interface_homescreen_search_default" /> + <CheckBoxPreference android:key="ui_homescreen_general_hide_icon_labels" + android:title="@string/preferences_interface_homescreen_general_hide_icon_labels_title" + android:summary="@string/preferences_interface_homescreen_general_hide_icon_labels_summary" + android:defaultValue="@bool/preferences_interface_homescreen_hide_icon_labels" /> </PreferenceScreen> diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java index 28bc4e477..7e67f7c60 100644 --- a/src/com/android/launcher3/AppsCustomizePagedView.java +++ b/src/com/android/launcher3/AppsCustomizePagedView.java @@ -27,6 +27,7 @@ import android.appwidget.AppWidgetProviderInfo; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageManager; +import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.content.res.TypedArray; @@ -175,6 +176,11 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } private SortMode mSortMode = SortMode.Title; + private int mFilterApps = FILTER_APPS_SYSTEM_FLAG | FILTER_APPS_DOWNLOADED_FLAG; + + private static final int FILTER_APPS_SYSTEM_FLAG = 1; + private static final int FILTER_APPS_DOWNLOADED_FLAG = 2; + // Refs private Launcher mLauncher; private DragController mDragController; @@ -189,6 +195,11 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen private ArrayList<AppInfo> mApps; private ArrayList<Object> mWidgets; + private ArrayList<AppInfo> mFilteredApps; + private ArrayList<Object> mFilteredWidgets; + private ArrayList<ComponentName> mHiddenApps; + private ArrayList<String> mHiddenPackages; + // Cling private boolean mHasShownAllAppsCling; private int mClingFocusedX; @@ -279,7 +290,9 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen mLayoutInflater = LayoutInflater.from(context); mPackageManager = context.getPackageManager(); mApps = new ArrayList<AppInfo>(); + mFilteredApps = new ArrayList<AppInfo>(); mWidgets = new ArrayList<Object>(); + mFilteredWidgets = new ArrayList<Object>(); mIconCache = (LauncherAppState.getInstance()).getIconCache(); mCanvas = new Canvas(); mRunningTasks = new ArrayList<AppsCustomizeAsyncTask>(); @@ -309,6 +322,18 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES); } + + String[] flattened = SettingsProvider.getStringCustomDefault(context, + SettingsProvider.SETTINGS_UI_DRAWER_HIDDEN_APPS, "").split("\\|"); + mHiddenApps = new ArrayList<ComponentName>(flattened.length); + mHiddenPackages = new ArrayList<String>(flattened.length); + for (String flat : flattened) { + ComponentName cmp = ComponentName.unflattenFromString(flat); + if (cmp != null) { + mHiddenApps.add(cmp); + mHiddenPackages.add(cmp.getPackageName()); + } + } } @Override @@ -351,7 +376,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen i = (currentPage * numItemsPerPage) + (childCount / 2); } } else if (mContentType == ContentType.Widgets) { - int numApps = mApps.size(); + int numApps = mFilteredApps.size(); PagedViewGridLayout layout = (PagedViewGridLayout) getPageAt(currentPage); int numItemsPerPage = mWidgetCountX * mWidgetCountY; int childCount = layout.getChildCount(); @@ -379,12 +404,12 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen int getPageForComponent(int index) { if (index < 0) return 0; - if (index < mApps.size()) { + if (index < mFilteredApps.size()) { int numItemsPerPage = mCellCountX * mCellCountY; return (index / numItemsPerPage); } else { int numItemsPerPage = mWidgetCountX * mWidgetCountY; - return (index - mApps.size()) / numItemsPerPage; + return (index - mFilteredApps.size()) / numItemsPerPage; } } @@ -395,9 +420,9 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } private void updatePageCounts() { - mNumWidgetPages = (int) Math.ceil(mWidgets.size() / - (float) (mWidgetCountX * mWidgetCountY)); - mNumAppsPages = (int) Math.ceil((float) mApps.size() / (mCellCountX * mCellCountY)); + mNumWidgetPages = (int) Math.ceil((float) mFilteredWidgets.size() + / (mWidgetCountX * mWidgetCountY)); + mNumAppsPages = (int) Math.ceil((float) mFilteredApps.size() / (mCellCountX * mCellCountY)); } protected void onDataReady(int width, int height) { @@ -462,7 +487,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen int width = MeasureSpec.getSize(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); if (!isDataReady()) { - if ((DISABLE_ALL_APPS || !mApps.isEmpty()) && !mWidgets.isEmpty()) { + if ((DISABLE_ALL_APPS || !mFilteredApps.isEmpty()) && !mFilteredWidgets.isEmpty()) { setDataIsReady(); setMeasuredDimension(width, height); onDataReady(width, height); @@ -507,7 +532,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen mWidgets.add(o); } } - updatePageCountsAndInvalidateData(); + filterWidgets(); } public void setBulkBind(boolean bulkBind) { @@ -1083,17 +1108,21 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen final boolean isRtl = isLayoutRtl(); int numCells = mCellCountX * mCellCountY; int startIndex = page * numCells; - int endIndex = Math.min(startIndex + numCells, mApps.size()); + int endIndex = Math.min(startIndex + numCells, mFilteredApps.size()); AppsCustomizeCellLayout layout = (AppsCustomizeCellLayout) getPageAt(page); layout.removeAllViewsOnPage(); ArrayList<Object> items = new ArrayList<Object>(); ArrayList<Bitmap> images = new ArrayList<Bitmap>(); + boolean hideIconLabels = SettingsProvider.getBoolean(mLauncher, + SettingsProvider.SETTINGS_UI_DRAWER_HIDE_ICON_LABELS, + R.bool.preferences_interface_drawer_hide_icon_labels_default); for (int i = startIndex; i < endIndex; ++i) { - AppInfo info = mApps.get(i); + AppInfo info = mFilteredApps.get(i); PagedViewIcon icon = (PagedViewIcon) mLayoutInflater.inflate( R.layout.apps_customize_application, layout, false); icon.applyFromApplicationInfo(info, true, this); + icon.setTextVisibility(!hideIconLabels); icon.setOnClickListener(this); icon.setOnLongClickListener(this); icon.setOnTouchListener(this); @@ -1239,8 +1268,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen // Prepare the set of widgets to load previews for in the background int offset = page * numItemsPerPage; - for (int i = offset; i < Math.min(offset + numItemsPerPage, mWidgets.size()); ++i) { - items.add(mWidgets.get(i)); + for (int i = offset; i < Math.min(offset + numItemsPerPage, mFilteredWidgets.size()); ++i) { + items.add(mFilteredWidgets.get(i)); } // Prepopulate the pages with the other widget info, and fill in the previews later @@ -1865,7 +1894,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen mSortMode = sortMode; - Collections.sort(mApps, getComparatorForSortMode()); + Collections.sort(mFilteredApps, getComparatorForSortMode()); if (mContentType == ContentType.Applications) { for (int i = 0; i < getChildCount(); i++) { @@ -1903,13 +1932,40 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } } + public void setShowSystemApps(boolean show) { + if (show) { + mFilterApps |= FILTER_APPS_SYSTEM_FLAG; + } else { + mFilterApps &= ~FILTER_APPS_SYSTEM_FLAG; + } + filterApps(); + } + + public void setShowDownloadedApps(boolean show) { + if (show) { + mFilterApps |= FILTER_APPS_DOWNLOADED_FLAG; + } else { + mFilterApps &= ~FILTER_APPS_DOWNLOADED_FLAG; + } + filterApps(); + } + + public boolean getShowSystemApps() { + return (mFilterApps & FILTER_APPS_SYSTEM_FLAG) != 0; + } + + public boolean getShowDownloadedApps() { + return (mFilterApps & FILTER_APPS_DOWNLOADED_FLAG) != 0; + } + public void setApps(ArrayList<AppInfo> list) { if (!DISABLE_ALL_APPS) { mApps = list; - Collections.sort(mApps, getComparatorForSortMode()); + filterAppsWithoutInvalidate(); updatePageCountsAndInvalidateData(); } } + private void addAppsWithoutInvalidate(ArrayList<AppInfo> list) { // We add it in place, in alphabetical order int count = list.size(); @@ -1921,12 +1977,15 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } } } + public void addApps(ArrayList<AppInfo> list) { if (!DISABLE_ALL_APPS) { addAppsWithoutInvalidate(list); + filterAppsWithoutInvalidate(); updatePageCountsAndInvalidateData(); } } + private int findAppByComponent(List<AppInfo> list, AppInfo item) { ComponentName removeComponent = item.intent.getComponent(); int length = list.size(); @@ -1938,6 +1997,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } return -1; } + private void removeAppsWithoutInvalidate(ArrayList<AppInfo> list) { // loop through all the apps and remove apps that have the same component int length = list.size(); @@ -1949,12 +2009,15 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } } } + public void removeApps(ArrayList<AppInfo> appInfos) { if (!DISABLE_ALL_APPS) { removeAppsWithoutInvalidate(appInfos); + filterAppsWithoutInvalidate(); updatePageCountsAndInvalidateData(); } } + public void updateApps(ArrayList<AppInfo> list) { // We remove and re-add the updated applications list because it's properties may have // changed (ie. the title), and this will ensure that the items will be in their proper @@ -1962,10 +2025,73 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen if (!DISABLE_ALL_APPS) { removeAppsWithoutInvalidate(list); addAppsWithoutInvalidate(list); + filterAppsWithoutInvalidate(); updatePageCountsAndInvalidateData(); } } + public void filterAppsWithoutInvalidate() { + mFilteredApps = new ArrayList<AppInfo>(mApps); + Iterator<AppInfo> iterator = mFilteredApps.iterator(); + while (iterator.hasNext()) { + AppInfo appInfo = iterator.next(); + boolean system = (appInfo.flags & AppInfo.DOWNLOADED_FLAG) == 0; + if (mHiddenApps.contains(appInfo.componentName) || + (system && !getShowSystemApps()) || + (!system && !getShowDownloadedApps())) { + iterator.remove(); + } + } + Collections.sort(mFilteredApps, getComparatorForSortMode()); + } + + public void filterApps() { + filterAppsWithoutInvalidate(); + updatePageCountsAndInvalidateData(); + } + + public void filterWidgetsWithoutInvalidate() { + mFilteredWidgets = new ArrayList<Object>(mWidgets); + + Iterator<Object> iterator = mFilteredWidgets.iterator(); + while (iterator.hasNext()) { + Object o = iterator.next(); + + String packageName; + if (o instanceof AppWidgetProviderInfo) { + AppWidgetProviderInfo widgetInfo = (AppWidgetProviderInfo) o; + if (widgetInfo.provider == null) { + continue; + } + packageName = widgetInfo.provider.getPackageName(); + } else if (o instanceof ResolveInfo) { + ResolveInfo shortcut = (ResolveInfo) o; + packageName = shortcut.activityInfo.applicationInfo.packageName; + } else { + Log.w(TAG, "Unknown class in widgets list: " + o.getClass()); + continue; + } + + int flags; + try { + flags = AppInfo.initFlags(mPackageManager.getPackageInfo(packageName, 0)); + } catch (NameNotFoundException e) { + flags = 0; + } + boolean system = (flags & AppInfo.DOWNLOADED_FLAG) == 0; + if (mHiddenPackages.contains(packageName) || + (system && !getShowSystemApps()) || + (!system && !getShowDownloadedApps())) { + iterator.remove(); + } + } + } + + public void filterWidgets() { + filterWidgetsWithoutInvalidate(); + updatePageCountsAndInvalidateData(); + } + public void reset() { // If we have reset, then we should not continue to restore the previous state mSaveInstanceStateItemIndex = -1; diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index dafb79ffc..dc2db8773 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -35,7 +35,6 @@ import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; -import android.graphics.drawable.NinePatchDrawable; import android.os.Parcelable; import android.util.AttributeSet; import android.util.Log; @@ -48,7 +47,6 @@ import android.view.animation.Animation; import android.view.animation.DecelerateInterpolator; import android.view.animation.LayoutAnimationController; -import com.android.launcher3.R; import com.android.launcher3.FolderIcon.FolderRingAnimator; import java.util.ArrayList; @@ -198,7 +196,7 @@ public class CellLayout extends ViewGroup { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CellLayout, defStyle, 0); mCellWidth = mCellHeight = -1; - mFixedCellHeight = mFixedCellHeight = -1; + mFixedCellWidth = mFixedCellHeight = -1; mWidthGap = mOriginalWidthGap = 0; mHeightGap = mOriginalHeightGap = 0; mMaxGap = Integer.MAX_VALUE; @@ -606,9 +604,8 @@ public class CellLayout extends ViewGroup { final LayoutParams lp = params; // Hotseat icons - remove text - if (child instanceof BubbleTextView) { - BubbleTextView bubbleChild = (BubbleTextView) child; - bubbleChild.setTextVisibility(!mIsHotseat); + if (mIsHotseat && child instanceof BubbleTextView) { + ((BubbleTextView) child).setTextVisibility(false); } child.setScaleX(getChildrenScale()); diff --git a/src/com/android/launcher3/FastBitmapDrawable.java b/src/com/android/launcher3/FastBitmapDrawable.java index 14760c7b6..8061c619d 100644 --- a/src/com/android/launcher3/FastBitmapDrawable.java +++ b/src/com/android/launcher3/FastBitmapDrawable.java @@ -32,7 +32,7 @@ class FastBitmapDrawable extends Drawable { private final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG); FastBitmapDrawable(Bitmap b) { - mAlpha = 255; + mAlpha = 255; mBitmap = b; if (b != null) { mWidth = mBitmap.getWidth(); diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java index 1a25760ae..1fcfa1173 100644 --- a/src/com/android/launcher3/Folder.java +++ b/src/com/android/launcher3/Folder.java @@ -31,9 +31,7 @@ import android.text.InputType; import android.text.Selection; import android.text.Spannable; import android.util.AttributeSet; -import android.util.DisplayMetrics; import android.util.Log; -import android.util.TypedValue; import android.view.ActionMode; import android.view.KeyEvent; import android.view.LayoutInflater; @@ -43,8 +41,6 @@ import android.view.MotionEvent; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; -import android.view.animation.AccelerateInterpolator; -import android.view.animation.Interpolator; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.LinearLayout; @@ -52,6 +48,7 @@ import android.widget.ScrollView; import android.widget.TextView; import com.android.launcher3.FolderInfo.FolderListener; +import com.android.launcher3.settings.SettingsProvider; import java.util.ArrayList; import java.util.Collections; @@ -195,6 +192,13 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList mFolderName.setInputType(mFolderName.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_CAP_WORDS); mAutoScrollHelper = new FolderAutoScrollHelper(mScrollView); + + if (SettingsProvider.getBoolean(mLauncher, + SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS, + R.bool.preferences_interface_homescreen_hide_icon_labels)) { + mFolderName.setVisibility(View.GONE); + mFolderNameHeight = getPaddingBottom(); + } } private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() { @@ -270,7 +274,11 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList // Convert to a string here to ensure that no other state associated with the text field // gets saved. String newTitle = mFolderName.getText().toString(); - mInfo.setTitle(newTitle); + if (!SettingsProvider.getBoolean(mLauncher, + SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS, + R.bool.preferences_interface_homescreen_hide_icon_labels)) { + mInfo.setTitle(newTitle); + } LauncherModel.updateItemInDatabase(mLauncher, mInfo); if (commit) { diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 620071460..29618422d 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -50,9 +50,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.content.res.Resources; -import android.content.res.TypedArray; import android.database.ContentObserver; -import android.database.DataSetObserver; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Point; @@ -96,15 +94,9 @@ import android.view.accessibility.AccessibilityManager; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.inputmethod.InputMethodManager; - -import android.widget.AbsListView; -import android.widget.AdapterView; import android.widget.Advanceable; -import android.widget.ArrayAdapter; import android.widget.FrameLayout; -import android.widget.GridView; import android.widget.ImageView; -import android.widget.ListAdapter; import android.widget.PopupMenu; import android.widget.TextView; import android.widget.Toast; @@ -123,7 +115,6 @@ import java.io.IOException; import java.io.PrintWriter; import java.text.DateFormat; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.HashMap; @@ -345,6 +336,9 @@ public class Launcher extends Activity private HideFromAccessibilityHelper mHideFromAccessibilityHelper = new HideFromAccessibilityHelper(); + // Preferences + private boolean mHideIconLabels; + private Runnable mBuildLayersRunnable = new Runnable() { public void run() { if (mWorkspace != null) { @@ -395,6 +389,10 @@ public class Launcher extends Activity LauncherAppState.setApplicationContext(getApplicationContext()); LauncherAppState app = LauncherAppState.getInstance(); + mHideIconLabels = SettingsProvider.getBoolean(this, + SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS, + R.bool.preferences_interface_homescreen_hide_icon_labels); + // Determine the dynamic grid properties Point smallestSize = new Point(); Point largestSize = new Point(); @@ -1482,6 +1480,7 @@ public class Launcher extends Activity View createShortcut(int layoutResId, ViewGroup parent, ShortcutInfo info) { BubbleTextView favorite = (BubbleTextView) mInflater.inflate(layoutResId, parent, false); favorite.applyFromShortcutInfo(info, mIconCache); + favorite.setTextVisibility(!mHideIconLabels); favorite.setOnClickListener(this); if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS && info.getIcon(mIconCache) == null) { // All apps icon @@ -2301,6 +2300,9 @@ public class Launcher extends Activity // Create the view FolderIcon newFolder = FolderIcon.fromXml(R.layout.folder_icon, this, layout, folderInfo, mIconCache); + if (container == LauncherSettings.Favorites.CONTAINER_DESKTOP) { + newFolder.setTextVisible(!mHideIconLabels); + } mWorkspace.addInScreen(newFolder, container, screenId, cellX, cellY, 1, 1, isWorkspaceLocked()); // Force measure the new folder icon @@ -4021,6 +4023,7 @@ public class Launcher extends Activity FolderIcon newFolder = FolderIcon.fromXml(R.layout.folder_icon, this, (ViewGroup) workspace.getChildAt(workspace.getCurrentPage()), (FolderInfo) item, mIconCache); + newFolder.setTextVisible(!mHideIconLabels); workspace.addInScreenFromBind(newFolder, item.container, item.screenId, item.cellX, item.cellY, 1, 1); break; diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index bc97e0af2..e06fe5fb3 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -19,8 +19,16 @@ package com.android.launcher3; import android.app.SearchManager; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProviderInfo; -import android.content.*; +import android.content.BroadcastReceiver; +import android.content.ComponentName; +import android.content.ContentProviderClient; +import android.content.ContentProviderOperation; +import android.content.ContentResolver; +import android.content.ContentValues; +import android.content.Context; +import android.content.Intent; import android.content.Intent.ShortcutIconResource; +import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; @@ -42,7 +50,9 @@ import android.os.SystemClock; import android.provider.BaseColumns; import android.util.Log; import android.util.Pair; + import com.android.launcher3.InstallWidgetReceiver.WidgetMimeTypeHandlerData; +import com.android.launcher3.settings.SettingsProvider; import java.lang.ref.WeakReference; import java.net.URISyntaxException; @@ -2201,6 +2211,92 @@ public class LauncherModel extends BroadcastReceiver { runOnMainThread(r, MAIN_THREAD_BINDING_RUNNABLE); } + private void removeHiddenAppsWorkspaceItems( + final ArrayList<ItemInfo> workspaceItems, + final ArrayList<LauncherAppWidgetInfo> appWidgets, + final HashMap<Long, FolderInfo> folders) { + + // Get hidden apps + ArrayList<ComponentName> mHiddenApps = new ArrayList<ComponentName>(); + ArrayList<String> mHiddenAppsPackages = new ArrayList<String>(); + Context context = mApp.getContext(); + String[] flattened = SettingsProvider.getStringCustomDefault(context, + SettingsProvider.SETTINGS_UI_DRAWER_HIDDEN_APPS, "").split("\\|"); + boolean hideShortcuts = SettingsProvider.getBoolean(context, + SettingsProvider.SETTINGS_UI_DRAWER_REMOVE_HIDDEN_APPS_SHORTCUTS, + R.bool.preferences_interface_drawer_remove_hidden_apps_shortcuts_default); + boolean hideWidgets = SettingsProvider.getBoolean(context, + SettingsProvider.SETTINGS_UI_DRAWER_REMOVE_HIDDEN_APPS_WIDGETS, + R.bool.preferences_interface_drawer_remove_hidden_apps_widgets_default); + + for (String flat : flattened) { + ComponentName cmp = ComponentName.unflattenFromString(flat); + if (cmp != null) { + mHiddenApps.add(cmp); + mHiddenAppsPackages.add(cmp.getPackageName()); + } + } + + // Shortcuts + if (hideShortcuts) { + int N = workspaceItems.size() - 1; + for (int i = N; i >= 0; i--) { + final ItemInfo item = workspaceItems.get(i); + if (item instanceof ShortcutInfo) { + ShortcutInfo shortcut = (ShortcutInfo)item; + if (shortcut.intent != null && shortcut.intent.getComponent() != null) { + if (mHiddenApps.contains(shortcut.intent.getComponent())) { + LauncherModel.deleteItemFromDatabase(mContext, shortcut); + workspaceItems.remove(i); + } + } + } else { + final FolderInfo folder = (FolderInfo)item; + List<ShortcutInfo> shortcuts = folder.contents; + int NN = shortcuts.size() - 1; + for (int j = NN; j >= 0; j--) { + ShortcutInfo sci = shortcuts.get(j); + if (sci.intent != null && sci.intent.getComponent() != null) { + if (mHiddenApps.contains(sci.intent.getComponent())) { + LauncherModel.deleteItemFromDatabase(mContext, sci); + folder.remove(sci); + } + } + } + + if (folder.contents.size() == 1 /*&& !(folder instanceof LiveFolderInfo)*/) { + ShortcutInfo finalItem = folder.contents.get(0); + finalItem.container = folder.container; + LauncherModel.deleteItemFromDatabase(mContext, folder); + LauncherModel.addOrMoveItemInDatabase(mContext, finalItem, folder.container, + folder.screenId, folder.cellX, folder.cellY); + workspaceItems.remove(i); + workspaceItems.add(finalItem); + folders.remove(Long.valueOf(item.id)); + } else if (folder.contents.size() == 0 /*&& !(folder instanceof LiveFolderInfo)*/) { + LauncherModel.deleteFolderContentsFromDatabase(mContext, folder); + workspaceItems.remove(i); + folders.remove(Long.valueOf(item.id)); + } + } + } + } + + // AppWidgets + if (hideWidgets) { + int N = appWidgets.size() - 1; + for (int i = N; i >= 0; i--) { + final LauncherAppWidgetInfo item = appWidgets.get(i); + if (item.providerName != null) { + if (mHiddenAppsPackages.contains(item.providerName.getPackageName())) { + LauncherModel.deleteItemFromDatabase(mContext, item); + appWidgets.remove(i); + } + } + } + } + } + private void bindWorkspaceItems(final Callbacks oldCallbacks, final ArrayList<ItemInfo> workspaceItems, final ArrayList<LauncherAppWidgetInfo> appWidgets, @@ -2209,6 +2305,8 @@ public class LauncherModel extends BroadcastReceiver { final boolean postOnMainThread = (deferredBindRunnables != null); + removeHiddenAppsWorkspaceItems(workspaceItems, appWidgets, folders); + // Bind the workspace items int N = workspaceItems.size(); for (int i = 0; i < N; i += ITEMS_CHUNK) { diff --git a/src/com/android/launcher3/PagedViewIcon.java b/src/com/android/launcher3/PagedViewIcon.java index 8bfe42d24..785725852 100644 --- a/src/com/android/launcher3/PagedViewIcon.java +++ b/src/com/android/launcher3/PagedViewIcon.java @@ -20,7 +20,6 @@ import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Region; -import android.graphics.Region.Op; import android.util.AttributeSet; import android.util.TypedValue; import android.widget.TextView; @@ -44,6 +43,9 @@ public class PagedViewIcon extends TextView { private Bitmap mIcon; + private int mTextColor; + private boolean mIsTextVisible; + public PagedViewIcon(Context context) { this(context, null); } @@ -63,6 +65,8 @@ public class PagedViewIcon extends TextView { LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); setTextSize(TypedValue.COMPLEX_UNIT_SP, grid.iconTextSize); + mTextColor = getCurrentTextColor(); + mIsTextVisible = mTextColor != getResources().getColor(android.R.color.transparent); } public void applyFromApplicationInfo(AppInfo info, boolean scaleUp, @@ -126,4 +130,23 @@ public class PagedViewIcon extends TextView { super.draw(canvas); canvas.restore(); } + + @Override + public void setTextColor(int color) { + mTextColor = color; + super.setTextColor(color); + } + + public void setTextVisibility(boolean visible) { + if (visible) { + super.setTextColor(mTextColor); + } else { + super.setTextColor(getResources().getColor(android.R.color.transparent)); + } + mIsTextVisible = visible; + } + + public boolean isTextVisible() { + return mIsTextVisible; + } } diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 43994d702..83074aeda 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -54,10 +54,7 @@ import android.view.Display; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; -import android.view.View.OnClickListener; -import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; -import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import android.widget.TextView; @@ -282,6 +279,7 @@ public class Workspace extends SmoothPagedView private boolean mShowSearchBar; private boolean mShowOutlines; + private boolean mHideIconLabels; /** * Used to inflate the Workspace from XML. @@ -315,6 +313,9 @@ public class Workspace extends SmoothPagedView mShowOutlines = SettingsProvider.getBoolean(context, SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_PAGE_OUTLINES, R.bool.preferences_interface_homescreen_scrolling_page_outlines_default); + mHideIconLabels = SettingsProvider.getBoolean(context, + SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS, + R.bool.preferences_interface_homescreen_hide_icon_labels); mWorkspaceFadeInAdjacentScreens = SettingsProvider.getBoolean(context, SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_FADE_ADJACENT, R.bool.preferences_interface_homescreen_scrolling_fade_adjacent_default); @@ -895,7 +896,9 @@ public class Workspace extends SmoothPagedView } else { // Show folder title if not in the hotseat if (child instanceof FolderIcon) { - ((FolderIcon) child).setTextVisible(true); + ((FolderIcon) child).setTextVisible(!mHideIconLabels); + } else if (child instanceof BubbleTextView) { + ((BubbleTextView) child).setTextVisibility(!mHideIconLabels); } layout = getScreenWithId(screenId); child.setOnKeyListener(new IconKeyEventListener()); @@ -1334,7 +1337,7 @@ public class Workspace extends SmoothPagedView } void hideOutlines() { - if (!mIsSwitchingState) { + if (!isSmall() && !mIsSwitchingState) { if (mChildrenOutlineFadeInAnimation != null) mChildrenOutlineFadeInAnimation.cancel(); if (mChildrenOutlineFadeOutAnimation != null) mChildrenOutlineFadeOutAnimation.cancel(); mChildrenOutlineFadeOutAnimation = LauncherAnimUtils.ofFloat(this, "childrenOutlineAlpha", 0.0f); @@ -3707,6 +3710,7 @@ public class Workspace extends SmoothPagedView case LauncherSettings.Favorites.ITEM_TYPE_FOLDER: view = FolderIcon.fromXml(R.layout.folder_icon, mLauncher, cellLayout, (FolderInfo) info, mIconCache); + ((FolderIcon) view).setTextVisible(!mHideIconLabels); break; default: throw new IllegalStateException("Unknown item type: " + info.itemType); diff --git a/src/com/android/launcher3/settings/HiddenAppsActivity.java b/src/com/android/launcher3/settings/HiddenAppsActivity.java new file mode 100644 index 000000000..57ea7bc36 --- /dev/null +++ b/src/com/android/launcher3/settings/HiddenAppsActivity.java @@ -0,0 +1,302 @@ +package com.android.launcher3.settings; + +import android.app.ListActivity; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.graphics.drawable.Drawable; +import android.os.AsyncTask; +import android.os.Bundle; +import android.util.Log; +import android.util.SparseBooleanArray; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.TextView; + +import com.android.launcher3.R; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; + +public class HiddenAppsActivity extends ListActivity { + + private boolean mSaved; + + private static final int MENU_RESET = 0; + + private PackageManager mPackageManager; + + private AppsAdapter mAppsAdapter; + + protected void onCreate(Bundle savedInstanceState) { + requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); + super.onCreate(savedInstanceState); + + setTitle(R.string.hidden_apps_title); + setContentView(R.layout.hidden_apps_list); + + getActionBar().setDisplayHomeAsUpEnabled(true); + setProgressBarIndeterminateVisibility(true); + setProgressBarIndeterminate(true); + + mPackageManager = getPackageManager(); + mAppsAdapter = new AppsAdapter(this, R.layout.hidden_apps_list_item); + mAppsAdapter.setNotifyOnChange(true); + + setListAdapter(mAppsAdapter); + + AsyncTask<Void, Void, List<AppEntry>> refreshAppsTask = new AsyncTask<Void, Void, List<AppEntry>>() { + + @Override + protected void onPostExecute(List<AppEntry> apps) { + mAppsAdapter.clear(); + mAppsAdapter.addAll(apps); + restoreCheckedItems(); + setProgressBarIndeterminateVisibility(false); + setProgressBarIndeterminate(false); + } + + @Override + protected List<AppEntry> doInBackground(Void... params) { + return refreshApps(); + } + }; + refreshAppsTask.execute(null, null, null); + } + + @Override + public void onPause() { + super.onPause(); + save(); + } + + private void save() { + if (mSaved) { + return; + } + String string = ""; + + SparseBooleanArray checked = getListView().getCheckedItemPositions(); + + AppsAdapter listAdapter = (AppsAdapter) getListAdapter(); + for (int i = 0; i < checked.size(); i++) { + if (checked.valueAt(i)) { + AppEntry app = listAdapter.getItem(checked.keyAt(i)); + if (!string.isEmpty()) + string += "|"; + string += app.componentName.flattenToString(); + } + } + + SharedPreferences.Editor editor = SettingsProvider.get(this).edit(); + editor.putString(SettingsProvider.SETTINGS_UI_DRAWER_HIDDEN_APPS, string); + editor.putBoolean(SettingsProvider.SETTINGS_CHANGED, true); + editor.apply(); + + mSaved = true; + } + + private void restoreCheckedItems() { + List<ComponentName> apps = new ArrayList<ComponentName>(); + String[] flattened = SettingsProvider.getStringCustomDefault(this, + SettingsProvider.SETTINGS_UI_DRAWER_HIDDEN_APPS, "").split("\\|"); + for (String flat : flattened) { + apps.add(ComponentName.unflattenFromString(flat)); + } + + AppsAdapter listAdapter = (AppsAdapter) getListAdapter(); + + for (int i = 0; i < listAdapter.getCount(); i++) { + AppEntry info = listAdapter.getItem(i); + if (apps.contains(info.componentName)) { + getListView().setItemChecked(i, true); + } + } + + mSaved = true; + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + menu.add(0, MENU_RESET, 0, R.string.menu_hidden_apps_delete) + .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); + + return true; + } + + private void reset() { + for (int i = 0; i < getListView().getCount(); i++) { + getListView().setItemChecked(i, false); + } + + mSaved = false; + } + + private List<AppEntry> refreshApps() { + Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); + mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); + List<ResolveInfo> apps = mPackageManager.queryIntentActivities(mainIntent, 0); + Collections.sort(apps, new ResolveInfo.DisplayNameComparator(mPackageManager)); + List<AppEntry> appEntries = new ArrayList<AppEntry>(apps.size()); + for (ResolveInfo info : apps) { + appEntries.add(new AppEntry(info)); + } + return appEntries; + } + + @Override + public boolean onMenuItemSelected(int featureId, MenuItem item) { + if (item.getItemId() == android.R.id.home) { + finish(); + return true; + } else if (item.getItemId() == MENU_RESET) { + reset(); + return true; + } + return super.onMenuItemSelected(featureId, item); + } + + @Override + protected void onListItemClick(ListView l, View v, int position, long id) { + mSaved = false; + } + + private final class AppEntry { + + public final ComponentName componentName; + public final String title; + + public AppEntry(ResolveInfo info) { + componentName = new ComponentName(info.activityInfo.packageName, info.activityInfo.name); + title = info.loadLabel(mPackageManager).toString(); + } + } + + /** + * App view holder used to reuse the views inside the list. + */ + private static class AppViewHolder { + public final TextView title; + public final ImageView icon; + + public AppViewHolder(View parentView) { + icon = (ImageView) parentView.findViewById(R.id.icon); + title = (TextView) parentView.findViewById(R.id.title); + } + } + + public class AppsAdapter extends ArrayAdapter<AppEntry> { + + private final LayoutInflater mInflator; + + private ConcurrentHashMap<String, Drawable> mIcons; + private Drawable mDefaultImg; + private List<AppEntry> mApps; + + public AppsAdapter(Context context, int textViewResourceId) { + super(context, textViewResourceId); + + mApps = new ArrayList<AppEntry>(); + + mInflator = LayoutInflater.from(context); + + // set the default icon till the actual app icon is loaded in async + // task + mDefaultImg = context.getResources().getDrawable(android.R.mipmap.sym_def_app_icon); + mIcons = new ConcurrentHashMap<String, Drawable>(); + } + + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + AppViewHolder viewHolder; + + if (convertView == null) { + convertView = mInflator.inflate(R.layout.hidden_apps_list_item, parent, false); + viewHolder = new AppViewHolder(convertView); + convertView.setTag(viewHolder); + } else { + viewHolder = (AppViewHolder) convertView.getTag(); + } + + AppEntry app = getItem(position); + + viewHolder.title.setText(app.title); + + Drawable icon = mIcons.get(app.componentName.getPackageName()); + viewHolder.icon.setImageDrawable(icon != null ? icon : mDefaultImg); + + return convertView; + } + + @Override + public boolean hasStableIds() { + return true; + } + + @Override + public void notifyDataSetChanged() { + super.notifyDataSetChanged(); + // If we have new items, we have to load their icons + // If items were deleted, remove them from our mApps + List<AppEntry> newApps = new ArrayList<AppEntry>(getCount()); + List<AppEntry> oldApps = new ArrayList<AppEntry>(getCount()); + for (int i = 0; i < getCount(); i++) { + AppEntry app = getItem(i); + if (mApps.contains(app)) { + oldApps.add(app); + } else { + newApps.add(app); + } + } + + if (newApps.size() > 0) { + new LoadIconsTask().execute(newApps.toArray(new AppEntry[] {})); + newApps.addAll(oldApps); + mApps = newApps; + } else { + mApps = oldApps; + } + } + + /** + * An asynchronous task to load the icons of the installed applications. + */ + private class LoadIconsTask extends AsyncTask<AppEntry, Void, Void> { + @Override + protected Void doInBackground(AppEntry... apps) { + for (AppEntry app : apps) { + try { + if (mIcons.containsKey(app.componentName.getPackageName())) { + continue; + } + Drawable icon = mPackageManager.getApplicationIcon(app.componentName + .getPackageName()); + mIcons.put(app.componentName.getPackageName(), icon); + publishProgress(); + } catch (PackageManager.NameNotFoundException e) { + // ignored; app will show up with default image + } + } + + return null; + } + + @Override + protected void onProgressUpdate(Void... progress) { + notifyDataSetChanged(); + } + } + } +} diff --git a/src/com/android/launcher3/settings/SettingsActivity.java b/src/com/android/launcher3/settings/SettingsActivity.java index 182a6bff8..dbbf95f52 100644 --- a/src/com/android/launcher3/settings/SettingsActivity.java +++ b/src/com/android/launcher3/settings/SettingsActivity.java @@ -153,6 +153,15 @@ public class SettingsActivity extends PreferenceActivity } } + public static class DrawerFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.preferences_drawer); + } + } + private static class HeaderAdapter extends ArrayAdapter<Header> { private static final int HEADER_TYPE_NORMAL = 0; private static final int HEADER_TYPE_CATEGORY = 1; diff --git a/src/com/android/launcher3/settings/SettingsProvider.java b/src/com/android/launcher3/settings/SettingsProvider.java index 8ef3c9c7f..abf4e1b67 100644 --- a/src/com/android/launcher3/settings/SettingsProvider.java +++ b/src/com/android/launcher3/settings/SettingsProvider.java @@ -26,12 +26,17 @@ public final class SettingsProvider { public static final String SETTINGS_UI_HOMESCREEN_DEFAULT_SCREEN_ID = "ui_homescreen_default_screen_id"; public static final String SETTINGS_UI_HOMESCREEN_SEARCH = "ui_homescreen_search"; + public static final String SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS = "ui_homescreen_general_hide_icon_labels"; public static final String SETTINGS_UI_HOMESCREEN_SCROLLING_TRANSITION_EFFECT = "ui_homescreen_scrolling_transition_effect"; public static final String SETTINGS_UI_HOMESCREEN_SCROLLING_WALLPAPER_SCROLL = "ui_homescreen_scrolling_wallpaper_scroll"; public static final String SETTINGS_UI_HOMESCREEN_SCROLLING_PAGE_OUTLINES = "ui_homescreen_scrolling_page_outlines"; public static final String SETTINGS_UI_HOMESCREEN_SCROLLING_FADE_ADJACENT = "ui_homescreen_scrolling_fade_adjacent"; public static final String SETTINGS_UI_DRAWER_SCROLLING_TRANSITION_EFFECT = "ui_drawer_scrolling_transition_effect"; public static final String SETTINGS_UI_DRAWER_SCROLLING_FADE_ADJACENT = "ui_drawer_scrolling_fade_adjacent"; + public static final String SETTINGS_UI_DRAWER_HIDDEN_APPS = "ui_drawer_hidden_apps"; + public static final String SETTINGS_UI_DRAWER_REMOVE_HIDDEN_APPS_SHORTCUTS = "ui_drawer_remove_hidden_apps_shortcuts"; + public static final String SETTINGS_UI_DRAWER_REMOVE_HIDDEN_APPS_WIDGETS = "ui_drawer_remove_hidden_apps_widgets"; + public static final String SETTINGS_UI_DRAWER_HIDE_ICON_LABELS = "ui_drawer_hide_icon_labels"; public static final String SETTINGS_UI_GENERAL_ICONS_LARGE = "ui_general_icons_large"; public static final String SETTINGS_UI_GENERAL_ICONS_TEXT_FONT_FAMILY = "ui_general_icons_text_font"; public static final String SETTINGS_UI_GENERAL_ICONS_TEXT_FONT_STYLE = "ui_general_icons_text_font_style"; diff --git a/src/com/android/launcher3/widget/CheckableLinearLayout.java b/src/com/android/launcher3/widget/CheckableLinearLayout.java new file mode 100644 index 000000000..f834c10b8 --- /dev/null +++ b/src/com/android/launcher3/widget/CheckableLinearLayout.java @@ -0,0 +1,50 @@ +package com.android.launcher3.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.CheckBox; +import android.widget.Checkable; +import android.widget.LinearLayout; + +import com.android.launcher3.R; + +/* + * This class is useful for using inside of ListView that needs to have checkable items. + */ +public class CheckableLinearLayout extends LinearLayout implements Checkable { + private CheckBox mCheckBox; + + public CheckableLinearLayout(Context context) { + super(context); + } + + public CheckableLinearLayout(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public CheckableLinearLayout(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + + mCheckBox = (CheckBox) findViewById(R.id.checkbox); + } + + @Override + public boolean isChecked() { + return mCheckBox.isChecked(); + } + + @Override + public void setChecked(boolean checked) { + mCheckBox.setChecked(checked); + } + + @Override + public void toggle() { + mCheckBox.toggle(); + } +}
\ No newline at end of file diff --git a/src/com/android/launcher3/widget/InertCheckBox.java b/src/com/android/launcher3/widget/InertCheckBox.java new file mode 100644 index 000000000..e990a8b85 --- /dev/null +++ b/src/com/android/launcher3/widget/InertCheckBox.java @@ -0,0 +1,69 @@ +package com.android.launcher3.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.KeyEvent; +import android.view.MotionEvent; +import android.widget.CheckBox; + + +// CheckBox that does not react to any user event in order to let the container handle them. +public class InertCheckBox extends CheckBox { + + @SuppressWarnings("unused") + public InertCheckBox(Context context) { + super(context); + } + + @SuppressWarnings("unused") + public InertCheckBox(Context context, AttributeSet attrs) { + super(context, attrs); + } + + @SuppressWarnings("unused") + public InertCheckBox(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + // Make the checkbox not respond to any user event + return false; + } + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + // Make the checkbox not respond to any user event + return false; + } + + @Override + public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) { + // Make the checkbox not respond to any user event + return false; + } + + @Override + public boolean onKeyPreIme(int keyCode, KeyEvent event) { + // Make the checkbox not respond to any user event + return false; + } + + @Override + public boolean onKeyShortcut(int keyCode, KeyEvent event) { + // Make the checkbox not respond to any user event + return false; + } + + @Override + public boolean onKeyUp(int keyCode, KeyEvent event) { + // Make the checkbox not respond to any user event + return false; + } + + @Override + public boolean onTrackballEvent(MotionEvent event) { + // Make the checkbox not respond to any user event + return false; + } +}
\ No newline at end of file |