Skip to content

Commit

Permalink
Fix:Android:fixes (#919)
Browse files Browse the repository at this point in the history
  • Loading branch information
jandegr authored and hoehnp committed Nov 4, 2019
1 parent 2b2a6e4 commit da86e47
Show file tree
Hide file tree
Showing 16 changed files with 693 additions and 747 deletions.
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ jobs:
command: |
sudo apt-get update
sudo apt-get install -y ant cmake gettext libsaxonb-java librsvg2-bin pkg-config rename
- run:
name: Install Android SDK components
command: sdkmanager "cmake;3.6.4111459"
- run:
name: Install ndk
command: |
Expand Down
39 changes: 34 additions & 5 deletions navit/android.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,15 +356,16 @@ JNIEXPORT jstring JNICALL Java_org_navitproject_navit_NavitGraphics_getCoordForP
return return_string;
}

JNIEXPORT jint JNICALL Java_org_navitproject_navit_NavitGraphics_callbackMessageChannel( JNIEnv* env, jclass thiz,
jint channel, jstring str) {

JNIEXPORT jobject JNICALL Java_org_navitproject_navit_NavitCallbackHandler_callbackCmdChannel( JNIEnv* env,
jclass thiz, jint command) {

struct attr attr;
const char *s;
jint ret = 0;
dbg(lvl_debug,"enter %d %p",channel,str);
dbg(lvl_debug,"enter %d\n",command);
config_get_attr(config_get(), attr_navit, &attr, NULL);

switch(channel) {
switch(command) {
case 1:
// zoom in
navit_zoom_in_cursor(attr.u.navit, 2);
Expand All @@ -375,6 +376,34 @@ JNIEXPORT jint JNICALL Java_org_navitproject_navit_NavitGraphics_callbackMessage
navit_zoom_out_cursor(attr.u.navit, 2);
navit_draw(attr.u.navit);
break;
case 3:
// block
navit_block(attr.u.navit, 1);
break;
case 4:
// unblock
navit_block(attr.u.navit, 0);
break;
case 5:
// cancel route
navit_set_destination(attr.u.navit, NULL, NULL, 0);
navit_draw(attr.u.navit);
break;
default:
dbg(lvl_error, "Unknown command: %d", command);
break;
}
}

JNIEXPORT jint JNICALL Java_org_navitproject_navit_NavitCallbackHandler_callbackMessageChannel( JNIEnv* env,
jclass thiz, jint channel, jstring str) {
struct attr attr;
const char *s;
jint ret = 0;
dbg(lvl_debug,"enter %d %p",channel,str);
config_get_attr(config_get(), attr_navit, &attr, NULL);

switch(channel) {
case 6: {// add a map to the current mapset, return 1 on success
struct mapset *ms = navit_get_mapset(attr.u.navit);
struct attr type, name, data, *attrs[4];
Expand Down
11 changes: 7 additions & 4 deletions navit/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application android:usesCleartextTraffic="true" android:label="@string/app_name"
<application
android:label="@string/app_name"
android:usesCleartextTraffic="true"
android:allowBackup="true"
android:fullBackupContent="@xml/navit_backup_rules"
android:icon="@drawable/icon"
android:name=".NavitAppConfig"
android:theme="@style/NavitTheme">
android:name=".NavitAppConfig">
<activity android:name="Navit"
android:label="@string/app_name"
android:theme="@style/NavitTheme"
android:launchMode="singleTask"
android:taskAffinity=""
android:configChanges="screenLayout|smallestScreenSize|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|fontScale|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
Expand Down
9 changes: 5 additions & 4 deletions navit/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ apply from: "$project.rootDir/gradle/scripts/git-scm-version.gradle"
apply plugin: 'checkstyle'

android {
compileSdkVersion 28
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "org.navitproject.navit"
minSdkVersion 10
targetSdkVersion 28
targetSdkVersion 29
versionCode gitVersionCode
versionName gitVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -17,7 +17,7 @@ android {
}
externalNativeBuild {
cmake {
arguments '-DUSE_PLUGINS=n', '-DBUILD_MAPTOOL=n', '-DXSL_PROCESSING=y', '-DXSLTS=android', '-DANDROID=y', '-DSAMPLE_MAP=n'
arguments '-DUSE_PLUGINS=n', '-DBUILD_MAPTOOL=n', '-DXSL_PROCESSING=n', '-DSAMPLE_MAP=n'
}
}
}
Expand Down Expand Up @@ -74,9 +74,10 @@ android {
applicationVariants.all { variant ->
// create tasks to generate Javadocs
task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
source = android.sourceSets.main.java.srcDirs
destinationDir = file("build/outputs/docs/javadoc/")
title = rootProject.name
options.memberLevel = JavadocMemberLevel.PACKAGE
verbose = true
failOnError false
}
Expand Down
4 changes: 4 additions & 0 deletions navit/android/res/xml/navit_backup_rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<include domain="external" path="bookmark.txt"/>
</full-backup-content>
Loading

0 comments on commit da86e47

Please sign in to comment.