android/source/res/drawable-hdpi/ic_folder_48dp.xml                   |    2 
 android/source/res/drawable/label_background.xml                      |    2 
 android/source/res/layout/activity_document_browser.xml               |   34 
+++-------
 android/source/res/values-night/colors.xml                            |    2 
 android/source/res/values/colors.xml                                  |    5 +
 android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java |    5 -
 6 files changed, 23 insertions(+), 27 deletions(-)

New commits:
commit c82a594da3189fe82052f8081fda16e9e3cb0c0f
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Nov 29 10:30:55 2023 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Nov 30 12:17:14 2023 +0100

    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.wegh...@posteo.de>

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>
commit 322f8e8cb7d103a6666ceb212d43929aab2f111e
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Nov 29 09:15:25 2023 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Nov 30 12:17:07 2023 +0100

    tdf#124480 android: Use an actual button for "Select file to open"
    
    Instead of using a TextView and setting `?attr/colorButtonNormal`
    for the background color, just use a button right away, which also
    makes sure that the proper button color is used and avoids
    using `colorButtonNormal` only available from API level 21 on. [1]
    
    Also drop the extra `LinearLayout` parent that was only containing
    this one TextView.
    
    While at it, drop an unused import.
    
    [1] https://developer.android.com/reference/android/R.attr#colorButtonNormal
    
    Change-Id: Ie2f7e2646d20f4051fb2513fb8fd72572ce19217
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160076
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/android/source/res/layout/activity_document_browser.xml 
b/android/source/res/layout/activity_document_browser.xml
index 23666b11c6e4..bb022683b2ae 100644
--- a/android/source/res/layout/activity_document_browser.xml
+++ b/android/source/res/layout/activity_document_browser.xml
@@ -67,25 +67,15 @@
                     android:textSize="14sp"
                     android:textStyle="bold" />
 
-                <!--Icon and text to open system file picker via Intent -->
-                <LinearLayout
-                    android:id="@+id/system_file_picker_layout"
+                <Button
+                    android:id="@+id/open_file_button"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:background="?attr/colorButtonNormal"
-                    android:orientation="horizontal"
-                    app:layout_constraintTop_toBottomOf="@id/toolbar">
-
-                    <TextView
-                        android:id="@+id/open_file_view"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:layout_weight="1"
-                        android:gravity="center_vertical"
-                        android:text="@string/select_file_to_open"
-                        android:textSize="14dp"
-                        app:drawableLeftCompat="@drawable/ic_folder_48dp" />
-                </LinearLayout>
+                    android:layout_weight="1"
+                    android:gravity="center_vertical"
+                    android:text="@string/select_file_to_open"
+                    android:textSize="14dp"
+                    app:drawableLeftCompat="@drawable/ic_folder_48dp" />
 
                 <TextView
                     android:layout_width="match_parent"
diff --git 
a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java 
b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index eba618095045..6f583377d592 100644
--- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -43,7 +43,6 @@ import android.view.animation.AnimationUtils;
 import android.view.animation.OvershootInterpolator;
 import android.widget.LinearLayout;
 import android.widget.TextView;
-import android.widget.Toast;
 
 import org.libreoffice.AboutDialogFragment;
 import org.libreoffice.BuildConfig;
@@ -199,7 +198,7 @@ public class LibreOfficeUIActivity extends 
AppCompatActivity implements Settings
         impressLayout = findViewById(R.id.impressLayout);
         calcLayout = findViewById(R.id.calcLayout);
         drawLayout = findViewById(R.id.drawLayout);
-        TextView openFileView = findViewById(R.id.open_file_view);
+        TextView openFileView = findViewById(R.id.open_file_button);
         openFileView.setOnClickListener(this);
 
 
@@ -458,7 +457,7 @@ public class LibreOfficeUIActivity extends 
AppCompatActivity implements Settings
             } else {
                 expandFabMenu();
             }
-        } else if (id == R.id.open_file_view) {
+        } else if (id == R.id.open_file_button) {
             showSystemFilePickerAndOpenFile();
         } else if (id == R.id.newWriterFAB) {
             loadNewDocument(DocumentType.WRITER);
commit 31a689b83112bfa057c2f7f8306b875b9a2ac7c7
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Nov 28 15:04:42 2023 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Nov 30 12:17:00 2023 +0100

    tdf#124480 android: Use themed color for icon on start activity
    
    Similar to how
    
            Change-Id I2061878067d21dcd743ad6ca8d1018db323755d6
            Author: Michael Weghorn <m.wegh...@posteo.de>
            Date:   Tue Nov 28 14:22:54 2023 +0100
    
                tdf#124480 android: Use themed color for more icons
    
    did for the icons in the toolbars, use the themed color for
    the directory icon in the start activity as well.
    While at it, switch to using the same shade of gray that
    the toolbar icons also use.
    And rename the icon to drop the "_grey" suffix, since this
    is now themed and no longer using a hard-coded color.
    
    Change-Id: I9fcf51b712a01aab3b9754bcfbd817c89171a64f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160075
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/android/source/res/drawable-hdpi/ic_folder_grey_48dp.xml 
b/android/source/res/drawable-hdpi/ic_folder_48dp.xml
similarity index 53%
rename from android/source/res/drawable-hdpi/ic_folder_grey_48dp.xml
rename to android/source/res/drawable-hdpi/ic_folder_48dp.xml
index c652bf48eb32..7eec9b367f00 100644
--- a/android/source/res/drawable-hdpi/ic_folder_grey_48dp.xml
+++ b/android/source/res/drawable-hdpi/ic_folder_48dp.xml
@@ -1,5 +1,5 @@
 <vector android:autoMirrored="true" android:height="48dp"
     android:viewportHeight="24.0" android:viewportWidth="24.0"
     android:width="48dp" 
xmlns:android="http://schemas.android.com/apk/res/android";>
-    <path android:fillColor="#FF606060" android:pathData="M10,4H4c-1.1,0 
-1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V8c0,-1.1 -0.9,-2 
-2,-2h-8l-2,-2z"/>
+    <path android:fillColor="@color/toolbar_foreground" 
android:pathData="M10,4H4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 
2,2h16c1.1,0 2,-0.9 2,-2V8c0,-1.1 -0.9,-2 -2,-2h-8l-2,-2z"/>
 </vector>
diff --git a/android/source/res/layout/activity_document_browser.xml 
b/android/source/res/layout/activity_document_browser.xml
index 5f03d4bc0c28..23666b11c6e4 100644
--- a/android/source/res/layout/activity_document_browser.xml
+++ b/android/source/res/layout/activity_document_browser.xml
@@ -84,7 +84,7 @@
                         android:gravity="center_vertical"
                         android:text="@string/select_file_to_open"
                         android:textSize="14dp"
-                        app:drawableLeftCompat="@drawable/ic_folder_grey_48dp" 
/>
+                        app:drawableLeftCompat="@drawable/ic_folder_48dp" />
                 </LinearLayout>
 
                 <TextView

Reply via email to