android: Use PNG icons instead of vector image for compatibility

Convert the drawable resources added in

    commit cfc73f3373
    Date:   Fri Dec 23 23:20:26 2022 +0100

        android: Add buttons to increase/decrease indent

to use PNG images (PNG export of the SVG images used previously, using
Inkscape) instead of vector drawables, since devices with old API
versions apparently don't support these vector drawables.

Trying to open any doc in an x86 AVD with API version 16
would result in LO crashing with this exception in ADB log:

    E/AndroidRuntime( 2948): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.libreoffice/org.libreoffice.LibreOfficeMainActivity}: android.view.InflateException: Binary XML file line #281: Error inflating class ImageButton
    E/AndroidRuntime( 2948):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
    E/AndroidRuntime( 2948):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
    E/AndroidRuntime( 2948):        at android.app.ActivityThread.access$600(ActivityThread.java:130)
    E/AndroidRuntime( 2948):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
    E/AndroidRuntime( 2948):        at android.os.Handler.dispatchMessage(Handler.java:99)
    E/AndroidRuntime( 2948):        at android.os.Looper.loop(Looper.java:137)
    E/AndroidRuntime( 2948):        at android.app.ActivityThread.main(ActivityThread.java:4745)
    E/AndroidRuntime( 2948):        at java.lang.reflect.Method.invokeNative(Native Method)
    E/AndroidRuntime( 2948):        at java.lang.reflect.Method.invoke(Method.java:511)
    E/AndroidRuntime( 2948):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
    E/AndroidRuntime( 2948):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    E/AndroidRuntime( 2948):        at dalvik.system.NativeStart.main(Native Method)
    E/AndroidRuntime( 2948): Caused by: android.view.InflateException: Binary XML file line #281: Error inflating class ImageButton
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
    E/AndroidRuntime( 2948):        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:710)
    E/AndroidRuntime( 2948):        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
    E/AndroidRuntime( 2948):        at org.libreoffice.LibreOfficeMainActivity.onCreate(LibreOfficeMainActivity.java:131)
    E/AndroidRuntime( 2948):        at android.app.Activity.performCreate(Activity.java:5008)
    E/AndroidRuntime( 2948):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
    E/AndroidRuntime( 2948):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
    E/AndroidRuntime( 2948):        ... 11 more
    E/AndroidRuntime( 2948): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/ic_incrementindent.xml from drawable resource ID #0x7f0800b4
    E/AndroidRuntime( 2948):        at android.content.res.Resources.loadDrawable(Resources.java:1923)
    E/AndroidRuntime( 2948):        at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
    E/AndroidRuntime( 2948):        at android.widget.ImageView.<init>(ImageView.java:120)
    E/AndroidRuntime( 2948):        at android.widget.ImageButton.<init>(ImageButton.java:87)
    E/AndroidRuntime( 2948):        at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:78)
    E/AndroidRuntime( 2948):        at androidx.appcompat.widget.AppCompatImageButton.<init>(AppCompatImageButton.java:73)
    E/AndroidRuntime( 2948):        at androidx.appcompat.app.AppCompatViewInflater.createImageButton(AppCompatViewInflater.java:226)
    E/AndroidRuntime( 2948):        at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:141)
    E/AndroidRuntime( 2948):        at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1569)
    E/AndroidRuntime( 2948):        at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1620)
    E/AndroidRuntime( 2948):        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675)
    E/AndroidRuntime( 2948):        ... 32 more
    E/AndroidRuntime( 2948): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #5: invalid drawable tag vector
    E/AndroidRuntime( 2948):        at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:877)
    E/AndroidRuntime( 2948):        at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818)
    E/AndroidRuntime( 2948):        at android.content.res.Resources.loadDrawable(Resources.java:1920)
    E/AndroidRuntime( 2948):        ... 42 more
    W/ActivityManager( 1423):   Force finishing activity org.libreoffice/.LibreOfficeMainActivity
    W/ActivityManager( 1423):   Force finishing activity org.libreoffice/.ui.LibreOfficeUIActivity

