From a9745046297a5c07bdb9cf70217b111ae9293d9b Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Sat, 27 May 2017 11:06:23 -0700 Subject: [PATCH] Use a custom spinner layout on Huawei phones running API 24. Fixes https://redmine.stoutner.com/issues/131. --- .idea/dictionaries/soren.xml | 1 + app/src/main/assets/de/about_changelog.html | 6 ++-- app/src/main/assets/en/about_changelog.html | 6 ++-- app/src/main/assets/es/about_changelog.html | 6 ++-- app/src/main/assets/it/about_changelog.html | 6 ++-- .../main/assets/zh-rTW/about_changelog.html | 6 ++-- .../fragments/DomainSettingsFragment.java | 9 ++++- ...imple_spinner_dropdown_item_huawei_fix.xml | 33 +++++++++++++++++++ 8 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 app/src/main/res/layout/simple_spinner_dropdown_item_huawei_fix.xml diff --git a/.idea/dictionaries/soren.xml b/.idea/dictionaries/soren.xml index 01627498..f593ed68 100644 --- a/.idea/dictionaries/soren.xml +++ b/.idea/dictionaries/soren.xml @@ -52,6 +52,7 @@ framelayout gerlach googleplay + huawei imageview intl ipleak diff --git a/app/src/main/assets/de/about_changelog.html b/app/src/main/assets/de/about_changelog.html index 52707d7b..add70df2 100644 --- a/app/src/main/assets/de/about_changelog.html +++ b/app/src/main/assets/de/about_changelog.html @@ -33,7 +33,7 @@

2.3 (version code 23)

-

26 May 2017 - minimum API 19, target API 25

+

26 May 2017 - minimum API 19, target API 25

2.2 (version code 22)

diff --git a/app/src/main/assets/en/about_changelog.html b/app/src/main/assets/en/about_changelog.html index 88358801..e94b2e1a 100644 --- a/app/src/main/assets/en/about_changelog.html +++ b/app/src/main/assets/en/about_changelog.html @@ -28,7 +28,7 @@

2.3 (version code 23)

-

26 May 2017 - minimum API 19, target API 25

+

26 May 2017 - minimum API 19, target API 25

2.2 (version code 22)

diff --git a/app/src/main/assets/es/about_changelog.html b/app/src/main/assets/es/about_changelog.html index c1e82122..7ee6eb12 100644 --- a/app/src/main/assets/es/about_changelog.html +++ b/app/src/main/assets/es/about_changelog.html @@ -30,7 +30,7 @@

2.3 (version code 23)

-

26 de mayo de 2017 - API mínimo 19, API dirigido 25

+

26 de mayo de 2017 - API mínimo 19, API dirigido 25

2.2 (código de versión 22)

diff --git a/app/src/main/assets/it/about_changelog.html b/app/src/main/assets/it/about_changelog.html index f3eaf40c..9a8c9d1e 100644 --- a/app/src/main/assets/it/about_changelog.html +++ b/app/src/main/assets/it/about_changelog.html @@ -30,7 +30,7 @@

2.3 (version code 23)

-

26 Maggio 2017 - minima API 19, target API 25

+

26 Maggio 2017 - minima API 19, target API 25

2.2 (versione codice 22)

diff --git a/app/src/main/assets/zh-rTW/about_changelog.html b/app/src/main/assets/zh-rTW/about_changelog.html index 88358801..e94b2e1a 100644 --- a/app/src/main/assets/zh-rTW/about_changelog.html +++ b/app/src/main/assets/zh-rTW/about_changelog.html @@ -28,7 +28,7 @@

2.3 (version code 23)

-

26 May 2017 - minimum API 19, target API 25

+

26 May 2017 - minimum API 19, target API 25

2.2 (version code 22)

diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java index 4416d301..5362026c 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java @@ -116,10 +116,17 @@ public class DomainSettingsFragment extends Fragment { final ArrayAdapter displayImagesArrayAdapter = ArrayAdapter.createFromResource(context, R.array.display_website_images_array, android.R.layout.simple_spinner_item); // Set the drop down style for the `ArrayAdapters`. - userAgentArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); fontSizeArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); displayImagesArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + // Some phones running Huawei's customized Android 7.0 don't display a spinner that requires scrolling correctly with the default `simple_spinner_dropdown_item`. The Huawei P9 Lite is known to be affected. + if (Build.BRAND.equals("HUAWEI") && (Build.VERSION.SDK_INT == 24)) { // The device is manufactured by Huawei and is running Android 7.0. + // Use a customized `simple_spinner_dropdown_item`. + userAgentArrayAdapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item_huawei_fix); + } else { // Use the standard `android.R.layout.simple_spinner_dropdown_item` on all other devices. + userAgentArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + } + // Set the `ArrayAdapters` for the `Spinners`. userAgentSpinner.setAdapter(userAgentArrayAdapter); fontSizeSpinner.setAdapter(fontSizeArrayAdapter); diff --git a/app/src/main/res/layout/simple_spinner_dropdown_item_huawei_fix.xml b/app/src/main/res/layout/simple_spinner_dropdown_item_huawei_fix.xml new file mode 100644 index 00000000..eeb37ce5 --- /dev/null +++ b/app/src/main/res/layout/simple_spinner_dropdown_item_huawei_fix.xml @@ -0,0 +1,33 @@ + + + + + -- 2.45.2