diff --git a/PocketMaps/app/build.gradle b/PocketMaps/app/build.gradle index 48a83bf..03695e9 100644 --- a/PocketMaps/app/build.gradle +++ b/PocketMaps/app/build.gradle @@ -21,7 +21,7 @@ android { } lintOptions { - disable 'InvalidPackage','MissingPrefix' + disable 'InvalidPackage','MissingPrefix','ProtectedPermissions' } } @@ -48,7 +48,7 @@ dependencies { implementation 'org.mapsforge:vtm-android:0.12.0:natives-x86_64' implementation 'org.mapsforge:vtm-jts:0.12.0' implementation 'org.mapsforge:vtm-themes:0.12.0' - implementation 'com.caverock:androidsvg-aar:1.4' + //implementation 'com.caverock:androidsvg-aar:1.4' implementation 'org.slf4j:slf4j-api:1.7.28' implementation 'org.slf4j:slf4j-android:1.7.28' diff --git a/PocketMaps/app/src/main/java/com/junjunguo/pocketmaps/activities/GeocodeActivity.java b/PocketMaps/app/src/main/java/com/junjunguo/pocketmaps/activities/GeocodeActivity.java index e22be16..a21eebc 100644 --- a/PocketMaps/app/src/main/java/com/junjunguo/pocketmaps/activities/GeocodeActivity.java +++ b/PocketMaps/app/src/main/java/com/junjunguo/pocketmaps/activities/GeocodeActivity.java @@ -752,7 +752,7 @@ public void onClick(Address addr) // use a linear layout manager LinearLayoutManager layoutManager = new LinearLayoutManager(this.getApplicationContext()); - layoutManager.setOrientation(LinearLayout.VERTICAL); + layoutManager.setOrientation(RecyclerView.VERTICAL); listView.setLayoutManager(layoutManager); listView.setItemAnimator(new DefaultItemAnimator()); listView.setAdapter(adapter); diff --git a/PocketMaps/app/src/main/java/com/junjunguo/pocketmaps/activities/MapActions.java b/PocketMaps/app/src/main/java/com/junjunguo/pocketmaps/activities/MapActions.java index c6561c9..56d9bb1 100644 --- a/PocketMaps/app/src/main/java/com/junjunguo/pocketmaps/activities/MapActions.java +++ b/PocketMaps/app/src/main/java/com/junjunguo/pocketmaps/activities/MapActions.java @@ -1,5 +1,6 @@ package com.junjunguo.pocketmaps.activities; +import android.annotation.SuppressLint; import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; @@ -145,6 +146,7 @@ public OnClickListener createNaviCenterListener() /** * init and implement performance for settings */ + @SuppressLint("ResourceAsColor") private void initSettingsBtnHandler() { settingsSetBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -185,6 +187,7 @@ private void initSettingsBtnHandler() { /** * init and implement performance for favourites */ + @SuppressLint("ResourceAsColor") private void initFavourBtnHandler() { initSearchLocationHandler(false, true, R.id.map_southbar_favour_add_fab, true); initPointOnMapHandler(TabAction.AddFavourit, R.id.map_southbar_favour_select_fab, true); diff --git a/PocketMaps/app/src/main/java/com/junjunguo/pocketmaps/activities/Permission.java b/PocketMaps/app/src/main/java/com/junjunguo/pocketmaps/activities/Permission.java index 0521de5..41580d2 100644 --- a/PocketMaps/app/src/main/java/com/junjunguo/pocketmaps/activities/Permission.java +++ b/PocketMaps/app/src/main/java/com/junjunguo/pocketmaps/activities/Permission.java @@ -3,6 +3,7 @@ import com.junjunguo.pocketmaps.R; import android.app.Activity; +import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; @@ -111,9 +112,9 @@ public void onRequestPermissionsResult(int requestCode, String[] permissions, in /** Check if permission is already permitted. * @param sPermission The Permission of android.Manifest.permission.xyz **/ - public static boolean checkPermission(String sPermission, Activity activity) { + public static boolean checkPermission(String sPermission, Context context) { // Check if the Camera permission has been granted - if (ActivityCompat.checkSelfPermission(activity, sPermission) + if (ActivityCompat.checkSelfPermission(context, sPermission) == PackageManager.PERMISSION_GRANTED) { return true; } else { diff --git a/PocketMaps/app/src/main/java/com/villoren/android/kalmanlocationmanager/lib/LooperThread.java b/PocketMaps/app/src/main/java/com/villoren/android/kalmanlocationmanager/lib/LooperThread.java index 22294af..a37a8dd 100644 --- a/PocketMaps/app/src/main/java/com/villoren/android/kalmanlocationmanager/lib/LooperThread.java +++ b/PocketMaps/app/src/main/java/com/villoren/android/kalmanlocationmanager/lib/LooperThread.java @@ -34,6 +34,7 @@ import android.os.Looper; import android.os.Message; import android.os.SystemClock; +import com.junjunguo.pocketmaps.activities.Permission; import static com.villoren.android.kalmanlocationmanager.lib.KalmanLocationManager.KALMAN_PROVIDER; import static com.villoren.android.kalmanlocationmanager.lib.KalmanLocationManager.UseProvider; @@ -123,20 +124,26 @@ public void run() { mLooper = Looper.myLooper(); if (mUseProvider == UseProvider.GPS || mUseProvider == UseProvider.GPS_AND_NET) { - - mLocationManager.requestLocationUpdates( - LocationManager.GPS_PROVIDER, mMinTimeGpsProvider, 0.0f, mOwnLocationListener, mLooper); + requestLoc(LocationManager.GPS_PROVIDER, mMinTimeGpsProvider); } if (mUseProvider == UseProvider.NET || mUseProvider == UseProvider.GPS_AND_NET) { - - mLocationManager.requestLocationUpdates( - LocationManager.NETWORK_PROVIDER, mMinTimeNetProvider, 0.0f, mOwnLocationListener, mLooper); + requestLoc(LocationManager.NETWORK_PROVIDER, mMinTimeNetProvider); } Looper.loop(); } + private void requestLoc(String provider, long upTime) + { + String sPermission = android.Manifest.permission.ACCESS_FINE_LOCATION; + if (Permission.checkPermission(sPermission, mContext)) + { + mLocationManager.requestLocationUpdates( + provider, upTime, 0.0f, mOwnLocationListener, mLooper); + } + } + /** Set maxPredictTime in millis. Disable with negative value. **/ public void setMaxPredictTime(long maxPredictTime) { diff --git a/PocketMaps/app/src/main/res/menu/menu_main.xml b/PocketMaps/app/src/main/res/menu/menu_main.xml index 6097f8f..388cd14 100644 --- a/PocketMaps/app/src/main/res/menu/menu_main.xml +++ b/PocketMaps/app/src/main/res/menu/menu_main.xml @@ -6,45 +6,45 @@ android:id="@+id/menu_about_pocket_maps" android:orderInCategory="100" android:title="About" - android:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> diff --git a/PocketMaps/app/src/main/res/menu/menu_maps.xml b/PocketMaps/app/src/main/res/menu/menu_maps.xml index 18d0f6b..dcccffd 100644 --- a/PocketMaps/app/src/main/res/menu/menu_maps.xml +++ b/PocketMaps/app/src/main/res/menu/menu_maps.xml @@ -16,46 +16,46 @@ android:id="@+id/menu_map_downloaded" android:orderInCategory="100" android:title="Downloaded" - android:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> + app:showAsAction="never"/> diff --git a/PocketMaps/app/src/main/res/values-w820dp/dimens.xml b/PocketMaps/app/src/main/res/values-w820dp/dimens.xml index 25d5e6f..e2b0f62 100644 --- a/PocketMaps/app/src/main/res/values-w820dp/dimens.xml +++ b/PocketMaps/app/src/main/res/values-w820dp/dimens.xml @@ -4,9 +4,4 @@ would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). --> 64dp - - 56dp - - 2dp - 4dp diff --git a/PocketMaps/build.gradle b/PocketMaps/build.gradle index cd89ddd..4b6f436 100644 --- a/PocketMaps/build.gradle +++ b/PocketMaps/build.gradle @@ -6,9 +6,10 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:4.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files + // NOTE: Versions compatible with wrapper: https://developer.android.com/studio/releases/gradle-plugin } } diff --git a/PocketMaps/gradle.properties b/PocketMaps/gradle.properties index e8cf5b9..ef52d9d 100644 --- a/PocketMaps/gradle.properties +++ b/PocketMaps/gradle.properties @@ -17,3 +17,7 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true + +# Enable to use AndroidX +android.useAndroidX=true +android.enableJetifier=true diff --git a/PocketMaps/gradle/wrapper/gradle-wrapper.jar b/PocketMaps/gradle/wrapper/gradle-wrapper.jar index 8c0fb64..7a3265e 100644 Binary files a/PocketMaps/gradle/wrapper/gradle-wrapper.jar and b/PocketMaps/gradle/wrapper/gradle-wrapper.jar differ diff --git a/PocketMaps/gradle/wrapper/gradle-wrapper.properties b/PocketMaps/gradle/wrapper/gradle-wrapper.properties index cd201a3..38c1d48 100644 --- a/PocketMaps/gradle/wrapper/gradle-wrapper.properties +++ b/PocketMaps/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Thu Oct 26 11:57:58 EEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip diff --git a/PocketMaps/gradlew b/PocketMaps/gradlew index 91a7e26..cccdd3d 100755 --- a/PocketMaps/gradlew +++ b/PocketMaps/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,31 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -90,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -114,6 +113,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/PocketMaps/gradlew.bat b/PocketMaps/gradlew.bat index aec9973..e95643d 100644 --- a/PocketMaps/gradlew.bat +++ b/PocketMaps/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +46,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line