Quellcode durchsuchen

[android] use single shortcuts.xml

using Gradle plugin https://github.com/Zellius/android-shortcut-gradle-plugin
Andrey Filipenkov vor 3 Monaten
Ursprung
Commit
3c400e6992

+ 1 - 1
android/AndroidManifest.xml

@@ -44,7 +44,7 @@
 				<category android:name="android.intent.category.LAUNCHER"/>
 			</intent-filter>
 
-			<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts${applicationVariant}" /> 
+			<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" /> 
 
 			<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
 			<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>

+ 4 - 0
android/build.gradle

@@ -3,9 +3,13 @@ buildscript {
 	repositories {
 		google()
 		mavenCentral()
+		maven {
+			url 'https://www.jitpack.io'
+		}
 	}
 	dependencies {
 		classpath 'com.android.tools.build:gradle:8.11.0'
+		classpath 'com.github.zellius:android-shortcut-gradle-plugin:0.1.2'
 
 		// NOTE: Do not place your application dependencies here; they belong
 		// in the individual module build.gradle files

+ 0 - 1
android/vcmi-app/src/main/res/xml/shortcuts.xml → android/shortcuts.xml

@@ -7,7 +7,6 @@
 		android:shortcutLongLabel="@string/shortcut_play">
 		<intent
 			android:action="android.intent.action.VIEW"
-			android:targetPackage="is.xyz.vcmi"
 			android:targetClass="eu.vcmi.vcmi.VcmiSDLActivity" />
 	</shortcut>
 </shortcuts>

+ 3 - 0
android/vcmi-app/build.gradle

@@ -1,4 +1,5 @@
 apply plugin: 'com.android.application'
+apply plugin: 'com.github.zellius.shortcut-helper'
 
 android {
 	/*******************************************************
@@ -102,6 +103,8 @@ android {
 	}
 }
 
+shortcutHelper.filePath = "../shortcuts.xml"
+
 def SigningPropertiesPath(final basePath, final signingConfigKey) {
 	return file("${basePath}/${signingConfigKey}.properties")
 }

+ 0 - 13
android/vcmi-app/src/main/res/xml/shortcutsdaily.xml

@@ -1,13 +0,0 @@
-<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
-	<shortcut
-		android:shortcutId="play"
-		android:enabled="true"
-		android:icon="@mipmap/ic_launcher"
-		android:shortcutShortLabel="@string/shortcut_play"
-		android:shortcutLongLabel="@string/shortcut_play">
-		<intent
-			android:action="android.intent.action.VIEW"
-			android:targetPackage="is.xyz.vcmi.daily"
-			android:targetClass="eu.vcmi.vcmi.VcmiSDLActivity" />
-	</shortcut>
-</shortcuts>

+ 0 - 13
android/vcmi-app/src/main/res/xml/shortcutsdebug.xml

@@ -1,13 +0,0 @@
-<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
-	<shortcut
-		android:shortcutId="play"
-		android:enabled="true"
-		android:icon="@mipmap/ic_launcher"
-		android:shortcutShortLabel="@string/shortcut_play"
-		android:shortcutLongLabel="@string/shortcut_play">
-		<intent
-			android:action="android.intent.action.VIEW"
-			android:targetPackage="is.xyz.vcmi.debug"
-			android:targetClass="eu.vcmi.vcmi.VcmiSDLActivity" />
-	</shortcut>
-</shortcuts>