diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 8fb1504b..dda1af13 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -10,11 +10,15 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- - name: set up JDK 16
+ - name: set up JDK 17
uses: actions/setup-java@v3
with:
- java-version: 16
+ java-version: 17
distribution: 'adopt'
+ - name: Setup Keystore
+ run: |
+ echo "${{ secrets.SIGNING_KEY }}" > release.b64
+ base64 -d release.b64 > release.keystore
- name: mobsfscan
uses: MobSF/mobsfscan@0.2.0
with:
@@ -24,21 +28,30 @@ jobs:
with:
sarif_file: results.sarif
- name: Build with Gradle
- run: ./gradlew assembleRelease -PRELEASE_MAPS_MAPCACHE_API_KEY=${{ secrets.RELEASE_MAPS_MAPCACHE_API_KEY }}
- - name: Sign APK
- uses: r0adkll/sign-android-release@v1
+ run: |
+ ./gradlew clean assembleRelease \
+ -PKEYSTORE=../release.keystore \
+ -PKEYSTORE_PASSWORD=${{ secrets.KEY_STORE_PASSWORD }} \
+ -PKEY_ALIAS=${{ secrets.ALIAS }} \
+ -PKEY_PASSWORD=${{ secrets.KEY_PASSWORD }} \
+ -PRELEASE_MAPS_MAPCACHE_API_KEY=${{ secrets.RELEASE_MAPS_MAPCACHE_API_KEY }}
+ - run: ./gradlew lint
+ - uses: yutailang0119/action-android-lint@v3.1.0
+ with:
+ report-path: build/reports/*.xml
+ follow-symbolic-links: true
+ - name: print lint xml results
+ uses: hidakatsuya/action-report-android-lint@v1.1.4
with:
- releaseDirectory: mapcache/build/outputs/apk/release
- signingKeyBase64: ${{ secrets.SIGNING_KEY }}
- alias: ${{ secrets.ALIAS }}
- keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
- keyPassword: ${{ secrets.KEY_PASSWORD }}
- - name: Copy Release Artifacts
+ result-path: 'mapcache/build/reports/lint-results-debug.xml'
+ fail-on-warning: false
+ - name: Verify Signature
+ run: $ANDROID_SDK_ROOT/build-tools/33.0.1/apksigner verify --print-certs mapcache/build/outputs/apk/release/mapcache.apk
+ - name: List files in the repository
run: |
- mkdir mapcache/build/release
- cp mapcache/build/outputs/apk/release/mapcache-*-signed.apk "mapcache/build/release/mapcache-$(./gradlew mapcache:androidAppVersion | grep versionName | sed 's/^.*@//').apk"
+ ls -R ${{ github.workspace }}
- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: mapcache
- path: mapcache/build/release
+ path: mapcache/build/outputs/apk/release/mapcache.apk
diff --git a/build.gradle b/build.gradle
index 2f11efd3..cd034d86 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = '1.7.10'
+ ext.kotlin_version = '1.8.0'
repositories {
google()
diff --git a/mapcache/build.gradle b/mapcache/build.gradle
index bb85176c..6f5df095 100644
--- a/mapcache/build.gradle
+++ b/mapcache/build.gradle
@@ -4,7 +4,7 @@ def googleMapsApiReleaseKey = hasProperty('RELEASE_MAPS_MAPCACHE_API_KEY') ? REL
def googleMapsApiKeyDebug = hasProperty('DEBUG_MAPS_API_KEY') ? DEBUG_MAPS_API_KEY : ''
android {
- compileSdkVersion 33
+ compileSdkVersion 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
@@ -22,14 +22,33 @@ android {
resValue "string", "applicationId", applicationId
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
minSdkVersion 28
- targetSdkVersion 33
- versionCode 59
- versionName '2.1.10'
+ targetSdkVersion 34
+ versionCode 64
+ versionName '2.1.11'
multiDexEnabled true
}
+ signingConfigs {
+ release {
+ if (project.hasProperty('KEYSTORE')) {
+ println 'assigning keystore'
+ storeFile file(KEYSTORE)
+ storePassword KEYSTORE_PASSWORD
+ keyAlias KEY_ALIAS
+ keyPassword KEY_PASSWORD
+ } else {
+ println 'no keystore property configured'
+ }
+ }
+ }
buildTypes {
release {
+ applicationVariants.all { variant ->
+ variant.outputs.all {
+ outputFileName = "mapcache.apk"
+ }
+ }
minifyEnabled false
+ signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
resValue "string", "GOOGLE_MAPS_ANDROID_API_KEY", googleMapsApiReleaseKey
}
@@ -53,6 +72,11 @@ android {
}
}
}
+ lint {
+ baseline file("lint-baseline.xml")
+ checkReleaseBuilds false
+ abortOnError false
+ }
}
task androidAppVersion {
@@ -64,11 +88,12 @@ task androidAppVersion {
dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
- api 'androidx.appcompat:appcompat:1.3.0'
+ api 'androidx.appcompat:appcompat:1.6.1'
+ api 'androidx.activity:activity:1.8.1'
api 'com.google.android.material:material:1.6.0'
api 'androidx.preference:preference:1.2.1'
api 'androidx.lifecycle:lifecycle-extensions:2.2.0'
- api 'mil.nga.geopackage.map:geopackage-android-map:6.7.2' // comment out to build locally
+ api 'mil.nga.geopackage.map:geopackage-android-map:6.7.3' // comment out to build locally
//api project(':geopackage-map') // uncomment me to build locally
api 'mil.nga.mgrs:mgrs-android:2.2.2'
api 'mil.nga.gars:gars-android:1.2.2'
@@ -91,26 +116,6 @@ dependencies {
testImplementation 'androidx.test:rules:1.5.0'
}
-configure extensions.android, {
- if (project.hasProperty('RELEASE_STORE_FILE') && new File((String) project.getProperty('RELEASE_STORE_FILE')).exists()) {
- signingConfigs {
- release {
- storeFile file(RELEASE_STORE_FILE)
- storePassword RELEASE_STORE_PASSWORD
- keyAlias RELEASE_KEY_ALIAS
- keyPassword RELEASE_KEY_PASSWORD
- }
- }
- buildTypes {
- release {
- setSigningConfig(signingConfigs.release)
- }
- }
- } else {
- println 'no keystore configured'
- }
-}
-
// This is to fix the errors : java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
configurations.all {
resolutionStrategy.eachDependency { details ->
@@ -123,4 +128,4 @@ configurations.all {
}
}
-apply plugin: 'kotlin-android'
\ No newline at end of file
+apply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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mapcache/src/main/java/mil/nga/mapcache/GeoPackageMapFragment.java b/mapcache/src/main/java/mil/nga/mapcache/GeoPackageMapFragment.java
index 2e52a5b3..85300412 100644
--- a/mapcache/src/main/java/mil/nga/mapcache/GeoPackageMapFragment.java
+++ b/mapcache/src/main/java/mil/nga/mapcache/GeoPackageMapFragment.java
@@ -1643,6 +1643,16 @@ private void showDisclaimer() {
acceptButton.setOnClickListener((View view) -> {
sharedPreferences.edit().putBoolean(getString(R.string.disclaimerPref), true).apply();
disclaimerDialog.dismiss();
+ // Create the example geopackage
+ try {
+ if (!geoPackageViewModel.createGeoPackage("Example")) {
+ GeoPackageUtils.showMessage(getActivity(), getString(R.string.geopackage_create_label),
+ "Failed to create example GeoPackage");
+ }
+ } catch (Exception e) {
+ GeoPackageUtils.showMessage(
+ getActivity(), "Create example", e.getMessage());
+ }
});
exitButton.setOnClickListener((View view) -> getActivity().finish());
@@ -3352,6 +3362,15 @@ public void onMapLongClick(@NonNull LatLng point) {
}
updateEditState(true);
}
+ } else {
+ // Drop a pin on user long press when not editing specific layer
+// vibrator.vibrate(VibrationEffect.createOneShot(getActivity().getResources()
+// .getInteger(R.integer.edit_features_add_long_click_vibrate_quick),
+// VibrationEffect.DEFAULT_AMPLITUDE));
+// editFeatureType = EditType.POINT;
+// Marker marker = addEditPoint(point);
+// editFeatureType = null;
+// editPoints.put(marker.getId(), marker);
}
}
}
diff --git a/mapcache/src/main/java/mil/nga/mapcache/load/ImportTask.java b/mapcache/src/main/java/mil/nga/mapcache/load/ImportTask.java
index cb035791..dd7a3449 100644
--- a/mapcache/src/main/java/mil/nga/mapcache/load/ImportTask.java
+++ b/mapcache/src/main/java/mil/nga/mapcache/load/ImportTask.java
@@ -82,38 +82,21 @@ public void importFile() {
final TextInputEditText nameInput = (TextInputEditText) importFileView
.findViewById(R.id.import_file_name_input);
- final RadioButton copyRadioButton = (RadioButton) importFileView
- .findViewById(R.id.import_file_copy_radio_button);
- final RadioButton externalRadioButton = (RadioButton) importFileView
- .findViewById(R.id.import_file_external_radio_button);
// Set the default name
if (name != null) {
nameInput.setText(name);
}
- // If no file path could be found, disable the external link option
- if (path == null) {
- externalRadioButton.setEnabled(false);
- }
dialog.setPositiveButton(importLabel,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
-
String value = nameInput.getText().toString();
- if (value != null && !value.isEmpty()) {
-
- boolean copy = copyRadioButton.isChecked();
-
+ if (!value.isEmpty()) {
try {
- if (copy) {
- // Import the GeoPackage by copying the file
- importGeoPackage(value, uri, path);
- } else {
- // Import the GeoPackage by linking to the file
- importGeoPackageExternalLinkWithPermissions(value, uri, path);
- }
+ // Import the GeoPackage by copying the file
+ importGeoPackage(value, uri, path);
} catch (final Exception e) {
try {
activity.runOnUiThread(
diff --git a/mapcache/src/main/java/mil/nga/mapcache/preferences/PreferencesActivity.java b/mapcache/src/main/java/mil/nga/mapcache/preferences/PreferencesActivity.java
index 1111ad62..640db183 100644
--- a/mapcache/src/main/java/mil/nga/mapcache/preferences/PreferencesActivity.java
+++ b/mapcache/src/main/java/mil/nga/mapcache/preferences/PreferencesActivity.java
@@ -45,8 +45,7 @@ protected void onCreate(Bundle savedInstanceState) {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
-// NavUtils.navigateUpFromSameTask(this);
- onBackPressed();
+ super.getOnBackPressedDispatcher().onBackPressed();
return true;
default:
return super.onOptionsItemSelected(item);
diff --git a/mapcache/src/main/java/mil/nga/mapcache/repository/GeoPackageRepository.java b/mapcache/src/main/java/mil/nga/mapcache/repository/GeoPackageRepository.java
index e48b7399..c09d211c 100644
--- a/mapcache/src/main/java/mil/nga/mapcache/repository/GeoPackageRepository.java
+++ b/mapcache/src/main/java/mil/nga/mapcache/repository/GeoPackageRepository.java
@@ -401,7 +401,8 @@ public List> regenerateTableList() {
String database = databasesIterator.next();
// Delete any databases with invalid headers
- if (!manager.validateHeader(database)) {
+ if (!manager.validateHeader(database) ||
+ database.equalsIgnoreCase(context.getString(R.string.invalidDb))) {
cache.removeAndClose(database);
if (manager.delete(database)) {
databasesIterator.remove();
diff --git a/mapcache/src/main/java/mil/nga/mapcache/view/map/feature/FeatureViewActivity.java b/mapcache/src/main/java/mil/nga/mapcache/view/map/feature/FeatureViewActivity.java
index bd22573d..4586e433 100644
--- a/mapcache/src/main/java/mil/nga/mapcache/view/map/feature/FeatureViewActivity.java
+++ b/mapcache/src/main/java/mil/nga/mapcache/view/map/feature/FeatureViewActivity.java
@@ -24,6 +24,7 @@
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
+import androidx.activity.result.PickVisualMediaRequest;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
@@ -71,10 +72,15 @@ public class FeatureViewActivity extends AppCompatActivity {
/**
- * Permission check
+ * Permission check for multiple
*/
public static final int REQUEST_ID_MULTIPLE_PERMISSIONS = 204;
+ /**
+ * Permission check for gallery usage
+ */
+ public static final int REQUEST_ID_GALLERY_PERMISSIONS = 205;
+
/**
* We'll generate a list of FCObjects to hold our data for the recycler
*/
@@ -156,16 +162,19 @@ public class FeatureViewActivity extends AppCompatActivity {
private DeleteImageListener deleteImageListener;
/**
- * result listener for selecting images from the gallery
+ * Result listener for selecting images from the gallery.
+ * Registers a photo picker activity launcher in single-select mode.
*/
- private ActivityResultLauncher getImageFromGallery = registerForActivityResult(new ActivityResultContracts.GetContent(),
- new ActivityResultCallback() {
- @Override
- public void onActivityResult(Uri uri) {
+ ActivityResultLauncher getImageFromGallery =
+ registerForActivityResult(new ActivityResultContracts.PickVisualMedia(), uri -> {
+ // Callback is invoked after the user selects a media item or closes the
+ // photo picker.
+ if (uri != null) {
+ Log.d("PhotoPicker", "Selected URI: " + uri);
Bitmap image = getImageResult(uri);
- if(image != null) {
- addImageToGallery(image);
- }
+ addImageToGallery(image);
+ } else {
+ Log.d("PhotoPicker", "No media selected");
}
});
@@ -252,8 +261,8 @@ protected void onCreate(Bundle savedInstanceState) {
*/
private void createImageGallery(){
if(imageGalleryPager != null && featureViewObjects != null){
- for(Map.Entry map : featureViewObjects.getBitmaps().entrySet() ){
- sliderItems.add(new SliderItem((long)map.getKey(),(Bitmap)map.getValue()));
+ for(Map.Entry map : featureViewObjects.getBitmaps().entrySet() ){
+ sliderItems.add(new SliderItem(map.getKey(),map.getValue()));
}
imageGalleryPager.setAdapter(sliderAdapter);
imageGalleryPager.setClipToPadding(false);
@@ -313,7 +322,7 @@ private void createButtonListeners(){
}
if(galleryButton != null) {
galleryButton.setOnClickListener(v -> {
- if (checkAndRequestPermissions(FeatureViewActivity.this)) {
+ if (checkAndRequestGalleryPermissions(FeatureViewActivity.this)) {
addFromGallery();
}
});
@@ -419,8 +428,8 @@ private void updateImages(){
if(featureViewObjects != null){
sliderItems.clear();
featureViewObjects.getAddedBitmaps().clear();
- for(Map.Entry map : featureViewObjects.getBitmaps().entrySet() ){
- sliderItems.add(new SliderItem((long)map.getKey(),(Bitmap)map.getValue()));
+ for(Map.Entry map : featureViewObjects.getBitmaps().entrySet() ){
+ sliderItems.add(new SliderItem(map.getKey(),map.getValue()));
}
}
sliderAdapter.setData(sliderItems);
@@ -455,7 +464,10 @@ private void takePicture(){
* Open the phone's image gallery to add an image
*/
private void addFromGallery(){
- getImageFromGallery.launch("image/*");
+ ActivityResultContracts.PickVisualMedia.VisualMediaType mediaType = (ActivityResultContracts.PickVisualMedia.VisualMediaType) ActivityResultContracts.PickVisualMedia.ImageOnly.INSTANCE;
+ getImageFromGallery.launch(new PickVisualMediaRequest.Builder()
+ .setMediaType(mediaType)
+ .build());
}
@@ -550,6 +562,25 @@ public static boolean checkAndRequestPermissions(final Activity context) {
return true;
}
+ public static boolean checkAndRequestGalleryPermissions(final Activity context) {
+ int writeExternalPermission = ContextCompat.checkSelfPermission(context,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE);
+ List listPermissionsNeeded = new ArrayList<>();
+ if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q){
+ if (writeExternalPermission != PackageManager.PERMISSION_GRANTED) {
+ listPermissionsNeeded
+ .add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
+ }
+ }
+ if (!listPermissionsNeeded.isEmpty()) {
+ ActivityCompat.requestPermissions(context, listPermissionsNeeded
+ .toArray(new String[0]),
+ REQUEST_ID_GALLERY_PERMISSIONS);
+ return false;
+ }
+ return true;
+ }
+
/**
@@ -566,19 +597,22 @@ public void onRequestPermissionsResult(int requestCode, @NotNull String[] permis
"Camera permissions required", Toast.LENGTH_SHORT)
.show();
flagged = true;
+ } else {
+ takePicture();
}
+ }
+ if (requestCode == REQUEST_ID_GALLERY_PERMISSIONS) {
if (android.os.Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
- if (ContextCompat.checkSelfPermission(FeatureViewActivity.this,
+ if (ContextCompat.checkSelfPermission(FeatureViewActivity.this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
Toast.makeText(getApplicationContext(),
"Storage permissions required",
Toast.LENGTH_SHORT).show();
- flagged = true;
-
- }
+ flagged = true;
+ }
}
- if(!flagged) {
- takePicture();
+ if(!flagged){
+ addFromGallery();
}
}
}
diff --git a/mapcache/src/main/res/layout/fragment_map.xml b/mapcache/src/main/res/layout/fragment_map.xml
index 2d0c14f6..c8ec7144 100755
--- a/mapcache/src/main/res/layout/fragment_map.xml
+++ b/mapcache/src/main/res/layout/fragment_map.xml
@@ -87,8 +87,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
- android:src="@drawable/edit_icon"
- android:onClick="openEditMenu"/>
+ android:src="@drawable/edit_icon" />
+ android:src="@drawable/map_layers_circle" />
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/mapcache/src/main/res/values/strings.xml b/mapcache/src/main/res/values/strings.xml
index 7abc4919..44660fd6 100644
--- a/mapcache/src/main/res/values/strings.xml
+++ b/mapcache/src/main/res/values/strings.xml
@@ -2,8 +2,8 @@
MapCache
- Version 2.1.10
- Released Oct 2023
+ Version 2.1.11
+ Released Jan 2024
MapCache
Map
Manager
@@ -386,11 +386,10 @@
<a href=http://ngageoint.github.io/geopackage-android>GeoPackage Android on Github</a>
<a href=http://www.geopackage.org/#implementations_nga>OGC GeoPackage</a>
- Release Notes - 2.1.10\n \n
- - Improved geometry error handling\n
- - Fix for file linking errors\n
- - Url validation improvements for tiles\n
- - GeoPackage android map library 6.7.2\n
+ Release Notes - 2.1.11\n \n
+ - Create default GeoPackage on start\n
+ - Support for blob format in GeoPackage\n
+ - GeoPackage android map library 6.7.3\n
- Background improvements
@@ -485,6 +484,9 @@
Max Lat
Min Lat
Add URL
+ MapCache will make a copy of this GeoPackage and save it internally
+ ue3.db
+