Change-Id: I3580faf5e4b1f55acdc3d32caa8a233bb09a14aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144848
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2022-12-28 10:10:19 +01:00
parent cfaee17c0e
commit a510543a46
4 changed files with 6 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 B

View File

@@ -1,9 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="m3,3v2h26v-2zM10.5,9c-0.239,0.029 -0.362,0.145 -0.518,0.328l-6.615,5.896a1,1 0,0 1,-0.002 0.002l-0.002,0.002a1,1 0,0 0,-0.064 0.059c-0.001,0.001 -0.003,0.003 -0.004,0.004a1,1 0,0 0,-0.057 0.061c-0.002,0.002 -0.004,0.005 -0.006,0.008a1,1 0,0 0,-0.049 0.063c-0.002,0.003 -0.004,0.005 -0.006,0.008a1,1 0,0 0,-0.041 0.066c-0.002,0.003 -0.002,0.007 -0.004,0.01a1,1 0,0 0,-0.037 0.068c-0.002,0.004 -0.004,0.008 -0.006,0.012a1,1 0,0 0,-0.018 0.043,1 1,0 0,0 -0.021,0.061 1,1 0,0 0,-0.016 0.049c-0.001,0.004 -0.001,0.008 -0.002,0.012 -0.006,0.023 -0.011,0.046 -0.016,0.07a1,1 0,0 0,-0.002 0.004c-0.004,0.024 -0.007,0.049 -0.01,0.074a1,1 0,0 0,-0.006 0.102c-0,0.178 0.048,0.35 0.135,0.5 0.059,0.102 0.135,0.195 0.229,0.271l0.002,0.002 0.002,0.002 6.615,5.896c0.156,0.183 0.279,0.299 0.518,0.328h1.5v-7,-7zM14,9v2h15v-2zM14,15v2h15v-2zM14,21v2h15v-2zM3,27v2h20v-2z"
android:fillColor="#2e3436"/>
</vector>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/decrementindent"
android:tint="@color/toolbar_foreground"/>

View File

@@ -1,9 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="m3,3v2h26v-2zM3,9v7,7h1.5c0.239,-0.029 0.362,-0.145 0.518,-0.328l6.615,-5.896 0.002,-0.002 0.002,-0.002c0.093,-0.077 0.17,-0.169 0.229,-0.271 0.087,-0.15 0.135,-0.322 0.135,-0.5a1,1 0,0 0,-0.006 -0.102c-0.003,-0.025 -0.005,-0.05 -0.01,-0.074a1,1 0,0 0,-0.002 -0.004c-0.004,-0.024 -0.01,-0.047 -0.016,-0.07 -0.001,-0.004 -0.001,-0.008 -0.002,-0.012a1,1 0,0 0,-0.016 -0.049,1 1,0 0,0 -0.021,-0.061 1,1 0,0 0,-0.018 -0.043c-0.002,-0.004 -0.004,-0.008 -0.006,-0.012a1,1 0,0 0,-0.037 -0.068c-0.002,-0.003 -0.002,-0.007 -0.004,-0.01a1,1 0,0 0,-0.041 -0.066c-0.002,-0.003 -0.004,-0.005 -0.006,-0.008a1,1 0,0 0,-0.049 -0.063c-0.002,-0.003 -0.004,-0.005 -0.006,-0.008a1,1 0,0 0,-0.057 -0.061c-0.001,-0.001 -0.003,-0.003 -0.004,-0.004a1,1 0,0 0,-0.064 -0.059c-0.001,-0.001 -0.001,-0.001 -0.002,-0.002a1,1 0,0 0,-0.002 -0.002l-6.615,-5.896c-0.156,-0.183 -0.279,-0.299 -0.518,-0.328zM14,9v2h15v-2zM14,15v2h15v-2zM14,21v2h15v-2zM3,27v2h20v-2z"
android:fillColor="#2e3436"/>
</vector>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/incrementindent"
android:tint="@color/toolbar_foreground"/>