├── settings.gradle ├── README.md ├── app ├── proguard-gradle-repackage.txt ├── src │ └── main │ │ ├── res │ │ ├── drawable │ │ │ ├── ic_launcher.png │ │ │ ├── new_dark_button_disabled.xml │ │ │ ├── new_dark_button_bg.xml │ │ │ ├── new_dark_button_selected.xml │ │ │ └── btn_gray.xml │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── strings.xml │ │ │ ├── dimen.xml │ │ │ └── styles.xml │ │ └── layout │ │ │ └── main_layout.xml │ │ ├── assets │ │ └── plugin.xml │ │ ├── java │ │ └── com │ │ │ └── atakmap │ │ │ └── android │ │ │ └── plugintemplate │ │ │ ├── plugin │ │ │ ├── PluginTemplatePluginTool.java │ │ │ ├── PluginTemplateLifeCycle.java │ │ │ └── PluginTemplateNativeLoader.java │ │ │ ├── PluginTemplateMapComponent.java │ │ │ └── PluginTemplateDropDownReceiver.java │ │ └── AndroidManifest.xml ├── proguard-gradle.txt └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── .gitattributes ├── LICENSE ├── .gitignore ├── gradlew.bat └── gradlew /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ATAK-Plugin-Template 2 | plugin template for ATAK-CIV 5.1.0.x 3 | -------------------------------------------------------------------------------- /app/proguard-gradle-repackage.txt: -------------------------------------------------------------------------------- 1 | -repackageclasses atakplugin.plugintemplate -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hellikandra/atak-plugin-template/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hellikandra/atak-plugin-template/HEAD/app/src/main/res/drawable/ic_launcher.png -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xms256m -Xmx4096m 2 | org.gradle.daemon=false 3 | org.gradle.parallel=false 4 | android.enableR8=false 5 | android.useAndroidX=true -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.gradle text eol=lf 3 | *.java text eol=lf 4 | *.xml text eol=lf 5 | *.md text eol=lf 6 | *.txt text eol=lf 7 | *.properties text eol=lf 8 | *.sh text eol=lf 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #ffffff 5 | #121212 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Plugin Template 5 | 6 | This plugin demonstrate bare bones plugin UI, and may be used to start a new plugin project. 7 | -------------------------------------------------------------------------------- /app/src/main/assets/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/new_dark_button_disabled.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/new_dark_button_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/new_dark_button_selected.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/btn_gray.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | 15 | 18 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/atakmap/android/plugintemplate/plugin/PluginTemplatePluginTool.java: -------------------------------------------------------------------------------- 1 | package com.atakmap.android.plugintemplate.plugin; 2 | 3 | // ----- Android API import ----- //; 4 | import android.content.Context; 5 | 6 | // ----- ATAK API import ----- // 7 | import com.atak.plugins.impl.AbstractPluginTool; 8 | 9 | public class PluginTemplatePluginTool extends AbstractPluginTool 10 | { 11 | /** ************************* CONSTRUCTOR ************************* **/ 12 | public PluginTemplatePluginTool (final Context context) 13 | { 14 | super(context, context.getString(R.string.app_name), context.getString(R.string.app_name), 15 | context.getResources().getDrawable(R.drawable.ic_launcher), 16 | "com.atakmap.android.plugintemplate.SHOW_PLUGIN"); 17 | PluginTemplateNativeLoader.init(context); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/atakmap/android/plugintemplate/plugin/PluginTemplateLifeCycle.java: -------------------------------------------------------------------------------- 1 | package com.atakmap.android.plugintemplate.plugin; 2 | 3 | // ----- Android API import ----- // 4 | 5 | // ----- Local API import ----- // 6 | 7 | // ----- ATAK API import ----- // 8 | import com.atak.plugins.impl.AbstractPlugin; 9 | import com.atak.plugins.impl.PluginContextProvider; 10 | import com.atakmap.android.maps.MapComponent; 11 | import com.atakmap.android.plugintemplate.PluginTemplateMapComponent; 12 | 13 | import gov.tak.api.plugin.IServiceController; 14 | 15 | public class PluginTemplateLifeCycle extends AbstractPlugin 16 | { 17 | /** ************************* CONSTRUCTOR ************************* **/ 18 | public PluginTemplateLifeCycle (IServiceController isc) 19 | { 20 | super(isc, new PluginTemplatePluginTool(((PluginContextProvider) isc.getService(PluginContextProvider.class)).getPluginContext()), 21 | (MapComponent) new PluginTemplateMapComponent()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14sp 6 | 7 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Hellikandra 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/proguard-gradle.txt: -------------------------------------------------------------------------------- 1 | -dontskipnonpubliclibraryclasses 2 | -dontshrink 3 | -dontoptimize 4 | 5 | ############### ACRA specifics 6 | # we need line numbers in our stack traces otherwise they are pretty useless 7 | -renamesourcefileattribute SourceFile 8 | -keepattributes SourceFile,LineNumberTable 9 | 10 | -applymapping 11 | -repackageclasses atakplugin.helloworld 12 | 13 | -keepattributes *Annotation* 14 | -keepattributes Signature, InnerClasses 15 | 16 | 17 | -keep class * implements android.os.Parcelable { 18 | public static final android.os.Parcelable$Creator *; 19 | } 20 | 21 | -keepclassmembers class **.R$* { 22 | public static ; 23 | } 24 | 25 | # For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations 26 | -keepclassmembers enum * { 27 | public static **[] values(); 28 | public static ** valueOf(java.lang.String); 29 | } 30 | 31 | 32 | 33 | # Preserve all native method names and the names of their classes. 34 | -keepclasseswithmembernames class * { 35 | native ; 36 | } 37 | 38 | -keepclassmembers class * { 39 | @org.simpleframework.xml.* *; 40 | } 41 | 42 | 43 | # For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations 44 | -keepclassmembers enum * { 45 | public static **[] values(); 46 | public static ** valueOf(java.lang.String); 47 | } 48 | 49 | 50 | 51 | -keep class * extends transapps.maps.plugin.tool.Tool { 52 | } 53 | -keep class * implements gov.tak.api.plugin.IPlugin { 54 | } 55 | 56 | -dontwarn androidx.** 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/atakmap/android/plugintemplate/PluginTemplateMapComponent.java: -------------------------------------------------------------------------------- 1 | package com.atakmap.android.plugintemplate; 2 | 3 | // ----- Android API import ----- // 4 | import android.content.Context; 5 | import android.content.Intent; 6 | 7 | // ----- Local App import ----- // 8 | import com.atakmap.android.ipc.AtakBroadcast.DocumentedIntentFilter; 9 | import com.atakmap.android.plugintemplate.plugin.R; 10 | 11 | // ----- ATAK API import ----- // 12 | import com.atakmap.coremap.log.Log; 13 | import com.atakmap.android.dropdown.DropDownMapComponent; 14 | import com.atakmap.android.maps.MapView; 15 | 16 | 17 | public class PluginTemplateMapComponent extends DropDownMapComponent 18 | { 19 | private static final String TAG = "PluginTemplateMapComponent"; 20 | private Context pluginContext; 21 | private PluginTemplateDropDownReceiver ddr; 22 | 23 | public PluginTemplateMapComponent() { 24 | super(); 25 | } 26 | 27 | 28 | public void onCreate (final Context context, Intent intent, final MapView view) 29 | { 30 | context.setTheme(R.style.ATAKPluginTheme); 31 | super.onCreate(context, intent, view); 32 | pluginContext = context; 33 | 34 | ddr = new PluginTemplateDropDownReceiver(view, context); 35 | 36 | Log.d(TAG, "registering the plugin filter"); 37 | DocumentedIntentFilter ddFilter = new DocumentedIntentFilter(); 38 | ddFilter.addAction(PluginTemplateDropDownReceiver.SHOW_PLUGIN); 39 | registerDropDownReceiver(ddr, ddFilter); 40 | } 41 | 42 | @Override 43 | protected void onDestroyImpl (Context context, MapView view) 44 | { 45 | super.onDestroyImpl(context, view); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.aar 4 | *.ap_ 5 | *.aab 6 | 7 | # Files for the ART/Dalvik VM 8 | *.dex 9 | 10 | # Java class files 11 | *.class 12 | 13 | # Generated files 14 | bin/ 15 | gen/ 16 | out/ 17 | # Uncomment the following line in case you need and you don't have the release build type files in your app 18 | # release/ 19 | 20 | # Gradle files 21 | .gradle/ 22 | build/ 23 | 24 | # Local configuration file (sdk path, etc) 25 | local.properties 26 | 27 | # Proguard folder generated by Eclipse 28 | proguard/ 29 | 30 | # Log Files 31 | *.log 32 | 33 | # Android Studio Navigation editor temp files 34 | .navigation/ 35 | 36 | # Android Studio captures folder 37 | captures/ 38 | 39 | # IntelliJ 40 | *.iml 41 | .idea/workspace.xml 42 | .idea/tasks.xml 43 | .idea/gradle.xml 44 | .idea/assetWizardSettings.xml 45 | .idea/dictionaries 46 | .idea/libraries 47 | # Android Studio 3 in .gitignore file. 48 | .idea/caches 49 | .idea/modules.xml 50 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 51 | .idea/navEditor.xml 52 | 53 | # Keystore files 54 | # Uncomment the following lines if you do not want to check your keystore files in. 55 | *.jks 56 | *.keystore 57 | 58 | # External native build folder generated in Android Studio 2.2 and later 59 | .externalNativeBuild 60 | .cxx/ 61 | 62 | # Google Services (e.g. APIs or Firebase) 63 | # google-services.json 64 | 65 | # Freeline 66 | freeline.py 67 | freeline/ 68 | freeline_project_description.json 69 | 70 | # fastlane 71 | fastlane/report.xml 72 | fastlane/Preview.html 73 | fastlane/screenshots 74 | fastlane/test_output 75 | fastlane/readme.md 76 | 77 | # Version control 78 | vcs.xml 79 | 80 | # lint 81 | lint/intermediates/ 82 | lint/generated/ 83 | lint/outputs/ 84 | lint/tmp/ 85 | # lint/reports/ 86 | 87 | # takdev folder generated under docker environment 88 | .takdev 89 | -------------------------------------------------------------------------------- /app/src/main/res/layout/main_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 18 | 19 | 20 | 26 | 27 | 32 | 33 | 34 | 35 | 41 | 42 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/atakmap/android/plugintemplate/plugin/PluginTemplateNativeLoader.java: -------------------------------------------------------------------------------- 1 | 2 | package com.atakmap.android.plugintemplate.plugin; 3 | 4 | import java.io.File; 5 | import android.content.Context; 6 | 7 | /** 8 | * Boilerplate code for loading native. 9 | */ 10 | public class PluginTemplateNativeLoader { 11 | 12 | private static final String TAG = "NativeLoader"; 13 | private static String ndl = null; 14 | 15 | /** 16 | * If a plugin wishes to make use of this class, they will need to copy it into their plugin. 17 | * The classloader that loads this class is a key component of getting System.load to work 18 | * properly. If it is desirable to use this in a plugin, it will need to be a direct copy in a 19 | * non-conflicting package name. 20 | */ 21 | synchronized static public void init(final Context context) { 22 | if (ndl == null) { 23 | try { 24 | ndl = context.getPackageManager() 25 | .getApplicationInfo(context.getPackageName(), 26 | 0).nativeLibraryDir; 27 | } catch (Exception e) { 28 | throw new IllegalArgumentException( 29 | "native library loading will fail, unable to grab the nativeLibraryDir from the package name"); 30 | } 31 | 32 | } 33 | } 34 | 35 | /** 36 | * Security guidance from our recent audit: 37 | * Pass an absolute path to System.load(). Avoid System.loadLibrary() because its behavior 38 | * depends upon its implementation which often relies on environmental features that can be 39 | * manipulated. Use only validated, sanitized absolute paths. 40 | */ 41 | 42 | public static void loadLibrary(final String name) { 43 | if (ndl != null) { 44 | final String lib = ndl + File.separator 45 | + System.mapLibraryName(name); 46 | if (new File(lib).exists()) { 47 | System.load(lib); 48 | } 49 | } else { 50 | throw new IllegalArgumentException("NativeLoader not initialized"); 51 | } 52 | 53 | } 54 | 55 | } 56 | 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/atakmap/android/plugintemplate/PluginTemplateDropDownReceiver.java: -------------------------------------------------------------------------------- 1 | package com.atakmap.android.plugintemplate; 2 | 3 | // ----- Android API import ----- // 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.view.View; 7 | 8 | // ----- Java API import ----- // 9 | 10 | // ----- Local App import ----- // 11 | import com.atakmap.android.plugintemplate.plugin.R; 12 | 13 | 14 | // ----- ATAK API import ----- // 15 | import com.atak.plugins.impl.PluginLayoutInflater; 16 | import com.atakmap.android.maps.MapView; 17 | import com.atakmap.android.dropdown.DropDown.OnStateListener; 18 | import com.atakmap.android.dropdown.DropDownReceiver; 19 | import com.atakmap.coremap.log.Log; 20 | 21 | public class PluginTemplateDropDownReceiver extends DropDownReceiver implements OnStateListener { 22 | public static final String TAG = "PluginTemplateDropDownReceiver"; 23 | public static final String SHOW_PLUGIN = "com.atakmap.android.plugintemplate.SHOW_PLUGIN"; 24 | private final View templateView; 25 | private final Context pluginContext; 26 | 27 | /** ************************* CONSTRUCTOR ************************* **/ 28 | public PluginTemplateDropDownReceiver (final MapView mapView, final Context context) { 29 | super(mapView); 30 | this.pluginContext = context; 31 | 32 | // Remember to use the PluginLayoutInflator if you are actually inflating a custom view 33 | // In this case, using it is not necessary - but I am putting it here to remind 34 | // developers to look at this Inflator 35 | templateView = PluginLayoutInflater.inflate(context, R.layout.main_layout, null); 36 | } 37 | 38 | /** ************************* PUBLIC METHODS ************************* **/ 39 | public void disposeImpl () { 40 | 41 | } 42 | 43 | /** ************************* INHERITED METHODS ************************* **/ 44 | @Override 45 | public void onReceive (Context context, Intent intent) { 46 | final String action = intent.getAction(); 47 | if (action == null) { 48 | return; 49 | } 50 | if (action.equals(SHOW_PLUGIN)) { 51 | Log.d(TAG, "showing plugin drop down"); 52 | showDropDown(templateView, HALF_WIDTH, FULL_HEIGHT, FULL_WIDTH, HALF_HEIGHT, false, this); 53 | } 54 | } 55 | 56 | @Override 57 | public void onDropDownSelectionRemoved () { 58 | } 59 | 60 | @Override 61 | public void onDropDownVisible (boolean v) { 62 | } 63 | 64 | @Override 65 | public void onDropDownSizeChanged (double width, double height) { 66 | } 67 | 68 | @Override 69 | public void onDropDownClose() { 70 | } 71 | 72 | /** ************************* PRIVATE METHODS ************************* **/ 73 | } 74 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto init 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto init 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :init 68 | @rem Get command-line arguments, handling Windows variants 69 | 70 | if not "%OS%" == "Windows_NT" goto win9xME_args 71 | 72 | :win9xME_args 73 | @rem Slurp the command line arguments. 74 | set CMD_LINE_ARGS= 75 | set _SKIP=2 76 | 77 | :win9xME_args_slurp 78 | if "x%~1" == "x" goto execute 79 | 80 | set CMD_LINE_ARGS=%* 81 | 82 | :execute 83 | @rem Setup the command line 84 | 85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 86 | 87 | @rem Execute Gradle 88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 89 | 90 | :end 91 | @rem End local scope for the variables with windows NT shell 92 | if "%ERRORLEVEL%"=="0" goto mainEnd 93 | 94 | :fail 95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 96 | rem the _cmd.exe /c_ return code! 97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 98 | exit /b 1 99 | 100 | :mainEnd 101 | if "%OS%"=="Windows_NT" endlocal 102 | 103 | :omega 104 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 40 | 41 | 42 | 46 | 53 | 54 | 55 | 63 | 64 | 65 | 68 | 69 | 76 | 77 | 78 | 83 | 84 | 85 | 86 | 89 | 90 | 95 | 96 | 97 | 98 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=`expr $i + 1` 158 | done 159 | case $i in 160 | 0) set -- ;; 161 | 1) set -- "$args0" ;; 162 | 2) set -- "$args0" "$args1" ;; 163 | 3) set -- "$args0" "$args1" "$args2" ;; 164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=`save "$@"` 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | exec "$JAVACMD" "$@" 184 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // PLUGIN_VERSION is the common version name when describing the plugin. 4 | // ATAK_VERSION is for the version of ATAK this plugin should be compatible 5 | // with some examples include 3.11.0, 3.11.0.civ 3.11.1.fvey 6 | // 7 | //////////////////////////////////////////////////////////////////////////////// 8 | 9 | buildscript { 10 | 11 | ext.PLUGIN_VERSION = "1.0" 12 | ext.ATAK_VERSION = "5.1.0" 13 | 14 | def takdevVersion = '3.+' 15 | 16 | def getValueFromPropertiesFile = { propFile, key -> 17 | if(!propFile.isFile() || !propFile.canRead()) 18 | return null 19 | def prop = new Properties() 20 | def reader = propFile.newReader() 21 | try { 22 | prop.load(reader) 23 | } finally { 24 | reader.close() 25 | } 26 | return prop.get(key) 27 | } 28 | 29 | def getProperty = { name, defValue -> 30 | def prop = project.properties[name] ?: 31 | getValueFromPropertiesFile(project.rootProject.file('local.properties'), name) 32 | return (null == prop) ? defValue : prop 33 | } 34 | 35 | def urlKey = 'takrepo.url' 36 | 37 | ext.isDevKitEnabled = { -> 38 | return getProperty(urlKey, null) != null 39 | } 40 | 41 | ext.takrepoUrl = getProperty(urlKey, 'https://localhost/') 42 | ext.takrepoUser = getProperty('takrepo.user', 'invalid') 43 | ext.takrepoPassword = getProperty('takrepo.password', 'invalid') 44 | ext.takdevPlugin = getProperty('takdev.plugin', "${rootDir}/../../atak-gradle-takdev.jar") 45 | 46 | repositories { 47 | google() 48 | mavenCentral() 49 | mavenLocal() 50 | maven { 51 | url "https://jitpack.io" 52 | } 53 | maven { 54 | url = takrepoUrl 55 | credentials { 56 | username = takrepoUser 57 | password = takrepoPassword 58 | } 59 | } 60 | } 61 | dependencies { 62 | classpath 'com.android.tools.build:gradle:7.4.2' 63 | if(isDevKitEnabled()) { 64 | classpath "com.atakmap.gradle:atak-gradle-takdev:${takdevVersion}" 65 | } else { 66 | classpath files(takdevPlugin) 67 | } 68 | } 69 | } 70 | 71 | allprojects { 72 | repositories { 73 | mavenCentral() 74 | google() 75 | mavenCentral() 76 | mavenLocal() 77 | maven { 78 | url "https://jitpack.io" 79 | } 80 | } 81 | } 82 | 83 | apply plugin: 'com.android.application' 84 | apply plugin: 'atak-takdev-plugin' 85 | 86 | 87 | def supportedFlavors = 88 | [ 89 | [ name : 'civ', default: true ], 90 | [ name : 'mil' /** example: true **/], 91 | [ name : 'aus' ], 92 | [ name : 'nzl' ], 93 | [ name : 'prt' ], 94 | [ name : 'nor' ], 95 | [ name : 'swe' ], 96 | [ name : 'gbr' ], 97 | [ name : 'can' ], 98 | [ name : 'hun' ], 99 | [ name : 'bel' ], 100 | [ name : 'est' ], 101 | [ name : 'ltu' ], 102 | [ name : 'ukr' ], 103 | [ name : 'pol' ], 104 | [ name : 'nld' ], 105 | [ name : 'esp' ], 106 | [ name : 'aeronet' ], 107 | [ name : 'gov' ], 108 | [ name : 'natosof' ], 109 | ] 110 | 111 | android { 112 | compileSdkVersion 33 113 | buildToolsVersion "30.0.3" 114 | 115 | 116 | // this is required and should not be removed otherwise the TAK 117 | // innersigning check will fail and the plugin will not load 118 | bundle { 119 | storeArchive { 120 | enable = false 121 | } 122 | } 123 | 124 | // this is required and should not be removed otherwise the 125 | // plugin will not be able to use native libraries 126 | packagingOptions { 127 | jniLibs { 128 | useLegacyPackaging = true 129 | } 130 | } 131 | 132 | 133 | lintOptions { 134 | checkReleaseBuilds true 135 | // Or, if you prefer, you can continue to check for errors in release builds, 136 | // but continue the build even when errors are found: 137 | abortOnError true 138 | } 139 | 140 | signingConfigs { 141 | debug { 142 | storeFile file("${buildDir}/android_keystore") 143 | storePassword "tnttnt" 144 | keyAlias "wintec_mapping" 145 | keyPassword "tnttnt" 146 | } 147 | release { 148 | storeFile file("${buildDir}/android_keystore") 149 | storePassword "tnttnt" 150 | keyAlias "wintec_mapping" 151 | keyPassword "tnttnt" 152 | } 153 | } 154 | 155 | buildTypes { 156 | debug { 157 | debuggable true 158 | matchingFallbacks = ['sdk'] 159 | } 160 | release { 161 | minifyEnabled true 162 | proguardFiles 'proguard-gradle.txt', 'proguard-gradle-repackage.txt' 163 | signingConfig signingConfigs.release 164 | matchingFallbacks = ['odk'] 165 | } 166 | } 167 | 168 | flavorDimensions "application" 169 | 170 | productFlavors { 171 | supportedFlavors.each { flav -> 172 | "${flav.name}" { 173 | getIsDefault().set(flav.default) 174 | dimension "application" 175 | 176 | // retain existing application identifiers for civ and mil 177 | if (!flav.name.equals("civ") && !flav.name.equals("mil")) { 178 | applicationIdSuffix = ".${flav.name}" 179 | } 180 | // resolve CIV dependency if flavor specific dependency is not available 181 | matchingFallbacks = ['civ'] 182 | 183 | // set the api version information 184 | def pluginApiFlavor = flav.name.equals('gov') ? 'CIV' : "${flav.name.toUpperCase()}" 185 | manifestPlaceholders = [atakApiVersion: "com.atakmap.app@" + ATAK_VERSION + ".${pluginApiFlavor}"] 186 | 187 | // additional variables associated with the flav can be set here once defined above 188 | // buildConfigField 'boolean', 'EXAMPLE', "${flav.example}" 189 | } 190 | } 191 | // additional variables associated with all flavors can be set here 192 | applicationVariants.all { variant -> 193 | variant.resValue "string", "versionName", variant.versionName 194 | buildConfigField 'String', 'ATAK_PACKAGE_NAME', '"com.atakmap.app.civ"' 195 | } 196 | } 197 | 198 | packagingOptions { 199 | exclude 'META-INF/INDEX.LIST' 200 | 201 | 202 | // Extract native libraries from the APK - required for plugin loading 203 | jniLibs.useLegacyPackaging true 204 | } 205 | 206 | sourceSets { 207 | main { 208 | 209 | // It is strongly encouraged that plugin developers do not modify the archiveBaseName, version code logic and version 210 | // name logic to provide for consistency within the community. 211 | setProperty("archivesBaseName", "ATAK-Plugin-" + rootProject.name + "-" + PLUGIN_VERSION + "-" + getVersionName() + "-" + ATAK_VERSION) 212 | defaultConfig.versionCode = getVersionCode() 213 | defaultConfig.versionName = PLUGIN_VERSION + " (" + getVersionName() + ") - [" + ATAK_VERSION + "]" 214 | } 215 | 216 | gov.java.srcDirs 'src/gov/java' 217 | gov.assets.srcDir 'src/gov/assets' 218 | gov.res.srcDir 'src/gov/res' 219 | 220 | // Move the build types to build-types/ 221 | // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 222 | // This moves them out of them default location under src//... which would 223 | // conflict with src/ being used by the main source set. 224 | // Adding new build types or product flavors should be accompanied 225 | // by a similar customization. 226 | debug.setRoot('build-types/debug') 227 | release.setRoot('build-types/release') 228 | 229 | } 230 | 231 | defaultConfig { 232 | minSdkVersion 21 233 | targetSdkVersion 33 234 | 235 | def runTasks = gradle.startParameter.taskNames 236 | if(runTasks.toString().contains('bundle')) { 237 | ndk { 238 | abiFilters "armeabi-v7a", "arm64-v8a" 239 | } 240 | } else { 241 | ndk { 242 | abiFilters "armeabi-v7a", "arm64-v8a", "x86" 243 | } 244 | } 245 | } 246 | } 247 | 248 | afterEvaluate { 249 | project.file('proguard-gradle-repackage.txt').text = "-repackageclasses atakplugin.${rootProject.getName()}" 250 | 251 | try { 252 | tasks.named("compile" + getCommandFlavor() + "ReleaseKotlin") { 253 | println "modifying " + getCommandFlavor().toLowerCase() + " kotlin compile options to include: -Xsam-conversions=class" 254 | kotlinOptions { 255 | freeCompilerArgs += "-Xsam-conversions=class" 256 | } 257 | } 258 | } catch (Exception ignored) { } 259 | } 260 | 261 | // modified code to find the current flavor in progress 262 | def getCommandFlavor() { 263 | String tskReqStr = getGradle().getStartParameter().getTaskRequests().toString() 264 | 265 | java.util.regex.Pattern pattern 266 | if( tskReqStr.contains( "assemble" ) ) 267 | pattern = java.util.regex.Pattern.compile("assemble(\\w+)(Release|Debug)") 268 | else if( tskReqStr.contains( "install" ) ) 269 | pattern = java.util.regex.Pattern.compile("install(\\w+)(Release|Debug)") 270 | else 271 | pattern = java.util.regex.Pattern.compile("generate(\\w+)(Release|Debug)") 272 | 273 | java.util.regex.Matcher matcher = pattern.matcher(tskReqStr) 274 | 275 | if( matcher.find() ) { 276 | return matcher.group(1) 277 | } else { 278 | return "Civ" 279 | } 280 | } 281 | 282 | 283 | dependencies { 284 | implementation fileTree(dir: 'libs', include: '*.jar') 285 | } 286 | 287 | --------------------------------------------------------------------------------