diff --git a/brouter-core/src/main/java/btools/router/OsmTrack.java b/brouter-core/src/main/java/btools/router/OsmTrack.java index 66c645f0c..859fdc870 100644 --- a/brouter-core/src/main/java/btools/router/OsmTrack.java +++ b/brouter-core/src/main/java/btools/router/OsmTrack.java @@ -23,8 +23,8 @@ import btools.util.FrozenLongMap; public final class OsmTrack { - final public static String version = "1.7.6"; - final public static String versionDate = "20062024"; + final public static String version = "1.7.7"; + final public static String versionDate = "23072024"; // csv-header-line private static final String MESSAGES_HEADER = "Longitude\tLatitude\tElevation\tDistance\tCostPerKm\tElevCost\tTurnCost\tNodeCost\tInitialCost\tWayTags\tNodeTags\tTime\tEnergy"; diff --git a/brouter-routing-app/build.gradle b/brouter-routing-app/build.gradle index e7daacc6b..ebcc34b34 100644 --- a/brouter-routing-app/build.gradle +++ b/brouter-routing-app/build.gradle @@ -1,26 +1,30 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform plugins { + id 'base' id 'com.android.application' id 'checkstyle' id 'brouter.version-conventions' } android { - compileSdkVersion 33 + compileSdk 34 + + base { + archivesName = "BRouterApp." + project.version + } defaultConfig { namespace 'btools.routingapp' applicationId "btools.routingapp" - versionCode 53 + versionCode 54 versionName project.version resValue('string', 'app_version', defaultConfig.versionName) - setProperty("archivesBaseName", "BRouterApp." + defaultConfig.versionName) - minSdkVersion 14 - targetSdkVersion 33 + minSdkVersion 21 + targetSdkVersion 34 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -96,22 +100,22 @@ repositories { } dependencies { - implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.appcompat:appcompat:1.7.0' implementation "androidx.constraintlayout:constraintlayout:2.1.4" - implementation 'androidx.work:work-runtime:2.8.1' - implementation 'com.google.android.material:material:1.8.0' + implementation 'androidx.work:work-runtime:2.9.0' + implementation 'com.google.android.material:material:1.12.0' implementation project(':brouter-mapaccess') implementation project(':brouter-core') implementation project(':brouter-expressions') implementation project(':brouter-util') - implementation 'androidx.preference:preference:1.2.0' + implementation 'androidx.preference:preference:1.2.1' testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - androidTestImplementation 'androidx.work:work-testing:2.8.1' + androidTestImplementation 'androidx.test.ext:junit:1.2.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' + androidTestImplementation 'androidx.work:work-testing:2.9.0' } gradle.projectsEvaluated { @@ -159,3 +163,8 @@ task generateReadmesZip(type: Zip) { } destinationDirectory = layout.buildDirectory.dir("assets") } + +tasks.withType(JavaCompile).configureEach { + options.compilerArgs += ['-Xlint:unchecked'] + options.compilerArgs += ['-Xlint:deprecation'] +} diff --git a/brouter-routing-app/src/androidTest/java/btools/routingapp/BRouterActivityTest.java b/brouter-routing-app/src/androidTest/java/btools/routingapp/BRouterActivityTest.java index 6a6a9cd38..43b89f7a1 100644 --- a/brouter-routing-app/src/androidTest/java/btools/routingapp/BRouterActivityTest.java +++ b/brouter-routing-app/src/androidTest/java/btools/routingapp/BRouterActivityTest.java @@ -1,9 +1,9 @@ package btools.routingapp; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertThat; import android.os.Build; import android.os.Environment; diff --git a/brouter-routing-app/src/androidTest/java/btools/routingapp/DownloadWorkerTest.java b/brouter-routing-app/src/androidTest/java/btools/routingapp/DownloadWorkerTest.java index a9004c01e..c0ce44ded 100644 --- a/brouter-routing-app/src/androidTest/java/btools/routingapp/DownloadWorkerTest.java +++ b/brouter-routing-app/src/androidTest/java/btools/routingapp/DownloadWorkerTest.java @@ -1,7 +1,7 @@ package btools.routingapp; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; import android.content.Context; diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java index 5d375d67c..6dcc25936 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java @@ -46,6 +46,8 @@ public class BInstallerActivity extends AppCompatActivity { + private static final String TAG = "BInstallerActivity"; + private static final int DIALOG_CONFIRM_DELETE_ID = 1; private static final int DIALOG_CONFIRM_NEXTSTEPS_ID = 2; private static final int DIALOG_CONFIRM_GETDIFFS_ID = 3; @@ -216,7 +218,7 @@ public void downloadAll(ArrayList downloadList, int all) { Object data; Toast.makeText(this, R.string.msg_too_much_data, Toast.LENGTH_LONG).show(); - e.printStackTrace(); + Log.e(TAG, Log.getStackTraceString(e)); return; } @@ -242,10 +244,9 @@ public void downloadAll(ArrayList downloadList, int all) { //WorkManager.getInstance(getApplicationContext()).cancelWorkById(downloadWorkRequest.getId()); } } catch (ExecutionException e) { - e.printStackTrace(); + Log.e(TAG, Log.getStackTraceString(e)); } catch (InterruptedException e) { - Log.d("worker", "canceled " + e.getMessage()); - //e.printStackTrace(); + Log.d(TAG, "canceled " + e.getMessage()); } workManager @@ -516,10 +517,10 @@ private boolean isDownloadRunning(Class serviceClass) { } return running; } catch (ExecutionException e) { - e.printStackTrace(); + Log.e(TAG, Log.getStackTraceString(e)); return false; } catch (InterruptedException e) { - e.printStackTrace(); + Log.e(TAG, Log.getStackTraceString(e)); return false; } } diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java index 674eaf94f..efdbdfb21 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java @@ -48,6 +48,8 @@ public class BRouterView extends View { + private static final String TAG = "BRouterView"; + private final int memoryClass; RoutingEngine cr; private int imgw; @@ -148,8 +150,8 @@ public void startSetup(File baseDir, boolean storeBasedir, boolean silent) { try { td.mkdirs(); } catch (Exception e) { - Log.d("BRouterView", "Error creating base directory: " + e.getMessage()); - e.printStackTrace(); + Log.d(TAG, "Error creating base directory: " + e.getMessage()); + Log.e(TAG, Log.getStackTraceString(e)); } if (!td.isDirectory()) { @@ -173,7 +175,7 @@ public void startSetup(File baseDir, boolean storeBasedir, boolean silent) { // new init is done move old files if (waitingForMigration) { - Log.d("BR", "path " + oldMigrationPath + " " + basedir); + Log.d(TAG, "path " + oldMigrationPath + " " + basedir); Thread t = new Thread(new Runnable() { @Override public void run() { @@ -184,7 +186,7 @@ public void run() { try { t.join(500); } catch (InterruptedException e) { - e.printStackTrace(); + Log.e(TAG, Log.getStackTraceString(e)); } waitingForMigration = false; } @@ -333,9 +335,9 @@ private void copyFile(String inputPath, String inputFile, String outputPath) { out.close(); } catch (FileNotFoundException fileNotFoundException) { - Log.e("tag", fileNotFoundException.getMessage()); + Log.e(TAG, fileNotFoundException.getMessage()); } catch (Exception e) { - Log.e("tag", e.getMessage()); + Log.e(TAG, e.getMessage()); } } diff --git a/brouter-routing-app/src/main/java/btools/routingapp/RoutingParameterDialog.java b/brouter-routing-app/src/main/java/btools/routingapp/RoutingParameterDialog.java index 356e2d339..d69a0370d 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/RoutingParameterDialog.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/RoutingParameterDialog.java @@ -7,6 +7,7 @@ import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; +import android.util.Log; import android.window.OnBackInvokedCallback; import android.window.OnBackInvokedDispatcher; @@ -146,7 +147,7 @@ static public List getParamsFromProfile(final InputStream fis) thr list.add(p); } } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, Log.getStackTraceString(e)); } } } while (line != null); @@ -240,6 +241,7 @@ public void onDetach() { } @Override + @SuppressWarnings("deprecation") public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -262,10 +264,10 @@ public void onCreate(Bundle savedInstanceState) { if (i.hasExtra("PARAMS")) { List result; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - result = (List) i.getExtras().getSerializable("PARAMS", ArrayList.class); - } else { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { result = (List) i.getExtras().getSerializable("PARAMS"); + } else { + result = (List) i.getExtras().getSerializable("PARAMS", ArrayList.class); } if (result instanceof ArrayList) { for (Object o : result) { @@ -277,7 +279,7 @@ public void onCreate(Bundle savedInstanceState) { sparams = i.getExtras().getString("PARAMS_VALUES", ""); } } catch (Exception e) { - e.printStackTrace(); + Log.e(TAG, Log.getStackTraceString(e)); } getPreferenceManager().setSharedPreferencesName("prefs_profile_" + profile_hash); diff --git a/brouter-routing-app/src/main/java/btools/routingapp/ServerConfig.java b/brouter-routing-app/src/main/java/btools/routingapp/ServerConfig.java index 0d83d49fa..a059a1910 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/ServerConfig.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/ServerConfig.java @@ -2,6 +2,7 @@ import android.content.Context; import android.content.res.AssetManager; +import android.util.Log; import java.io.BufferedReader; import java.io.File; @@ -13,6 +14,9 @@ import java.util.zip.ZipInputStream; public class ServerConfig { + + private static final String TAG = "ServerConfig"; + private static String mServerConfigName = "serverconfig.txt"; private String mSegmentUrl = "https://brouter.de/brouter/segments4/"; @@ -52,7 +56,7 @@ private void readConfigFile(File file) { } } } catch (IOException e) { - e.printStackTrace(); + Log.e(TAG, Log.getStackTraceString(e)); } finally { try { if (br != null) br.close(); diff --git a/buildSrc/src/main/groovy/brouter.version-conventions.gradle b/buildSrc/src/main/groovy/brouter.version-conventions.gradle index 8e94c81a8..b99c641cb 100644 --- a/buildSrc/src/main/groovy/brouter.version-conventions.gradle +++ b/buildSrc/src/main/groovy/brouter.version-conventions.gradle @@ -4,4 +4,4 @@ // app: build.gradle (versionCode only) // OsmTrack (version and versionDate) // docs revisions.md (version and versionDate) -version '1.7.6' +version '1.7.7' diff --git a/docs/revisions.md b/docs/revisions.md index 6268d6a21..e58e2a969 100644 --- a/docs/revisions.md +++ b/docs/revisions.md @@ -2,7 +2,12 @@ (ZIP-Archives including APK, readme + profiles) -### [brouter-1.7.6.zip](../brouter_bin/brouter-1.7.6.zip) (current revision, 20.06.2024) +### [brouter-1.7.7.zip](../brouter_bin/brouter-1.7.7.zip) (current revision, 23.07.2024) + +- new Android API 34 + + +### [brouter-1.7.6.zip](../brouter_bin/brouter-1.7.6.zip) (20.06.2024) Android