]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Fix app icon on Android versions < 5.0
authorTobias Brunner <tobias@strongswan.org>
Wed, 15 Jan 2020 13:12:07 +0000 (14:12 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 2 Jun 2020 11:57:37 +0000 (13:57 +0200)
XML resources are apparently not supported there.  Moving the icon to
the mipmap folders should fix that.  Aliases are defined for the icons on
Android < 8.0.

src/frontends/android/app/src/main/java/org/strongswan/android/ui/MainActivity.java
src/frontends/android/app/src/main/java/org/strongswan/android/ui/TrustedCertificateImportActivity.java
src/frontends/android/app/src/main/res/mipmap-anydpi/ic_shortcut.xml [deleted file]
src/frontends/android/app/src/main/res/mipmap-hdpi/ic_app.png [moved from src/frontends/android/app/src/main/res/drawable-hdpi/ic_launcher.png with 100% similarity]
src/frontends/android/app/src/main/res/mipmap-mdpi/ic_app.png [moved from src/frontends/android/app/src/main/res/drawable-mdpi/ic_launcher.png with 100% similarity]
src/frontends/android/app/src/main/res/mipmap-xhdpi/ic_app.png [moved from src/frontends/android/app/src/main/res/drawable-xhdpi/ic_launcher.png with 100% similarity]
src/frontends/android/app/src/main/res/values/mipmaps.xml [moved from src/frontends/android/app/src/main/res/mipmap-anydpi/ic_launcher.xml with 78% similarity]

index b00f3b20587ac62f07b5683665ef81d41731f9b0..18953d18581e5d8bb32320f0d3ecb403dcec56a2 100644 (file)
@@ -66,7 +66,7 @@ public class MainActivity extends AppCompatActivity implements OnVpnProfileSelec
                ActionBar bar = getSupportActionBar();
                bar.setDisplayShowHomeEnabled(true);
                bar.setDisplayShowTitleEnabled(false);
-               bar.setIcon(R.drawable.ic_launcher);
+               bar.setIcon(R.mipmap.ic_app);
 
                /* load CA certificates in a background task */
                new LoadCertificatesTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
index 4581d44274a4731461b644742646db19b4785e06..0beabd465f290caf18a540677a0db861c995a222 100644 (file)
@@ -202,7 +202,7 @@ public class TrustedCertificateImportActivity extends AppCompatActivity
                        certificate = (X509Certificate)getArguments().getSerializable(VpnProfileDataSource.KEY_CERTIFICATE);
 
                        return new AlertDialog.Builder(getActivity())
-                               .setIcon(R.drawable.ic_launcher)
+                               .setIcon(R.mipmap.ic_app)
                                .setTitle(R.string.import_certificate)
                                .setMessage(certificate.getSubjectDN().toString())
                                .setPositiveButton(R.string.import_certificate, new DialogInterface.OnClickListener()
diff --git a/src/frontends/android/app/src/main/res/mipmap-anydpi/ic_shortcut.xml b/src/frontends/android/app/src/main/res/mipmap-anydpi/ic_shortcut.xml
deleted file mode 100644 (file)
index 653d080..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-    Copyright (C) 2018 Tobias Brunner
-    HSR Hochschule fuer Technik Rapperswil
-
-    This program is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the
-    Free Software Foundation; either version 2 of the License, or (at your
-    option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
-
-    This program is distributed in the hope that it will be useful, but
-    WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-    for more details.
--->
-<inset xmlns:android="http://schemas.android.com/apk/res/android"
-    android:drawable="@drawable/ic_launcher" />
\ No newline at end of file
similarity index 78%
rename from src/frontends/android/app/src/main/res/mipmap-anydpi/ic_launcher.xml
rename to src/frontends/android/app/src/main/res/values/mipmaps.xml
index 653d080060360de3dafe9fb46b2b4de1f152f61f..9711350a0762a677d4647c0de48efa55be05d631 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-    Copyright (C) 2018 Tobias Brunner
+    Copyright (C) 2020 Tobias Brunner
     HSR Hochschule fuer Technik Rapperswil
 
     This program is free software; you can redistribute it and/or modify it
@@ -13,5 +13,7 @@
     or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     for more details.
 -->
-<inset xmlns:android="http://schemas.android.com/apk/res/android"
-    android:drawable="@drawable/ic_launcher" />
\ No newline at end of file
+<resources>
+    <mipmap name="ic_launcher">@mipmap/ic_app</mipmap>
+    <mipmap name="ic_shortcut">@mipmap/ic_app</mipmap>
+</resources>