Skip to content

Commit e63cc98

Browse files
authored
Merge pull request #717 from afischerdev/update-android
Update Android Version
2 parents f9c6ad1 + 15bf08a commit e63cc98

File tree

10 files changed

+59
-36
lines changed

10 files changed

+59
-36
lines changed

brouter-core/src/main/java/btools/router/OsmTrack.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import btools.util.FrozenLongMap;
2424

2525
public final class OsmTrack {
26-
final public static String version = "1.7.6";
27-
final public static String versionDate = "20062024";
26+
final public static String version = "1.7.7";
27+
final public static String versionDate = "23072024";
2828

2929
// csv-header-line
3030
private static final String MESSAGES_HEADER = "Longitude\tLatitude\tElevation\tDistance\tCostPerKm\tElevCost\tTurnCost\tNodeCost\tInitialCost\tWayTags\tNodeTags\tTime\tEnergy";

brouter-routing-app/build.gradle

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
22

33
plugins {
4+
id 'base'
45
id 'com.android.application'
56
id 'checkstyle'
67
id 'brouter.version-conventions'
78
}
89

910
android {
10-
compileSdkVersion 33
11+
compileSdk 34
12+
13+
base {
14+
archivesName = "BRouterApp." + project.version
15+
}
1116

1217
defaultConfig {
1318
namespace 'btools.routingapp'
1419
applicationId "btools.routingapp"
1520

16-
versionCode 53
21+
versionCode 54
1722
versionName project.version
1823

1924
resValue('string', 'app_version', defaultConfig.versionName)
20-
setProperty("archivesBaseName", "BRouterApp." + defaultConfig.versionName)
2125

22-
minSdkVersion 14
23-
targetSdkVersion 33
26+
minSdkVersion 21
27+
targetSdkVersion 34
2428

2529
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2630
}
@@ -96,22 +100,22 @@ repositories {
96100
}
97101

98102
dependencies {
99-
implementation 'androidx.appcompat:appcompat:1.6.1'
103+
implementation 'androidx.appcompat:appcompat:1.7.0'
100104
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
101-
implementation 'androidx.work:work-runtime:2.8.1'
102-
implementation 'com.google.android.material:material:1.8.0'
105+
implementation 'androidx.work:work-runtime:2.9.0'
106+
implementation 'com.google.android.material:material:1.12.0'
103107

104108
implementation project(':brouter-mapaccess')
105109
implementation project(':brouter-core')
106110
implementation project(':brouter-expressions')
107111
implementation project(':brouter-util')
108-
implementation 'androidx.preference:preference:1.2.0'
112+
implementation 'androidx.preference:preference:1.2.1'
109113

110114
testImplementation 'junit:junit:4.13.2'
111115

112-
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
113-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
114-
androidTestImplementation 'androidx.work:work-testing:2.8.1'
116+
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
117+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
118+
androidTestImplementation 'androidx.work:work-testing:2.9.0'
115119
}
116120

117121
gradle.projectsEvaluated {
@@ -159,3 +163,8 @@ task generateReadmesZip(type: Zip) {
159163
}
160164
destinationDirectory = layout.buildDirectory.dir("assets")
161165
}
166+
167+
tasks.withType(JavaCompile).configureEach {
168+
options.compilerArgs += ['-Xlint:unchecked']
169+
options.compilerArgs += ['-Xlint:deprecation']
170+
}

brouter-routing-app/src/androidTest/java/btools/routingapp/BRouterActivityTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package btools.routingapp;
22

3+
import static org.hamcrest.MatcherAssert.assertThat;
34
import static org.hamcrest.Matchers.empty;
45
import static org.hamcrest.Matchers.hasItem;
56
import static org.hamcrest.Matchers.not;
6-
import static org.junit.Assert.assertThat;
77

88
import android.os.Build;
99
import android.os.Environment;

brouter-routing-app/src/androidTest/java/btools/routingapp/DownloadWorkerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package btools.routingapp;
22

3+
import static org.hamcrest.MatcherAssert.assertThat;
34
import static org.hamcrest.core.Is.is;
4-
import static org.junit.Assert.assertThat;
55

66
import android.content.Context;
77

brouter-routing-app/src/main/java/btools/routingapp/BInstallerActivity.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646

4747
public class BInstallerActivity extends AppCompatActivity {
4848

49+
private static final String TAG = "BInstallerActivity";
50+
4951
private static final int DIALOG_CONFIRM_DELETE_ID = 1;
5052
private static final int DIALOG_CONFIRM_NEXTSTEPS_ID = 2;
5153
private static final int DIALOG_CONFIRM_GETDIFFS_ID = 3;
@@ -216,7 +218,7 @@ public void downloadAll(ArrayList<Integer> downloadList, int all) {
216218
Object data;
217219
Toast.makeText(this, R.string.msg_too_much_data, Toast.LENGTH_LONG).show();
218220

219-
e.printStackTrace();
221+
Log.e(TAG, Log.getStackTraceString(e));
220222
return;
221223
}
222224

@@ -242,10 +244,9 @@ public void downloadAll(ArrayList<Integer> downloadList, int all) {
242244
//WorkManager.getInstance(getApplicationContext()).cancelWorkById(downloadWorkRequest.getId());
243245
}
244246
} catch (ExecutionException e) {
245-
e.printStackTrace();
247+
Log.e(TAG, Log.getStackTraceString(e));
246248
} catch (InterruptedException e) {
247-
Log.d("worker", "canceled " + e.getMessage());
248-
//e.printStackTrace();
249+
Log.d(TAG, "canceled " + e.getMessage());
249250
}
250251

251252
workManager
@@ -516,10 +517,10 @@ private boolean isDownloadRunning(Class<?> serviceClass) {
516517
}
517518
return running;
518519
} catch (ExecutionException e) {
519-
e.printStackTrace();
520+
Log.e(TAG, Log.getStackTraceString(e));
520521
return false;
521522
} catch (InterruptedException e) {
522-
e.printStackTrace();
523+
Log.e(TAG, Log.getStackTraceString(e));
523524
return false;
524525
}
525526
}

brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848

4949
public class BRouterView extends View {
5050

51+
private static final String TAG = "BRouterView";
52+
5153
private final int memoryClass;
5254
RoutingEngine cr;
5355
private int imgw;
@@ -148,8 +150,8 @@ public void startSetup(File baseDir, boolean storeBasedir, boolean silent) {
148150
try {
149151
td.mkdirs();
150152
} catch (Exception e) {
151-
Log.d("BRouterView", "Error creating base directory: " + e.getMessage());
152-
e.printStackTrace();
153+
Log.d(TAG, "Error creating base directory: " + e.getMessage());
154+
Log.e(TAG, Log.getStackTraceString(e));
153155
}
154156

155157
if (!td.isDirectory()) {
@@ -173,7 +175,7 @@ public void startSetup(File baseDir, boolean storeBasedir, boolean silent) {
173175

174176
// new init is done move old files
175177
if (waitingForMigration) {
176-
Log.d("BR", "path " + oldMigrationPath + " " + basedir);
178+
Log.d(TAG, "path " + oldMigrationPath + " " + basedir);
177179
Thread t = new Thread(new Runnable() {
178180
@Override
179181
public void run() {
@@ -184,7 +186,7 @@ public void run() {
184186
try {
185187
t.join(500);
186188
} catch (InterruptedException e) {
187-
e.printStackTrace();
189+
Log.e(TAG, Log.getStackTraceString(e));
188190
}
189191
waitingForMigration = false;
190192
}
@@ -333,9 +335,9 @@ private void copyFile(String inputPath, String inputFile, String outputPath) {
333335
out.close();
334336

335337
} catch (FileNotFoundException fileNotFoundException) {
336-
Log.e("tag", fileNotFoundException.getMessage());
338+
Log.e(TAG, fileNotFoundException.getMessage());
337339
} catch (Exception e) {
338-
Log.e("tag", e.getMessage());
340+
Log.e(TAG, e.getMessage());
339341
}
340342
}
341343

brouter-routing-app/src/main/java/btools/routingapp/RoutingParameterDialog.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.content.res.Configuration;
88
import android.os.Build;
99
import android.os.Bundle;
10+
import android.util.Log;
1011
import android.window.OnBackInvokedCallback;
1112
import android.window.OnBackInvokedDispatcher;
1213

@@ -146,7 +147,7 @@ static public List<RoutingParam> getParamsFromProfile(final InputStream fis) thr
146147
list.add(p);
147148
}
148149
} catch (Exception e) {
149-
e.printStackTrace();
150+
Log.e(TAG, Log.getStackTraceString(e));
150151
}
151152
}
152153
} while (line != null);
@@ -240,6 +241,7 @@ public void onDetach() {
240241
}
241242

242243
@Override
244+
@SuppressWarnings("deprecation")
243245
public void onCreate(Bundle savedInstanceState) {
244246
super.onCreate(savedInstanceState);
245247

@@ -262,10 +264,10 @@ public void onCreate(Bundle savedInstanceState) {
262264

263265
if (i.hasExtra("PARAMS")) {
264266
List<?> result;
265-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
266-
result = (List<?>) i.getExtras().getSerializable("PARAMS", ArrayList.class);
267-
} else {
267+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
268268
result = (List<?>) i.getExtras().getSerializable("PARAMS");
269+
} else {
270+
result = (List<?>) i.getExtras().getSerializable("PARAMS", ArrayList.class);
269271
}
270272
if (result instanceof ArrayList) {
271273
for (Object o : result) {
@@ -277,7 +279,7 @@ public void onCreate(Bundle savedInstanceState) {
277279
sparams = i.getExtras().getString("PARAMS_VALUES", "");
278280
}
279281
} catch (Exception e) {
280-
e.printStackTrace();
282+
Log.e(TAG, Log.getStackTraceString(e));
281283
}
282284

283285
getPreferenceManager().setSharedPreferencesName("prefs_profile_" + profile_hash);

brouter-routing-app/src/main/java/btools/routingapp/ServerConfig.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.content.Context;
44
import android.content.res.AssetManager;
5+
import android.util.Log;
56

67
import java.io.BufferedReader;
78
import java.io.File;
@@ -13,6 +14,9 @@
1314
import java.util.zip.ZipInputStream;
1415

1516
public class ServerConfig {
17+
18+
private static final String TAG = "ServerConfig";
19+
1620
private static String mServerConfigName = "serverconfig.txt";
1721

1822
private String mSegmentUrl = "https://brouter.de/brouter/segments4/";
@@ -52,7 +56,7 @@ private void readConfigFile(File file) {
5256
}
5357
}
5458
} catch (IOException e) {
55-
e.printStackTrace();
59+
Log.e(TAG, Log.getStackTraceString(e));
5660
} finally {
5761
try {
5862
if (br != null) br.close();

buildSrc/src/main/groovy/brouter.version-conventions.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
// app: build.gradle (versionCode only)
55
// OsmTrack (version and versionDate)
66
// docs revisions.md (version and versionDate)
7-
version '1.7.6'
7+
version '1.7.7'

docs/revisions.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
(ZIP-Archives including APK, readme + profiles)
44

5-
### [brouter-1.7.6.zip](../brouter_bin/brouter-1.7.6.zip) (current revision, 20.06.2024)
5+
### [brouter-1.7.7.zip](../brouter_bin/brouter-1.7.7.zip) (current revision, 23.07.2024)
6+
7+
- new Android API 34
8+
9+
10+
### [brouter-1.7.6.zip](../brouter_bin/brouter-1.7.6.zip) (20.06.2024)
611

712
Android
813

0 commit comments

Comments
 (0)