From 9a8573250bbe0df0af0d275cb188bf9db7942e6f Mon Sep 17 00:00:00 2001 From: Cameron Neale Date: Thu, 16 Oct 2014 13:29:12 -0700 Subject: Removing duplicated and/or unused resources from WallpaperPicker that conflict with Launcher 3 resources. The resource duplicated between the two is now only held within Launcher3. These changes are necessary in order for GSA to build in Google3. Change-Id: I70f5a250db52303c876e6abedd9c6d32d1d4761e --- WallpaperPicker/res/values-sw600dp/config.xml | 18 ------------------ WallpaperPicker/res/values-sw720dp/dimens.xml | 5 ----- WallpaperPicker/res/values/config.xml | 1 - 3 files changed, 24 deletions(-) delete mode 100644 WallpaperPicker/res/values-sw600dp/config.xml (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/res/values-sw600dp/config.xml b/WallpaperPicker/res/values-sw600dp/config.xml deleted file mode 100644 index 62342dcc2..000000000 --- a/WallpaperPicker/res/values-sw600dp/config.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - true - diff --git a/WallpaperPicker/res/values-sw720dp/dimens.xml b/WallpaperPicker/res/values-sw720dp/dimens.xml index 9ae155b3c..27c4fd054 100644 --- a/WallpaperPicker/res/values-sw720dp/dimens.xml +++ b/WallpaperPicker/res/values-sw720dp/dimens.xml @@ -15,12 +15,7 @@ --> - 72dp - - 8dip - 8dip - 0dp diff --git a/WallpaperPicker/res/values/config.xml b/WallpaperPicker/res/values/config.xml index 71580b5b0..2f5174ce6 100644 --- a/WallpaperPicker/res/values/config.xml +++ b/WallpaperPicker/res/values/config.xml @@ -14,7 +14,6 @@ limitations under the License. --> - false false -- cgit v1.2.3 From 2775cb34b390ad52d0920bb533232571568c3f71 Mon Sep 17 00:00:00 2001 From: Cameron Neale Date: Fri, 31 Oct 2014 13:18:38 -0700 Subject: Changes made to accomodate GSA in Google3 w/ Robolectric dragViewOffset removed from WallpaperPicker as it was causing a duplicate resource conflict with launcher3 and was not used within the WallpaperPicker project. Empty tag added to WallpaperPicker manifest as required by Robolectric Removed tag from L3 manifest, unrecognized by Robolectric Change-Id: I3744fc50731f82c3e6fdc01d9819e9a0302dc503 --- WallpaperPicker/AndroidManifest.xml | 4 ++-- WallpaperPicker/res/values-sw720dp/dimens.xml | 23 ----------------------- 2 files changed, 2 insertions(+), 25 deletions(-) delete mode 100644 WallpaperPicker/res/values-sw720dp/dimens.xml (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/AndroidManifest.xml b/WallpaperPicker/AndroidManifest.xml index 86a94d078..5b6a0077d 100644 --- a/WallpaperPicker/AndroidManifest.xml +++ b/WallpaperPicker/AndroidManifest.xml @@ -4,7 +4,7 @@ android:versionCode="1" android:versionName="1.0" > - + - + diff --git a/WallpaperPicker/res/values-sw720dp/dimens.xml b/WallpaperPicker/res/values-sw720dp/dimens.xml deleted file mode 100644 index 27c4fd054..000000000 --- a/WallpaperPicker/res/values-sw720dp/dimens.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - 0dp - 0dp - -- cgit v1.2.3 From 2571c1acc2ab0d507ac2fd118271bb8a76660865 Mon Sep 17 00:00:00 2001 From: Geoff Mendal Date: Fri, 16 Jan 2015 16:06:23 -0800 Subject: Import translations. DO NOT MERGE Change-Id: Id2721f2c721bfcaf5f880e6675f66a02a8bca1f3 Auto-generated-cl: translation import --- WallpaperPicker/res/values-am/strings.xml | 6 ++--- WallpaperPicker/res/values-bn-rBD/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-eu-rES/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-fa/strings.xml | 2 +- WallpaperPicker/res/values-gl-rES/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-is-rIS/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-kk-rKZ/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-kn-rIN/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-ky-rKG/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-mk-rMK/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-ml-rIN/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-mr-rIN/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-my-rMM/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-ne-rNP/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-si-rLK/strings.xml | 38 +++++++++++++++++++++++++++ WallpaperPicker/res/values-ta-rIN/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-te-rIN/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-th/strings.xml | 2 +- WallpaperPicker/res/values-ur-rPK/strings.xml | 36 +++++++++++++++++++++++++ WallpaperPicker/res/values-uz-rUZ/strings.xml | 36 +++++++++++++++++++++++++ 20 files changed, 619 insertions(+), 5 deletions(-) create mode 100644 WallpaperPicker/res/values-bn-rBD/strings.xml create mode 100644 WallpaperPicker/res/values-eu-rES/strings.xml create mode 100644 WallpaperPicker/res/values-gl-rES/strings.xml create mode 100644 WallpaperPicker/res/values-is-rIS/strings.xml create mode 100644 WallpaperPicker/res/values-kk-rKZ/strings.xml create mode 100644 WallpaperPicker/res/values-kn-rIN/strings.xml create mode 100644 WallpaperPicker/res/values-ky-rKG/strings.xml create mode 100644 WallpaperPicker/res/values-mk-rMK/strings.xml create mode 100644 WallpaperPicker/res/values-ml-rIN/strings.xml create mode 100644 WallpaperPicker/res/values-mr-rIN/strings.xml create mode 100644 WallpaperPicker/res/values-my-rMM/strings.xml create mode 100644 WallpaperPicker/res/values-ne-rNP/strings.xml create mode 100644 WallpaperPicker/res/values-si-rLK/strings.xml create mode 100644 WallpaperPicker/res/values-ta-rIN/strings.xml create mode 100644 WallpaperPicker/res/values-te-rIN/strings.xml create mode 100644 WallpaperPicker/res/values-ur-rPK/strings.xml create mode 100644 WallpaperPicker/res/values-uz-rUZ/strings.xml (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/res/values-am/strings.xml b/WallpaperPicker/res/values-am/strings.xml index 394161634..59c3bf733 100644 --- a/WallpaperPicker/res/values-am/strings.xml +++ b/WallpaperPicker/res/values-am/strings.xml @@ -19,7 +19,7 @@ - "የግድግዳ ወረቀት አዘጋጅ" + "ልጣፍ አዘጋጅ" "ምስሉን መጫን አልተቻለም" "ምስሉን እንደ ግድግዳ ወረቀት መጫን አልተቻለም" @@ -27,10 +27,10 @@ "%1$d ተመርጧል" "%1$d ተመርጧል" - "የግድግዳ ወረቀት %1$d የ%2$d" + "ልጣፍ %1$d የ%2$d" "%1$s ተመርጧል" "ሰርዝ" "ምስል ይምረጡ" "የግድግዳ ወረቀቶች" - "የግድግዳ ወረቀት ይከርክሙ" + "ልጣፍ ይከርክሙ" diff --git a/WallpaperPicker/res/values-bn-rBD/strings.xml b/WallpaperPicker/res/values-bn-rBD/strings.xml new file mode 100644 index 000000000..a4fccb208 --- /dev/null +++ b/WallpaperPicker/res/values-bn-rBD/strings.xml @@ -0,0 +1,36 @@ + + + + + "ওয়ালপেপার সেট করুন" + "চিত্র লোড করা যায়নি" + "ওয়ালপেপার হিসাবে চিত্র লোড করা যায়নি" + + "%1$dটি নির্বাচন করা হয়েছে" + "%1$dটি নির্বাচন করা হয়েছে" + "%1$dটি নির্বাচন করা হয়েছে" + + "%2$dটির মধ্যে %1$dটি ওয়ালপেপার" + "%1$s নির্বাচন করা হয়েছে" + "মুছুন" + "চিত্র বাছুন" + "ওয়ালপেপারগুলি" + "ওয়ালপেপার কাটছাঁট করুন" + diff --git a/WallpaperPicker/res/values-eu-rES/strings.xml b/WallpaperPicker/res/values-eu-rES/strings.xml new file mode 100644 index 000000000..327550d52 --- /dev/null +++ b/WallpaperPicker/res/values-eu-rES/strings.xml @@ -0,0 +1,36 @@ + + + + + "Ezarri horma-papera" + "Ezin izan da irudia kargatu" + "Ezin izan da irudia horma-paper gisa kargatu" + + "%1$d hautatuta" + "%1$d hautatuta" + "%1$d hautatuta" + + "%1$d/%2$d horma-papera" + "%1$s hautatu da" + "Ezabatu" + "Hautatu irudia" + "Horma-paperak" + "Ebaki horma-papera" + diff --git a/WallpaperPicker/res/values-fa/strings.xml b/WallpaperPicker/res/values-fa/strings.xml index eb330b515..ef4bc4fa6 100644 --- a/WallpaperPicker/res/values-fa/strings.xml +++ b/WallpaperPicker/res/values-fa/strings.xml @@ -28,7 +28,7 @@ "‏%1$d انتخاب شد" "‏کاغذدیواری %1$d از %2$d" - "%1$s انتخاب شده است" + "%1$s انتخاب شد" "حذف" "انتخاب تصویر" "کاغذدیواری‌ها" diff --git a/WallpaperPicker/res/values-gl-rES/strings.xml b/WallpaperPicker/res/values-gl-rES/strings.xml new file mode 100644 index 000000000..9f1fd5014 --- /dev/null +++ b/WallpaperPicker/res/values-gl-rES/strings.xml @@ -0,0 +1,36 @@ + + + + + "Establecer fondo de pantalla" + "Non se puido cargar a imaxe" + "Non se puido cargar a imaxe como fondo de pantalla" + + "Seleccionaches %1$d" + "Seleccionaches %1$d" + "Seleccionaches %1$d" + + "Fondo de pantalla %1$d de %2$d" + "Seleccionaches %1$s" + "Eliminar" + "Escoller imaxe" + "Fondos de pantalla" + "Recortar fondo de pantalla" + diff --git a/WallpaperPicker/res/values-is-rIS/strings.xml b/WallpaperPicker/res/values-is-rIS/strings.xml new file mode 100644 index 000000000..6d5d680cf --- /dev/null +++ b/WallpaperPicker/res/values-is-rIS/strings.xml @@ -0,0 +1,36 @@ + + + + + "Velja veggfóður" + "Ekki var hægt að hlaða mynd" + "Ekki var hægt að hlaða mynd sem veggfóður" + + "%1$d valin" + "%1$d valið" + "%1$d valin" + + "Veggfóður %1$d af %2$d" + "%1$s valið" + "Eyða" + "Velja mynd" + "Veggfóður" + "Skera veggfóður" + diff --git a/WallpaperPicker/res/values-kk-rKZ/strings.xml b/WallpaperPicker/res/values-kk-rKZ/strings.xml new file mode 100644 index 000000000..b75562ec9 --- /dev/null +++ b/WallpaperPicker/res/values-kk-rKZ/strings.xml @@ -0,0 +1,36 @@ + + + + + "Артқы фонды орнату" + "Суретті жүктей алмады" + "Суретті артқы фон ретінде жүктей алмады" + + "%1$d таңдалған" + "%1$d таңдалған" + "%1$d таңдалған" + + "%1$d артқы фон, барлығы %2$d" + "%1$s таңдалған" + "Жою" + "Суретті таңдау" + "Артқы фондар" + "Артқы фонды кесу" + diff --git a/WallpaperPicker/res/values-kn-rIN/strings.xml b/WallpaperPicker/res/values-kn-rIN/strings.xml new file mode 100644 index 000000000..89203bf1c --- /dev/null +++ b/WallpaperPicker/res/values-kn-rIN/strings.xml @@ -0,0 +1,36 @@ + + + + + "ವಾಲ್‌ಪೇಪರ್ ಹೊಂದಿಸಿ" + "ಚಿತ್ರವನ್ನು ಲೋಡ್‌ ಮಾಡಲು ಸಾಧ್ಯವಾಗಲಿಲ್ಲ" + "ಚಿತ್ರವನ್ನು ವಾಲ್‌ಪೇಪರ್‌ ರೂಪದಲ್ಲಿ ಲೋಡ್‌ ಮಾಡಲು ಸಾಧ್ಯವಾಗಲಿಲ್ಲ" + + "%1$d ಅನ್ನು ಆಯ್ಕೆ ಮಾಡಲಾಗಿದೆ" + "%1$d ಅನ್ನು ಆಯ್ಕೆ ಮಾಡಲಾಗಿದೆ" + "%1$d ಅನ್ನು ಆಯ್ಕೆ ಮಾಡಲಾಗಿದೆ" + + "%2$d ರಲ್ಲಿ %1$d ವಾಲ್‌ಪೇಪರ್‌" + "%1$s ಆಯ್ಕೆ ಮಾಡಲಾಗಿದೆ" + "ಅಳಿಸು" + "ಚಿತ್ರವನ್ನು ಆರಿಸಿ" + "ವಾಲ್‌ಪೇಪರ್‌ಗಳು" + "ವಾಲ್‌ಪೇಪರ್‌ ಕತ್ತರಿಸಿ" + diff --git a/WallpaperPicker/res/values-ky-rKG/strings.xml b/WallpaperPicker/res/values-ky-rKG/strings.xml new file mode 100644 index 000000000..696b3ee17 --- /dev/null +++ b/WallpaperPicker/res/values-ky-rKG/strings.xml @@ -0,0 +1,36 @@ + + + + + "Тушкагаз орнотуу" + "Сүрөт жүктөө мүмкүн болбоду" + "Сүрөттү тушкагаз катары жүктөө кыйрады" + + "%1$d тандалды" + "%1$d тандалды" + "%1$d тандалды" + + "%2$d ичинен %1$d тушкагаз" + "%1$s тандалды" + "Жок кылуу" + "Сүрөт тандоо" + "Тушкагаздар" + "Тушкагазды тегиздөө" + diff --git a/WallpaperPicker/res/values-mk-rMK/strings.xml b/WallpaperPicker/res/values-mk-rMK/strings.xml new file mode 100644 index 000000000..b1919ccd4 --- /dev/null +++ b/WallpaperPicker/res/values-mk-rMK/strings.xml @@ -0,0 +1,36 @@ + + + + + "Подеси тапет" + "Сликата не можеше да се вчита" + "Сликата не можеше да се вчита како тапет" + + "Избрано %1$d" + "Избрано %1$d" + "Избрано %1$d" + + "Тапет %1$d од %2$d" + "Избран %1$s" + "Избриши" + "Избери слика" + "Тапети" + "Исечи тапет" + diff --git a/WallpaperPicker/res/values-ml-rIN/strings.xml b/WallpaperPicker/res/values-ml-rIN/strings.xml new file mode 100644 index 000000000..0b6a4c108 --- /dev/null +++ b/WallpaperPicker/res/values-ml-rIN/strings.xml @@ -0,0 +1,36 @@ + + + + + "വാൾപേപ്പർ സജ്ജീകരിക്കുക" + "ചിത്രം ലോഡുചെയ്യാനായില്ല" + "വാൾപേപ്പറായി ചിത്രം ലോഡുചെയ്യാനായില്ല" + + "%1$d തിരഞ്ഞെടുത്തു" + "%1$d തിരഞ്ഞെടുത്തു" + "%1$d തിരഞ്ഞെടുത്തു" + + "%1$d / %2$d വാൾപേപ്പർ" + "%1$s തിരഞ്ഞെടുത്തു" + "ഇല്ലാതാക്കുക" + "ചിത്രം തിരഞ്ഞെടുക്കുക" + "വാൾപേപ്പറുകൾ" + "വാൾപേപ്പറിന്റെ വലുപ്പം മാറ്റൽ" + diff --git a/WallpaperPicker/res/values-mr-rIN/strings.xml b/WallpaperPicker/res/values-mr-rIN/strings.xml new file mode 100644 index 000000000..33cfaa148 --- /dev/null +++ b/WallpaperPicker/res/values-mr-rIN/strings.xml @@ -0,0 +1,36 @@ + + + + + "वॉलपेपर सेट करा" + "प्रतिमा लोड करू शकलो नाही" + "वॉलपेपर म्हणून प्रतिमा लोड करू शकलो नाही" + + "%1$d निवडले" + "%1$d निवडले" + "%1$d निवडले" + + "%2$d पैकी %1$d वॉलपेपर" + "%1$s निवडले" + "हटवा" + "प्रतिमा निवडा" + "वॉलपेपर" + "वॉलपेपर कापा" + diff --git a/WallpaperPicker/res/values-my-rMM/strings.xml b/WallpaperPicker/res/values-my-rMM/strings.xml new file mode 100644 index 000000000..4d5ac47df --- /dev/null +++ b/WallpaperPicker/res/values-my-rMM/strings.xml @@ -0,0 +1,36 @@ + + + + + "နောက်ခံအား သတ်မှတ်ရန်" + "ပုံရိပ် တင် မရပါ" + "ပုံရိပ်အား နောက်ခံအဖြစ် တင် မရပါ" + + "%1$d ရွေးချယ်ပြီး" + "%1$d ရွေးချယ်ပြီး" + "%1$d ရွေးချယ်ပြီး" + + "နောက်ခံ %1$d မှ %2$d" + "ရွေးချယ်ထားသော %1$s" + "ဖျက်ပါ" + "ပုံ ရွေးပါ" + "နောက်ခံများ" + "နောက်ခံအား ဖြတ်ခြင်း" + diff --git a/WallpaperPicker/res/values-ne-rNP/strings.xml b/WallpaperPicker/res/values-ne-rNP/strings.xml new file mode 100644 index 000000000..221fa9438 --- /dev/null +++ b/WallpaperPicker/res/values-ne-rNP/strings.xml @@ -0,0 +1,36 @@ + + + + + "वालपेपर मिलाउनुहोस्" + "तस्बिर लोड गर्न सकिएन" + "तस्बिरलाई वालपेपरका रूपमा लोड गर्न सकिएन" + + "%1$d चयन भयो" + "%1$d चयन भयो" + "%1$d चयन भयो" + + "%2$d को %1$d वालपेपर" + "चयन गरिएको %1$s" + "मेट्नुहोस्" + "तस्बिर छान्नुहोस्" + "वालपेपरहरु" + "वालपेपर काँटछाट गर्नुहोस्" + diff --git a/WallpaperPicker/res/values-si-rLK/strings.xml b/WallpaperPicker/res/values-si-rLK/strings.xml new file mode 100644 index 000000000..d175724fd --- /dev/null +++ b/WallpaperPicker/res/values-si-rLK/strings.xml @@ -0,0 +1,38 @@ + + + + + "වෝල්පේපරය සකසන්න" + "පින්තූරය පූරණය කිරීමට නොහැකි විය" + "පින්තූරය වෝල්පේපරයක් ලෙස පූරණය කිරීමට නොහැකි විය" + + "%1$d තෝරා ගන්නා ලදි" + "%1$d තෝරා ගන්නා ලදි" + "%1$d තෝරා ගන්නා ලදි" + + + + + "තෝරාගත්තේ %1$s" + "මකන්න" + "පින්තූරයක් තෝරන්න" + "වෝල්පේපර" + "වෝල්පේපරය කප්පාදු කිරීම" + diff --git a/WallpaperPicker/res/values-ta-rIN/strings.xml b/WallpaperPicker/res/values-ta-rIN/strings.xml new file mode 100644 index 000000000..2b984271a --- /dev/null +++ b/WallpaperPicker/res/values-ta-rIN/strings.xml @@ -0,0 +1,36 @@ + + + + + "வால்பேப்பரை அமை" + "படத்தை ஏற்ற முடியவில்லை" + "படத்தை வால்பேப்பராக ஏற்ற முடியவில்லை" + + "%1$d தேர்ந்தெடுக்கப்பட்டன" + "%1$d தேர்ந்தெடுக்கப்பட்டது" + "%1$d தேர்ந்தெடுக்கப்பட்டன" + + "வால்பேப்பர் %1$d / %2$d" + "%1$s தேர்ந்தெடுக்கப்பட்டது" + "நீக்கு" + "படத்தைத் தேர்வுசெய்க" + "வால்பேப்பர்கள்" + "வால்பேப்பரைச் செதுக்கு" + diff --git a/WallpaperPicker/res/values-te-rIN/strings.xml b/WallpaperPicker/res/values-te-rIN/strings.xml new file mode 100644 index 000000000..c26f84e28 --- /dev/null +++ b/WallpaperPicker/res/values-te-rIN/strings.xml @@ -0,0 +1,36 @@ + + + + + "వాల్‌పేపర్‌ను సెట్ చేయి" + "చిత్రాన్ని లోడ్ చేయడం సాధ్యపడలేదు" + "చిత్రాన్ని వాల్‌పేపర్‌గా లోడ్ చేయడం సాధ్యపడలేదు" + + "%1$d ఎంచుకోబడింది" + "%1$d ఎంచుకోబడింది" + "%1$d ఎంచుకోబడింది" + + "%2$dలో %1$dవ వాల్‌పేపర్" + "%1$s ఎంచుకోబడింది" + "తొలగించు" + "చిత్రాన్ని ఎంచుకోండి" + "వాల్‌పేపర్‌లు" + "వాల్‌పేపర్‌ను కత్తిరించండి" + diff --git a/WallpaperPicker/res/values-th/strings.xml b/WallpaperPicker/res/values-th/strings.xml index c81720563..6b4c23536 100644 --- a/WallpaperPicker/res/values-th/strings.xml +++ b/WallpaperPicker/res/values-th/strings.xml @@ -29,7 +29,7 @@ "วอลเปเปอร์ %1$d จาก %2$d" "เลือก %1$s แล้ว" - "นำออก" + "ลบ" "เลือกรูปภาพ" "วอลเปเปอร์" "ครอบตัดวอลเปเปอร์" diff --git a/WallpaperPicker/res/values-ur-rPK/strings.xml b/WallpaperPicker/res/values-ur-rPK/strings.xml new file mode 100644 index 000000000..7b12d4239 --- /dev/null +++ b/WallpaperPicker/res/values-ur-rPK/strings.xml @@ -0,0 +1,36 @@ + + + + + "وال پیپر سیٹ کریں" + "تصویر کو لوڈ نہیں کیا جا سکا" + "تصویر کو وال پیپر کے بطور لوڈ نہیں کیا جا سکا" + + "‏%1$d کو منتخب کیا گیا" + "‏%1$d کو منتخب کیا گیا" + "‏%1$d کو منتخب کیا گیا" + + "‏وال پیپر ‎%1$d از ‎%2$d" + "%1$s کو منتخب کیا گیا" + "حذف کریں" + "تصویر منتخب کریں" + "وال پیپرز" + "وال پیپر کو تراشیں" + diff --git a/WallpaperPicker/res/values-uz-rUZ/strings.xml b/WallpaperPicker/res/values-uz-rUZ/strings.xml new file mode 100644 index 000000000..73d7a0d1e --- /dev/null +++ b/WallpaperPicker/res/values-uz-rUZ/strings.xml @@ -0,0 +1,36 @@ + + + + + "Fonga rasm o‘rnatish" + "Rasm yuklanmadi" + "Fon rasmi sifatida rasm yuklanmadi" + + "%1$d ta tanlandi" + "%1$d tanlandi" + "%1$d ta tanlandi" + + "Fon rasmi %2$ddan %1$d" + "%1$s tanlandi" + "O‘chirish" + "Rasmni tanlang" + "Fon rasmlari" + "Fon rasmini kesish" + -- cgit v1.2.3 From c46bfef5dfd8c6867641bdc32c27b03e2f183726 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 5 Jan 2015 12:40:08 -0800 Subject: Removing support library dependency > Removed FolderAutoScrollHelper as folders are currently not scrollable Change-Id: I261f43a665b742697e3224e1e9852ccc526badcd --- WallpaperPicker/AndroidManifest.xml | 4 ++-- WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/AndroidManifest.xml b/WallpaperPicker/AndroidManifest.xml index 5b6a0077d..cb1457bdc 100644 --- a/WallpaperPicker/AndroidManifest.xml +++ b/WallpaperPicker/AndroidManifest.xml @@ -4,7 +4,7 @@ android:versionCode="1" android:versionName="1.0" > - - + + diff --git a/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java b/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java index c4e493b34..b0292e660 100644 --- a/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java +++ b/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java @@ -20,9 +20,9 @@ import android.content.Context; import android.graphics.Bitmap; import android.graphics.Rect; import android.graphics.RectF; -import android.support.v4.util.LongSparseArray; import android.util.DisplayMetrics; import android.util.Log; +import android.util.LongSparseArray; import android.util.Pools.Pool; import android.util.Pools.SynchronizedPool; import android.view.View; -- cgit v1.2.3 From d0091012322d5d3a37b6605cdf61ab85431e56a8 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Tue, 20 Jan 2015 15:55:34 -0800 Subject: Removing usage of reflection. > Updated launcher.java with the new APIs > Removed unused method in BitmapUtils Change-Id: I24804d2cd7d9fc45040532e8324672f5ea6fc110 --- .../com/android/gallery3d/common/BitmapUtils.java | 52 ---------------------- 1 file changed, 52 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java b/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java index a671ed2b9..6a816d990 100644 --- a/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java +++ b/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java @@ -18,17 +18,13 @@ package com.android.gallery3d.common; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; -import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; -import android.os.Build; import android.util.FloatMath; import android.util.Log; import java.io.ByteArrayOutputStream; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; public class BitmapUtils { private static final String TAG = "BitmapUtils"; @@ -187,54 +183,6 @@ public class BitmapUtils { return bitmap; } - public static Bitmap createVideoThumbnail(String filePath) { - // MediaMetadataRetriever is available on API Level 8 - // but is hidden until API Level 10 - Class clazz = null; - Object instance = null; - try { - clazz = Class.forName("android.media.MediaMetadataRetriever"); - instance = clazz.newInstance(); - - Method method = clazz.getMethod("setDataSource", String.class); - method.invoke(instance, filePath); - - // The method name changes between API Level 9 and 10. - if (Build.VERSION.SDK_INT <= 9) { - return (Bitmap) clazz.getMethod("captureFrame").invoke(instance); - } else { - byte[] data = (byte[]) clazz.getMethod("getEmbeddedPicture").invoke(instance); - if (data != null) { - Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); - if (bitmap != null) return bitmap; - } - return (Bitmap) clazz.getMethod("getFrameAtTime").invoke(instance); - } - } catch (IllegalArgumentException ex) { - // Assume this is a corrupt video file - } catch (RuntimeException ex) { - // Assume this is a corrupt video file. - } catch (InstantiationException e) { - Log.e(TAG, "createVideoThumbnail", e); - } catch (InvocationTargetException e) { - Log.e(TAG, "createVideoThumbnail", e); - } catch (ClassNotFoundException e) { - Log.e(TAG, "createVideoThumbnail", e); - } catch (NoSuchMethodException e) { - Log.e(TAG, "createVideoThumbnail", e); - } catch (IllegalAccessException e) { - Log.e(TAG, "createVideoThumbnail", e); - } finally { - try { - if (instance != null) { - clazz.getMethod("release").invoke(instance); - } - } catch (Exception ignored) { - } - } - return null; - } - public static byte[] compressToBytes(Bitmap bitmap) { return compressToBytes(bitmap, DEFAULT_JPEG_QUALITY); } -- cgit v1.2.3 From 6f553b975fba69bd9e5fd58c4db2ba72b67192ee Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 12 Feb 2015 09:46:41 -0800 Subject: Fixing last image thumb, being loaded twice Change-Id: I241e472a3f0869b82066163514fb2c29c0f18a8f --- WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 09e096396..043f6306b 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -500,10 +500,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { if (lastPhoto != null) { ImageView galleryThumbnailBg = (ImageView) pickImageTile.findViewById(R.id.wallpaper_image); - galleryThumbnailBg.setImageBitmap(getThumbnailOfLastPhoto()); + galleryThumbnailBg.setImageBitmap(lastPhoto); int colorOverlay = getResources().getColor(R.color.wallpaper_picker_translucent_gray); galleryThumbnailBg.setColorFilter(colorOverlay, PorterDuff.Mode.SRC_ATOP); - } PickImageInfo pickImageInfo = new PickImageInfo(); -- cgit v1.2.3 From fddef4634cb3b06c85662c24ffa33026d1348d54 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 12 Feb 2015 09:51:48 -0800 Subject: Fixing logic to determine if wallpaper change. > Current logic to determine if livewallpaper changed returns true all the time > Use returnCode passed by the calling activity. Change-Id: Ida800a90451b1f7d368234e1a7e10938dcf2f6f7 --- .../launcher3/LiveWallpaperListAdapter.java | 4 ++-- .../android/launcher3/WallpaperPickerActivity.java | 28 ++-------------------- 2 files changed, 4 insertions(+), 28 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java b/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java index 88f4461bf..0a9050cff 100644 --- a/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java +++ b/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java @@ -122,8 +122,8 @@ public class LiveWallpaperListAdapter extends BaseAdapter implements ListAdapter Intent preview = new Intent(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER); preview.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, mInfo.getComponent()); - a.onLiveWallpaperPickerLaunch(mInfo); - a.startActivityForResultSafely(preview, WallpaperPickerActivity.PICK_LIVE_WALLPAPER); + a.startActivityForResultSafely(preview, + WallpaperPickerActivity.PICK_WALLPAPER_THIRD_PARTY_ACTIVITY); } } diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 09e096396..4ad7b6a6b 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -20,7 +20,6 @@ import android.animation.LayoutTransition; import android.annotation.TargetApi; import android.app.ActionBar; import android.app.Activity; -import android.app.WallpaperInfo; import android.app.WallpaperManager; import android.content.Context; import android.content.Intent; @@ -83,7 +82,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { public static final int IMAGE_PICK = 5; public static final int PICK_WALLPAPER_THIRD_PARTY_ACTIVITY = 6; - public static final int PICK_LIVE_WALLPAPER = 7; private static final String TEMP_WALLPAPER_TILES = "TEMP_WALLPAPER_TILES"; private static final String SELECTED_INDEX = "SELECTED_INDEX"; private static final int FLAG_POST_DELAY_MILLIS = 200; @@ -102,9 +100,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { ArrayList mTempWallpaperTiles = new ArrayList(); private SavedWallpaperImages mSavedImages; - private WallpaperInfo mLiveWallpaperInfoOnPickerLaunch; private int mSelectedIndex = -1; - private WallpaperInfo mLastClickedLiveWallpaperInfo; public static abstract class WallpaperTileInfo { protected View mView; @@ -885,25 +881,10 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { Uri uri = data.getData(); addTemporaryWallpaperTile(uri, false); } - } else if (requestCode == PICK_WALLPAPER_THIRD_PARTY_ACTIVITY) { + } else if (requestCode == PICK_WALLPAPER_THIRD_PARTY_ACTIVITY && resultCode == RESULT_OK) { + // Something was set on the third-party activity. setResult(RESULT_OK); finish(); - } else if (requestCode == PICK_LIVE_WALLPAPER) { - WallpaperManager wm = WallpaperManager.getInstance(this); - final WallpaperInfo oldLiveWallpaper = mLiveWallpaperInfoOnPickerLaunch; - final WallpaperInfo clickedWallpaper = mLastClickedLiveWallpaperInfo; - WallpaperInfo newLiveWallpaper = wm.getWallpaperInfo(); - // Try to figure out if a live wallpaper was set; - if (newLiveWallpaper != null && - (oldLiveWallpaper == null - || !oldLiveWallpaper.getComponent() - .equals(newLiveWallpaper.getComponent()) - || clickedWallpaper.getComponent() - .equals(oldLiveWallpaper.getComponent()))) { - // Return if a live wallpaper was set - setResult(RESULT_OK); - finish(); - } } } @@ -1110,11 +1091,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { return mSavedImages; } - public void onLiveWallpaperPickerLaunch(WallpaperInfo info) { - mLastClickedLiveWallpaperInfo = info; - mLiveWallpaperInfoOnPickerLaunch = WallpaperManager.getInstance(this).getWallpaperInfo(); - } - static class ZeroPaddingDrawable extends LevelListDrawable { public ZeroPaddingDrawable(Drawable d) { super(); -- cgit v1.2.3 From c7eef375121d881e5a83d6e767d68abf87668098 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 12 Feb 2015 10:12:39 -0800 Subject: Removing unused BlockingGLTextureView Change-Id: Iac5aec1193e53dd554f61d07201bac06178914f5 --- .../photos/views/BlockingGLTextureView.java | 438 --------------------- .../com/android/photos/views/TiledImageView.java | 113 +----- 2 files changed, 11 insertions(+), 540 deletions(-) delete mode 100644 WallpaperPicker/src/com/android/photos/views/BlockingGLTextureView.java (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/photos/views/BlockingGLTextureView.java b/WallpaperPicker/src/com/android/photos/views/BlockingGLTextureView.java deleted file mode 100644 index 8a0505185..000000000 --- a/WallpaperPicker/src/com/android/photos/views/BlockingGLTextureView.java +++ /dev/null @@ -1,438 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -package com.android.photos.views; - -import android.content.Context; -import android.graphics.SurfaceTexture; -import android.opengl.GLSurfaceView.Renderer; -import android.opengl.GLUtils; -import android.util.Log; -import android.view.TextureView; -import android.view.TextureView.SurfaceTextureListener; - -import javax.microedition.khronos.egl.EGL10; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.egl.EGLContext; -import javax.microedition.khronos.egl.EGLDisplay; -import javax.microedition.khronos.egl.EGLSurface; -import javax.microedition.khronos.opengles.GL10; - -/** - * A TextureView that supports blocking rendering for synchronous drawing - */ -public class BlockingGLTextureView extends TextureView - implements SurfaceTextureListener { - - private RenderThread mRenderThread; - - public BlockingGLTextureView(Context context) { - super(context); - setSurfaceTextureListener(this); - } - - public void setRenderer(Renderer renderer) { - if (mRenderThread != null) { - throw new IllegalArgumentException("Renderer already set"); - } - mRenderThread = new RenderThread(renderer); - } - - public void render() { - mRenderThread.render(); - } - - public void destroy() { - if (mRenderThread != null) { - mRenderThread.finish(); - mRenderThread = null; - } - } - - @Override - public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, - int height) { - mRenderThread.setSurface(surface); - mRenderThread.setSize(width, height); - } - - @Override - public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, - int height) { - mRenderThread.setSize(width, height); - } - - @Override - public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { - if (mRenderThread != null) { - mRenderThread.setSurface(null); - } - return false; - } - - @Override - public void onSurfaceTextureUpdated(SurfaceTexture surface) { - } - - @Override - protected void finalize() throws Throwable { - try { - destroy(); - } catch (Throwable t) { - // Ignore - } - super.finalize(); - } - - /** - * An EGL helper class. - */ - - private static class EglHelper { - private static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; - private static final int EGL_OPENGL_ES2_BIT = 4; - - EGL10 mEgl; - EGLDisplay mEglDisplay; - EGLSurface mEglSurface; - EGLConfig mEglConfig; - EGLContext mEglContext; - - private EGLConfig chooseEglConfig() { - int[] configsCount = new int[1]; - EGLConfig[] configs = new EGLConfig[1]; - int[] configSpec = getConfig(); - if (!mEgl.eglChooseConfig(mEglDisplay, configSpec, configs, 1, configsCount)) { - throw new IllegalArgumentException("eglChooseConfig failed " + - GLUtils.getEGLErrorString(mEgl.eglGetError())); - } else if (configsCount[0] > 0) { - return configs[0]; - } - return null; - } - - private static int[] getConfig() { - return new int[] { - EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, - EGL10.EGL_RED_SIZE, 8, - EGL10.EGL_GREEN_SIZE, 8, - EGL10.EGL_BLUE_SIZE, 8, - EGL10.EGL_ALPHA_SIZE, 8, - EGL10.EGL_DEPTH_SIZE, 0, - EGL10.EGL_STENCIL_SIZE, 0, - EGL10.EGL_NONE - }; - } - - EGLContext createContext(EGL10 egl, EGLDisplay eglDisplay, EGLConfig eglConfig) { - int[] attribList = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE }; - return egl.eglCreateContext(eglDisplay, eglConfig, EGL10.EGL_NO_CONTEXT, attribList); - } - - /** - * Initialize EGL for a given configuration spec. - */ - public void start() { - /* - * Get an EGL instance - */ - mEgl = (EGL10) EGLContext.getEGL(); - - /* - * Get to the default display. - */ - mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); - - if (mEglDisplay == EGL10.EGL_NO_DISPLAY) { - throw new RuntimeException("eglGetDisplay failed"); - } - - /* - * We can now initialize EGL for that display - */ - int[] version = new int[2]; - if (!mEgl.eglInitialize(mEglDisplay, version)) { - throw new RuntimeException("eglInitialize failed"); - } - mEglConfig = chooseEglConfig(); - - /* - * Create an EGL context. We want to do this as rarely as we can, because an - * EGL context is a somewhat heavy object. - */ - mEglContext = createContext(mEgl, mEglDisplay, mEglConfig); - - if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) { - mEglContext = null; - throwEglException("createContext"); - } - - mEglSurface = null; - } - - /** - * Create an egl surface for the current SurfaceTexture surface. If a surface - * already exists, destroy it before creating the new surface. - * - * @return true if the surface was created successfully. - */ - public boolean createSurface(SurfaceTexture surface) { - /* - * Check preconditions. - */ - if (mEgl == null) { - throw new RuntimeException("egl not initialized"); - } - if (mEglDisplay == null) { - throw new RuntimeException("eglDisplay not initialized"); - } - if (mEglConfig == null) { - throw new RuntimeException("mEglConfig not initialized"); - } - - /* - * The window size has changed, so we need to create a new - * surface. - */ - destroySurfaceImp(); - - /* - * Create an EGL surface we can render into. - */ - if (surface != null) { - mEglSurface = mEgl.eglCreateWindowSurface(mEglDisplay, mEglConfig, surface, null); - } else { - mEglSurface = null; - } - - if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { - int error = mEgl.eglGetError(); - if (error == EGL10.EGL_BAD_NATIVE_WINDOW) { - Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW."); - } - return false; - } - - /* - * Before we can issue GL commands, we need to make sure - * the context is current and bound to a surface. - */ - if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { - /* - * Could not make the context current, probably because the underlying - * SurfaceView surface has been destroyed. - */ - logEglErrorAsWarning("EGLHelper", "eglMakeCurrent", mEgl.eglGetError()); - return false; - } - - return true; - } - - /** - * Create a GL object for the current EGL context. - */ - public GL10 createGL() { - return (GL10) mEglContext.getGL(); - } - - /** - * Display the current render surface. - * @return the EGL error code from eglSwapBuffers. - */ - public int swap() { - if (!mEgl.eglSwapBuffers(mEglDisplay, mEglSurface)) { - return mEgl.eglGetError(); - } - return EGL10.EGL_SUCCESS; - } - - public void destroySurface() { - destroySurfaceImp(); - } - - private void destroySurfaceImp() { - if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) { - mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, - EGL10.EGL_NO_SURFACE, - EGL10.EGL_NO_CONTEXT); - mEgl.eglDestroySurface(mEglDisplay, mEglSurface); - mEglSurface = null; - } - } - - public void finish() { - if (mEglContext != null) { - mEgl.eglDestroyContext(mEglDisplay, mEglContext); - mEglContext = null; - } - if (mEglDisplay != null) { - mEgl.eglTerminate(mEglDisplay); - mEglDisplay = null; - } - } - - private void throwEglException(String function) { - throwEglException(function, mEgl.eglGetError()); - } - - public static void throwEglException(String function, int error) { - String message = formatEglError(function, error); - throw new RuntimeException(message); - } - - public static void logEglErrorAsWarning(String tag, String function, int error) { - Log.w(tag, formatEglError(function, error)); - } - - public static String formatEglError(String function, int error) { - return function + " failed: " + error; - } - - } - - private static class RenderThread extends Thread { - private static final int INVALID = -1; - private static final int RENDER = 1; - private static final int CHANGE_SURFACE = 2; - private static final int RESIZE_SURFACE = 3; - private static final int FINISH = 4; - - private EglHelper mEglHelper = new EglHelper(); - - private Object mLock = new Object(); - private int mExecMsgId = INVALID; - private SurfaceTexture mSurface; - private Renderer mRenderer; - private int mWidth, mHeight; - - private boolean mFinished = false; - private GL10 mGL; - - public RenderThread(Renderer renderer) { - super("RenderThread"); - mRenderer = renderer; - start(); - } - - private void checkRenderer() { - if (mRenderer == null) { - throw new IllegalArgumentException("Renderer is null!"); - } - } - - private void checkSurface() { - if (mSurface == null) { - throw new IllegalArgumentException("surface is null!"); - } - } - - public void setSurface(SurfaceTexture surface) { - // If the surface is null we're being torn down, don't need a - // renderer then - if (surface != null) { - checkRenderer(); - } - mSurface = surface; - exec(CHANGE_SURFACE); - } - - public void setSize(int width, int height) { - checkRenderer(); - checkSurface(); - mWidth = width; - mHeight = height; - exec(RESIZE_SURFACE); - } - - public void render() { - checkRenderer(); - if (mSurface != null) { - exec(RENDER); - mSurface.updateTexImage(); - } - } - - public void finish() { - mSurface = null; - exec(FINISH); - try { - join(); - } catch (InterruptedException e) { - // Ignore - } - } - - private void exec(int msgid) { - synchronized (mLock) { - if (mExecMsgId != INVALID) { - throw new IllegalArgumentException( - "Message already set - multithreaded access?"); - } - mExecMsgId = msgid; - mLock.notify(); - try { - mLock.wait(); - } catch (InterruptedException e) { - // Ignore - } - } - } - - private void handleMessageLocked(int what) { - switch (what) { - case CHANGE_SURFACE: - if (mEglHelper.createSurface(mSurface)) { - mGL = mEglHelper.createGL(); - mRenderer.onSurfaceCreated(mGL, mEglHelper.mEglConfig); - } - break; - case RESIZE_SURFACE: - mRenderer.onSurfaceChanged(mGL, mWidth, mHeight); - break; - case RENDER: - mRenderer.onDrawFrame(mGL); - mEglHelper.swap(); - break; - case FINISH: - mEglHelper.destroySurface(); - mEglHelper.finish(); - mFinished = true; - break; - } - } - - @Override - public void run() { - synchronized (mLock) { - mEglHelper.start(); - while (!mFinished) { - while (mExecMsgId == INVALID) { - try { - mLock.wait(); - } catch (InterruptedException e) { - // Ignore - } - } - handleMessageLocked(mExecMsgId); - mExecMsgId = INVALID; - mLock.notify(); - } - mExecMsgId = FINISH; - } - } - } -} diff --git a/WallpaperPicker/src/com/android/photos/views/TiledImageView.java b/WallpaperPicker/src/com/android/photos/views/TiledImageView.java index 94063b027..524fa2e47 100644 --- a/WallpaperPicker/src/com/android/photos/views/TiledImageView.java +++ b/WallpaperPicker/src/com/android/photos/views/TiledImageView.java @@ -16,8 +16,6 @@ package com.android.photos.views; -import android.annotation.SuppressLint; -import android.annotation.TargetApi; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -28,11 +26,9 @@ import android.graphics.Paint.Align; import android.graphics.RectF; import android.opengl.GLSurfaceView; import android.opengl.GLSurfaceView.Renderer; -import android.os.Build; import android.util.AttributeSet; import android.view.Choreographer; import android.view.Choreographer.FrameCallback; -import android.view.View; import android.widget.FrameLayout; import com.android.gallery3d.glrenderer.BasicTexture; @@ -43,18 +39,10 @@ import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; /** - * Shows an image using {@link TiledImageRenderer} using either {@link GLSurfaceView} - * or {@link BlockingGLTextureView}. + * Shows an image using {@link TiledImageRenderer} using either {@link GLSurfaceView}. */ public class TiledImageView extends FrameLayout { - private static final boolean USE_TEXTURE_VIEW = false; - private static final boolean IS_SUPPORTED = - Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN; - private static final boolean USE_CHOREOGRAPHER = - Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN; - - private BlockingGLTextureView mTextureView; private GLSurfaceView mGLSurfaceView; private boolean mInvalPending = false; private FrameCallback mFrameCallback; @@ -79,35 +67,19 @@ public class TiledImageView extends FrameLayout { protected Object mLock = new Object(); protected ImageRendererWrapper mRenderer; - public static boolean isTilingSupported() { - return IS_SUPPORTED; - } - public TiledImageView(Context context) { this(context, null); } public TiledImageView(Context context, AttributeSet attrs) { super(context, attrs); - if (!IS_SUPPORTED) { - return; - } - mRenderer = new ImageRendererWrapper(); mRenderer.image = new TiledImageRenderer(this); - View view; - if (USE_TEXTURE_VIEW) { - mTextureView = new BlockingGLTextureView(context); - mTextureView.setRenderer(new TileRenderer()); - view = mTextureView; - } else { - mGLSurfaceView = new GLSurfaceView(context); - mGLSurfaceView.setEGLContextClientVersion(2); - mGLSurfaceView.setRenderer(new TileRenderer()); - mGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); - view = mGLSurfaceView; - } - addView(view, new LayoutParams( + mGLSurfaceView = new GLSurfaceView(context); + mGLSurfaceView.setEGLContextClientVersion(2); + mGLSurfaceView.setRenderer(new TileRenderer()); + mGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); + addView(mGLSurfaceView, new LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); //setTileSource(new ColoredTiles()); } @@ -117,22 +89,11 @@ public class TiledImageView extends FrameLayout { super.setVisibility(visibility); // need to update inner view's visibility because it seems like we're causing it to draw // from {@link #dispatchDraw} or {@link #invalidate} even if we are invisible. - if (USE_TEXTURE_VIEW) { - mTextureView.setVisibility(visibility); - } else { - mGLSurfaceView.setVisibility(visibility); - } + mGLSurfaceView.setVisibility(visibility); } public void destroy() { - if (!IS_SUPPORTED) { - return; - } - if (USE_TEXTURE_VIEW) { - mTextureView.destroy(); - } else { - mGLSurfaceView.queueEvent(mFreeTextures); - } + mGLSurfaceView.queueEvent(mFreeTextures); } private Runnable mFreeTextures = new Runnable() { @@ -144,27 +105,14 @@ public class TiledImageView extends FrameLayout { }; public void onPause() { - if (!IS_SUPPORTED) { - return; - } - if (!USE_TEXTURE_VIEW) { - mGLSurfaceView.onPause(); - } + mGLSurfaceView.onPause(); } public void onResume() { - if (!IS_SUPPORTED) { - return; - } - if (!USE_TEXTURE_VIEW) { - mGLSurfaceView.onResume(); - } + mGLSurfaceView.onResume(); } public void setTileSource(TileSource source, Runnable isReadyCallback) { - if (!IS_SUPPORTED) { - return; - } synchronized (mLock) { mRenderer.source = source; mRenderer.isReadyCallback = isReadyCallback; @@ -181,9 +129,6 @@ public class TiledImageView extends FrameLayout { protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - if (!IS_SUPPORTED) { - return; - } synchronized (mLock) { updateScaleIfNecessaryLocked(mRenderer); } @@ -199,44 +144,11 @@ public class TiledImageView extends FrameLayout { (float) getHeight() / (float) renderer.source.getImageHeight()); } - @Override - protected void dispatchDraw(Canvas canvas) { - if (!IS_SUPPORTED) { - return; - } - if (USE_TEXTURE_VIEW) { - mTextureView.render(); - } - super.dispatchDraw(canvas); - } - - @SuppressLint("NewApi") - @Override - public void setTranslationX(float translationX) { - if (!IS_SUPPORTED) { - return; - } - super.setTranslationX(translationX); - } - @Override public void invalidate() { - if (!IS_SUPPORTED) { - return; - } - if (USE_TEXTURE_VIEW) { - super.invalidate(); - mTextureView.invalidate(); - } else { - if (USE_CHOREOGRAPHER) { - invalOnVsync(); - } else { - mGLSurfaceView.requestRender(); - } - } + invalOnVsync(); } - @TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void invalOnVsync() { if (!mInvalPending) { mInvalPending = true; @@ -255,9 +167,6 @@ public class TiledImageView extends FrameLayout { private RectF mTempRectF = new RectF(); public void positionFromMatrix(Matrix matrix) { - if (!IS_SUPPORTED) { - return; - } if (mRenderer.source != null) { final int rotation = mRenderer.source.getRotation(); final boolean swap = !(rotation % 180 == 0); -- cgit v1.2.3 From 06a4d3f1afee2d1069796d585838efbc7a1f491e Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 12 Feb 2015 11:19:39 -0800 Subject: Moving some files and methods around > Removing android.util package > Moving static methods and classes out of WallpaperCropActivity > Removing some unused utility methods Change-Id: I252a0655ddce195189b6b3f0bf92970e5808c9d7 --- WallpaperPicker/src/android/util/Pools.java | 165 ------ .../android/gallery3d/common/BitmapCropTask.java | 405 +++++++++++++++ .../com/android/gallery3d/common/BitmapUtils.java | 243 ++++----- .../src/com/android/gallery3d/common/Utils.java | 271 ++-------- .../android/gallery3d/glrenderer/BasicTexture.java | 1 - .../android/gallery3d/glrenderer/GLES20Canvas.java | 2 - .../com/android/gallery3d/glrenderer/IntArray.java | 60 +++ .../src/com/android/gallery3d/util/IntArray.java | 60 --- .../android/launcher3/WallpaperCropActivity.java | 553 +-------------------- .../android/launcher3/WallpaperPickerActivity.java | 15 +- .../src/com/android/photos/views/Pools.java | 165 ++++++ .../android/photos/views/TiledImageRenderer.java | 4 +- 12 files changed, 791 insertions(+), 1153 deletions(-) delete mode 100644 WallpaperPicker/src/android/util/Pools.java create mode 100644 WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java create mode 100644 WallpaperPicker/src/com/android/gallery3d/glrenderer/IntArray.java delete mode 100644 WallpaperPicker/src/com/android/gallery3d/util/IntArray.java create mode 100644 WallpaperPicker/src/com/android/photos/views/Pools.java (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/android/util/Pools.java b/WallpaperPicker/src/android/util/Pools.java deleted file mode 100644 index 40bab1eae..000000000 --- a/WallpaperPicker/src/android/util/Pools.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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. - */ - -package android.util; - -/** - * Helper class for crating pools of objects. An example use looks like this: - *
- * public class MyPooledClass {
- *
- *     private static final SynchronizedPool sPool =
- *             new SynchronizedPool(10);
- *
- *     public static MyPooledClass obtain() {
- *         MyPooledClass instance = sPool.acquire();
- *         return (instance != null) ? instance : new MyPooledClass();
- *     }
- *
- *     public void recycle() {
- *          // Clear state if needed.
- *          sPool.release(this);
- *     }
- *
- *     . . .
- * }
- * 
- * - * @hide - */ -public final class Pools { - - /** - * Interface for managing a pool of objects. - * - * @param The pooled type. - */ - public static interface Pool { - - /** - * @return An instance from the pool if such, null otherwise. - */ - public T acquire(); - - /** - * Release an instance to the pool. - * - * @param instance The instance to release. - * @return Whether the instance was put in the pool. - * - * @throws IllegalStateException If the instance is already in the pool. - */ - public boolean release(T instance); - } - - private Pools() { - /* do nothing - hiding constructor */ - } - - /** - * Simple (non-synchronized) pool of objects. - * - * @param The pooled type. - */ - public static class SimplePool implements Pool { - private final Object[] mPool; - - private int mPoolSize; - - /** - * Creates a new instance. - * - * @param maxPoolSize The max pool size. - * - * @throws IllegalArgumentException If the max pool size is less than zero. - */ - public SimplePool(int maxPoolSize) { - if (maxPoolSize <= 0) { - throw new IllegalArgumentException("The max pool size must be > 0"); - } - mPool = new Object[maxPoolSize]; - } - - @Override - @SuppressWarnings("unchecked") - public T acquire() { - if (mPoolSize > 0) { - final int lastPooledIndex = mPoolSize - 1; - T instance = (T) mPool[lastPooledIndex]; - mPool[lastPooledIndex] = null; - mPoolSize--; - return instance; - } - return null; - } - - @Override - public boolean release(T instance) { - if (isInPool(instance)) { - throw new IllegalStateException("Already in the pool!"); - } - if (mPoolSize < mPool.length) { - mPool[mPoolSize] = instance; - mPoolSize++; - return true; - } - return false; - } - - private boolean isInPool(T instance) { - for (int i = 0; i < mPoolSize; i++) { - if (mPool[i] == instance) { - return true; - } - } - return false; - } - } - - /** - * Synchronized) pool of objects. - * - * @param The pooled type. - */ - public static class SynchronizedPool extends SimplePool { - private final Object mLock = new Object(); - - /** - * Creates a new instance. - * - * @param maxPoolSize The max pool size. - * - * @throws IllegalArgumentException If the max pool size is less than zero. - */ - public SynchronizedPool(int maxPoolSize) { - super(maxPoolSize); - } - - @Override - public T acquire() { - synchronized (mLock) { - return super.acquire(); - } - } - - @Override - public boolean release(T element) { - synchronized (mLock) { - return super.release(element); - } - } - } -} \ No newline at end of file diff --git a/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java b/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java new file mode 100644 index 000000000..45118bf45 --- /dev/null +++ b/WallpaperPicker/src/com/android/gallery3d/common/BitmapCropTask.java @@ -0,0 +1,405 @@ +/** + * Copyright (C) 2015 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. + */ +package com.android.gallery3d.common; + +import android.app.WallpaperManager; +import android.content.Context; +import android.content.res.Resources; +import android.graphics.Bitmap; +import android.graphics.Bitmap.CompressFormat; +import android.graphics.BitmapFactory; +import android.graphics.BitmapRegionDecoder; +import android.graphics.Canvas; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.graphics.Point; +import android.graphics.Rect; +import android.graphics.RectF; +import android.net.Uri; +import android.os.AsyncTask; +import android.util.Log; + +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; + +public class BitmapCropTask extends AsyncTask { + + public interface OnBitmapCroppedHandler { + public void onBitmapCropped(byte[] imageBytes); + } + + private static final int DEFAULT_COMPRESS_QUALITY = 90; + private static final String LOGTAG = "BitmapCropTask"; + + Uri mInUri = null; + Context mContext; + String mInFilePath; + byte[] mInImageBytes; + int mInResId = 0; + RectF mCropBounds = null; + int mOutWidth, mOutHeight; + int mRotation; + boolean mSetWallpaper; + boolean mSaveCroppedBitmap; + Bitmap mCroppedBitmap; + Runnable mOnEndRunnable; + Resources mResources; + BitmapCropTask.OnBitmapCroppedHandler mOnBitmapCroppedHandler; + boolean mNoCrop; + + public BitmapCropTask(Context c, String filePath, + RectF cropBounds, int rotation, int outWidth, int outHeight, + boolean setWallpaper, boolean saveCroppedBitmap, Runnable onEndRunnable) { + mContext = c; + mInFilePath = filePath; + init(cropBounds, rotation, + outWidth, outHeight, setWallpaper, saveCroppedBitmap, onEndRunnable); + } + + public BitmapCropTask(byte[] imageBytes, + RectF cropBounds, int rotation, int outWidth, int outHeight, + boolean setWallpaper, boolean saveCroppedBitmap, Runnable onEndRunnable) { + mInImageBytes = imageBytes; + init(cropBounds, rotation, + outWidth, outHeight, setWallpaper, saveCroppedBitmap, onEndRunnable); + } + + public BitmapCropTask(Context c, Uri inUri, + RectF cropBounds, int rotation, int outWidth, int outHeight, + boolean setWallpaper, boolean saveCroppedBitmap, Runnable onEndRunnable) { + mContext = c; + mInUri = inUri; + init(cropBounds, rotation, + outWidth, outHeight, setWallpaper, saveCroppedBitmap, onEndRunnable); + } + + public BitmapCropTask(Context c, Resources res, int inResId, + RectF cropBounds, int rotation, int outWidth, int outHeight, + boolean setWallpaper, boolean saveCroppedBitmap, Runnable onEndRunnable) { + mContext = c; + mInResId = inResId; + mResources = res; + init(cropBounds, rotation, + outWidth, outHeight, setWallpaper, saveCroppedBitmap, onEndRunnable); + } + + private void init(RectF cropBounds, int rotation, int outWidth, int outHeight, + boolean setWallpaper, boolean saveCroppedBitmap, Runnable onEndRunnable) { + mCropBounds = cropBounds; + mRotation = rotation; + mOutWidth = outWidth; + mOutHeight = outHeight; + mSetWallpaper = setWallpaper; + mSaveCroppedBitmap = saveCroppedBitmap; + mOnEndRunnable = onEndRunnable; + } + + public void setOnBitmapCropped(BitmapCropTask.OnBitmapCroppedHandler handler) { + mOnBitmapCroppedHandler = handler; + } + + public void setNoCrop(boolean value) { + mNoCrop = value; + } + + public void setOnEndRunnable(Runnable onEndRunnable) { + mOnEndRunnable = onEndRunnable; + } + + // Helper to setup input stream + private InputStream regenerateInputStream() { + if (mInUri == null && mInResId == 0 && mInFilePath == null && mInImageBytes == null) { + Log.w(LOGTAG, "cannot read original file, no input URI, resource ID, or " + + "image byte array given"); + } else { + try { + if (mInUri != null) { + return new BufferedInputStream( + mContext.getContentResolver().openInputStream(mInUri)); + } else if (mInFilePath != null) { + return mContext.openFileInput(mInFilePath); + } else if (mInImageBytes != null) { + return new BufferedInputStream(new ByteArrayInputStream(mInImageBytes)); + } else { + return new BufferedInputStream(mResources.openRawResource(mInResId)); + } + } catch (FileNotFoundException e) { + Log.w(LOGTAG, "cannot read file: " + mInUri.toString(), e); + } + } + return null; + } + + public Point getImageBounds() { + InputStream is = regenerateInputStream(); + if (is != null) { + BitmapFactory.Options options = new BitmapFactory.Options(); + options.inJustDecodeBounds = true; + BitmapFactory.decodeStream(is, null, options); + Utils.closeSilently(is); + if (options.outWidth != 0 && options.outHeight != 0) { + return new Point(options.outWidth, options.outHeight); + } + } + return null; + } + + public void setCropBounds(RectF cropBounds) { + mCropBounds = cropBounds; + } + + public Bitmap getCroppedBitmap() { + return mCroppedBitmap; + } + public boolean cropBitmap() { + boolean failure = false; + + + WallpaperManager wallpaperManager = null; + if (mSetWallpaper) { + wallpaperManager = WallpaperManager.getInstance(mContext.getApplicationContext()); + } + + + if (mSetWallpaper && mNoCrop) { + try { + InputStream is = regenerateInputStream(); + if (is != null) { + wallpaperManager.setStream(is); + Utils.closeSilently(is); + } + } catch (IOException e) { + Log.w(LOGTAG, "cannot write stream to wallpaper", e); + failure = true; + } + return !failure; + } else { + // Find crop bounds (scaled to original image size) + Rect roundedTrueCrop = new Rect(); + Matrix rotateMatrix = new Matrix(); + Matrix inverseRotateMatrix = new Matrix(); + + Point bounds = getImageBounds(); + if (mRotation > 0) { + rotateMatrix.setRotate(mRotation); + inverseRotateMatrix.setRotate(-mRotation); + + mCropBounds.roundOut(roundedTrueCrop); + mCropBounds = new RectF(roundedTrueCrop); + + if (bounds == null) { + Log.w(LOGTAG, "cannot get bounds for image"); + failure = true; + return false; + } + + float[] rotatedBounds = new float[] { bounds.x, bounds.y }; + rotateMatrix.mapPoints(rotatedBounds); + rotatedBounds[0] = Math.abs(rotatedBounds[0]); + rotatedBounds[1] = Math.abs(rotatedBounds[1]); + + mCropBounds.offset(-rotatedBounds[0]/2, -rotatedBounds[1]/2); + inverseRotateMatrix.mapRect(mCropBounds); + mCropBounds.offset(bounds.x/2, bounds.y/2); + + } + + mCropBounds.roundOut(roundedTrueCrop); + + if (roundedTrueCrop.width() <= 0 || roundedTrueCrop.height() <= 0) { + Log.w(LOGTAG, "crop has bad values for full size image"); + failure = true; + return false; + } + + // See how much we're reducing the size of the image + int scaleDownSampleSize = Math.max(1, Math.min(roundedTrueCrop.width() / mOutWidth, + roundedTrueCrop.height() / mOutHeight)); + // Attempt to open a region decoder + BitmapRegionDecoder decoder = null; + InputStream is = null; + try { + is = regenerateInputStream(); + if (is == null) { + Log.w(LOGTAG, "cannot get input stream for uri=" + mInUri.toString()); + failure = true; + return false; + } + decoder = BitmapRegionDecoder.newInstance(is, false); + Utils.closeSilently(is); + } catch (IOException e) { + Log.w(LOGTAG, "cannot open region decoder for file: " + mInUri.toString(), e); + } finally { + Utils.closeSilently(is); + is = null; + } + + Bitmap crop = null; + if (decoder != null) { + // Do region decoding to get crop bitmap + BitmapFactory.Options options = new BitmapFactory.Options(); + if (scaleDownSampleSize > 1) { + options.inSampleSize = scaleDownSampleSize; + } + crop = decoder.decodeRegion(roundedTrueCrop, options); + decoder.recycle(); + } + + if (crop == null) { + // BitmapRegionDecoder has failed, try to crop in-memory + is = regenerateInputStream(); + Bitmap fullSize = null; + if (is != null) { + BitmapFactory.Options options = new BitmapFactory.Options(); + if (scaleDownSampleSize > 1) { + options.inSampleSize = scaleDownSampleSize; + } + fullSize = BitmapFactory.decodeStream(is, null, options); + Utils.closeSilently(is); + } + if (fullSize != null) { + // Find out the true sample size that was used by the decoder + scaleDownSampleSize = bounds.x / fullSize.getWidth(); + mCropBounds.left /= scaleDownSampleSize; + mCropBounds.top /= scaleDownSampleSize; + mCropBounds.bottom /= scaleDownSampleSize; + mCropBounds.right /= scaleDownSampleSize; + mCropBounds.roundOut(roundedTrueCrop); + + // Adjust values to account for issues related to rounding + if (roundedTrueCrop.width() > fullSize.getWidth()) { + // Adjust the width + roundedTrueCrop.right = roundedTrueCrop.left + fullSize.getWidth(); + } + if (roundedTrueCrop.right > fullSize.getWidth()) { + // Adjust the left value + int adjustment = roundedTrueCrop.left - + Math.max(0, roundedTrueCrop.right - roundedTrueCrop.width()); + roundedTrueCrop.left -= adjustment; + roundedTrueCrop.right -= adjustment; + } + if (roundedTrueCrop.height() > fullSize.getHeight()) { + // Adjust the height + roundedTrueCrop.bottom = roundedTrueCrop.top + fullSize.getHeight(); + } + if (roundedTrueCrop.bottom > fullSize.getHeight()) { + // Adjust the top value + int adjustment = roundedTrueCrop.top - + Math.max(0, roundedTrueCrop.bottom - roundedTrueCrop.height()); + roundedTrueCrop.top -= adjustment; + roundedTrueCrop.bottom -= adjustment; + } + + crop = Bitmap.createBitmap(fullSize, roundedTrueCrop.left, + roundedTrueCrop.top, roundedTrueCrop.width(), + roundedTrueCrop.height()); + } + } + + if (crop == null) { + Log.w(LOGTAG, "cannot decode file: " + mInUri.toString()); + failure = true; + return false; + } + if (mOutWidth > 0 && mOutHeight > 0 || mRotation > 0) { + float[] dimsAfter = new float[] { crop.getWidth(), crop.getHeight() }; + rotateMatrix.mapPoints(dimsAfter); + dimsAfter[0] = Math.abs(dimsAfter[0]); + dimsAfter[1] = Math.abs(dimsAfter[1]); + + if (!(mOutWidth > 0 && mOutHeight > 0)) { + mOutWidth = Math.round(dimsAfter[0]); + mOutHeight = Math.round(dimsAfter[1]); + } + + RectF cropRect = new RectF(0, 0, dimsAfter[0], dimsAfter[1]); + RectF returnRect = new RectF(0, 0, mOutWidth, mOutHeight); + + Matrix m = new Matrix(); + if (mRotation == 0) { + m.setRectToRect(cropRect, returnRect, Matrix.ScaleToFit.FILL); + } else { + Matrix m1 = new Matrix(); + m1.setTranslate(-crop.getWidth() / 2f, -crop.getHeight() / 2f); + Matrix m2 = new Matrix(); + m2.setRotate(mRotation); + Matrix m3 = new Matrix(); + m3.setTranslate(dimsAfter[0] / 2f, dimsAfter[1] / 2f); + Matrix m4 = new Matrix(); + m4.setRectToRect(cropRect, returnRect, Matrix.ScaleToFit.FILL); + + Matrix c1 = new Matrix(); + c1.setConcat(m2, m1); + Matrix c2 = new Matrix(); + c2.setConcat(m4, m3); + m.setConcat(c2, c1); + } + + Bitmap tmp = Bitmap.createBitmap((int) returnRect.width(), + (int) returnRect.height(), Bitmap.Config.ARGB_8888); + if (tmp != null) { + Canvas c = new Canvas(tmp); + Paint p = new Paint(); + p.setFilterBitmap(true); + c.drawBitmap(crop, m, p); + crop = tmp; + } + } + + if (mSaveCroppedBitmap) { + mCroppedBitmap = crop; + } + + // Compress to byte array + ByteArrayOutputStream tmpOut = new ByteArrayOutputStream(2048); + if (crop.compress(CompressFormat.JPEG, DEFAULT_COMPRESS_QUALITY, tmpOut)) { + // If we need to set to the wallpaper, set it + if (mSetWallpaper && wallpaperManager != null) { + try { + byte[] outByteArray = tmpOut.toByteArray(); + wallpaperManager.setStream(new ByteArrayInputStream(outByteArray)); + if (mOnBitmapCroppedHandler != null) { + mOnBitmapCroppedHandler.onBitmapCropped(outByteArray); + } + } catch (IOException e) { + Log.w(LOGTAG, "cannot write stream to wallpaper", e); + failure = true; + } + } + } else { + Log.w(LOGTAG, "cannot compress bitmap"); + failure = true; + } + } + return !failure; // True if any of the operations failed + } + + @Override + protected Boolean doInBackground(Void... params) { + return cropBitmap(); + } + + @Override + protected void onPostExecute(Boolean result) { + if (mOnEndRunnable != null) { + mOnEndRunnable.run(); + } + } +} \ No newline at end of file diff --git a/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java b/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java index 6a816d990..347001783 100644 --- a/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java +++ b/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java @@ -16,83 +16,32 @@ package com.android.gallery3d.common; +import android.annotation.TargetApi; +import android.content.Context; +import android.content.res.Resources; import android.graphics.Bitmap; -import android.graphics.Bitmap.CompressFormat; import android.graphics.Canvas; -import android.graphics.Matrix; import android.graphics.Paint; -import android.util.FloatMath; +import android.graphics.Point; +import android.net.Uri; +import android.os.Build; import android.util.Log; +import android.view.WindowManager; -import java.io.ByteArrayOutputStream; +import com.android.gallery3d.exif.ExifInterface; +import com.android.launcher3.WallpaperCropActivity; -public class BitmapUtils { - private static final String TAG = "BitmapUtils"; - private static final int DEFAULT_JPEG_QUALITY = 90; - public static final int UNCONSTRAINED = -1; - - private BitmapUtils(){} - - /* - * Compute the sample size as a function of minSideLength - * and maxNumOfPixels. - * minSideLength is used to specify that minimal width or height of a - * bitmap. - * maxNumOfPixels is used to specify the maximal size in pixels that is - * tolerable in terms of memory usage. - * - * The function returns a sample size based on the constraints. - * Both size and minSideLength can be passed in as UNCONSTRAINED, - * which indicates no care of the corresponding constraint. - * The functions prefers returning a sample size that - * generates a smaller bitmap, unless minSideLength = UNCONSTRAINED. - * - * Also, the function rounds up the sample size to a power of 2 or multiple - * of 8 because BitmapFactory only honors sample size this way. - * For example, BitmapFactory downsamples an image by 2 even though the - * request is 3. So we round up the sample size to avoid OOM. - */ - public static int computeSampleSize(int width, int height, - int minSideLength, int maxNumOfPixels) { - int initialSize = computeInitialSampleSize( - width, height, minSideLength, maxNumOfPixels); - - return initialSize <= 8 - ? Utils.nextPowerOf2(initialSize) - : (initialSize + 7) / 8 * 8; - } - - private static int computeInitialSampleSize(int w, int h, - int minSideLength, int maxNumOfPixels) { - if (maxNumOfPixels == UNCONSTRAINED - && minSideLength == UNCONSTRAINED) return 1; - - int lowerBound = (maxNumOfPixels == UNCONSTRAINED) ? 1 : - (int) FloatMath.ceil(FloatMath.sqrt((float) (w * h) / maxNumOfPixels)); - - if (minSideLength == UNCONSTRAINED) { - return lowerBound; - } else { - int sampleSize = Math.min(w / minSideLength, h / minSideLength); - return Math.max(sampleSize, lowerBound); - } - } +import java.io.BufferedInputStream; +import java.io.IOException; +import java.io.InputStream; - // This computes a sample size which makes the longer side at least - // minSideLength long. If that's not possible, return 1. - public static int computeSampleSizeLarger(int w, int h, - int minSideLength) { - int initialSize = Math.max(w / minSideLength, h / minSideLength); - if (initialSize <= 1) return 1; +public class BitmapUtils { - return initialSize <= 8 - ? Utils.prevPowerOf2(initialSize) - : initialSize / 8 * 8; - } + private static final String TAG = "BitmapUtils"; // Find the min x that 1 / x >= scale public static int computeSampleSizeLarger(float scale) { - int initialSize = (int) FloatMath.floor(1f / scale); + int initialSize = (int) Math.floor(1f / scale); if (initialSize <= 1) return 1; return initialSize <= 8 @@ -100,15 +49,6 @@ public class BitmapUtils { : initialSize / 8 * 8; } - // Find the max x that 1 / x <= scale. - public static int computeSampleSize(float scale) { - Utils.assertTrue(scale > 0); - int initialSize = Math.max(1, (int) FloatMath.ceil(1 / scale)); - return initialSize <= 8 - ? Utils.nextPowerOf2(initialSize) - : (initialSize + 7) / 8 * 8; - } - public static Bitmap resizeBitmapByScale( Bitmap bitmap, float scale, boolean recycle) { int width = Math.round(bitmap.getWidth() * scale); @@ -132,77 +72,104 @@ public class BitmapUtils { return config; } - public static Bitmap resizeDownBySideLength( - Bitmap bitmap, int maxLength, boolean recycle) { - int srcWidth = bitmap.getWidth(); - int srcHeight = bitmap.getHeight(); - float scale = Math.min( - (float) maxLength / srcWidth, (float) maxLength / srcHeight); - if (scale >= 1.0f) return bitmap; - return resizeBitmapByScale(bitmap, scale, recycle); - } - - public static Bitmap resizeAndCropCenter(Bitmap bitmap, int size, boolean recycle) { - int w = bitmap.getWidth(); - int h = bitmap.getHeight(); - if (w == size && h == size) return bitmap; - - // scale the image so that the shorter side equals to the target; - // the longer side will be center-cropped. - float scale = (float) size / Math.min(w, h); - - Bitmap target = Bitmap.createBitmap(size, size, getConfig(bitmap)); - int width = Math.round(scale * bitmap.getWidth()); - int height = Math.round(scale * bitmap.getHeight()); - Canvas canvas = new Canvas(target); - canvas.translate((size - width) / 2f, (size - height) / 2f); - canvas.scale(scale, scale); - Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG); - canvas.drawBitmap(bitmap, 0, 0, paint); - if (recycle) bitmap.recycle(); - return target; + /** + * As a ratio of screen height, the total distance we want the parallax effect to span + * horizontally + */ + public static float wallpaperTravelToScreenWidthRatio(int width, int height) { + float aspectRatio = width / (float) height; + + // At an aspect ratio of 16/10, the wallpaper parallax effect should span 1.5 * screen width + // At an aspect ratio of 10/16, the wallpaper parallax effect should span 1.2 * screen width + // We will use these two data points to extrapolate how much the wallpaper parallax effect + // to span (ie travel) at any aspect ratio: + + final float ASPECT_RATIO_LANDSCAPE = 16/10f; + final float ASPECT_RATIO_PORTRAIT = 10/16f; + final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE = 1.5f; + final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT = 1.2f; + + // To find out the desired width at different aspect ratios, we use the following two + // formulas, where the coefficient on x is the aspect ratio (width/height): + // (16/10)x + y = 1.5 + // (10/16)x + y = 1.2 + // We solve for x and y and end up with a final formula: + final float x = + (WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE - WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT) / + (ASPECT_RATIO_LANDSCAPE - ASPECT_RATIO_PORTRAIT); + final float y = WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT - x * ASPECT_RATIO_PORTRAIT; + return x * aspectRatio + y; } - public static void recycleSilently(Bitmap bitmap) { - if (bitmap == null) return; - try { - bitmap.recycle(); - } catch (Throwable t) { - Log.w(TAG, "unable recycle bitmap", t); + private static Point sDefaultWallpaperSize; + + @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) + public static Point getDefaultWallpaperSize(Resources res, WindowManager windowManager) { + if (sDefaultWallpaperSize == null) { + Point minDims = new Point(); + Point maxDims = new Point(); + windowManager.getDefaultDisplay().getCurrentSizeRange(minDims, maxDims); + + int maxDim = Math.max(maxDims.x, maxDims.y); + int minDim = Math.max(minDims.x, minDims.y); + + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { + Point realSize = new Point(); + windowManager.getDefaultDisplay().getRealSize(realSize); + maxDim = Math.max(realSize.x, realSize.y); + minDim = Math.min(realSize.x, realSize.y); + } + + // We need to ensure that there is enough extra space in the wallpaper + // for the intended parallax effects + final int defaultWidth, defaultHeight; + if (res.getConfiguration().smallestScreenWidthDp >= 720) { + defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim)); + defaultHeight = maxDim; + } else { + defaultWidth = Math.max((int) (minDim * WallpaperCropActivity.WALLPAPER_SCREENS_SPAN), maxDim); + defaultHeight = maxDim; + } + sDefaultWallpaperSize = new Point(defaultWidth, defaultHeight); } + return sDefaultWallpaperSize; } - public static Bitmap rotateBitmap(Bitmap source, int rotation, boolean recycle) { - if (rotation == 0) return source; - int w = source.getWidth(); - int h = source.getHeight(); - Matrix m = new Matrix(); - m.postRotate(rotation); - Bitmap bitmap = Bitmap.createBitmap(source, 0, 0, w, h, m, true); - if (recycle) source.recycle(); - return bitmap; - } - - public static byte[] compressToBytes(Bitmap bitmap) { - return compressToBytes(bitmap, DEFAULT_JPEG_QUALITY); + public static int getRotationFromExif(Context context, Uri uri) { + return BitmapUtils.getRotationFromExifHelper(null, 0, context, uri); } - public static byte[] compressToBytes(Bitmap bitmap, int quality) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(65536); - bitmap.compress(CompressFormat.JPEG, quality, baos); - return baos.toByteArray(); + public static int getRotationFromExif(Resources res, int resId) { + return BitmapUtils.getRotationFromExifHelper(res, resId, null, null); } - public static boolean isSupportedByRegionDecoder(String mimeType) { - if (mimeType == null) return false; - mimeType = mimeType.toLowerCase(); - return mimeType.startsWith("image/") && - (!mimeType.equals("image/gif") && !mimeType.endsWith("bmp")); - } - - public static boolean isRotationSupported(String mimeType) { - if (mimeType == null) return false; - mimeType = mimeType.toLowerCase(); - return mimeType.equals("image/jpeg"); + private static int getRotationFromExifHelper(Resources res, int resId, Context context, Uri uri) { + ExifInterface ei = new ExifInterface(); + InputStream is = null; + BufferedInputStream bis = null; + try { + if (uri != null) { + is = context.getContentResolver().openInputStream(uri); + bis = new BufferedInputStream(is); + ei.readExif(bis); + } else { + is = res.openRawResource(resId); + bis = new BufferedInputStream(is); + ei.readExif(bis); + } + Integer ori = ei.getTagIntValue(ExifInterface.TAG_ORIENTATION); + if (ori != null) { + return ExifInterface.getRotationForOrientationValue(ori.shortValue()); + } + } catch (IOException e) { + Log.w(TAG, "Getting exif data failed", e); + } catch (NullPointerException e) { + // Sometimes the ExifInterface has an internal NPE if Exif data isn't valid + Log.w(TAG, "Getting exif data failed", e); + } finally { + Utils.closeSilently(bis); + Utils.closeSilently(is); + } + return 0; } } diff --git a/WallpaperPicker/src/com/android/gallery3d/common/Utils.java b/WallpaperPicker/src/com/android/gallery3d/common/Utils.java index 614a081c8..8466c22cb 100644 --- a/WallpaperPicker/src/com/android/gallery3d/common/Utils.java +++ b/WallpaperPicker/src/com/android/gallery3d/common/Utils.java @@ -16,32 +16,16 @@ package com.android.gallery3d.common; -import android.content.Context; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager.NameNotFoundException; import android.database.Cursor; -import android.os.Build; +import android.graphics.RectF; import android.os.ParcelFileDescriptor; -import android.text.TextUtils; import android.util.Log; import java.io.Closeable; import java.io.IOException; -import java.io.InterruptedIOException; public class Utils { private static final String TAG = "Utils"; - private static final String DEBUG_TAG = "GalleryDebug"; - - private static final long POLY64REV = 0x95AC9329AC4BC9B5L; - private static final long INITIALCRC = 0xFFFFFFFFFFFFFFFFL; - - private static long[] sCrcTable = new long[256]; - - private static final boolean IS_DEBUG_BUILD = - Build.TYPE.equals("eng") || Build.TYPE.equals("userdebug"); - - private static final String MASK_STRING = "********************************"; // Throws AssertionError if the input is false. public static void assertTrue(boolean cond) { @@ -50,28 +34,6 @@ public class Utils { } } - // Throws AssertionError with the message. We had a method having the form - // assertTrue(boolean cond, String message, Object ... args); - // However a call to that method will cause memory allocation even if the - // condition is false (due to autoboxing generated by "Object ... args"), - // so we don't use that anymore. - public static void fail(String message, Object ... args) { - throw new AssertionError( - args.length == 0 ? message : String.format(message, args)); - } - - // Throws NullPointerException if the input is null. - public static T checkNotNull(T object) { - if (object == null) throw new NullPointerException(); - return object; - } - - // Returns true if two input Object are both null or equal - // to each other. - public static boolean equals(Object a, Object b) { - return (a == b) || (a == null ? false : a.equals(b)); - } - // Returns the next power of two. // Returns the input if it is already power of 2. // Throws IllegalArgumentException if the input is <= 0 or @@ -102,87 +64,6 @@ public class Utils { return x; } - // Returns the input value x clamped to the range [min, max]. - public static float clamp(float x, float min, float max) { - if (x > max) return max; - if (x < min) return min; - return x; - } - - // Returns the input value x clamped to the range [min, max]. - public static long clamp(long x, long min, long max) { - if (x > max) return max; - if (x < min) return min; - return x; - } - - public static boolean isOpaque(int color) { - return color >>> 24 == 0xFF; - } - - public static void swap(int[] array, int i, int j) { - int temp = array[i]; - array[i] = array[j]; - array[j] = temp; - } - - /** - * A function thats returns a 64-bit crc for string - * - * @param in input string - * @return a 64-bit crc value - */ - public static final long crc64Long(String in) { - if (in == null || in.length() == 0) { - return 0; - } - return crc64Long(getBytes(in)); - } - - static { - // http://bioinf.cs.ucl.ac.uk/downloads/crc64/crc64.c - long part; - for (int i = 0; i < 256; i++) { - part = i; - for (int j = 0; j < 8; j++) { - long x = ((int) part & 1) != 0 ? POLY64REV : 0; - part = (part >> 1) ^ x; - } - sCrcTable[i] = part; - } - } - - public static final long crc64Long(byte[] buffer) { - long crc = INITIALCRC; - for (int k = 0, n = buffer.length; k < n; ++k) { - crc = sCrcTable[(((int) crc) ^ buffer[k]) & 0xff] ^ (crc >> 8); - } - return crc; - } - - public static byte[] getBytes(String in) { - byte[] result = new byte[in.length() * 2]; - int output = 0; - for (char ch : in.toCharArray()) { - result[output++] = (byte) (ch & 0xFF); - result[output++] = (byte) (ch >> 8); - } - return result; - } - - public static void closeSilently(Closeable c) { - if (c == null) return; - try { - c.close(); - } catch (IOException t) { - Log.w(TAG, "close fail ", t); - } - } - - public static int compare(long a, long b) { - return a < b ? -1 : a == b ? 0 : 1; - } - public static int ceilLog2(float value) { int i; for (i = 0; i < 31; i++) { @@ -199,6 +80,15 @@ public class Utils { return i - 1; } + public static void closeSilently(Closeable c) { + if (c == null) return; + try { + c.close(); + } catch (IOException t) { + Log.w(TAG, "close fail ", t); + } + } + public static void closeSilently(ParcelFileDescriptor fd) { try { if (fd != null) fd.close(); @@ -215,126 +105,25 @@ public class Utils { } } - public static float interpolateAngle( - float source, float target, float progress) { - // interpolate the angle from source to target - // We make the difference in the range of [-179, 180], this is the - // shortest path to change source to target. - float diff = target - source; - if (diff < 0) diff += 360f; - if (diff > 180) diff -= 360f; - - float result = source + diff * progress; - return result < 0 ? result + 360f : result; - } - - public static float interpolateScale( - float source, float target, float progress) { - return source + progress * (target - source); - } - - public static String ensureNotNull(String value) { - return value == null ? "" : value; - } - - public static float parseFloatSafely(String content, float defaultValue) { - if (content == null) return defaultValue; - try { - return Float.parseFloat(content); - } catch (NumberFormatException e) { - return defaultValue; - } - } - - public static int parseIntSafely(String content, int defaultValue) { - if (content == null) return defaultValue; - try { - return Integer.parseInt(content); - } catch (NumberFormatException e) { - return defaultValue; - } - } - - public static boolean isNullOrEmpty(String exifMake) { - return TextUtils.isEmpty(exifMake); - } - - public static void waitWithoutInterrupt(Object object) { - try { - object.wait(); - } catch (InterruptedException e) { - Log.w(TAG, "unexpected interrupt: " + object); - } - } - - public static boolean handleInterrruptedException(Throwable e) { - // A helper to deal with the interrupt exception - // If an interrupt detected, we will setup the bit again. - if (e instanceof InterruptedIOException - || e instanceof InterruptedException) { - Thread.currentThread().interrupt(); - return true; - } - return false; - } - - /** - * @return String with special XML characters escaped. - */ - public static String escapeXml(String s) { - StringBuilder sb = new StringBuilder(); - for (int i = 0, len = s.length(); i < len; ++i) { - char c = s.charAt(i); - switch (c) { - case '<': sb.append("<"); break; - case '>': sb.append(">"); break; - case '\"': sb.append("""); break; - case '\'': sb.append("'"); break; - case '&': sb.append("&"); break; - default: sb.append(c); - } - } - return sb.toString(); - } - - public static String getUserAgent(Context context) { - PackageInfo packageInfo; - try { - packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); - } catch (NameNotFoundException e) { - throw new IllegalStateException("getPackageInfo failed"); - } - return String.format("%s/%s; %s/%s/%s/%s; %s/%s/%s", - packageInfo.packageName, - packageInfo.versionName, - Build.BRAND, - Build.DEVICE, - Build.MODEL, - Build.ID, - Build.VERSION.SDK_INT, - Build.VERSION.RELEASE, - Build.VERSION.INCREMENTAL); - } - - public static String[] copyOf(String[] source, int newSize) { - String[] result = new String[newSize]; - newSize = Math.min(source.length, newSize); - System.arraycopy(source, 0, result, 0, newSize); - return result; - } - - // Mask information for debugging only. It returns info.toString() directly - // for debugging build (i.e., 'eng' and 'userdebug') and returns a mask ("****") - // in release build to protect the information (e.g. for privacy issue). - public static String maskDebugInfo(Object info) { - if (info == null) return null; - String s = info.toString(); - int length = Math.min(s.length(), MASK_STRING.length()); - return IS_DEBUG_BUILD ? s : MASK_STRING.substring(0, length); - } - - // This method should be ONLY used for debugging. - public static void debug(String message, Object ... args) { - Log.v(DEBUG_TAG, String.format(message, args)); + public static RectF getMaxCropRect( + int inWidth, int inHeight, int outWidth, int outHeight, boolean leftAligned) { + RectF cropRect = new RectF(); + // Get a crop rect that will fit this + if (inWidth / (float) inHeight > outWidth / (float) outHeight) { + cropRect.top = 0; + cropRect.bottom = inHeight; + cropRect.left = (inWidth - (outWidth / (float) outHeight) * inHeight) / 2; + cropRect.right = inWidth - cropRect.left; + if (leftAligned) { + cropRect.right -= cropRect.left; + cropRect.left = 0; + } + } else { + cropRect.left = 0; + cropRect.right = inWidth; + cropRect.top = (inHeight - (outHeight / (float) outWidth) * inWidth) / 2; + cropRect.bottom = inHeight - cropRect.top; + } + return cropRect; } } diff --git a/WallpaperPicker/src/com/android/gallery3d/glrenderer/BasicTexture.java b/WallpaperPicker/src/com/android/gallery3d/glrenderer/BasicTexture.java index 2e77b903f..0f3efb727 100644 --- a/WallpaperPicker/src/com/android/gallery3d/glrenderer/BasicTexture.java +++ b/WallpaperPicker/src/com/android/gallery3d/glrenderer/BasicTexture.java @@ -27,7 +27,6 @@ import java.util.WeakHashMap; // If a BasicTexture is loaded into GL memory, it has a GL texture id. public abstract class BasicTexture implements Texture { - @SuppressWarnings("unused") private static final String TAG = "BasicTexture"; protected static final int UNSPECIFIED = -1; diff --git a/WallpaperPicker/src/com/android/gallery3d/glrenderer/GLES20Canvas.java b/WallpaperPicker/src/com/android/gallery3d/glrenderer/GLES20Canvas.java index 4ead1315e..8af1f5932 100644 --- a/WallpaperPicker/src/com/android/gallery3d/glrenderer/GLES20Canvas.java +++ b/WallpaperPicker/src/com/android/gallery3d/glrenderer/GLES20Canvas.java @@ -23,8 +23,6 @@ import android.opengl.GLUtils; import android.opengl.Matrix; import android.util.Log; -import com.android.gallery3d.util.IntArray; - import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; diff --git a/WallpaperPicker/src/com/android/gallery3d/glrenderer/IntArray.java b/WallpaperPicker/src/com/android/gallery3d/glrenderer/IntArray.java new file mode 100644 index 000000000..f123624d6 --- /dev/null +++ b/WallpaperPicker/src/com/android/gallery3d/glrenderer/IntArray.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 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. + */ + +package com.android.gallery3d.glrenderer; + +public class IntArray { + private static final int INIT_CAPACITY = 8; + + private int mData[] = new int[INIT_CAPACITY]; + private int mSize = 0; + + public void add(int value) { + if (mData.length == mSize) { + int temp[] = new int[mSize + mSize]; + System.arraycopy(mData, 0, temp, 0, mSize); + mData = temp; + } + mData[mSize++] = value; + } + + public int removeLast() { + mSize--; + return mData[mSize]; + } + + public int size() { + return mSize; + } + + // For testing only + public int[] toArray(int[] result) { + if (result == null || result.length < mSize) { + result = new int[mSize]; + } + System.arraycopy(mData, 0, result, 0, mSize); + return result; + } + + public int[] getInternalArray() { + return mData; + } + + public void clear() { + mSize = 0; + if (mData.length != INIT_CAPACITY) mData = new int[INIT_CAPACITY]; + } +} diff --git a/WallpaperPicker/src/com/android/gallery3d/util/IntArray.java b/WallpaperPicker/src/com/android/gallery3d/util/IntArray.java deleted file mode 100644 index 2c4dc2c83..000000000 --- a/WallpaperPicker/src/com/android/gallery3d/util/IntArray.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -package com.android.gallery3d.util; - -public class IntArray { - private static final int INIT_CAPACITY = 8; - - private int mData[] = new int[INIT_CAPACITY]; - private int mSize = 0; - - public void add(int value) { - if (mData.length == mSize) { - int temp[] = new int[mSize + mSize]; - System.arraycopy(mData, 0, temp, 0, mSize); - mData = temp; - } - mData[mSize++] = value; - } - - public int removeLast() { - mSize--; - return mData[mSize]; - } - - public int size() { - return mSize; - } - - // For testing only - public int[] toArray(int[] result) { - if (result == null || result.length < mSize) { - result = new int[mSize]; - } - System.arraycopy(mData, 0, result, 0, mSize); - return result; - } - - public int[] getInternalArray() { - return mData; - } - - public void clear() { - mSize = 0; - if (mData.length != INIT_CAPACITY) mData = new int[INIT_CAPACITY]; - } -} diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index fa8ec64c2..71c7a161d 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -16,6 +16,7 @@ package com.android.launcher3; +import android.annotation.TargetApi; import android.app.ActionBar; import android.app.Activity; import android.app.WallpaperManager; @@ -24,43 +25,30 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.Bitmap.CompressFormat; -import android.graphics.BitmapFactory; -import android.graphics.BitmapRegionDecoder; -import android.graphics.Canvas; import android.graphics.Matrix; -import android.graphics.Paint; import android.graphics.Point; -import android.graphics.Rect; import android.graphics.RectF; import android.net.Uri; import android.os.AsyncTask; +import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.Display; import android.view.View; import android.view.WindowManager; import android.widget.Toast; - +import com.android.gallery3d.common.BitmapCropTask; +import com.android.gallery3d.common.BitmapUtils; import com.android.gallery3d.common.Utils; -import com.android.gallery3d.exif.ExifInterface; import com.android.photos.BitmapRegionTileSource; import com.android.photos.BitmapRegionTileSource.BitmapSource; -import java.io.BufferedInputStream; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; - public class WallpaperCropActivity extends Activity { private static final String LOGTAG = "Launcher3.CropActivity"; protected static final String WALLPAPER_WIDTH_KEY = "wallpaper.width"; protected static final String WALLPAPER_HEIGHT_KEY = "wallpaper.height"; - private static final int DEFAULT_COMPRESS_QUALITY = 90; + /** * The maximum bitmap size we allow to be returned through the intent. * Intents have a maximum of 1MB in total size. However, the Bitmap seems to @@ -69,9 +57,7 @@ public class WallpaperCropActivity extends Activity { * array instead of a Bitmap instance to avoid overhead. */ public static final int MAX_BMAP_IN_INTENT = 750000; - private static final float WALLPAPER_SCREENS_SPAN = 2f; - - protected static Point sDefaultWallpaperSize; + public static final float WALLPAPER_SCREENS_SPAN = 2f; protected CropView mCropView; protected Uri mUri; @@ -205,111 +191,8 @@ public class WallpaperCropActivity extends Activity { return LauncherFiles.WALLPAPER_CROP_PREFERENCES_KEY; } - // As a ratio of screen height, the total distance we want the parallax effect to span - // horizontally - private static float wallpaperTravelToScreenWidthRatio(int width, int height) { - float aspectRatio = width / (float) height; - - // At an aspect ratio of 16/10, the wallpaper parallax effect should span 1.5 * screen width - // At an aspect ratio of 10/16, the wallpaper parallax effect should span 1.2 * screen width - // We will use these two data points to extrapolate how much the wallpaper parallax effect - // to span (ie travel) at any aspect ratio: - - final float ASPECT_RATIO_LANDSCAPE = 16/10f; - final float ASPECT_RATIO_PORTRAIT = 10/16f; - final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE = 1.5f; - final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT = 1.2f; - - // To find out the desired width at different aspect ratios, we use the following two - // formulas, where the coefficient on x is the aspect ratio (width/height): - // (16/10)x + y = 1.5 - // (10/16)x + y = 1.2 - // We solve for x and y and end up with a final formula: - final float x = - (WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE - WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT) / - (ASPECT_RATIO_LANDSCAPE - ASPECT_RATIO_PORTRAIT); - final float y = WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT - x * ASPECT_RATIO_PORTRAIT; - return x * aspectRatio + y; - } - - static protected Point getDefaultWallpaperSize(Resources res, WindowManager windowManager) { - if (sDefaultWallpaperSize == null) { - Point minDims = new Point(); - Point maxDims = new Point(); - windowManager.getDefaultDisplay().getCurrentSizeRange(minDims, maxDims); - - int maxDim = Math.max(maxDims.x, maxDims.y); - int minDim = Math.max(minDims.x, minDims.y); - - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { - Point realSize = new Point(); - windowManager.getDefaultDisplay().getRealSize(realSize); - maxDim = Math.max(realSize.x, realSize.y); - minDim = Math.min(realSize.x, realSize.y); - } - - // We need to ensure that there is enough extra space in the wallpaper - // for the intended parallax effects - final int defaultWidth, defaultHeight; - if (isScreenLarge(res)) { - defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim)); - defaultHeight = maxDim; - } else { - defaultWidth = Math.max((int) (minDim * WALLPAPER_SCREENS_SPAN), maxDim); - defaultHeight = maxDim; - } - sDefaultWallpaperSize = new Point(defaultWidth, defaultHeight); - } - return sDefaultWallpaperSize; - } - - public static int getRotationFromExif(String path) { - return getRotationFromExifHelper(path, null, 0, null, null); - } - - public static int getRotationFromExif(Context context, Uri uri) { - return getRotationFromExifHelper(null, null, 0, context, uri); - } - - public static int getRotationFromExif(Resources res, int resId) { - return getRotationFromExifHelper(null, res, resId, null, null); - } - - private static int getRotationFromExifHelper( - String path, Resources res, int resId, Context context, Uri uri) { - ExifInterface ei = new ExifInterface(); - InputStream is = null; - BufferedInputStream bis = null; - try { - if (path != null) { - ei.readExif(path); - } else if (uri != null) { - is = context.getContentResolver().openInputStream(uri); - bis = new BufferedInputStream(is); - ei.readExif(bis); - } else { - is = res.openRawResource(resId); - bis = new BufferedInputStream(is); - ei.readExif(bis); - } - Integer ori = ei.getTagIntValue(ExifInterface.TAG_ORIENTATION); - if (ori != null) { - return ExifInterface.getRotationForOrientationValue(ori.shortValue()); - } - } catch (IOException e) { - Log.w(LOGTAG, "Getting exif data failed", e); - } catch (NullPointerException e) { - // Sometimes the ExifInterface has an internal NPE if Exif data isn't valid - Log.w(LOGTAG, "Getting exif data failed", e); - } finally { - Utils.closeSilently(bis); - Utils.closeSilently(is); - } - return 0; - } - protected void setWallpaper(Uri uri, final boolean finishActivityWhenDone) { - int rotation = getRotationFromExif(this, uri); + int rotation = BitmapUtils.getRotationFromExif(this, uri); BitmapCropTask cropTask = new BitmapCropTask( this, uri, null, rotation, 0, 0, true, false, null); final Point bounds = cropTask.getImageBounds(); @@ -331,11 +214,11 @@ public class WallpaperCropActivity extends Activity { Resources res, int resId, final boolean finishActivityWhenDone) { // crop this image and scale it down to the default wallpaper size for // this device - int rotation = getRotationFromExif(res, resId); + int rotation = BitmapUtils.getRotationFromExif(res, resId); Point inSize = mCropView.getSourceDimensions(); - Point outSize = getDefaultWallpaperSize(getResources(), + Point outSize = BitmapUtils.getDefaultWallpaperSize(getResources(), getWindowManager()); - RectF crop = getMaxCropRect( + RectF crop = Utils.getMaxCropRect( inSize.x, inSize.y, outSize.x, outSize.y, false); Runnable onEndCrop = new Runnable() { public void run() { @@ -353,13 +236,9 @@ public class WallpaperCropActivity extends Activity { cropTask.execute(); } - private static boolean isScreenLarge(Resources res) { - Configuration config = res.getConfiguration(); - return config.smallestScreenWidthDp >= 720; - } - + @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) protected void cropImageAndSetWallpaper(Uri uri, - OnBitmapCroppedHandler onBitmapCroppedHandler, final boolean finishActivityWhenDone) { + BitmapCropTask.OnBitmapCroppedHandler onBitmapCroppedHandler, final boolean finishActivityWhenDone) { boolean centerCrop = getResources().getBoolean(R.bool.center_crop); // Get the crop boolean ltr = mCropView.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR; @@ -370,7 +249,7 @@ public class WallpaperCropActivity extends Activity { d.getSize(displaySize); boolean isPortrait = displaySize.x < displaySize.y; - Point defaultWallpaperSize = getDefaultWallpaperSize(getResources(), + Point defaultWallpaperSize = BitmapUtils.getDefaultWallpaperSize(getResources(), getWindowManager()); // Get the crop RectF cropRect = mCropView.getCrop(); @@ -452,372 +331,6 @@ public class WallpaperCropActivity extends Activity { cropTask.execute(); } - public interface OnBitmapCroppedHandler { - public void onBitmapCropped(byte[] imageBytes); - } - - protected static class BitmapCropTask extends AsyncTask { - Uri mInUri = null; - Context mContext; - String mInFilePath; - byte[] mInImageBytes; - int mInResId = 0; - RectF mCropBounds = null; - int mOutWidth, mOutHeight; - int mRotation; - String mOutputFormat = "jpg"; // for now - boolean mSetWallpaper; - boolean mSaveCroppedBitmap; - Bitmap mCroppedBitmap; - Runnable mOnEndRunnable; - Resources mResources; - OnBitmapCroppedHandler mOnBitmapCroppedHandler; - boolean mNoCrop; - - public BitmapCropTask(Context c, String filePath, - RectF cropBounds, int rotation, int outWidth, int outHeight, - boolean setWallpaper, boolean saveCroppedBitmap, Runnable onEndRunnable) { - mContext = c; - mInFilePath = filePath; - init(cropBounds, rotation, - outWidth, outHeight, setWallpaper, saveCroppedBitmap, onEndRunnable); - } - - public BitmapCropTask(byte[] imageBytes, - RectF cropBounds, int rotation, int outWidth, int outHeight, - boolean setWallpaper, boolean saveCroppedBitmap, Runnable onEndRunnable) { - mInImageBytes = imageBytes; - init(cropBounds, rotation, - outWidth, outHeight, setWallpaper, saveCroppedBitmap, onEndRunnable); - } - - public BitmapCropTask(Context c, Uri inUri, - RectF cropBounds, int rotation, int outWidth, int outHeight, - boolean setWallpaper, boolean saveCroppedBitmap, Runnable onEndRunnable) { - mContext = c; - mInUri = inUri; - init(cropBounds, rotation, - outWidth, outHeight, setWallpaper, saveCroppedBitmap, onEndRunnable); - } - - public BitmapCropTask(Context c, Resources res, int inResId, - RectF cropBounds, int rotation, int outWidth, int outHeight, - boolean setWallpaper, boolean saveCroppedBitmap, Runnable onEndRunnable) { - mContext = c; - mInResId = inResId; - mResources = res; - init(cropBounds, rotation, - outWidth, outHeight, setWallpaper, saveCroppedBitmap, onEndRunnable); - } - - private void init(RectF cropBounds, int rotation, int outWidth, int outHeight, - boolean setWallpaper, boolean saveCroppedBitmap, Runnable onEndRunnable) { - mCropBounds = cropBounds; - mRotation = rotation; - mOutWidth = outWidth; - mOutHeight = outHeight; - mSetWallpaper = setWallpaper; - mSaveCroppedBitmap = saveCroppedBitmap; - mOnEndRunnable = onEndRunnable; - } - - public void setOnBitmapCropped(OnBitmapCroppedHandler handler) { - mOnBitmapCroppedHandler = handler; - } - - public void setNoCrop(boolean value) { - mNoCrop = value; - } - - public void setOnEndRunnable(Runnable onEndRunnable) { - mOnEndRunnable = onEndRunnable; - } - - // Helper to setup input stream - private InputStream regenerateInputStream() { - if (mInUri == null && mInResId == 0 && mInFilePath == null && mInImageBytes == null) { - Log.w(LOGTAG, "cannot read original file, no input URI, resource ID, or " + - "image byte array given"); - } else { - try { - if (mInUri != null) { - return new BufferedInputStream( - mContext.getContentResolver().openInputStream(mInUri)); - } else if (mInFilePath != null) { - return mContext.openFileInput(mInFilePath); - } else if (mInImageBytes != null) { - return new BufferedInputStream(new ByteArrayInputStream(mInImageBytes)); - } else { - return new BufferedInputStream(mResources.openRawResource(mInResId)); - } - } catch (FileNotFoundException e) { - Log.w(LOGTAG, "cannot read file: " + mInUri.toString(), e); - } - } - return null; - } - - public Point getImageBounds() { - InputStream is = regenerateInputStream(); - if (is != null) { - BitmapFactory.Options options = new BitmapFactory.Options(); - options.inJustDecodeBounds = true; - BitmapFactory.decodeStream(is, null, options); - Utils.closeSilently(is); - if (options.outWidth != 0 && options.outHeight != 0) { - return new Point(options.outWidth, options.outHeight); - } - } - return null; - } - - public void setCropBounds(RectF cropBounds) { - mCropBounds = cropBounds; - } - - public Bitmap getCroppedBitmap() { - return mCroppedBitmap; - } - public boolean cropBitmap() { - boolean failure = false; - - - WallpaperManager wallpaperManager = null; - if (mSetWallpaper) { - wallpaperManager = WallpaperManager.getInstance(mContext.getApplicationContext()); - } - - - if (mSetWallpaper && mNoCrop) { - try { - InputStream is = regenerateInputStream(); - if (is != null) { - wallpaperManager.setStream(is); - Utils.closeSilently(is); - } - } catch (IOException e) { - Log.w(LOGTAG, "cannot write stream to wallpaper", e); - failure = true; - } - return !failure; - } else { - // Find crop bounds (scaled to original image size) - Rect roundedTrueCrop = new Rect(); - Matrix rotateMatrix = new Matrix(); - Matrix inverseRotateMatrix = new Matrix(); - - Point bounds = getImageBounds(); - if (mRotation > 0) { - rotateMatrix.setRotate(mRotation); - inverseRotateMatrix.setRotate(-mRotation); - - mCropBounds.roundOut(roundedTrueCrop); - mCropBounds = new RectF(roundedTrueCrop); - - if (bounds == null) { - Log.w(LOGTAG, "cannot get bounds for image"); - failure = true; - return false; - } - - float[] rotatedBounds = new float[] { bounds.x, bounds.y }; - rotateMatrix.mapPoints(rotatedBounds); - rotatedBounds[0] = Math.abs(rotatedBounds[0]); - rotatedBounds[1] = Math.abs(rotatedBounds[1]); - - mCropBounds.offset(-rotatedBounds[0]/2, -rotatedBounds[1]/2); - inverseRotateMatrix.mapRect(mCropBounds); - mCropBounds.offset(bounds.x/2, bounds.y/2); - - } - - mCropBounds.roundOut(roundedTrueCrop); - - if (roundedTrueCrop.width() <= 0 || roundedTrueCrop.height() <= 0) { - Log.w(LOGTAG, "crop has bad values for full size image"); - failure = true; - return false; - } - - // See how much we're reducing the size of the image - int scaleDownSampleSize = Math.max(1, Math.min(roundedTrueCrop.width() / mOutWidth, - roundedTrueCrop.height() / mOutHeight)); - // Attempt to open a region decoder - BitmapRegionDecoder decoder = null; - InputStream is = null; - try { - is = regenerateInputStream(); - if (is == null) { - Log.w(LOGTAG, "cannot get input stream for uri=" + mInUri.toString()); - failure = true; - return false; - } - decoder = BitmapRegionDecoder.newInstance(is, false); - Utils.closeSilently(is); - } catch (IOException e) { - Log.w(LOGTAG, "cannot open region decoder for file: " + mInUri.toString(), e); - } finally { - Utils.closeSilently(is); - is = null; - } - - Bitmap crop = null; - if (decoder != null) { - // Do region decoding to get crop bitmap - BitmapFactory.Options options = new BitmapFactory.Options(); - if (scaleDownSampleSize > 1) { - options.inSampleSize = scaleDownSampleSize; - } - crop = decoder.decodeRegion(roundedTrueCrop, options); - decoder.recycle(); - } - - if (crop == null) { - // BitmapRegionDecoder has failed, try to crop in-memory - is = regenerateInputStream(); - Bitmap fullSize = null; - if (is != null) { - BitmapFactory.Options options = new BitmapFactory.Options(); - if (scaleDownSampleSize > 1) { - options.inSampleSize = scaleDownSampleSize; - } - fullSize = BitmapFactory.decodeStream(is, null, options); - Utils.closeSilently(is); - } - if (fullSize != null) { - // Find out the true sample size that was used by the decoder - scaleDownSampleSize = bounds.x / fullSize.getWidth(); - mCropBounds.left /= scaleDownSampleSize; - mCropBounds.top /= scaleDownSampleSize; - mCropBounds.bottom /= scaleDownSampleSize; - mCropBounds.right /= scaleDownSampleSize; - mCropBounds.roundOut(roundedTrueCrop); - - // Adjust values to account for issues related to rounding - if (roundedTrueCrop.width() > fullSize.getWidth()) { - // Adjust the width - roundedTrueCrop.right = roundedTrueCrop.left + fullSize.getWidth(); - } - if (roundedTrueCrop.right > fullSize.getWidth()) { - // Adjust the left value - int adjustment = roundedTrueCrop.left - - Math.max(0, roundedTrueCrop.right - roundedTrueCrop.width()); - roundedTrueCrop.left -= adjustment; - roundedTrueCrop.right -= adjustment; - } - if (roundedTrueCrop.height() > fullSize.getHeight()) { - // Adjust the height - roundedTrueCrop.bottom = roundedTrueCrop.top + fullSize.getHeight(); - } - if (roundedTrueCrop.bottom > fullSize.getHeight()) { - // Adjust the top value - int adjustment = roundedTrueCrop.top - - Math.max(0, roundedTrueCrop.bottom - roundedTrueCrop.height()); - roundedTrueCrop.top -= adjustment; - roundedTrueCrop.bottom -= adjustment; - } - - crop = Bitmap.createBitmap(fullSize, roundedTrueCrop.left, - roundedTrueCrop.top, roundedTrueCrop.width(), - roundedTrueCrop.height()); - } - } - - if (crop == null) { - Log.w(LOGTAG, "cannot decode file: " + mInUri.toString()); - failure = true; - return false; - } - if (mOutWidth > 0 && mOutHeight > 0 || mRotation > 0) { - float[] dimsAfter = new float[] { crop.getWidth(), crop.getHeight() }; - rotateMatrix.mapPoints(dimsAfter); - dimsAfter[0] = Math.abs(dimsAfter[0]); - dimsAfter[1] = Math.abs(dimsAfter[1]); - - if (!(mOutWidth > 0 && mOutHeight > 0)) { - mOutWidth = Math.round(dimsAfter[0]); - mOutHeight = Math.round(dimsAfter[1]); - } - - RectF cropRect = new RectF(0, 0, dimsAfter[0], dimsAfter[1]); - RectF returnRect = new RectF(0, 0, mOutWidth, mOutHeight); - - Matrix m = new Matrix(); - if (mRotation == 0) { - m.setRectToRect(cropRect, returnRect, Matrix.ScaleToFit.FILL); - } else { - Matrix m1 = new Matrix(); - m1.setTranslate(-crop.getWidth() / 2f, -crop.getHeight() / 2f); - Matrix m2 = new Matrix(); - m2.setRotate(mRotation); - Matrix m3 = new Matrix(); - m3.setTranslate(dimsAfter[0] / 2f, dimsAfter[1] / 2f); - Matrix m4 = new Matrix(); - m4.setRectToRect(cropRect, returnRect, Matrix.ScaleToFit.FILL); - - Matrix c1 = new Matrix(); - c1.setConcat(m2, m1); - Matrix c2 = new Matrix(); - c2.setConcat(m4, m3); - m.setConcat(c2, c1); - } - - Bitmap tmp = Bitmap.createBitmap((int) returnRect.width(), - (int) returnRect.height(), Bitmap.Config.ARGB_8888); - if (tmp != null) { - Canvas c = new Canvas(tmp); - Paint p = new Paint(); - p.setFilterBitmap(true); - c.drawBitmap(crop, m, p); - crop = tmp; - } - } - - if (mSaveCroppedBitmap) { - mCroppedBitmap = crop; - } - - // Get output compression format - CompressFormat cf = - convertExtensionToCompressFormat(getFileExtension(mOutputFormat)); - - // Compress to byte array - ByteArrayOutputStream tmpOut = new ByteArrayOutputStream(2048); - if (crop.compress(cf, DEFAULT_COMPRESS_QUALITY, tmpOut)) { - // If we need to set to the wallpaper, set it - if (mSetWallpaper && wallpaperManager != null) { - try { - byte[] outByteArray = tmpOut.toByteArray(); - wallpaperManager.setStream(new ByteArrayInputStream(outByteArray)); - if (mOnBitmapCroppedHandler != null) { - mOnBitmapCroppedHandler.onBitmapCropped(outByteArray); - } - } catch (IOException e) { - Log.w(LOGTAG, "cannot write stream to wallpaper", e); - failure = true; - } - } - } else { - Log.w(LOGTAG, "cannot compress bitmap"); - failure = true; - } - } - return !failure; // True if any of the operations failed - } - - @Override - protected Boolean doInBackground(Void... params) { - return cropBitmap(); - } - - @Override - protected void onPostExecute(Boolean result) { - if (mOnEndRunnable != null) { - mOnEndRunnable.run(); - } - } - } - protected void updateWallpaperDimensions(int width, int height) { String spKey = getSharedPreferencesKey(); SharedPreferences sp = getSharedPreferences(spKey, Context.MODE_MULTI_PROCESS); @@ -835,11 +348,11 @@ public class WallpaperCropActivity extends Activity { sp, getWindowManager(), WallpaperManager.getInstance(this), true); } - static public void suggestWallpaperDimension(Resources res, + public static void suggestWallpaperDimension(Resources res, final SharedPreferences sharedPrefs, WindowManager windowManager, final WallpaperManager wallpaperManager, boolean fallBackToDefaults) { - final Point defaultWallpaperSize = getDefaultWallpaperSize(res, windowManager); + final Point defaultWallpaperSize = BitmapUtils.getDefaultWallpaperSize(res, windowManager); // If we have saved a wallpaper width/height, use that instead int savedWidth = sharedPrefs.getInt(WALLPAPER_WIDTH_KEY, -1); @@ -859,40 +372,4 @@ public class WallpaperCropActivity extends Activity { wallpaperManager.suggestDesiredDimensions(savedWidth, savedHeight); } } - - protected static RectF getMaxCropRect( - int inWidth, int inHeight, int outWidth, int outHeight, boolean leftAligned) { - RectF cropRect = new RectF(); - // Get a crop rect that will fit this - if (inWidth / (float) inHeight > outWidth / (float) outHeight) { - cropRect.top = 0; - cropRect.bottom = inHeight; - cropRect.left = (inWidth - (outWidth / (float) outHeight) * inHeight) / 2; - cropRect.right = inWidth - cropRect.left; - if (leftAligned) { - cropRect.right -= cropRect.left; - cropRect.left = 0; - } - } else { - cropRect.left = 0; - cropRect.right = inWidth; - cropRect.top = (inHeight - (outHeight / (float) outWidth) * inWidth) / 2; - cropRect.bottom = inHeight - cropRect.top; - } - return cropRect; - } - - protected static CompressFormat convertExtensionToCompressFormat(String extension) { - return extension.equals("png") ? CompressFormat.PNG : CompressFormat.JPEG; - } - - protected static String getFileExtension(String requestFormat) { - String outputFormat = (requestFormat == null) - ? "jpg" - : requestFormat; - outputFormat = outputFormat.toLowerCase(); - return (outputFormat.equals("png") || outputFormat.equals("gif")) - ? "png" // We don't support gif compression. - : "jpg"; - } } diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 043f6306b..53cc13dbc 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -70,6 +70,9 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Toast; +import com.android.gallery3d.common.BitmapCropTask; +import com.android.gallery3d.common.BitmapUtils; +import com.android.gallery3d.common.Utils; import com.android.photos.BitmapRegionTileSource; import com.android.photos.BitmapRegionTileSource.BitmapSource; @@ -174,7 +177,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public void onSave(final WallpaperPickerActivity a) { boolean finishActivityWhenDone = true; - OnBitmapCroppedHandler h = new OnBitmapCroppedHandler() { + BitmapCropTask.OnBitmapCroppedHandler h = new BitmapCropTask.OnBitmapCroppedHandler() { public void onBitmapCropped(byte[] imageBytes) { Point thumbSize = getDefaultThumbnailSize(a.getResources()); // rotation is set to 0 since imageBytes has already been correctly rotated @@ -240,9 +243,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { BitmapRegionTileSource source = new BitmapRegionTileSource(a, bitmapSource); CropView v = a.getCropView(); v.setTileSource(source, null); - Point wallpaperSize = WallpaperCropActivity.getDefaultWallpaperSize( + Point wallpaperSize = BitmapUtils.getDefaultWallpaperSize( a.getResources(), a.getWindowManager()); - RectF crop = WallpaperCropActivity.getMaxCropRect( + RectF crop = Utils.getMaxCropRect( source.getImageWidth(), source.getImageHeight(), wallpaperSize.x, wallpaperSize.y, false); v.setScale(wallpaperSize.x / crop.width()); @@ -811,7 +814,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { rotatedBounds[0] = Math.abs(rotatedBounds[0]); rotatedBounds[1] = Math.abs(rotatedBounds[1]); - RectF cropRect = WallpaperCropActivity.getMaxCropRect( + RectF cropRect = Utils.getMaxCropRect( (int) rotatedBounds[0], (int) rotatedBounds[1], width, height, leftAligned); cropTask.setCropBounds(cropRect); @@ -838,7 +841,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { new AsyncTask() { protected Bitmap doInBackground(Void...args) { try { - int rotation = WallpaperCropActivity.getRotationFromExif(context, uri); + int rotation = BitmapUtils.getRotationFromExif(context, uri); return createThumbnail(defaultSize, context, uri, null, null, 0, rotation, false); } catch (SecurityException securityException) { if (isDestroyed()) { @@ -1023,7 +1026,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } else { Resources res = getResources(); Point defaultThumbSize = getDefaultThumbnailSize(res); - int rotation = WallpaperCropActivity.getRotationFromExif(res, resId); + int rotation = BitmapUtils.getRotationFromExif(res, resId); thumb = createThumbnail( defaultThumbSize, this, null, null, sysRes, resId, rotation, false); if (thumb != null) { diff --git a/WallpaperPicker/src/com/android/photos/views/Pools.java b/WallpaperPicker/src/com/android/photos/views/Pools.java new file mode 100644 index 000000000..c60f2f013 --- /dev/null +++ b/WallpaperPicker/src/com/android/photos/views/Pools.java @@ -0,0 +1,165 @@ +/* + * 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. + */ + +package com.android.photos.views; + +/** + * Helper class for crating pools of objects. An example use looks like this: + *
+ * public class MyPooledClass {
+ *
+ *     private static final SynchronizedPool sPool =
+ *             new SynchronizedPool(10);
+ *
+ *     public static MyPooledClass obtain() {
+ *         MyPooledClass instance = sPool.acquire();
+ *         return (instance != null) ? instance : new MyPooledClass();
+ *     }
+ *
+ *     public void recycle() {
+ *          // Clear state if needed.
+ *          sPool.release(this);
+ *     }
+ *
+ *     . . .
+ * }
+ * 
+ * + * @hide + */ +public final class Pools { + + /** + * Interface for managing a pool of objects. + * + * @param The pooled type. + */ + public static interface Pool { + + /** + * @return An instance from the pool if such, null otherwise. + */ + public T acquire(); + + /** + * Release an instance to the pool. + * + * @param instance The instance to release. + * @return Whether the instance was put in the pool. + * + * @throws IllegalStateException If the instance is already in the pool. + */ + public boolean release(T instance); + } + + private Pools() { + /* do nothing - hiding constructor */ + } + + /** + * Simple (non-synchronized) pool of objects. + * + * @param The pooled type. + */ + public static class SimplePool implements Pool { + private final Object[] mPool; + + private int mPoolSize; + + /** + * Creates a new instance. + * + * @param maxPoolSize The max pool size. + * + * @throws IllegalArgumentException If the max pool size is less than zero. + */ + public SimplePool(int maxPoolSize) { + if (maxPoolSize <= 0) { + throw new IllegalArgumentException("The max pool size must be > 0"); + } + mPool = new Object[maxPoolSize]; + } + + @Override + @SuppressWarnings("unchecked") + public T acquire() { + if (mPoolSize > 0) { + final int lastPooledIndex = mPoolSize - 1; + T instance = (T) mPool[lastPooledIndex]; + mPool[lastPooledIndex] = null; + mPoolSize--; + return instance; + } + return null; + } + + @Override + public boolean release(T instance) { + if (isInPool(instance)) { + throw new IllegalStateException("Already in the pool!"); + } + if (mPoolSize < mPool.length) { + mPool[mPoolSize] = instance; + mPoolSize++; + return true; + } + return false; + } + + private boolean isInPool(T instance) { + for (int i = 0; i < mPoolSize; i++) { + if (mPool[i] == instance) { + return true; + } + } + return false; + } + } + + /** + * Synchronized) pool of objects. + * + * @param The pooled type. + */ + public static class SynchronizedPool extends SimplePool { + private final Object mLock = new Object(); + + /** + * Creates a new instance. + * + * @param maxPoolSize The max pool size. + * + * @throws IllegalArgumentException If the max pool size is less than zero. + */ + public SynchronizedPool(int maxPoolSize) { + super(maxPoolSize); + } + + @Override + public T acquire() { + synchronized (mLock) { + return super.acquire(); + } + } + + @Override + public boolean release(T element) { + synchronized (mLock) { + return super.release(element); + } + } + } +} \ No newline at end of file diff --git a/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java b/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java index b0292e660..f9b7ab473 100644 --- a/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java +++ b/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java @@ -23,8 +23,6 @@ import android.graphics.RectF; import android.util.DisplayMetrics; import android.util.Log; import android.util.LongSparseArray; -import android.util.Pools.Pool; -import android.util.Pools.SynchronizedPool; import android.view.View; import android.view.WindowManager; @@ -32,6 +30,8 @@ import com.android.gallery3d.common.Utils; import com.android.gallery3d.glrenderer.BasicTexture; import com.android.gallery3d.glrenderer.GLCanvas; import com.android.gallery3d.glrenderer.UploadedTexture; +import com.android.photos.views.Pools.Pool; +import com.android.photos.views.Pools.SynchronizedPool; /** * Handles laying out, decoding, and drawing of tiles in GL -- cgit v1.2.3 From 65b929d6f21683198caf28e266fd2cf52c843764 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 12 Feb 2015 15:34:41 -0800 Subject: Reducing memory usage of wallpaper picker > Loading preview bitmap only once, instead of loading it twice at BitmapRegionTileSource and BitmapSource > Maintaing a weak-set of reusable bitmaps and reusing them for decoding bitmaps > Loading images on a HandlerThread (instead of AsyncTask) and removing any non-started task before submitting a new task > Loading inbuild images (from resources) on HandlerThread instead of UIThread > Freeing up unbound GL textures before binding a new texture. Bug: 18382606 Change-Id: Ic4ca630dd113ded65d2853eb0d291c9e5823637e (cherry picked from commit 283c2261bd4440f4108a564cea0f5fc499781213) --- .../android/gallery3d/glrenderer/GLES20Canvas.java | 1 + .../android/launcher3/WallpaperCropActivity.java | 195 ++++++++++++++++----- .../android/launcher3/WallpaperPickerActivity.java | 76 ++++---- .../com/android/photos/BitmapRegionTileSource.java | 147 +++++----------- .../com/android/photos/views/TiledImageView.java | 4 + 5 files changed, 241 insertions(+), 182 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/gallery3d/glrenderer/GLES20Canvas.java b/WallpaperPicker/src/com/android/gallery3d/glrenderer/GLES20Canvas.java index 8af1f5932..933260b48 100644 --- a/WallpaperPicker/src/com/android/gallery3d/glrenderer/GLES20Canvas.java +++ b/WallpaperPicker/src/com/android/gallery3d/glrenderer/GLES20Canvas.java @@ -696,6 +696,7 @@ public class GLES20Canvas implements GLCanvas { } private void prepareTexture(BasicTexture texture, int program, ShaderParameter[] params) { + deleteRecycledResources(); GLES20.glUseProgram(program); checkError(); enableBlending(!texture.isOpaque() || getAlpha() < OPAQUE_ALPHA); diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index 71c7a161d..0ddb79e4f 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -25,25 +25,36 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; import android.content.res.Resources; +import android.graphics.Bitmap; import android.graphics.Matrix; import android.graphics.Point; import android.graphics.RectF; import android.net.Uri; -import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; +import android.os.Handler; +import android.os.HandlerThread; +import android.os.Message; import android.util.Log; import android.view.Display; import android.view.View; import android.view.WindowManager; import android.widget.Toast; + import com.android.gallery3d.common.BitmapCropTask; import com.android.gallery3d.common.BitmapUtils; import com.android.gallery3d.common.Utils; import com.android.photos.BitmapRegionTileSource; import com.android.photos.BitmapRegionTileSource.BitmapSource; +import com.android.photos.BitmapRegionTileSource.BitmapSource.InBitmapProvider; +import com.android.photos.views.TiledImageRenderer.TileSource; + +import java.util.Collections; +import java.util.Iterator; +import java.util.Set; +import java.util.WeakHashMap; -public class WallpaperCropActivity extends Activity { +public class WallpaperCropActivity extends Activity implements Handler.Callback { private static final String LOGTAG = "Launcher3.CropActivity"; protected static final String WALLPAPER_WIDTH_KEY = "wallpaper.width"; @@ -59,13 +70,29 @@ public class WallpaperCropActivity extends Activity { public static final int MAX_BMAP_IN_INTENT = 750000; public static final float WALLPAPER_SCREENS_SPAN = 2f; + private static final int MSG_LOAD_IMAGE = 1; + protected CropView mCropView; + protected View mProgressView; protected Uri mUri; protected View mSetWallpaperButton; + private HandlerThread mLoaderThread; + private Handler mLoaderHandler; + private LoadRequest mCurrentLoadRequest; + private byte[] mTempStorageForDecoding = new byte[16 * 1024]; + // A weak-set of reusable bitmaps + private Set mReusableBitmaps = + Collections.newSetFromMap(new WeakHashMap()); + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + mLoaderThread = new HandlerThread("wallpaper_loader"); + mLoaderThread.start(); + mLoaderHandler = new Handler(mLoaderThread.getLooper(), this); + init(); if (!enableRotation()) { setRequestedOrientation(Configuration.ORIENTATION_PORTRAIT); @@ -76,6 +103,7 @@ public class WallpaperCropActivity extends Activity { setContentView(R.layout.wallpaper_cropper); mCropView = (CropView) findViewById(R.id.cropView); + mProgressView = findViewById(R.id.loading); Intent cropIntent = getIntent(); final Uri imageUri = cropIntent.getData(); @@ -116,7 +144,7 @@ public class WallpaperCropActivity extends Activity { } } }; - setCropViewTileSource(bitmapSource, true, false, onLoad); + setCropViewTileSource(bitmapSource, true, false, null, onLoad); } @Override @@ -124,65 +152,134 @@ public class WallpaperCropActivity extends Activity { if (mCropView != null) { mCropView.destroy(); } + if (mLoaderThread != null) { + mLoaderThread.quit(); + } super.onDestroy(); } - public void setCropViewTileSource( - final BitmapRegionTileSource.BitmapSource bitmapSource, final boolean touchEnabled, - final boolean moveToLeft, final Runnable postExecute) { - final Context context = WallpaperCropActivity.this; - final View progressView = findViewById(R.id.loading); - final AsyncTask loadBitmapTask = new AsyncTask() { - protected Void doInBackground(Void...args) { - if (!isCancelled()) { - try { - bitmapSource.loadInBackground(); - } catch (SecurityException securityException) { - if (isDestroyed()) { - // Temporarily granted permissions are revoked when the activity - // finishes, potentially resulting in a SecurityException here. - // Even though {@link #isDestroyed} might also return true in different - // situations where the configuration changes, we are fine with - // catching these cases here as well. - cancel(false); - } else { - // otherwise it had a different cause and we throw it further - throw securityException; + /** + * This is called on {@link #mLoaderThread} + */ + @Override + public boolean handleMessage(Message msg) { + if (msg.what == MSG_LOAD_IMAGE) { + final LoadRequest req = (LoadRequest) msg.obj; + try { + req.src.loadInBackground(new InBitmapProvider() { + + @Override + public Bitmap forPixelCount(int count) { + synchronized (mReusableBitmaps) { + Iterator itr = mReusableBitmaps.iterator(); + while (itr.hasNext()) { + Bitmap b = itr.next(); + if (b.getWidth() * b.getHeight() >= count) { + itr.remove(); + return b; + } + } } + return null; } + }); + } catch (SecurityException securityException) { + if (isDestroyed()) { + // Temporarily granted permissions are revoked when the activity + // finishes, potentially resulting in a SecurityException here. + // Even though {@link #isDestroyed} might also return true in different + // situations where the configuration changes, we are fine with + // catching these cases here as well. + return true; + } else { + // otherwise it had a different cause and we throw it further + throw securityException; } - return null; } - protected void onPostExecute(Void arg) { - if (!isCancelled()) { - progressView.setVisibility(View.INVISIBLE); - if (bitmapSource.getLoadingState() == BitmapSource.State.LOADED) { - mCropView.setTileSource( - new BitmapRegionTileSource(context, bitmapSource), null); - mCropView.setTouchEnabled(touchEnabled); - if (moveToLeft) { - mCropView.moveToLeft(); - } + + req.result = new BitmapRegionTileSource(this, req.src, mTempStorageForDecoding); + runOnUiThread(new Runnable() { + + @Override + public void run() { + if (req == mCurrentLoadRequest) { + onLoadRequestComplete(req, + req.src.getLoadingState() == BitmapSource.State.LOADED); + } else { + addReusableBitmap(req.result); } } - if (postExecute != null) { - postExecute.run(); + }); + return true; + } + return false; + } + + private void addReusableBitmap(TileSource src) { + synchronized (mReusableBitmaps) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT + && src instanceof BitmapRegionTileSource) { + Bitmap preview = ((BitmapRegionTileSource) src).getBitmap(); + if (preview != null && preview.isMutable()) { + mReusableBitmaps.add(preview); } } - }; + } + } + + protected void onLoadRequestComplete(LoadRequest req, boolean success) { + mCurrentLoadRequest = null; + if (success) { + TileSource oldSrc = mCropView.getTileSource(); + mCropView.setTileSource(req.result, null); + mCropView.setTouchEnabled(req.touchEnabled); + if (req.moveToLeft) { + mCropView.moveToLeft(); + } + if (req.scaleProvider != null) { + mCropView.setScale(req.scaleProvider.getScale(req.result)); + } + + // Free last image + if (oldSrc != null) { + // Call yield instead of recycle, as we only want to free GL resource. + // We can still reuse the bitmap for decoding any other image. + oldSrc.getPreview().yield(); + } + addReusableBitmap(oldSrc); + } + if (req.postExecute != null) { + req.postExecute.run(); + } + } + + public final void setCropViewTileSource(BitmapSource bitmapSource, boolean touchEnabled, + boolean moveToLeft, CropViewScaleProvider scaleProvider, Runnable postExecute) { + final LoadRequest req = new LoadRequest(); + req.moveToLeft = moveToLeft; + req.src = bitmapSource; + req.touchEnabled = touchEnabled; + req.postExecute = postExecute; + req.scaleProvider = scaleProvider; + mCurrentLoadRequest = req; + + // Remove any pending requests + mLoaderHandler.removeMessages(MSG_LOAD_IMAGE); + Message.obtain(mLoaderHandler, MSG_LOAD_IMAGE, req).sendToTarget(); + // We don't want to show the spinner every time we load an image, because that would be // annoying; instead, only start showing the spinner if loading the image has taken // longer than 1 sec (ie 1000 ms) - progressView.postDelayed(new Runnable() { + mProgressView.postDelayed(new Runnable() { public void run() { - if (loadBitmapTask.getStatus() != AsyncTask.Status.FINISHED) { - progressView.setVisibility(View.VISIBLE); + if (mCurrentLoadRequest == req) { + mProgressView.setVisibility(View.VISIBLE); } } }, 1000); - loadBitmapTask.execute(); } + public boolean enableRotation() { return getResources().getBoolean(R.bool.allow_rotation); } @@ -372,4 +469,18 @@ public class WallpaperCropActivity extends Activity { wallpaperManager.suggestDesiredDimensions(savedWidth, savedHeight); } } + + static class LoadRequest { + BitmapSource src; + boolean touchEnabled; + boolean moveToLeft; + Runnable postExecute; + CropViewScaleProvider scaleProvider; + + TileSource result; + } + + interface CropViewScaleProvider { + float getScale(TileSource src); + } } diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index f6cc6d0fd..cbed61bd2 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -74,6 +74,7 @@ import com.android.gallery3d.common.BitmapUtils; import com.android.gallery3d.common.Utils; import com.android.photos.BitmapRegionTileSource; import com.android.photos.BitmapRegionTileSource.BitmapSource; +import com.android.photos.views.TiledImageRenderer.TileSource; import java.io.File; import java.io.FileOutputStream; @@ -168,7 +169,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } mBitmapSource = new BitmapRegionTileSource.UriBitmapSource( a, mUri, BitmapRegionTileSource.MAX_PREVIEW_SIZE); - a.setCropViewTileSource(mBitmapSource, true, false, onLoad); + a.setCropViewTileSource(mBitmapSource, true, false, null, onLoad); } @Override public void onSave(final WallpaperPickerActivity a) { @@ -205,7 +206,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { public void onClick(WallpaperPickerActivity a) { BitmapRegionTileSource.UriBitmapSource bitmapSource = new BitmapRegionTileSource.UriBitmapSource(a, Uri.fromFile(mFile), 1024); - a.setCropViewTileSource(bitmapSource, false, true, null); + a.setCropViewTileSource(bitmapSource, false, true, null, null); } @Override public void onSave(WallpaperPickerActivity a) { @@ -231,22 +232,22 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { mThumb = thumb; } @Override - public void onClick(WallpaperPickerActivity a) { + public void onClick(final WallpaperPickerActivity a) { BitmapRegionTileSource.ResourceBitmapSource bitmapSource = new BitmapRegionTileSource.ResourceBitmapSource( mResources, mResId, BitmapRegionTileSource.MAX_PREVIEW_SIZE); - bitmapSource.loadInBackground(); - BitmapRegionTileSource source = new BitmapRegionTileSource(a, bitmapSource); - CropView v = a.getCropView(); - v.setTileSource(source, null); - Point wallpaperSize = BitmapUtils.getDefaultWallpaperSize( - a.getResources(), a.getWindowManager()); - RectF crop = Utils.getMaxCropRect( - source.getImageWidth(), source.getImageHeight(), - wallpaperSize.x, wallpaperSize.y, false); - v.setScale(wallpaperSize.x / crop.width()); - v.setTouchEnabled(false); - a.setSystemWallpaperVisiblity(false); + a.setCropViewTileSource(bitmapSource, false, false, new CropViewScaleProvider() { + + @Override + public float getScale(TileSource src) { + Point wallpaperSize = BitmapUtils.getDefaultWallpaperSize( + a.getResources(), a.getWindowManager()); + RectF crop = Utils.getMaxCropRect( + src.getImageWidth(), src.getImageHeight(), + wallpaperSize.x, wallpaperSize.y, false); + return wallpaperSize.x / crop.width(); + } + }, null); } @Override public void onSave(WallpaperPickerActivity a) { @@ -271,21 +272,26 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public void onClick(WallpaperPickerActivity a) { CropView c = a.getCropView(); - Drawable defaultWallpaper = WallpaperManager.getInstance(a).getBuiltInDrawable( c.getWidth(), c.getHeight(), false, 0.5f, 0.5f); - if (defaultWallpaper == null) { Log.w(TAG, "Null default wallpaper encountered."); c.setTileSource(null, null); return; } - c.setTileSource( - new DrawableTileSource(a, defaultWallpaper, DrawableTileSource.MAX_PREVIEW_SIZE), null); - c.setScale(1f); - c.setTouchEnabled(false); - a.setSystemWallpaperVisiblity(false); + LoadRequest req = new LoadRequest(); + req.moveToLeft = false; + req.touchEnabled = false; + req.scaleProvider = new CropViewScaleProvider() { + + @Override + public float getScale(TileSource src) { + return 1f; + } + }; + req.result = new DrawableTileSource(a, defaultWallpaper, DrawableTileSource.MAX_PREVIEW_SIZE); + a.onLoadRequestComplete(req, true); } @Override public void onSave(WallpaperPickerActivity a) { @@ -348,24 +354,11 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } @Override - public void setCropViewTileSource(BitmapSource bitmapSource, - boolean touchEnabled, - boolean moveToLeft, - final Runnable postExecute) { - // we also want to show our own wallpaper instead of the one in the background - Runnable showPostExecuteRunnable = new Runnable() { - @Override - public void run() { - if(postExecute != null) { - postExecute.run(); - } - setSystemWallpaperVisiblity(false); - } - }; - super.setCropViewTileSource(bitmapSource, - touchEnabled, - moveToLeft, - showPostExecuteRunnable); + protected void onLoadRequestComplete(LoadRequest req, boolean success) { + super.onLoadRequestComplete(req, success); + if (success) { + setSystemWallpaperVisiblity(false); + } } // called by onCreate; this is subclassed to overwrite WallpaperCropActivity @@ -375,6 +368,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { mCropView = (CropView) findViewById(R.id.cropView); mCropView.setVisibility(View.INVISIBLE); + mProgressView = findViewById(R.id.loading); + + mWallpaperStrip = findViewById(R.id.wallpaper_strip); mCropView.setTouchCallback(new CropView.TouchCallback() { ViewPropertyAnimator mAnim; diff --git a/WallpaperPicker/src/com/android/photos/BitmapRegionTileSource.java b/WallpaperPicker/src/com/android/photos/BitmapRegionTileSource.java index 66ece4ff6..15f97e5b1 100644 --- a/WallpaperPicker/src/com/android/photos/BitmapRegionTileSource.java +++ b/WallpaperPicker/src/com/android/photos/BitmapRegionTileSource.java @@ -20,7 +20,6 @@ import android.annotation.TargetApi; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; -import android.graphics.Bitmap.Config; import android.graphics.BitmapFactory; import android.graphics.BitmapRegionDecoder; import android.graphics.Canvas; @@ -28,7 +27,6 @@ import android.graphics.Paint; import android.graphics.Rect; import android.net.Uri; import android.os.Build; -import android.os.Build.VERSION_CODES; import android.util.Log; import com.android.gallery3d.common.BitmapUtils; @@ -148,8 +146,6 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { private static final String TAG = "BitmapRegionTileSource"; - private static final boolean REUSE_BITMAP = - Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN; private static final int GL_SIZE_LIMIT = 2048; // This must be no larger than half the size of the GL_SIZE_LIMIT // due to decodePreview being allowed to be up to 2x the size of the target @@ -158,14 +154,14 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { public static abstract class BitmapSource { private SimpleBitmapRegionDecoder mDecoder; private Bitmap mPreview; - private int mPreviewSize; + private final int mPreviewSize; private int mRotation; public enum State { NOT_LOADED, LOADED, ERROR_LOADING }; private State mState = State.NOT_LOADED; public BitmapSource(int previewSize) { - mPreviewSize = previewSize; + mPreviewSize = Math.min(previewSize, MAX_PREVIEW_SIZE); } - public boolean loadInBackground() { + public boolean loadInBackground(InBitmapProvider bitmapProvider) { ExifInterface ei = new ExifInterface(); if (readExif(ei)) { Integer ori = ei.getTagIntValue(ExifInterface.TAG_ORIENTATION); @@ -181,15 +177,33 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { int width = mDecoder.getWidth(); int height = mDecoder.getHeight(); if (mPreviewSize != 0) { - int previewSize = Math.min(mPreviewSize, MAX_PREVIEW_SIZE); BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inPreferredConfig = Bitmap.Config.ARGB_8888; opts.inPreferQualityOverSpeed = true; - float scale = (float) previewSize / Math.max(width, height); + float scale = (float) mPreviewSize / Math.max(width, height); opts.inSampleSize = BitmapUtils.computeSampleSizeLarger(scale); opts.inJustDecodeBounds = false; - mPreview = loadPreviewBitmap(opts); + opts.inMutable = true; + + if (bitmapProvider != null) { + int expectedPixles = (width / opts.inSampleSize) * (height / opts.inSampleSize); + Bitmap reusableBitmap = bitmapProvider.forPixelCount(expectedPixles); + if (reusableBitmap != null) { + // Try loading with reusable bitmap + opts.inBitmap = reusableBitmap; + try { + mPreview = loadPreviewBitmap(opts); + } catch (IllegalArgumentException e) { + Log.d(TAG, "Unable to reusage bitmap", e); + opts.inBitmap = null; + mPreview = null; + } + } + } + if (mPreview == null) { + mPreview = loadPreviewBitmap(opts); + } } mState = State.LOADED; return true; @@ -208,10 +222,6 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { return mPreview; } - public int getPreviewSize() { - return mPreviewSize; - } - public int getRotation() { return mRotation; } @@ -219,6 +229,10 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { public abstract boolean readExif(ExifInterface ei); public abstract SimpleBitmapRegionDecoder loadBitmapRegionDecoder(); public abstract Bitmap loadPreviewBitmap(BitmapFactory.Options options); + + public interface InBitmapProvider { + Bitmap forPixelCount(int count); + } } public static class FilePathBitmapSource extends BitmapSource { @@ -306,13 +320,13 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { Utils.closeSilently(is); return true; } catch (FileNotFoundException e) { - Log.e("BitmapRegionTileSource", "Failed to load URI " + mUri, e); + Log.d("BitmapRegionTileSource", "Failed to load URI " + mUri, e); return false; } catch (IOException e) { - Log.e("BitmapRegionTileSource", "Failed to load URI " + mUri, e); + Log.d("BitmapRegionTileSource", "Failed to load URI " + mUri, e); return false; } catch (NullPointerException e) { - Log.e("BitmapRegionTileSource", "Failed to read EXIF for URI " + mUri, e); + Log.d("BitmapRegionTileSource", "Failed to read EXIF for URI " + mUri, e); return false; } finally { Utils.closeSilently(is); @@ -372,11 +386,9 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { // For use only by getTile private Rect mWantRegion = new Rect(); - private Rect mOverlapRegion = new Rect(); private BitmapFactory.Options mOptions; - private Canvas mCanvas; - public BitmapRegionTileSource(Context context, BitmapSource source) { + public BitmapRegionTileSource(Context context, BitmapSource source, byte[] tempStorage) { mTileSize = TiledImageRenderer.suggestedTileSize(context); mRotation = source.getRotation(); mDecoder = source.getBitmapRegionDecoder(); @@ -386,27 +398,26 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { mOptions = new BitmapFactory.Options(); mOptions.inPreferredConfig = Bitmap.Config.ARGB_8888; mOptions.inPreferQualityOverSpeed = true; - mOptions.inTempStorage = new byte[16 * 1024]; - int previewSize = source.getPreviewSize(); - if (previewSize != 0) { - previewSize = Math.min(previewSize, MAX_PREVIEW_SIZE); - // Although this is the same size as the Bitmap that is likely already - // loaded, the lifecycle is different and interactions are on a different - // thread. Thus to simplify, this source will decode its own bitmap. - Bitmap preview = decodePreview(source, previewSize); - if (preview.getWidth() <= GL_SIZE_LIMIT && preview.getHeight() <= GL_SIZE_LIMIT) { + mOptions.inTempStorage = tempStorage; + + Bitmap preview = source.getPreviewBitmap(); + if (preview != null && + preview.getWidth() <= GL_SIZE_LIMIT && preview.getHeight() <= GL_SIZE_LIMIT) { mPreview = new BitmapTexture(preview); - } else { - Log.w(TAG, String.format( - "Failed to create preview of apropriate size! " - + " in: %dx%d, out: %dx%d", - mWidth, mHeight, - preview.getWidth(), preview.getHeight())); - } + } else { + Log.w(TAG, String.format( + "Failed to create preview of apropriate size! " + + " in: %dx%d, out: %dx%d", + mWidth, mHeight, + preview.getWidth(), preview.getHeight())); } } } + public Bitmap getBitmap() { + return mPreview instanceof BitmapTexture ? ((BitmapTexture) mPreview).getBitmap() : null; + } + @Override public int getTileSize() { return mTileSize; @@ -435,10 +446,6 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { @Override public Bitmap getTile(int level, int x, int y, Bitmap bitmap) { int tileSize = getTileSize(); - if (!REUSE_BITMAP) { - return getTileWithoutReusingBitmap(level, x, y, tileSize); - } - int t = tileSize << level; mWantRegion.set(x, y, x + t, y + t); @@ -462,64 +469,4 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { } return bitmap; } - - private Bitmap getTileWithoutReusingBitmap( - int level, int x, int y, int tileSize) { - - int t = tileSize << level; - mWantRegion.set(x, y, x + t, y + t); - - mOverlapRegion.set(0, 0, mWidth, mHeight); - - mOptions.inSampleSize = (1 << level); - Bitmap bitmap = mDecoder.decodeRegion(mOverlapRegion, mOptions); - - if (bitmap == null) { - Log.w(TAG, "fail in decoding region"); - } - - if (mWantRegion.equals(mOverlapRegion)) { - return bitmap; - } - - Bitmap result = Bitmap.createBitmap(tileSize, tileSize, Config.ARGB_8888); - if (mCanvas == null) { - mCanvas = new Canvas(); - } - mCanvas.setBitmap(result); - mCanvas.drawBitmap(bitmap, - (mOverlapRegion.left - mWantRegion.left) >> level, - (mOverlapRegion.top - mWantRegion.top) >> level, null); - mCanvas.setBitmap(null); - return result; - } - - /** - * Note that the returned bitmap may have a long edge that's longer - * than the targetSize, but it will always be less than 2x the targetSize - */ - private Bitmap decodePreview(BitmapSource source, int targetSize) { - Bitmap result = source.getPreviewBitmap(); - if (result == null) { - return null; - } - - // We need to resize down if the decoder does not support inSampleSize - // or didn't support the specified inSampleSize (some decoders only do powers of 2) - float scale = (float) targetSize / (float) (Math.max(result.getWidth(), result.getHeight())); - - if (scale <= 0.5) { - result = BitmapUtils.resizeBitmapByScale(result, scale, true); - } - return ensureGLCompatibleBitmap(result); - } - - private static Bitmap ensureGLCompatibleBitmap(Bitmap bitmap) { - if (bitmap == null || bitmap.getConfig() != null) { - return bitmap; - } - Bitmap newBitmap = bitmap.copy(Config.ARGB_8888, false); - bitmap.recycle(); - return newBitmap; - } } diff --git a/WallpaperPicker/src/com/android/photos/views/TiledImageView.java b/WallpaperPicker/src/com/android/photos/views/TiledImageView.java index 524fa2e47..56ee7a658 100644 --- a/WallpaperPicker/src/com/android/photos/views/TiledImageView.java +++ b/WallpaperPicker/src/com/android/photos/views/TiledImageView.java @@ -125,6 +125,10 @@ public class TiledImageView extends FrameLayout { invalidate(); } + public TileSource getTileSource() { + return mRenderer.source; + } + @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { -- cgit v1.2.3 From 9f9d0a59c4dab713b6cd8f5a29ea20f646bc5ac0 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 25 Feb 2015 11:34:17 -0800 Subject: Picking a bitmap to reuse where least pixels are wasted Change-Id: I4217bc68a5caa2d1526e4ebb101dbaf0348066d3 --- .../android/launcher3/WallpaperCropActivity.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index 0ddb79e4f..a3a3c537b 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -50,7 +50,6 @@ import com.android.photos.BitmapRegionTileSource.BitmapSource.InBitmapProvider; import com.android.photos.views.TiledImageRenderer.TileSource; import java.util.Collections; -import java.util.Iterator; import java.util.Set; import java.util.WeakHashMap; @@ -170,17 +169,23 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback @Override public Bitmap forPixelCount(int count) { + Bitmap bitmapToReuse = null; + // Find the smallest bitmap that satisfies the pixel count limit synchronized (mReusableBitmaps) { - Iterator itr = mReusableBitmaps.iterator(); - while (itr.hasNext()) { - Bitmap b = itr.next(); - if (b.getWidth() * b.getHeight() >= count) { - itr.remove(); - return b; + int currentBitmapSize = Integer.MAX_VALUE; + for (Bitmap b : mReusableBitmaps) { + int bitmapSize = b.getWidth() * b.getHeight(); + if ((bitmapSize >= count) && (bitmapSize < currentBitmapSize)) { + bitmapToReuse = b; + currentBitmapSize = bitmapSize; } } + + if (bitmapToReuse != null) { + mReusableBitmaps.remove(bitmapToReuse); + } } - return null; + return bitmapToReuse; } }); } catch (SecurityException securityException) { -- cgit v1.2.3 From 9c83a0da6d6faf4d8a81effd27997ffb12bf3fdd Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 13 Feb 2015 10:40:07 -0800 Subject: Cleaning up some resources in WallpaperPickerActivity Change-Id: I4923403c0c094d0ae0b00e3a08a13099c3addb10 --- WallpaperPicker/res/layout/wallpaper_cropper.xml | 3 +- WallpaperPicker/res/layout/wallpaper_picker.xml | 42 +++++++++----- .../layout/wallpaper_picker_image_picker_item.xml | 1 - .../res/layout/wallpaper_picker_item.xml | 1 - .../wallpaper_picker_live_wallpaper_item.xml | 1 - .../layout/wallpaper_picker_third_party_item.xml | 1 - WallpaperPicker/res/values-sw720dp-v19/styles.xml | 2 +- WallpaperPicker/res/values-sw720dp/styles.xml | 2 +- .../launcher3/LiveWallpaperListAdapter.java | 2 - .../ThirdPartyWallpaperPickerListAdapter.java | 2 - .../android/launcher3/WallpaperPickerActivity.java | 64 +++++----------------- .../com/android/launcher3/WallpaperRootView.java | 39 ------------- 12 files changed, 46 insertions(+), 114 deletions(-) delete mode 100644 WallpaperPicker/src/com/android/launcher3/WallpaperRootView.java (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/res/layout/wallpaper_cropper.xml b/WallpaperPicker/res/layout/wallpaper_cropper.xml index abb860898..ffe8df0fb 100644 --- a/WallpaperPicker/res/layout/wallpaper_cropper.xml +++ b/WallpaperPicker/res/layout/wallpaper_cropper.xml @@ -19,7 +19,6 @@ --> - + android:layout_height="match_parent" > + + + android:visibility="invisible" /> + + + - - - - + - + + \ No newline at end of file diff --git a/WallpaperPicker/res/layout/wallpaper_picker_image_picker_item.xml b/WallpaperPicker/res/layout/wallpaper_picker_image_picker_item.xml index ae3c43d8e..dc6524486 100644 --- a/WallpaperPicker/res/layout/wallpaper_picker_image_picker_item.xml +++ b/WallpaperPicker/res/layout/wallpaper_picker_image_picker_item.xml @@ -20,7 +20,6 @@ android:layout_height="@dimen/wallpaperThumbnailHeight" android:focusable="true" android:clickable="true" - android:background="@drawable/wallpaper_tile_fg" android:foreground="@drawable/wallpaper_tile_fg"> - diff --git a/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java b/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java index 0a9050cff..72f2d7e49 100644 --- a/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java +++ b/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java @@ -90,8 +90,6 @@ public class LiveWallpaperListAdapter extends BaseAdapter implements ListAdapter view = convertView; } - WallpaperPickerActivity.setWallpaperItemPaddingToZero((FrameLayout) view); - LiveWallpaperTile wallpaperInfo = mWallpapers.get(position); wallpaperInfo.setView(view); ImageView image = (ImageView) view.findViewById(R.id.wallpaper_image); diff --git a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java index 7a4d48ca9..27e65aa31 100644 --- a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java +++ b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java @@ -126,8 +126,6 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements view = convertView; } - WallpaperPickerActivity.setWallpaperItemPaddingToZero((FrameLayout) view); - ResolveInfo info = mThirdPartyWallpaperPickers.get(position).mResolveInfo; TextView label = (TextView) view.findViewById(R.id.wallpaper_item_label); label.setText(info.loadLabel(mPackageManager)); diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index cbed61bd2..d16fc31e5 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -34,11 +34,9 @@ import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Point; import android.graphics.PorterDuff; -import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; -import android.graphics.drawable.LevelListDrawable; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; @@ -95,7 +93,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { private OnClickListener mThumbnailOnClickListener; private LinearLayout mWallpapersView; - private View mWallpaperStrip; + private HorizontalScrollView mWallpaperScrollContainer; private ActionMode.Callback mActionModeCallback; private ActionMode mActionMode; @@ -313,10 +311,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } } - public void setWallpaperStripYOffset(float offset) { - mWallpaperStrip.setPadding(0, 0, 0, (int) offset); - } - /** * shows the system wallpaper behind the window and hides the {@link * #mCropView} if visible @@ -369,9 +363,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { mCropView.setVisibility(View.INVISIBLE); mProgressView = findViewById(R.id.loading); - - - mWallpaperStrip = findViewById(R.id.wallpaper_strip); + mWallpaperScrollContainer = (HorizontalScrollView) findViewById(R.id.wallpaper_scroll_container); mCropView.setTouchCallback(new CropView.TouchCallback() { ViewPropertyAnimator mAnim; @Override @@ -379,15 +371,15 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { if (mAnim != null) { mAnim.cancel(); } - if (mWallpaperStrip.getAlpha() == 1f) { + if (mWallpaperScrollContainer.getAlpha() == 1f) { mIgnoreNextTap = true; } - mAnim = mWallpaperStrip.animate(); + mAnim = mWallpaperScrollContainer.animate(); mAnim.alpha(0f) .setDuration(150) .withEndAction(new Runnable() { public void run() { - mWallpaperStrip.setVisibility(View.INVISIBLE); + mWallpaperScrollContainer.setVisibility(View.INVISIBLE); } }); mAnim.setInterpolator(new AccelerateInterpolator(0.75f)); @@ -405,8 +397,8 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { if (mAnim != null) { mAnim.cancel(); } - mWallpaperStrip.setVisibility(View.VISIBLE); - mAnim = mWallpaperStrip.animate(); + mWallpaperScrollContainer.setVisibility(View.VISIBLE); + mAnim = mWallpaperScrollContainer.animate(); mAnim.alpha(1f) .setDuration(150) .setInterpolator(new DecelerateInterpolator(0.75f)); @@ -487,7 +479,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { LinearLayout masterWallpaperList = (LinearLayout) findViewById(R.id.master_wallpaper_list); FrameLayout pickImageTile = (FrameLayout) getLayoutInflater(). inflate(R.layout.wallpaper_picker_image_picker_item, masterWallpaperList, false); - setWallpaperItemPaddingToZero(pickImageTile); masterWallpaperList.addView(pickImageTile, 0); // Make its background the last photo taken on external storage @@ -659,17 +650,14 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } private void initializeScrollForRtl() { - final HorizontalScrollView scroll = - (HorizontalScrollView) findViewById(R.id.wallpaper_scroll_container); - - if (scroll.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { - final ViewTreeObserver observer = scroll.getViewTreeObserver(); + if (mWallpaperScrollContainer.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { + final ViewTreeObserver observer = mWallpaperScrollContainer.getViewTreeObserver(); observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { public void onGlobalLayout() { LinearLayout masterWallpaperList = (LinearLayout) findViewById(R.id.master_wallpaper_list); - scroll.scrollTo(masterWallpaperList.getWidth(), 0); - scroll.getViewTreeObserver().removeOnGlobalLayoutListener(this); + mWallpaperScrollContainer.scrollTo(masterWallpaperList.getWidth(), 0); + mWallpaperScrollContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this); } }); } @@ -696,10 +684,10 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { protected void onStop() { super.onStop(); - mWallpaperStrip = findViewById(R.id.wallpaper_strip); - if (mWallpaperStrip.getAlpha() < 1f) { - mWallpaperStrip.setAlpha(1f); - mWallpaperStrip.setVisibility(View.VISIBLE); + mWallpaperScrollContainer = (HorizontalScrollView) findViewById(R.id.wallpaper_scroll_container); + if (mWallpaperScrollContainer.getAlpha() < 1f) { + mWallpaperScrollContainer.setAlpha(1f); + mWallpaperScrollContainer.setVisibility(View.VISIBLE); } } @@ -823,7 +811,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { final FrameLayout pickedImageThumbnail = (FrameLayout) getLayoutInflater(). inflate(R.layout.wallpaper_picker_item, mWallpapersView, false); pickedImageThumbnail.setVisibility(View.GONE); - setWallpaperItemPaddingToZero(pickedImageThumbnail); mWallpapersView.addView(pickedImageThumbnail, 0); // Load the thumbnail @@ -886,11 +873,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } } - static void setWallpaperItemPaddingToZero(FrameLayout frameLayout) { - frameLayout.setPadding(0, 0, 0, 0); - frameLayout.setForeground(new ZeroPaddingDrawable(frameLayout.getForeground())); - } - private void addLongPressHandler(View v) { v.setOnLongClickListener(mLongClickListener); } @@ -1089,20 +1071,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { return mSavedImages; } - static class ZeroPaddingDrawable extends LevelListDrawable { - public ZeroPaddingDrawable(Drawable d) { - super(); - addLevel(0, 0, d); - setLevel(0); - } - - @Override - public boolean getPadding(Rect padding) { - padding.set(0, 0, 0, 0); - return true; - } - } - private static class SimpleWallpapersAdapter extends ArrayAdapter { private final LayoutInflater mLayoutInflater; @@ -1130,8 +1098,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { view = convertView; } - setWallpaperItemPaddingToZero((FrameLayout) view); - ImageView image = (ImageView) view.findViewById(R.id.wallpaper_image); if (thumb != null) { diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperRootView.java b/WallpaperPicker/src/com/android/launcher3/WallpaperRootView.java deleted file mode 100644 index ceaa043a7..000000000 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperRootView.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -package com.android.launcher3; - -import android.content.Context; -import android.graphics.Rect; -import android.util.AttributeSet; -import android.widget.RelativeLayout; - -public class WallpaperRootView extends RelativeLayout { - private final WallpaperPickerActivity a; - public WallpaperRootView(Context context, AttributeSet attrs) { - super(context, attrs); - a = (WallpaperPickerActivity) context; - } - public WallpaperRootView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - a = (WallpaperPickerActivity) context; - } - - protected boolean fitSystemWindows(Rect insets) { - a.setWallpaperStripYOffset(insets.bottom); - return true; - } -} -- cgit v1.2.3 From 091440a9cb9d4f42406631004aa484cbb79214ca Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Wed, 18 Mar 2015 14:16:05 -0700 Subject: Reducing method count by eliminating synthetic accessors Elimates 304 methods based on dex analysis The java compiler generates sythetic accessor methods for all private fields, methods and contructors accessed from inner classes. By marking them package-private and @Thunk instead, sythentic accessor methods are no longer needeed. These annotated elements should be treated as private. Change-Id: Id0dc2c92733474250d8ff12fa793d3a8adeb1f26 --- .../gallery3d/glrenderer/UploadedTexture.java | 4 ++- .../launcher3/LiveWallpaperListAdapter.java | 8 +++-- .../ThirdPartyWallpaperPickerListAdapter.java | 4 ++- .../android/launcher3/WallpaperCropActivity.java | 7 +++-- .../android/launcher3/WallpaperPickerActivity.java | 35 +++++++++++----------- .../android/photos/views/TiledImageRenderer.java | 21 ++++++------- .../com/android/photos/views/TiledImageView.java | 7 +++-- 7 files changed, 48 insertions(+), 38 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java b/WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java index f41a979b7..67abf6564 100644 --- a/WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java +++ b/WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java @@ -20,6 +20,8 @@ import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.opengl.GLUtils; +import com.android.launcher3.util.Thunk; + import junit.framework.Assert; import java.util.HashMap; @@ -82,7 +84,7 @@ public abstract class UploadedTexture extends BasicTexture { return mIsUploading; } - private static class BorderKey implements Cloneable { + @Thunk static class BorderKey implements Cloneable { public boolean vertical; public Config config; public int length; diff --git a/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java b/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java index 72f2d7e49..a5e951ce4 100644 --- a/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java +++ b/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java @@ -35,6 +35,8 @@ import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.TextView; +import com.android.launcher3.util.Thunk; + import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; @@ -50,7 +52,7 @@ public class LiveWallpaperListAdapter extends BaseAdapter implements ListAdapter private final LayoutInflater mInflater; private final PackageManager mPackageManager; - private List mWallpapers; + @Thunk List mWallpapers; @SuppressWarnings("unchecked") public LiveWallpaperListAdapter(Context context) { @@ -109,8 +111,8 @@ public class LiveWallpaperListAdapter extends BaseAdapter implements ListAdapter } public static class LiveWallpaperTile extends WallpaperPickerActivity.WallpaperTileInfo { - private Drawable mThumbnail; - private WallpaperInfo mInfo; + @Thunk Drawable mThumbnail; + @Thunk WallpaperInfo mInfo; public LiveWallpaperTile(Drawable thumbnail, WallpaperInfo info, Intent intent) { mThumbnail = thumbnail; mInfo = info; diff --git a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java index 27e65aa31..16bde3300 100644 --- a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java +++ b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java @@ -32,6 +32,8 @@ import android.widget.FrameLayout; import android.widget.ListAdapter; import android.widget.TextView; +import com.android.launcher3.util.Thunk; + import java.util.ArrayList; import java.util.List; @@ -46,7 +48,7 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements new ArrayList(); public static class ThirdPartyWallpaperTile extends WallpaperPickerActivity.WallpaperTileInfo { - private ResolveInfo mResolveInfo; + @Thunk ResolveInfo mResolveInfo; public ThirdPartyWallpaperTile(ResolveInfo resolveInfo) { mResolveInfo = resolveInfo; } diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index a3a3c537b..5b2943a65 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -44,6 +44,7 @@ import android.widget.Toast; import com.android.gallery3d.common.BitmapCropTask; import com.android.gallery3d.common.BitmapUtils; import com.android.gallery3d.common.Utils; +import com.android.launcher3.util.Thunk; import com.android.photos.BitmapRegionTileSource; import com.android.photos.BitmapRegionTileSource.BitmapSource; import com.android.photos.BitmapRegionTileSource.BitmapSource.InBitmapProvider; @@ -78,10 +79,10 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback private HandlerThread mLoaderThread; private Handler mLoaderHandler; - private LoadRequest mCurrentLoadRequest; + @Thunk LoadRequest mCurrentLoadRequest; private byte[] mTempStorageForDecoding = new byte[16 * 1024]; // A weak-set of reusable bitmaps - private Set mReusableBitmaps = + @Thunk Set mReusableBitmaps = Collections.newSetFromMap(new WeakHashMap()); @Override @@ -220,7 +221,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback return false; } - private void addReusableBitmap(TileSource src) { + @Thunk void addReusableBitmap(TileSource src) { synchronized (mReusableBitmaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && src instanceof BitmapRegionTileSource) { diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index d16fc31e5..1364df3ed 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -70,6 +70,7 @@ import android.widget.Toast; import com.android.gallery3d.common.BitmapCropTask; import com.android.gallery3d.common.BitmapUtils; import com.android.gallery3d.common.Utils; +import com.android.launcher3.util.Thunk; import com.android.photos.BitmapRegionTileSource; import com.android.photos.BitmapRegionTileSource.BitmapSource; import com.android.photos.views.TiledImageRenderer.TileSource; @@ -88,21 +89,21 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { private static final String SELECTED_INDEX = "SELECTED_INDEX"; private static final int FLAG_POST_DELAY_MILLIS = 200; - private View mSelectedTile; - private boolean mIgnoreNextTap; - private OnClickListener mThumbnailOnClickListener; + @Thunk View mSelectedTile; + @Thunk boolean mIgnoreNextTap; + @Thunk OnClickListener mThumbnailOnClickListener; - private LinearLayout mWallpapersView; - private HorizontalScrollView mWallpaperScrollContainer; + @Thunk LinearLayout mWallpapersView; + @Thunk HorizontalScrollView mWallpaperScrollContainer; - private ActionMode.Callback mActionModeCallback; - private ActionMode mActionMode; + @Thunk ActionMode.Callback mActionModeCallback; + @Thunk ActionMode mActionMode; - private View.OnLongClickListener mLongClickListener; + @Thunk View.OnLongClickListener mLongClickListener; ArrayList mTempWallpaperTiles = new ArrayList(); private SavedWallpaperImages mSavedImages; - private int mSelectedIndex = -1; + @Thunk int mSelectedIndex = -1; public static abstract class WallpaperTileInfo { protected View mView; @@ -135,7 +136,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { public static class UriWallpaperInfo extends WallpaperTileInfo { private Uri mUri; private boolean mFirstClick = true; - private BitmapRegionTileSource.UriBitmapSource mBitmapSource; + @Thunk BitmapRegionTileSource.UriBitmapSource mBitmapSource; public UriWallpaperInfo(Uri uri) { mUri = uri; } @@ -337,7 +338,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { }, FLAG_POST_DELAY_MILLIS); } - private void changeWallpaperFlags(boolean visible) { + @Thunk void changeWallpaperFlags(boolean visible) { int desiredWallpaperFlag = visible ? WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER : 0; int currentWallpaperFlag = getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; @@ -635,7 +636,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { }; } - private void selectTile(View v) { + @Thunk void selectTile(View v) { if (mSelectedTile != null) { mSelectedTile.setSelected(false); mSelectedTile = null; @@ -649,7 +650,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { getString(R.string.announce_selection, v.getContentDescription())); } - private void initializeScrollForRtl() { + @Thunk void initializeScrollForRtl() { if (mWallpaperScrollContainer.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { final ViewTreeObserver observer = mWallpaperScrollContainer.getViewTreeObserver(); observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @@ -704,7 +705,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { mSelectedIndex = savedInstanceState.getInt(SELECTED_INDEX, -1); } - private void populateWallpapersFromAdapter(ViewGroup parent, BaseAdapter adapter, + @Thunk void populateWallpapersFromAdapter(ViewGroup parent, BaseAdapter adapter, boolean addLongPressHandler) { for (int i = 0; i < adapter.getCount(); i++) { FrameLayout thumbnail = (FrameLayout) adapter.getView(i, null, parent); @@ -719,7 +720,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } } - private void updateTileIndices() { + @Thunk void updateTileIndices() { LinearLayout masterWallpaperList = (LinearLayout) findViewById(R.id.master_wallpaper_list); final int childCount = masterWallpaperList.getChildCount(); final Resources res = getResources(); @@ -760,13 +761,13 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } } - private static Point getDefaultThumbnailSize(Resources res) { + @Thunk static Point getDefaultThumbnailSize(Resources res) { return new Point(res.getDimensionPixelSize(R.dimen.wallpaperThumbnailWidth), res.getDimensionPixelSize(R.dimen.wallpaperThumbnailHeight)); } - private static Bitmap createThumbnail(Point size, Context context, Uri uri, byte[] imageBytes, + @Thunk static Bitmap createThumbnail(Point size, Context context, Uri uri, byte[] imageBytes, Resources res, int resId, int rotation, boolean leftAligned) { int width = size.x; int height = size.y; diff --git a/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java b/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java index f9b7ab473..39a73b9d5 100644 --- a/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java +++ b/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java @@ -30,6 +30,7 @@ import com.android.gallery3d.common.Utils; import com.android.gallery3d.glrenderer.BasicTexture; import com.android.gallery3d.glrenderer.GLCanvas; import com.android.gallery3d.glrenderer.UploadedTexture; +import com.android.launcher3.util.Thunk; import com.android.photos.views.Pools.Pool; import com.android.photos.views.Pools.SynchronizedPool; @@ -67,12 +68,12 @@ public class TiledImageRenderer { private static final int STATE_RECYCLING = 0x20; private static final int STATE_RECYCLED = 0x40; - private static Pool sTilePool = new SynchronizedPool(64); + @Thunk static Pool sTilePool = new SynchronizedPool(64); // TILE_SIZE must be 2^N - private int mTileSize; + @Thunk int mTileSize; - private TileSource mModel; + @Thunk TileSource mModel; private BasicTexture mPreview; protected int mLevelCount; // cache the value of mScaledBitmaps.length @@ -82,7 +83,7 @@ public class TiledImageRenderer { // half size of the previous one). If the value is in [0, mLevelCount), we // use the bitmap in mScaledBitmaps[mLevel] for display, otherwise the value // is mLevelCount - private int mLevel = 0; + @Thunk int mLevel = 0; private int mOffsetX; private int mOffsetY; @@ -96,10 +97,10 @@ public class TiledImageRenderer { private final LongSparseArray mActiveTiles = new LongSparseArray(); // The following three queue are guarded by mQueueLock - private final Object mQueueLock = new Object(); + @Thunk final Object mQueueLock = new Object(); private final TileQueue mRecycledQueue = new TileQueue(); private final TileQueue mUploadQueue = new TileQueue(); - private final TileQueue mDecodeQueue = new TileQueue(); + @Thunk final TileQueue mDecodeQueue = new TileQueue(); // The width and height of the full-sized bitmap protected int mImageWidth = SIZE_UNKNOWN; @@ -489,7 +490,7 @@ public class TiledImageRenderer { } } - private void decodeTile(Tile tile) { + @Thunk void decodeTile(Tile tile) { synchronized (mQueueLock) { if (tile.mTileState != STATE_IN_QUEUE) { return; @@ -556,7 +557,7 @@ public class TiledImageRenderer { mActiveTiles.put(key, tile); } - private Tile getTile(int x, int y, int level) { + @Thunk Tile getTile(int x, int y, int level) { return mActiveTiles.get(makeTileKey(x, y, level)); } @@ -748,7 +749,7 @@ public class TiledImageRenderer { } } - private static class TileQueue { + @Thunk static class TileQueue { private Tile mHead; public Tile pop() { @@ -786,7 +787,7 @@ public class TiledImageRenderer { } } - private class TileDecoder extends Thread { + @Thunk class TileDecoder extends Thread { public void finishAndWait() { interrupt(); diff --git a/WallpaperPicker/src/com/android/photos/views/TiledImageView.java b/WallpaperPicker/src/com/android/photos/views/TiledImageView.java index 56ee7a658..7e3e1a936 100644 --- a/WallpaperPicker/src/com/android/photos/views/TiledImageView.java +++ b/WallpaperPicker/src/com/android/photos/views/TiledImageView.java @@ -33,6 +33,7 @@ import android.widget.FrameLayout; import com.android.gallery3d.glrenderer.BasicTexture; import com.android.gallery3d.glrenderer.GLES20Canvas; +import com.android.launcher3.util.Thunk; import com.android.photos.views.TiledImageRenderer.TileSource; import javax.microedition.khronos.egl.EGLConfig; @@ -43,8 +44,8 @@ import javax.microedition.khronos.opengles.GL10; */ public class TiledImageView extends FrameLayout { - private GLSurfaceView mGLSurfaceView; - private boolean mInvalPending = false; + @Thunk GLSurfaceView mGLSurfaceView; + @Thunk boolean mInvalPending = false; private FrameCallback mFrameCallback; protected static class ImageRendererWrapper { @@ -203,7 +204,7 @@ public class TiledImageView extends FrameLayout { } } - private class TileRenderer implements Renderer { + @Thunk class TileRenderer implements Renderer { private GLES20Canvas mCanvas; -- cgit v1.2.3 From 6a1e95a3dfb5eb65cc2c682c5ede9e22cc7ff7d9 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 20 Mar 2015 17:26:30 -0700 Subject: Removing all dependencies of launcher code on wallpaper-picker > WallpaperPicker can still depend on launcher code, but not the other way round. Change-Id: I93a07f985c3955c638a68a5fad9c09b184a879b9 --- .../com/android/gallery3d/common/BitmapUtils.java | 94 ---------------------- .../launcher3/LauncherWallpaperPickerActivity.java | 21 +++++ .../android/launcher3/WallpaperCropActivity.java | 46 ++--------- .../android/launcher3/WallpaperPickerActivity.java | 12 ++- 4 files changed, 37 insertions(+), 136 deletions(-) create mode 100644 WallpaperPicker/src/com/android/launcher3/LauncherWallpaperPickerActivity.java (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java b/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java index 347001783..9ac5c1bf7 100644 --- a/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java +++ b/WallpaperPicker/src/com/android/gallery3d/common/BitmapUtils.java @@ -16,20 +16,12 @@ package com.android.gallery3d.common; -import android.annotation.TargetApi; import android.content.Context; import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Paint; -import android.graphics.Point; import android.net.Uri; -import android.os.Build; import android.util.Log; -import android.view.WindowManager; import com.android.gallery3d.exif.ExifInterface; -import com.android.launcher3.WallpaperCropActivity; import java.io.BufferedInputStream; import java.io.IOException; @@ -49,92 +41,6 @@ public class BitmapUtils { : initialSize / 8 * 8; } - public static Bitmap resizeBitmapByScale( - Bitmap bitmap, float scale, boolean recycle) { - int width = Math.round(bitmap.getWidth() * scale); - int height = Math.round(bitmap.getHeight() * scale); - if (width == bitmap.getWidth() - && height == bitmap.getHeight()) return bitmap; - Bitmap target = Bitmap.createBitmap(width, height, getConfig(bitmap)); - Canvas canvas = new Canvas(target); - canvas.scale(scale, scale); - Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG); - canvas.drawBitmap(bitmap, 0, 0, paint); - if (recycle) bitmap.recycle(); - return target; - } - - private static Bitmap.Config getConfig(Bitmap bitmap) { - Bitmap.Config config = bitmap.getConfig(); - if (config == null) { - config = Bitmap.Config.ARGB_8888; - } - return config; - } - - /** - * As a ratio of screen height, the total distance we want the parallax effect to span - * horizontally - */ - public static float wallpaperTravelToScreenWidthRatio(int width, int height) { - float aspectRatio = width / (float) height; - - // At an aspect ratio of 16/10, the wallpaper parallax effect should span 1.5 * screen width - // At an aspect ratio of 10/16, the wallpaper parallax effect should span 1.2 * screen width - // We will use these two data points to extrapolate how much the wallpaper parallax effect - // to span (ie travel) at any aspect ratio: - - final float ASPECT_RATIO_LANDSCAPE = 16/10f; - final float ASPECT_RATIO_PORTRAIT = 10/16f; - final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE = 1.5f; - final float WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT = 1.2f; - - // To find out the desired width at different aspect ratios, we use the following two - // formulas, where the coefficient on x is the aspect ratio (width/height): - // (16/10)x + y = 1.5 - // (10/16)x + y = 1.2 - // We solve for x and y and end up with a final formula: - final float x = - (WALLPAPER_WIDTH_TO_SCREEN_RATIO_LANDSCAPE - WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT) / - (ASPECT_RATIO_LANDSCAPE - ASPECT_RATIO_PORTRAIT); - final float y = WALLPAPER_WIDTH_TO_SCREEN_RATIO_PORTRAIT - x * ASPECT_RATIO_PORTRAIT; - return x * aspectRatio + y; - } - - private static Point sDefaultWallpaperSize; - - @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) - public static Point getDefaultWallpaperSize(Resources res, WindowManager windowManager) { - if (sDefaultWallpaperSize == null) { - Point minDims = new Point(); - Point maxDims = new Point(); - windowManager.getDefaultDisplay().getCurrentSizeRange(minDims, maxDims); - - int maxDim = Math.max(maxDims.x, maxDims.y); - int minDim = Math.max(minDims.x, minDims.y); - - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { - Point realSize = new Point(); - windowManager.getDefaultDisplay().getRealSize(realSize); - maxDim = Math.max(realSize.x, realSize.y); - minDim = Math.min(realSize.x, realSize.y); - } - - // We need to ensure that there is enough extra space in the wallpaper - // for the intended parallax effects - final int defaultWidth, defaultHeight; - if (res.getConfiguration().smallestScreenWidthDp >= 720) { - defaultWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim)); - defaultHeight = maxDim; - } else { - defaultWidth = Math.max((int) (minDim * WallpaperCropActivity.WALLPAPER_SCREENS_SPAN), maxDim); - defaultHeight = maxDim; - } - sDefaultWallpaperSize = new Point(defaultWidth, defaultHeight); - } - return sDefaultWallpaperSize; - } - public static int getRotationFromExif(Context context, Uri uri) { return BitmapUtils.getRotationFromExifHelper(null, 0, context, uri); } diff --git a/WallpaperPicker/src/com/android/launcher3/LauncherWallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/LauncherWallpaperPickerActivity.java new file mode 100644 index 000000000..091c05462 --- /dev/null +++ b/WallpaperPicker/src/com/android/launcher3/LauncherWallpaperPickerActivity.java @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2013 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. + */ + +package com.android.launcher3; + +// TODO: Remove this class +public class LauncherWallpaperPickerActivity extends WallpaperPickerActivity { +} \ No newline at end of file diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index 5b2943a65..c238390e3 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -38,13 +38,13 @@ import android.os.Message; import android.util.Log; import android.view.Display; import android.view.View; -import android.view.WindowManager; import android.widget.Toast; import com.android.gallery3d.common.BitmapCropTask; import com.android.gallery3d.common.BitmapUtils; import com.android.gallery3d.common.Utils; import com.android.launcher3.util.Thunk; +import com.android.launcher3.util.WallpaperUtils; import com.android.photos.BitmapRegionTileSource; import com.android.photos.BitmapRegionTileSource.BitmapSource; import com.android.photos.BitmapRegionTileSource.BitmapSource.InBitmapProvider; @@ -57,8 +57,8 @@ import java.util.WeakHashMap; public class WallpaperCropActivity extends Activity implements Handler.Callback { private static final String LOGTAG = "Launcher3.CropActivity"; - protected static final String WALLPAPER_WIDTH_KEY = "wallpaper.width"; - protected static final String WALLPAPER_HEIGHT_KEY = "wallpaper.height"; + protected static final String WALLPAPER_WIDTH_KEY = WallpaperUtils.WALLPAPER_WIDTH_KEY; + protected static final String WALLPAPER_HEIGHT_KEY = WallpaperUtils.WALLPAPER_HEIGHT_KEY; /** * The maximum bitmap size we allow to be returned through the intent. @@ -68,7 +68,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback * array instead of a Bitmap instance to avoid overhead. */ public static final int MAX_BMAP_IN_INTENT = 750000; - public static final float WALLPAPER_SCREENS_SPAN = 2f; + public static final float WALLPAPER_SCREENS_SPAN = WallpaperUtils.WALLPAPER_SCREENS_SPAN; private static final int MSG_LOAD_IMAGE = 1; @@ -290,10 +290,6 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback return getResources().getBoolean(R.bool.allow_rotation); } - public static String getSharedPreferencesKey() { - return LauncherFiles.WALLPAPER_CROP_PREFERENCES_KEY; - } - protected void setWallpaper(Uri uri, final boolean finishActivityWhenDone) { int rotation = BitmapUtils.getRotationFromExif(this, uri); BitmapCropTask cropTask = new BitmapCropTask( @@ -319,7 +315,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback // this device int rotation = BitmapUtils.getRotationFromExif(res, resId); Point inSize = mCropView.getSourceDimensions(); - Point outSize = BitmapUtils.getDefaultWallpaperSize(getResources(), + Point outSize = WallpaperUtils.getDefaultWallpaperSize(getResources(), getWindowManager()); RectF crop = Utils.getMaxCropRect( inSize.x, inSize.y, outSize.x, outSize.y, false); @@ -352,7 +348,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback d.getSize(displaySize); boolean isPortrait = displaySize.x < displaySize.y; - Point defaultWallpaperSize = BitmapUtils.getDefaultWallpaperSize(getResources(), + Point defaultWallpaperSize = WallpaperUtils.getDefaultWallpaperSize(getResources(), getWindowManager()); // Get the crop RectF cropRect = mCropView.getCrop(); @@ -435,7 +431,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback } protected void updateWallpaperDimensions(int width, int height) { - String spKey = getSharedPreferencesKey(); + String spKey = LauncherFiles.WALLPAPER_CROP_PREFERENCES_KEY; SharedPreferences sp = getSharedPreferences(spKey, Context.MODE_MULTI_PROCESS); SharedPreferences.Editor editor = sp.edit(); if (width != 0 && height != 0) { @@ -446,36 +442,10 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback editor.remove(WALLPAPER_HEIGHT_KEY); } editor.commit(); - - suggestWallpaperDimension(getResources(), + WallpaperUtils.suggestWallpaperDimension(getResources(), sp, getWindowManager(), WallpaperManager.getInstance(this), true); } - public static void suggestWallpaperDimension(Resources res, - final SharedPreferences sharedPrefs, - WindowManager windowManager, - final WallpaperManager wallpaperManager, boolean fallBackToDefaults) { - final Point defaultWallpaperSize = BitmapUtils.getDefaultWallpaperSize(res, windowManager); - // If we have saved a wallpaper width/height, use that instead - - int savedWidth = sharedPrefs.getInt(WALLPAPER_WIDTH_KEY, -1); - int savedHeight = sharedPrefs.getInt(WALLPAPER_HEIGHT_KEY, -1); - - if (savedWidth == -1 || savedHeight == -1) { - if (!fallBackToDefaults) { - return; - } else { - savedWidth = defaultWallpaperSize.x; - savedHeight = defaultWallpaperSize.y; - } - } - - if (savedWidth != wallpaperManager.getDesiredMinimumWidth() || - savedHeight != wallpaperManager.getDesiredMinimumHeight()) { - wallpaperManager.suggestDesiredDimensions(savedWidth, savedHeight); - } - } - static class LoadRequest { BitmapSource src; boolean touchEnabled; diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 1364df3ed..152cac4cc 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -71,6 +71,7 @@ import com.android.gallery3d.common.BitmapCropTask; import com.android.gallery3d.common.BitmapUtils; import com.android.gallery3d.common.Utils; import com.android.launcher3.util.Thunk; +import com.android.launcher3.util.WallpaperUtils; import com.android.photos.BitmapRegionTileSource; import com.android.photos.BitmapRegionTileSource.BitmapSource; import com.android.photos.views.TiledImageRenderer.TileSource; @@ -239,7 +240,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public float getScale(TileSource src) { - Point wallpaperSize = BitmapUtils.getDefaultWallpaperSize( + Point wallpaperSize = WallpaperUtils.getDefaultWallpaperSize( a.getResources(), a.getWindowManager()); RectF crop = Utils.getMaxCropRect( src.getImageWidth(), src.getImageHeight(), @@ -1109,9 +1110,12 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { return view; } - // In Launcher3, we override this with a method that catches exceptions - // from starting activities; didn't want to copy and paste code into here public void startActivityForResultSafely(Intent intent, int requestCode) { - startActivityForResult(intent, requestCode); + Utilities.startActivityForResultSafely(this, intent, requestCode); + } + + @Override + public boolean enableRotation() { + return Utilities.isRotationEnabled(this); } } -- cgit v1.2.3 From 1d0b093a6e384f5ade340c2b404b324bb6002c97 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 20 Mar 2015 18:51:38 -0700 Subject: Adding BaseActivity which can be overriden for custom behavior Change-Id: I6707aa99f5d33dceede226a6367e24482f5157f6 --- .../launcher3/LiveWallpaperListAdapter.java | 1 - .../android/launcher3/SavedWallpaperImages.java | 5 +- .../ThirdPartyWallpaperPickerListAdapter.java | 5 +- .../android/launcher3/WallpaperCropActivity.java | 26 +++---- .../android/launcher3/WallpaperPickerActivity.java | 81 ++++++++++++---------- .../com/android/launcher3/base/BaseActivity.java | 21 ++++++ 6 files changed, 80 insertions(+), 59 deletions(-) create mode 100644 WallpaperPicker/src/com/android/launcher3/base/BaseActivity.java (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java b/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java index a5e951ce4..b53fce119 100644 --- a/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java +++ b/WallpaperPicker/src/com/android/launcher3/LiveWallpaperListAdapter.java @@ -30,7 +30,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; -import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.TextView; diff --git a/WallpaperPicker/src/com/android/launcher3/SavedWallpaperImages.java b/WallpaperPicker/src/com/android/launcher3/SavedWallpaperImages.java index 9f92bc105..64b0ac466 100644 --- a/WallpaperPicker/src/com/android/launcher3/SavedWallpaperImages.java +++ b/WallpaperPicker/src/com/android/launcher3/SavedWallpaperImages.java @@ -16,7 +16,6 @@ package com.android.launcher3; -import android.app.Activity; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; @@ -60,13 +59,13 @@ public class SavedWallpaperImages extends BaseAdapter implements ListAdapter { } } - public SavedWallpaperImages(Activity context) { + public SavedWallpaperImages(Context context) { // We used to store the saved images in the cache directory, but that meant they'd get // deleted sometimes-- move them to the data directory ImageDb.moveFromCacheDirectoryIfNecessary(context); mDb = new ImageDb(context); mContext = context; - mLayoutInflater = context.getLayoutInflater(); + mLayoutInflater = LayoutInflater.from(context); } public void loadThumbnailsAndImageIdList() { diff --git a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java index 16bde3300..f46da53ec 100644 --- a/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java +++ b/WallpaperPicker/src/com/android/launcher3/ThirdPartyWallpaperPickerListAdapter.java @@ -28,7 +28,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; -import android.widget.FrameLayout; import android.widget.ListAdapter; import android.widget.TextView; @@ -38,8 +37,6 @@ import java.util.ArrayList; import java.util.List; public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements ListAdapter { - private static final String LOG_TAG = "LiveWallpaperListAdapter"; - private final LayoutInflater mInflater; private final PackageManager mPackageManager; private final int mIconSize; @@ -64,7 +61,7 @@ public class ThirdPartyWallpaperPickerListAdapter extends BaseAdapter implements } public ThirdPartyWallpaperPickerListAdapter(Context context) { - mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + mInflater = LayoutInflater.from(context); mPackageManager = context.getPackageManager(); mIconSize = context.getResources().getDimensionPixelSize(R.dimen.wallpaperItemIconSize); final PackageManager pm = mPackageManager; diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index c238390e3..142a9cb10 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -43,6 +43,7 @@ import android.widget.Toast; import com.android.gallery3d.common.BitmapCropTask; import com.android.gallery3d.common.BitmapUtils; import com.android.gallery3d.common.Utils; +import com.android.launcher3.base.BaseActivity; import com.android.launcher3.util.Thunk; import com.android.launcher3.util.WallpaperUtils; import com.android.photos.BitmapRegionTileSource; @@ -54,7 +55,7 @@ import java.util.Collections; import java.util.Set; import java.util.WeakHashMap; -public class WallpaperCropActivity extends Activity implements Handler.Callback { +public class WallpaperCropActivity extends BaseActivity implements Handler.Callback { private static final String LOGTAG = "Launcher3.CropActivity"; protected static final String WALLPAPER_WIDTH_KEY = WallpaperUtils.WALLPAPER_WIDTH_KEY; @@ -86,7 +87,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback Collections.newSetFromMap(new WeakHashMap()); @Override - protected void onCreate(Bundle savedInstanceState) { + public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mLoaderThread = new HandlerThread("wallpaper_loader"); @@ -130,13 +131,12 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback // Load image in background final BitmapRegionTileSource.UriBitmapSource bitmapSource = - new BitmapRegionTileSource.UriBitmapSource(this, imageUri, 1024); + new BitmapRegionTileSource.UriBitmapSource(getContext(), imageUri, 1024); mSetWallpaperButton.setEnabled(false); Runnable onLoad = new Runnable() { public void run() { if (bitmapSource.getLoadingState() != BitmapSource.State.LOADED) { - Toast.makeText(WallpaperCropActivity.this, - getString(R.string.wallpaper_load_fail), + Toast.makeText(getContext(), R.string.wallpaper_load_fail, Toast.LENGTH_LONG).show(); finish(); } else { @@ -148,7 +148,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback } @Override - protected void onDestroy() { + public void onDestroy() { if (mCropView != null) { mCropView.destroy(); } @@ -203,7 +203,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback } } - req.result = new BitmapRegionTileSource(this, req.src, mTempStorageForDecoding); + req.result = new BitmapRegionTileSource(getContext(), req.src, mTempStorageForDecoding); runOnUiThread(new Runnable() { @Override @@ -291,9 +291,9 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback } protected void setWallpaper(Uri uri, final boolean finishActivityWhenDone) { - int rotation = BitmapUtils.getRotationFromExif(this, uri); + int rotation = BitmapUtils.getRotationFromExif(getContext(), uri); BitmapCropTask cropTask = new BitmapCropTask( - this, uri, null, rotation, 0, 0, true, false, null); + getContext(), uri, null, rotation, 0, 0, true, false, null); final Point bounds = cropTask.getImageBounds(); Runnable onEndCrop = new Runnable() { public void run() { @@ -330,7 +330,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback } } }; - BitmapCropTask cropTask = new BitmapCropTask(this, res, resId, + BitmapCropTask cropTask = new BitmapCropTask(getContext(), res, resId, crop, rotation, outSize.x, outSize.y, true, false, onEndCrop); cropTask.execute(); } @@ -422,7 +422,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback } } }; - BitmapCropTask cropTask = new BitmapCropTask(this, uri, + BitmapCropTask cropTask = new BitmapCropTask(getContext(), uri, cropRect, cropRotation, outWidth, outHeight, true, false, onEndCrop); if (onBitmapCroppedHandler != null) { cropTask.setOnBitmapCropped(onBitmapCroppedHandler); @@ -432,7 +432,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback protected void updateWallpaperDimensions(int width, int height) { String spKey = LauncherFiles.WALLPAPER_CROP_PREFERENCES_KEY; - SharedPreferences sp = getSharedPreferences(spKey, Context.MODE_MULTI_PROCESS); + SharedPreferences sp = getContext().getSharedPreferences(spKey, Context.MODE_MULTI_PROCESS); SharedPreferences.Editor editor = sp.edit(); if (width != 0 && height != 0) { editor.putInt(WALLPAPER_WIDTH_KEY, width); @@ -443,7 +443,7 @@ public class WallpaperCropActivity extends Activity implements Handler.Callback } editor.commit(); WallpaperUtils.suggestWallpaperDimension(getResources(), - sp, getWindowManager(), WallpaperManager.getInstance(this), true); + sp, getWindowManager(), WallpaperManager.getInstance(getContext()), true); } static class LoadRequest { diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 152cac4cc..c49286a75 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -21,6 +21,7 @@ import android.annotation.TargetApi; import android.app.ActionBar; import android.app.Activity; import android.app.WallpaperManager; +import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; @@ -159,8 +160,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { ViewGroup parent = (ViewGroup) mView.getParent(); if (parent != null) { parent.removeView(mView); - Toast.makeText(a, - a.getString(R.string.image_load_fail), + Toast.makeText(a.getContext(), R.string.image_load_fail, Toast.LENGTH_SHORT).show(); } } @@ -168,7 +168,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { }; } mBitmapSource = new BitmapRegionTileSource.UriBitmapSource( - a, mUri, BitmapRegionTileSource.MAX_PREVIEW_SIZE); + a.getContext(), mUri, BitmapRegionTileSource.MAX_PREVIEW_SIZE); a.setCropViewTileSource(mBitmapSource, true, false, null, onLoad); } @Override @@ -205,7 +205,8 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public void onClick(WallpaperPickerActivity a) { BitmapRegionTileSource.UriBitmapSource bitmapSource = - new BitmapRegionTileSource.UriBitmapSource(a, Uri.fromFile(mFile), 1024); + new BitmapRegionTileSource.UriBitmapSource(a.getContext(), + Uri.fromFile(mFile), 1024); a.setCropViewTileSource(bitmapSource, false, true, null, null); } @Override @@ -272,8 +273,8 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public void onClick(WallpaperPickerActivity a) { CropView c = a.getCropView(); - Drawable defaultWallpaper = WallpaperManager.getInstance(a).getBuiltInDrawable( - c.getWidth(), c.getHeight(), false, 0.5f, 0.5f); + Drawable defaultWallpaper = WallpaperManager.getInstance(a.getContext()) + .getBuiltInDrawable(c.getWidth(), c.getHeight(), false, 0.5f, 0.5f); if (defaultWallpaper == null) { Log.w(TAG, "Null default wallpaper encountered."); c.setTileSource(null, null); @@ -290,14 +291,15 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { return 1f; } }; - req.result = new DrawableTileSource(a, defaultWallpaper, DrawableTileSource.MAX_PREVIEW_SIZE); + req.result = new DrawableTileSource(a.getContext(), + defaultWallpaper, DrawableTileSource.MAX_PREVIEW_SIZE); a.onLoadRequestComplete(req, true); } @Override public void onSave(WallpaperPickerActivity a) { try { - WallpaperManager.getInstance(a).clear(); - a.setResult(RESULT_OK); + WallpaperManager.getInstance(a.getContext()).clear(); + a.setResult(Activity.RESULT_OK); } catch (IOException e) { Log.w("Setting wallpaper to default threw exception", e); } @@ -449,18 +451,18 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { // Populate the built-in wallpapers ArrayList wallpapers = findBundledWallpapers(); mWallpapersView = (LinearLayout) findViewById(R.id.wallpaper_list); - SimpleWallpapersAdapter ia = new SimpleWallpapersAdapter(this, wallpapers); + SimpleWallpapersAdapter ia = new SimpleWallpapersAdapter(getContext(), wallpapers); populateWallpapersFromAdapter(mWallpapersView, ia, false); // Populate the saved wallpapers - mSavedImages = new SavedWallpaperImages(this); + mSavedImages = new SavedWallpaperImages(getContext()); mSavedImages.loadThumbnailsAndImageIdList(); populateWallpapersFromAdapter(mWallpapersView, mSavedImages, true); // Populate the live wallpapers final LinearLayout liveWallpapersView = (LinearLayout) findViewById(R.id.live_wallpaper_list); - final LiveWallpaperListAdapter a = new LiveWallpaperListAdapter(this); + final LiveWallpaperListAdapter a = new LiveWallpaperListAdapter(getContext()); a.registerDataSetObserver(new DataSetObserver() { public void onChanged() { liveWallpapersView.removeAllViews(); @@ -474,7 +476,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { final LinearLayout thirdPartyWallpapersView = (LinearLayout) findViewById(R.id.third_party_wallpaper_list); final ThirdPartyWallpaperPickerListAdapter ta = - new ThirdPartyWallpaperPickerListAdapter(this); + new ThirdPartyWallpaperPickerListAdapter(getContext()); populateWallpapersFromAdapter(thirdPartyWallpapersView, ta, false); // Add a tile for the Gallery @@ -648,7 +650,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { // TODO: Remove this once the accessibility framework and // services have better support for selection state. v.announceForAccessibility( - getString(R.string.announce_selection, v.getContentDescription())); + getContext().getString(R.string.announce_selection, v.getContentDescription())); } @Thunk void initializeScrollForRtl() { @@ -666,7 +668,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } protected Bitmap getThumbnailOfLastPhoto() { - Cursor cursor = MediaStore.Images.Media.query(getContentResolver(), + Cursor cursor = MediaStore.Images.Media.query(getContext().getContentResolver(), MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[] { MediaStore.Images.ImageColumns._ID, MediaStore.Images.ImageColumns.DATE_TAKEN}, @@ -676,7 +678,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { if (cursor != null) { if (cursor.moveToNext()) { int id = cursor.getInt(0); - thumb = MediaStore.Images.Thumbnails.getThumbnail(getContentResolver(), + thumb = MediaStore.Images.Thumbnails.getThumbnail(getContext().getContentResolver(), id, MediaStore.Images.Thumbnails.MINI_KIND, null); } cursor.close(); @@ -684,7 +686,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { return thumb; } - protected void onStop() { + public void onStop() { super.onStop(); mWallpaperScrollContainer = (HorizontalScrollView) findViewById(R.id.wallpaper_scroll_container); if (mWallpaperScrollContainer.getAlpha() < 1f) { @@ -693,7 +695,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } } - protected void onSaveInstanceState(Bundle outState) { + public void onSaveInstanceState(Bundle outState) { outState.putParcelableArrayList(TEMP_WALLPAPER_TILES, mTempWallpaperTiles); outState.putInt(SELECTED_INDEX, mSelectedIndex); } @@ -818,7 +820,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { // Load the thumbnail final ImageView image = (ImageView) pickedImageThumbnail.findViewById(R.id.wallpaper_image); final Point defaultSize = getDefaultThumbnailSize(this.getResources()); - final Context context = this; + final Context context = getContext(); new AsyncTask() { protected Bitmap doInBackground(Void...args) { try { @@ -862,15 +864,16 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } } - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == IMAGE_PICK && resultCode == RESULT_OK) { + public void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == IMAGE_PICK && resultCode == Activity.RESULT_OK) { if (data != null && data.getData() != null) { Uri uri = data.getData(); addTemporaryWallpaperTile(uri, false); } - } else if (requestCode == PICK_WALLPAPER_THIRD_PARTY_ACTIVITY && resultCode == RESULT_OK) { + } else if (requestCode == PICK_WALLPAPER_THIRD_PARTY_ACTIVITY + && resultCode == Activity.RESULT_OK) { // Something was set on the third-party activity. - setResult(RESULT_OK); + setResult(Activity.RESULT_OK); finish(); } } @@ -880,7 +883,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } private ArrayList findBundledWallpapers() { - final PackageManager pm = getPackageManager(); + final PackageManager pm = getContext().getPackageManager(); final ArrayList bundled = new ArrayList(24); Partner partner = Partner.get(pm); @@ -924,7 +927,8 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { Pair r = getWallpaperArrayResourceId(); if (r != null) { try { - Resources wallpaperRes = getPackageManager().getResourcesForApplication(r.first); + Resources wallpaperRes = getContext().getPackageManager() + .getResourcesForApplication(r.first); addWallpapers(bundled, wallpaperRes, r.first.packageName, r.second); } catch (PackageManager.NameNotFoundException e) { } @@ -947,7 +951,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { try { f.createNewFile(); FileOutputStream thumbFileStream = - openFileOutput(f.getName(), Context.MODE_PRIVATE); + getContext().openFileOutput(f.getName(), Context.MODE_PRIVATE); b.compress(Bitmap.CompressFormat.JPEG, 95, thumbFileStream); thumbFileStream.close(); return true; @@ -959,17 +963,18 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } private File getDefaultThumbFile() { - return new File(getFilesDir(), Build.VERSION.SDK_INT + return new File(getContext().getFilesDir(), Build.VERSION.SDK_INT + "_" + LauncherFiles.DEFAULT_WALLPAPER_THUMBNAIL); } private boolean saveDefaultWallpaperThumb(Bitmap b) { // Delete old thumbnails. - new File(getFilesDir(), LauncherFiles.DEFAULT_WALLPAPER_THUMBNAIL_OLD).delete(); - new File(getFilesDir(), LauncherFiles.DEFAULT_WALLPAPER_THUMBNAIL).delete(); + new File(getContext().getFilesDir(), LauncherFiles.DEFAULT_WALLPAPER_THUMBNAIL_OLD).delete(); + new File(getContext().getFilesDir(), LauncherFiles.DEFAULT_WALLPAPER_THUMBNAIL).delete(); for (int i = Build.VERSION_CODES.JELLY_BEAN; i < Build.VERSION.SDK_INT; i++) { - new File(getFilesDir(), i + "_" + LauncherFiles.DEFAULT_WALLPAPER_THUMBNAIL).delete(); + new File(getContext().getFilesDir(), i + "_" + + LauncherFiles.DEFAULT_WALLPAPER_THUMBNAIL).delete(); } return writeImageToFileAsJpeg(getDefaultThumbFile(), b); } @@ -989,7 +994,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { Point defaultThumbSize = getDefaultThumbnailSize(res); int rotation = BitmapUtils.getRotationFromExif(res, resId); thumb = createThumbnail( - defaultThumbSize, this, null, null, sysRes, resId, rotation, false); + defaultThumbSize, getContext(), null, null, sysRes, resId, rotation, false); if (thumb != null) { defaultWallpaperExists = saveDefaultWallpaperThumb(thumb); } @@ -1011,7 +1016,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } else { Resources res = getResources(); Point defaultThumbSize = getDefaultThumbnailSize(res); - Drawable wallpaperDrawable = WallpaperManager.getInstance(this).getBuiltInDrawable( + Drawable wallpaperDrawable = WallpaperManager.getInstance(getContext()).getBuiltInDrawable( defaultThumbSize.x, defaultThumbSize.y, true, 0.5f, 0.5f); if (wallpaperDrawable != null) { thumb = Bitmap.createBitmap( @@ -1038,7 +1043,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { // package name should be. final String packageName = getResources().getResourcePackageName(R.array.wallpapers); try { - ApplicationInfo info = getPackageManager().getApplicationInfo(packageName, 0); + ApplicationInfo info = getContext().getPackageManager().getApplicationInfo(packageName, 0); return new Pair(info, R.array.wallpapers); } catch (PackageManager.NameNotFoundException e) { return null; @@ -1076,9 +1081,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { private static class SimpleWallpapersAdapter extends ArrayAdapter { private final LayoutInflater mLayoutInflater; - SimpleWallpapersAdapter(Activity activity, ArrayList wallpapers) { - super(activity, R.layout.wallpaper_picker_item, wallpapers); - mLayoutInflater = activity.getLayoutInflater(); + SimpleWallpapersAdapter(Context context, ArrayList wallpapers) { + super(context, R.layout.wallpaper_picker_item, wallpapers); + mLayoutInflater = LayoutInflater.from(context); } public View getView(int position, View convertView, ViewGroup parent) { @@ -1111,11 +1116,11 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } public void startActivityForResultSafely(Intent intent, int requestCode) { - Utilities.startActivityForResultSafely(this, intent, requestCode); + Utilities.startActivityForResultSafely(getActivity(), intent, requestCode); } @Override public boolean enableRotation() { - return Utilities.isRotationEnabled(this); + return Utilities.isRotationEnabled(getContext()); } } diff --git a/WallpaperPicker/src/com/android/launcher3/base/BaseActivity.java b/WallpaperPicker/src/com/android/launcher3/base/BaseActivity.java new file mode 100644 index 000000000..f8541188f --- /dev/null +++ b/WallpaperPicker/src/com/android/launcher3/base/BaseActivity.java @@ -0,0 +1,21 @@ +package com.android.launcher3.base; + +import android.app.Activity; +import android.content.Context; + +/** + * A wrapper over {@link Activity} which allows to override some methods. + * The base implementation can change from an Activity to a Fragment (or any other custom + * implementation), Callers should not assume that the base class extends Context, instead use + * either {@link #getContext} or {@link #getActivity} + */ +public class BaseActivity extends Activity { + + public Context getContext() { + return this; + } + + public Activity getActivity() { + return this; + } +} -- cgit v1.2.3 From 7f06ae5c8b5c4d617797813b1bd04ee479e9bcff Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 8 Apr 2015 11:08:27 -0700 Subject: Removing Pools.java as it is present in support lib Change-Id: I0f1346223aa289889dbefedd47bff093e9c2c05d --- .../src/com/android/photos/views/Pools.java | 165 --------------------- .../android/photos/views/TiledImageRenderer.java | 4 +- 2 files changed, 2 insertions(+), 167 deletions(-) delete mode 100644 WallpaperPicker/src/com/android/photos/views/Pools.java (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/photos/views/Pools.java b/WallpaperPicker/src/com/android/photos/views/Pools.java deleted file mode 100644 index c60f2f013..000000000 --- a/WallpaperPicker/src/com/android/photos/views/Pools.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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. - */ - -package com.android.photos.views; - -/** - * Helper class for crating pools of objects. An example use looks like this: - *
- * public class MyPooledClass {
- *
- *     private static final SynchronizedPool sPool =
- *             new SynchronizedPool(10);
- *
- *     public static MyPooledClass obtain() {
- *         MyPooledClass instance = sPool.acquire();
- *         return (instance != null) ? instance : new MyPooledClass();
- *     }
- *
- *     public void recycle() {
- *          // Clear state if needed.
- *          sPool.release(this);
- *     }
- *
- *     . . .
- * }
- * 
- * - * @hide - */ -public final class Pools { - - /** - * Interface for managing a pool of objects. - * - * @param The pooled type. - */ - public static interface Pool { - - /** - * @return An instance from the pool if such, null otherwise. - */ - public T acquire(); - - /** - * Release an instance to the pool. - * - * @param instance The instance to release. - * @return Whether the instance was put in the pool. - * - * @throws IllegalStateException If the instance is already in the pool. - */ - public boolean release(T instance); - } - - private Pools() { - /* do nothing - hiding constructor */ - } - - /** - * Simple (non-synchronized) pool of objects. - * - * @param The pooled type. - */ - public static class SimplePool implements Pool { - private final Object[] mPool; - - private int mPoolSize; - - /** - * Creates a new instance. - * - * @param maxPoolSize The max pool size. - * - * @throws IllegalArgumentException If the max pool size is less than zero. - */ - public SimplePool(int maxPoolSize) { - if (maxPoolSize <= 0) { - throw new IllegalArgumentException("The max pool size must be > 0"); - } - mPool = new Object[maxPoolSize]; - } - - @Override - @SuppressWarnings("unchecked") - public T acquire() { - if (mPoolSize > 0) { - final int lastPooledIndex = mPoolSize - 1; - T instance = (T) mPool[lastPooledIndex]; - mPool[lastPooledIndex] = null; - mPoolSize--; - return instance; - } - return null; - } - - @Override - public boolean release(T instance) { - if (isInPool(instance)) { - throw new IllegalStateException("Already in the pool!"); - } - if (mPoolSize < mPool.length) { - mPool[mPoolSize] = instance; - mPoolSize++; - return true; - } - return false; - } - - private boolean isInPool(T instance) { - for (int i = 0; i < mPoolSize; i++) { - if (mPool[i] == instance) { - return true; - } - } - return false; - } - } - - /** - * Synchronized) pool of objects. - * - * @param The pooled type. - */ - public static class SynchronizedPool extends SimplePool { - private final Object mLock = new Object(); - - /** - * Creates a new instance. - * - * @param maxPoolSize The max pool size. - * - * @throws IllegalArgumentException If the max pool size is less than zero. - */ - public SynchronizedPool(int maxPoolSize) { - super(maxPoolSize); - } - - @Override - public T acquire() { - synchronized (mLock) { - return super.acquire(); - } - } - - @Override - public boolean release(T element) { - synchronized (mLock) { - return super.release(element); - } - } - } -} \ No newline at end of file diff --git a/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java b/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java index 39a73b9d5..e57ce70b9 100644 --- a/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java +++ b/WallpaperPicker/src/com/android/photos/views/TiledImageRenderer.java @@ -20,6 +20,8 @@ import android.content.Context; import android.graphics.Bitmap; import android.graphics.Rect; import android.graphics.RectF; +import android.support.v4.util.Pools.Pool; +import android.support.v4.util.Pools.SynchronizedPool; import android.util.DisplayMetrics; import android.util.Log; import android.util.LongSparseArray; @@ -31,8 +33,6 @@ import com.android.gallery3d.glrenderer.BasicTexture; import com.android.gallery3d.glrenderer.GLCanvas; import com.android.gallery3d.glrenderer.UploadedTexture; import com.android.launcher3.util.Thunk; -import com.android.photos.views.Pools.Pool; -import com.android.photos.views.Pools.SynchronizedPool; /** * Handles laying out, decoding, and drawing of tiles in GL -- cgit v1.2.3 From ba41458f5c696194d547ac8f24e9f8e58cfa64fc Mon Sep 17 00:00:00 2001 From: Neil Fuller Date: Mon, 13 Apr 2015 14:32:47 +0100 Subject: Remove usage of FloatMath Bug: https://code.google.com/p/android/issues/detail?id=36199 Change-Id: I2effc3f498fb13e66de9a905b9a40ac5688a5850 --- WallpaperPicker/src/com/android/launcher3/CropView.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/CropView.java b/WallpaperPicker/src/com/android/launcher3/CropView.java index 578b8eafd..50f779add 100644 --- a/WallpaperPicker/src/com/android/launcher3/CropView.java +++ b/WallpaperPicker/src/com/android/launcher3/CropView.java @@ -21,7 +21,6 @@ import android.graphics.Matrix; import android.graphics.Point; import android.graphics.RectF; import android.util.AttributeSet; -import android.util.FloatMath; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.ScaleGestureDetector.OnScaleGestureListener; @@ -300,12 +299,12 @@ public class CropView extends TiledImageView implements OnScaleGestureListener { adjustment[0] = (edges.right - getWidth()) / scale; } if (edges.top > 0) { - adjustment[1] = FloatMath.ceil(edges.top / scale); + adjustment[1] = (float) Math.ceil(edges.top / scale); } else if (edges.bottom < getHeight()) { adjustment[1] = (edges.bottom - getHeight()) / scale; } for (int dim = 0; dim <= 1; dim++) { - if (coef[dim] > 0) adjustment[dim] = FloatMath.ceil(adjustment[dim]); + if (coef[dim] > 0) adjustment[dim] = (float) Math.ceil(adjustment[dim]); } mInverseRotateMatrix.mapPoints(adjustment); -- cgit v1.2.3 From 65776c43590e506f2ce1906b1421caad95448010 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 15 Apr 2015 13:42:21 -0700 Subject: Disable setWallpaper button until the wallpaper is loaded Bug: 20187333 Change-Id: Id7a42616560e15eddedad5846ef927a3be52ed1c --- .../android/launcher3/WallpaperPickerActivity.java | 71 +++++++++++++--------- 1 file changed, 41 insertions(+), 30 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index c49286a75..93320919e 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -137,39 +137,32 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { public static class UriWallpaperInfo extends WallpaperTileInfo { private Uri mUri; - private boolean mFirstClick = true; - @Thunk BitmapRegionTileSource.UriBitmapSource mBitmapSource; public UriWallpaperInfo(Uri uri) { mUri = uri; } @Override public void onClick(final WallpaperPickerActivity a) { - final Runnable onLoad; - if (!mFirstClick) { - onLoad = null; - } else { - mFirstClick = false; - a.mSetWallpaperButton.setEnabled(false); - onLoad = new Runnable() { - public void run() { - if (mBitmapSource != null && - mBitmapSource.getLoadingState() == BitmapSource.State.LOADED) { - a.selectTile(mView); - a.mSetWallpaperButton.setEnabled(true); - } else { - ViewGroup parent = (ViewGroup) mView.getParent(); - if (parent != null) { - parent.removeView(mView); - Toast.makeText(a.getContext(), R.string.image_load_fail, - Toast.LENGTH_SHORT).show(); - } + a.setWallpaperButtonEnabled(false); + final BitmapRegionTileSource.UriBitmapSource bitmapSource = + new BitmapRegionTileSource.UriBitmapSource( + a.getContext(), mUri, BitmapRegionTileSource.MAX_PREVIEW_SIZE); + a.setCropViewTileSource(bitmapSource, true, false, null, new Runnable() { + + @Override + public void run() { + if (bitmapSource.getLoadingState() == BitmapSource.State.LOADED) { + a.selectTile(mView); + a.setWallpaperButtonEnabled(true); + } else { + ViewGroup parent = (ViewGroup) mView.getParent(); + if (parent != null) { + parent.removeView(mView); + Toast.makeText(a.getContext(), R.string.image_load_fail, + Toast.LENGTH_SHORT).show(); } } - }; - } - mBitmapSource = new BitmapRegionTileSource.UriBitmapSource( - a.getContext(), mUri, BitmapRegionTileSource.MAX_PREVIEW_SIZE); - a.setCropViewTileSource(mBitmapSource, true, false, null, onLoad); + } + }); } @Override public void onSave(final WallpaperPickerActivity a) { @@ -203,11 +196,18 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { mThumb = thumb; } @Override - public void onClick(WallpaperPickerActivity a) { + public void onClick(final WallpaperPickerActivity a) { + a.setWallpaperButtonEnabled(false); BitmapRegionTileSource.UriBitmapSource bitmapSource = new BitmapRegionTileSource.UriBitmapSource(a.getContext(), Uri.fromFile(mFile), 1024); - a.setCropViewTileSource(bitmapSource, false, true, null, null); + a.setCropViewTileSource(bitmapSource, false, true, null, new Runnable() { + + @Override + public void run() { + a.setWallpaperButtonEnabled(true); + } + }); } @Override public void onSave(WallpaperPickerActivity a) { @@ -234,6 +234,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } @Override public void onClick(final WallpaperPickerActivity a) { + a.setWallpaperButtonEnabled(false); BitmapRegionTileSource.ResourceBitmapSource bitmapSource = new BitmapRegionTileSource.ResourceBitmapSource( mResources, mResId, BitmapRegionTileSource.MAX_PREVIEW_SIZE); @@ -248,7 +249,13 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { wallpaperSize.x, wallpaperSize.y, false); return wallpaperSize.x / crop.width(); } - }, null); + }, new Runnable() { + + @Override + public void run() { + a.setWallpaperButtonEnabled(true); + } + }); } @Override public void onSave(WallpaperPickerActivity a) { @@ -420,7 +427,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } return; } - mSetWallpaperButton.setEnabled(true); + setWallpaperButtonEnabled(true); WallpaperTileInfo info = (WallpaperTileInfo) v.getTag(); if (info.isSelectable() && v.getVisibility() == View.VISIBLE) { selectTile(v); @@ -639,6 +646,10 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { }; } + public void setWallpaperButtonEnabled(boolean enabled) { + mSetWallpaperButton.setEnabled(enabled); + } + @Thunk void selectTile(View v) { if (mSelectedTile != null) { mSelectedTile.setSelected(false); -- cgit v1.2.3 From b4b01efa438953b0a9fcb5b83a6a619e24c93ea3 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 15 Apr 2015 23:38:17 +0000 Subject: Revert "Disable setWallpaper button until the wallpaper is loaded" Will submit again after the drop This reverts commit 65776c43590e506f2ce1906b1421caad95448010. Change-Id: I5f85d0c70f3f5faf85d9ba16e82d4714b694a193 --- .../android/launcher3/WallpaperPickerActivity.java | 71 +++++++++------------- 1 file changed, 30 insertions(+), 41 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 93320919e..c49286a75 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -137,32 +137,39 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { public static class UriWallpaperInfo extends WallpaperTileInfo { private Uri mUri; + private boolean mFirstClick = true; + @Thunk BitmapRegionTileSource.UriBitmapSource mBitmapSource; public UriWallpaperInfo(Uri uri) { mUri = uri; } @Override public void onClick(final WallpaperPickerActivity a) { - a.setWallpaperButtonEnabled(false); - final BitmapRegionTileSource.UriBitmapSource bitmapSource = - new BitmapRegionTileSource.UriBitmapSource( - a.getContext(), mUri, BitmapRegionTileSource.MAX_PREVIEW_SIZE); - a.setCropViewTileSource(bitmapSource, true, false, null, new Runnable() { - - @Override - public void run() { - if (bitmapSource.getLoadingState() == BitmapSource.State.LOADED) { - a.selectTile(mView); - a.setWallpaperButtonEnabled(true); - } else { - ViewGroup parent = (ViewGroup) mView.getParent(); - if (parent != null) { - parent.removeView(mView); - Toast.makeText(a.getContext(), R.string.image_load_fail, - Toast.LENGTH_SHORT).show(); + final Runnable onLoad; + if (!mFirstClick) { + onLoad = null; + } else { + mFirstClick = false; + a.mSetWallpaperButton.setEnabled(false); + onLoad = new Runnable() { + public void run() { + if (mBitmapSource != null && + mBitmapSource.getLoadingState() == BitmapSource.State.LOADED) { + a.selectTile(mView); + a.mSetWallpaperButton.setEnabled(true); + } else { + ViewGroup parent = (ViewGroup) mView.getParent(); + if (parent != null) { + parent.removeView(mView); + Toast.makeText(a.getContext(), R.string.image_load_fail, + Toast.LENGTH_SHORT).show(); + } } } - } - }); + }; + } + mBitmapSource = new BitmapRegionTileSource.UriBitmapSource( + a.getContext(), mUri, BitmapRegionTileSource.MAX_PREVIEW_SIZE); + a.setCropViewTileSource(mBitmapSource, true, false, null, onLoad); } @Override public void onSave(final WallpaperPickerActivity a) { @@ -196,18 +203,11 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { mThumb = thumb; } @Override - public void onClick(final WallpaperPickerActivity a) { - a.setWallpaperButtonEnabled(false); + public void onClick(WallpaperPickerActivity a) { BitmapRegionTileSource.UriBitmapSource bitmapSource = new BitmapRegionTileSource.UriBitmapSource(a.getContext(), Uri.fromFile(mFile), 1024); - a.setCropViewTileSource(bitmapSource, false, true, null, new Runnable() { - - @Override - public void run() { - a.setWallpaperButtonEnabled(true); - } - }); + a.setCropViewTileSource(bitmapSource, false, true, null, null); } @Override public void onSave(WallpaperPickerActivity a) { @@ -234,7 +234,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } @Override public void onClick(final WallpaperPickerActivity a) { - a.setWallpaperButtonEnabled(false); BitmapRegionTileSource.ResourceBitmapSource bitmapSource = new BitmapRegionTileSource.ResourceBitmapSource( mResources, mResId, BitmapRegionTileSource.MAX_PREVIEW_SIZE); @@ -249,13 +248,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { wallpaperSize.x, wallpaperSize.y, false); return wallpaperSize.x / crop.width(); } - }, new Runnable() { - - @Override - public void run() { - a.setWallpaperButtonEnabled(true); - } - }); + }, null); } @Override public void onSave(WallpaperPickerActivity a) { @@ -427,7 +420,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } return; } - setWallpaperButtonEnabled(true); + mSetWallpaperButton.setEnabled(true); WallpaperTileInfo info = (WallpaperTileInfo) v.getTag(); if (info.isSelectable() && v.getVisibility() == View.VISIBLE) { selectTile(v); @@ -646,10 +639,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { }; } - public void setWallpaperButtonEnabled(boolean enabled) { - mSetWallpaperButton.setEnabled(enabled); - } - @Thunk void selectTile(View v) { if (mSelectedTile != null) { mSelectedTile.setSelected(false); -- cgit v1.2.3 From 89a6ec2af2857115fb6d5bb65bb9df75432f7972 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 15 Apr 2015 23:40:57 +0000 Subject: Revert "Revert "Disable setWallpaper button until the wallpaper is loaded" Will submit again after the drop" Actual fix This reverts commit b4b01efa438953b0a9fcb5b83a6a619e24c93ea3. Change-Id: I65cc75e0f1a95f69be607bb5b11d7f4627ff25c1 --- .../android/launcher3/WallpaperPickerActivity.java | 71 +++++++++++++--------- 1 file changed, 41 insertions(+), 30 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index c49286a75..93320919e 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -137,39 +137,32 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { public static class UriWallpaperInfo extends WallpaperTileInfo { private Uri mUri; - private boolean mFirstClick = true; - @Thunk BitmapRegionTileSource.UriBitmapSource mBitmapSource; public UriWallpaperInfo(Uri uri) { mUri = uri; } @Override public void onClick(final WallpaperPickerActivity a) { - final Runnable onLoad; - if (!mFirstClick) { - onLoad = null; - } else { - mFirstClick = false; - a.mSetWallpaperButton.setEnabled(false); - onLoad = new Runnable() { - public void run() { - if (mBitmapSource != null && - mBitmapSource.getLoadingState() == BitmapSource.State.LOADED) { - a.selectTile(mView); - a.mSetWallpaperButton.setEnabled(true); - } else { - ViewGroup parent = (ViewGroup) mView.getParent(); - if (parent != null) { - parent.removeView(mView); - Toast.makeText(a.getContext(), R.string.image_load_fail, - Toast.LENGTH_SHORT).show(); - } + a.setWallpaperButtonEnabled(false); + final BitmapRegionTileSource.UriBitmapSource bitmapSource = + new BitmapRegionTileSource.UriBitmapSource( + a.getContext(), mUri, BitmapRegionTileSource.MAX_PREVIEW_SIZE); + a.setCropViewTileSource(bitmapSource, true, false, null, new Runnable() { + + @Override + public void run() { + if (bitmapSource.getLoadingState() == BitmapSource.State.LOADED) { + a.selectTile(mView); + a.setWallpaperButtonEnabled(true); + } else { + ViewGroup parent = (ViewGroup) mView.getParent(); + if (parent != null) { + parent.removeView(mView); + Toast.makeText(a.getContext(), R.string.image_load_fail, + Toast.LENGTH_SHORT).show(); } } - }; - } - mBitmapSource = new BitmapRegionTileSource.UriBitmapSource( - a.getContext(), mUri, BitmapRegionTileSource.MAX_PREVIEW_SIZE); - a.setCropViewTileSource(mBitmapSource, true, false, null, onLoad); + } + }); } @Override public void onSave(final WallpaperPickerActivity a) { @@ -203,11 +196,18 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { mThumb = thumb; } @Override - public void onClick(WallpaperPickerActivity a) { + public void onClick(final WallpaperPickerActivity a) { + a.setWallpaperButtonEnabled(false); BitmapRegionTileSource.UriBitmapSource bitmapSource = new BitmapRegionTileSource.UriBitmapSource(a.getContext(), Uri.fromFile(mFile), 1024); - a.setCropViewTileSource(bitmapSource, false, true, null, null); + a.setCropViewTileSource(bitmapSource, false, true, null, new Runnable() { + + @Override + public void run() { + a.setWallpaperButtonEnabled(true); + } + }); } @Override public void onSave(WallpaperPickerActivity a) { @@ -234,6 +234,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } @Override public void onClick(final WallpaperPickerActivity a) { + a.setWallpaperButtonEnabled(false); BitmapRegionTileSource.ResourceBitmapSource bitmapSource = new BitmapRegionTileSource.ResourceBitmapSource( mResources, mResId, BitmapRegionTileSource.MAX_PREVIEW_SIZE); @@ -248,7 +249,13 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { wallpaperSize.x, wallpaperSize.y, false); return wallpaperSize.x / crop.width(); } - }, null); + }, new Runnable() { + + @Override + public void run() { + a.setWallpaperButtonEnabled(true); + } + }); } @Override public void onSave(WallpaperPickerActivity a) { @@ -420,7 +427,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } return; } - mSetWallpaperButton.setEnabled(true); + setWallpaperButtonEnabled(true); WallpaperTileInfo info = (WallpaperTileInfo) v.getTag(); if (info.isSelectable() && v.getVisibility() == View.VISIBLE) { selectTile(v); @@ -639,6 +646,10 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { }; } + public void setWallpaperButtonEnabled(boolean enabled) { + mSetWallpaperButton.setEnabled(enabled); + } + @Thunk void selectTile(View v) { if (mSelectedTile != null) { mSelectedTile.setSelected(false); -- cgit v1.2.3 From 7066003b2032a49ae5e59dab9b706259bdeb7e6e Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 14 May 2015 00:07:08 -0700 Subject: Various lint error fixes. > Fixing some RTL errors by specifying both marginStart and marginLeft > Moving all layout direction checks to Utilities > Explicitely adding @TargetApi before every method Change-Id: Ibe9c52b93b5a6adeadb27ace2b312770fd732ea0 --- WallpaperPicker/src/com/android/gallery3d/exif/ExifInterface.java | 6 +++--- .../src/com/android/launcher3/WallpaperCropActivity.java | 8 +++++++- .../src/com/android/launcher3/WallpaperPickerActivity.java | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/gallery3d/exif/ExifInterface.java b/WallpaperPicker/src/com/android/gallery3d/exif/ExifInterface.java index a1cf0fc85..9247e879f 100644 --- a/WallpaperPicker/src/com/android/gallery3d/exif/ExifInterface.java +++ b/WallpaperPicker/src/com/android/gallery3d/exif/ExifInterface.java @@ -1247,7 +1247,7 @@ public class ExifInterface { if (l == null || l.length <= 0) { return null; } - return new Long(l[0]); + return Long.valueOf(l[0]); } /** @@ -1266,7 +1266,7 @@ public class ExifInterface { if (l == null || l.length <= 0) { return null; } - return new Integer(l[0]); + return Integer.valueOf(l[0]); } /** @@ -1285,7 +1285,7 @@ public class ExifInterface { if (l == null || l.length <= 0) { return null; } - return new Byte(l[0]); + return Byte.valueOf(l[0]); } /** diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index 142a9cb10..affad0f45 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -190,7 +190,7 @@ public class WallpaperCropActivity extends BaseActivity implements Handler.Callb } }); } catch (SecurityException securityException) { - if (isDestroyed()) { + if (isActivityDestroyed()) { // Temporarily granted permissions are revoked when the activity // finishes, potentially resulting in a SecurityException here. // Even though {@link #isDestroyed} might also return true in different @@ -221,6 +221,12 @@ public class WallpaperCropActivity extends BaseActivity implements Handler.Callb return false; } + @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) + protected boolean isActivityDestroyed() { + return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) + && isDestroyed(); + } + @Thunk void addReusableBitmap(TileSource src) { synchronized (mReusableBitmaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 93320919e..1ba5b4b2e 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -665,7 +665,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } @Thunk void initializeScrollForRtl() { - if (mWallpaperScrollContainer.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { + if (Utilities.isRtl(getResources())) { final ViewTreeObserver observer = mWallpaperScrollContainer.getViewTreeObserver(); observer.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { public void onGlobalLayout() { @@ -838,7 +838,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { int rotation = BitmapUtils.getRotationFromExif(context, uri); return createThumbnail(defaultSize, context, uri, null, null, 0, rotation, false); } catch (SecurityException securityException) { - if (isDestroyed()) { + if (isActivityDestroyed()) { // Temporarily granted permissions are revoked when the activity // finishes, potentially resulting in a SecurityException here. // Even though {@link #isDestroyed} might also return true in different -- cgit v1.2.3 From e49c105de57e53828ea372aff3713d6ebfd66f2e Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 18 May 2015 16:40:56 -0700 Subject: Verify that an image can be rendered on a GL Surface before using it Bug: 20138883 Change-Id: I8de70eb971f31c2a4c07a7903e097a1586402282 --- .../android/launcher3/WallpaperCropActivity.java | 2 +- .../android/launcher3/WallpaperPickerActivity.java | 10 +-- .../com/android/photos/BitmapRegionTileSource.java | 79 +++++++++++----------- 3 files changed, 45 insertions(+), 46 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index affad0f45..ee0d8b0c6 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -131,7 +131,7 @@ public class WallpaperCropActivity extends BaseActivity implements Handler.Callb // Load image in background final BitmapRegionTileSource.UriBitmapSource bitmapSource = - new BitmapRegionTileSource.UriBitmapSource(getContext(), imageUri, 1024); + new BitmapRegionTileSource.UriBitmapSource(getContext(), imageUri); mSetWallpaperButton.setEnabled(false); Runnable onLoad = new Runnable() { public void run() { diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 1ba5b4b2e..72cb194d6 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -21,7 +21,6 @@ import android.annotation.TargetApi; import android.app.ActionBar; import android.app.Activity; import android.app.WallpaperManager; -import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; @@ -144,8 +143,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { public void onClick(final WallpaperPickerActivity a) { a.setWallpaperButtonEnabled(false); final BitmapRegionTileSource.UriBitmapSource bitmapSource = - new BitmapRegionTileSource.UriBitmapSource( - a.getContext(), mUri, BitmapRegionTileSource.MAX_PREVIEW_SIZE); + new BitmapRegionTileSource.UriBitmapSource(a.getContext(), mUri); a.setCropViewTileSource(bitmapSource, true, false, null, new Runnable() { @Override @@ -199,8 +197,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { public void onClick(final WallpaperPickerActivity a) { a.setWallpaperButtonEnabled(false); BitmapRegionTileSource.UriBitmapSource bitmapSource = - new BitmapRegionTileSource.UriBitmapSource(a.getContext(), - Uri.fromFile(mFile), 1024); + new BitmapRegionTileSource.UriBitmapSource(a.getContext(), Uri.fromFile(mFile)); a.setCropViewTileSource(bitmapSource, false, true, null, new Runnable() { @Override @@ -236,8 +233,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { public void onClick(final WallpaperPickerActivity a) { a.setWallpaperButtonEnabled(false); BitmapRegionTileSource.ResourceBitmapSource bitmapSource = - new BitmapRegionTileSource.ResourceBitmapSource( - mResources, mResId, BitmapRegionTileSource.MAX_PREVIEW_SIZE); + new BitmapRegionTileSource.ResourceBitmapSource(mResources, mResId); a.setCropViewTileSource(bitmapSource, false, false, new CropViewScaleProvider() { @Override diff --git a/WallpaperPicker/src/com/android/photos/BitmapRegionTileSource.java b/WallpaperPicker/src/com/android/photos/BitmapRegionTileSource.java index 15f97e5b1..2d496a5a6 100644 --- a/WallpaperPicker/src/com/android/photos/BitmapRegionTileSource.java +++ b/WallpaperPicker/src/com/android/photos/BitmapRegionTileSource.java @@ -26,6 +26,7 @@ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.net.Uri; +import android.opengl.GLUtils; import android.os.Build; import android.util.Log; @@ -149,18 +150,15 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { private static final int GL_SIZE_LIMIT = 2048; // This must be no larger than half the size of the GL_SIZE_LIMIT // due to decodePreview being allowed to be up to 2x the size of the target - public static final int MAX_PREVIEW_SIZE = GL_SIZE_LIMIT / 2; + private static final int MAX_PREVIEW_SIZE = GL_SIZE_LIMIT / 2; public static abstract class BitmapSource { private SimpleBitmapRegionDecoder mDecoder; private Bitmap mPreview; - private final int mPreviewSize; private int mRotation; public enum State { NOT_LOADED, LOADED, ERROR_LOADING }; private State mState = State.NOT_LOADED; - public BitmapSource(int previewSize) { - mPreviewSize = Math.min(previewSize, MAX_PREVIEW_SIZE); - } + public boolean loadInBackground(InBitmapProvider bitmapProvider) { ExifInterface ei = new ExifInterface(); if (readExif(ei)) { @@ -176,36 +174,44 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { } else { int width = mDecoder.getWidth(); int height = mDecoder.getHeight(); - if (mPreviewSize != 0) { - BitmapFactory.Options opts = new BitmapFactory.Options(); - opts.inPreferredConfig = Bitmap.Config.ARGB_8888; - opts.inPreferQualityOverSpeed = true; - - float scale = (float) mPreviewSize / Math.max(width, height); - opts.inSampleSize = BitmapUtils.computeSampleSizeLarger(scale); - opts.inJustDecodeBounds = false; - opts.inMutable = true; - - if (bitmapProvider != null) { - int expectedPixles = (width / opts.inSampleSize) * (height / opts.inSampleSize); - Bitmap reusableBitmap = bitmapProvider.forPixelCount(expectedPixles); - if (reusableBitmap != null) { - // Try loading with reusable bitmap - opts.inBitmap = reusableBitmap; - try { - mPreview = loadPreviewBitmap(opts); - } catch (IllegalArgumentException e) { - Log.d(TAG, "Unable to reusage bitmap", e); - opts.inBitmap = null; - mPreview = null; - } + + BitmapFactory.Options opts = new BitmapFactory.Options(); + opts.inPreferredConfig = Bitmap.Config.ARGB_8888; + opts.inPreferQualityOverSpeed = true; + + float scale = (float) MAX_PREVIEW_SIZE / Math.max(width, height); + opts.inSampleSize = BitmapUtils.computeSampleSizeLarger(scale); + opts.inJustDecodeBounds = false; + opts.inMutable = true; + + if (bitmapProvider != null) { + int expectedPixles = (width / opts.inSampleSize) * (height / opts.inSampleSize); + Bitmap reusableBitmap = bitmapProvider.forPixelCount(expectedPixles); + if (reusableBitmap != null) { + // Try loading with reusable bitmap + opts.inBitmap = reusableBitmap; + try { + mPreview = loadPreviewBitmap(opts); + } catch (IllegalArgumentException e) { + Log.d(TAG, "Unable to reusage bitmap", e); + opts.inBitmap = null; + mPreview = null; } } - if (mPreview == null) { - mPreview = loadPreviewBitmap(opts); - } } - mState = State.LOADED; + if (mPreview == null) { + mPreview = loadPreviewBitmap(opts); + } + + // Verify that the bitmap can be used on GL surface + try { + GLUtils.getInternalFormat(mPreview); + GLUtils.getType(mPreview); + mState = State.LOADED; + } catch (IllegalArgumentException e) { + Log.d(TAG, "Image cannot be rendered on a GL surface", e); + mState = State.ERROR_LOADING; + } return true; } } @@ -237,8 +243,7 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { public static class FilePathBitmapSource extends BitmapSource { private String mPath; - public FilePathBitmapSource(String path, int previewSize) { - super(previewSize); + public FilePathBitmapSource(String path) { mPath = path; } @Override @@ -272,8 +277,7 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { public static class UriBitmapSource extends BitmapSource { private Context mContext; private Uri mUri; - public UriBitmapSource(Context context, Uri uri, int previewSize) { - super(previewSize); + public UriBitmapSource(Context context, Uri uri) { mContext = context; mUri = uri; } @@ -337,8 +341,7 @@ public class BitmapRegionTileSource implements TiledImageRenderer.TileSource { public static class ResourceBitmapSource extends BitmapSource { private Resources mRes; private int mResId; - public ResourceBitmapSource(Resources res, int resId, int previewSize) { - super(previewSize); + public ResourceBitmapSource(Resources res, int resId) { mRes = res; mResId = resId; } -- cgit v1.2.3 From 8abbd29ca320fe88d0043a51bc4a4f5914480b00 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Thu, 21 May 2015 15:54:58 -0700 Subject: Enabling setWallpaper button only if the image was loaded successfully Bug: 20187333 Change-Id: I1b738a06499d20facbc4bccb1e6247086a45b686 --- .../src/com/android/launcher3/WallpaperCropActivity.java | 1 + .../src/com/android/launcher3/WallpaperPickerActivity.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java index ee0d8b0c6..f2bb50944 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java @@ -263,6 +263,7 @@ public class WallpaperCropActivity extends BaseActivity implements Handler.Callb if (req.postExecute != null) { req.postExecute.run(); } + mProgressView.setVisibility(View.GONE); } public final void setCropViewTileSource(BitmapSource bitmapSource, boolean touchEnabled, diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 72cb194d6..3f90203ed 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -196,13 +196,15 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public void onClick(final WallpaperPickerActivity a) { a.setWallpaperButtonEnabled(false); - BitmapRegionTileSource.UriBitmapSource bitmapSource = + final BitmapRegionTileSource.UriBitmapSource bitmapSource = new BitmapRegionTileSource.UriBitmapSource(a.getContext(), Uri.fromFile(mFile)); a.setCropViewTileSource(bitmapSource, false, true, null, new Runnable() { @Override public void run() { - a.setWallpaperButtonEnabled(true); + if (bitmapSource.getLoadingState() == BitmapSource.State.LOADED) { + a.setWallpaperButtonEnabled(true); + } } }); } @@ -232,7 +234,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public void onClick(final WallpaperPickerActivity a) { a.setWallpaperButtonEnabled(false); - BitmapRegionTileSource.ResourceBitmapSource bitmapSource = + final BitmapRegionTileSource.ResourceBitmapSource bitmapSource = new BitmapRegionTileSource.ResourceBitmapSource(mResources, mResId); a.setCropViewTileSource(bitmapSource, false, false, new CropViewScaleProvider() { @@ -249,7 +251,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public void run() { - a.setWallpaperButtonEnabled(true); + if (bitmapSource.getLoadingState() == BitmapSource.State.LOADED) { + a.setWallpaperButtonEnabled(true); + } } }); } -- cgit v1.2.3 From 7fc77cad3d06bd3647e550f7419e89116471240a Mon Sep 17 00:00:00 2001 From: Rahul Chaturvedi Date: Tue, 19 May 2015 18:02:16 -0700 Subject: Add the Allow Rotation setting to Launcher3. This CL adds a Settings activity along with the code needed to provide a "Allow Rotation" setting to all phones and tablets. This setting is set to false for phones and true for tablets. On changing the setting from unlocked to locked, the launcher (and the Settings activity) will get locked to the orientation the user was in when he disabled "Allow Rotation". This is consistent with how the natural rotation feature of Android works. Change-Id: I8a1c59d1fa0bb9262530cad96e0a9bdbab0d9344 --- .../src/com/android/launcher3/WallpaperPickerActivity.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 3f90203ed..659c3062b 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -1132,6 +1132,11 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { @Override public boolean enableRotation() { - return Utilities.isRotationEnabled(getContext()); + // Check if rotation is enabled for this device. + if (Utilities.isRotationAllowedForDevice(getContext())) + return true; + + // Check if the user has specifically enabled rotation via preferences. + return Utilities.isAllowRotationPrefEnabled(getApplicationContext()); } } -- cgit v1.2.3 From ef044dd380ac3abf354027750efdc16d5d48ac70 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Tue, 2 Jun 2015 15:35:07 -0700 Subject: Stylus support: creating and setting listeners for stylus button press This updates almost(*) all locations that use a long press listener to also set a custom touch listener that recognizes the stylus button press action. The stylus button press action is: when a stylus touches a view while the primary stylus button is pressed which may occur on a DOWN or MOVE event. *The location this is *not* enabled for is: Longpress to enter "overview" mode -- this isn't really a selection or drag n drop action; it is also easy to accidentally do this while using the stylus gesture to drag n drop items which is not an ideal interaction. Also not set for the "cling" that demonstrates this. Bug: 20430722 Change-Id: I9343f143261a7b4fada9afca28b8a11a60dbecca --- .../src/com/android/launcher3/WallpaperPickerActivity.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 3f90203ed..96238717e 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -49,6 +49,7 @@ import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; +import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLayoutChangeListener; @@ -891,6 +892,15 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { private void addLongPressHandler(View v) { v.setOnLongClickListener(mLongClickListener); + + // Enable stylus button to also trigger long click. + final StylusEventHelper stylusEventHelper = new StylusEventHelper(v); + v.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View view, MotionEvent event) { + return stylusEventHelper.checkAndPerformStylusEvent(event); + } + }); } private ArrayList findBundledWallpapers() { -- cgit v1.2.3 From c1f174a244367a756a0661b50ebd2557477c680b Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 5 Jun 2015 13:41:23 -0700 Subject: Fixing touch feedback clipped on SetWallpaper button Bug: 19534312 Change-Id: I97dfd92c560caaf83e525f7e94286a7a77d2ba0b --- WallpaperPicker/res/values-v21/styles.xml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 WallpaperPicker/res/values-v21/styles.xml (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/res/values-v21/styles.xml b/WallpaperPicker/res/values-v21/styles.xml new file mode 100644 index 000000000..04f39de73 --- /dev/null +++ b/WallpaperPicker/res/values-v21/styles.xml @@ -0,0 +1,31 @@ + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From e863fed1400d00fab11a61c5b4b989d86ca55386 Mon Sep 17 00:00:00 2001 From: Rahul Chaturvedi Date: Mon, 15 Jun 2015 14:09:42 -0400 Subject: Read rotation setting correctly from the wallpaper picker. If reading the rotation setting without the multi-process flag, the WallpaperPickerActivity usually picks up a cached value. Specifying the multi-process flag during the read fixes this and the wallpaper picker always has the correct rotation setting. Change-Id: Ic3639f8cd694674e92c8940b753c6bc30486076d --- WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index 94159416a..d9bfc30eb 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -1147,6 +1147,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { return true; // Check if the user has specifically enabled rotation via preferences. - return Utilities.isAllowRotationPrefEnabled(getApplicationContext()); + return Utilities.isAllowRotationPrefEnabled(getApplicationContext(), true); } } -- cgit v1.2.3 From 170ca1ccd81a1a73bec94fa468a8b54d7d25717b Mon Sep 17 00:00:00 2001 From: Geoff Mendal Date: Wed, 17 Jun 2015 20:18:23 -0700 Subject: Import translations. DO NOT MERGE Change-Id: I8c0c8c4e5f5e09c5852d31429c8f668d4229cc37 Auto-generated-cl: translation import --- WallpaperPicker/res/values-en-rAU/strings.xml | 36 +++++++++++++++++++++++++++ WallpaperPicker/res/values-fr/strings.xml | 2 +- WallpaperPicker/res/values-hr/strings.xml | 2 +- WallpaperPicker/res/values-kk-rKZ/strings.xml | 2 +- WallpaperPicker/res/values-uz-rUZ/strings.xml | 6 ++--- 5 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 WallpaperPicker/res/values-en-rAU/strings.xml (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/res/values-en-rAU/strings.xml b/WallpaperPicker/res/values-en-rAU/strings.xml new file mode 100644 index 000000000..c057c0cb3 --- /dev/null +++ b/WallpaperPicker/res/values-en-rAU/strings.xml @@ -0,0 +1,36 @@ + + + + + "Set wallpaper" + "Couldn\'t load image" + "Couldn\'t load image as wallpaper" + + "%1$d selected" + "%1$d selected" + "%1$d selected" + + "Wallpaper %1$d of %2$d" + "Selected %1$s" + "Delete" + "Pick image" + "Wallpapers" + "Crop wallpaper" + diff --git a/WallpaperPicker/res/values-fr/strings.xml b/WallpaperPicker/res/values-fr/strings.xml index ea07db1e5..37846e0f5 100644 --- a/WallpaperPicker/res/values-fr/strings.xml +++ b/WallpaperPicker/res/values-fr/strings.xml @@ -32,5 +32,5 @@ "Supprimer" "Sélectionner une image" "Fonds d\'écran" - "Rogner le fond d\'écran" + "Recadrer le fond d\'écran"
diff --git a/WallpaperPicker/res/values-hr/strings.xml b/WallpaperPicker/res/values-hr/strings.xml index ff2eed2cc..5e8322f9b 100644 --- a/WallpaperPicker/res/values-hr/strings.xml +++ b/WallpaperPicker/res/values-hr/strings.xml @@ -19,7 +19,7 @@ - "Postavi pozadinsku sliku" + "Postavi pozadinu" "Nije moguće učitati sliku" "Nije moguće učitati sliku kao pozadinsku sliku" diff --git a/WallpaperPicker/res/values-kk-rKZ/strings.xml b/WallpaperPicker/res/values-kk-rKZ/strings.xml index b75562ec9..dcf372cf5 100644 --- a/WallpaperPicker/res/values-kk-rKZ/strings.xml +++ b/WallpaperPicker/res/values-kk-rKZ/strings.xml @@ -19,7 +19,7 @@ - "Артқы фонды орнату" + "Тұсқағаз орнату" "Суретті жүктей алмады" "Суретті артқы фон ретінде жүктей алмады" diff --git a/WallpaperPicker/res/values-uz-rUZ/strings.xml b/WallpaperPicker/res/values-uz-rUZ/strings.xml index 73d7a0d1e..751f457e7 100644 --- a/WallpaperPicker/res/values-uz-rUZ/strings.xml +++ b/WallpaperPicker/res/values-uz-rUZ/strings.xml @@ -24,13 +24,13 @@ "Fon rasmi sifatida rasm yuklanmadi" "%1$d ta tanlandi" - "%1$d tanlandi" + "%1$d ta tanlandi" "%1$d ta tanlandi" "Fon rasmi %2$ddan %1$d" "%1$s tanlandi" "O‘chirish" - "Rasmni tanlang" - "Fon rasmlari" + "Rasm tanlang" + "Orqa fon rasmlari" "Fon rasmini kesish" -- cgit v1.2.3 From 5d9200f92141f157fe6ae30106ee4b644d5ebd7e Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Tue, 23 Jun 2015 14:28:29 -0700 Subject: Using a full-bleed background for Set-Wallpaper button Bug: 22007160 Change-Id: I06c4ffe5b5fa4f2c18c06a6e1bf014b328de00fd --- WallpaperPicker/res/values-v21/styles.xml | 5 +++++ WallpaperPicker/res/values/styles.xml | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/res/values-v21/styles.xml b/WallpaperPicker/res/values-v21/styles.xml index 04f39de73..582ab8fed 100644 --- a/WallpaperPicker/res/values-v21/styles.xml +++ b/WallpaperPicker/res/values-v21/styles.xml @@ -28,4 +28,9 @@ 0dp + + \ No newline at end of file diff --git a/WallpaperPicker/res/values/styles.xml b/WallpaperPicker/res/values/styles.xml index f4008f159..74aeab903 100644 --- a/WallpaperPicker/res/values/styles.xml +++ b/WallpaperPicker/res/values/styles.xml @@ -17,7 +17,7 @@ */ --> - + -- cgit v1.2.3 From b15d43837c5c3a0c52bb5112c23738eeaee1dc1e Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Tue, 23 Jun 2015 16:56:59 -0700 Subject: Avoid crashing if we don't have the READ_EXTERNAL_STORAGE permission issue 22019397 Change-Id: I7d556494569afaeac0ecdd641a089b78663b5563 --- .../src/com/android/launcher3/WallpaperPickerActivity.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java index d9bfc30eb..88dc3e22b 100644 --- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java +++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java @@ -16,6 +16,7 @@ package com.android.launcher3; +import android.Manifest.permission; import android.animation.LayoutTransition; import android.annotation.TargetApi; import android.app.ActionBar; @@ -37,10 +38,12 @@ import android.graphics.PorterDuff; import android.graphics.RectF; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.Manifest; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; +import android.os.Process; import android.provider.MediaStore; import android.util.Log; import android.util.Pair; @@ -680,6 +683,16 @@ public class WallpaperPickerActivity extends WallpaperCropActivity { } protected Bitmap getThumbnailOfLastPhoto() { + boolean canReadExternalStorage = getActivity().checkPermission( + Manifest.permission.READ_EXTERNAL_STORAGE, Process.myPid(), Process.myUid()) == + PackageManager.PERMISSION_GRANTED; + + if (!canReadExternalStorage) { + // MediaStore.Images.Media.EXTERNAL_CONTENT_URI requires + // the READ_EXTERNAL_STORAGE permission + return null; + } + Cursor cursor = MediaStore.Images.Media.query(getContext().getContentResolver(), MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[] { MediaStore.Images.ImageColumns._ID, -- cgit v1.2.3 From 320a27b539b7d4ff5b4f1329644d20e550eb55dd Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 26 Jun 2015 14:10:44 -0700 Subject: Removing junit.framework.Assert from wallpaper picker code Bug: 22124692 Change-Id: Ifd41727a2ce4af660818b4f0cd6b95110ffdeec4 --- .../src/com/android/gallery3d/glrenderer/BitmapTexture.java | 4 ++-- WallpaperPicker/src/com/android/gallery3d/glrenderer/GLPaint.java | 4 ++-- .../src/com/android/gallery3d/glrenderer/UploadedTexture.java | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/src/com/android/gallery3d/glrenderer/BitmapTexture.java b/WallpaperPicker/src/com/android/gallery3d/glrenderer/BitmapTexture.java index 100b0b3b9..f8b01cb42 100644 --- a/WallpaperPicker/src/com/android/gallery3d/glrenderer/BitmapTexture.java +++ b/WallpaperPicker/src/com/android/gallery3d/glrenderer/BitmapTexture.java @@ -18,7 +18,7 @@ package com.android.gallery3d.glrenderer; import android.graphics.Bitmap; -import junit.framework.Assert; +import com.android.gallery3d.common.Utils; // BitmapTexture is a texture whose content is specified by a fixed Bitmap. // @@ -34,7 +34,7 @@ public class BitmapTexture extends UploadedTexture { public BitmapTexture(Bitmap bitmap, boolean hasBorder) { super(hasBorder); - Assert.assertTrue(bitmap != null && !bitmap.isRecycled()); + Utils.assertTrue(bitmap != null && !bitmap.isRecycled()); mContentBitmap = bitmap; } diff --git a/WallpaperPicker/src/com/android/gallery3d/glrenderer/GLPaint.java b/WallpaperPicker/src/com/android/gallery3d/glrenderer/GLPaint.java index 16b220690..b26e9ab29 100644 --- a/WallpaperPicker/src/com/android/gallery3d/glrenderer/GLPaint.java +++ b/WallpaperPicker/src/com/android/gallery3d/glrenderer/GLPaint.java @@ -16,7 +16,7 @@ package com.android.gallery3d.glrenderer; -import junit.framework.Assert; +import com.android.gallery3d.common.Utils; public class GLPaint { private float mLineWidth = 1f; @@ -31,7 +31,7 @@ public class GLPaint { } public void setLineWidth(float width) { - Assert.assertTrue(width >= 0); + Utils.assertTrue(width >= 0); mLineWidth = width; } diff --git a/WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java b/WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java index 67abf6564..8075bf868 100644 --- a/WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java +++ b/WallpaperPicker/src/com/android/gallery3d/glrenderer/UploadedTexture.java @@ -20,10 +20,9 @@ import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.opengl.GLUtils; +import com.android.gallery3d.common.Utils; import com.android.launcher3.util.Thunk; -import junit.framework.Assert; - import java.util.HashMap; import javax.microedition.khronos.opengles.GL11; @@ -146,7 +145,7 @@ public abstract class UploadedTexture extends BasicTexture { } private void freeBitmap() { - Assert.assertTrue(mBitmap != null); + Utils.assertTrue(mBitmap != null); onFreeBitmap(mBitmap); mBitmap = null; } @@ -221,7 +220,7 @@ public abstract class UploadedTexture extends BasicTexture { int texWidth = getTextureWidth(); int texHeight = getTextureHeight(); - Assert.assertTrue(bWidth <= texWidth && bHeight <= texHeight); + Utils.assertTrue(bWidth <= texWidth && bHeight <= texHeight); // Upload the bitmap to a new texture. mId = canvas.getGLId().generateTexture(); -- cgit v1.2.3 From cc31d463279016d0ce1f15886a8cf2aee7d4c54b Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 1 Jul 2015 13:46:37 -0700 Subject: Updating the pick-image tile in wallpaper picker > Changing the label to My photos > Changing the icon to photo-library icon Bug: 22019397 Change-Id: I068d8d5fa11392642bb0a84cb466d8f679e49b54 --- WallpaperPicker/res/drawable-hdpi/ic_images.png | Bin 1935 -> 354 bytes WallpaperPicker/res/drawable-mdpi/ic_images.png | Bin 1332 -> 249 bytes WallpaperPicker/res/drawable-xhdpi/ic_images.png | Bin 2480 -> 431 bytes WallpaperPicker/res/drawable-xxhdpi/ic_images.png | Bin 2097 -> 621 bytes WallpaperPicker/res/drawable-xxxhdpi/ic_images.png | Bin 0 -> 845 bytes WallpaperPicker/res/values/strings.xml | 2 +- 6 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 WallpaperPicker/res/drawable-xxxhdpi/ic_images.png (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/res/drawable-hdpi/ic_images.png b/WallpaperPicker/res/drawable-hdpi/ic_images.png index 0003c6c65..15e511c89 100644 Binary files a/WallpaperPicker/res/drawable-hdpi/ic_images.png and b/WallpaperPicker/res/drawable-hdpi/ic_images.png differ diff --git a/WallpaperPicker/res/drawable-mdpi/ic_images.png b/WallpaperPicker/res/drawable-mdpi/ic_images.png index aabc1237a..c4a2229e9 100644 Binary files a/WallpaperPicker/res/drawable-mdpi/ic_images.png and b/WallpaperPicker/res/drawable-mdpi/ic_images.png differ diff --git a/WallpaperPicker/res/drawable-xhdpi/ic_images.png b/WallpaperPicker/res/drawable-xhdpi/ic_images.png index 3f21faf8f..497479291 100644 Binary files a/WallpaperPicker/res/drawable-xhdpi/ic_images.png and b/WallpaperPicker/res/drawable-xhdpi/ic_images.png differ diff --git a/WallpaperPicker/res/drawable-xxhdpi/ic_images.png b/WallpaperPicker/res/drawable-xxhdpi/ic_images.png index d00db9a00..c8b9f757a 100644 Binary files a/WallpaperPicker/res/drawable-xxhdpi/ic_images.png and b/WallpaperPicker/res/drawable-xxhdpi/ic_images.png differ diff --git a/WallpaperPicker/res/drawable-xxxhdpi/ic_images.png b/WallpaperPicker/res/drawable-xxxhdpi/ic_images.png new file mode 100644 index 000000000..a19002e47 Binary files /dev/null and b/WallpaperPicker/res/drawable-xxxhdpi/ic_images.png differ diff --git a/WallpaperPicker/res/values/strings.xml b/WallpaperPicker/res/values/strings.xml index 1ee3513f9..72b1e15df 100644 --- a/WallpaperPicker/res/values/strings.xml +++ b/WallpaperPicker/res/values/strings.xml @@ -45,7 +45,7 @@ Delete - Pick image + My photos Wallpapers -- cgit v1.2.3 From 2598d3ce5b7571e3e781a77da7bee8f7f224f294 Mon Sep 17 00:00:00 2001 From: Geoff Mendal Date: Mon, 6 Jul 2015 05:25:09 -0700 Subject: Import translations. DO NOT MERGE Change-Id: I7e48169b1393f02ef4a152b8052f5243f3363f3a Auto-generated-cl: translation import --- WallpaperPicker/res/values-af/strings.xml | 2 +- WallpaperPicker/res/values-am/strings.xml | 2 +- WallpaperPicker/res/values-ar/strings.xml | 2 +- WallpaperPicker/res/values-bg/strings.xml | 2 +- WallpaperPicker/res/values-bn-rBD/strings.xml | 2 +- WallpaperPicker/res/values-ca/strings.xml | 2 +- WallpaperPicker/res/values-cs/strings.xml | 2 +- WallpaperPicker/res/values-da/strings.xml | 2 +- WallpaperPicker/res/values-de/strings.xml | 2 +- WallpaperPicker/res/values-el/strings.xml | 2 +- WallpaperPicker/res/values-en-rAU/strings.xml | 2 +- WallpaperPicker/res/values-en-rGB/strings.xml | 2 +- WallpaperPicker/res/values-en-rIN/strings.xml | 2 +- WallpaperPicker/res/values-es-rUS/strings.xml | 2 +- WallpaperPicker/res/values-es/strings.xml | 2 +- WallpaperPicker/res/values-et-rEE/strings.xml | 2 +- WallpaperPicker/res/values-eu-rES/strings.xml | 2 +- WallpaperPicker/res/values-fa/strings.xml | 2 +- WallpaperPicker/res/values-fi/strings.xml | 2 +- WallpaperPicker/res/values-fr-rCA/strings.xml | 2 +- WallpaperPicker/res/values-fr/strings.xml | 2 +- WallpaperPicker/res/values-gl-rES/strings.xml | 2 +- WallpaperPicker/res/values-hi/strings.xml | 2 +- WallpaperPicker/res/values-hr/strings.xml | 2 +- WallpaperPicker/res/values-hu/strings.xml | 2 +- WallpaperPicker/res/values-hy-rAM/strings.xml | 2 +- WallpaperPicker/res/values-in/strings.xml | 2 +- WallpaperPicker/res/values-is-rIS/strings.xml | 2 +- WallpaperPicker/res/values-it/strings.xml | 2 +- WallpaperPicker/res/values-iw/strings.xml | 2 +- WallpaperPicker/res/values-ja/strings.xml | 2 +- WallpaperPicker/res/values-ka-rGE/strings.xml | 2 +- WallpaperPicker/res/values-kk-rKZ/strings.xml | 2 +- WallpaperPicker/res/values-km-rKH/strings.xml | 2 +- WallpaperPicker/res/values-kn-rIN/strings.xml | 2 +- WallpaperPicker/res/values-ko/strings.xml | 2 +- WallpaperPicker/res/values-ky-rKG/strings.xml | 2 +- WallpaperPicker/res/values-lo-rLA/strings.xml | 2 +- WallpaperPicker/res/values-lt/strings.xml | 2 +- WallpaperPicker/res/values-lv/strings.xml | 2 +- WallpaperPicker/res/values-mk-rMK/strings.xml | 2 +- WallpaperPicker/res/values-ml-rIN/strings.xml | 2 +- WallpaperPicker/res/values-mn-rMN/strings.xml | 2 +- WallpaperPicker/res/values-mr-rIN/strings.xml | 2 +- WallpaperPicker/res/values-ms-rMY/strings.xml | 2 +- WallpaperPicker/res/values-my-rMM/strings.xml | 2 +- WallpaperPicker/res/values-nb/strings.xml | 2 +- WallpaperPicker/res/values-ne-rNP/strings.xml | 2 +- WallpaperPicker/res/values-nl/strings.xml | 2 +- WallpaperPicker/res/values-pl/strings.xml | 2 +- WallpaperPicker/res/values-pt-rPT/strings.xml | 2 +- WallpaperPicker/res/values-pt/strings.xml | 2 +- WallpaperPicker/res/values-ro/strings.xml | 2 +- WallpaperPicker/res/values-ru/strings.xml | 2 +- WallpaperPicker/res/values-si-rLK/strings.xml | 2 +- WallpaperPicker/res/values-sk/strings.xml | 2 +- WallpaperPicker/res/values-sl/strings.xml | 2 +- WallpaperPicker/res/values-sr/strings.xml | 2 +- WallpaperPicker/res/values-sv/strings.xml | 2 +- WallpaperPicker/res/values-sw/strings.xml | 2 +- WallpaperPicker/res/values-ta-rIN/strings.xml | 2 +- WallpaperPicker/res/values-te-rIN/strings.xml | 2 +- WallpaperPicker/res/values-th/strings.xml | 2 +- WallpaperPicker/res/values-tl/strings.xml | 2 +- WallpaperPicker/res/values-tr/strings.xml | 2 +- WallpaperPicker/res/values-uk/strings.xml | 2 +- WallpaperPicker/res/values-ur-rPK/strings.xml | 2 +- WallpaperPicker/res/values-uz-rUZ/strings.xml | 4 ++-- WallpaperPicker/res/values-vi/strings.xml | 2 +- WallpaperPicker/res/values-zh-rCN/strings.xml | 2 +- WallpaperPicker/res/values-zh-rHK/strings.xml | 2 +- WallpaperPicker/res/values-zh-rTW/strings.xml | 2 +- WallpaperPicker/res/values-zu/strings.xml | 2 +- 73 files changed, 74 insertions(+), 74 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/res/values-af/strings.xml b/WallpaperPicker/res/values-af/strings.xml index c17d26be0..eb816402a 100644 --- a/WallpaperPicker/res/values-af/strings.xml +++ b/WallpaperPicker/res/values-af/strings.xml @@ -30,7 +30,7 @@ "Muurpapier %1$d van %2$d" "Het %1$s gekies" "Vee uit" - "Kies prent" + "My foto\'s" "Muurpapiere" "Snoei muurpapier" diff --git a/WallpaperPicker/res/values-am/strings.xml b/WallpaperPicker/res/values-am/strings.xml index 59c3bf733..7e793856e 100644 --- a/WallpaperPicker/res/values-am/strings.xml +++ b/WallpaperPicker/res/values-am/strings.xml @@ -30,7 +30,7 @@ "ልጣፍ %1$d የ%2$d" "%1$s ተመርጧል" "ሰርዝ" - "ምስል ይምረጡ" + "የእኔ ፎቶዎች" "የግድግዳ ወረቀቶች" "ልጣፍ ይከርክሙ"
diff --git a/WallpaperPicker/res/values-ar/strings.xml b/WallpaperPicker/res/values-ar/strings.xml index 2075cc875..84fa104db 100644 --- a/WallpaperPicker/res/values-ar/strings.xml +++ b/WallpaperPicker/res/values-ar/strings.xml @@ -30,7 +30,7 @@ "‏الخلفية %1$d من %2$d" "تم تحديد %1$s" "حذف" - "اختيار صورة" + "صوري" "الخلفيات" "اقتصاص الخلفية" diff --git a/WallpaperPicker/res/values-bg/strings.xml b/WallpaperPicker/res/values-bg/strings.xml index ce4fc651b..60ae3022f 100644 --- a/WallpaperPicker/res/values-bg/strings.xml +++ b/WallpaperPicker/res/values-bg/strings.xml @@ -30,7 +30,7 @@ "Тапет %1$d от %2$d" "Избрахте %1$s" "Изтриване" - "Избиране на изображение" + "Моите снимки" "Тапети" "Подрязване на тапета" diff --git a/WallpaperPicker/res/values-bn-rBD/strings.xml b/WallpaperPicker/res/values-bn-rBD/strings.xml index a4fccb208..74d7e57bd 100644 --- a/WallpaperPicker/res/values-bn-rBD/strings.xml +++ b/WallpaperPicker/res/values-bn-rBD/strings.xml @@ -30,7 +30,7 @@ "%2$dটির মধ্যে %1$dটি ওয়ালপেপার" "%1$s নির্বাচন করা হয়েছে" "মুছুন" - "চিত্র বাছুন" + "আমার ফটো" "ওয়ালপেপারগুলি" "ওয়ালপেপার কাটছাঁট করুন" diff --git a/WallpaperPicker/res/values-ca/strings.xml b/WallpaperPicker/res/values-ca/strings.xml index 89de81c30..cbec76250 100644 --- a/WallpaperPicker/res/values-ca/strings.xml +++ b/WallpaperPicker/res/values-ca/strings.xml @@ -30,7 +30,7 @@ "Fons de pantalla %1$d de %2$d" "S\'ha seleccionat %1$s." "Suprimeix" - "Tria una imatge" + "Les meves fotos" "Fons de pantalla" "Retallar fons de pantalla" diff --git a/WallpaperPicker/res/values-cs/strings.xml b/WallpaperPicker/res/values-cs/strings.xml index a07b9eda2..da0758e0a 100644 --- a/WallpaperPicker/res/values-cs/strings.xml +++ b/WallpaperPicker/res/values-cs/strings.xml @@ -30,7 +30,7 @@ "Tapeta %1$d z %2$d" "Vybrána položka %1$s" "Smazat" - "Vybrat obrázek" + "Moje fotografie" "Tapety" "Oříznutí tapety" diff --git a/WallpaperPicker/res/values-da/strings.xml b/WallpaperPicker/res/values-da/strings.xml index 5b233e1d0..12c0fe87e 100644 --- a/WallpaperPicker/res/values-da/strings.xml +++ b/WallpaperPicker/res/values-da/strings.xml @@ -30,7 +30,7 @@ "Baggrund %1$d af %2$d" "%1$s blev valgt" "Slet" - "Vælg et billede" + "Mine billeder" "Baggrunde" "Beskær baggrunden" diff --git a/WallpaperPicker/res/values-de/strings.xml b/WallpaperPicker/res/values-de/strings.xml index 11c1cac6a..3171b3f3a 100644 --- a/WallpaperPicker/res/values-de/strings.xml +++ b/WallpaperPicker/res/values-de/strings.xml @@ -30,7 +30,7 @@ "Hintergrund %1$d von %2$d" "%1$s ausgewählt" "Löschen" - "Bild auswählen" + "Meine Fotos" "Hintergründe" "Hintergrund zuschneiden" diff --git a/WallpaperPicker/res/values-el/strings.xml b/WallpaperPicker/res/values-el/strings.xml index 8e1e78fb9..2988beced 100644 --- a/WallpaperPicker/res/values-el/strings.xml +++ b/WallpaperPicker/res/values-el/strings.xml @@ -30,7 +30,7 @@ "Ταπετσαρία %1$d από %2$d" "Επιλέχθηκε το %1$s" "Διαγραφή" - "Επιλογή εικόνας" + "Οι φωτογραφίες μου" "Ταπετσαρίες" "Περικοπή ταπετσαρίας" diff --git a/WallpaperPicker/res/values-en-rAU/strings.xml b/WallpaperPicker/res/values-en-rAU/strings.xml index c057c0cb3..30450ee81 100644 --- a/WallpaperPicker/res/values-en-rAU/strings.xml +++ b/WallpaperPicker/res/values-en-rAU/strings.xml @@ -30,7 +30,7 @@ "Wallpaper %1$d of %2$d" "Selected %1$s" "Delete" - "Pick image" + "My photos" "Wallpapers" "Crop wallpaper" diff --git a/WallpaperPicker/res/values-en-rGB/strings.xml b/WallpaperPicker/res/values-en-rGB/strings.xml index c057c0cb3..30450ee81 100644 --- a/WallpaperPicker/res/values-en-rGB/strings.xml +++ b/WallpaperPicker/res/values-en-rGB/strings.xml @@ -30,7 +30,7 @@ "Wallpaper %1$d of %2$d" "Selected %1$s" "Delete" - "Pick image" + "My photos" "Wallpapers" "Crop wallpaper" diff --git a/WallpaperPicker/res/values-en-rIN/strings.xml b/WallpaperPicker/res/values-en-rIN/strings.xml index c057c0cb3..30450ee81 100644 --- a/WallpaperPicker/res/values-en-rIN/strings.xml +++ b/WallpaperPicker/res/values-en-rIN/strings.xml @@ -30,7 +30,7 @@ "Wallpaper %1$d of %2$d" "Selected %1$s" "Delete" - "Pick image" + "My photos" "Wallpapers" "Crop wallpaper" diff --git a/WallpaperPicker/res/values-es-rUS/strings.xml b/WallpaperPicker/res/values-es-rUS/strings.xml index 768385b9e..c18ecb233 100644 --- a/WallpaperPicker/res/values-es-rUS/strings.xml +++ b/WallpaperPicker/res/values-es-rUS/strings.xml @@ -30,7 +30,7 @@ "Fondo de pantalla %1$d de %2$d" "%1$s seleccionado" "Eliminar" - "Elegir imagen" + "Mis fotos" "Fondos de pantalla" "Recortar fondo de pantalla" diff --git a/WallpaperPicker/res/values-es/strings.xml b/WallpaperPicker/res/values-es/strings.xml index 702b6d413..b7221af2a 100644 --- a/WallpaperPicker/res/values-es/strings.xml +++ b/WallpaperPicker/res/values-es/strings.xml @@ -30,7 +30,7 @@ "Fondo de pantalla %1$d de %2$d" "%1$s seleccionado" "Eliminar" - "Seleccionar imagen" + "Mis fotos" "Fondos de pantalla" "Recortar fondo de pantalla" diff --git a/WallpaperPicker/res/values-et-rEE/strings.xml b/WallpaperPicker/res/values-et-rEE/strings.xml index c09e223d9..571a0ffbd 100644 --- a/WallpaperPicker/res/values-et-rEE/strings.xml +++ b/WallpaperPicker/res/values-et-rEE/strings.xml @@ -30,7 +30,7 @@ "%1$d/%2$d taustapildist" "Valitud on %1$s" "Kustuta" - "Vali kujutis" + "Minu fotod" "Taustapildid" "Taustapildi kärpimine" diff --git a/WallpaperPicker/res/values-eu-rES/strings.xml b/WallpaperPicker/res/values-eu-rES/strings.xml index 327550d52..45bf7a106 100644 --- a/WallpaperPicker/res/values-eu-rES/strings.xml +++ b/WallpaperPicker/res/values-eu-rES/strings.xml @@ -30,7 +30,7 @@ "%1$d/%2$d horma-papera" "%1$s hautatu da" "Ezabatu" - "Hautatu irudia" + "Nire argazkiak" "Horma-paperak" "Ebaki horma-papera" diff --git a/WallpaperPicker/res/values-fa/strings.xml b/WallpaperPicker/res/values-fa/strings.xml index ef4bc4fa6..20289d087 100644 --- a/WallpaperPicker/res/values-fa/strings.xml +++ b/WallpaperPicker/res/values-fa/strings.xml @@ -30,7 +30,7 @@ "‏کاغذدیواری %1$d از %2$d" "%1$s انتخاب شد" "حذف" - "انتخاب تصویر" + "عکس‌های من" "کاغذدیواری‌ها" "برش کاغذدیواری" diff --git a/WallpaperPicker/res/values-fi/strings.xml b/WallpaperPicker/res/values-fi/strings.xml index 0fa4b7bcf..c82d3e0ed 100644 --- a/WallpaperPicker/res/values-fi/strings.xml +++ b/WallpaperPicker/res/values-fi/strings.xml @@ -30,7 +30,7 @@ "Taustakuva %1$d/%2$d" "Valittu: %1$s" "Poista" - "Valitse kuva" + "Omat valokuvat" "Taustakuvat" "Rajaa taustakuva" diff --git a/WallpaperPicker/res/values-fr-rCA/strings.xml b/WallpaperPicker/res/values-fr-rCA/strings.xml index e95670678..92568966e 100644 --- a/WallpaperPicker/res/values-fr-rCA/strings.xml +++ b/WallpaperPicker/res/values-fr-rCA/strings.xml @@ -30,7 +30,7 @@ "Fond d\'écran %1$d de %2$d" "Sélection : %1$s" "Supprimer" - "Choisir une image" + "Mes photos" "Fonds d\'écran" "Rogner le fond d\'écran" diff --git a/WallpaperPicker/res/values-fr/strings.xml b/WallpaperPicker/res/values-fr/strings.xml index 37846e0f5..479a7e430 100644 --- a/WallpaperPicker/res/values-fr/strings.xml +++ b/WallpaperPicker/res/values-fr/strings.xml @@ -30,7 +30,7 @@ "Fond d\'écran %1$d sur %2$d" "%1$s sélectionné" "Supprimer" - "Sélectionner une image" + "Mes photos" "Fonds d\'écran" "Recadrer le fond d\'écran" diff --git a/WallpaperPicker/res/values-gl-rES/strings.xml b/WallpaperPicker/res/values-gl-rES/strings.xml index 9f1fd5014..0396b2f62 100644 --- a/WallpaperPicker/res/values-gl-rES/strings.xml +++ b/WallpaperPicker/res/values-gl-rES/strings.xml @@ -30,7 +30,7 @@ "Fondo de pantalla %1$d de %2$d" "Seleccionaches %1$s" "Eliminar" - "Escoller imaxe" + "As miñas fotos" "Fondos de pantalla" "Recortar fondo de pantalla" diff --git a/WallpaperPicker/res/values-hi/strings.xml b/WallpaperPicker/res/values-hi/strings.xml index fcb252eb5..60834e103 100644 --- a/WallpaperPicker/res/values-hi/strings.xml +++ b/WallpaperPicker/res/values-hi/strings.xml @@ -30,7 +30,7 @@ "वॉलपेपर %2$d में से %1$d" "चयनित %1$s" "हटाएं" - "चित्र चुनें" + "मेरी फ़ोटो" "वॉलपेपर" "वॉलपेपर काटें" diff --git a/WallpaperPicker/res/values-hr/strings.xml b/WallpaperPicker/res/values-hr/strings.xml index 5e8322f9b..3c4d36262 100644 --- a/WallpaperPicker/res/values-hr/strings.xml +++ b/WallpaperPicker/res/values-hr/strings.xml @@ -30,7 +30,7 @@ "%1$d. pozadinska slika od %2$d" "Odabrana je %1$s" "Izbriši" - "Odaberi sliku" + "Moje fotografije" "Pozadinske slike" "Obrezivanje pozadinske slike" diff --git a/WallpaperPicker/res/values-hu/strings.xml b/WallpaperPicker/res/values-hu/strings.xml index 703aa12eb..d8b08fdfd 100644 --- a/WallpaperPicker/res/values-hu/strings.xml +++ b/WallpaperPicker/res/values-hu/strings.xml @@ -30,7 +30,7 @@ "%1$d/%2$d. háttérkép" "%1$s kiválasztva" "Törlés" - "Kép kiválasztása" + "Saját fotók" "Háttérképek" "Háttérkép körbevágása" diff --git a/WallpaperPicker/res/values-hy-rAM/strings.xml b/WallpaperPicker/res/values-hy-rAM/strings.xml index f3891dd35..027b841a7 100644 --- a/WallpaperPicker/res/values-hy-rAM/strings.xml +++ b/WallpaperPicker/res/values-hy-rAM/strings.xml @@ -30,7 +30,7 @@ "%1$d պաստառ՝ %2$d-ից" "Ընտրված է %1$s" "Ջնջել" - "Ընտրել պատկեր" + "Իմ լուսանկարները" "Պաստառներ" "Եզրատել պաստառը" diff --git a/WallpaperPicker/res/values-in/strings.xml b/WallpaperPicker/res/values-in/strings.xml index f216cf343..91554522f 100644 --- a/WallpaperPicker/res/values-in/strings.xml +++ b/WallpaperPicker/res/values-in/strings.xml @@ -30,7 +30,7 @@ "Wallpaper %1$d dari %2$d" "%1$s terpilih" "Hapus" - "Pilih gambar" + "Foto saya" "Wallpaper" "Pangkas wallpaper" diff --git a/WallpaperPicker/res/values-is-rIS/strings.xml b/WallpaperPicker/res/values-is-rIS/strings.xml index 6d5d680cf..69e6cd498 100644 --- a/WallpaperPicker/res/values-is-rIS/strings.xml +++ b/WallpaperPicker/res/values-is-rIS/strings.xml @@ -30,7 +30,7 @@ "Veggfóður %1$d af %2$d" "%1$s valið" "Eyða" - "Velja mynd" + "Myndirnar mínar" "Veggfóður" "Skera veggfóður" diff --git a/WallpaperPicker/res/values-it/strings.xml b/WallpaperPicker/res/values-it/strings.xml index c29946f85..f4d38d14e 100644 --- a/WallpaperPicker/res/values-it/strings.xml +++ b/WallpaperPicker/res/values-it/strings.xml @@ -30,7 +30,7 @@ "Sfondo %1$d di %2$d" "Elemento selezionato: %1$s" "Elimina" - "Scegli l\'immagine" + "Le mie foto" "Sfondi" "Ritaglia sfondo" diff --git a/WallpaperPicker/res/values-iw/strings.xml b/WallpaperPicker/res/values-iw/strings.xml index ddc96e92c..e29f2372f 100644 --- a/WallpaperPicker/res/values-iw/strings.xml +++ b/WallpaperPicker/res/values-iw/strings.xml @@ -30,7 +30,7 @@ "‏טפט %1$d מתוך %2$d" "בחרת %1$s" "מחק" - "בחר תמונה" + "התמונות שלי" "טפטים" "חתוך את הטפט" diff --git a/WallpaperPicker/res/values-ja/strings.xml b/WallpaperPicker/res/values-ja/strings.xml index 80b094453..e86026bf9 100644 --- a/WallpaperPicker/res/values-ja/strings.xml +++ b/WallpaperPicker/res/values-ja/strings.xml @@ -30,7 +30,7 @@ "壁紙: %1$d/%2$d" "選択: %1$s" "削除" - "画像を選択" + "マイフォト" "壁紙" "壁紙のトリミング" diff --git a/WallpaperPicker/res/values-ka-rGE/strings.xml b/WallpaperPicker/res/values-ka-rGE/strings.xml index 2f59712d8..1ae10214a 100644 --- a/WallpaperPicker/res/values-ka-rGE/strings.xml +++ b/WallpaperPicker/res/values-ka-rGE/strings.xml @@ -30,7 +30,7 @@ "ფონი %1$d %2$d-დან" "არჩეული %1$s" "წაშლა" - "სურათის ამორჩევა" + "ჩემი ფოტოები" "ფონები" "ფონის ჩამოჭრა" diff --git a/WallpaperPicker/res/values-kk-rKZ/strings.xml b/WallpaperPicker/res/values-kk-rKZ/strings.xml index dcf372cf5..a10e27318 100644 --- a/WallpaperPicker/res/values-kk-rKZ/strings.xml +++ b/WallpaperPicker/res/values-kk-rKZ/strings.xml @@ -30,7 +30,7 @@ "%1$d артқы фон, барлығы %2$d" "%1$s таңдалған" "Жою" - "Суретті таңдау" + "Менің фотосуреттерім" "Артқы фондар" "Артқы фонды кесу" diff --git a/WallpaperPicker/res/values-km-rKH/strings.xml b/WallpaperPicker/res/values-km-rKH/strings.xml index 41722355f..2a605e86a 100644 --- a/WallpaperPicker/res/values-km-rKH/strings.xml +++ b/WallpaperPicker/res/values-km-rKH/strings.xml @@ -30,7 +30,7 @@ "ផ្ទាំង​រូបភាព %1$d នៃ %2$d" "បាន​ជ្រើស %1$s" "លុប" - "ជ្រើស​យក​រូបភាព" + "រូបថតរបស់ខ្ញុំ" "ផ្ទាំង​រូបភាព" "ច្រឹប​ផ្ទាំង​រូបភាព" diff --git a/WallpaperPicker/res/values-kn-rIN/strings.xml b/WallpaperPicker/res/values-kn-rIN/strings.xml index 89203bf1c..b69bda529 100644 --- a/WallpaperPicker/res/values-kn-rIN/strings.xml +++ b/WallpaperPicker/res/values-kn-rIN/strings.xml @@ -30,7 +30,7 @@ "%2$d ರಲ್ಲಿ %1$d ವಾಲ್‌ಪೇಪರ್‌" "%1$s ಆಯ್ಕೆ ಮಾಡಲಾಗಿದೆ" "ಅಳಿಸು" - "ಚಿತ್ರವನ್ನು ಆರಿಸಿ" + "ನನ್ನ ಫೋಟೋಗಳು" "ವಾಲ್‌ಪೇಪರ್‌ಗಳು" "ವಾಲ್‌ಪೇಪರ್‌ ಕತ್ತರಿಸಿ" diff --git a/WallpaperPicker/res/values-ko/strings.xml b/WallpaperPicker/res/values-ko/strings.xml index a5a85b773..30e7cfa23 100644 --- a/WallpaperPicker/res/values-ko/strings.xml +++ b/WallpaperPicker/res/values-ko/strings.xml @@ -30,7 +30,7 @@ "배경화면 %1$d/%2$d" "%1$s 선택함" "삭제" - "이미지 선택" + "내 사진" "배경화면" "배경화면 잘라내기" diff --git a/WallpaperPicker/res/values-ky-rKG/strings.xml b/WallpaperPicker/res/values-ky-rKG/strings.xml index 696b3ee17..f1ebf095d 100644 --- a/WallpaperPicker/res/values-ky-rKG/strings.xml +++ b/WallpaperPicker/res/values-ky-rKG/strings.xml @@ -30,7 +30,7 @@ "%2$d ичинен %1$d тушкагаз" "%1$s тандалды" "Жок кылуу" - "Сүрөт тандоо" + "Менин сүрөттөрүм" "Тушкагаздар" "Тушкагазды тегиздөө" diff --git a/WallpaperPicker/res/values-lo-rLA/strings.xml b/WallpaperPicker/res/values-lo-rLA/strings.xml index e46859111..e32cafb7d 100644 --- a/WallpaperPicker/res/values-lo-rLA/strings.xml +++ b/WallpaperPicker/res/values-lo-rLA/strings.xml @@ -30,7 +30,7 @@ "ພາບພື້ນຫຼັງ %1$d ໃນ %2$d" "ເລືອກ %1$s" "ລຶບ" - "ເລືອກ​ຮູບ​ພາບ" + "ຮູບຂອງຂ້ອຍ" "ພາບພື້ນຫຼັງ" "ຕັດພາບພື້ນຫຼັງ" diff --git a/WallpaperPicker/res/values-lt/strings.xml b/WallpaperPicker/res/values-lt/strings.xml index 86035b883..c442e3a5a 100644 --- a/WallpaperPicker/res/values-lt/strings.xml +++ b/WallpaperPicker/res/values-lt/strings.xml @@ -30,7 +30,7 @@ "%1$d ekrano fonas iš %2$d" "Pasirinkta: %1$s" "Ištrinti" - "Pasirinkti vaizdą" + "Mano nuotraukos" "Ekrano fonai" "Apkirpti ekrano foną" diff --git a/WallpaperPicker/res/values-lv/strings.xml b/WallpaperPicker/res/values-lv/strings.xml index 02e5cfb22..d05a17547 100644 --- a/WallpaperPicker/res/values-lv/strings.xml +++ b/WallpaperPicker/res/values-lv/strings.xml @@ -30,7 +30,7 @@ "%1$d. fona tapete no %2$d" "Atlasīta: %1$s" "Dzēst" - "Izvēlēties attēlu" + "Mani fotoattēli" "Fona tapetes" "Apgriezt fona tapeti" diff --git a/WallpaperPicker/res/values-mk-rMK/strings.xml b/WallpaperPicker/res/values-mk-rMK/strings.xml index b1919ccd4..f9e0963ed 100644 --- a/WallpaperPicker/res/values-mk-rMK/strings.xml +++ b/WallpaperPicker/res/values-mk-rMK/strings.xml @@ -30,7 +30,7 @@ "Тапет %1$d од %2$d" "Избран %1$s" "Избриши" - "Избери слика" + "Моите фотографии" "Тапети" "Исечи тапет" diff --git a/WallpaperPicker/res/values-ml-rIN/strings.xml b/WallpaperPicker/res/values-ml-rIN/strings.xml index 0b6a4c108..6be771c0e 100644 --- a/WallpaperPicker/res/values-ml-rIN/strings.xml +++ b/WallpaperPicker/res/values-ml-rIN/strings.xml @@ -30,7 +30,7 @@ "%1$d / %2$d വാൾപേപ്പർ" "%1$s തിരഞ്ഞെടുത്തു" "ഇല്ലാതാക്കുക" - "ചിത്രം തിരഞ്ഞെടുക്കുക" + "എന്റെ ഫോട്ടോകൾ" "വാൾപേപ്പറുകൾ" "വാൾപേപ്പറിന്റെ വലുപ്പം മാറ്റൽ" diff --git a/WallpaperPicker/res/values-mn-rMN/strings.xml b/WallpaperPicker/res/values-mn-rMN/strings.xml index 71ff9e0f7..b88da5a96 100644 --- a/WallpaperPicker/res/values-mn-rMN/strings.xml +++ b/WallpaperPicker/res/values-mn-rMN/strings.xml @@ -30,7 +30,7 @@ "%2$d ханын цаасны %1$d нь" "%1$s сонгогдсон" "Устгах" - "Зураг сонгох" + "Миний зураг" "Ханын зураг" "Ханын зургийг тайрах" diff --git a/WallpaperPicker/res/values-mr-rIN/strings.xml b/WallpaperPicker/res/values-mr-rIN/strings.xml index 33cfaa148..128b21c1c 100644 --- a/WallpaperPicker/res/values-mr-rIN/strings.xml +++ b/WallpaperPicker/res/values-mr-rIN/strings.xml @@ -30,7 +30,7 @@ "%2$d पैकी %1$d वॉलपेपर" "%1$s निवडले" "हटवा" - "प्रतिमा निवडा" + "माझे फोटो" "वॉलपेपर" "वॉलपेपर कापा" diff --git a/WallpaperPicker/res/values-ms-rMY/strings.xml b/WallpaperPicker/res/values-ms-rMY/strings.xml index 950f4d0e1..9d824e4fa 100644 --- a/WallpaperPicker/res/values-ms-rMY/strings.xml +++ b/WallpaperPicker/res/values-ms-rMY/strings.xml @@ -30,7 +30,7 @@ "Kertas dinding %1$d daripada %2$d" "Memilih %1$s" "Padam" - "Pilih imej" + "Foto saya" "Kertas dinding" "Pangkas kertas dinding" diff --git a/WallpaperPicker/res/values-my-rMM/strings.xml b/WallpaperPicker/res/values-my-rMM/strings.xml index 4d5ac47df..233611431 100644 --- a/WallpaperPicker/res/values-my-rMM/strings.xml +++ b/WallpaperPicker/res/values-my-rMM/strings.xml @@ -30,7 +30,7 @@ "နောက်ခံ %1$d မှ %2$d" "ရွေးချယ်ထားသော %1$s" "ဖျက်ပါ" - "ပုံ ရွေးပါ" + "ကျွန်ုပ်၏ ဓာတ်ပုံများ" "နောက်ခံများ" "နောက်ခံအား ဖြတ်ခြင်း" diff --git a/WallpaperPicker/res/values-nb/strings.xml b/WallpaperPicker/res/values-nb/strings.xml index 3589e4bc8..9ae0b989a 100644 --- a/WallpaperPicker/res/values-nb/strings.xml +++ b/WallpaperPicker/res/values-nb/strings.xml @@ -30,7 +30,7 @@ "Bakgrunn %1$d av %2$d" "Valgt %1$s" "Slett" - "Velg bilde" + "Mine bilder" "Bakgrunner" "Beskjær bakgrunnen" diff --git a/WallpaperPicker/res/values-ne-rNP/strings.xml b/WallpaperPicker/res/values-ne-rNP/strings.xml index 221fa9438..5bca8d809 100644 --- a/WallpaperPicker/res/values-ne-rNP/strings.xml +++ b/WallpaperPicker/res/values-ne-rNP/strings.xml @@ -30,7 +30,7 @@ "%2$d को %1$d वालपेपर" "चयन गरिएको %1$s" "मेट्नुहोस्" - "तस्बिर छान्नुहोस्" + "मेरा तस्बिरहरू" "वालपेपरहरु" "वालपेपर काँटछाट गर्नुहोस्" diff --git a/WallpaperPicker/res/values-nl/strings.xml b/WallpaperPicker/res/values-nl/strings.xml index 7dd4f22b0..a86f0f651 100644 --- a/WallpaperPicker/res/values-nl/strings.xml +++ b/WallpaperPicker/res/values-nl/strings.xml @@ -30,7 +30,7 @@ "Achtergrond %1$d van %2$d" "%1$s is geselecteerd" "Verwijderen" - "Afbeelding kiezen" + "Mijn foto\'s" "Achtergronden" "Achtergrond bijsnijden" diff --git a/WallpaperPicker/res/values-pl/strings.xml b/WallpaperPicker/res/values-pl/strings.xml index bcdbb3dc7..cd52082d6 100644 --- a/WallpaperPicker/res/values-pl/strings.xml +++ b/WallpaperPicker/res/values-pl/strings.xml @@ -30,7 +30,7 @@ "Tapeta %1$d z %2$d" "Wybrano %1$s" "Usuń" - "Wybierz obraz" + "Moje zdjęcia" "Tapety" "Przytnij tapetę" diff --git a/WallpaperPicker/res/values-pt-rPT/strings.xml b/WallpaperPicker/res/values-pt-rPT/strings.xml index 83492327f..82aa4694a 100644 --- a/WallpaperPicker/res/values-pt-rPT/strings.xml +++ b/WallpaperPicker/res/values-pt-rPT/strings.xml @@ -30,7 +30,7 @@ "Imagem de fundo %1$d de %2$d" "%1$s selecionada" "Eliminar" - "Escolher imagem" + "As minhas fotos" "Imagens de fundo" "Recortar imagem de fundo" diff --git a/WallpaperPicker/res/values-pt/strings.xml b/WallpaperPicker/res/values-pt/strings.xml index 2332fcbd1..74ff3106c 100644 --- a/WallpaperPicker/res/values-pt/strings.xml +++ b/WallpaperPicker/res/values-pt/strings.xml @@ -30,7 +30,7 @@ "Plano de fundo %1$d de %2$d" "%1$s selecionado" "Excluir" - "Escolher imagem" + "Minhas fotos" "Planos de fundo" "Cortar plano de fundo" diff --git a/WallpaperPicker/res/values-ro/strings.xml b/WallpaperPicker/res/values-ro/strings.xml index 8ee1a5a39..6281b80fc 100644 --- a/WallpaperPicker/res/values-ro/strings.xml +++ b/WallpaperPicker/res/values-ro/strings.xml @@ -30,7 +30,7 @@ "Imaginea de fundal %1$d din %2$d" "S-a selectat %1$s" "Ștergeți" - "Alegeți imaginea" + "Fotografiile mele" "Imagini de fundal" "Decupați imaginea de fundal" diff --git a/WallpaperPicker/res/values-ru/strings.xml b/WallpaperPicker/res/values-ru/strings.xml index ff43ce8f6..959205a33 100644 --- a/WallpaperPicker/res/values-ru/strings.xml +++ b/WallpaperPicker/res/values-ru/strings.xml @@ -30,7 +30,7 @@ "Обои %1$d из %2$d" "Выбран элемент \"%1$s\"" "Удалить" - "Выбрать обои" + "Мои фото" "Обои" "Кадрировать обои" diff --git a/WallpaperPicker/res/values-si-rLK/strings.xml b/WallpaperPicker/res/values-si-rLK/strings.xml index d175724fd..37ce1fc52 100644 --- a/WallpaperPicker/res/values-si-rLK/strings.xml +++ b/WallpaperPicker/res/values-si-rLK/strings.xml @@ -32,7 +32,7 @@ "තෝරාගත්තේ %1$s" "මකන්න" - "පින්තූරයක් තෝරන්න" + "මගේ ඡායාරූප" "වෝල්පේපර" "වෝල්පේපරය කප්පාදු කිරීම" diff --git a/WallpaperPicker/res/values-sk/strings.xml b/WallpaperPicker/res/values-sk/strings.xml index 33477a124..9d38de437 100644 --- a/WallpaperPicker/res/values-sk/strings.xml +++ b/WallpaperPicker/res/values-sk/strings.xml @@ -30,7 +30,7 @@ "Tapeta %1$d z %2$d" "Vybratá položka %1$s" "Odstrániť" - "Vybrať obrázok" + "Moje fotky" "Tapety" "Orezanie tapety" diff --git a/WallpaperPicker/res/values-sl/strings.xml b/WallpaperPicker/res/values-sl/strings.xml index 06a508a8c..e776cc7d5 100644 --- a/WallpaperPicker/res/values-sl/strings.xml +++ b/WallpaperPicker/res/values-sl/strings.xml @@ -30,7 +30,7 @@ "%1$d. ozadje od %2$d" "Izbrano: %1$s" "Izbriši" - "Izberi sliko" + "Moje fotografije" "Ozadja" "Obrezovanje ozadja" diff --git a/WallpaperPicker/res/values-sr/strings.xml b/WallpaperPicker/res/values-sr/strings.xml index fdfaaf60f..c37bc060f 100644 --- a/WallpaperPicker/res/values-sr/strings.xml +++ b/WallpaperPicker/res/values-sr/strings.xml @@ -30,7 +30,7 @@ "Позадина %1$d од %2$d" "Изабрана је %1$s" "Избриши" - "Изабери слику" + "Моје фотографије" "Позадине" "Опсеци позадину" diff --git a/WallpaperPicker/res/values-sv/strings.xml b/WallpaperPicker/res/values-sv/strings.xml index 57db3a64d..044508b4d 100644 --- a/WallpaperPicker/res/values-sv/strings.xml +++ b/WallpaperPicker/res/values-sv/strings.xml @@ -30,7 +30,7 @@ "Bakgrund %1$d av %2$d" "%1$s har valts" "Ta bort" - "Välj bild" + "Mina foton" "Bakgrunder" "Beskär bakgrund" diff --git a/WallpaperPicker/res/values-sw/strings.xml b/WallpaperPicker/res/values-sw/strings.xml index edea3de5b..367912aab 100644 --- a/WallpaperPicker/res/values-sw/strings.xml +++ b/WallpaperPicker/res/values-sw/strings.xml @@ -30,7 +30,7 @@ "Mandhari %1$d ya %2$d" "%1$s iliyochaguliwa" "Futa" - "Chagua picha" + "Picha zangu" "Mandhari" "Punguza mandhari" diff --git a/WallpaperPicker/res/values-ta-rIN/strings.xml b/WallpaperPicker/res/values-ta-rIN/strings.xml index 2b984271a..7284da8ae 100644 --- a/WallpaperPicker/res/values-ta-rIN/strings.xml +++ b/WallpaperPicker/res/values-ta-rIN/strings.xml @@ -30,7 +30,7 @@ "வால்பேப்பர் %1$d / %2$d" "%1$s தேர்ந்தெடுக்கப்பட்டது" "நீக்கு" - "படத்தைத் தேர்வுசெய்க" + "எனது படங்கள்" "வால்பேப்பர்கள்" "வால்பேப்பரைச் செதுக்கு" diff --git a/WallpaperPicker/res/values-te-rIN/strings.xml b/WallpaperPicker/res/values-te-rIN/strings.xml index c26f84e28..4c5ad2f08 100644 --- a/WallpaperPicker/res/values-te-rIN/strings.xml +++ b/WallpaperPicker/res/values-te-rIN/strings.xml @@ -30,7 +30,7 @@ "%2$dలో %1$dవ వాల్‌పేపర్" "%1$s ఎంచుకోబడింది" "తొలగించు" - "చిత్రాన్ని ఎంచుకోండి" + "నా ఫోటోలు" "వాల్‌పేపర్‌లు" "వాల్‌పేపర్‌ను కత్తిరించండి" diff --git a/WallpaperPicker/res/values-th/strings.xml b/WallpaperPicker/res/values-th/strings.xml index 6b4c23536..b3d7a8bc7 100644 --- a/WallpaperPicker/res/values-th/strings.xml +++ b/WallpaperPicker/res/values-th/strings.xml @@ -30,7 +30,7 @@ "วอลเปเปอร์ %1$d จาก %2$d" "เลือก %1$s แล้ว" "ลบ" - "เลือกรูปภาพ" + "รูปภาพของฉัน" "วอลเปเปอร์" "ครอบตัดวอลเปเปอร์" diff --git a/WallpaperPicker/res/values-tl/strings.xml b/WallpaperPicker/res/values-tl/strings.xml index c9fe338d4..db8f4d542 100644 --- a/WallpaperPicker/res/values-tl/strings.xml +++ b/WallpaperPicker/res/values-tl/strings.xml @@ -30,7 +30,7 @@ "Wallpaper %1$d ng %2$d" "Napili ang %1$s" "Tanggalin" - "Pumili ng larawan" + "Aking mga larawan" "Mga Wallpaper" "I-crop ang wallpaper" diff --git a/WallpaperPicker/res/values-tr/strings.xml b/WallpaperPicker/res/values-tr/strings.xml index 3d03c6be8..d1e57edbb 100644 --- a/WallpaperPicker/res/values-tr/strings.xml +++ b/WallpaperPicker/res/values-tr/strings.xml @@ -30,7 +30,7 @@ "%2$d duvar kağıdı arasından duvar kağıdı %1$d" "%1$s seçildi" "Sil" - "Resim seç" + "Fotoğraflarım" "Duvar kağıtları" "Duvar kağıdını kırp" diff --git a/WallpaperPicker/res/values-uk/strings.xml b/WallpaperPicker/res/values-uk/strings.xml index 076c88238..756e7cf09 100644 --- a/WallpaperPicker/res/values-uk/strings.xml +++ b/WallpaperPicker/res/values-uk/strings.xml @@ -30,7 +30,7 @@ "Фоновий малюнок %1$d з %2$d" "Вибрано %1$s" "Видалити" - "Вибрати зображення" + "Мої фото" "Фонові малюнки" "Обрізати фоновий малюнок" diff --git a/WallpaperPicker/res/values-ur-rPK/strings.xml b/WallpaperPicker/res/values-ur-rPK/strings.xml index 7b12d4239..86d8163d9 100644 --- a/WallpaperPicker/res/values-ur-rPK/strings.xml +++ b/WallpaperPicker/res/values-ur-rPK/strings.xml @@ -30,7 +30,7 @@ "‏وال پیپر ‎%1$d از ‎%2$d" "%1$s کو منتخب کیا گیا" "حذف کریں" - "تصویر منتخب کریں" + "میری تصاویر" "وال پیپرز" "وال پیپر کو تراشیں" diff --git a/WallpaperPicker/res/values-uz-rUZ/strings.xml b/WallpaperPicker/res/values-uz-rUZ/strings.xml index 751f457e7..97d3938ae 100644 --- a/WallpaperPicker/res/values-uz-rUZ/strings.xml +++ b/WallpaperPicker/res/values-uz-rUZ/strings.xml @@ -30,7 +30,7 @@ "Fon rasmi %2$ddan %1$d" "%1$s tanlandi" "O‘chirish" - "Rasm tanlang" - "Orqa fon rasmlari" + "Mening rasmlarim" + "Fon rasmlari" "Fon rasmini kesish" diff --git a/WallpaperPicker/res/values-vi/strings.xml b/WallpaperPicker/res/values-vi/strings.xml index d1efbe989..ae00d585c 100644 --- a/WallpaperPicker/res/values-vi/strings.xml +++ b/WallpaperPicker/res/values-vi/strings.xml @@ -30,7 +30,7 @@ "Hình nền %1$d / %2$d" "%1$s được chọn" "Xóa" - "Chọn hình ảnh" + "Ảnh của tôi" "Hình nền" "Cắt hình nền" diff --git a/WallpaperPicker/res/values-zh-rCN/strings.xml b/WallpaperPicker/res/values-zh-rCN/strings.xml index 1def9ed41..8bd5342eb 100644 --- a/WallpaperPicker/res/values-zh-rCN/strings.xml +++ b/WallpaperPicker/res/values-zh-rCN/strings.xml @@ -30,7 +30,7 @@ "第%1$d张壁纸,共%2$d张" "已选择%1$s" "删除" - "选择图片" + "我的照片" "壁纸" "剪裁壁纸" diff --git a/WallpaperPicker/res/values-zh-rHK/strings.xml b/WallpaperPicker/res/values-zh-rHK/strings.xml index 66ba0af18..e51d60afa 100644 --- a/WallpaperPicker/res/values-zh-rHK/strings.xml +++ b/WallpaperPicker/res/values-zh-rHK/strings.xml @@ -30,7 +30,7 @@ "第 %1$d 張桌布,共 %2$d 張" "已選取%1$s" "刪除" - "選擇圖片" + "我的相片" "桌布" "裁剪桌布" diff --git a/WallpaperPicker/res/values-zh-rTW/strings.xml b/WallpaperPicker/res/values-zh-rTW/strings.xml index 418497608..c12350af0 100644 --- a/WallpaperPicker/res/values-zh-rTW/strings.xml +++ b/WallpaperPicker/res/values-zh-rTW/strings.xml @@ -30,7 +30,7 @@ "第 %1$d 張桌布,共 %2$d 張" "已選取%1$s" "刪除" - "選擇圖片" + "我的相片" "桌布" "裁剪桌布" diff --git a/WallpaperPicker/res/values-zu/strings.xml b/WallpaperPicker/res/values-zu/strings.xml index c7d3f33d1..537b2f3ca 100644 --- a/WallpaperPicker/res/values-zu/strings.xml +++ b/WallpaperPicker/res/values-zu/strings.xml @@ -30,7 +30,7 @@ "Isithombe sangemuva esingu-%1$d kwezingu-%2$d" "I-%1$s ekhethiwe" "Susa" - "Khetha isithombe" + "Izithombe zami" "Izithombe zangemuva" "Nqampuna isithombe sangemuva" -- cgit v1.2.3 From 5053abb0eb1cadc0dd13f135f6129b22c74207ca Mon Sep 17 00:00:00 2001 From: Geoff Mendal Date: Wed, 8 Jul 2015 06:48:00 -0700 Subject: Import translations. DO NOT MERGE Change-Id: I32cb7994d836d2ea00acab42fa11f31b33dab3d9 Auto-generated-cl: translation import --- WallpaperPicker/res/values-fa/strings.xml | 2 +- WallpaperPicker/res/values-hr/strings.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/res/values-fa/strings.xml b/WallpaperPicker/res/values-fa/strings.xml index 20289d087..469ec1263 100644 --- a/WallpaperPicker/res/values-fa/strings.xml +++ b/WallpaperPicker/res/values-fa/strings.xml @@ -21,7 +21,7 @@ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> "تنظیم کاغذدیواری" "تصویر بارگیری نشد" - "تصویر به عنوان کاغذدیواری بارگیری نشد" + "تصویر به‌عنوان کاغذدیواری بارگیری نشد" "‏%1$d انتخاب شد" "‏%1$d انتخاب شد" diff --git a/WallpaperPicker/res/values-hr/strings.xml b/WallpaperPicker/res/values-hr/strings.xml index 3c4d36262..9ed702c5a 100644 --- a/WallpaperPicker/res/values-hr/strings.xml +++ b/WallpaperPicker/res/values-hr/strings.xml @@ -21,7 +21,7 @@ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> "Postavi pozadinu" "Nije moguće učitati sliku" - "Nije moguće učitati sliku kao pozadinsku sliku" + "Nije moguće učitati sliku kao pozadinu" "Odabrano je %1$d stavki" "Odabrana je %1$d stavka" @@ -31,6 +31,6 @@ "Odabrana je %1$s" "Izbriši" "Moje fotografije" - "Pozadinske slike" + "Pozadine" "Obrezivanje pozadinske slike" -- cgit v1.2.3 From c71a5c7cc69bae6ba9da3200bd2cc2359071e78d Mon Sep 17 00:00:00 2001 From: Geoff Mendal Date: Wed, 8 Jul 2015 12:01:26 -0700 Subject: Import translations. DO NOT MERGE Change-Id: I6d088f3a7797d75df4e1faf21b3809a891618449 Auto-generated-cl: translation import --- WallpaperPicker/res/values-az-rAZ/strings.xml | 36 +++++++++++++++++++++++++++ WallpaperPicker/res/values-gu-rIN/strings.xml | 36 +++++++++++++++++++++++++++ WallpaperPicker/res/values-pa-rIN/strings.xml | 36 +++++++++++++++++++++++++++ WallpaperPicker/res/values-sq-rAL/strings.xml | 36 +++++++++++++++++++++++++++ 4 files changed, 144 insertions(+) create mode 100644 WallpaperPicker/res/values-az-rAZ/strings.xml create mode 100644 WallpaperPicker/res/values-gu-rIN/strings.xml create mode 100644 WallpaperPicker/res/values-pa-rIN/strings.xml create mode 100644 WallpaperPicker/res/values-sq-rAL/strings.xml (limited to 'WallpaperPicker') diff --git a/WallpaperPicker/res/values-az-rAZ/strings.xml b/WallpaperPicker/res/values-az-rAZ/strings.xml new file mode 100644 index 000000000..883673dd6 --- /dev/null +++ b/WallpaperPicker/res/values-az-rAZ/strings.xml @@ -0,0 +1,36 @@ + + + + + "Divar kağı seçin" + "Şəkli yükləmək alınmadı" + "Şəkli divar kağızı olaraq yükləmək alınmadı" + + "%1$d seçilib" + "%1$d seçilib" + "%1$d seçilib" + + "Divar kağızı %1$d of %2$d" + "%1$s seçilib" + "Sil" + "Fotolarım" + "Divar kağızları" + "Divar kağızını kəsin" + diff --git a/WallpaperPicker/res/values-gu-rIN/strings.xml b/WallpaperPicker/res/values-gu-rIN/strings.xml new file mode 100644 index 000000000..e201d523f --- /dev/null +++ b/WallpaperPicker/res/values-gu-rIN/strings.xml @@ -0,0 +1,36 @@ + + + + + "વૉલપેપર સેટ કરો" + "છબી લોડ કરી શકાઈ નથી" + "વૉલપેપર તરીકે છબી લોડ કરી શકાઈ નથી" + + "%1$d પસંદ કર્યો" + "%1$d પસંદ કર્યો" + "%1$d પસંદ કર્યો" + + "%2$d માંથી %1$d વૉલપેપર" + "%1$s પસંદ કર્યો" + "કાઢી નાખો" + "મારા ફોટા" + "વૉલપેપર્સ" + "વૉલપેપર કાપો" + diff --git a/WallpaperPicker/res/values-pa-rIN/strings.xml b/WallpaperPicker/res/values-pa-rIN/strings.xml new file mode 100644 index 000000000..e4225e02d --- /dev/null +++ b/WallpaperPicker/res/values-pa-rIN/strings.xml @@ -0,0 +1,36 @@ + + + + + "ਵਾਲਪੇਪਰ ਸੈਟ ਕਰੋ" + "ਚਿੱਤਰ ਲੋਡ ਨਹੀਂ ਕਰ ਸਕਿਆ" + "ਵਾਲਪੇਪਰ ਦੇ ਤੌਰ ਤੇ ਚਿੱਤਰ ਲੋਡ ਨਹੀਂ ਕਰ ਸਕਿਆ" + + "%1$d ਚੁਣਿਆ ਗਿਆ" + "%1$d ਚੁਣਿਆ ਗਿਆ" + "%1$d ਚੁਣਿਆ ਗਿਆ" + + "ਵਾਲਪੇਪਰ %2$d ਦਾ %1$d" + "%1$s ਚੁਣਿਆ ਗਿਆ" + "ਮਿਟਾਓ" + "ਮੇਰੀਆਂ ਫੋਟੋਆਂ" + "ਵਾਲਪੇਪਰ" + "ਵਾਲਪੇਪਰ ਕੱਟੋ" + diff --git a/WallpaperPicker/res/values-sq-rAL/strings.xml b/WallpaperPicker/res/values-sq-rAL/strings.xml new file mode 100644 index 000000000..8a9983b4b --- /dev/null +++ b/WallpaperPicker/res/values-sq-rAL/strings.xml @@ -0,0 +1,36 @@ + + + + + "Cakto imazhin e sfondit" + "Nuk mund të ngarkonte imazhin" + "Nuk mundi të ngarkonte imazhin si imazh sfondi" + + "Të përzgjedhur: %1$d" + "Të përzgjedhur: %1$d" + "Të përzgjedhur: %1$d" + + "Imazhi i sfondit: %1$d nga gjithsej %2$d" + "%1$s u përzgjodh" + "Fshi" + "Fotografitë e mia" + "Imazhet e sfondit" + "Prit imazhin e sfondit" + -- cgit v1.2.3