summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-11-29 10:30:55 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-11-30 12:17:14 +0100
commitc82a594da3189fe82052f8081fda16e9e3cb0c0f (patch)
tree03653dfedaad8e30d44c85d42e76f4fe97513e5e /android
parent322f8e8cb7d103a6666ceb212d43929aab2f111e (diff)
tdf#124480 android: Avoid using color attr requiring API 23
Using "colorBackgroundFloating" requires API level 23 [1], but our current minimum API level is 16 (when building with NDK 23). Therefore, define an own color `background_floating` instead and use the correspodning color values from the material theme (`background_floating_material_{dark,light}` depending on whether dark/night mode is enabled or not. This makes the app work again in a quick test with an x86 AVD with API level 16 instead of crashing on startup. Change-Id: I7b8378b42e9fc7430ec4ed263d4cb8b42027a930 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160077 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'android')
-rw-r--r--android/source/res/drawable/label_background.xml2
-rw-r--r--android/source/res/layout/activity_document_browser.xml10
-rw-r--r--android/source/res/values-night/colors.xml2
-rw-r--r--android/source/res/values/colors.xml5
4 files changed, 13 insertions, 6 deletions
diff --git a/android/source/res/drawable/label_background.xml b/android/source/res/drawable/label_background.xml
index 3e5b7b1cb907..2727c7d9ab0b 100644
--- a/android/source/res/drawable/label_background.xml
+++ b/android/source/res/drawable/label_background.xml
@@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
- <solid android:color="?attr/colorBackgroundFloating" />
+ <solid android:color="@color/background_floating" />
<corners android:radius="5dp" />
</shape>
</item>
diff --git a/android/source/res/layout/activity_document_browser.xml b/android/source/res/layout/activity_document_browser.xml
index bb022683b2ae..72b6e42b29b2 100644
--- a/android/source/res/layout/activity_document_browser.xml
+++ b/android/source/res/layout/activity_document_browser.xml
@@ -109,7 +109,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
- app:backgroundTint="?attr/colorBackgroundFloating"
+ app:backgroundTint="@color/background_floating"
app:fabSize="normal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
@@ -141,7 +141,7 @@
android:layout_marginBottom="@dimen/new_doc_fab_tweak_bottom"
android:layout_marginTop="@dimen/new_doc_fab_tweak_top"
android:clickable="true"
- app:backgroundTint="?attr/colorBackgroundFloating"
+ app:backgroundTint="@color/background_floating"
app:fabSize="mini"
app:srcCompat="@drawable/writer"
app:useCompatPadding="true" />
@@ -173,7 +173,7 @@
android:layout_marginBottom="@dimen/new_doc_fab_tweak_bottom"
android:layout_marginTop="@dimen/new_doc_fab_tweak_top"
android:clickable="true"
- app:backgroundTint="?attr/colorBackgroundFloating"
+ app:backgroundTint="@color/background_floating"
app:fabSize="mini"
app:srcCompat="@drawable/impress"
app:useCompatPadding="true" />
@@ -205,7 +205,7 @@
android:layout_marginBottom="@dimen/new_doc_fab_tweak_bottom"
android:layout_marginTop="@dimen/new_doc_fab_tweak_top"
android:clickable="true"
- app:backgroundTint="?attr/colorBackgroundFloating"
+ app:backgroundTint="@color/background_floating"
app:fabSize="mini"
app:srcCompat="@drawable/calc"
app:useCompatPadding="true" />
@@ -237,7 +237,7 @@
android:layout_marginBottom="@dimen/new_doc_fab_tweak_bottom"
android:layout_marginTop="@dimen/new_doc_fab_tweak_top"
android:clickable="true"
- app:backgroundTint="?attr/colorBackgroundFloating"
+ app:backgroundTint="@color/background_floating"
app:fabSize="mini"
app:srcCompat="@drawable/draw"
app:useCompatPadding="true" />
diff --git a/android/source/res/values-night/colors.xml b/android/source/res/values-night/colors.xml
index e02863b10340..c6260c191d3e 100644
--- a/android/source/res/values-night/colors.xml
+++ b/android/source/res/values-night/colors.xml
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
+ <color name="background_floating">@color/background_floating_material_dark</color>
+
<color name="toolbar_foreground">#efefef</color>
</resources>
diff --git a/android/source/res/values/colors.xml b/android/source/res/values/colors.xml
index 791c0f23da23..8f97b3e67130 100644
--- a/android/source/res/values/colors.xml
+++ b/android/source/res/values/colors.xml
@@ -4,6 +4,11 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
+
+ <!-- "?attr/colorBackgroundFloating" could be used directly instead for API level >= 23,
+ but current minimum API level is lower. Overriden for dark theme in values-night/color.xml. -->
+ <color name="background_floating">@color/background_floating_material_light</color>
+
<color name="background_light">#FAFAFA</color> <!--Material Grey 50-->
<color name="background_normal">#F5F5F5</color> <!--Material Grey 100-->
<color name="background_private">#FF292C29</color>