1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Merge pull request #6082 from kambala-decapitator/android-improvements

Android improvements
This commit is contained in:
Ivan Savenko
2025-09-07 16:10:33 +03:00
committed by GitHub
10 changed files with 46 additions and 37 deletions

View File

@@ -736,9 +736,7 @@ if(ANDROID)
if(ANDROID_STL MATCHES "_shared$") if(ANDROID_STL MATCHES "_shared$")
set(stlLibName "${CMAKE_SHARED_LIBRARY_PREFIX}${ANDROID_STL}${CMAKE_SHARED_LIBRARY_SUFFIX}") set(stlLibName "${CMAKE_SHARED_LIBRARY_PREFIX}${ANDROID_STL}${CMAKE_SHARED_LIBRARY_SUFFIX}")
install(FILES "${CMAKE_SYSROOT}/usr/lib/${ANDROID_SYSROOT_LIB_SUBDIR}/${stlLibName}" vcmi_install_libs_symlink("${CMAKE_SYSROOT}/usr/lib/${ANDROID_SYSROOT_LIB_SUBDIR}/${stlLibName}")
DESTINATION ${LIB_DIR}
)
endif() endif()
else() else()
install(DIRECTORY config DESTINATION ${DATA_DIR}) install(DIRECTORY config DESTINATION ${DATA_DIR})

View File

@@ -31,7 +31,9 @@
android:label="${applicationLabel}" android:label="${applicationLabel}"
android:testOnly="false" android:testOnly="false"
android:supportsRtl="true" android:supportsRtl="true"
android:usesCleartextTraffic="false"> android:usesCleartextTraffic="false"
android:theme="@style/AppTheme"
>
<activity <activity
android:name=".ActivityLauncher" android:name=".ActivityLauncher"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
@@ -42,7 +44,7 @@
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter> </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.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>

View File

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

View File

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

View File

@@ -1,4 +1,5 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'com.github.zellius.shortcut-helper'
android { android {
/******************************************************* /*******************************************************
@@ -36,8 +37,6 @@ android {
versionCode 1700 versionCode 1700
versionName "1.7.0" versionName "1.7.0"
setProperty("archivesBaseName", "vcmi")
} }
sourceSets { sourceSets {
@@ -102,6 +101,9 @@ android {
} }
} }
base.archivesName = "vcmi"
shortcutHelper.filePath = "../shortcuts.xml"
def SigningPropertiesPath(final basePath, final signingConfigKey) { def SigningPropertiesPath(final basePath, final signingConfigKey) {
return file("${basePath}/${signingConfigKey}.properties") return file("${basePath}/${signingConfigKey}.properties")
} }
@@ -147,6 +149,9 @@ def LoadSigningConfig(final signingConfigKey) {
dependencies { dependencies {
implementation fileTree(dir: '../libs', include: ['*.jar', '*.aar']) implementation fileTree(dir: '../libs', include: ['*.jar', '*.aar'])
implementation 'androidx.annotation:annotation:1.7.1' implementation('androidx.annotation:annotation:1.9.1')
implementation 'androidx.documentfile:documentfile:1.0.1'
// later versions require API level 21
implementation('androidx.appcompat:appcompat:1.6.1')
implementation('androidx.documentfile:documentfile:1.0.1')
} }

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
<!-- for Android 15 + SDK 35 -->
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>
</resources>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@style/Theme.AppCompat.NoActionBar" />
</resources>

View File

@@ -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>

View File

@@ -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>

View File

@@ -118,6 +118,18 @@ function(vcmi_print_git_commit_hash)
endfunction() endfunction()
# install(FILES) of shared libs but using symlink instead of copying
function(vcmi_install_libs_symlink libs)
install(CODE "
foreach(lib ${libs})
cmake_path(GET lib FILENAME filename)
file(CREATE_LINK \${lib} \"\${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/\${filename}\"
COPY_ON_ERROR SYMBOLIC
)
endforeach()
")
endfunction()
# install dependencies from Conan, CONAN_RUNTIME_LIBS_FILE is set in conanfile.py # install dependencies from Conan, CONAN_RUNTIME_LIBS_FILE is set in conanfile.py
function(vcmi_install_conan_deps) function(vcmi_install_conan_deps)
if(NOT USING_CONAN) if(NOT USING_CONAN)
@@ -125,7 +137,11 @@ function(vcmi_install_conan_deps)
endif() endif()
file(STRINGS "${CONAN_RUNTIME_LIBS_FILE}" runtimeLibs) file(STRINGS "${CONAN_RUNTIME_LIBS_FILE}" runtimeLibs)
install(FILES ${runtimeLibs} DESTINATION ${LIB_DIR}) if(ANDROID)
vcmi_install_libs_symlink("${runtimeLibs}")
else()
install(FILES ${runtimeLibs} DESTINATION ${LIB_DIR})
endif()
endfunction() endfunction()
function(vcmi_deploy_qt deployQtToolName deployQtOptions) function(vcmi_deploy_qt deployQtToolName deployQtOptions)