summaryrefslogtreecommitdiff
path: root/navit/android
diff options
context:
space:
mode:
Diffstat (limited to 'navit/android')
-rw-r--r--navit/android/AndroidManifest.xml.cmake51
-rw-r--r--navit/android/CMakeLists.txt86
-rw-r--r--navit/android/android_layout_default_new.xml855
-rw-r--r--navit/android/build.properties2
-rwxr-xr-xnavit/android/change_xslt.sh58
-rw-r--r--navit/android/libs/TTS_library_stub.jarbin31633 -> 0 bytes
-rw-r--r--navit/android/libs/acra-4.8.5.jarbin154375 -> 0 bytes
-rw-r--r--navit/android/libs/android-support-v4.jarbin1364299 -> 0 bytes
-rw-r--r--navit/android/po2xml.xslt40
-rw-r--r--navit/android/res/drawable-hdpi/ic_notify.pngbin634 -> 0 bytes
-rw-r--r--navit/android/res/drawable-hdpi/icon.pngbin5949 -> 0 bytes
-rw-r--r--navit/android/res/drawable-ldpi/dir_up.pngbin455 -> 0 bytes
-rw-r--r--navit/android/res/drawable-ldpi/file_icon.pngbin160 -> 0 bytes
-rw-r--r--navit/android/res/drawable-ldpi/folder_icon.pngbin113 -> 0 bytes
-rw-r--r--navit/android/res/drawable-ldpi/folder_icon_light.pngbin226 -> 0 bytes
-rw-r--r--navit/android/res/drawable-ldpi/ic_launcher.pngbin2729 -> 0 bytes
-rw-r--r--navit/android/res/drawable-ldpi/ic_notify.pngbin370 -> 0 bytes
-rw-r--r--navit/android/res/drawable-ldpi/icon.pngbin2208 -> 0 bytes
-rw-r--r--navit/android/res/drawable-mdpi/ic_notify.pngbin462 -> 0 bytes
-rw-r--r--navit/android/res/drawable-mdpi/icon.pngbin3353 -> 0 bytes
-rw-r--r--navit/android/res/drawable-xhdpi/ic_notify.pngbin832 -> 0 bytes
-rw-r--r--navit/android/res/drawable-xhdpi/icon.pngbin8858 -> 0 bytes
-rw-r--r--navit/android/res/drawable-xxhdpi/ic_notify.pngbin1216 -> 0 bytes
-rw-r--r--navit/android/res/drawable-xxhdpi/icon.pngbin15235 -> 0 bytes
-rw-r--r--navit/android/res/layout/ua_com_vassiliev_filebrowser_layout.xml84
-rw-r--r--navit/android/res/values-v19/styles.xml31
-rw-r--r--navit/android/res/values-v21/styles.xml46
-rw-r--r--navit/android/res/values/strings-dont-translate.xml22
-rw-r--r--navit/android/res/values/strings.xml84
-rw-r--r--navit/android/res/values/styles.xml42
-rw-r--r--navit/android/src/org/navitproject/navit/FileBrowserActivity.java432
-rw-r--r--navit/android/src/org/navitproject/navit/Navit.java933
-rw-r--r--navit/android/src/org/navitproject/navit/NavitActivityResult.java6
-rw-r--r--navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java385
-rwxr-xr-xnavit/android/src/org/navitproject/navit/NavitAppConfig.java90
-rw-r--r--navit/android/src/org/navitproject/navit/NavitBackupTask.java126
-rw-r--r--navit/android/src/org/navitproject/navit/NavitCamera.java82
-rw-r--r--navit/android/src/org/navitproject/navit/NavitDialogs.java218
-rw-r--r--navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java245
-rw-r--r--navit/android/src/org/navitproject/navit/NavitGraphics.java1210
-rw-r--r--navit/android/src/org/navitproject/navit/NavitMap.java40
-rw-r--r--navit/android/src/org/navitproject/navit/NavitMapDownloader.java711
-rw-r--r--navit/android/src/org/navitproject/navit/NavitRestoreTask.java144
-rw-r--r--navit/android/src/org/navitproject/navit/NavitSensors.java52
-rw-r--r--navit/android/src/org/navitproject/navit/NavitSpeech.java53
-rw-r--r--navit/android/src/org/navitproject/navit/NavitSpeech2.java90
-rw-r--r--navit/android/src/org/navitproject/navit/NavitTextTranslations.java204
-rw-r--r--navit/android/src/org/navitproject/navit/NavitTimeout.java58
-rw-r--r--navit/android/src/org/navitproject/navit/NavitVehicle.java185
-rw-r--r--navit/android/src/org/navitproject/navit/NavitWatch.java102
50 files changed, 0 insertions, 6767 deletions
diff --git a/navit/android/AndroidManifest.xml.cmake b/navit/android/AndroidManifest.xml.cmake
deleted file mode 100644
index 7aa882bb8..000000000
--- a/navit/android/AndroidManifest.xml.cmake
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.navitproject.navit"
- android:sharedUserId="org.navitproject.navit"
- android:versionCode="@ANDROID_VERSION_INT@"
- android:versionName="@ANDROID_VERSION_NAME@-@ANDROID_VERSION_INT@"
- android:installLocation="auto">
- <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="@ANDROID_API_VERSION@"/>
- <uses-feature android:name="android.hardware.location.network" android:required="false"/>
- <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
- <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:resizeable="true" android:anyDensity="true"/>
- @ANDROID_PERMISSIONS@
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
- <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:label="@string/app_name"
- android:icon="@drawable/icon"
- android:name=".NavitAppConfig"
- android:theme="@style/NavitBaseTheme">
- <activity android:name="Navit"
- android:label="@string/app_name"
- android:configChanges="locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|fontScale|screenSize"
- android:theme="@style/NavitTheme">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.intent.action.VIEW" />
- <category android:name="android.intent.category.DEFAULT" />
- <data android:scheme="google.navigation" />
- </intent-filter>
- </activity>
- <activity android:name=".NavitAddressSearchActivity"></activity>
- <activity android:name=".NavitDownloadSelectMapActivity"></activity>
- <activity android:name=".NavitAddressResultListActivity"></activity>
- <activity android:name=".FileBrowserActivity"></activity>
- <activity
- android:name="org.acra.dialog.CrashReportDialog"
- android:theme="@android:style/Theme.Dialog"
- android:launchMode="singleInstance"
- android:excludeFromRecents="true"
- android:finishOnTaskLaunch="true"/>
- <service
- android:name="org.acra.sender.SenderService"
- android:exported="false"
- android:process=":acra" />
- </application>
-</manifest>
diff --git a/navit/android/CMakeLists.txt b/navit/android/CMakeLists.txt
deleted file mode 100644
index 6a9b9c92f..000000000
--- a/navit/android/CMakeLists.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-if (ANDROID)
-
- FILE(GLOB SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*/*/*/*")
-
- foreach ( PERMISSION ${ANDROID_PERMISSIONS})
- set(ANDROID_PERMISSIONS_EXPANDED "${ANDROID_PERMISSIONS_EXPANDED}<uses-permission\tandroid:name=\\\"android.permission.${PERMISSION}\\\"/>" )
- endforeach()
-
- # Generate Android string resource files from gettext .po.in files.
- # Note: Android language resources should have two letter ISO 639-1 code, and, optionally, iso-3166-1-alpha-2 region code,
- # so we skip all translation files which do not conform these requirements.
- FILE(GLOB POIN_FILES1 RELATIVE ${CMAKE_SOURCE_DIR}/po "${CMAKE_SOURCE_DIR}/po/??.po.in")
- FILE(GLOB POIN_FILES2 RELATIVE ${CMAKE_SOURCE_DIR}/po "${CMAKE_SOURCE_DIR}/po/??_??.po.in")
- set(POIN_FILES ${POIN_FILES1} ${POIN_FILES2})
- foreach (POIN_FILE ${POIN_FILES})
- string(REPLACE ".po.in" "" LANG ${POIN_FILE})
- string(REPLACE "_" "-r" LANG ${LANG})
- set(LANG_RESOURCES ${LANG_RESOURCES} "${CMAKE_CURRENT_BINARY_DIR}/res/values-${LANG}/strings.xml")
- compose_xslt_transform_command(TRANS "${CMAKE_CURRENT_SOURCE_DIR}/po2xml.xslt" "${CMAKE_CURRENT_SOURCE_DIR}/res/values/strings.xml" "${CMAKE_CURRENT_BINARY_DIR}/res/values-${LANG}/strings.xml" "po_file=${CMAKE_SOURCE_DIR}/po/${POIN_FILE}")
- ADD_CUSTOM_COMMAND(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/res/values-${LANG}/strings.xml"
- DEPENDS "${CMAKE_BINARY_DIR}/po/navit.pot" "${CMAKE_SOURCE_DIR}/po/${POIN_FILE}" "${CMAKE_CURRENT_SOURCE_DIR}/po2xml.xslt" "${CMAKE_CURRENT_SOURCE_DIR}/res/values/strings.xml"
- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/res/values-${LANG}
- ${TRANS}
- )
- endforeach(POIN_FILE ${POIN_FILES})
-
- add_custom_command (
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/AndroidManifest.xml
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake
- COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake
- -D DST=${CMAKE_CURRENT_BINARY_DIR}/AndroidManifest.xml
- -D NAME=ANDROID_VERSION_INT
- -D ANDROID_VERSION_NAME=${PACKAGE_STRING}
- -D ANDROID_API_VERSION=${ANDROID_API_VERSION}
- -D ANDROID_PERMISSIONS:string="${ANDROID_PERMISSIONS_EXPANDED}"
- -D STRIP_M="1"
- -P ${PROJECT_SOURCE_DIR}/cmake/version.cmake
- )
-
- add_custom_command (
- OUTPUT build.xml
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/AndroidManifest.xml ${SRC_FILES}
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND android update project -t android-${ANDROID_API_VERSION} -p ${CMAKE_CURRENT_BINARY_DIR}
- )
-
- add_custom_target( android_resources
- DEPENDS build.xml ${MODULES_NAME} ${NAVIT_SUPPORT_LIBS} ${LANG_RESOURCES}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/res/raw/
- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/libs/${ANDROID_ARCH}
- COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/navit/libnavit.so ${CMAKE_CURRENT_BINARY_DIR}/libs/${ANDROID_ARCH}/
- COMMAND ${CMAKE_COMMAND}
- -D GLOB_EXP="${PROJECT_BINARY_DIR}/navit/navit*.xml"
- -D DST=${CMAKE_CURRENT_BINARY_DIR}/res/raw
- -P ${PROJECT_SOURCE_DIR}/cmake/copy_files.cmake
- COMMAND ${CMAKE_COMMAND}
- -D GLOB_EXP="${PROJECT_BINARY_DIR}/navit/icons/*.png"
- -D DST=${CMAKE_CURRENT_BINARY_DIR}/res/drawable-nodpi
- -D LOWER=1
- -P ${PROJECT_SOURCE_DIR}/cmake/copy_files.cmake
- COMMAND ${CMAKE_COMMAND}
- -D GLOB_EXP="${PROJECT_BINARY_DIR}/navit/*/*/.libs/lib[b-z]*.so"
- -D DST=${CMAKE_CURRENT_BINARY_DIR}/libs/${ANDROID_ARCH}
- -P ${PROJECT_SOURCE_DIR}/cmake/copy_files.cmake
- COMMAND ${CMAKE_COMMAND}
- -D GLOB_EXP="${PROJECT_BINARY_DIR}/po/*.mo"
- -D DST=${CMAKE_CURRENT_BINARY_DIR}/res/raw
- -D LOWER=1
- -P ${PROJECT_SOURCE_DIR}/cmake/copy_files.cmake
- )
-
- add_dependencies (android_resources images locales ${NAVIT_LIBNAME})
-
- add_custom_target ( apkg
- COMMAND ant debug
- )
-
- add_custom_target ( apkg-release
- COMMAND ant release
- )
-
- add_dependencies(apkg android_resources)
- add_dependencies(apkg-release android_resources)
-
-endif(ANDROID)
diff --git a/navit/android/android_layout_default_new.xml b/navit/android/android_layout_default_new.xml
deleted file mode 100644
index d36659f1e..000000000
--- a/navit/android/android_layout_default_new.xml
+++ /dev/null
@@ -1,855 +0,0 @@
- <layer name="polygons">
- <itemgra item_types="poly_wood" order="13-">
- <polygon color="#8ec78d"/>
- <text text_size="5"/>
- </itemgra>
-
- <!-- ocean -->
- <itemgra item_types="poly_water_tiled">
- <polygon color="#82c8ea"/>
- </itemgra>
- <!-- ocean -->
-
- <!-- rivers with text -->
- <itemgra item_types="poly_water" order="10-">
- <polygon color="#82c8ea"/>
- <polyline color="#5096b8"/>
- <text text_size="5"/>
- </itemgra>
- <!-- rivers with text -->
-
-
- <itemgra item_types="poly_flats,poly_scrub,poly_military_zone,poly_marine,plantation,tundra" order="14-">
- <polygon color="#a0a0a0"/>
- <text text_size="5"/>
- </itemgra>
- <itemgra item_types="poly_park" order="14-">
- <polygon color="#7cc334"/>
- <text text_size="5"/>
- </itemgra>
- <itemgra item_types="poly_pedestrian" order="14">
- <polyline color="#d2d2d2" width="13"/>
- <polyline color="#dddddd" width="9"/>
- <polygon color="#dddddd"/>
- </itemgra>
- <itemgra item_types="poly_pedestrian" order="15">
- <polyline color="#d2d2d2" width="18"/>
- <polyline color="#dddddd" width="14"/>
- <polygon color="#dddddd"/>
- </itemgra>
- <itemgra item_types="poly_pedestrian" order="16">
- <polyline color="#d2d2d2" width="21"/>
- <polyline color="#dddddd" width="17"/>
- <polygon color="#dddddd"/>
- </itemgra>
- <itemgra item_types="poly_pedestrian" order="17">
- <polyline color="#d2d2d2" width="25"/>
- <polyline color="#dddddd" width="21"/>
- <polygon color="#dddddd"/>
- </itemgra>
- <itemgra item_types="poly_pedestrian" order="18">
- <polyline color="#d2d2d2" width="40"/>
- <polyline color="#dddddd" width="34"/>
- <polygon color="#dddddd"/>
- </itemgra>
- <itemgra item_types="poly_airport" order="5-">
- <polygon color="#a0a0a0"/>
- </itemgra>
-
- <!--
- <itemgra item_types="poly_sport,poly_sports_pitch" order="0-">
- <polygon color="#4af04f"/>
- </itemgra>
- <itemgra item_types="poly_industry,poly_place" order="0-">
- <polygon color="#e6e6e6"/>
- </itemgra>
- -->
-
- <!--
- <itemgra item_types="poly_street_1" order="8-13">
- <polygon color="#ffffff"/>
- <polyline color="#d2d2d2" width="1"/>
- </itemgra>
- <itemgra item_types="poly_street_1" order="14-16">
- <polygon color="#ffffff"/>
- <polyline color="#d2d2d2" width="2"/>
- </itemgra>
- <itemgra item_types="poly_street_1" order="17-18">
- <polygon color="#ffffff"/>
- <polyline color="#d2d2d2" width="3"/>
- </itemgra>
- -->
-
-
- <!--
- <itemgra item_types="poly_street_2" order="7-12">
- <polygon color="#fefc8c"/>
- <polyline color="#c0c0c0" width="1"/>
- </itemgra>
- <itemgra item_types="poly_street_2" order="13-16">
- <polygon color="#fefc8c"/>
- <polyline color="#c0c0c0" width="2"/>
- </itemgra>
- <itemgra item_types="poly_street_2" order="17-18">
- <polygon color="#fefc8c"/>
- <polyline color="#c0c0c0" width="3"/>
- </itemgra>
- -->
-
- <!--
- <itemgra item_types="poly_street_3" order="7-11">
- <polygon color="#fefc8c"/>
- <polyline color="#a0a0a0" width="1"/>
- </itemgra>
- <itemgra item_types="poly_street_3" order="12-15">
- <polygon color="#fefc8c"/>
- <polyline color="#a0a0a0" width="2"/>
- </itemgra>
- <itemgra item_types="poly_street_3" order="16-18">
- <polygon color="#fefc8c"/>
- <polyline color="#a0a0a0" width="3"/>
- </itemgra>
- -->
-
-
-
- <!--
- <itemgra item_types="water_line" order="0-">
- <polyline color="#5096b8" width="2"/>
- <text text_size="5"/>
- </itemgra>
- -->
-
- <!--
- <itemgra item_types="water_river" order="0-5">
- <polyline color="#82c8ea" width="2"/>
- </itemgra>
- -->
- <itemgra item_types="water_river" order="6-7">
- <polyline color="#82c8ea" width="3"/>
- </itemgra>
- <itemgra item_types="water_river" order="8-9">
- <polyline color="#82c8ea" width="4"/>
- </itemgra>
- <itemgra item_types="water_river" order="10-">
- <polyline color="#82c8ea" width="4"/>
- <text text_size="10"/>
- </itemgra>
- <itemgra item_types="water_canal" order="13-">
- <polyline color="#82c8ea" width="3"/>
- <text text_size="10"/>
- </itemgra>
- <itemgra item_types="water_stream" order="13-">
- <polyline color="#82c8ea" width="2"/>
- <text text_size="7"/>
- </itemgra>
- <itemgra item_types="water_drain" order="14-">
- <polyline color="#82c8ea" width="1"/>
- <text text_size="5"/>
- </itemgra>
- <itemgra item_types="poly_apron" order="13-">
- <polygon color="#d0d0d0"/>
- </itemgra>
- <itemgra item_types="poly_terminal" order="14-">
- <polygon color="#e3c6a6"/>
- </itemgra>
- <itemgra item_types="poly_car_parking" order="15-">
- <polygon color="#e7cf87"/>
- </itemgra>
- <itemgra item_types="poly_building" order="14-">
- <polygon color="#b6a6a6"/>
- </itemgra>
- <itemgra item_types="rail" order="13-">
- <polyline color="#696969" width="3"/>
- <polyline color="#ffffff" width="1" dash="5,5"/>
- </itemgra>
- <itemgra item_types="ferry" order="14-">
- <polyline color="#000000" width="1" dash="10"/>
- </itemgra>
-
-
- <itemgra item_types="border_country" order="0-4">
- <polyline color="#9b1199" width="8" />
- </itemgra>
- <itemgra item_types="border_country" order="5-7">
- <polyline color="#9b1199" width="12" />
- </itemgra>
- <itemgra item_types="border_country" order="8-12">
- <polyline color="#9b1199" width="20" dash="10,5"/>
- </itemgra>
- <itemgra item_types="border_country" order="13-">
- <polyline color="#9b1199" width="30" dash="10,5,2,1"/>
- </itemgra>
-
-
- </layer>
- <layer name="streets">
-
- <!-- route -->
- <itemgra item_types="street_route" order="2">
- <polyline color="#69e068" width="8"/>
- </itemgra>
- <itemgra item_types="street_route" order="3-5">
- <polyline color="#69e068" width="10"/>
- </itemgra>
- <itemgra item_types="street_route" order="6">
- <polyline color="#69e068" width="12"/>
- </itemgra>
- <itemgra item_types="street_route" order="7-8">
- <polyline color="#69e068" width="16"/>
- </itemgra>
- <itemgra item_types="street_route" order="9-10">
- <polyline color="#69e068" width="20"/>
- </itemgra>
- <itemgra item_types="street_route" order="11">
- <polyline color="#69e068" width="28"/>
- </itemgra>
- <itemgra item_types="street_route" order="12">
- <polyline color="#69e068" width="32"/>
- </itemgra>
- <itemgra item_types="street_route" order="13">
- <polyline color="#69e068" width="52"/>
- </itemgra>
- <itemgra item_types="street_route" order="14">
- <polyline color="#69e068" width="64"/>
- </itemgra>
- <itemgra item_types="street_route" order="15">
- <polyline color="#69e068" width="68"/>
- </itemgra>
- <itemgra item_types="street_route" order="16">
- <polyline color="#69e068" width="132"/>
- </itemgra>
- <itemgra item_types="street_route" order="17">
- <polyline color="#69e068" width="268"/>
- </itemgra>
- <itemgra item_types="street_route" order="18">
- <polyline color="#69e068" width="530"/>
- </itemgra>
- <!-- route -->
-
-
-
- <itemgra item_types="selected_line" order="2">
- <polyline color="#ba00b8" width="4"/>
- </itemgra>
- <itemgra item_types="selected_line" order="3-5">
- <polyline color="#ba00b8" width="8"/>
- </itemgra>
- <itemgra item_types="selected_line" order="6">
- <polyline color="#ba00b8" width="10"/>
- </itemgra>
- <itemgra item_types="selected_line" order="7-8">
- <polyline color="#ba00b8" width="16"/>
- </itemgra>
- <itemgra item_types="selected_line" order="9-10">
- <polyline color="#ba00b8" width="20"/>
- </itemgra>
- <itemgra item_types="selected_line" order="11">
- <polyline color="#ba00b8" width="28"/>
- </itemgra>
- <itemgra item_types="selected_line" order="12">
- <polyline color="#ba00b8" width="32"/>
- </itemgra>
- <itemgra item_types="selected_line" order="13">
- <polyline color="#ba00b8" width="52"/>
- </itemgra>
- <itemgra item_types="selected_line" order="14">
- <polyline color="#ba00b8" width="64"/>
- </itemgra>
- <itemgra item_types="selected_line" order="15">
- <polyline color="#ba00b8" width="68"/>
- </itemgra>
- <itemgra item_types="selected_line" order="16">
- <polyline color="#ba00b8" width="132"/>
- </itemgra>
- <itemgra item_types="selected_line" order="17">
- <polyline color="#ba00b8" width="268"/>
- </itemgra>
- <itemgra item_types="selected_line" order="18">
- <polyline color="#ba00b8" width="530"/>
- </itemgra>
- <itemgra item_types="forest_way_1" order="14-">
- <polyline color="#0070c0" width="6"/>
- </itemgra>
- <itemgra item_types="forest_way_2" order="14-">
- <polyline color="#ff0000" width="3"/>
- </itemgra>
- <itemgra item_types="forest_way_3" order="14-">
- <polyline color="#ff0000" width="1" dash="2,4"/>
- </itemgra>
- <itemgra item_types="forest_way_4" order="14-">
- <polyline color="#119a2e" width="1" dash="4,10"/>
- </itemgra>
- <itemgra item_types="street_nopass" order="14-">
- <polyline color="#000000" width="1"/>
- </itemgra>
- <itemgra item_types="track_paved" order="14-">
- <polyline color="#000000" width="1"/>
- </itemgra>
- <itemgra item_types="track_gravelled" order="14">
- <polyline color="#ffffff" width="4" dash="4,8"/>
- <polyline color="#800000" width="2" dash="4,8"/>
- </itemgra>
- <itemgra item_types="track_gravelled" order="15-16">
- <polyline color="#ffffff" width="5" dash="5,10"/>
- <polyline color="#800000" width="3" dash="5,10"/>
- </itemgra>
- <itemgra item_types="track_gravelled" order="17-">
- <polyline color="#ffffff" width="7" dash="7,15"/>
- <polyline color="#800000" width="5" dash="7,15"/>
- </itemgra>
- <itemgra item_types="track_unpaved" order="14-">
- <polyline color="#000000" width="1"/>
- </itemgra>
- <itemgra item_types="bridleway" order="14-">
- <polyline color="#000000" width="1"/>
- </itemgra>
- <itemgra item_types="cycleway" order="14-">
- <polyline color="#000000" width="1"/>
- </itemgra>
- <itemgra item_types="lift_cable_car" order="15-">
- <polyline color="#696969" width="1" dash="5"/>
- </itemgra>
- <itemgra item_types="lift_chair" order="15-">
- <polyline color="#696969" width="1" dash="5"/>
- </itemgra>
- <itemgra item_types="lift_drag" order="15-">
- <polyline color="#696969" width="1" dash="5"/>
- </itemgra>
- <itemgra item_types="footway" order="15-16">
- <polyline color="#ffffff" width="5" dash="5,10"/>
- <polyline color="#ff0000" width="3" dash="5,10"/>
- </itemgra>
- <itemgra item_types="footway" order="17-">
- <polyline color="#ffffff" width="7" dash="7,15"/>
- <polyline color="#ff0000" width="5" dash="7,15"/>
- </itemgra>
- <itemgra item_types="steps" order="15-">
- <polyline color="#000000" width="1"/>
- </itemgra>
- <itemgra item_types="street_pedestrian,living_street" order="14">
- <polyline color="#d2d2d2" width="13"/>
- <polyline color="#dddddd" width="9"/>
- </itemgra>
- <itemgra item_types="street_pedestrian,living_street" order="15">
- <polyline color="#d2d2d2" width="18"/>
- <polyline color="#dddddd" width="14"/>
- </itemgra>
- <itemgra item_types="street_pedestrian,living_street" order="16">
- <polyline color="#d2d2d2" width="21"/>
- <polyline color="#dddddd" width="17"/>
- </itemgra>
- <itemgra item_types="street_pedestrian,living_street" order="17">
- <polyline color="#d2d2d2" width="25"/>
- <polyline color="#dddddd" width="21"/>
- </itemgra>
- <itemgra item_types="street_pedestrian,living_street" order="18">
- <polyline color="#d2d2d2" width="40"/>
- <polyline color="#dddddd" width="34"/>
- </itemgra>
- <itemgra item_types="street_service" order="14">
- <polyline color="#d2d2d2" width="7"/>
- <polyline color="#fefefe" width="5"/>
- </itemgra>
- <itemgra item_types="street_service" order="15">
- <polyline color="#d2d2d2" width="8"/>
- <polyline color="#fefefe" width="6"/>
- </itemgra>
- <itemgra item_types="street_service" order="16">
- <polyline color="#d2d2d2" width="9"/>
- <polyline color="#fefefe" width="7"/>
- </itemgra>
- <itemgra item_types="street_service" order="17">
- <polyline color="#d2d2d2" width="10"/>
- <polyline color="#fefefe" width="8"/>
- </itemgra>
- <itemgra item_types="street_service" order="18">
- <polyline color="#d2d2d2" width="11"/>
- <polyline color="#fefefe" width="9"/>
- </itemgra>
- <itemgra item_types="street_parking_lane" order="15">
- <polyline color="#d2d2d2" width="6"/>
- <polyline color="#fefefe" width="4"/>
- </itemgra>
- <itemgra item_types="street_parking_lane" order="16">
- <polyline color="#d2d2d2" width="7"/>
- <polyline color="#fefefe" width="5"/>
- </itemgra>
- <itemgra item_types="street_parking_lane" order="17">
- <polyline color="#d2d2d2" width="8"/>
- <polyline color="#fefefe" width="6"/>
- </itemgra>
- <itemgra item_types="street_parking_lane" order="18">
- <polyline color="#d2d2d2" width="9"/>
- <polyline color="#fefefe" width="7"/>
- </itemgra>
-
- <!-- very small "white" street -->
- <itemgra item_types="street_0,street_1_city,street_1_land" order="12">
- <polyline color="#d2d2d2" width="1"/>
- </itemgra>
- <itemgra item_types="street_0,street_1_city,street_1_land" order="13-14">
- <polyline color="#d2d2d2" width="17"/>
- <polyline color="#ffffff" width="13"/>
- </itemgra>
- <itemgra item_types="street_0,street_1_city,street_1_land" order="15">
- <polyline color="#d2d2d2" width="18"/>
- <polyline color="#ffffff" width="14"/>
- </itemgra>
- <itemgra item_types="street_0,street_1_city,street_1_land" order="16">
- <polyline color="#d2d2d2" width="30"/>
- <polyline color="#ffffff" width="26"/>
- </itemgra>
- <itemgra item_types="street_0,street_1_city,street_1_land" order="17">
- <polyline color="#d2d2d2" width="67"/>
- <polyline color="#ffffff" width="61"/>
- </itemgra>
- <itemgra item_types="street_0,street_1_city,street_1_land" order="18">
- <polyline color="#d2d2d2" width="132"/>
- <polyline color="#ffffff" width="126"/>
- </itemgra>
-
-
- <!-- small -->
- <itemgra item_types="street_2_city,street_2_land,ramp" order="11-12">
- <polyline color="#c0c0c0" width="9"/>
- <polyline color="#fefc8c" width="7"/>
- </itemgra>
- <itemgra item_types="street_2_city,street_2_land,ramp" order="13-14">
- <polyline color="#c0c0c0" width="13"/>
- <polyline color="#fefc8c" width="11"/>
- </itemgra>
- <itemgra item_types="street_2_city,street_2_land,ramp" order="15">
- <polyline color="#c0c0c0" width="19"/>
- <polyline color="#fefc8c" width="15"/>
- </itemgra>
- <itemgra item_types="street_2_city,street_2_land,ramp" order="16">
- <polyline color="#c0c0c0" width="30"/>
- <polyline color="#fefc8c" width="26"/>
- </itemgra>
- <itemgra item_types="street_2_city,street_2_land,ramp" order="17">
- <polyline color="#c0c0c0" width="63"/>
- <polyline color="#fefc8c" width="57"/>
- </itemgra>
- <itemgra item_types="street_2_city,street_2_land,ramp" order="18">
- <polyline color="#c0c0c0" width="100"/>
- <polyline color="#fefc8c" width="90"/>
- </itemgra>
-
-
- <!-- little bigger -->
- <!--
- <itemgra item_types="street_3_city,street_3_land,roundabout" order="10">
- <polyline color="#e0e0e0" width="2"/>
- </itemgra>
- -->
- <itemgra item_types="street_3_city,street_3_land,roundabout" order="11-12">
- <polyline color="#a0a0a0" width="9"/>
- <polyline color="#fefc8c" width="7"/>
- </itemgra>
- <itemgra item_types="street_3_city,street_3_land,roundabout" order="13-14">
- <polyline color="#a0a0a0" width="21"/>
- <polyline color="#fefc8c" width="17"/>
- </itemgra>
- <itemgra item_types="street_3_city,street_3_land,roundabout" order="15">
- <polyline color="#a0a0a0" width="25"/>
- <polyline color="#fefc8c" width="21"/>
- </itemgra>
- <itemgra item_types="street_3_city,street_3_land,roundabout" order="16">
- <polyline color="#a0a0a0" width="40"/>
- <polyline color="#fefc8c" width="34"/>
- </itemgra>
- <itemgra item_types="street_3_city,street_3_land,roundabout" order="17">
- <polyline color="#a0a0a0" width="79"/>
- <polyline color="#fefc8c" width="73"/>
- </itemgra>
- <itemgra item_types="street_3_city,street_3_land,roundabout" order="18">
- <polyline color="#a0a0a0" width="156"/>
- <polyline color="#fefc8c" width="150"/>
- </itemgra>
-
-
- <!-- big -->
- <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="2-6">
- <polyline color="#f8dc79" width="4"/>
- </itemgra>
- <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="7-8">
- <!--<polyline color="#404040" width="3"/>-->
- <polyline color="#f8dc79" width="4"/>
- </itemgra>
- <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="9">
- <!--<polyline color="#000000" width="5"/>-->
- <polyline color="#f8dc79" width="5"/>
- </itemgra>
- <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="10">
- <!--<polyline color="#000000" width="6"/>-->
- <polyline color="#f8dc79" width="6"/>
- </itemgra>
- <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="11">
- <polyline color="#000000" width="9"/>
- <polyline color="#f8dc79" width="7"/>
- </itemgra>
- <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="12">
- <polyline color="#000000" width="13"/>
- <polyline color="#f8dc79" width="9"/>
- </itemgra>
- <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="13">
- <polyline color="#000000" width="18"/>
- <polyline color="#f8dc79" width="14"/>
- </itemgra>
- <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="14">
- <polyline color="#000000" width="21"/>
- <polyline color="#f8dc79" width="17"/>
- </itemgra>
- <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="15">
- <polyline color="#000000" width="24"/>
- <polyline color="#f8dc79" width="20"/>
- </itemgra>
- <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="16">
- <polyline color="#000000" width="39"/>
- <polyline color="#f8dc79" width="33"/>
- </itemgra>
- <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="17">
- <polyline color="#000000" width="78"/>
- <polyline color="#f8dc79" width="72"/>
- </itemgra>
- <itemgra item_types="street_4_city,street_4_land,street_n_lanes" order="18">
- <polyline color="#000000" width="156"/>
- <polyline color="#f8dc79" width="150"/>
- </itemgra>
-
-
- <!-- autobahn / highway -->
- <itemgra item_types="highway_city,highway_land" order="0-1">
- <polyline color="#fc843b" width="1"/>
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="2">
- <polyline color="#fc843b" width="3"/>
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="3-5">
- <polyline color="#fc843b" width="6"/>
- <!--<polyline color="#fc843b" width="3"/>-->
- <!--<polyline color="#fc843b" width="1"/>-->
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="6">
- <!--<polyline color="#a8aab3" width="4"/>-->
- <polyline color="#fc843b" width="6"/>
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="7-8">
- <!--<polyline color="#a8aab3" width="7"/>-->
- <polyline color="#fc843b" width="6"/>
- <!--<polyline color="#a8aab3" width="1"/>-->
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="9">
- <polyline color="#fc843b" width="7"/>
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="10">
- <!--<polyline color="#a8aab3" width="9"/>-->
- <polyline color="#fc843b" width="9"/>
- <!--<polyline color="#a8aab3" width="1"/>-->
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="11">
- <polyline color="#a8aab3" width="13"/>
- <polyline color="#fc843b" width="9"/>
- <polyline color="#a8aab3" width="1"/>
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="12">
- <polyline color="#a8aab3" width="15"/>
- <polyline color="#fc843b" width="10"/>
- <polyline color="#a8aab3" width="1"/>
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="13">
- <polyline color="#a8aab3" width="25"/>
- <polyline color="#fc843b" width="17"/>
- <polyline color="#a8aab3" width="1"/>
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="14">
- <polyline color="#a8aab3" width="31"/>
- <polyline color="#fc843b" width="24"/>
- <polyline color="#a8aab3" width="1"/>
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="15">
- <polyline color="#a8aab3" width="33"/>
- <polyline color="#fc843b" width="27"/>
- <polyline color="#a8aab3" width="1"/>
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="16">
- <polyline color="#a8aab3" width="65"/>
- <polyline color="#fc843b" width="59"/>
- <polyline color="#a8aab3" width="1"/>
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="17">
- <polyline color="#a8aab3" width="133"/>
- <polyline color="#fc843b" width="127"/>
- <polyline color="#a8aab3" width="1"/>
- </itemgra>
- <itemgra item_types="highway_city,highway_land" order="18">
- <polyline color="#a8aab3" width="264"/>
- <polyline color="#fc843b" width="258"/>
- <polyline color="#a8aab3" width="1"/>
- </itemgra>
-
-
-
-
-
- <itemgra item_types="highway_exit_label" order="13-">
- <circle color="#000000" radius="3" text_size="7"/>
- </itemgra>
-
-
- <itemgra item_types="highway_city,highway_land,street_4_city,street_4_land,street_n_lanes" order="13-18">
- <text text_size="8"/>
- </itemgra>
- <itemgra item_types="street_2_city,street_2_land,street_3_city,street_3_land,ramp" order="13-18">
- <text text_size="9"/>
- </itemgra>
- <itemgra item_types="street_nopass,street_0,street_1_city,street_1_land" order="13-18">
- <text text_size="9"/>
- </itemgra>
-
- <itemgra item_types="traffic_distortion" order="7-8">
- <polyline color="#ff9000" width="8"/>
- </itemgra>
- <itemgra item_types="traffic_distortion" order="9-10">
- <polyline color="#ff9000" width="10"/>
- </itemgra>
- <itemgra item_types="traffic_distortion" order="11">
- <polyline color="#ff9000" width="14"/>
- </itemgra>
- <itemgra item_types="traffic_distortion" order="12">
- <polyline color="#ff9000" width="16"/>
- </itemgra>
- <itemgra item_types="traffic_distortion" order="13">
- <polyline color="#ff9000" width="26"/>
- </itemgra>
- <itemgra item_types="traffic_distortion" order="14">
- <polyline color="#ff9000" width="32"/>
- </itemgra>
- <itemgra item_types="traffic_distortion" order="15">
- <polyline color="#ff9000" width="34"/>
- </itemgra>
- <itemgra item_types="traffic_distortion" order="16">
- <polyline color="#ff9000" width="66"/>
- </itemgra>
- <itemgra item_types="traffic_distortion" order="17">
- <polyline color="#ff9000" width="134"/>
- </itemgra>
- <itemgra item_types="traffic_distortion" order="18">
- <polyline color="#ff9000" width="265"/>
- </itemgra>
- </layer>
- <layer name="polylines">
- <itemgra item_types="rail_tram" order="13-">
- <polyline color="#606060" width="2"/>
- </itemgra>
- </layer>
- <layer name="labels">
- <itemgra item_types="house_number" order="15-">
- <circle color="#000000" radius="3" text_size="7"/>
- </itemgra>
-
-
- <itemgra item_types="town_label,district_label,town_label_0e0,town_label_1e0,town_label_2e0,town_label_5e0,town_label_1e1,town_label_2e1,town_label_5e1,town_label_1e2,town_label_2e2,town_label_5e2,district_label_0e0,district_label_1e0,district_label_2e0,district_label_5e0,district_label_1e1,district_label_2e1,district_label_5e1,district_label_1e2,district_label_2e2,district_label_5e2" order="13-">
- <circle color="#000000" radius="3" text_size="7"/>
- </itemgra>
-
-
- <itemgra item_types="district_label_1e3,district_label_2e3,district_label_5e3" order="12-">
- <circle color="#000000" radius="3" text_size="7"/>
- </itemgra>
- <itemgra item_types="town_label_1e3,place_label" order="10-">
- <circle color="#000000" radius="3" text_size="10"/>
- </itemgra>
- <itemgra item_types="district_label_1e4,district_label_2e4,district_label_5e4" order="11-">
- <circle color="#000000" radius="3" text_size="7"/>
- </itemgra>
- <itemgra item_types="town_label_2e3" order="11-">
- <circle color="#000000" radius="3" text_size="10"/>
- </itemgra>
- <itemgra item_types="town_label_5e3,town_label_1e4,town_label_2e4,town_label_5e4" order="11-">
- <circle color="#000000" radius="3" text_size="15"/>
- </itemgra>
- <itemgra item_types="district_label_1e5,district_label_2e5,district_label_5e5" order="10-">
- <circle color="#000000" radius="3" text_size="7"/>
- </itemgra>
- <itemgra item_types="town_label_2e3" order="10">
- <circle color="#000000" radius="3" text_size="7"/>
- </itemgra>
- <itemgra item_types="district_label_1e6,district_label_2e6,district_label_5e6,district_label_1e7" order="9-">
- <circle color="#000000" radius="3" text_size="7"/>
- </itemgra>
- <itemgra item_types="town_label_5e3" order="9-10">
- <circle color="#000000" radius="3" text_size="10"/>
- </itemgra>
- <itemgra item_types="town_label_1e4" order="8-9">
- <circle color="#000000" radius="3" text_size="10"/>
- </itemgra>
- <itemgra item_types="town_label_2e4,town_label_5e4" order="7-8">
- <circle color="#000000" radius="3" text_size="10"/>
- </itemgra>
- <itemgra item_types="town_label_1e5,town_label_2e5,town_label_5e5" order="5-">
- <circle color="#000000" radius="3" text_size="15"/>
- </itemgra>
- <itemgra item_types="town_label_1e6,town_label_2e6,town_label_5e6,town_label_1e7" order="5-">
- <circle color="#000000" radius="3" text_size="20"/>
- </itemgra>
- <itemgra item_types="town_label_1e5,town_label_2e5,town_label_5e5" order="4">
- <circle color="#000000" radius="3" text_size="10"/>
- </itemgra>
- <itemgra item_types="town_label_1e6,town_label_2e6,town_label_5e6,town_label_1e7" order="4">
- <circle color="#000000" radius="3" text_size="15"/>
- </itemgra>
- <itemgra item_types="town_label_1e6,town_label_2e6,town_label_5e6,town_label_1e7" order="0-3">
- <circle color="#000000" radius="3" text_size="10"/>
- </itemgra>
- </layer>
-
-
- <layer name="Internal">
- <itemgra item_types="track" order="7-">
- <polyline color="#3f3f3f" width="1"/>
- </itemgra>
- <itemgra item_types="track_tracked" order="7-">
- <polyline color="#3f3fff" width="3"/>
- </itemgra>
- <itemgra item_types="rg_segment" order="12-">
- <polyline color="#FF089C" width="1"/>
- <arrows color="#FF089C" width="1"/>
- </itemgra>
- <itemgra item_types="rg_point" order="12-">
- <circle color="#FF089C" radius="10" text_size="7"/>
- </itemgra>
- <itemgra item_types="nav_left_1" order="0-">
- <icon src="nav_left_1_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_left_2" order="0-">
- <icon src="nav_left_2_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_left_3" order="0-">
- <icon src="nav_left_3_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_right_1" order="0-">
- <icon src="nav_right_1_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_right_2" order="0-">
- <icon src="nav_right_2_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_right_3" order="0-">
- <icon src="nav_right_3_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_straight" order="0-">
- <icon src="nav_straight_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_turnaround" order="0-">
- <icon src="nav_turnaround_left_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_l1" order="0-">
- <icon src="nav_roundabout_l1_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_r1" order="0-">
- <icon src="nav_roundabout_r1_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_l2" order="0-">
- <icon src="nav_roundabout_l2_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_r2" order="0-">
- <icon src="nav_roundabout_r2_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_l3" order="0-">
- <icon src="nav_roundabout_l3_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_r3" order="0-">
- <icon src="nav_roundabout_r3_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_l4" order="0-">
- <icon src="nav_roundabout_l4_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_r4" order="0-">
- <icon src="nav_roundabout_r4_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_l5" order="0-">
- <icon src="nav_roundabout_l5_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_r5" order="0-">
- <icon src="nav_roundabout_r5_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_l6" order="0-">
- <icon src="nav_roundabout_l6_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_r6" order="0-">
- <icon src="nav_roundabout_r6_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_l7" order="0-">
- <icon src="nav_roundabout_l7_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_r7" order="0-">
- <icon src="nav_roundabout_r7_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_l8" order="0-">
- <icon src="nav_roundabout_l8_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_roundabout_r8" order="0-">
- <icon src="nav_roundabout_r8_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="route_end" order="0-">
- <icon src="nav_destination_bk.png" w="32" h="32"/>
- </itemgra>
- <itemgra item_types="nav_none" order="0-">
- <icon src="unknown.png"/>
- </itemgra>
- <itemgra item_types="announcement" order="7-">
- <icon src="gui_sound_32_32.png"/>
- <circle color="#FF089C" radius="10" text_size="7"/>
- </itemgra>
- </layer>
-
-
- <layer name="POI Symbols">
- <itemgra item_types="mini_roundabout" order="12-">
- <icon src="mini_roundabout.png"/>
- </itemgra>
- <itemgra item_types="turning_circle" order="12-">
- <icon src="mini_roundabout.png"/>
- </itemgra>
- <itemgra item_types="poi_airport" order="6-">
- <icon src="airport.png"/>
- </itemgra>
- <itemgra item_types="poi_fuel" order="12-">
- <icon src="fuel.png"/>
- </itemgra>
- <itemgra item_types="poi_bridge" order="12-">
- <icon src="bridge.png"/>
- </itemgra>
- <itemgra item_types="highway_exit" order="12-">
- <icon src="exit.png"/>
- </itemgra>
- <itemgra item_types="poi_auto_club" order="13-">
- <icon src="auto_club.png"/>
- </itemgra>
- <itemgra item_types="poi_bank" order="13-">
- <icon src="bank.png"/>
- </itemgra>
- <itemgra item_types="poi_danger_area" order="13-">
- <icon src="danger_16_16.png"/>
- </itemgra>
- <itemgra item_types="poi_forbidden_area" order="13-">
- <icon src="forbiden_area.png"/>
- </itemgra>
- <itemgra item_types="poi_tunnel" order="12-">
- <icon src="tunnel.png"/>
- </itemgra>
- <itemgra item_types="traffic_signals" order="14-">
- <icon src="traffic_signals.png"/>
- </itemgra>
- </layer>
- <layer name="POI Labels">
- <itemgra item_types="poi_airport,town_ghost,poi_hotel,poi_car_parking,poi_car_dealer_parts,poi_fuel,poi_shopping,poi_attraction,poi_cafe,poi_bar,highway_exit,poi_camp_rv,poi_museum_history,poi_hospital,poi_dining,poi_fastfood,poi_police,poi_autoservice,poi_bank,poi_bus_station,poi_bus_stop,poi_business_service,poi_car_rent,poi_church,poi_cinema,poi_concert,poi_drinking_water,poi_emergency,poi_fair,poi_fish,poi_government_building,poi_hotspring,poi_information,poi_justice,poi_landmark,poi_library,poi_mall,poi_manmade_feature,poi_marine,poi_marine_type,poi_mark,poi_oil_field,poi_peak,poi_personal_service,poi_pharmacy,poi_post_office,poi_public_office,poi_rail_halt,poi_rail_station,poi_rail_tram_stop,poi_repair_service,poi_resort,poi_restaurant,poi_restricted_area,poi_sailing,poi_scenic_area,poi_school,poi_service,poi_shop_retail,poi_skiing,poi_social_service,poi_sport,poi_stadium,poi_swimming,poi_theater,poi_townhall,poi_trail,poi_truck_stop,poi_tunnel,poi_worship,poi_wrecker,poi_zoo,poi_biergarten,poi_castle,poi_ruins,poi_memorial,poi_monument,poi_shelter,poi_fountain,poi_viewpoint,vehicle" order="15-">
- <circle color="#606060" radius="0" width="0" text_size="10"/>
- </itemgra>
- <!--
- <itemgra item_types="poi_custom0,poi_custom1,poi_custom2,poi_custom3,poi_custom4,poi_custom5,poi_custom6,poi_custom7,poi_custom8,poi_custom9,poi_customa,poi_customb,poi_customc,poi_customd,poi_custome,poi_customf" order="14-">
- <circle color="#606060" radius="0" width="0" text_size="10"/>
- </itemgra>
- -->
- </layer>
diff --git a/navit/android/build.properties b/navit/android/build.properties
deleted file mode 100644
index 5e6455582..000000000
--- a/navit/android/build.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-# sources are UTF-8
-java.encoding=utf-8
diff --git a/navit/android/change_xslt.sh b/navit/android/change_xslt.sh
deleted file mode 100755
index 5f11f0930..000000000
--- a/navit/android/change_xslt.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#! /bin/bash
-###########################################
-#
-# change android car layout into XSLT for all densities
-# handle with care!
-#
-# Zoff <zoff@zoff.cc> 2011-02-15
-#
-###########################################
-
-in="android_layout_default_new.xml"
-temp="/tmp/temp_layout.tmp"
-out="android_layout_default_parsed.xml"
-
-# setup temp file
-rm -f "$temp"
-cp -p "$in" "$temp"
-
-REG0='0-{round(@1@-number($LAYOUT_001_ORDER_DELTA_1))}'
-REG1='{round(@1@-number($LAYOUT_001_ORDER_DELTA_1))}-'
-REG2='-{round(@1@-number($LAYOUT_001_ORDER_DELTA_1))}'
-REG3='{round(@1@-number($LAYOUT_001_ORDER_DELTA_1))}-{round(@2@-number($LAYOUT_001_ORDER_DELTA_1))}'
-REG4='{round(@1@-number($LAYOUT_001_ORDER_DELTA_1))}'
-
-for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18;do
- a=`echo "$REG0"|sed -e "s#@1@#$i#"`
- cat "$temp"|sed -e "s#order=\"0-${i}\"#order=\"${a}\"#g" > "$out"
- cp -p "$out" "$temp"
-done
-
-# dont change order="0-" values !!
-for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18;do
- a=`echo "$REG1"|sed -e "s#@1@#$i#"`
- cat "$temp"|sed -e "s#order=\"${i}-\"#order=\"${a}\"#g" > "$out"
- cp -p "$out" "$temp"
-done
-
-for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18;do
- a=`echo "$REG2"|sed -e "s#@1@#$i#"`
- cat "$temp"|sed -e "s#order=\"-${i}\"#order=\"${a}\"#g" > "$out"
- cp -p "$out" "$temp"
-done
-
-
-for j in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18;do
- for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18;do
- a=`echo "$REG3"|sed -e "s#@1@#$i#"|sed -e "s#@2@#$j#"`
- cat "$temp"|sed -e "s#order=\"${i}-${j}\"#order=\"${a}\"#g" > "$out"
- cp -p "$out" "$temp"
- done
-done
-
-for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18;do
- a=`echo "$REG4"|sed -e "s#@1@#$i#"`
- cat "$temp"|sed -e "s#order=\"${i}\"#order=\"${a}\"#g" > "$out"
- cp -p "$out" "$temp"
-done
-
diff --git a/navit/android/libs/TTS_library_stub.jar b/navit/android/libs/TTS_library_stub.jar
deleted file mode 100644
index 194b82733..000000000
--- a/navit/android/libs/TTS_library_stub.jar
+++ /dev/null
Binary files differ
diff --git a/navit/android/libs/acra-4.8.5.jar b/navit/android/libs/acra-4.8.5.jar
deleted file mode 100644
index f0044ece8..000000000
--- a/navit/android/libs/acra-4.8.5.jar
+++ /dev/null
Binary files differ
diff --git a/navit/android/libs/android-support-v4.jar b/navit/android/libs/android-support-v4.jar
deleted file mode 100644
index aa0b1a5cc..000000000
--- a/navit/android/libs/android-support-v4.jar
+++ /dev/null
Binary files differ
diff --git a/navit/android/po2xml.xslt b/navit/android/po2xml.xslt
deleted file mode 100644
index 1a92d2db4..000000000
--- a/navit/android/po2xml.xslt
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:po2xml="http://example.com/namespace" exclude-result-prefixes="po2xml">
-<xsl:param name="po_file"/>
-<xsl:output method="xml" indent="yes" encoding="utf-8"/>
-
-<xsl:function name="po2xml:escape">
- <xsl:param name="str" />
- <xsl:sequence select="replace($str,concat('(',codepoints-to-string(39),')'),'\\$1')" />
-</xsl:function>
-
-<xsl:template match="/">
- <resources>
- <xsl:variable name="r" select="." />
- <xsl:for-each select="tokenize(replace(unparsed-text($po_file),'\r',''), '\n+\n')">
- <xsl:analyze-string regex="(.*\n)?msgid &quot;(.*)&quot;\nmsgstr &quot;(.*)&quot;$" select="." flags="s">
- <xsl:matching-substring>
- <xsl:variable name="comment" select="replace(regex-group(1),'#','')" />
- <xsl:variable name="msgid" select="po2xml:escape(replace(regex-group(2),'&quot;\n&quot;','','s'))" />
- <xsl:variable name="msgstr" select="po2xml:escape(replace(regex-group(3),'&quot;\n&quot;','','s'))" />
- <xsl:variable name="resname" select="$r/resources/string[text()=$msgid]/@name" />
- <xsl:choose>
- <xsl:when test="$msgid!='' and $msgstr!='' and $resname!=''">
- <xsl:choose>
- <xsl:when test="$comment!=''">
- <xsl:comment select="$comment"/>
- </xsl:when>
- </xsl:choose>
- <string>
- <xsl:attribute name='name'><xsl:value-of select="$resname"/></xsl:attribute>
- <xsl:value-of select="$msgstr"/>
- </string>
- </xsl:when>
- </xsl:choose>
- </xsl:matching-substring>
- </xsl:analyze-string>
- </xsl:for-each>
- </resources>
-</xsl:template>
-</xsl:transform>
-
diff --git a/navit/android/res/drawable-hdpi/ic_notify.png b/navit/android/res/drawable-hdpi/ic_notify.png
deleted file mode 100644
index 7516b2fbd..000000000
--- a/navit/android/res/drawable-hdpi/ic_notify.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-hdpi/icon.png b/navit/android/res/drawable-hdpi/icon.png
deleted file mode 100644
index 311c57b59..000000000
--- a/navit/android/res/drawable-hdpi/icon.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-ldpi/dir_up.png b/navit/android/res/drawable-ldpi/dir_up.png
deleted file mode 100644
index a4f295530..000000000
--- a/navit/android/res/drawable-ldpi/dir_up.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-ldpi/file_icon.png b/navit/android/res/drawable-ldpi/file_icon.png
deleted file mode 100644
index 4fc6a5efe..000000000
--- a/navit/android/res/drawable-ldpi/file_icon.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-ldpi/folder_icon.png b/navit/android/res/drawable-ldpi/folder_icon.png
deleted file mode 100644
index 00a87a8a6..000000000
--- a/navit/android/res/drawable-ldpi/folder_icon.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-ldpi/folder_icon_light.png b/navit/android/res/drawable-ldpi/folder_icon_light.png
deleted file mode 100644
index 642e47a2a..000000000
--- a/navit/android/res/drawable-ldpi/folder_icon_light.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-ldpi/ic_launcher.png b/navit/android/res/drawable-ldpi/ic_launcher.png
deleted file mode 100644
index 99238729d..000000000
--- a/navit/android/res/drawable-ldpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-ldpi/ic_notify.png b/navit/android/res/drawable-ldpi/ic_notify.png
deleted file mode 100644
index 010d55fb3..000000000
--- a/navit/android/res/drawable-ldpi/ic_notify.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-ldpi/icon.png b/navit/android/res/drawable-ldpi/icon.png
deleted file mode 100644
index da2553687..000000000
--- a/navit/android/res/drawable-ldpi/icon.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-mdpi/ic_notify.png b/navit/android/res/drawable-mdpi/ic_notify.png
deleted file mode 100644
index d6de8d53f..000000000
--- a/navit/android/res/drawable-mdpi/ic_notify.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-mdpi/icon.png b/navit/android/res/drawable-mdpi/icon.png
deleted file mode 100644
index f8f68e8bc..000000000
--- a/navit/android/res/drawable-mdpi/icon.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-xhdpi/ic_notify.png b/navit/android/res/drawable-xhdpi/ic_notify.png
deleted file mode 100644
index 72371c974..000000000
--- a/navit/android/res/drawable-xhdpi/ic_notify.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-xhdpi/icon.png b/navit/android/res/drawable-xhdpi/icon.png
deleted file mode 100644
index 649fb32d4..000000000
--- a/navit/android/res/drawable-xhdpi/icon.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-xxhdpi/ic_notify.png b/navit/android/res/drawable-xxhdpi/ic_notify.png
deleted file mode 100644
index d47a41154..000000000
--- a/navit/android/res/drawable-xxhdpi/ic_notify.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/drawable-xxhdpi/icon.png b/navit/android/res/drawable-xxhdpi/icon.png
deleted file mode 100644
index 398945c23..000000000
--- a/navit/android/res/drawable-xxhdpi/icon.png
+++ /dev/null
Binary files differ
diff --git a/navit/android/res/layout/ua_com_vassiliev_filebrowser_layout.xml b/navit/android/res/layout/ua_com_vassiliev_filebrowser_layout.xml
deleted file mode 100644
index 28bedf592..000000000
--- a/navit/android/res/layout/ua_com_vassiliev_filebrowser_layout.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical"
- android:padding="3dp" >
-
- <!--
- android:layout_weight="1"
- android:layout_weight="1"
- android:layout_height="wrap_content"
- android:layout_width="fill_parent"
- android:layout_width="fill_parent"
- android:layout_gravity="top"
- android:background = "#f00"
- android:background = "#0f0"
-
- -->
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_margin="0dp"
- android:gravity="top"
- android:orientation="horizontal"
- android:padding="0dp" >
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_margin="0dp"
- android:layout_weight="1"
- android:gravity="top"
- android:orientation="horizontal"
- android:padding="0dp" >
-
- <Button
- android:id="@+id/upDirectoryButton"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="top"
- android:layout_margin="0dp"
- android:layout_weight="1"
- android:padding="0dp"
- android:drawableLeft="@drawable/dir_up"
- android:text="Up" />
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_margin="0dp"
- android:layout_weight="1"
- android:gravity="top"
- android:orientation="horizontal"
- android:padding="0dp" >
-
- <Button
- android:id="@+id/selectCurrentDirectoryButton"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="top"
- android:gravity = "center|center_vertical"
- android:layout_margin="0dp"
- android:layout_weight="1"
- android:padding="0dp"
- android:text="Select" />
- </LinearLayout>
- </LinearLayout>
-
- <TextView
- android:id="@+id/currentDirectoryTextView"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="Current folder: \n/THis/is/a/long/path/to/test/if/this/will/span/multiple/lines" />
-
- <ListView
- android:id="@+id/fileListView"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_marginTop="5dp"
- android:layout_weight="1" />
-
-</LinearLayout> \ No newline at end of file
diff --git a/navit/android/res/values-v19/styles.xml b/navit/android/res/values-v19/styles.xml
deleted file mode 100644
index b3ea5c14f..000000000
--- a/navit/android/res/values-v19/styles.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<resources>
-
- <!--
- Base application theme for API 19+. This theme completely replaces
- NavitBaseTheme from BOTH res/values/styles.xml and
- res/values-v19/styles.xml on API 19+ devices.
- -->
- <style name="NavitBaseTheme" parent="android:Theme.Holo">
-
- <!-- Main theme colors -->
- <!-- your app branding color for the app bar -->
- <item name="android:colorPrimary">@color/navitYellow500</item>
- <!-- darker variant for the status bar and contextual app bars -->
- <item name="android:colorPrimaryDark">@color/navitYellow700</item>
- <!-- theme UI controls like checkboxes and text fields -->
- <item name="android:colorAccent">@color/navitBlue500</item>
- </style>
-
- <!--
- Main Activity theme for API 19+. This theme completely replaces
- NavitTheme from BOTH res/values/styles.xml and
- res/values-v19/styles.xml on API 19+ devices.
- -->
- <style name="NavitTheme" parent="NavitBaseTheme">
-
- <!-- API 19 theme customizations can go here. -->
- <item name="android:windowTranslucentNavigation">true</item>
- <item name="android:windowTranslucentStatus">true</item>
- </style>
-
-</resources> \ No newline at end of file
diff --git a/navit/android/res/values-v21/styles.xml b/navit/android/res/values-v21/styles.xml
deleted file mode 100644
index a1d66bb3d..000000000
--- a/navit/android/res/values-v21/styles.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<resources>
-
- <!--
- Base application theme for API 21+. This theme completely replaces
- NavitBaseTheme from BOTH res/values/styles.xml and
- res/values-v.../styles.xml on API 21+ devices.
- -->
- <style name="NavitBaseTheme" parent="android:Theme.Material">
-
- <!-- Main theme colors -->
- <!-- your app branding color for the app bar -->
- <item name="android:colorPrimary">@color/navitYellow500</item>
- <!-- darker variant for the status bar and contextual app bars -->
- <item name="android:colorPrimaryDark">@color/navitYellow700</item>
- <!-- theme UI controls like checkboxes and text fields -->
- <item name="android:colorAccent">@color/navitBlue500</item>
- </style>
-
- <!--
- Main Activity theme for API 21+. This theme completely replaces
- NavitTheme from BOTH res/values/styles.xml and
- res/values-v21/styles.xml on API 21+ devices.
- -->
- <style name="NavitTheme" parent="NavitBaseTheme">
-
- <!-- API 21 theme customizations can go here. -->
-
- <!--
- Don't use translucent system bars on API 21 as they are drawn with a semitransparent
- black background which can't be changed.
- -->
- <item name="android:windowTranslucentNavigation">false</item>
- <item name="android:windowTranslucentStatus">false</item>
-
- <!--
- We could set any semi-transparent color here (or change it in code), but this would not
- be available on API 19/20. Simply specifying full transparency allows us to implement a
- separate mechanism that will work on all versions.
- -->
- <item name="android:navigationBarColor">@android:color/transparent</item>
- <item name="android:statusBarColor">@android:color/transparent</item>
-
- <item name="android:windowDrawsSystemBarBackgrounds">true</item>
- </style>
-
-</resources> \ No newline at end of file
diff --git a/navit/android/res/values/strings-dont-translate.xml b/navit/android/res/values/strings-dont-translate.xml
deleted file mode 100644
index db794184f..000000000
--- a/navit/android/res/values/strings-dont-translate.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <!-- LANG=en -->
- <!-- GENERIC -->
- <string name="app_name">Navit</string>
- <string name="map_data_copyright">© OpenStreetMap contributors</string>
- <string name="url_wiki_android">http://wiki.navit-project.org/index.php/Navit_on_Android</string>
- <string name="url_wiki_main">http://wiki.navit-project.org</string>
-
- <!-- NOTIFICATION -->
- <string name="notification_name">@string/app_name</string>
-
- <!-- OPTIONS MENU -->
- <string name="optionsmenu_address_search">@string/address_search_title</string>
-
- <!-- Backup Restore -->
- <string-array name="dialog_backup_restore_items">
- <item >@string/backup</item>
- <item >@string/restore</item>
- </string-array>
-</resources>
-
diff --git a/navit/android/res/values/strings.xml b/navit/android/res/values/strings.xml
deleted file mode 100644
index 3a730e807..000000000
--- a/navit/android/res/values/strings.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <!-- LANG=en -->
- <!-- GENERIC -->
- <string name="yes">Yes</string>
- <string name="no">No</string>
-
- <!-- NOTIFICATION -->
- <string name="notification_ticker">Navit started</string>
- <string name="notification_event_default">Navit running</string>
-
- <!-- INITIAL INFOBOX -->
- <string name="initial_info_box_title">Welcome to Navit</string>
- <string name="initial_info_box_message">Thank you for installing Navit!\n\nTo start, select \"Download maps\" from the menu to download a map. Note: The map filesize may be large (>50MB) - a wifi connection is recommended.\n\nMapdata: (c) OpenStreetMap contributors\n\nEnjoy Navit!</string>
- <string name="initial_info_box_OK">OK</string>
- <string name="initial_info_box_more_info">More info</string>
-
-
- <!-- OPTIONS MENU -->
- <string name="optionsmenu_zoom_in">Zoom in</string>
- <string name="optionsmenu_zoom_out">Zoom out</string>
- <string name="optionsmenu_download_maps">Download maps</string>
- <string name="optionsmenu_toggle_poi">Toggle POIs</string>
- <string name="optionsmenu_exit_navit">Exit Navit</string>
- <string name="optionsmenu_backup_restore">Backup / Restore</string>
- <string name="optionsmenu_set_map_location">Set map location</string>
-
- <!-- POSITION POP-UP -->
- <string name="position_popup_title">Position</string>
- <string name="position_popup_drive_here">Route to here</string>
-
- <!-- MAP DOWNLOAD -->
- <string name="map_delete">Delete this map?</string>
- <string name="map_download_title">Map download</string>
- <string name="map_download_downloading">Downloading:</string>
- <string name="map_download_eta">ETA</string>
- <string name="map_download_ready">ready</string>
- <string name="map_download_download_error">Error downloading map.</string>
- <string name="map_download_download_aborted">Map download aborted</string>
- <string name="map_download_not_enough_free_space">Not enough free space</string>
- <string name="map_no_fix">No location. Reopen after location fix.</string>
- <string name="maps_for_current_location">Maps containing current location</string>
-
- <!-- ADDRESS SEARCH -->
- <string name="address_search_title">Address search</string>
- <string name="address_enter_destination">Enter destination</string>
- <string name="address_partial_match">Match partial address</string>
- <string name="address_search_button">Search</string>
- <string name="address_search_searching">Searching...</string>
- <string name="address_search_not_found">Address not found</string>
- <string name="address_search_getting_results">Getting search results</string>
- <string name="address_search_loading_results">Loading search results</string>
- <string name="address_search_no_results">No results found</string>
- <string name="address_search_no_text_entered">No text entered</string>
- <string name="address_search_set_destination">Setting destination to:</string>
- <string name="address_search_towns">Towns</string>
- <string name="address_search_streets">Streets</string>
-
- <!-- Backup Restore -->
- <string name="choose_an_action">Choose an action</string>
- <string name="please_insert_an_sd_card">Please insert an SD Card</string>
- <string name="backing_up">Backing up...</string>
- <string name="restoring">Restoring...</string>
- <string name="failed_to_create_backup_directory">Failed to create backup directory</string>
- <string name="backup_failed">Backup failed</string>
- <string name="no_backup_found">No backup found</string>
- <string name="failed_to_restore">Failed to restore</string>
- <string name="backup_successful">Backup successful</string>
- <string name="restore_successful_please_restart_navit">Restore Successful\nPlease restart Navit</string>
- <string name="backup_not_found">Backup not found</string>
- <string name="restore_failed">Restore failed</string>
- <string name="select_backup">Select backup</string>
- <string name="backup">Backup</string>
- <string name="restore">Restore</string>
-
- <!-- TTS -->
- <string name="TTS_title_data_missing">System text to speech engine data is missing</string>
- <string name="TTS_qery_install_data">Navit can use any text to speech engine installed on your device. The currently selected engine reports it is unable to speak in your language. Should we ask the system to show voice download dialog?</string>
-
- <!-- Permissions dialog-->
- <string name="permissions_not_granted">Navit needs permission to access GPS and read the map.\nIf you change your mind please restart Navit and grant the permissions</string>
- <string name="permissions_info_box_title">One or more ungranted permissions</string>
-</resources>
-
diff --git a/navit/android/res/values/styles.xml b/navit/android/res/values/styles.xml
deleted file mode 100644
index 91094e222..000000000
--- a/navit/android/res/values/styles.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<resources>
-
- <!--
- Base application theme, dependent on API level. This theme is replaced
- by NavitBaseTheme from res/values-vXX/styles.xml on newer devices.
- -->
- <style name="NavitBaseTheme" parent="android:Theme.Holo">
- <!--
- Theme customizations available in newer API levels can go in
- res/values-vXX/styles.xml, while customizations related to
- backward-compatibility can go here.
- -->
- </style>
-
- <!-- Theme for Navit's main Activity. -->
- <style name="NavitTheme" parent="NavitBaseTheme">
- <!-- All customizations that are NOT specific to a particular API-level can go here. -->
- </style>
-
- <!-- TODO complete list of shades for both colors -->
- <!--
- Primary color is derived average of icon colors (500 in Android parlance):
- 213 164 19 #d5a411 hsl 45 92 84
-
- Dark color is normally the 600 color (i.e. slightly darker than 500)
- 209 155 19 #d19b13 hsl 43 91 82
- -->
-
-
- <!-- Yellow from Navit icon background (300 and 700 are the extremes of the gradient, 500 is the average, 900 is the line color) -->
- <color name="navitYellow300">#e9cb14</color>
- <color name="navitYellow500">#d5a411</color>
- <!-- <color name="navitYellow600">#d19b13</color> -->
- <color name="navitYellow700">#c17d11</color>
- <color name="navitYellow900">#43350f</color>
-
- <!-- Blue from arrow in Navit icon (500 is the midpoint of the gradient, 300 is the end, 900 is the line color) -->
- <color name="navitBlue300">#329eff</color>
- <color name="navitBlue500">#1a6cb6</color>
- <color name="navitBlue900">#1f3157</color>
-
-</resources> \ No newline at end of file
diff --git a/navit/android/src/org/navitproject/navit/FileBrowserActivity.java b/navit/android/src/org/navitproject/navit/FileBrowserActivity.java
deleted file mode 100644
index ab3c47376..000000000
--- a/navit/android/src/org/navitproject/navit/FileBrowserActivity.java
+++ /dev/null
@@ -1,432 +0,0 @@
-package org.navitproject.navit;
-
-//Heavily based on code from
-//https://github.com/mburman/Android-File-Explore
-// Version of Aug 13, 2011
-//Also contributed:
-// Sugan Krishnan (https://github.com/rgksugan) - Jan 2013.
-//
-
-//Project type now is Android library:
-// http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject
-
-//General Java imports
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Collections;
-
-//Android imports
-import android.app.Activity;
-import android.content.Intent;
-import android.content.res.Configuration;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.os.Environment;
-import android.os.StatFs;
-import android.util.Log;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup.LayoutParams;
-import android.view.*;
-import android.widget.*;
-
-//Import of resources file for file browser
-import org.navitproject.navit.R;
-
-public class FileBrowserActivity extends Activity {
- // Intent Action Constants
- public static final String INTENT_ACTION_SELECT_DIR = "ua.com.vassiliev.androidfilebrowser.SELECT_DIRECTORY_ACTION";
- public static final String INTENT_ACTION_SELECT_FILE = "ua.com.vassiliev.androidfilebrowser.SELECT_FILE_ACTION";
-
- // Intent parameters names constants
- public static final String startDirectoryParameter = "ua.com.vassiliev.androidfilebrowser.directoryPath";
- public static final String returnDirectoryParameter = "ua.com.vassiliev.androidfilebrowser.directoryPathRet";
- public static final String returnFileParameter = "ua.com.vassiliev.androidfilebrowser.filePathRet";
- public static final String showCannotReadParameter = "ua.com.vassiliev.androidfilebrowser.showCannotRead";
- public static final String filterExtension = "ua.com.vassiliev.androidfilebrowser.filterExtension";
-
- // Stores names of traversed directories
- ArrayList<String> pathDirsList = new ArrayList<String>();
-
- // Check if the first level of the directory structure is the one showing
- // private Boolean firstLvl = true;
-
- private static final String LOGTAG = "F_PATH";
-
- private List<Item> fileList = new ArrayList<Item>();
- private File path = null;
- private String chosenFile;
- // private static final int DIALOG_LOAD_FILE = 1000;
-
- ArrayAdapter<Item> adapter;
-
- private boolean showHiddenFilesAndDirs = true;
-
- private boolean directoryShownIsEmpty = false;
-
- private String filterFileExtension = null;
-
- // Action constants
- private static int currentAction = -1;
- private static final int SELECT_DIRECTORY = 1;
- private static final int SELECT_FILE = 2;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- // In case of
- // ua.com.vassiliev.androidfilebrowser.SELECT_DIRECTORY_ACTION
- // Expects com.mburman.fileexplore.directoryPath parameter to
- // point to the start folder.
- // If empty or null, will start from SDcard root.
- setContentView(R.layout.ua_com_vassiliev_filebrowser_layout);
-
- // Set action for this activity
- Intent thisInt = this.getIntent();
- currentAction = SELECT_DIRECTORY;// This would be a default action in
- // case not set by intent
- if (thisInt.getAction().equalsIgnoreCase(INTENT_ACTION_SELECT_FILE)) {
- Log.d(LOGTAG, "SELECT ACTION - SELECT FILE");
- currentAction = SELECT_FILE;
- }
-
- showHiddenFilesAndDirs = thisInt.getBooleanExtra(
- showCannotReadParameter, true);
-
- filterFileExtension = thisInt.getStringExtra(filterExtension);
-
- setInitialDirectory();
-
- parseDirectoryPath();
- loadFileList();
- this.createFileListAdapter();
- this.initializeButtons();
- this.initializeFileListView();
- updateCurrentDirectoryTextView();
- Log.d(LOGTAG, path.getAbsolutePath());
- }
-
- private void setInitialDirectory() {
- Intent thisInt = this.getIntent();
- String requestedStartDir = thisInt
- .getStringExtra(startDirectoryParameter);
-
- if (requestedStartDir != null && requestedStartDir.length() > 0) {// if(requestedStartDir!=null
- File tempFile = new File(requestedStartDir);
- if (tempFile.isDirectory())
- this.path = tempFile;
- }// if(requestedStartDir!=null
-
- if (this.path == null) {// No or invalid directory supplied in intent
- // parameter
- if (Environment.getExternalStorageDirectory().isDirectory()
- && Environment.getExternalStorageDirectory().canRead())
- path = Environment.getExternalStorageDirectory();
- else
- path = new File("/");
- }// if(this.path==null) {//No or invalid directory supplied in intent
- // parameter
- }// private void setInitialDirectory() {
-
- private void parseDirectoryPath() {
- pathDirsList.clear();
- String pathString = path.getAbsolutePath();
- String[] parts = pathString.split("/");
- int i = 0;
- while (i < parts.length) {
- pathDirsList.add(parts[i]);
- i++;
- }
- }
-
- private void initializeButtons() {
- Button upDirButton = (Button) this.findViewById(R.id.upDirectoryButton);
- upDirButton.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- Log.d(LOGTAG, "onclick for upDirButton");
- loadDirectoryUp();
- loadFileList();
- adapter.notifyDataSetChanged();
- updateCurrentDirectoryTextView();
- }
- });// upDirButton.setOnClickListener(
-
- Button selectFolderButton = (Button) this
- .findViewById(R.id.selectCurrentDirectoryButton);
- if (currentAction == SELECT_DIRECTORY) {
- selectFolderButton.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- Log.d(LOGTAG, "onclick for selectFolderButton");
- returnDirectoryFinishActivity();
- }
- });
- } else {// if(currentAction == this.SELECT_DIRECTORY) {
- selectFolderButton.setVisibility(View.GONE);
- }// } else {//if(currentAction == this.SELECT_DIRECTORY) {
- }// private void initializeButtons() {
-
- private void loadDirectoryUp() {
- // present directory removed from list
- String s = pathDirsList.remove(pathDirsList.size() - 1);
- // path modified to exclude present directory
- path = new File(path.toString().substring(0,
- path.toString().lastIndexOf(s)));
- fileList.clear();
- }
-
- private void updateCurrentDirectoryTextView() {
- int i = 0;
- String curDirString = "";
- while (i < pathDirsList.size()) {
- curDirString += pathDirsList.get(i) + "/";
- i++;
- }
- if (pathDirsList.size() == 0) {
- ((Button) this.findViewById(R.id.upDirectoryButton))
- .setEnabled(false);
- curDirString = "/";
- } else
- ((Button) this.findViewById(R.id.upDirectoryButton))
- .setEnabled(true);
- long freeSpace = getFreeSpace(curDirString);
- String formattedSpaceString = formatBytes(freeSpace);
- if (freeSpace == 0) {
- Log.d(LOGTAG, "NO FREE SPACE");
- File currentDir = new File(curDirString);
- if(!currentDir.canWrite())
- formattedSpaceString = "NON Writable";
- }
-
- ((Button) this.findViewById(R.id.selectCurrentDirectoryButton))
- .setText("Select\n[" + formattedSpaceString
- + "]");
-
- ((TextView) this.findViewById(R.id.currentDirectoryTextView))
- .setText("Current directory: " + curDirString);
- }// END private void updateCurrentDirectoryTextView() {
-
- private void showToast(String message) {
- Toast.makeText(this, message, Toast.LENGTH_LONG).show();
- }
-
- private void initializeFileListView() {
- ListView lView = (ListView) this.findViewById(R.id.fileListView);
- lView.setBackgroundColor(Color.LTGRAY);
- LinearLayout.LayoutParams lParam = new LinearLayout.LayoutParams(
- LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
- lParam.setMargins(15, 5, 15, 5);
- lView.setAdapter(this.adapter);
- lView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- public void onItemClick(AdapterView<?> parent, View view,
- int position, long id) {
- chosenFile = fileList.get(position).file;
- File sel = new File(path + "/" + chosenFile);
- Log.d(LOGTAG, "Clicked:" + chosenFile);
- if (sel.isDirectory()) {
- if (sel.canRead()) {
- // Adds chosen directory to list
- pathDirsList.add(chosenFile);
- path = new File(sel + "");
- Log.d(LOGTAG, "Just reloading the list");
- loadFileList();
- adapter.notifyDataSetChanged();
- updateCurrentDirectoryTextView();
- Log.d(LOGTAG, path.getAbsolutePath());
- } else {// if(sel.canRead()) {
- showToast("Path does not exist or cannot be read");
- }// } else {//if(sel.canRead()) {
- }// if (sel.isDirectory()) {
- // File picked or an empty directory message clicked
- else {// if (sel.isDirectory()) {
- Log.d(LOGTAG, "item clicked");
- if (!directoryShownIsEmpty) {
- Log.d(LOGTAG, "File selected:" + chosenFile);
- returnFileFinishActivity(sel.getAbsolutePath());
- }
- }// else {//if (sel.isDirectory()) {
- }// public void onClick(DialogInterface dialog, int which) {
- });// lView.setOnClickListener(
- }// private void initializeFileListView() {
-
- private void returnDirectoryFinishActivity() {
- Intent retIntent = new Intent();
- retIntent.putExtra(returnDirectoryParameter, path.getAbsolutePath());
- this.setResult(RESULT_OK, retIntent);
- this.finish();
- }// END private void returnDirectoryFinishActivity() {
-
- private void returnFileFinishActivity(String filePath) {
- Intent retIntent = new Intent();
- retIntent.putExtra(returnFileParameter, filePath);
- this.setResult(RESULT_OK, retIntent);
- this.finish();
- }// END private void returnDirectoryFinishActivity() {
-
- private void loadFileList() {
- try {
- path.mkdirs();
- } catch (SecurityException e) {
- Log.e(LOGTAG, "unable to write on the sd card ");
- }
- fileList.clear();
-
- if (path.exists() && path.canRead()) {
- FilenameFilter filter = new FilenameFilter() {
- public boolean accept(File dir, String filename) {
- File sel = new File(dir, filename);
- boolean showReadableFile = showHiddenFilesAndDirs
- || sel.canRead();
- // Filters based on whether the file is hidden or not
- if (currentAction == SELECT_DIRECTORY) {
- return (sel.isDirectory() && showReadableFile);
- }
- if (currentAction == SELECT_FILE) {
-
- // If it is a file check the extension if provided
- if (sel.isFile() && filterFileExtension != null) {
- return (showReadableFile && sel.getName().endsWith(
- filterFileExtension));
- }
- return (showReadableFile);
- }
- return true;
- }// public boolean accept(File dir, String filename) {
- };// FilenameFilter filter = new FilenameFilter() {
-
- String[] fList = path.list(filter);
- this.directoryShownIsEmpty = false;
- for (int i = 0; i < fList.length; i++) {
- // Convert into file path
- File sel = new File(path, fList[i]);
- Log.d(LOGTAG,
- "File:" + fList[i] + " readable:"
- + (Boolean.valueOf(sel.canRead())).toString());
- int drawableID = R.drawable.file_icon;
- boolean canRead = sel.canRead();
- // Set drawables
- if (sel.isDirectory()) {
- if (canRead) {
- drawableID = R.drawable.folder_icon;
- } else {
- drawableID = R.drawable.folder_icon_light;
- }
- }
- fileList.add(i, new Item(fList[i], drawableID, canRead));
- }// for (int i = 0; i < fList.length; i++) {
- if (fileList.size() == 0) {
- // Log.d(LOGTAG, "This directory is empty");
- this.directoryShownIsEmpty = true;
- fileList.add(0, new Item("Directory is empty", -1, true));
- } else {// sort non empty list
- Collections.sort(fileList, new ItemFileNameComparator());
- }
- } else {
- Log.e(LOGTAG, "path does not exist or cannot be read");
- }
- // Log.d(TAG, "loadFileList finished");
- }// private void loadFileList() {
-
- private void createFileListAdapter() {
- adapter = new ArrayAdapter<Item>(this,
- android.R.layout.select_dialog_item, android.R.id.text1,
- fileList) {
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- // creates view
- View view = super.getView(position, convertView, parent);
- TextView textView = (TextView) view
- .findViewById(android.R.id.text1);
- // put the image on the text view
- int drawableID = 0;
- if (fileList.get(position).icon != -1) {
- // If icon == -1, then directory is empty
- drawableID = fileList.get(position).icon;
- }
- textView.setCompoundDrawablesWithIntrinsicBounds(drawableID, 0,
- 0, 0);
-
- textView.setEllipsize(null);
-
- // add margin between image and text (support various screen
- // densities)
- // int dp5 = (int) (5 *
- // getResources().getDisplayMetrics().density + 0.5f);
- int dp3 = (int) (3 * getResources().getDisplayMetrics().density + 0.5f);
- // TODO: change next line for empty directory, so text will be
- // centered
- textView.setCompoundDrawablePadding(dp3);
- textView.setBackgroundColor(Color.LTGRAY);
- return view;
- }// public View getView(int position, View convertView, ViewGroup
- };// adapter = new ArrayAdapter<Item>(this,
- }// private createFileListAdapter(){
-
- private class Item {
- public String file;
- public int icon;
- public boolean canRead;
-
- public Item(String file, Integer icon, boolean canRead) {
- this.file = file;
- this.icon = icon;
- }
-
- @Override
- public String toString() {
- return file;
- }
- }// END private class Item {
-
- private class ItemFileNameComparator implements Comparator<Item> {
- public int compare(Item lhs, Item rhs) {
- return lhs.file.toLowerCase().compareTo(rhs.file.toLowerCase());
- }
- }
-
- public void onConfigurationChanged(Configuration newConfig) {
- super.onConfigurationChanged(newConfig);
- if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
- Log.d(LOGTAG, "ORIENTATION_LANDSCAPE");
- } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
- Log.d(LOGTAG, "ORIENTATION_PORTRAIT");
- }
- // Layout apparently changes itself, only have to provide good onMeasure
- // in custom components
- // TODO: check with keyboard
- // if(newConfig.keyboard == Configuration.KEYBOARDHIDDEN_YES)
- }// END public void onConfigurationChanged(Configuration newConfig) {
-
- public static long getFreeSpace(String path) {
- StatFs stat = new StatFs(path);
- long availSize = (long) stat.getAvailableBlocks()
- * (long) stat.getBlockSize();
- return availSize;
- }// END public static long getFreeSpace(String path) {
-
- public static String formatBytes(long bytes) {
- // TODO: add flag to which part is needed (e.g. GB, MB, KB or bytes)
- String retStr = "";
- // One binary gigabyte equals 1,073,741,824 bytes.
- if (bytes > 1073741824) {// Add GB
- long gbs = bytes / 1073741824;
- retStr += (new Long(gbs)).toString() + "GB ";
- bytes = bytes - (gbs * 1073741824);
- }
- // One MB - 1048576 bytes
- if (bytes > 1048576) {// Add GB
- long mbs = bytes / 1048576;
- retStr += (new Long(mbs)).toString() + "MB ";
- bytes = bytes - (mbs * 1048576);
- }
- if (bytes > 1024) {
- long kbs = bytes / 1024;
- retStr += (new Long(kbs)).toString() + "KB";
- bytes = bytes - (kbs * 1024);
- } else
- retStr += (new Long(bytes)).toString() + " bytes";
- return retStr;
- }// public static String formatBytes(long bytes){
-
-}// END public class FileBrowserActivity extends Activity {
diff --git a/navit/android/src/org/navitproject/navit/Navit.java b/navit/android/src/org/navitproject/navit/Navit.java
deleted file mode 100644
index 77a54bc30..000000000
--- a/navit/android/src/org/navitproject/navit/Navit.java
+++ /dev/null
@@ -1,933 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package org.navitproject.navit;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.app.ActivityManager.TaskDescription;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Color;
-import android.graphics.Point;
-import android.Manifest;
-import android.media.AudioManager;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.Environment;
-import android.os.Message;
-import android.os.PowerManager;
-import android.support.v4.app.ActivityCompat;
-import android.support.v4.content.ContextCompat;
-import android.text.SpannableString;
-import android.text.method.LinkMovementMethod;
-import android.text.util.Linkify;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.view.Display;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.Window;
-import android.view.WindowManager;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-
-
-public class Navit extends Activity
-{
-
- public NavitDialogs dialogs;
- private PowerManager.WakeLock wl;
- private NavitActivityResult ActivityResults[];
- public static InputMethodManager mgr = null;
- public static DisplayMetrics metrics = null;
- public static int status_bar_height = 0;
- public static int action_bar_default_height = 0;
- public static int navigation_bar_height = 0;
- public static int navigation_bar_height_landscape= 0;
- public static int navigation_bar_width = 0;
- public static Boolean show_soft_keyboard = false;
- public static Boolean show_soft_keyboard_now_showing = false;
- public static long last_pressed_menu_key = 0L;
- public static long time_pressed_menu_key = 0L;
- private static Intent startup_intent = null;
- private static long startup_intent_timestamp = 0L;
- public static String my_display_density = "mdpi";
- public static final int NavitDownloaderSelectMap_id = 967;
- public static final int MAP_NUM_PRIMARY = 11;
- public static final int NavitAddressSearch_id = 70;
- public static final int NavitSelectStorage_id = 43;
- public static String NavitLanguage;
- public static Resources NavitResources = null;
-
- public static final int MAP_NUM_SECONDARY = 12;
- static final String NAVIT_PACKAGE_NAME = "org.navitproject.navit";
- static final String TAG = "Navit";
- static String map_filename_path = null;
- static final String NAVIT_DATA_DIR = "/data/data/" + NAVIT_PACKAGE_NAME;
- static final String NAVIT_DATA_SHARE_DIR = NAVIT_DATA_DIR + "/share";
- static final String FIRST_STARTUP_FILE = NAVIT_DATA_SHARE_DIR + "/has_run_once.txt";
- public static final String NAVIT_PREFS = "NavitPrefs";
- Boolean isFullscreen = false;
- private static final int MY_PERMISSIONS_REQUEST_ALL = 101;
-
-
- /**
- * @brief A Runnable to restore soft input when the user returns to the activity.
- *
- * An instance of this class can be passed to the main message queue in the Activity's
- * {@code onRestore()} method.
- */
- private class SoftInputRestorer implements Runnable {
- public void run() {
- Navit.this.showNativeKeyboard();
- }
- }
-
-
- public void removeFileIfExists(String source) {
- File file = new File(source);
-
- if (!file.exists())
- return;
-
- file.delete();
- }
-
- public void copyFileIfExists(String source, String destination) throws IOException {
- File file = new File(source);
-
- if (!file.exists())
- return;
-
- FileInputStream is = null;
- FileOutputStream os = null;
-
- try {
- is = new FileInputStream(source);
- os = new FileOutputStream(destination);
-
- int len;
- byte buffer[] = new byte[1024];
-
- while ((len = is.read(buffer)) != -1) {
- os.write(buffer, 0, len);
- }
- } finally {
- /* Close the FileStreams to prevent Resource leaks */
- if (is != null)
- is.close();
-
- if (os != null)
- os.close();
- }
- return;
- }
-
-
- public static String _(String in)
- {
- return NavitTextTranslations.get_text(in);
- }
-
- private boolean extractRes(String resname, String result) {
- boolean needs_update = false;
- Log.e(TAG, "Res Name " + resname + ", result " + result);
- int id = NavitResources.getIdentifier(resname, "raw", NAVIT_PACKAGE_NAME);
- Log.e(TAG, "Res ID " + id);
- if (id == 0)
- return false;
-
- File resultfile = new File(result);
- if (!resultfile.exists()) {
- needs_update = true;
- File path = resultfile.getParentFile();
- if ( !path.exists() && !resultfile.getParentFile().mkdirs())
- return false;
- } else {
- PackageManager pm = getPackageManager();
- ApplicationInfo appInfo;
- long apkUpdateTime = 0;
- try {
- appInfo = pm.getApplicationInfo(NAVIT_PACKAGE_NAME, 0);
- apkUpdateTime = new File(appInfo.sourceDir).lastModified();
- } catch (NameNotFoundException e) {
- Log.e(TAG, "Could not read package infos");
- e.printStackTrace();
- }
- if (apkUpdateTime > resultfile.lastModified())
- needs_update = true;
- }
-
- if (needs_update) {
- Log.e(TAG, "Extracting resource");
-
- try {
- InputStream resourcestream = NavitResources.openRawResource(id);
- FileOutputStream resultfilestream = new FileOutputStream(resultfile);
- byte[] buf = new byte[1024];
- int i = 0;
- while ((i = resourcestream.read(buf)) != -1) {
- resultfilestream.write(buf, 0, i);
- }
- resultfilestream.close();
- } catch (Exception e) {
- Log.e(TAG, "Exception " + e.getMessage());
- return false;
- }
- }
- return true;
- }
-
- private void showInfos()
- {
- SharedPreferences settings = getSharedPreferences(NAVIT_PREFS, MODE_PRIVATE);
- boolean firstStart = settings.getBoolean("firstStart", true);
-
- if (firstStart)
- {
- AlertDialog.Builder infobox = new AlertDialog.Builder(this);
- infobox.setTitle(getString(R.string.initial_info_box_title)); // TRANS
- infobox.setCancelable(false);
- final TextView message = new TextView(this);
- message.setFadingEdgeLength(20);
- message.setVerticalFadingEdgeEnabled(true);
- // message.setVerticalScrollBarEnabled(true);
- RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
-
- message.setLayoutParams(rlp);
- final SpannableString s = new SpannableString(getString(R.string.initial_info_box_message)); // TRANS
- Linkify.addLinks(s, Linkify.WEB_URLS);
- message.setText(s);
- message.setMovementMethod(LinkMovementMethod.getInstance());
- infobox.setView(message);
-
- // TRANS
- infobox.setPositiveButton(getString(R.string.initial_info_box_OK), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
- Log.e("Navit", "Ok, user saw the infobox");
- }
- });
-
- // TRANS
- infobox.setNeutralButton(getString(R.string.initial_info_box_more_info), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
- Log.e("Navit", "user wants more info, show the website");
- String url = "http://wiki.navit-project.org/index.php/Navit_on_Android";
- Intent i = new Intent(Intent.ACTION_VIEW);
- i.setData(Uri.parse(url));
- startActivity(i);
- }
- });
- infobox.show();
- SharedPreferences.Editor edit_settings = settings.edit();
- edit_settings.putBoolean("firstStart", false);
- edit_settings.commit();
- }
- }
-
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)
- this.requestWindowFeature(Window.FEATURE_NO_TITLE);
- else
- this.getActionBar().hide();
-
- dialogs = new NavitDialogs(this);
-
- NavitResources = getResources();
-
- // only take arguments here, onResume gets called all the time (e.g. when screenblanks, etc.)
- Navit.startup_intent = this.getIntent();
- // hack! Remember time stamps, and only allow 4 secs. later in onResume to set target!
- Navit.startup_intent_timestamp = System.currentTimeMillis();
- Log.e("Navit", "**1**A " + startup_intent.getAction());
- Log.e("Navit", "**1**D " + startup_intent.getDataString());
-
- // init translated text
- NavitTextTranslations.init();
-
- // NOTIFICATION
- // Setup the status bar notification
- // This notification is removed in the exit() function
- NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Grab a handle to the NotificationManager
- Notification NavitNotification = new Notification(R.drawable.ic_notify, getString(R.string.notification_ticker), System.currentTimeMillis()); // Create a new notification, with the text string to show when the notification first appears
- PendingIntent appIntent = PendingIntent.getActivity(getApplicationContext(), 0, getIntent(), 0);
-// FIXME : needs a fix for sdk 23
-// NavitNotification.setLatestEventInfo(getApplicationContext(), "Navit", getString(R.string.notification_event_default), appIntent); // Set the text in the notification
-// NavitNotification.flags|=Notification.FLAG_ONGOING_EVENT; // Ensure that the notification appears in Ongoing
-// nm.notify(R.string.app_name, NavitNotification); // Set the notification
-
- // Status and navigation bar sizes
- // These are platform defaults and do not change with rotation, but we have to figure out which ones apply
- // (is the navigation bar visible? on the side or at the bottom?)
- Resources resources = getResources();
- int shid = resources.getIdentifier("status_bar_height", "dimen", "android");
- int adhid = resources.getIdentifier("action_bar_default_height", "dimen", "android");
- int nhid = resources.getIdentifier("navigation_bar_height", "dimen", "android");
- int nhlid = resources.getIdentifier("navigation_bar_height_landscape", "dimen", "android");
- int nwid = resources.getIdentifier("navigation_bar_width", "dimen", "android");
- status_bar_height = (shid > 0) ? resources.getDimensionPixelSize(shid) : 0;
- action_bar_default_height = (adhid > 0) ? resources.getDimensionPixelSize(adhid) : 0;
- navigation_bar_height = (nhid > 0) ? resources.getDimensionPixelSize(nhid) : 0;
- navigation_bar_height_landscape = (nhlid > 0) ? resources.getDimensionPixelSize(nhlid) : 0;
- navigation_bar_width = (nwid > 0) ? resources.getDimensionPixelSize(nwid) : 0;
- Log.d(TAG, String.format("status_bar_height=%d, action_bar_default_height=%d, navigation_bar_height=%d, navigation_bar_height_landscape=%d, navigation_bar_width=%d",
- status_bar_height, action_bar_default_height, navigation_bar_height, navigation_bar_height_landscape, navigation_bar_width));
- if ((ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)||
- (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED)) {
- Log.d (TAG,"ask for permission(s)");
- ActivityCompat.requestPermissions(this,
- new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.ACCESS_FINE_LOCATION},MY_PERMISSIONS_REQUEST_ALL);
- }
- // get the local language -------------
- Locale locale = java.util.Locale.getDefault();
- String lang = locale.getLanguage();
- String langu = lang;
- String langc = lang;
- Log.e("Navit", "lang=" + lang);
- int pos = langu.indexOf('_');
- if (pos != -1)
- {
- langc = langu.substring(0, pos);
- NavitLanguage = langc + langu.substring(pos).toUpperCase(locale);
- Log.e("Navit", "substring lang " + NavitLanguage.substring(pos).toUpperCase(locale));
- // set lang. for translation
- NavitTextTranslations.main_language = langc;
- NavitTextTranslations.sub_language = NavitLanguage.substring(pos).toUpperCase(locale);
- }
- else
- {
- String country = locale.getCountry();
- Log.e("Navit", "Country1 " + country);
- Log.e("Navit", "Country2 " + country.toUpperCase(locale));
- NavitLanguage = langc + "_" + country.toUpperCase(locale);
- // set lang. for translation
- NavitTextTranslations.main_language = langc;
- NavitTextTranslations.sub_language = country.toUpperCase(locale);
- }
- Log.e("Navit", "Language " + lang);
-
- SharedPreferences prefs = getSharedPreferences(NAVIT_PREFS,MODE_PRIVATE);
- map_filename_path = prefs.getString("filenamePath", Environment.getExternalStorageDirectory().getPath() + "/navit/");
-
- // make sure the new path for the navitmap.bin file(s) exist!!
- File navit_maps_dir = new File(map_filename_path);
- navit_maps_dir.mkdirs();
-
- // make sure the share dir exists
- File navit_data_share_dir = new File(NAVIT_DATA_SHARE_DIR);
- navit_data_share_dir.mkdirs();
-
- Display display_ = getWindowManager().getDefaultDisplay();
- int width_ = display_.getWidth();
- int height_ = display_.getHeight();
- metrics = new DisplayMetrics();
- display_.getMetrics(Navit.metrics);
- int densityDpi = (int)(( Navit.metrics.density*160)-.5f);
- Log.e("Navit", "Navit -> pixels x=" + width_ + " pixels y=" + height_);
- Log.e("Navit", "Navit -> dpi=" + densityDpi);
- Log.e("Navit", "Navit -> density=" + Navit.metrics.density);
- Log.e("Navit", "Navit -> scaledDensity=" + Navit.metrics.scaledDensity);
-
- ActivityResults = new NavitActivityResult[16];
- setVolumeControlStream(AudioManager.STREAM_MUSIC);
- PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE,"NavitDoNotDimScreen");
-
- if (!extractRes(langc, NAVIT_DATA_DIR + "/locale/" + langc + "/LC_MESSAGES/navit.mo"))
- {
- Log.e("Navit", "Failed to extract language resource " + langc);
- }
-
- if (densityDpi <= 120)
- {
- my_display_density = "ldpi";
- }
- else if (densityDpi <= 160)
- {
- my_display_density = "mdpi";
- }
- else if (densityDpi < 240)
- {
- my_display_density = "hdpi";
- }
- else if (densityDpi < 320)
- {
- my_display_density = "xhdpi";
- }
- else if (densityDpi < 480)
- {
- my_display_density = "xxhdpi";
- }
- else if (densityDpi < 640)
- {
- my_display_density = "xxxhdpi";
- }
- else
- {
- Log.e("Navit", "found device of very high density ("+densityDpi+")");
- Log.e("Navit", "using xxxhdpi values");
- my_display_density = "xxxhdpi";
- }
-
- if (!extractRes("navit" + my_display_density, NAVIT_DATA_DIR + "/share/navit.xml"))
- {
- Log.e("Navit", "Failed to extract navit.xml for " + my_display_density);
- }
-
- // --> dont use android.os.Build.VERSION.SDK_INT, needs API >= 4
- Log.e("Navit", "android.os.Build.VERSION.SDK_INT=" + Integer.valueOf(android.os.Build.VERSION.SDK));
- NavitMain(this, NavitLanguage, Integer.valueOf(android.os.Build.VERSION.SDK), my_display_density, NAVIT_DATA_DIR+"/bin/navit",map_filename_path);
-
- showInfos();
-
- Navit.mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
- }
-
- @Override
- public void onResume()
- {
- super.onResume();
- Log.d("Navit", "OnResume");
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
- /* Required to make system bars fully transparent */
- getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
- }
- //InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
- // DEBUG
- // intent_data = "google.navigation:q=Wien Burggasse 27";
- // intent_data = "google.navigation:q=48.25676,16.643";
- // intent_data = "google.navigation:ll=48.25676,16.643&q=blabla-strasse";
- // intent_data = "google.navigation:ll=48.25676,16.643";
- if (startup_intent != null)
- {
- if (System.currentTimeMillis() <= Navit.startup_intent_timestamp + 4000L)
- {
- Log.e("Navit", "**2**A " + startup_intent.getAction());
- Log.e("Navit", "**2**D " + startup_intent.getDataString());
- String navi_scheme = startup_intent.getScheme();
- if ( navi_scheme != null && navi_scheme.equals("google.navigation")) {
- parseNavigationURI(startup_intent.getData().getSchemeSpecificPart());
- }
- }
- else {
- Log.e("Navit", "timestamp for navigate_to expired! not using data");
- }
- }
- Log.d(TAG, "onResume");
- if (show_soft_keyboard_now_showing) {
- /* Calling showNativeKeyboard() directly won't work here, we need to use the message queue */
- View cf = getCurrentFocus();
- if (cf == null)
- Log.e(TAG, "no view in focus, can't get a handler");
- else
- cf.getHandler().post(new SoftInputRestorer());
- }
- }
-
- @Override
- public void onPause() {
- super.onPause();
- Log.d(TAG, "onPause");
- if (show_soft_keyboard_now_showing) {
- Log.d(TAG, "onPause:hiding soft input");
- this.hideNativeKeyboard();
- show_soft_keyboard_now_showing = true;
- }
- }
-
- @Override
- public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
- switch (requestCode) {
- case MY_PERMISSIONS_REQUEST_ALL: {
- if (grantResults.length > 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED
- && grantResults[1] == PackageManager.PERMISSION_GRANTED) {
- // ok, we got permissions
- } else {
- AlertDialog.Builder infobox = new AlertDialog.Builder(this);
- infobox.setTitle(getString(R.string.permissions_info_box_title)); // TRANS
- infobox.setCancelable(false);
- final TextView message = new TextView(this);
- message.setFadingEdgeLength(20);
- message.setVerticalFadingEdgeEnabled(true);
- RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT);
- message.setLayoutParams(rlp);
- final SpannableString s = new SpannableString(getString(R.string.permissions_not_granted)); // TRANS
- message.setText(s);
- message.setMovementMethod(LinkMovementMethod.getInstance());
- infobox.setView(message);
- // TRANS
- infobox.setPositiveButton(getString(R.string.initial_info_box_OK), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
- exit();
- }
- });
- infobox.show();
- }
- return;
- }
- }
- }
-
- private void parseNavigationURI(String schemeSpecificPart) {
- String naviData[]= schemeSpecificPart.split("&");
- Pattern p = Pattern.compile("(.*)=(.*)");
- Map<String,String> params = new HashMap<String,String>();
- for (int count=0; count < naviData.length; count++) {
- Matcher m = p.matcher(naviData[count]);
-
- if (m.matches()) {
- params.put(m.group(1), m.group(2));
- }
- }
-
- // d: google.navigation:q=blabla-strasse # (this happens when you are offline, or from contacts)
- // a: google.navigation:ll=48.25676,16.643&q=blabla-strasse
- // c: google.navigation:ll=48.25676,16.643
- // b: google.navigation:q=48.25676,16.643
-
- Float lat;
- Float lon;
- Bundle b = new Bundle();
-
- String geoString = params.get("ll");
- if (geoString != null) {
- String address = params.get("q");
- if (address != null) b.putString("q", address);
- }
- else {
- geoString = params.get("q");
- }
-
- if ( geoString != null) {
- if (geoString.matches("^[+-]{0,1}\\d+(|\\.\\d*),[+-]{0,1}\\d+(|\\.\\d*)$")) {
- String geo[] = geoString.split(",");
- if (geo.length == 2) {
- try {
- lat = Float.valueOf(geo[0]);
- lon = Float.valueOf(geo[1]);
- b.putFloat("lat", lat);
- b.putFloat("lon", lon);
- Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal());
-
- msg.setData(b);
- msg.sendToTarget();
- Log.e("Navit", "target found (b): " + geoString);
- } catch (NumberFormatException e) { } // nothing to do here
- }
- }
- else {
- start_targetsearch_from_intent(geoString);
- }
- }
- }
-
- public void setActivityResult(int requestCode, NavitActivityResult ActivityResult)
- {
- //Log.e("Navit", "setActivityResult " + requestCode);
- ActivityResults[requestCode] = ActivityResult;
- }
-
- @Override
- public boolean onPrepareOptionsMenu(Menu menu)
- {
- super.onPrepareOptionsMenu(menu);
- //Log.e("Navit","onPrepareOptionsMenu");
- // this gets called every time the menu is opened!!
- // change menu items here!
- menu.clear();
-
- // group-id,item-id,sort order number
- //menu.add(1, 1, 100, getString(R.string.optionsmenu_zoom_in)); //TRANS
- //menu.add(1, 2, 200, getString(R.string.optionsmenu_zoom_out)); //TRANS
-
- menu.add(1, 3, 300, getString(R.string.optionsmenu_download_maps)); //TRANS
- menu.add(1, 5, 400, getString(R.string.optionsmenu_toggle_poi)); //TRANS
-
- menu.add(1, 6, 500, getString(R.string.optionsmenu_address_search)); //TRANS
- menu.add(1, 10, 600, getString(R.string.optionsmenu_set_map_location));
-
- menu.add(1, 99, 900, getString(R.string.optionsmenu_exit_navit)); //TRANS
-
- /* Only show the Backup to SD-Card Option if we really have one */
- if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
- menu.add(1, 7, 700, getString(R.string.optionsmenu_backup_restore)); //TRANS
-
- return true;
- }
-
- // define callback id here
- public static NavitGraphics N_NavitGraphics = null;
-
- // callback id gets set here when called from NavitGraphics
- public static void setKeypressCallback(int kp_cb_id, NavitGraphics ng)
- {
- //Log.e("Navit", "setKeypressCallback -> id1=" + kp_cb_id);
- //Log.e("Navit", "setKeypressCallback -> ng=" + String.valueOf(ng));
- //N_KeypressCallbackID = kp_cb_id;
- N_NavitGraphics = ng;
- }
-
- public static void setMotionCallback(int mo_cb_id, NavitGraphics ng)
- {
- //Log.e("Navit", "setKeypressCallback -> id2=" + mo_cb_id);
- //Log.e("Navit", "setKeypressCallback -> ng=" + String.valueOf(ng));
- //N_MotionCallbackID = mo_cb_id;
- N_NavitGraphics = ng;
- }
-
- public void start_targetsearch_from_intent(String target_address)
- {
- if (target_address == null || target_address.equals(""))
- {
- // empty search string entered
- Toast.makeText(getApplicationContext(), getString(R.string.address_search_not_found), Toast.LENGTH_LONG).show(); //TRANS
- }
- else
- {
- Intent search_intent = new Intent(this, NavitAddressSearchActivity.class);
- search_intent.putExtra("search_string", target_address);
- this.startActivityForResult(search_intent, NavitAddressSearch_id);
- }
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item)
- {
- runOptionsItem(item.getItemId());
- return true;
- }
-
- public void runOptionsItem(int id)
- {
- // Handle item selection
- switch (id)
- {
- case 1 :
- // zoom in
- Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_ZOOM_IN.ordinal()).sendToTarget();
- // if we zoom, hide the bubble
- Log.e("Navit", "onOptionsItemSelected -> zoom in");
- break;
- case 2 :
- // zoom out
- Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_ZOOM_OUT.ordinal()).sendToTarget();
- // if we zoom, hide the bubble
- Log.e("Navit", "onOptionsItemSelected -> zoom out");
- break;
- case 3 :
- // map download menu
- Intent map_download_list_activity = new Intent(this, NavitDownloadSelectMapActivity.class);
- startActivityForResult(map_download_list_activity, Navit.NavitDownloaderSelectMap_id);
- break;
- case 5 :
- // toggle the normal POI layers and labels (to avoid double POIs)
- Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
- Bundle b = new Bundle();
- b.putString("cmd", "toggle_layer(\"POI Symbols\");");
- msg.setData(b);
- msg.sendToTarget();
-
- msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
- b = new Bundle();
- b.putString("cmd", "toggle_layer(\"POI Labels\");");
- msg.setData(b);
- msg.sendToTarget();
-
- // toggle full POI icons on/off
- msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
- b = new Bundle();
- b.putString("cmd", "toggle_layer(\"Android-POI-Icons-full\");");
- msg.setData(b);
- msg.sendToTarget();
-
- break;
- case 6 :
- // ok startup address search activity
- Intent search_intent = new Intent(this, NavitAddressSearchActivity.class);
- this.startActivityForResult(search_intent, NavitAddressSearch_id);
- break;
- case 7 :
- /* Backup / Restore */
- showDialog(NavitDialogs.DIALOG_BACKUP_RESTORE);
- break;
- case 10:
- setMapLocation();
- break;
- case 99 :
- // exit
- this.onStop();
- this.exit();
- break;
- }
- }
-
-
- /**
- * @brief Shows the Options menu.
- *
- * Calling this method has the same effect as pressing the hardware Menu button, where present, or touching
- * the overflow button in the Action bar.
- */
- public void showMenu() {
- openOptionsMenu();
- }
-
-
- /**
- * @brief Shows the native keyboard or other input method.
- *
- * @return {@code true} if an input method is going to be displayed, {@code false} if not
- */
- public int showNativeKeyboard() {
- /*
- * Apologies for the huge mess that this function is, but Android's soft input API is a big
- * nightmare. Its devs have mercifully given us an option to show or hide the keyboard, but
- * there is no reliable way to figure out if it is actually showing, let alone how much of the
- * screen it occupies, so our best bet is guesswork.
- */
- Configuration config = getResources().getConfiguration();
- if ((config.keyboard == Configuration.KEYBOARD_QWERTY) && (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO))
- /* physical keyboard present, exit */
- return 0;
-
- /* Use SHOW_FORCED here, else keyboard won't show in landscape mode */
- mgr.showSoftInput(getCurrentFocus(), InputMethodManager.SHOW_FORCED);
- show_soft_keyboard_now_showing = true;
-
- /*
- * Crude way to estimate the height occupied by the keyboard: for AOSP on KitKat and Lollipop it
- * is about 62-63% of available screen width (in portrait mode) but no more than slightly above
- * 46% of height (in landscape mode).
- */
- Display display_ = getWindowManager().getDefaultDisplay();
- int width_ = display_.getWidth();
- int height_ = display_.getHeight();
- int maxHeight = height_ * 47 / 100;
- int inputHeight = width_ * 63 / 100;
- if (inputHeight > (maxHeight))
- inputHeight = maxHeight;
-
- /* the receiver isn't going to fire before the UI thread becomes idle, well after this method returns */
- Log.d(TAG, "showNativeKeyboard:return (assuming true)");
- return inputHeight;
- }
-
-
- /**
- * @brief Hides the native keyboard or other input method.
- */
- public void hideNativeKeyboard() {
- mgr.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
- show_soft_keyboard_now_showing = false;
- }
-
-
- void setDestination(float latitude, float longitude, String address) {
- Toast.makeText( getApplicationContext(),getString(R.string.address_search_set_destination) + "\n" + address, Toast.LENGTH_LONG).show(); //TRANS
-
- Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal());
- Bundle b = new Bundle();
- b.putFloat("lat", latitude);
- b.putFloat("lon", longitude);
- b.putString("q", address);
- msg.setData(b);
- msg.sendToTarget();
- }
-
- protected void onActivityResult(int requestCode, int resultCode, Intent data)
- {
- switch (requestCode)
- {
- case Navit.NavitDownloaderSelectMap_id :
- if (resultCode == Activity.RESULT_OK)
- {
- Message msg = dialogs.obtainMessage(NavitDialogs.MSG_START_MAP_DOWNLOAD
- , data.getIntExtra("map_index", -1), 0);
- msg.sendToTarget();
- }
- break;
- case NavitAddressSearch_id :
- if (resultCode == Activity.RESULT_OK) {
- Bundle destination = data.getExtras();
- Toast.makeText( getApplicationContext(),getString(R.string.address_search_set_destination) + "\n" + destination.getString(("q")), Toast.LENGTH_LONG).show(); //TRANS
-
- Message msg = Message.obtain(N_NavitGraphics.callback_handler, NavitGraphics.msg_type.CLB_SET_DESTINATION.ordinal());
- msg.setData(destination);
- msg.sendToTarget();
- }
- break;
- case NavitSelectStorage_id :
- if(resultCode == RESULT_OK) {
- String newDir = data.getStringExtra(FileBrowserActivity.returnDirectoryParameter);
- Log.d(TAG, "selected path= "+newDir);
- if(!newDir.contains("/navit"))
- newDir = newDir+"/navit/";
- else
- newDir = newDir+"/";
- SharedPreferences prefs = this.getSharedPreferences(NAVIT_PREFS,MODE_PRIVATE);
- SharedPreferences.Editor prefs_editor = prefs.edit();
- prefs_editor.putString("filenamePath", newDir);
- prefs_editor.commit();
- Toast.makeText(this, String.format(Navit._("New location set to %s\nRestart Navit to apply the changes."),newDir),Toast.LENGTH_LONG).show();
- }
- else Log.w(TAG, "select path failed");
- break;
- default :
- //Log.e("Navit", "onActivityResult " + requestCode + " " + resultCode);
- ActivityResults[requestCode].onActivityResult(requestCode, resultCode, data);
- break;
- }
- }
-
- @Override
- protected void onPrepareDialog(int id, Dialog dialog) {
- dialogs.prepareDialog(id, dialog);
- super.onPrepareDialog(id, dialog);
- }
-
- protected Dialog onCreateDialog(int id)
- {
- return dialogs.createDialog(id);
- }
-
- @Override
- public boolean onSearchRequested() {
- /* Launch the internal Search Activity */
- Intent search_intent = new Intent(this, NavitAddressSearchActivity.class);
- this.startActivityForResult(search_intent, NavitAddressSearch_id);
-
- return true;
- }
-
- public boolean setMapLocation()
- {
- Intent fileExploreIntent = new Intent(this,FileBrowserActivity.class);
- fileExploreIntent
- .putExtra(FileBrowserActivity.startDirectoryParameter, "/mnt")
- .setAction(FileBrowserActivity.INTENT_ACTION_SELECT_DIR);
- startActivityForResult(fileExploreIntent,NavitSelectStorage_id);
-
- return true;
- }
-
- @Override
- public void onDestroy()
- {
- super.onDestroy();
- Log.e("Navit", "OnDestroy");
- // TODO next call will kill our app the hard way. This should not be necessary, but ensures navit is
- // properly restarted and no resources are wasted with navit in background. Remove this call after
- // code review
- NavitDestroy();
- }
-
- public void fullscreen(int fullscreen) {
- int w, h;
-
- isFullscreen = (fullscreen != 0);
- if (isFullscreen) {
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
- }
- else {
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
- }
-
- Display display_ = getWindowManager().getDefaultDisplay();
- if (Build.VERSION.SDK_INT < 17) {
- w = display_.getWidth();
- h = display_.getHeight();
- } else {
- Point size = new Point();
- display_.getRealSize(size);
- w = size.x;
- h = size.y;
- }
- Log.d(TAG, String.format("Toggle fullscreen, w=%d, h=%d", w, h));
- N_NavitGraphics.handleResize(w, h);
- }
-
- public void disableSuspend()
- {
- wl.acquire();
- wl.release();
- }
-
- public void exit()
- {
-// NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
-// nm.cancel(R.string.app_name);
- NavitVehicle.removeListener();
- NavitDestroy();
- }
-
- public native void NavitMain(Navit x, String lang, int version, String display_density_string, String path, String path2);
- public native void NavitDestroy();
-
- /*
- * this is used to load the 'navit' native library on
- * application startup. The library has already been unpacked at
- * installation time by the package manager.
- */
- static
- {
- System.loadLibrary("navit");
- }
-}
diff --git a/navit/android/src/org/navitproject/navit/NavitActivityResult.java b/navit/android/src/org/navitproject/navit/NavitActivityResult.java
deleted file mode 100644
index 63b4e798f..000000000
--- a/navit/android/src/org/navitproject/navit/NavitActivityResult.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.navitproject.navit;
-import android.content.Intent;
-
-public interface NavitActivityResult {
- public void onActivityResult(int requestCode, int resultCode, Intent data);
-};
diff --git a/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java b/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java
deleted file mode 100644
index d3989cf48..000000000
--- a/navit/android/src/org/navitproject/navit/NavitAddressSearchActivity.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package org.navitproject.navit;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Locale;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.ProgressDialog;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.util.Log;
-import android.util.TypedValue;
-import android.view.Gravity;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.WindowManager;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.ImageButton;
-import android.widget.LinearLayout;
-import android.widget.ListView;
-import android.widget.RelativeLayout;
-import android.widget.Toast;
-import android.widget.RelativeLayout.LayoutParams;
-import android.widget.TextView;
-
-public class NavitAddressSearchActivity extends Activity {
- public static final class NavitAddress {
- public NavitAddress(int type, float latitude, float longitude, String address) {
- result_type = type;
- lat = latitude;
- lon = longitude;
- addr = address;
- }
-
- int result_type;
- float lat;
- float lon;
- String addr;
- }
-
- private static final String TAG = "NavitAddress";
- private static final int ADDRESS_RESULT_PROGRESS_MAX = 10;
-
- private List<NavitAddress> Addresses_found = null;
- private List<NavitAddress> addresses_shown = null;
- private String mAddressString = "";
- private boolean mPartialSearch = false;
- private String mCountry;
- private ImageButton mCountryButton;
- ProgressDialog search_results_wait = null;
- public RelativeLayout NavitAddressSearchActivity_layout;
- private int search_results_towns = 0;
- private int search_results_streets = 0;
- private int search_results_streets_hn = 0;
- private long search_handle = 0;
-
- // TODO remember settings
- private static String last_address_search_string = "";
- private static Boolean last_address_partial_match = false;
- private static String last_country = "";
-
- private int getDrawableID(String resourceName) {
- int drawableId = 0;
- try {
- Class<?> res = R.drawable.class;
- Field field = res.getField(resourceName);
- drawableId = field.getInt(null);
- } catch (Exception e) {
- Log.e("NavitAddressSearch", "Failure to get drawable id.", e);
- }
- return drawableId;
- }
-
- private void setCountryButtonImage() {
- // We have all images stored as drawable_nodpi resources which allows native code to manipulate them
- // without interference with android builtin choosing and scaling system. But that makes us to
- // reinvent the wheel here to show an image in android native interface.
- int flag_icon_sizes[]={24,32,48,64,96};
- int exact_size, nearest_size;
- exact_size=(int)(Navit.metrics.density*24.0 -.5);
- nearest_size=flag_icon_sizes[0];
- for(int size: flag_icon_sizes) {
- nearest_size=size;
- if(exact_size<=size)
- break;
- }
- mCountryButton.setImageResource(getDrawableID("country_" + mCountry+"_"+nearest_size+"_"+nearest_size));
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- Bundle extras = getIntent().getExtras();
- if ( extras != null )
- {
- String search_string = extras.getString(("search_string"));
- if (search_string != null) {
- mPartialSearch = true;
- mAddressString = search_string;
- executeSearch();
- return;
- }
- }
-
- mPartialSearch = last_address_partial_match;
- mAddressString = last_address_search_string;
-
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
- LinearLayout panel = new LinearLayout(this);
- panel.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
- panel.setOrientation(LinearLayout.VERTICAL);
-
- // address: label and text field
- SharedPreferences settings = getSharedPreferences(Navit.NAVIT_PREFS, MODE_PRIVATE);
- mCountry = settings.getString(("DefaultCountry") , null);
-
- if (mCountry == null) {
- Locale defaultLocale = Locale.getDefault();
- mCountry = defaultLocale.getCountry().toLowerCase(defaultLocale);
- SharedPreferences.Editor edit_settings = settings.edit();
- edit_settings.putString("DefaultCountry", mCountry);
- edit_settings.commit();
- }
-
- mCountryButton = new ImageButton(this);
-
- setCountryButtonImage();
-
- mCountryButton.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- requestCountryDialog();
- }
- });
-
- // address: label and text field
- TextView addr_view = new TextView(this);
- addr_view.setText(Navit._("Enter Destination")); // TRANS
- addr_view.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20f);
- addr_view.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
- addr_view.setPadding(4, 4, 4, 4);
-
- // partial match checkbox
- final CheckBox checkboxPartialMatch = new CheckBox(this);
- checkboxPartialMatch.setText(Navit._("partial match")); // TRANS
- checkboxPartialMatch.setChecked(last_address_partial_match);
- checkboxPartialMatch.setGravity(Gravity.CENTER);
-
- final EditText address_string = new EditText(this);
- address_string.setText(last_address_search_string);
- address_string.setSelectAllOnFocus(true);
-
- // search button
- final Button btnSearch = new Button(this);
- btnSearch.setText(Navit._("Search")); // TRANS
- btnSearch.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
- btnSearch.setGravity(Gravity.CENTER);
- btnSearch.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
- mPartialSearch = checkboxPartialMatch.isChecked();
- mAddressString = address_string.getText().toString();
- last_address_partial_match = mPartialSearch;
- last_address_search_string = mAddressString;
- executeSearch();
- }
- });
-
- ListView lastAddresses = new ListView(this);
- NavitAppConfig navitConfig = (NavitAppConfig) getApplicationContext();
-
- final List<NavitAddress> addresses = navitConfig.getLastAddresses();
- int addressCount = addresses.size();
- if (addressCount > 0) {
- String[] strAddresses = new String[addressCount];
- for (int addrIndex = 0; addrIndex < addressCount; addrIndex++) {
- strAddresses[addrIndex] = addresses.get(addrIndex).addr;
- }
- ArrayAdapter<String> addressList =
- new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, strAddresses);
- lastAddresses.setAdapter(addressList);
- lastAddresses.setOnItemClickListener(new OnItemClickListener() {
- public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
- NavitAddress addressSelected = addresses.get(arg2);
- Intent resultIntent = new Intent();
-
- resultIntent.putExtra("lat", addressSelected.lat);
- resultIntent.putExtra("lon", addressSelected.lon);
- resultIntent.putExtra("q", addressSelected.addr);
-
- setResult(Activity.RESULT_OK, resultIntent);
- finish();
- }
- });
- }
-
- String title = getString(R.string.address_search_title);
-
- if (title != null && title.length() > 0)
- this.setTitle(title);
-
- LinearLayout searchSettingsLayout = new LinearLayout(this);
- searchSettingsLayout.setOrientation(LinearLayout.HORIZONTAL);
-
- searchSettingsLayout.addView(mCountryButton);
- searchSettingsLayout.addView(checkboxPartialMatch);
- panel.addView(addr_view);
- panel.addView(address_string);
- panel.addView(searchSettingsLayout);
- panel.addView(btnSearch);
- panel.addView(lastAddresses);
-
- setContentView(panel);
- }
-
- private void requestCountryDialog() {
- final String[][] all_countries = NavitGraphics.GetAllCountries();
-
- Comparator<String[]> country_comperator = new Comparator<String[]>() {
- public int compare(String[] object1, String[] object2) {
- return object1[1].compareTo(object2[1]);
- }
- };
-
- Arrays.sort(all_countries, country_comperator);
-
- AlertDialog.Builder mapModeChooser = new AlertDialog.Builder(this);
- // ToDo also show icons and country code
- String[] country_name = new String[all_countries.length];
-
- for (int country_index = 0; country_index < all_countries.length; country_index++) {
- country_name[country_index] = all_countries[country_index][1];
- }
-
- mapModeChooser.setItems(country_name, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int item) {
- SharedPreferences settings = getSharedPreferences(Navit.NAVIT_PREFS, MODE_PRIVATE);
- mCountry = all_countries[item][0];
- SharedPreferences.Editor edit_settings = settings.edit();
- edit_settings.putString("DefaultCountry", mCountry);
- edit_settings.commit();
-
- setCountryButtonImage();
- }
- });
-
- AlertDialog d=mapModeChooser.create();
- d.getListView().setFastScrollEnabled(true);
- d.show();
- }
-
- /**
- * start a search on the map
- */
- public void receiveAddress(int type, float latitude, float longitude, String address) {
- Log.e(TAG, "(" + String.valueOf(latitude) + ", " + String.valueOf(longitude) + ") " + address);
-
- switch (type) {
- case 0:
- search_results_towns++;
- break;
- case 1:
- search_results_streets++;
- break;
- case 2:
- search_results_streets_hn++;
- break;
-
- }
- search_results_wait.setMessage(Navit._("Towns") + ":" + search_results_towns + " "
- + Navit._("Streets") + ":" + search_results_streets + "/"
- + search_results_streets_hn);
-
- search_results_wait.setProgress(Addresses_found.size() % (ADDRESS_RESULT_PROGRESS_MAX + 1));
-
- Addresses_found.add(new NavitAddress(type, latitude, longitude, address));
- }
-
- public void finishAddressSearch() {
- if (Addresses_found.isEmpty()) {
- Toast.makeText( getApplicationContext(),getString(R.string.address_search_not_found) + "\n" + mAddressString, Toast.LENGTH_LONG).show(); //TRANS
- setResult(Activity.RESULT_CANCELED);
- finish();
- }
- ListView addressesFound = new ListView(this);
- addressesFound.setFastScrollEnabled(true);
- ArrayAdapter<String> addressList =
- new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
-
- addresses_shown = new ArrayList<NavitAddress>();
-
- for (NavitAddress currentAddress : Addresses_found) {
- if (currentAddress.result_type != 0 || search_results_streets == 0) {
- addressList.add(currentAddress.addr);
- addresses_shown.add(currentAddress);
- }
- }
-
- addressesFound.setAdapter(addressList);
-
- addressesFound.setOnItemClickListener(new OnItemClickListener() {
- public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
- NavitAddress addressSelected = addresses_shown.get(arg2);
- Intent resultIntent = new Intent();
-
- resultIntent.putExtra("lat", addressSelected.lat);
- resultIntent.putExtra("lon", addressSelected.lon);
- resultIntent.putExtra("q", addressSelected.addr);
-
- setResult(Activity.RESULT_OK, resultIntent);
- finish();
- }
- });
-
- setContentView(addressesFound);
- search_results_wait.dismiss();
- }
-
- public native long CallbackStartAddressSearch(int partial_match, String country, String s);
- public native void CallbackCancelAddressSearch(long handle);
-
- @Override
- protected Dialog onCreateDialog(int id) {
- search_results_wait = new ProgressDialog(this);
- search_results_wait.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
- search_results_wait.setTitle("Loading search results");
- search_results_wait.setMessage("--");
- search_results_wait.setCancelable(true);
- search_results_wait.setProgress(0);
- search_results_wait.setMax(10);
-
- Addresses_found = new ArrayList<NavitAddress>();
- search_results_towns = 0;
- search_results_streets = 0;
- search_results_streets_hn = 0;
-
- search_handle = CallbackStartAddressSearch(mPartialSearch ? 1 : 0, mCountry, mAddressString);
-
- search_results_wait.setOnCancelListener(new DialogInterface.OnCancelListener() {
- @Override
- public void onCancel(DialogInterface dialog) {
- CallbackCancelAddressSearch(search_handle);
- search_handle = 0;
- search_results_wait.dismiss();
- }
- });
- return search_results_wait;
- }
-
- void executeSearch() {
- showDialog(0);
- }
-}
-
diff --git a/navit/android/src/org/navitproject/navit/NavitAppConfig.java b/navit/android/src/org/navitproject/navit/NavitAppConfig.java
deleted file mode 100755
index 13ccc9bb4..000000000
--- a/navit/android/src/org/navitproject/navit/NavitAppConfig.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.navitproject.navit;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.navitproject.navit.NavitAddressSearchActivity.NavitAddress;
-
-import android.app.Application;
-import android.content.SharedPreferences;
-import android.util.Log;
-import org.acra.*;
-import org.acra.annotation.*;
-
-//@ReportsCrashes(formKey = "dGlrNVRIOVVKYjB0UGVoLUZPanlzWFE6MQ")
-@ReportsCrashes(mailTo = "android@navit-project.org",
- mode = ReportingInteractionMode.TOAST,
- resToastText = R.string.app_name)
-
-public class NavitAppConfig extends Application {
-
- private static final int MAX_LAST_ADDRESSES = 10;
- private static final String TAG = "Navit";
-
- private List<NavitAddress> mLastAddresses = null;
- private int mLastAddressField;
- private SharedPreferences mSettings;
-
- @Override
- public void onCreate() {
- // call ACRA.init(this) as reflection, because old ant may forgot to include it
- try {
- Class<?> acraClass = Class.forName("org.acra.ACRA");
- Class<?> partypes[] = new Class[1];
- partypes[0] = Application.class;
- java.lang.reflect.Method initMethod = acraClass.getMethod("init", partypes);
- Object arglist[] = new Object[1];
- arglist[0] = this;
- initMethod.invoke(null, arglist);
- } catch (Exception e1) {
- Log.e(TAG, "Could not init ACRA crash reporter");
- }
-
- mSettings = getSharedPreferences(Navit.NAVIT_PREFS, MODE_PRIVATE);
- super.onCreate();
- }
-
- public List<NavitAddress> getLastAddresses() {
- if (mLastAddresses == null) {
- mLastAddresses = new ArrayList<NavitAddress>();
- int mLastAddressField = mSettings.getInt("LastAddress", -1);
- if (mLastAddressField >= 0) {
- int index = mLastAddressField;
- do {
- String addr_str = mSettings.getString("LastAddress_" + String.valueOf(index), "");
-
- if (addr_str.length() > 0) {
- mLastAddresses.add(new NavitAddress(
- 1,
- mSettings.getFloat("LastAddress_Lat_" + String.valueOf(index), 0),
- mSettings.getFloat("LastAddress_Lon_" + String.valueOf(index), 0),
- addr_str));
- }
-
- if (--index < 0) index = MAX_LAST_ADDRESSES - 1;
-
- } while (index != mLastAddressField);
- }
- }
- return mLastAddresses;
- }
-
- public void addLastAddress(NavitAddress newAddress) {
- getLastAddresses();
-
- mLastAddresses.add(newAddress);
- if (mLastAddresses.size() > MAX_LAST_ADDRESSES) mLastAddresses.remove(0);
-
- mLastAddressField++;
- if (mLastAddressField >= MAX_LAST_ADDRESSES) mLastAddressField = 0;
-
- SharedPreferences.Editor editSettings = mSettings.edit();
-
- editSettings.putInt("LastAddress", mLastAddressField);
- editSettings.putString("LastAddress_" + String.valueOf(mLastAddressField), newAddress.addr);
- editSettings.putFloat("LastAddress_Lat_" + String.valueOf(mLastAddressField), newAddress.lat);
- editSettings.putFloat("LastAddress_Lon_" + String.valueOf(mLastAddressField), newAddress.lon);
-
- editSettings.commit();
- }
-}
diff --git a/navit/android/src/org/navitproject/navit/NavitBackupTask.java b/navit/android/src/org/navitproject/navit/NavitBackupTask.java
deleted file mode 100644
index ca52ee46e..000000000
--- a/navit/android/src/org/navitproject/navit/NavitBackupTask.java
+++ /dev/null
@@ -1,126 +0,0 @@
-
-package org.navitproject.navit;
-
-import android.app.Activity;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.os.AsyncTask;
-import android.os.Environment;
-import android.text.format.Time;
-import android.widget.Toast;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
-public class NavitBackupTask extends AsyncTask<Void, Void, String> {
-
- private Navit mActivity;
-
- private ProgressDialog mDialog;
-
- public NavitBackupTask(Navit context) {
- mActivity = context;
- }
-
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
-
- /* Create a Wait Progress Dialog to inform the User that we are working */
- mDialog = new ProgressDialog(mActivity);
- mDialog.setIndeterminate(true);
- mDialog.setMessage(mActivity.getString(R.string.backing_up));
- mDialog.show();
- }
-
- @Override
- protected String doInBackground(Void... v) {
- Time now = new Time();
- now.setToNow();
-
- /* This is the Directory where all Subdirectories are stored by date */
- File mainBackupDir = new File(Environment.getExternalStorageDirectory().getPath() + "/navit/backup/");
-
- /* Create the Main Backup Directory if it doesn't exist */
- if (!mainBackupDir.isDirectory()) {
- if (!mainBackupDir.mkdirs())
- return mActivity.getString(R.string.failed_to_create_backup_directory);
- }
-
- /* Create a Timestamp in the format YYYY-MM-DD-Index */
- String timestamp = now.year + "-" + String.format("%02d", now.month+1) + "-" + String.format("%02d", now.monthDay);
- /* Get the next free index */
- int index = 1;
- for (String s : mainBackupDir.list()) {
- if (s.contains(timestamp)) {
- int newIndex = Integer.parseInt(s.substring(11));
- if (newIndex >= index)
- index = newIndex + 1;
- }
- }
- timestamp += "-" + index;
-
- /* This is the Directory in which the Files are copied into */
- File backupDir = new File(Environment.getExternalStorageDirectory().getPath() + "/navit/backup/" + timestamp);
-
- /* Create the Backup Directory if it doesn't exist */
- if (!backupDir.isDirectory()) {
- if (!backupDir.mkdirs())
- return mActivity.getString(R.string.failed_to_create_backup_directory);
- }
-
- ObjectOutputStream preferencesOOs = null;
- try {
- /* Backup Files in home */
- mActivity.copyFileIfExists(Navit.NAVIT_DATA_DIR + "/home/bookmark.txt", backupDir.getPath() + "/bookmark.txt");
- mActivity.copyFileIfExists(Navit.NAVIT_DATA_DIR + "/home/destination.txt", backupDir.getPath() + "/destination.txt");
- mActivity.copyFileIfExists(Navit.NAVIT_DATA_DIR + "/home/gui_internal.txt", backupDir.getPath() + "/gui_internal.txt");
-
- /* Backup Shared Preferences */
- preferencesOOs = new ObjectOutputStream(new FileOutputStream(backupDir.getPath() + "/preferences.bak"));
- preferencesOOs.writeObject(mActivity.getSharedPreferences(Navit.NAVIT_PREFS, Context.MODE_PRIVATE).getAll());
- }
- catch (IOException e) {
- e.printStackTrace();
- return mActivity.getString(R.string.backup_failed);
- }
- finally {
- /* Close Stream to prevent Resource Leaks */
- try {
- if (preferencesOOs != null)
- preferencesOOs.close();
- }
- catch (IOException e) {
- e.printStackTrace();
- return mActivity.getString(R.string.backup_failed);
- }
- }
-
- return null;
- }
-
- @Override
- protected void onPostExecute(String result) {
- super.onPostExecute(result);
-
- /* Dismiss the Wait Progress Dialog */
- mDialog.dismiss();
-
- /* If result is non null an Error occured */
- if (result != null) {
- Toast.makeText(mActivity, result, Toast.LENGTH_LONG).show();
- return;
- }
-
- Toast.makeText(mActivity, mActivity.getString(R.string.backup_successful), Toast.LENGTH_LONG).show();
- }
-
- @Override
- protected void onCancelled() {
- super.onCancelled();
- Toast.makeText(mActivity, mActivity.getString(R.string.backup_failed), Toast.LENGTH_LONG).show();
- mDialog.dismiss();
- }
-}
diff --git a/navit/android/src/org/navitproject/navit/NavitCamera.java b/navit/android/src/org/navitproject/navit/NavitCamera.java
deleted file mode 100644
index bd78b36b2..000000000
--- a/navit/android/src/org/navitproject/navit/NavitCamera.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.navitproject.navit;
-
-import java.io.IOException;
-
-import android.content.Context;
-import android.hardware.Camera;
-import android.util.Log;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-
-
-
-
-public class NavitCamera extends SurfaceView implements SurfaceHolder.Callback {
- SurfaceHolder mHolder;
- Camera mCamera;
-
-
-
- NavitCamera(Context context)
- {
- super(context);
- mHolder = getHolder();
- mHolder.addCallback(this);
- mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
- Log.e("NavitCamera","Creator");
-
-
- }
-
-
- public void surfaceCreated(SurfaceHolder holder) {
- // The Surface has been created, acquire the camera and tell it where
- // to draw.
- try {
- mCamera = Camera.open();
- mCamera.setPreviewDisplay(holder);
- } catch (IOException exception) {
- mCamera.release();
- mCamera = null;
- // TODO: add more exception handling logic here
- }
- Log.e("NavitCamera","surfaceCreated");
- }
-
- public void surfaceDestroyed(SurfaceHolder holder) {
- // Surface will be destroyed when we return, so stop the preview.
- // Because the CameraDevice object is not a shared resource, it's very
- // important to release it when the activity is paused.
- mCamera.stopPreview();
- mCamera = null;
- Log.e("NavitCamera","surfaceDestroyed");
- }
-
- public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
- // Now that the size is known, set up the camera parameters and begin
- // the preview.
- Log.e("NavitCamera","surfaceChanged "+w+"x"+h);
- mCamera.stopPreview();
- Camera.Parameters parameters = mCamera.getParameters();
- parameters.setPreviewSize(w, h);
- mCamera.setParameters(parameters);
- mCamera.startPreview();
- }
-
-}
-
diff --git a/navit/android/src/org/navitproject/navit/NavitDialogs.java b/navit/android/src/org/navitproject/navit/NavitDialogs.java
deleted file mode 100644
index f50672ebd..000000000
--- a/navit/android/src/org/navitproject/navit/NavitDialogs.java
+++ /dev/null
@@ -1,218 +0,0 @@
-package org.navitproject.navit;
-
-
-import java.io.File;
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.app.ProgressDialog;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnClickListener;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.widget.ArrayAdapter;
-import android.widget.Toast;
-import android.os.Environment;
-
-public class NavitDialogs extends Handler{
- // Dialogs
- public static final int DIALOG_MAPDOWNLOAD = 1;
- public static final int DIALOG_BACKUP_RESTORE = 2;
- public static final int DIALOG_SELECT_BACKUP = 3;
-
- // dialog messages
- static final int MSG_MAP_DOWNLOAD_FINISHED = 0;
- static final int MSG_PROGRESS_BAR = 1;
- static final int MSG_TOAST = 2;
- static final int MSG_TOAST_LONG = 3;
- static final int MSG_POSITION_MENU = 6;
- static final int MSG_START_MAP_DOWNLOAD = 7;
- static final int MSG_REMOVE_DIALOG_GENERIC = 99;
- static Handler mHandler;
-
- private ProgressDialog mapdownloader_dialog = null;
- private NavitMapDownloader mapdownloader = null;
-
- private Navit mActivity;
-
- public NavitDialogs(Navit activity) {
- super();
- mActivity = activity;
- mHandler = this;
- }
-
- static public void sendDialogMessage(int what, String title, String text, int dialog_num, int value1, int value2)
- {
- Message msg = mHandler.obtainMessage(what);
- Bundle data = new Bundle();
-
- data.putString("title", title);
- data.putString("text", text);
- data.putInt("value1", value1);
- data.putInt("value2", value2);
- data.putInt("dialog_num", dialog_num);
- msg.setData(data);
-
- mHandler.sendMessage(msg);
- }
-
- @Override
- public void handleMessage(Message msg)
- {
- switch (msg.what)
- {
- case MSG_MAP_DOWNLOAD_FINISHED :
- {
- // dismiss dialog, remove dialog
- mActivity.dismissDialog(DIALOG_MAPDOWNLOAD);
- mActivity.removeDialog(DIALOG_MAPDOWNLOAD);
- if (msg.getData().getInt("value1") == 1) {
- Message msg_out =
- Message.obtain(Navit.N_NavitGraphics.callback_handler,
- NavitGraphics.msg_type.CLB_LOAD_MAP.ordinal());
- msg_out.setData(msg.getData());
- msg_out.sendToTarget();
-
- msg_out = Message.obtain(Navit.N_NavitGraphics.callback_handler,
- NavitGraphics.msg_type.CLB_CALL_CMD.ordinal());
- Bundle b = new Bundle();
- int mi=msg.getData().getInt("value2");
- double lon=(Double.parseDouble(NavitMapDownloader.osm_maps[mi].lon1)+Double.parseDouble(NavitMapDownloader.osm_maps[mi].lon2))/2.0;
- double lat=(Double.parseDouble(NavitMapDownloader.osm_maps[mi].lat1)+Double.parseDouble(NavitMapDownloader.osm_maps[mi].lat2))/2.0;
- b.putString("cmd", "set_center(\""+ lon +" "+ lat + "\",1); zoom=256");
- msg_out.setData(b);
- msg_out.sendToTarget();
- }
- break;
- }
- case MSG_PROGRESS_BAR :
- // change progressbar values
- mapdownloader_dialog.setMax(msg.getData().getInt("value1"));
- mapdownloader_dialog.setProgress(msg.getData().getInt("value2"));
- mapdownloader_dialog.setTitle(msg.getData().getString(("title")));
- mapdownloader_dialog.setMessage(msg.getData().getString(("text")));
- break;
- case MSG_TOAST :
- Toast.makeText(mActivity, msg.getData().getString(("text")), Toast.LENGTH_SHORT).show();
- break;
- case MSG_TOAST_LONG :
- Toast.makeText(mActivity, msg.getData().getString(("text")), Toast.LENGTH_LONG).show();
- break;
- case MSG_START_MAP_DOWNLOAD:
- {
- int download_map_id = msg.arg1;
- Log.d("Navit", "PRI id=" + download_map_id);
- // set map id to download
-
- // show the map download progressbar, and download the map
- if (download_map_id > -1)
- {
- mapdownloader = new NavitMapDownloader(download_map_id);
- mActivity.showDialog(NavitDialogs.DIALOG_MAPDOWNLOAD);
- mapdownloader.start();
- }
- }
- break;
- case MSG_REMOVE_DIALOG_GENERIC :
- // dismiss dialog, remove dialog - generic
- mActivity.dismissDialog(msg.getData().getInt("dialog_num"));
- mActivity.removeDialog(msg.getData().getInt("dialog_num"));
- break;
- }
- }
-
- Dialog createDialog(int id)
- {
- AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
-
- switch (id)
- {
- case DIALOG_MAPDOWNLOAD :
- mapdownloader_dialog = new ProgressDialog(mActivity);
- mapdownloader_dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
- mapdownloader_dialog.setTitle("--");
- mapdownloader_dialog.setMessage("--");
- mapdownloader_dialog.setCancelable(true);
- mapdownloader_dialog.setProgress(0);
- mapdownloader_dialog.setMax(200);
- DialogInterface.OnDismissListener onDismissListener = new DialogInterface.OnDismissListener()
- {
- public void onDismiss(DialogInterface dialog)
- {
- Log.e("Navit", "onDismiss: mapdownloader_dialog");
- if(mapdownloader!=null)
- mapdownloader.stop_thread();
- }
- };
- mapdownloader_dialog.setOnDismissListener(onDismissListener);
- // show license for OSM maps
- Toast.makeText(mActivity.getApplicationContext(),
- Navit._("Map data (c) OpenStreetMap contributors, ODBL"),
- Toast.LENGTH_LONG).show(); //TRANS
- return mapdownloader_dialog;
-
- case DIALOG_BACKUP_RESTORE :
- /* Create a Dialog that Displays Options wether to Backup or Restore */
- builder.setTitle(mActivity.getString(R.string.choose_an_action)).
- setCancelable(true).
- setItems(R.array.dialog_backup_restore_items,
- new DialogInterface.OnClickListener() {
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- /* Notify User if no SD Card present */
- if(!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
- Toast.makeText(mActivity,mActivity.getString(R.string.please_insert_an_sd_card), Toast.LENGTH_LONG).show();
-
- switch (which) {
- case 0:
- /* Backup */
- new NavitBackupTask(mActivity).execute();
- break;
- case 1:
- /* Restore */
- mActivity.showDialog(DIALOG_SELECT_BACKUP);
- break;
- }
- }});
- return builder.create();
-
- case DIALOG_SELECT_BACKUP :
- /* Create a Dialog with a list from which the user selects the Backup to be restored */
- File mainBackupDir = new File(Environment.getExternalStorageDirectory().getPath() + "/navit/backup/");
-
- String[] backups = null;
- if(mainBackupDir.isDirectory())
- backups = mainBackupDir.list();
-
- if(backups == null || backups.length == 0) {
- /* No Backups were found */
- builder.setTitle(mActivity.getText(R.string.no_backup_found));
- builder.setNegativeButton(mActivity.getText(android.R.string.cancel), null);
- return builder.create();
- }
-
- builder.setTitle(mActivity.getString(R.string.select_backup));
- final ArrayAdapter<String> adapter = new ArrayAdapter<String>(mActivity, android.R.layout.simple_spinner_item, backups);
- builder.setAdapter(adapter, new OnClickListener(){
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- new NavitRestoreTask(mActivity, adapter.getItem(which)).execute();
- }});
- builder.setNegativeButton(mActivity.getString(android.R.string.cancel), null);
-
- return builder.create();
- }
- // should never get here!!
- return null;
- }
-
- public void prepareDialog(int id, Dialog dialog) {
-
- /* Remove the Dialog to force Android to rerun onCreateDialog */
- if(id == DIALOG_SELECT_BACKUP)
- mActivity.removeDialog(id);
- }
-}
diff --git a/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java b/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java
deleted file mode 100644
index fd117a376..000000000
--- a/navit/android/src/org/navitproject/navit/NavitDownloadSelectMapActivity.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package org.navitproject.navit;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.ExpandableListActivity;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationManager;
-import android.os.Bundle;
-import android.os.Message;
-import android.os.StatFs;
-import android.util.Log;
-import android.view.View;
-import android.widget.ExpandableListView;
-import android.widget.RelativeLayout;
-import android.widget.SimpleExpandableListAdapter;
-import android.widget.TextView;
-
-public class NavitDownloadSelectMapActivity extends ExpandableListActivity {
-
- private static SimpleExpandableListAdapter adapter = null;
- private static final String MAP_BULLETPOINT = " * ";
- private static ArrayList<HashMap<String, String>> downloaded_maps_childs = null;
- private static ArrayList<HashMap<String, String>> maps_current_position_childs = null;
- private static boolean currentLocationKnown = false;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- if (adapter == null) {
- adapter = createAdapter();
- }
- updateDownloadedMaps();
- updateMapsForLocation(NavitMapDownloader.osm_maps);
- setListAdapter(adapter);
- try {
- setTitle(String.valueOf(getFreeSpace() / 1024 / 1024) + "MB available");
- } catch (Exception e) {
- Log.e("Navit","Exception "+e.getClass().getName()+" during getFreeSpace, reporting 'no sdcard present'");
- NavitDialogs.sendDialogMessage(NavitDialogs.MSG_TOAST_LONG, null,
- String.format(Navit._("Current map location %s is not available\nPlease restart Navit after you attach an SD card or select a different map location."),Navit.map_filename_path),
- -1, 0, 0);
- finish();
- }
- }
-
- protected long getFreeSpace()
- {
- StatFs fsInfo = new StatFs(Navit.map_filename_path);
- return (long)fsInfo.getAvailableBlocks() * fsInfo.getBlockSize();
- }
-
- private void updateDownloadedMaps() {
- downloaded_maps_childs.clear();
- for (NavitMap map : NavitMapDownloader.getAvailableMaps()) {
- HashMap<String, String> child = new HashMap<String, String>();
- child.put("map_name", map.mapName + " " + (map.size() / 1024 / 1024) + "MB");
- child.put("map_location", map.getLocation());
- downloaded_maps_childs.add(child);
- }
- }
-
- private void updateMapsForLocation(NavitMapDownloader.osm_map_values osm_maps[]) {
- Location currentLocation = NavitVehicle.lastLocation;
- if (maps_current_position_childs.size() == 0 || (currentLocation != null && !currentLocationKnown)) {
- if (currentLocation == null) {
- LocationManager mapLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
- List<String> providers = mapLocationManager.getProviders(true);
- long lastUpdate = 0;
- long bestUpdateTime = -1;
- for (String provider : providers) {
- Location lastKnownLocation = mapLocationManager.getLastKnownLocation(provider);
- if (lastKnownLocation != null) {
- lastUpdate = lastKnownLocation.getTime();
- if (lastUpdate > bestUpdateTime) {
- currentLocation = lastKnownLocation;
- bestUpdateTime = lastUpdate;
- }
- }
- }
- } else currentLocationKnown = true;
-
- if (currentLocation != null) {
- // if this map contains data to our current position, add it to
- // the
- // MapsOfCurrentLocation-list
- for (int currentMapIndex = 0; currentMapIndex < osm_maps.length; currentMapIndex++) {
- if (osm_maps[currentMapIndex].isInMap(currentLocation)) {
- HashMap<String, String> currentPositionMapChild = new HashMap<String, String>();
- currentPositionMapChild.put("map_name", osm_maps[currentMapIndex].map_name + " "
- + (osm_maps[currentMapIndex].est_size_bytes / 1024 / 1024) + "MB");
- currentPositionMapChild.put("map_index", String.valueOf(currentMapIndex));
-
- maps_current_position_childs.add(currentPositionMapChild);
- }
- }
- }
- }
- }
-
- private SimpleExpandableListAdapter createAdapter() {
-
- NavitMapDownloader.osm_map_values osm_maps[] = NavitMapDownloader.osm_maps;
-
- ArrayList<HashMap<String, String>> resultGroups = new ArrayList<HashMap<String, String>>();
- ArrayList<ArrayList<HashMap<String, String>>> resultChilds =
- new ArrayList<ArrayList<HashMap<String, String>>>();
-
- // add already downloaded maps (group and empty child list
- HashMap<String, String> downloaded_maps_hash = new HashMap<String, String>();
- downloaded_maps_hash.put("category_name", Navit._("Downloaded maps"));
- resultGroups.add(downloaded_maps_hash);
- downloaded_maps_childs = new ArrayList<HashMap<String, String>>();
- resultChilds.add(downloaded_maps_childs);
-
- ArrayList<HashMap<String, String>> secList = new ArrayList<HashMap<String, String>>();
- maps_current_position_childs = new ArrayList<HashMap<String, String>>();
- // maps containing the current location
- HashMap<String, String> matching_maps = new HashMap<String, String>();
- matching_maps.put("category_name", Navit.NavitResources.getString(R.string.maps_for_current_location));
- resultGroups.add(matching_maps);
- resultChilds.add(maps_current_position_childs);
-
- // add all maps
- for (int currentMapIndex = 0; currentMapIndex < osm_maps.length; currentMapIndex++) {
- if (osm_maps[currentMapIndex].level == 0) {
- if (secList != null && secList.size() > 0) {
- resultChilds.add(secList);
- }
- secList = new ArrayList<HashMap<String, String>>();
- HashMap<String, String> map_info_hash = new HashMap<String, String>();
- map_info_hash.put("category_name", osm_maps[currentMapIndex].map_name);
- resultGroups.add(map_info_hash);
- }
-
- HashMap<String, String> child = new HashMap<String, String>();
- child.put("map_name", (osm_maps[currentMapIndex].level > 1 ? MAP_BULLETPOINT : "")
- + osm_maps[currentMapIndex].map_name + " "
- + (osm_maps[currentMapIndex].est_size_bytes / 1024 / 1024) + "MB");
- child.put("map_index", String.valueOf(currentMapIndex));
-
- secList.add(child);
- }
- resultChilds.add(secList);
-
- return new SimpleExpandableListAdapter(this, resultGroups, android.R.layout.simple_expandable_list_item_1,
- new String[] { "category_name" }, new int[] { android.R.id.text1 }, resultChilds,
- android.R.layout.simple_expandable_list_item_1, new String[] { "map_name" },
- new int[] { android.R.id.text1 });
- }
-
- @Override
- public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
- super.onChildClick(parent, v, groupPosition, childPosition, id);
- Log.d("Navit", "p:" + groupPosition + ", child_pos:" + childPosition);
-
- @SuppressWarnings("unchecked")
- HashMap<String, String> child = (HashMap<String, String>) adapter.getChild(groupPosition, childPosition);
-
- String map_index = child.get("map_index");
- if (map_index != null) {
- int mi=Integer.parseInt(map_index);
- if(NavitMapDownloader.osm_maps[mi].est_size_bytes/1024/1024/950>=4) {
- NavitDialogs.sendDialogMessage(NavitDialogs.MSG_TOAST_LONG, null,
- Navit._("Sorry, we currently do not support maps above 3.8G on Android, please select a smaller one."),
- -1, 0, 0);
- return true;
- }
- Intent resultIntent = new Intent();
- resultIntent.putExtra("map_index", mi);
- setResult(Activity.RESULT_OK, resultIntent);
- finish();
- } else {
- // ask user if to delete this map
- askForMapDeletion(child.get("map_location"));
- }
- return true;
- }
-
- private void askForMapDeletion(final String map_location) {
- AlertDialog.Builder deleteMapBox = new AlertDialog.Builder(this);
- deleteMapBox.setTitle(getString(R.string.map_delete)); // TRANS
- deleteMapBox.setCancelable(true);
- final TextView message = new TextView(this);
- message.setFadingEdgeLength(20);
- message.setVerticalFadingEdgeEnabled(true);
- RelativeLayout.LayoutParams layoutParams =
- new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT,
- RelativeLayout.LayoutParams.FILL_PARENT);
-
- message.setLayoutParams(layoutParams);
- NavitMap maptoDelete = new NavitMap(map_location);
- message.setText(maptoDelete.mapName + " " + String.valueOf(maptoDelete.size() / 1024 / 1024) + "MB");
- deleteMapBox.setView(message);
-
- // TRANS
- deleteMapBox.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
- Log.e("Navit", "Delete Map");
- Message msg =
- Message.obtain(Navit.N_NavitGraphics.callback_handler,
- NavitGraphics.msg_type.CLB_DELETE_MAP.ordinal());
- Bundle b = new Bundle();
- b.putString("title", map_location);
- msg.setData(b);
- msg.sendToTarget();
- finish();
- }
- });
-
- // TRANS
- deleteMapBox.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
- Log.e("Navit", "don't delete map");
- }
- });
- deleteMapBox.show();
- }
-}
diff --git a/navit/android/src/org/navitproject/navit/NavitGraphics.java b/navit/android/src/org/navitproject/navit/NavitGraphics.java
deleted file mode 100644
index a41ab52be..000000000
--- a/navit/android/src/org/navitproject/navit/NavitGraphics.java
+++ /dev/null
@@ -1,1210 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package org.navitproject.navit;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Matrix;
-import android.graphics.Paint;
-import android.graphics.Path;
-import android.graphics.PointF;
-import android.graphics.Rect;
-import android.os.Build;
-import android.os.Handler;
-import android.os.Message;
-import android.util.FloatMath;
-import android.util.Log;
-import android.view.ContextMenu;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewConfiguration;
-import android.view.ViewGroup.LayoutParams;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.FrameLayout;
-import android.widget.RelativeLayout;
-
-
-public class NavitGraphics
-{
- private NavitGraphics parent_graphics;
- private ArrayList<NavitGraphics> overlays = new ArrayList<NavitGraphics>();
- int bitmap_w;
- int bitmap_h;
- int pos_x;
- int pos_y;
- int pos_wraparound;
- int overlay_disabled;
- int bgcolor;
- float trackball_x, trackball_y;
- View view;
- SystemBarTintView navigationTintView;
- SystemBarTintView statusTintView;
- FrameLayout frameLayout;
- RelativeLayout relativelayout;
- NavitCamera camera;
- Activity activity;
-
- public static Boolean in_map = false;
-
- // for menu key
- private static long time_for_long_press = 300L;
- private static long interval_for_long_press = 200L;
-
- private Handler timer_handler = new Handler();
-
- public void setBackgroundColor(int bgcolor) {
- this.bgcolor = bgcolor;
- if (navigationTintView != null)
- navigationTintView.setBackgroundColor(bgcolor);
- if (statusTintView != null)
- statusTintView.setBackgroundColor(bgcolor);
- }
-
- public void SetCamera(int use_camera)
- {
- if (use_camera != 0 && camera == null)
- {
- // activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
- camera = new NavitCamera(activity);
- relativelayout.addView(camera);
- relativelayout.bringChildToFront(view);
- }
- }
-
- protected Rect get_rect()
- {
- Rect ret=new Rect();
- ret.left=pos_x;
- ret.top=pos_y;
- if (pos_wraparound != 0) {
- if (ret.left < 0) {
- ret.left+=parent_graphics.bitmap_w;
- }
- if (ret.top < 0) {
- ret.top+=parent_graphics.bitmap_h;
- }
- }
- ret.right=ret.left+bitmap_w;
- ret.bottom=ret.top+bitmap_h;
- if (pos_wraparound != 0) {
- if (bitmap_w < 0) {
- ret.right=ret.left+bitmap_w+parent_graphics.bitmap_w;
- }
- if (bitmap_h < 0) {
- ret.bottom=ret.top+bitmap_h+parent_graphics.bitmap_h;
- }
- }
- return ret;
- }
-
- private class NavitView extends View implements Runnable, MenuItem.OnMenuItemClickListener{
- int touch_mode = NONE;
- float oldDist = 0;
- static final int NONE = 0;
- static final int DRAG = 1;
- static final int ZOOM = 2;
- static final int PRESSED = 3;
-
- Method eventGetX = null;
- Method eventGetY = null;
-
- public PointF mPressedPosition = null;
-
- public NavitView(Context context) {
- super(context);
- try
- {
- eventGetX = android.view.MotionEvent.class.getMethod("getX", int.class);
- eventGetY = android.view.MotionEvent.class.getMethod("getY", int.class);
- }
- catch (Exception e)
- {
- Log.e("NavitGraphics", "Multitouch zoom not supported");
- }
- }
-
- @Override
- protected void onCreateContextMenu(ContextMenu menu) {
- super.onCreateContextMenu(menu);
-
- menu.setHeaderTitle(Navit._("Position")+"..");
- menu.add(1, 1, NONE, Navit._("Route to here")).setOnMenuItemClickListener(this);
- menu.add(1, 2, NONE, Navit._("Cancel")).setOnMenuItemClickListener(this);
- }
-
- @Override
- public boolean onMenuItemClick(MenuItem item) {
- switch(item.getItemId()) {
- case 1:
- Message msg = Message.obtain(callback_handler, msg_type.CLB_SET_DISPLAY_DESTINATION.ordinal()
- , (int)mPressedPosition.x, (int)mPressedPosition.y);
- msg.sendToTarget();
- break;
- }
- return false;
- }
-
-
- @Override
- protected void onDraw(Canvas canvas)
- {
- super.onDraw(canvas);
- canvas.drawBitmap(draw_bitmap, pos_x, pos_y, null);
- if (overlay_disabled == 0)
- {
- // assume we ARE in map view mode!
- in_map = true;
- for (NavitGraphics overlay : overlays)
- {
- if (overlay.overlay_disabled == 0)
- {
- Rect r=overlay.get_rect();
- canvas.drawBitmap(overlay.draw_bitmap, r.left, r.top, null);
- }
- }
- }
- else
- {
- if (Navit.show_soft_keyboard)
- {
- if (Navit.mgr != null)
- {
- //Log.e("NavitGraphics", "view -> SHOW SoftInput");
- //Log.e("NavitGraphics", "view mgr=" + String.valueOf(Navit.mgr));
- Navit.mgr.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT);
- Navit.show_soft_keyboard_now_showing = true;
- // clear the variable now, keyboard will stay on screen until backbutton pressed
- Navit.show_soft_keyboard = false;
- }
- }
- }
- }
-
- @Override
- protected void onSizeChanged(int w, int h, int oldw, int oldh)
- {
- Log.e("Navit", "NavitGraphics -> onSizeChanged pixels x=" + w + " pixels y=" + h);
- Log.e("Navit", "NavitGraphics -> onSizeChanged density=" + Navit.metrics.density);
- Log.e("Navit", "NavitGraphics -> onSizeChanged scaledDensity="
- + Navit.metrics.scaledDensity);
- super.onSizeChanged(w, h, oldw, oldh);
-
- handleResize(w, h);
- }
-
- public void do_longpress_action()
- {
- Log.e("NavitGraphics", "do_longpress_action enter");
-
- activity.openContextMenu(this);
- }
-
- private int getActionField(String fieldname, Object obj)
- {
- int ret_value = -999;
- try
- {
- java.lang.reflect.Field field = android.view.MotionEvent.class.getField(fieldname);
- try
- {
- ret_value = field.getInt(obj);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- catch (NoSuchFieldException ex) {}
-
- return ret_value;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent event)
- {
- //Log.e("NavitGraphics", "onTouchEvent");
- super.onTouchEvent(event);
- int x = (int) event.getX();
- int y = (int) event.getY();
-
- int _ACTION_POINTER_UP_ = getActionField("ACTION_POINTER_UP", event);
- int _ACTION_POINTER_DOWN_ = getActionField("ACTION_POINTER_DOWN", event);
- int _ACTION_MASK_ = getActionField("ACTION_MASK", event);
-
- int switch_value = event.getAction();
- if (_ACTION_MASK_ != -999)
- {
- switch_value = (event.getAction() & _ACTION_MASK_);
- }
-
- if (switch_value == MotionEvent.ACTION_DOWN)
- {
- touch_mode = PRESSED;
- if (!in_map) ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
- mPressedPosition = new PointF(x, y);
- postDelayed(this, time_for_long_press);
- }
- else if ((switch_value == MotionEvent.ACTION_UP) || (switch_value == _ACTION_POINTER_UP_))
- {
- Log.e("NavitGraphics", "ACTION_UP");
-
- if ( touch_mode == DRAG )
- {
- Log.e("NavitGraphics", "onTouch move");
-
- MotionCallback(MotionCallbackID, x, y);
- ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
- }
- else if (touch_mode == ZOOM)
- {
- //Log.e("NavitGraphics", "onTouch zoom");
-
- float newDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
- float scale = 0;
- if (newDist > 10f)
- {
- scale = newDist / oldDist;
- }
-
- if (scale > 1.3)
- {
- // zoom in
- CallbackMessageChannel(1, null);
- //Log.e("NavitGraphics", "onTouch zoom in");
- }
- else if (scale < 0.8)
- {
- // zoom out
- CallbackMessageChannel(2, null);
- //Log.e("NavitGraphics", "onTouch zoom out");
- }
- }
- else if (touch_mode == PRESSED)
- {
- if (in_map) ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
- ButtonCallback(ButtonCallbackID, 0, 1, x, y); // up
- }
- touch_mode = NONE;
- }
- else if (switch_value == MotionEvent.ACTION_MOVE)
- {
- //Log.e("NavitGraphics", "ACTION_MOVE");
-
- if (touch_mode == DRAG)
- {
- MotionCallback(MotionCallbackID, x, y);
- }
- else if (touch_mode == ZOOM)
- {
- float newDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
- float scale = newDist / oldDist;
- Log.e("NavitGraphics", "New scale = " + scale);
- if (scale > 1.2)
- {
- // zoom in
- CallbackMessageChannel(1, "");
- oldDist = newDist;
- //Log.e("NavitGraphics", "onTouch zoom in");
- }
- else if (scale < 0.8)
- {
- oldDist = newDist;
- // zoom out
- CallbackMessageChannel(2, "");
- //Log.e("NavitGraphics", "onTouch zoom out");
- }
- }
- else if (touch_mode == PRESSED)
- {
- Log.e("NavitGraphics", "Start drag mode");
- if ( spacing(mPressedPosition, new PointF(event.getX(), event.getY())) > 20f) {
- ButtonCallback(ButtonCallbackID, 1, 1, x, y); // down
- touch_mode = DRAG;
- }
- }
- }
- else if (switch_value == _ACTION_POINTER_DOWN_)
- {
- //Log.e("NavitGraphics", "ACTION_POINTER_DOWN");
- oldDist = spacing(getFloatValue(event, 0), getFloatValue(event, 1));
- if (oldDist > 2f)
- {
- touch_mode = ZOOM;
- //Log.e("NavitGraphics", "--> zoom");
- }
- }
- return true;
- }
-
- private float spacing(PointF a, PointF b)
- {
- float x = a.x - b.x;
- float y = a.y - b.y;
- return (float)Math.sqrt(x * x + y * y);
- }
-
- private PointF getFloatValue(Object instance, Object argument)
- {
- PointF pos = new PointF(0,0);
-
- if (eventGetX != null && eventGetY != null)
- {
- try
- {
- Float x = (java.lang.Float) eventGetX.invoke(instance, argument);
- Float y = (java.lang.Float) eventGetY.invoke(instance, argument);
- pos.set(x.floatValue(), y.floatValue());
-
- }
- catch (Exception e){}
- }
- return pos;
- }
-
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event)
- {
- int i;
- String s = null;
- boolean handled = true;
- i = event.getUnicodeChar();
- //Log.e("NavitGraphics", "onKeyDown " + keyCode + " " + i);
- // Log.e("NavitGraphics","Unicode "+event.getUnicodeChar());
- if (i == 0)
- {
- if (keyCode == android.view.KeyEvent.KEYCODE_DEL)
- {
- s = java.lang.String.valueOf((char) 8);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_MENU)
- {
- if (!in_map)
- {
- // if last menukeypress is less than 0.2 seconds away then count longpress
- if ((System.currentTimeMillis() - Navit.last_pressed_menu_key) < interval_for_long_press)
- {
- Navit.time_pressed_menu_key = Navit.time_pressed_menu_key
- + (System.currentTimeMillis() - Navit.last_pressed_menu_key);
- //Log.e("NavitGraphics", "press time=" + Navit.time_pressed_menu_key);
-
- // on long press let softkeyboard popup
- if (Navit.time_pressed_menu_key > time_for_long_press)
- {
- //Log.e("NavitGraphics", "long press menu key!!");
- Navit.show_soft_keyboard = true;
- Navit.time_pressed_menu_key = 0L;
- // need to draw to get the keyboard showing
- this.postInvalidate();
- }
- }
- else
- {
- Navit.time_pressed_menu_key = 0L;
- }
- Navit.last_pressed_menu_key = System.currentTimeMillis();
- // if in menu view:
- // use as OK (Enter) key
- s = java.lang.String.valueOf((char) 13);
- handled = true;
- // dont use menu key here (use it in onKeyUp)
- return handled;
- }
- else
- {
- // if on map view:
- // volume UP
- //s = java.lang.String.valueOf((char) 1);
- handled = false;
- return handled;
- }
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_SEARCH)
- {
- /* Handle event in Main Activity if map is shown */
- if(in_map)
- return false;
-
- s = java.lang.String.valueOf((char) 19);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_BACK)
- {
- //Log.e("NavitGraphics", "KEYCODE_BACK down");
- s = java.lang.String.valueOf((char) 27);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_CALL)
- {
- s = java.lang.String.valueOf((char) 3);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_VOLUME_UP)
- {
- if (!in_map)
- {
- // if in menu view:
- // use as UP key
- s = java.lang.String.valueOf((char) 16);
- handled = true;
- }
- else
- {
- // if on map view:
- // volume UP
- //s = java.lang.String.valueOf((char) 21);
- handled = false;
- return handled;
- }
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_VOLUME_DOWN)
- {
- if (!in_map)
- {
- // if in menu view:
- // use as DOWN key
- s = java.lang.String.valueOf((char) 14);
- handled = true;
- }
- else
- {
- // if on map view:
- // volume DOWN
- //s = java.lang.String.valueOf((char) 4);
- handled = false;
- return handled;
- }
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_DPAD_CENTER)
- {
- s = java.lang.String.valueOf((char) 13);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_DPAD_DOWN)
- {
- s = java.lang.String.valueOf((char) 14);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_DPAD_LEFT)
- {
- s = java.lang.String.valueOf((char) 2);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_DPAD_RIGHT)
- {
- s = java.lang.String.valueOf((char) 6);
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_DPAD_UP)
- {
- s = java.lang.String.valueOf((char) 16);
- }
- }
- else if (i == 10)
- {
- s = java.lang.String.valueOf((char) 13);
- }
-
- if (s != null)
- {
- KeypressCallback(KeypressCallbackID, s);
- }
- return handled;
- }
-
- @Override
- public boolean onKeyUp(int keyCode, KeyEvent event)
- {
- //Log.e("NavitGraphics", "onKeyUp " + keyCode);
-
- int i;
- String s = null;
- boolean handled = true;
- i = event.getUnicodeChar();
-
- if (i == 0)
- {
- if (keyCode == android.view.KeyEvent.KEYCODE_VOLUME_UP)
- {
- if (!in_map)
- {
- //s = java.lang.String.valueOf((char) 16);
- handled = true;
- return handled;
- }
- else
- {
- //s = java.lang.String.valueOf((char) 21);
- handled = false;
- return handled;
- }
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_VOLUME_DOWN)
- {
- if (!in_map)
- {
- //s = java.lang.String.valueOf((char) 14);
- handled = true;
- return handled;
- }
- else
- {
- //s = java.lang.String.valueOf((char) 4);
- handled = false;
- return handled;
- }
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_SEARCH) {
- /* Handle event in Main Activity if map is shown */
- if(in_map)
- return false;
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_BACK)
- {
- if (Navit.show_soft_keyboard_now_showing)
- {
- Navit.show_soft_keyboard_now_showing = false;
- }
- //Log.e("NavitGraphics", "KEYCODE_BACK up");
- //s = java.lang.String.valueOf((char) 27);
- handled = true;
- return handled;
- }
- else if (keyCode == android.view.KeyEvent.KEYCODE_MENU)
- {
- if (!in_map)
- {
- if (Navit.show_soft_keyboard_now_showing)
- {
- // if soft keyboard showing on screen, dont use menu button as select key
- }
- else
- {
- // if in menu view:
- // use as OK (Enter) key
- s = java.lang.String.valueOf((char) 13);
- handled = true;
- }
- }
- else
- {
- // if on map view:
- // volume UP
- //s = java.lang.String.valueOf((char) 1);
- handled = false;
- return handled;
- }
- }
- }
- else if(i!=10)
- {
- s = java.lang.String.valueOf((char) i);
- }
-
- if (s != null)
- {
- KeypressCallback(KeypressCallbackID, s);
- }
- return handled;
-
- }
-
- @Override
- public boolean onKeyMultiple (int keyCode, int count, KeyEvent event)
- {
- String s = null;
- if(keyCode == KeyEvent.KEYCODE_UNKNOWN) {
- s=event.getCharacters();
- KeypressCallback(KeypressCallbackID, s);
- return true;
- }
- return super.onKeyMultiple(keyCode, count, event);
- }
-
- @Override
- public boolean onTrackballEvent(MotionEvent event)
- {
- //Log.e("NavitGraphics", "onTrackball " + event.getAction() + " " + event.getX() + " "
- // + event.getY());
- String s = null;
- if (event.getAction() == android.view.MotionEvent.ACTION_DOWN)
- {
- s = java.lang.String.valueOf((char) 13);
- }
- if (event.getAction() == android.view.MotionEvent.ACTION_MOVE)
- {
- trackball_x += event.getX();
- trackball_y += event.getY();
- //Log.e("NavitGraphics", "trackball " + trackball_x + " " + trackball_y);
- if (trackball_x <= -1)
- {
- s = java.lang.String.valueOf((char) 2);
- trackball_x += 1;
- }
- if (trackball_x >= 1)
- {
- s = java.lang.String.valueOf((char) 6);
- trackball_x -= 1;
- }
- if (trackball_y <= -1)
- {
- s = java.lang.String.valueOf((char) 16);
- trackball_y += 1;
- }
- if (trackball_y >= 1)
- {
- s = java.lang.String.valueOf((char) 14);
- trackball_y -= 1;
- }
- }
- if (s != null)
- {
- KeypressCallback(KeypressCallbackID, s);
- }
- return true;
- }
- @Override
- protected void onFocusChanged(boolean gainFocus, int direction,
- Rect previouslyFocusedRect)
- {
- super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
- //Log.e("NavitGraphics", "FocusChange " + gainFocus);
- }
-
- public void run() {
- if (in_map && touch_mode == PRESSED)
- {
- do_longpress_action();
- touch_mode = NONE;
- }
- }
-
- }
-
- private class SystemBarTintView extends View {
-
- public SystemBarTintView(Context context) {
- super(context);
- this.setBackgroundColor(bgcolor);
- }
-
- }
-
- public NavitGraphics(final Activity activity, NavitGraphics parent, int x, int y, int w, int h,
- int wraparound, int use_camera)
- {
- if (parent == null)
- {
- this.activity = activity;
- view = new NavitView(activity);
- //activity.registerForContextMenu(view);
- view.setClickable(false);
- view.setFocusable(true);
- view.setFocusableInTouchMode(true);
- view.setKeepScreenOn(true);
- relativelayout = new RelativeLayout(activity);
- if (use_camera != 0)
- {
- SetCamera(use_camera);
- }
- relativelayout.addView(view);
-
- /* The navigational and status bar tinting code is meaningful only on API19+ */
- if(Build.VERSION.SDK_INT >= 19)
- {
- frameLayout = new FrameLayout(activity);
- frameLayout.addView(relativelayout);
- navigationTintView = new SystemBarTintView(activity);
- statusTintView = new SystemBarTintView(activity);
- frameLayout.addView(navigationTintView);
- frameLayout.addView(statusTintView);
- activity.setContentView(frameLayout);
- }
- else
- {
- activity.setContentView(relativelayout);
- }
-
- view.requestFocus();
- }
- else
- {
- draw_bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
- bitmap_w = w;
- bitmap_h = h;
- pos_x = x;
- pos_y = y;
- pos_wraparound = wraparound;
- draw_canvas = new Canvas(draw_bitmap);
- parent.overlays.add(this);
- }
- parent_graphics = parent;
- }
-
- static public enum msg_type {
- CLB_ZOOM_IN, CLB_ZOOM_OUT, CLB_REDRAW, CLB_MOVE, CLB_BUTTON_UP, CLB_BUTTON_DOWN, CLB_SET_DESTINATION
- , CLB_SET_DISPLAY_DESTINATION, CLB_CALL_CMD, CLB_COUNTRY_CHOOSER, CLB_LOAD_MAP, CLB_UNLOAD_MAP, CLB_DELETE_MAP
- };
-
- static public msg_type[] msg_values = msg_type.values();
-
- public Handler callback_handler = new Handler()
- {
- public void handleMessage(Message msg)
- {
- switch (msg_values[msg.what])
- {
- case CLB_ZOOM_IN:
- CallbackMessageChannel(1, "");
- break;
- case CLB_ZOOM_OUT:
- CallbackMessageChannel(2, "");
- break;
- case CLB_MOVE:
- MotionCallback(MotionCallbackID, msg.getData().getInt("x"), msg.getData().getInt("y"));
- break;
- case CLB_SET_DESTINATION:
- String lat = Float.toString(msg.getData().getFloat("lat"));
- String lon = Float.toString(msg.getData().getFloat("lon"));
- String q = msg.getData().getString(("q"));
- CallbackMessageChannel(3, lat + "#" + lon + "#" + q);
- break;
- case CLB_SET_DISPLAY_DESTINATION:
- int x = msg.arg1;
- int y = msg.arg2;
- CallbackMessageChannel(4, "" + x + "#" + y);
- break;
- case CLB_CALL_CMD:
- String cmd = msg.getData().getString(("cmd"));
- CallbackMessageChannel(5, cmd);
- break;
- case CLB_BUTTON_UP:
- ButtonCallback(ButtonCallbackID, 0, 1, msg.getData().getInt("x"), msg.getData().getInt("y")); // up
- break;
- case CLB_BUTTON_DOWN:
- ButtonCallback(ButtonCallbackID, 1, 1, msg.getData().getInt("x"), msg.getData().getInt("y")); // down
- break;
- case CLB_COUNTRY_CHOOSER:
- break;
- case CLB_LOAD_MAP:
- CallbackMessageChannel(6, msg.getData().getString(("title")));
- break;
- case CLB_DELETE_MAP:
- File toDelete = new File( msg.getData().getString(("title")));
- toDelete.delete();
- //fallthrough
- case CLB_UNLOAD_MAP:
- CallbackMessageChannel(7, msg.getData().getString(("title")));
- break;
- }
- }
- };
-
- public native void SizeChangedCallback(int id, int x, int y);
- public native void PaddingChangedCallback(int id, int left, int right, int top, int bottom);
- public native void KeypressCallback(int id, String s);
- public native int CallbackMessageChannel(int i, String s);
- public native void ButtonCallback(int id, int pressed, int button, int x, int y);
- public native void MotionCallback(int id, int x, int y);
- public native String GetDefaultCountry(int id, String s);
- public static native String[][] GetAllCountries();
- private Canvas draw_canvas;
- private Bitmap draw_bitmap;
- private int SizeChangedCallbackID, PaddingChangedCallbackID, ButtonCallbackID, MotionCallbackID, KeypressCallbackID;
- // private int count;
-
- /**
- * @brief Adjust views used to tint navigation and status bars.
- *
- * This method is called from handleResize.
- *
- * It (re-)evaluates if and where the navigation bar is going to be shown, and calculates the
- * padding for objects which should not be obstructed.
- *
- */
- private void adjustSystemBarsTintingViews() {
-
- /* frameLayout is only created on platforms supporting navigation and status bar tinting */
- if (frameLayout == null)
- return;
-
- if (!(activity instanceof Navit)) {
- Log.e("NavitGraphics", "Main Activity is not a Navit instance, cannot update padding");
- return;
- }
-
- Navit navit = (Navit) activity;
-
- /*
- * Determine visibility of status bar.
- * The status bar is always visible unless we are in fullscreen mode.
- */
- final Boolean isStatusShowing = !navit.isFullscreen;
-
- /*
- * Determine visibility of navigation bar.
- * This logic is based on the presence of a hardware menu button and is known to work on
- * devices which allow switching between hw and sw buttons (OnePlus One running CyanogenMod).
- */
- final Boolean isNavShowing = !ViewConfiguration.get(navit.getApplication()).hasPermanentMenuKey();
- Log.d("NavitGraphics", String.format("isStatusShowing=%b isNavShowing=%b", isStatusShowing, isNavShowing));
-
- /*
- * Determine where the navigation bar would be displayed.
- * Logic is taken from AOSP RenderSessionImpl.findNavigationBar()
- * (platform/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java)
- */
- final Boolean isLandscape = (navit.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);
- final Boolean isNavAtBottom = (!isLandscape) || (navit.getResources().getConfiguration().smallestScreenWidthDp >= 600);
- Log.d("NavitGraphics", String.format("isNavAtBottom=%b (Configuration.smallestScreenWidthDp=%d, isLandscape=%b)",
- isNavAtBottom, navit.getResources().getConfiguration().smallestScreenWidthDp, isLandscape));
-
- int left = 0;
- int top = isStatusShowing ? Navit.status_bar_height : 0;
- int right = (isNavShowing && !isNavAtBottom) ? Navit.navigation_bar_width : 0;
- final int bottom = (!(isNavShowing && isNavAtBottom)) ? 0 : isLandscape ? Navit.navigation_bar_height_landscape : Navit.navigation_bar_height;
-
- /* hide tint bars during update to prevent ugly effects */
- statusTintView.setVisibility(View.GONE);
- navigationTintView.setVisibility(View.GONE);
-
- frameLayout.post(new Runnable() {
- @Override
- public void run() {
- statusTintView.setVisibility(isStatusShowing ? View.VISIBLE : View.GONE);
- FrameLayout.LayoutParams statusLayoutParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, Navit.status_bar_height, Gravity.TOP);
-
- /* Prevent tint views from overlapping when navigation is on the right */
- statusLayoutParams.setMargins(0, 0, (isNavShowing && !isNavAtBottom) ? Navit.navigation_bar_width : 0, 0);
- statusTintView.setLayoutParams(statusLayoutParams);
- Log.d("NavitGraphics", String.format("statusTintView: width=%d height=%d",
- statusTintView.getWidth(), statusTintView.getHeight()));
- navigationTintView.setVisibility(isNavShowing ? View.VISIBLE : View.GONE);
- LayoutParams navigationLayoutParams = new FrameLayout.LayoutParams(
- isNavAtBottom ? LayoutParams.MATCH_PARENT : Navit.navigation_bar_width, // X
- isNavAtBottom ? bottom : LayoutParams.MATCH_PARENT, // Y
- Gravity.BOTTOM | Gravity.RIGHT);
- navigationTintView.setLayoutParams(navigationLayoutParams);
- Log.d("NavitGraphics", String.format("navigationTintView: width=%d height=%d",
- navigationTintView.getWidth(), navigationTintView.getHeight()));
- }
- });
-
- Log.d("NavitGraphics", String.format("Padding left=%d top=%d right=%d bottom=%d", left, top, right, bottom));
-
- PaddingChangedCallback(PaddingChangedCallbackID, left, top, right, bottom);
- }
-
- /**
- * @brief Handles resize events.
- *
- * This method is called whenever the main View is resized in any way. This is the case when its
- * {@code onSizeChanged()} event handler fires or when toggling Fullscreen mode.
- *
- */
- public void handleResize(int w, int h) {
- if (this.parent_graphics != null)
- this.parent_graphics.handleResize(w, h);
- else {
- Log.d("NavitGraphics", String.format("handleResize w=%d h=%d", w, h));
-
- adjustSystemBarsTintingViews();
-
- draw_bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
- draw_canvas = new Canvas(draw_bitmap);
- bitmap_w = w;
- bitmap_h = h;
- SizeChangedCallback(SizeChangedCallbackID, w, h);
- }
- }
-
- /**
- * @brief Returns whether the device has a hardware menu button.
- *
- * Only Android versions starting with ICS (API version 14) support the API call to detect the presence of a
- * Menu button. On earlier Android versions, the following assumptions will be made: On API levels up to 10,
- * this method will always return {@code true}, as these Android versions relied on devices having a physical
- * Menu button. On API levels 11 through 13 (Honeycomb releases), this method will always return
- * {@code false}, as Honeycomb was a tablet-only release and did not require devices to have a Menu button.
- *
- * Note that this method is not aware of non-standard mechanisms on some customized builds of Android. For
- * example, CyanogenMod has an option to add a menu button to the navigation bar. Even with that option,
- * this method will still return `false`.
- */
- public boolean hasMenuButton() {
- if (Build.VERSION.SDK_INT <= 10)
- return true;
- else if (Build.VERSION.SDK_INT <= 13)
- return false;
- else
- return ViewConfiguration.get(activity.getApplication()).hasPermanentMenuKey();
- }
-
- public void setSizeChangedCallback(int id)
- {
- SizeChangedCallbackID = id;
- }
- public void setPaddingChangedCallback(int id)
- {
- PaddingChangedCallbackID = id;
- }
- public void setButtonCallback(int id)
- {
- ButtonCallbackID = id;
- }
- public void setMotionCallback(int id)
- {
- MotionCallbackID = id;
- Navit.setMotionCallback(id, this);
- }
-
- public void setKeypressCallback(int id)
- {
- KeypressCallbackID = id;
- // set callback id also in main intent (for menus)
- Navit.setKeypressCallback(id, this);
- }
-
-
- protected void draw_polyline(Paint paint, int c[])
- {
- int i, ndashes;
- float [] intervals;
- // Log.e("NavitGraphics","draw_polyline");
- paint.setStrokeWidth(c[0]);
- paint.setARGB(c[1],c[2],c[3],c[4]);
- paint.setStyle(Paint.Style.STROKE);
- //paint.setAntiAlias(true);
- //paint.setStrokeWidth(0);
- ndashes=c[5];
- intervals=new float[ndashes+(ndashes%2)];
- for (i = 0; i < ndashes; i++)
- intervals[i]=c[6+i];
-
- if((ndashes%2)==1)
- intervals[ndashes]=intervals[ndashes-1];
-
- if(ndashes>0)
- paint.setPathEffect(new android.graphics.DashPathEffect(intervals,0.0f));
-
- Path path = new Path();
- path.moveTo(c[6+ndashes], c[7+ndashes]);
- for (i = 8+ndashes; i < c.length; i += 2)
- {
- path.lineTo(c[i], c[i + 1]);
- }
- //global_path.close();
- draw_canvas.drawPath(path, paint);
- paint.setPathEffect(null);
- }
-
- protected void draw_polygon(Paint paint, int c[])
- {
- //Log.e("NavitGraphics","draw_polygon");
- paint.setStrokeWidth(c[0]);
- paint.setARGB(c[1],c[2],c[3],c[4]);
- paint.setStyle(Paint.Style.FILL);
- //paint.setAntiAlias(true);
- //paint.setStrokeWidth(0);
- Path path = new Path();
- path.moveTo(c[5], c[6]);
- for (int i = 7; i < c.length; i += 2)
- {
- path.lineTo(c[i], c[i + 1]);
- }
- //global_path.close();
- draw_canvas.drawPath(path, paint);
- }
- protected void draw_rectangle(Paint paint, int x, int y, int w, int h)
- {
- //Log.e("NavitGraphics","draw_rectangle");
- Rect r = new Rect(x, y, x + w, y + h);
- paint.setStyle(Paint.Style.FILL);
- paint.setAntiAlias(true);
- //paint.setStrokeWidth(0);
- draw_canvas.drawRect(r, paint);
- }
- protected void draw_circle(Paint paint, int x, int y, int r)
- {
- //Log.e("NavitGraphics","draw_circle");
- // float fx = x;
- // float fy = y;
- // float fr = r / 2;
- paint.setStyle(Paint.Style.STROKE);
- draw_canvas.drawCircle(x, y, r / 2, paint);
- }
- protected void draw_text(Paint paint, int x, int y, String text, int size, int dx, int dy, int bgcolor)
- {
- int oldcolor=paint.getColor();
- Path path=null;
-
- paint.setTextSize(size / 15);
- paint.setStyle(Paint.Style.FILL);
-
- if (dx != 0x10000 || dy != 0) {
- path = new Path();
- path.moveTo(x, y);
- path.rLineTo(dx, dy);
- paint.setTextAlign(android.graphics.Paint.Align.LEFT);
- }
-
- if(bgcolor!=0) {
- paint.setStrokeWidth(3);
- paint.setColor(bgcolor);
- paint.setStyle(Paint.Style.STROKE);
- if(path==null) {
- draw_canvas.drawText(text, x, y, paint);
- } else {
- draw_canvas.drawTextOnPath(text, path, 0, 0, paint);
- }
- paint.setStyle(Paint.Style.FILL);
- paint.setColor(oldcolor);
- }
-
- if(path==null) {
- draw_canvas.drawText(text, x, y, paint);
- } else {
- draw_canvas.drawTextOnPath(text, path, 0, 0, paint);
- }
- paint.clearShadowLayer();
- }
- protected void draw_image(Paint paint, int x, int y, Bitmap bitmap)
- {
- //Log.e("NavitGraphics","draw_image");
- // float fx = x;
- // float fy = y;
- draw_canvas.drawBitmap(bitmap, x, y, null);
- }
-
- /* takes an image and draws it on the screen as a prerendered maptile
- *
- *
- *
- * @param paint Paint object used to draw the image
- * @param count the number of points specified
- * @param p0x and p0y specifying the top left point
- * @param p1x and p1y specifying the top right point
- * @param p2x and p2y specifying the bottom left point, not yet used but kept
- * for compatibility with the linux port
- * @param bitmap Bitmap object holding the image to draw
- *
- * TODO make it work with 4 points specified to make it work for 3D mapview, so it can be used
- * for small but very detailed maps as well as for large maps with very little detail but large
- * coverage.
- * TODO make it work with rectangular tiles as well ?
- */
- protected void draw_image_warp(Paint paint, int count, int p0x, int p0y, int p1x, int p1y, int p2x, int p2y, Bitmap bitmap)
- {
-
- float width;
- float scale;
- float deltaY;
- float deltaX;
- float angle;
- Matrix matrix;
-
- if (count == 3)
- {
- matrix = new Matrix();
- deltaX = p1x - p0x;
- deltaY = p1y - p0y;
- width = (float) (Math.sqrt((deltaX * deltaX) + (deltaY * deltaY)));
- angle = (float) (Math.atan2(deltaY, deltaX) * 180d / Math.PI);
- scale = width / bitmap.getWidth();
- matrix.preScale(scale, scale);
- matrix.postTranslate(p0x, p0y);
- matrix.postRotate(angle, p0x, p0y);
- draw_canvas.drawBitmap(bitmap, matrix, paint);
- }
- }
-
- /* These constants must be synchronized with enum draw_mode_num in graphics.h. */
- public static final int draw_mode_begin = 0;
- public static final int draw_mode_end = 1;
-
- protected void draw_mode(int mode)
- {
- //Log.e("NavitGraphics", "draw_mode mode=" + mode + " parent_graphics="
- // + String.valueOf(parent_graphics));
-
- if (mode == draw_mode_end) {
- if (parent_graphics == null) {
- view.invalidate();
- } else {
- parent_graphics.view.invalidate(get_rect());
- }
- }
- if (mode == draw_mode_begin && parent_graphics != null) {
- draw_bitmap.eraseColor(0);
- }
-
- }
- protected void draw_drag(int x, int y)
- {
- //Log.e("NavitGraphics","draw_drag");
- pos_x = x;
- pos_y = y;
- }
- protected void overlay_disable(int disable)
- {
- Log.e("NavitGraphics","overlay_disable: " + disable + "Parent: " + (parent_graphics != null));
- // assume we are NOT in map view mode!
- if (parent_graphics == null)
- in_map = (disable==0);
- if (overlay_disabled != disable) {
- overlay_disabled = disable;
- if (parent_graphics != null) {
- parent_graphics.view.invalidate(get_rect());
- }
- }
- }
-
- protected void overlay_resize(int x, int y, int w, int h, int wraparound)
- {
- //Log.e("NavitGraphics","overlay_resize");
- draw_bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
- bitmap_w = w;
- bitmap_h = h;
- pos_x = x;
- pos_y = y;
- pos_wraparound = wraparound;
- draw_canvas.setBitmap(draw_bitmap);
- }
-
- public static String getLocalizedString(String text)
- {
- String ret = CallbackLocalizedString(text);
- //Log.e("NavitGraphics", "callback_handler -> lozalized string=" + ret);
- return ret;
- }
-
-
-
-
- /**
- * get localized string
- */
- public static native String CallbackLocalizedString(String s);
-
-}
diff --git a/navit/android/src/org/navitproject/navit/NavitMap.java b/navit/android/src/org/navitproject/navit/NavitMap.java
deleted file mode 100644
index b7bd265a4..000000000
--- a/navit/android/src/org/navitproject/navit/NavitMap.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.navitproject.navit;
-
-import java.io.File;
-
-public class NavitMap {
- String fileName;
- String mapName;
- String mapPath;
-
- public NavitMap(String path, String map_file_name) {
- mapPath = path;
- fileName = map_file_name;
- if (map_file_name.endsWith(".bin")) {
- mapName = map_file_name.substring(0, map_file_name.length() - 4);
- } else {
- mapName = map_file_name;
- }
- }
-
- public NavitMap(String map_location) {
- File mapFile = new File(map_location);
-
- mapPath = mapFile.getParent() + "/";
- fileName = mapFile.getName();
- if (fileName.endsWith(".bin")) {
- mapName = fileName.substring(0, fileName.length() - 4);
- } else {
- mapName = fileName;
- }
- }
-
- public long size() {
- File map_file = new File(mapPath + fileName);
- return map_file.length();
- }
-
- public String getLocation() {
- return mapPath + fileName;
- }
-}
diff --git a/navit/android/src/org/navitproject/navit/NavitMapDownloader.java b/navit/android/src/org/navitproject/navit/NavitMapDownloader.java
deleted file mode 100644
index 736af33c8..000000000
--- a/navit/android/src/org/navitproject/navit/NavitMapDownloader.java
+++ /dev/null
@@ -1,711 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package org.navitproject.navit;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Message;
-import android.os.StatFs;
-import android.util.Log;
-
-/**
- * @author rikky
- *
- */
-public class NavitMapDownloader extends Thread
-{
- public static class osm_map_values
- {
- String lon1;
- String lat1;
- String lon2;
- String lat2;
- String map_name = "";
- long est_size_bytes = 0;
- int level = 0;
-
-
- public osm_map_values(String mapname, String lon_1, String lat_1, String lon_2, String lat_2,
- long bytes_est, int level)
- {
- this.map_name = mapname;
- this.lon1 = lon_1;
- this.lat1 = lat_1;
- this.lon2 = lon_2;
- this.lat2 = lat_2;
- this.est_size_bytes = bytes_est;
- this.level = level;
- }
-
- public boolean isInMap(Location location) {
- double longitude_1 = Double.valueOf(this.lon1);
- double latitude_1 = Double.valueOf(this.lat1);
- double longitude_2 = Double.valueOf(this.lon2);
- double latitude_2 = Double.valueOf(this.lat2);
-
- if (location.getLongitude() < longitude_1)
- return false;
- if (location.getLongitude() > longitude_2)
- return false;
- if (location.getLatitude() < latitude_1)
- return false;
- if (location.getLatitude() > latitude_2)
- return false;
-
- return true;
- }
- }
-
- //
- // define the maps here
- // size estimations updated 2017-06-22
- //
- public static final osm_map_values[] osm_maps = {
- new osm_map_values(Navit._("Whole Planet"), "-180", "-90", "180", "90", 23992258630L, 0),
- new osm_map_values(Navit._("Africa"), "-30.89", "-36.17", "61.68", "38.40", 2070076339L, 0),
- new osm_map_values(Navit._("Angola"), "11.4", "-18.1", "24.2", "-5.3", 127557789L, 1),
- new osm_map_values(Navit._("Burundi"), "28.9", "-4.5", "30.9", "-2.2", 124049667L, 1),
- new osm_map_values(Navit._("Canary Islands"), "-18.69", "26.52", "-12.79", "29.99", 133565815L, 1),
- new osm_map_values(Navit._("Congo, Democratic Republic of the"), "11.7", "-13.6", "31.5", "5.7", 244228485L, 1),
- new osm_map_values(Navit._("Ethiopia"), "32.89", "3.33", "48.07", "14.97", 153067406L, 1),
- new osm_map_values(Navit._("Guinea"), "-15.47", "7.12", "-7.58", "12.74", 188047126L, 1),
- new osm_map_values(Navit._("Cote d'Ivoire"), "-8.72", "4.09", "-2.43", "10.80", 132187496L, 1),
- new osm_map_values(Navit._("Kenya"), "33.8", "-5.2", "42.4", "4.9", 190073089L, 1),
- new osm_map_values(Navit._("Lesotho"), "26.9", "-30.7", "29.6", "-28.4", 196189429L, 1),
- new osm_map_values(Navit._("Liberia"), "-15.00", "-0.73", "-7.20", "8.65", 156257253L, 1),
- new osm_map_values(Navit._("Libya"), "9.32", "19.40", "25.54", "33.63", 126046917L, 1),
- new osm_map_values(Navit._("Madagascar"), "42.25", "-26.63", "51.20", "-11.31", 145210721L, 1),
- new osm_map_values(Navit._("Namibia")+"+"+Navit._("Botswana"), "11.4", "-29.1", "29.5", "-16.9", 248970987L, 1),
- new osm_map_values(Navit._("Reunion"), "55.2", "-21.4", "55.9", "-20.9", 126008774L, 1),
- new osm_map_values(Navit._("Rwanda"), "28.8", "-2.9", "30.9", "-1.0", 128267595L, 1),
- new osm_map_values(Navit._("South Africa")+"+"+Navit._("Lesotho"), "15.93", "-36.36", "33.65", "-22.08", 307280006L, 1),
- new osm_map_values(Navit._("Tanzania, United Republic of"), "29.19", "-11.87", "40.74", "-0.88", 253621029L, 1),
- new osm_map_values(Navit._("Uganda"), "29.3", "-1.6", "35.1", "4.3", 179134521L, 1),
- new osm_map_values(Navit._("Asia"), "23.8", "0.1", "195.0", "82.4", 5113673780L, 0),
- new osm_map_values(Navit._("Azerbaijan"), "44.74", "38.34", "51.69", "42.37", 138346406L, 1),
- new osm_map_values(Navit._("China"), "67.3", "5.3", "135.0", "54.5", 1718108758L, 1),
- new osm_map_values(Navit._("Cyprus"), "32.0", "34.5", "34.9", "35.8", 118472448L, 1),
- new osm_map_values(Navit._("India")+"+"+Navit._("Nepal"), "67.9", "5.5", "89.6", "36.0", 601877877L, 1),
- new osm_map_values(Navit._("Indonesia"), "93.7", "-17.3", "155.5", "7.6", 420741405L, 1),
- new osm_map_values(Navit._("Iran, Islamic Republic of"), "43.5", "24.4", "63.6", "40.4", 242016066L, 1),
- new osm_map_values(Navit._("Iraq"), "38.7", "28.5", "49.2", "37.4", 160751805L, 1),
- new osm_map_values(Navit._("Israel"), "33.99", "29.8", "35.95", "33.4", 155685778L, 1),
- new osm_map_values(Navit._("Japan")+"+"+Navit._("Korea"), "123.6", "25.2", "151.3", "47.1", 1029080156L, 1),
- new osm_map_values(Navit._("Kazakhstan"), "46.44", "40.89", "87.36", "55.45", 407633007L, 1),
- new osm_map_values(Navit._("Kyrgyzstan"), "69.23", "39.13", "80.33", "43.29", 147997835L, 1),
- new osm_map_values(Navit._("Malaysia")+"+"+Navit._("Singapore"), "94.3", "-5.9", "108.6", "6.8", 168816435L, 1),
- new osm_map_values(Navit._("Mongolia"), "87.5", "41.4", "120.3", "52.7", 153534851L, 1),
- new osm_map_values(Navit._("Pakistan"), "60.83", "23.28", "77.89", "37.15", 217644321L, 1),
- new osm_map_values(Navit._("Philippines"), "115.58", "4.47", "127.85", "21.60", 281428307L, 1),
- new osm_map_values(Navit._("Saudi Arabia"), "33.2", "16.1", "55.9", "33.5", 242648303L, 1),
- new osm_map_values(Navit._("Taiwan"), "119.1", "21.5", "122.5", "25.2", 1029080156L, 1),
- new osm_map_values(Navit._("Thailand"), "97.5", "5.7", "105.2", "19.7", 185135492L, 1),
- new osm_map_values(Navit._("Turkey"), "25.1", "35.8", "46.4", "42.8", 331087441L, 1),
- new osm_map_values(Navit._("Turkmenistan"), "51.78", "35.07", "66.76", "42.91", 131045087L, 1),
- new osm_map_values(Navit._("UAE+Other"), "51.5", "22.6", "56.7", "26.5", 128934674L, 1),
- new osm_map_values(Navit._("Australia")+"+"+Navit._("Oceania"), "89.84", "-57.39", "179.79", "7.26", 782722650L, 0),
- new osm_map_values(Navit._("Australia"), "110.5", "-44.2", "154.9", "-9.2", 348652900L, 0),
- new osm_map_values(Navit._("Tasmania"), "144.0", "-45.1", "155.3", "-24.8", 253231890L, 1),
- new osm_map_values(Navit._("Victoria")+"+"+Navit._("New South Wales"), "140.7", "-39.4", "153.7", "-26.9", 241500829L, 1),
- new osm_map_values(Navit._("New Caledonia"), "157.85", "-25.05", "174.15", "-16.85", 115512336L, 1),
- new osm_map_values(Navit._("New Zealand"), "165.2", "-47.6", "179.1", "-33.7", 239264192L, 1),
- new osm_map_values(Navit._("Europe"), "-12.97", "33.59", "34.15", "72.10", 11984126789L, 0),
- new osm_map_values(Navit._("Western Europe"), "-17.6", "34.5", "42.9", "70.9", 12648810717L, 1),
- new osm_map_values(Navit._("Austria"), "9.4", "46.32", "17.21", "49.1", 898273634L, 1),
- new osm_map_values(Navit._("Azores"), "-31.62", "36.63", "-24.67", "40.13", 112687225L, 1),
- new osm_map_values(Navit._("BeNeLux"), "2.08", "48.87", "7.78", "54.52", 1771971595L, 1),
- new osm_map_values(Navit._("Netherlands"), "3.07", "50.75", "7.23", "53.73", 1191828033L, 1),
- new osm_map_values(Navit._("Denmark"), "7.65", "54.32", "15.58", "58.07", 365606979L, 1),
- new osm_map_values(Navit._("Faroe Islands"), "-7.8", "61.3", "-6.1", "62.5", 109377568L, 1),
- new osm_map_values(Navit._("France"), "-5.45", "42.00", "8.44", "51.68", 3907969744L, 1),
- new osm_map_values(Navit._("Alsace"), "6.79", "47.27", "8.48", "49.17", 354249349L, 2),
- new osm_map_values(Navit._("Aquitaine"), "-2.27", "42.44", "1.50", "45.76", 443715019L, 2),
- new osm_map_values(Navit._("Auvergne"), "2.01", "44.57", "4.54", "46.85", 287663213L, 2),
- new osm_map_values(Navit._("Basse-Normandie"), "-2.09", "48.13", "1.03", "49.98", 262352354L, 2),
- new osm_map_values(Navit._("Bourgogne"), "2.80", "46.11", "5.58", "48.45", 298868796L, 2),
- new osm_map_values(Navit._("Bretagne"), "-5.58", "46.95", "-0.96", "48.99", 382770794L, 2),
- new osm_map_values(Navit._("Centre"), "0.01", "46.29", "3.18", "48.99", 474224721L, 2),
- new osm_map_values(Navit._("Champagne-Ardenne"), "3.34", "47.53", "5.94", "50.28", 269947824L, 2),
- new osm_map_values(Navit._("Corse"), "8.12", "41.32", "9.95", "43.28", 129902146L, 2),
- new osm_map_values(Navit._("Franche-Comte"), "5.20", "46.21", "7.83", "48.07", 324476070L, 2),
- new osm_map_values(Navit._("Haute-Normandie"), "-0.15", "48.62", "1.85", "50.18", 202782876L, 2),
- new osm_map_values(Navit._("Ile-de-France"), "1.40", "48.07", "3.61", "49.29", 311052699L, 2),
- new osm_map_values(Navit._("Languedoc-Roussillon"), "1.53", "42.25", "4.89", "45.02", 380145667L, 2),
- new osm_map_values(Navit._("Limousin"), "0.58", "44.87", "2.66", "46.50", 206696539L, 2),
- new osm_map_values(Navit._("Lorraine"), "4.84", "47.77", "7.72", "49.73", 330777318L, 2),
- new osm_map_values(Navit._("Midi-Pyrenees"), "-0.37", "42.18", "3.50", "45.10", 462618363L, 2),
- new osm_map_values(Navit._("Nord-pas-de-Calais"), "1.42", "49.92", "4.49", "51.31", 368467511L, 2),
- new osm_map_values(Navit._("Pays-de-la-Loire"), "-2.88", "46.20", "0.97", "48.62", 499471143L, 2),
- new osm_map_values(Navit._("Picardie"), "1.25", "48.79", "4.31", "50.43", 374308041L, 2),
- new osm_map_values(Navit._("Poitou-Charentes"), "-1.69", "45.04", "1.26", "47.23", 342125526L, 2),
- new osm_map_values(Navit._("Provence-Alpes-Cote-d-Azur"), "4.21", "42.91", "7.99", "45.18", 390306134L, 2),
- new osm_map_values(Navit._("Rhone-Alpes"), "3.65", "44.07", "7.88", "46.64", 510797942L, 2),
- new osm_map_values(Navit._("Germany"), "5.18", "46.84", "15.47", "55.64", 3521359466L, 1),
- new osm_map_values(Navit._("Baden-Wuerttemberg"), "7.32", "47.14", "10.57", "49.85", 674361124L, 2),
- new osm_map_values(Navit._("Bayern"), "8.92", "47.22", "13.90", "50.62", 860161150L, 2),
- new osm_map_values(Navit._("Mittelfranken"), "9.86", "48.78", "11.65", "49.84", 203055195L, 2),
- new osm_map_values(Navit._("Niederbayern"), "11.55", "47.75", "14.12", "49.42", 312924770L, 2),
- new osm_map_values(Navit._("Oberbayern"), "10.67", "47.05", "13.57", "49.14", 382734883L, 2),
- new osm_map_values(Navit._("Oberfranken"), "10.31", "49.54", "12.49", "50.95", 235258691L, 2),
- new osm_map_values(Navit._("Oberpfalz"), "11.14", "48.71", "13.47", "50.43", 264536012L, 2),
- new osm_map_values(Navit._("Schwaben"), "9.27", "47.10", "11.36", "49.09", 321141607L, 2),
- new osm_map_values(Navit._("Unterfranken"), "8.59", "49.16", "10.93", "50.67", 303720890L, 2),
- new osm_map_values(Navit._("Berlin"), "13.03", "52.28", "13.81", "52.73", 169019946L, 2),
- new osm_map_values(Navit._("Brandenburg"), "11.17", "51.30", "14.83", "53.63", 323497599L, 2),
- new osm_map_values(Navit._("Bremen"), "8.43", "52.96", "9.04", "53.66", 150963608L, 2),
- new osm_map_values(Navit._("Hamburg"), "9.56", "53.34", "10.39", "53.80", 156284421L, 2),
- new osm_map_values(Navit._("Hessen"), "7.72", "49.34", "10.29", "51.71", 432279328L, 2),
- new osm_map_values(Navit._("Mecklenburg-Vorpommern"), "10.54", "53.05", "14.48", "55.05", 213183908L, 2),
- new osm_map_values(Navit._("Niedersachsen"), "6.40", "51.24", "11.69", "54.22", 819766939L, 2),
- new osm_map_values(Navit._("Nordrhein-westfalen"), "5.46", "50.26", "9.52", "52.59", 967053517L, 2),
- new osm_map_values(Navit._("Rheinland-Pfalz"), "6.06", "48.91", "8.56", "51.00", 442868899L, 2),
- new osm_map_values(Navit._("Saarland"), "6.30", "49.06", "7.46", "49.69", 157721162L, 2),
- new osm_map_values(Navit._("Sachsen-Anhalt"), "10.50", "50.88", "13.26", "53.11", 287785088L, 2),
- new osm_map_values(Navit._("Sachsen"), "11.82", "50.11", "15.10", "51.73", 342620834L, 2),
- new osm_map_values(Navit._("Schleswig-Holstein"), "7.41", "53.30", "11.98", "55.20", 280293910L, 2),
- new osm_map_values(Navit._("Thueringen"), "9.81", "50.15", "12.72", "51.70", 269428239L, 2),
- new osm_map_values(Navit._("Germany")+"+"+Navit._("Austria")+"+"+Navit._("Switzerland"), "3.4", "44.5", "18.6", "55.1", 5746126429L, 1),
- new osm_map_values(Navit._("Iceland"), "-25.3", "62.8", "-11.4", "67.5", 124837162L, 1),
- new osm_map_values(Navit._("Ireland"), "-11.17", "51.25", "-5.23", "55.9", 234750271L, 1),
- new osm_map_values(Navit._("Italy"), "6.52", "36.38", "18.96", "47.19", 1610171395L, 1),
- new osm_map_values(Navit._("Spain")+"+"+Navit._("Portugal"), "-11.04", "34.87", "4.62", "44.41", 1039624918L, 1),
- new osm_map_values(Navit._("Mallorca"), "2.2", "38.8", "4.7", "40.2", 137200636L, 2),
- new osm_map_values(Navit._("Galicia"), "-10.0", "41.7", "-6.3", "44.1", 174549553L, 2),
- new osm_map_values(Navit._("Scandinavia"), "4.0", "54.4", "32.1", "71.5", 1398661090L, 1),
- new osm_map_values(Navit._("Finland"), "18.6", "59.2", "32.3", "70.3", 460997178L, 1),
- new osm_map_values(Navit._("Denmark"), "7.49", "54.33", "13.05", "57.88", 321870414L, 1),
- new osm_map_values(Navit._("Switzerland"), "5.79", "45.74", "10.59", "47.84", 552565332L, 1),
- new osm_map_values(Navit._("United Kingdom"), "-9.7", "49.6", "2.2", "61.2", 901724648L, 1),
- new osm_map_values(Navit._("England"), "-7.80", "48.93", "2.41", "56.14", 937728414L, 1),
- new osm_map_values(Navit._("Buckinghamshire"), "-1.19", "51.44", "-0.43", "52.25", 142256978L, 2),
- new osm_map_values(Navit._("Cambridgeshire"), "-0.55", "51.96", "0.56", "52.79", 142334001L, 2),
- new osm_map_values(Navit._("Cumbria"), "-3.96", "53.85", "-2.11", "55.24", 144422460L, 2),
- new osm_map_values(Navit._("East yorkshire with hull"), "-1.16", "53.50", "0.54", "54.26", 141518744L, 2),
- new osm_map_values(Navit._("Essex"), "-0.07", "51.40", "1.36", "52.14", 162542730L, 2),
- new osm_map_values(Navit._("Herefordshire"), "-3.19", "51.78", "-2.29", "52.45", 129368660L, 2),
- new osm_map_values(Navit._("Kent"), "-0.02", "50.81", "1.65", "51.53", 145482562L, 2),
- new osm_map_values(Navit._("Lancashire"), "-3.20", "53.43", "-2.00", "54.29", 148964975L, 2),
- new osm_map_values(Navit._("Leicestershire"), "-1.65", "52.34", "-0.61", "53.03", 154199956L, 2),
- new osm_map_values(Navit._("Norfolk"), "0.10", "52.30", "2.04", "53.41", 146017009L, 2),
- new osm_map_values(Navit._("Nottinghamshire"), "-1.39", "52.73", "-0.62", "53.55", 147986548L, 2),
- new osm_map_values(Navit._("Oxfordshire"), "-1.77", "51.41", "-0.82", "52.22", 142240992L, 2),
- new osm_map_values(Navit._("Shropshire"), "-3.29", "52.26", "-2.18", "53.05", 136909363L, 2),
- new osm_map_values(Navit._("Somerset"), "-3.89", "50.77", "-2.20", "51.40", 145186096L, 2),
- new osm_map_values(Navit._("South yorkshire"), "-1.88", "53.25", "-0.80", "53.71", 145902650L, 2),
- new osm_map_values(Navit._("Suffolk"), "0.29", "51.88", "1.81", "52.60", 143799697L, 2),
- new osm_map_values(Navit._("Surrey"), "-0.90", "51.02", "0.10", "51.52", 157987139L, 2),
- new osm_map_values(Navit._("Wiltshire"), "-2.41", "50.90", "-1.44", "51.76", 138652346L, 2),
- new osm_map_values(Navit._("Scotland"), "-8.13", "54.49", "-0.15", "61.40", 258853845L, 2),
- new osm_map_values(Navit._("Wales"), "-5.56", "51.28", "-2.60", "53.60", 193593409L, 2),
- new osm_map_values(Navit._("Albania"), "19.09", "39.55", "21.12", "42.72", 146199817L, 1),
- new osm_map_values(Navit._("Belarus"), "23.12", "51.21", "32.87", "56.23", 324470696L, 1),
- new osm_map_values(Navit._("Russian Federation"), "27.9", "41.5", "190.4", "77.6", 2148314279L, 1),
- new osm_map_values(Navit._("Bulgaria"), "24.7", "42.1", "24.8", "42.1", 109869373L, 1),
- new osm_map_values(Navit._("Bosnia and Herzegovina"), "15.69", "42.52", "19.67", "45.32", 187122485L, 1),
- new osm_map_values(Navit._("Czech Republic"), "11.91", "48.48", "19.02", "51.17", 904838442L, 1),
- new osm_map_values(Navit._("Croatia"), "13.4", "42.1", "19.4", "46.9", 460854751L, 1),
- new osm_map_values(Navit._("Estonia"), "21.5", "57.5", "28.2", "59.6", 173378927L, 1),
- new osm_map_values(Navit._("Greece"), "28.9", "37.8", "29.0", "37.8", 109435051L, 1),
- new osm_map_values(Navit._("Crete"), "23.3", "34.5", "26.8", "36.0", 115985063L, 1),
- new osm_map_values(Navit._("Hungary"), "16.08", "45.57", "23.03", "48.39", 350318541L, 1),
- new osm_map_values(Navit._("Latvia"), "20.7", "55.6", "28.3", "58.1", 188188140L, 1),
- new osm_map_values(Navit._("Lithuania"), "20.9", "53.8", "26.9", "56.5", 217852597L, 1),
- new osm_map_values(Navit._("Poland"), "13.6", "48.8", "24.5", "55.0", 1464968657L, 1),
- new osm_map_values(Navit._("Romania"), "20.3", "43.5", "29.9", "48.4", 347931565L, 1),
- new osm_map_values(Navit._("Ukraine"), "22.0", "44.3", "40.4", "52.4", 793611912L, 1),
- new osm_map_values(Navit._("North America"), "-178.1", "6.5", "-10.4", "84.0", 5601866516L, 0),
- new osm_map_values(Navit._("Alaska"), "-179.5", "49.5", "-129", "71.6", 207746039L, 1),
- new osm_map_values(Navit._("Canada"), "-141.3", "41.5", "-52.2", "70.2", 2635719651L, 1),
- new osm_map_values(Navit._("Hawaii"), "-161.07", "18.49", "-154.45", "22.85", 115016656L, 1),
- new osm_map_values(Navit._("USA")+Navit._(" (except Alaska and Hawaii)"), "-125.4", "24.3", "-66.5", "49.3", 4060487198L, 1),
- new osm_map_values(Navit._("Midwest"), "-104.11", "35.92", "-80.46", "49.46", 1145596450L, 2),
- new osm_map_values(Navit._("Michigan"), "-90.47", "41.64", "-79.00", "49.37", 538247019L, 2),
- new osm_map_values(Navit._("Ohio"), "-84.87", "38.05", "-79.85", "43.53", 277022336L, 2),
- new osm_map_values(Navit._("Northeast"), "-80.58", "38.72", "-66.83", "47.53", 1017160709L, 2),
- new osm_map_values(Navit._("Massachusetts"), "-73.56", "40.78", "-68.67", "42.94", 340055487L, 2),
- new osm_map_values(Navit._("Vermont"), "-73.49", "42.68", "-71.41", "45.07", 139626067L, 2),
- new osm_map_values(Navit._("Pacific"), "-180.05", "15.87", "-129.75", "73.04", 207090640L, 2),
- new osm_map_values(Navit._("South"), "-106.70", "23.98", "-71.46", "40.70", 1747935356L, 2),
- new osm_map_values(Navit._("Arkansas"), "-94.67", "32.95", "-89.59", "36.60", 155658661L, 2),
- new osm_map_values(Navit._("District of Columbia"), "-77.17", "38.74", "-76.86", "39.05", 129235755L, 2),
- new osm_map_values(Navit._("Florida"), "-88.75", "23.63", "-77.67", "31.05", 224022108L, 2),
- new osm_map_values(Navit._("Louisiana"), "-94.09", "28.09", "-88.62", "33.07", 210120605L, 2),
- new osm_map_values(Navit._("Maryland"), "-79.54", "37.83", "-74.99", "40.22", 276462622L, 2),
- new osm_map_values(Navit._("Mississippi"), "-91.71", "29.99", "-88.04", "35.05", 177858031L, 2),
- new osm_map_values(Navit._("Oklahoma"), "-103.41", "33.56", "-94.38", "37.38", 200061473L, 2),
- new osm_map_values(Navit._("Texas"), "-106.96", "25.62", "-92.97", "36.58", 430089141L, 2),
- new osm_map_values(Navit._("Virginia"), "-83.73", "36.49", "-74.25", "39.52", 384187569L, 2),
- new osm_map_values(Navit._("West Virginia"), "-82.70", "37.15", "-77.66", "40.97", 220552071L, 2),
- new osm_map_values(Navit._("West"), "-133.11", "31.28", "-101.99", "49.51", 1152909162L, 2),
- new osm_map_values(Navit._("Arizona"), "-114.88", "30.01", "-108.99", "37.06", 182826833L, 2),
- new osm_map_values(Navit._("California"), "-125.94", "32.43", "-114.08", "42.07", 586923326L, 2),
- new osm_map_values(Navit._("Colorado"), "-109.11", "36.52", "-100.41", "41.05", 228623724L, 2),
- new osm_map_values(Navit._("Idaho"), "-117.30", "41.93", "-110.99", "49.18", 170684507L, 2),
- new osm_map_values(Navit._("Montana"), "-116.10", "44.31", "-102.64", "49.74", 176229800L, 2),
- new osm_map_values(Navit._("New Mexico"), "-109.10", "26.98", "-96.07", "37.05", 361793070L, 2),
- new osm_map_values(Navit._("Nevada"), "-120.2", "35.0", "-113.8", "42.1", 200614482L, 2),
- new osm_map_values(Navit._("Oregon"), "-124.8", "41.8", "-116.3", "46.3", 211462685L, 2),
- new osm_map_values(Navit._("Utah"), "-114.11", "36.95", "-108.99", "42.05", 151590197L, 2),
- new osm_map_values(Navit._("Washington State"), "-125.0", "45.5", "-116.9", "49.0", 222553768L, 2),
- new osm_map_values(Navit._("South+Middle America"), "-83.5", "-56.3", "-30.8", "13.7", 958895383L, 0),
- new osm_map_values(Navit._("Argentina"), "-73.9", "-57.3", "-51.6", "-21.0", 376857648L, 1),
- new osm_map_values(Navit._("Argentina")+"+"+Navit._("Chile"), "-77.2", "-56.3", "-52.7", "-16.1", 420275812L, 1),
- new osm_map_values(Navit._("Bolivia"), "-70.5", "-23.1", "-57.3", "-9.3", 175937824L, 1),
- new osm_map_values(Navit._("Brazil"), "-71.4", "-34.7", "-32.8", "5.4", 664872975L, 1),
- new osm_map_values(Navit._("Chile"), "-81.77", "-58.50", "-65.46", "-17.41", 241657330L, 1),
- new osm_map_values(Navit._("Cuba"), "-85.3", "19.6", "-74.0", "23.6", 129043575L, 1),
- new osm_map_values(Navit._("Colombia"), "-79.1", "-4.0", "-66.7", "12.6", 212016580L, 1),
- new osm_map_values(Navit._("Ecuador"), "-82.6", "-5.4", "-74.4", "2.3", 158857591L, 1),
- new osm_map_values(Navit._("Guyana")+"+"+Navit._("Suriname")+"+"+Navit._("Guyane Francaise"), "-62.0", "1.0", "-51.2", "8.9", 123000072L, 1),
- new osm_map_values(Navit._("Haiti")+"+"+Navit._("Dominican Republic"), "-74.8", "17.3", "-68.2", "20.1", 149925689L, 1),
- new osm_map_values(Navit._("Jamaica"), "-78.6", "17.4", "-75.9", "18.9", 113961998L, 1),
- new osm_map_values(Navit._("Mexico"), "-117.6", "14.1", "-86.4", "32.8", 551307973L, 1),
- new osm_map_values(Navit._("Paraguay"), "-63.8", "-28.1", "-53.6", "-18.8", 159498397L, 1),
- new osm_map_values(Navit._("Peru"), "-82.4", "-18.1", "-67.5", "0.4", 212490557L, 1),
- new osm_map_values(Navit._("Uruguay"), "-59.2", "-36.5", "-51.7", "-29.7", 157482719L, 1),
- new osm_map_values(Navit._("Venezuela"), "-73.6", "0.4", "-59.7", "12.8", 167295729L, 1)
- };
-
- private String map_filename_path;
-
- public static NavitMap[] getAvailableMaps() {
- class filterMaps implements FilenameFilter {
- public boolean accept(File dir, String filename) {
- if (filename.endsWith(".bin"))
- return true;
- return false;
- }
- }
- NavitMap maps[] = new NavitMap[0];
- File map_dir = new File(Navit.map_filename_path);
- String map_file_names[] = map_dir.list(new filterMaps());
- if (map_file_names != null) {
- maps = new NavitMap[map_file_names.length];
- for (int map_file_index = 0; map_file_index < map_file_names.length; map_file_index++) {
- maps[map_file_index] = new NavitMap(Navit.map_filename_path, map_file_names[map_file_index]);
- }
- }
- return maps;
- }
- private Boolean stop_me = false;
- private osm_map_values map_values;
- private int map_id;
- private long uiLastUpdated = -1;
-
- private Boolean retryDownload = false; //Download failed, but
- //we should try to resume
- private static final int SOCKET_CONNECT_TIMEOUT = 60000; // 60 secs.
- private static final int SOCKET_READ_TIMEOUT = 120000; // 120 secs.
- private static final int MAP_WRITE_FILE_BUFFER = 1024 * 64;
- private static final int MAP_WRITE_MEM_BUFFER = 1024 * 64;
- private static final int MAP_READ_FILE_BUFFER = 1024 * 64;
- private static final int UPDATE_PROGRESS_TIME_NS = 1000 * 1000000; // 1ns=1E-9s
- private static final int MAX_RETRIES = 5;
- private static final String TAG = "NavitMapDownloader";
-
- protected int retry_counter = 0;
-
- public NavitMapDownloader(int map_id) {
- this.map_values = osm_maps[map_id];
- this.map_id=map_id;
- this.map_filename_path=Navit.map_filename_path;
- }
-
- public void run() {
- stop_me = false;
- retry_counter = 0;
-
- Log.v(TAG, "start download " + map_values.map_name);
- updateProgress(0, map_values.est_size_bytes, Navit._("downloading") + ": " + map_values.map_name);
-
- boolean success;
- do {
- try {
- Thread.sleep(10 + retry_counter * 1000);
- } catch (InterruptedException e1) {}
- retryDownload = false;
- success = download_osm_map();
- } while ( !success
- && retryDownload
- && retry_counter < MAX_RETRIES
- && !stop_me);
-
- if (success) {
- toast(map_values.map_name + " " + Navit._("ready"));
- getMapInfoFile().delete();
- Log.d(TAG, "success");
- }
-
- if (success || stop_me ) {
- NavitDialogs.sendDialogMessage( NavitDialogs.MSG_MAP_DOWNLOAD_FINISHED
- , map_filename_path + map_values.map_name + ".bin", null, -1, success ? 1 : 0 , map_id );
- }
- }
-
- public void stop_thread() {
- stop_me = true;
- Log.d(TAG, "stop_me -> true");
- }
-
- protected boolean checkFreeSpace(long needed_bytes) {
- long free_space = getFreeSpace();
-
- if ( needed_bytes <= 0 )
- needed_bytes = MAP_WRITE_FILE_BUFFER;
-
- if (free_space < needed_bytes ) {
- String msg;
- Log.e(TAG, "Not enough free space or media not available. Please free at least " + needed_bytes / 1024 /1024 + "Mb.");
- if(free_space<0)
- msg=Navit._("Media selected for map storage is not available");
- else
- msg=Navit._("Not enough free space");
- updateProgress(free_space, needed_bytes, Navit._("Error downloading map!") + "\n" + msg);
- return false;
- }
- return true;
- }
-
- protected boolean deleteMap() {
- File finalOutputFile = getMapFile();
-
- if (finalOutputFile.exists()) {
- Message msg =
- Message.obtain(Navit.N_NavitGraphics.callback_handler,
- NavitGraphics.msg_type.CLB_DELETE_MAP.ordinal());
- Bundle b = new Bundle();
- b.putString("title", finalOutputFile.getAbsolutePath());
- msg.setData(b);
- msg.sendToTarget();
- return true;
- }
- return false;
- }
-
- /**
- * @param map_values
- * @return
- */
- protected boolean download_osm_map() {
- long already_read = 0;
- long real_size_bytes = 0;
- boolean resume = true;
-
- File outputFile = getDestinationFile();
- long old_download_size = outputFile.length();
-
- URL url = null;
- if (old_download_size > 0) {
- url = readFileInfo();
- }
-
- if (url == null) {
- resume = false;
- url = getDownloadURL();
- }
-
- // URL url = new URL("http://192.168.2.101:8080/zweibruecken.bin");
- URLConnection c = initConnection(url);
- if (c != null) {
-
- if (resume) {
- c.setRequestProperty("Range", "bytes=" + old_download_size + "-");
- already_read = old_download_size;
- }
- try {
- real_size_bytes=Long.parseLong(c.getHeaderField("Content-Length")) + already_read;
- } catch(Exception e) {
- real_size_bytes=-1;
- }
-
- long fileTime = c.getLastModified();
-
- if (!resume) {
- outputFile.delete();
- writeFileInfo(c, real_size_bytes);
- }
-
- if (real_size_bytes <= 0)
- real_size_bytes = map_values.est_size_bytes;
-
- Log.d(TAG, "size: " + real_size_bytes + ", read: " + already_read + ", timestamp: " + fileTime
- + ", Connection ref: " + c.getURL());
-
- if (checkFreeSpace(real_size_bytes - already_read)
- && downloadData(c, already_read, real_size_bytes, resume, outputFile)) {
-
- File finalOutputFile = getMapFile();
- // delete an already existing file first
- finalOutputFile.delete();
- // rename file to its final name
- outputFile.renameTo(finalOutputFile);
- return true;
- }
- }
- return false;
- }
-
- protected File getDestinationFile() {
- File outputFile = new File(map_filename_path, map_values.map_name + ".tmp");
- outputFile.getParentFile().mkdir();
- return outputFile;
- }
-
- protected boolean downloadData(URLConnection c, long already_read, long real_size_bytes
- , boolean resume,File outputFile) {
- boolean success = false;
- BufferedOutputStream buf = getOutputStream(outputFile, resume);
- BufferedInputStream bif = getInputStream(c);
-
- if (buf != null && bif != null) {
- success = readData(buf, bif, already_read, real_size_bytes);
- // always cleanup, as we might get errors when trying to resume
- try {
- buf.flush();
- buf.close();
-
- bif.close();
- } catch (IOException e) {
- }
- }
- return success;
- }
-
- protected URL getDownloadURL() {
- URL url = null;
- try {
- url =
- new URL("http://maps.navit-project.org/api/map/?bbox=" + map_values.lon1 + "," + map_values.lat1
- + "," + map_values.lon2 + "," + map_values.lat2);
- } catch (MalformedURLException e) {
- Log.e(TAG, "We failed to create a URL to " + map_values.map_name);
- e.printStackTrace();
- return null;
- }
- Log.v(TAG, "connect to " + url.toString());
- return url;
- }
-
- protected long getFreeSpace() {
- try {
- StatFs fsInfo = new StatFs(map_filename_path);
- return (long)fsInfo.getAvailableBlocks() * fsInfo.getBlockSize();
- } catch(Exception e) {
- return -1;
- }
- }
-
- protected BufferedInputStream getInputStream(URLConnection c) {
- BufferedInputStream bif = null;
- try {
- bif = new BufferedInputStream(c.getInputStream(), MAP_READ_FILE_BUFFER);
- } catch (FileNotFoundException e) {
- Log.e(TAG, "File not found on server: " + e);
- if (retry_counter > 0) {
- getMapInfoFile().delete();
- }
- enableRetry();
- bif = null;
- } catch (IOException e) {
- Log.e(TAG, "Error reading from server: " + e);
- enableRetry();
- bif = null;
- }
- return bif;
- }
-
- protected File getMapFile() {
- return new File(map_filename_path, map_values.map_name + ".bin");
- }
-
- protected File getMapInfoFile() {
- return new File(map_filename_path, map_values.map_name + ".tmp.info");
- }
-
- protected BufferedOutputStream getOutputStream(File outputFile, boolean resume) {
- BufferedOutputStream buf = null;
- try {
- buf = new BufferedOutputStream(new FileOutputStream(outputFile, resume), MAP_WRITE_FILE_BUFFER);
- } catch (FileNotFoundException e) {
- Log.e(TAG, "Could not open output file for writing: " + e);
- buf = null;
- }
- return buf;
- }
-
- protected URLConnection initConnection(URL url) {
- HttpURLConnection c = null;
- try {
- c = (HttpURLConnection) url.openConnection();
- c.setRequestMethod("GET");
- } catch (Exception e) {
- Log.e(TAG, "Failed connecting server: " + e);
- enableRetry();
- return null;
- }
-
- c.setReadTimeout(SOCKET_READ_TIMEOUT);
- c.setConnectTimeout(SOCKET_CONNECT_TIMEOUT);
- return c;
- }
-
- protected boolean readData(OutputStream buf, InputStream bif, long already_read, long real_size_bytes) {
- long start_timestamp = System.nanoTime();
- byte[] buffer = new byte[MAP_WRITE_MEM_BUFFER];
- int len1 = 0;
- long mapFileSize = real_size_bytes;
- long startOffset = already_read;
- boolean success = false;
-
- try {
- while (!stop_me && (len1 = bif.read(buffer)) != -1) {
- already_read += len1;
- updateProgress(start_timestamp, startOffset, already_read, mapFileSize);
-
- try {
- buf.write(buffer, 0, len1);
- } catch (IOException e) {
- Log.d(TAG, "Error: " + e);
- if ( !checkFreeSpace(real_size_bytes - already_read + MAP_WRITE_FILE_BUFFER)) {
- if (deleteMap()) {
- enableRetry();
- } else {
- updateProgress(already_read, real_size_bytes, Navit._("Error downloading map!") + "\n"
- + Navit._("Not enough free space"));
- }
- } else {
- updateProgress(already_read, real_size_bytes, Navit._("Error writing map!"));
- }
-
- return false;
- }
- }
-
- if (stop_me) {
- toast(Navit._("Map download aborted!"));
- } else if ( already_read < real_size_bytes ) {
- Log.d(TAG, "Server send only " + already_read + " bytes of " + real_size_bytes);
- enableRetry();
- } else {
- success = true;
- }
- } catch (IOException e) {
- Log.d(TAG, "Error: " + e);
-
- enableRetry();
- updateProgress(already_read, real_size_bytes, Navit._("Error downloading map!"));
- }
-
- return success;
- }
-
- protected URL readFileInfo() {
- URL url = null;
- try {
- ObjectInputStream infoStream = new ObjectInputStream(new FileInputStream(getMapInfoFile()));
- String resume_proto = infoStream.readUTF();
- infoStream.readUTF(); // read the host name (unused for now)
- String resume_file = infoStream.readUTF();
- infoStream.close();
- // looks like the same file, try to resume
- Log.v(TAG, "Try to resume download");
- url = new URL(resume_proto + "://" + "maps.navit-project.org" + resume_file);
- } catch (Exception e) {
- getMapInfoFile().delete();
- }
- return url;
- }
-
- protected void toast(String message) {
- NavitDialogs.sendDialogMessage(NavitDialogs.MSG_TOAST, null, message, -1, 0, 0);
- }
-
- protected void updateProgress(long startTime, long offsetBytes, long readBytes, long maxBytes) {
- long currentTime = System.nanoTime();
-
- if ((currentTime > uiLastUpdated + UPDATE_PROGRESS_TIME_NS) && startTime!=currentTime) {
- float per_second_overall = (readBytes - offsetBytes) / ((currentTime - startTime) / 1000000000f);
- long bytes_remaining = maxBytes - readBytes;
- int eta_seconds = (int) (bytes_remaining / per_second_overall);
-
- String eta_string;
- if (eta_seconds > 60) {
- eta_string = (int) (eta_seconds / 60f) + " m";
- } else {
- eta_string = eta_seconds + " s";
- }
- String info =
- String.format("%s: %s\n %dMb / %dMb\n %.1f kb/s %s: %s", Navit._("downloading")
- , map_values.map_name, readBytes / 1024 / 1024, maxBytes / 1024 / 1024,
- per_second_overall / 1024f, Navit._("ETA"), eta_string);
-
- if (retry_counter > 0) {
- info += "\n Retry " + retry_counter + "/" + MAX_RETRIES;
- }
- Log.e(TAG, "info: " + info);
-
- updateProgress(readBytes, maxBytes, info);
- uiLastUpdated = currentTime;
- }
- }
-
- protected void updateProgress(long positionBytes, long maximumBytes, String infoText) {
- NavitDialogs.sendDialogMessage(NavitDialogs.MSG_PROGRESS_BAR, Navit._("Map download"), infoText
- , NavitDialogs.DIALOG_MAPDOWNLOAD, (int) (maximumBytes / 1024),
- (int) (positionBytes / 1024));
- }
-
- protected void writeFileInfo(URLConnection c, long sizeInBytes) {
- ObjectOutputStream infoStream;
- try {
- infoStream = new ObjectOutputStream(new FileOutputStream(getMapInfoFile()));
- infoStream.writeUTF(c.getURL().getProtocol());
- infoStream.writeUTF(c.getURL().getHost());
- infoStream.writeUTF(c.getURL().getFile());
- infoStream.writeLong(sizeInBytes);
- infoStream.close();
- } catch (Exception e) {
- Log.e(TAG, "Could not write info file for map download. Resuming will not be possible. (" + e.getMessage() + ")");
- }
- }
-
- void enableRetry() {
- retryDownload = true;
- retry_counter++;
- }
- // dialog send helper methods
-}
diff --git a/navit/android/src/org/navitproject/navit/NavitRestoreTask.java b/navit/android/src/org/navitproject/navit/NavitRestoreTask.java
deleted file mode 100644
index aaffcb002..000000000
--- a/navit/android/src/org/navitproject/navit/NavitRestoreTask.java
+++ /dev/null
@@ -1,144 +0,0 @@
-
-package org.navitproject.navit;
-
-import android.app.Activity;
-import android.app.NotificationManager;
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.content.SharedPreferences.Editor;
-import android.os.AsyncTask;
-import android.os.Environment;
-import android.widget.Toast;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.util.Map;
-import java.util.Map.Entry;
-
-public class NavitRestoreTask extends AsyncTask<Void, Void, String> {
-
- private Navit mActivity;
-
- private ProgressDialog mDialog;
-
- private String mTimestamp;
-
- public NavitRestoreTask(Navit context, String timestamp) {
- mActivity = context;
- mTimestamp = timestamp;
- }
-
- @Override
- protected void onPreExecute() {
- super.onPreExecute();
-
- /* Create a Wait Progress Dialog to inform the User that we are working */
- mDialog = new ProgressDialog(mActivity);
- mDialog.setIndeterminate(true);
- mDialog.setMessage(mActivity.getString(R.string.restoring));
- mDialog.show();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected String doInBackground(Void... v) {
-
- /* This is the Directory where all Subdirectories are stored by date */
- File backupDir = new File(Environment.getExternalStorageDirectory().getPath() + "/navit/backup/" + mTimestamp);
-
- /* Check if there is a Backup Directory */
- if (!backupDir.isDirectory())
- return mActivity.getString(R.string.backup_not_found);
-
- ObjectInputStream preferenceOIS = null;
- try {
- /* Delete all old Files in Home */
- mActivity.removeFileIfExists(Navit.NAVIT_DATA_DIR + "/home/bookmark.txt");
- mActivity.removeFileIfExists(Navit.NAVIT_DATA_DIR + "/home/destination.txt");
- mActivity.removeFileIfExists(Navit.NAVIT_DATA_DIR + "/home/gui_internal.txt");
-
-
- /* Restore Files in home */
- mActivity.copyFileIfExists(backupDir.getPath() + "/bookmark.txt", Navit.NAVIT_DATA_DIR + "/home/bookmark.txt");
- mActivity.copyFileIfExists(backupDir.getPath() + "/destination.txt", Navit.NAVIT_DATA_DIR + "/home/destination.txt");
- mActivity.copyFileIfExists(backupDir.getPath() + "/gui_internal.txt", Navit.NAVIT_DATA_DIR + "/home/gui_internal.txt");
-
- /* Restore Shared Preferences */
- preferenceOIS = new ObjectInputStream(new FileInputStream(backupDir.getPath() + "/preferences.bak"));
- Map<String, ?> entries = (Map<String, ?>) preferenceOIS.readObject();
-
- Editor prefEditor = mActivity.getSharedPreferences(Navit.NAVIT_PREFS, Context.MODE_PRIVATE).edit();
-
- /* Remove all old Preferences */
- prefEditor.clear();
-
- /* Iterate through all Entries and add them to our Preferences */
- for (Entry<String, ?> entry : entries.entrySet()) {
- Object value = entry.getValue();
- String key = entry.getKey();
-
- if (value instanceof Boolean)
- prefEditor.putBoolean(key, ((Boolean) value).booleanValue());
- else if (value instanceof Float)
- prefEditor.putFloat(key, ((Float) value).floatValue());
- else if (value instanceof Integer)
- prefEditor.putInt(key, ((Integer) value).intValue());
- else if (value instanceof Long)
- prefEditor.putLong(key, ((Long) value).longValue());
- else if (value instanceof String)
- prefEditor.putString(key, (String) value);
- }
-
- if (!prefEditor.commit())
- return mActivity.getString(R.string.failed_to_restore);
-
- }
- catch (Exception e) {
- e.printStackTrace();
- return mActivity.getString(R.string.failed_to_restore);
- }
- finally {
- try {
- /* Close Stream to prevent Resource leak */
- if (preferenceOIS != null)
- preferenceOIS.close();
- }
- catch (IOException e) {
-
- }
- }
-
- return null;
- }
-
- @Override
- protected void onPostExecute(String result) {
- super.onPostExecute(result);
-
- /* Dismiss the Wait Progress Dialog */
- mDialog.dismiss();
-
- /* If result is non null an Error occured */
- if (result != null) {
- Toast.makeText(mActivity, result, Toast.LENGTH_LONG).show();
- return;
- }
-
- /* Navit needs to be restarted. Currently the User has to restart it by himself */
- Toast.makeText(mActivity, mActivity.getString(R.string.restore_successful_please_restart_navit), Toast.LENGTH_LONG).show();
- NotificationManager nm = (NotificationManager) mActivity.getSystemService(Context.NOTIFICATION_SERVICE);
- nm.cancel(R.string.app_name);
- NavitVehicle.removeListener();
- mActivity.finish();
- }
-
- @Override
- protected void onCancelled() {
- super.onCancelled();
- Toast.makeText(mActivity, mActivity.getString(R.string.restore_failed), Toast.LENGTH_LONG).show();
- mDialog.dismiss();
- }
-}
diff --git a/navit/android/src/org/navitproject/navit/NavitSensors.java b/navit/android/src/org/navitproject/navit/NavitSensors.java
deleted file mode 100644
index b263ed082..000000000
--- a/navit/android/src/org/navitproject/navit/NavitSensors.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.navitproject.navit;
-
-import android.content.Context;
-import android.hardware.Sensor;
-import android.hardware.SensorEvent;
-import android.hardware.SensorEventListener;
-import android.hardware.SensorManager;
-
-
-
-public class NavitSensors implements SensorEventListener {
- private SensorManager mSensorManager;
- private int callbackid;
- public native void SensorCallback(int id, int sensor, float x, float y, float z);
-
-
- NavitSensors(Context context, int cbid)
- {
- mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
- mSensorManager.registerListener((SensorEventListener)this, mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), SensorManager.SENSOR_DELAY_NORMAL);
- mSensorManager.registerListener((SensorEventListener)this, mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD), SensorManager.SENSOR_DELAY_NORMAL);
- callbackid=cbid;
- }
-
- public void
- onAccuracyChanged(Sensor sensor, int accuracy)
- {
- }
-
- public void
- onSensorChanged(SensorEvent sev)
- {
- // Log.e("NavitSensor","Type:" + sev.sensor.getType() + " X:" + sev.values[0] + " Y:"+sev.values[1]+" Z:"+sev.values[2]);
- SensorCallback(callbackid, sev.sensor.getType(), sev.values[0], sev.values[1], sev.values[2]);
- }
-}
-
diff --git a/navit/android/src/org/navitproject/navit/NavitSpeech.java b/navit/android/src/org/navitproject/navit/NavitSpeech.java
deleted file mode 100644
index ac6b5de4c..000000000
--- a/navit/android/src/org/navitproject/navit/NavitSpeech.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package org.navitproject.navit;
-
-import android.util.Log;
-
-import com.google.tts.TTS;
-
-
-public class NavitSpeech implements Runnable {
- private TTS tts;
- private TTS.InitListener ttsInitListener;
- private String what;
- private Thread thread;
-
- NavitSpeech(Navit navit)
- {
- ttsInitListener = new TTS.InitListener() {
- public void onInit(int version) {
- }
- };
- tts=new TTS(navit, ttsInitListener, true);
- }
- public void run()
- {
- Log.e("NavitSpeech","In "+what);
- tts.speak(what, 0, null);
- }
- public void say(String what)
- {
- this.what=what;
- thread = new Thread(this, "speech thread");
- thread.start();
- }
-}
-
diff --git a/navit/android/src/org/navitproject/navit/NavitSpeech2.java b/navit/android/src/org/navitproject/navit/NavitSpeech2.java
deleted file mode 100644
index b4ec85d4e..000000000
--- a/navit/android/src/org/navitproject/navit/NavitSpeech2.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package org.navitproject.navit;
-
-import android.content.Intent;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.pm.PackageManager;
-import android.app.AlertDialog;
-import android.speech.tts.TextToSpeech;
-import android.util.Log;
-
-
-public class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityResult {
- private TextToSpeech mTts;
- private Navit navit;
- int MY_DATA_CHECK_CODE=1;
-
-
- public void onInit(int status)
- {
- Log.e("NavitSpeech2","Status "+status);
- }
-
- public void onActivityResult(int requestCode, int resultCode, Intent data)
- {
- Log.e("NavitSpeech2","onActivityResult "+requestCode+" "+resultCode);
- if (requestCode == MY_DATA_CHECK_CODE) {
- if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
- // success, create the TTS instance
- mTts = new TextToSpeech(navit, this);
- } else {
- // missing data, ask to install it
- AlertDialog.Builder builder = new AlertDialog.Builder(navit);
- builder
- .setTitle(R.string.TTS_title_data_missing)
- .setMessage(R.string.TTS_qery_install_data)
- .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent installIntent = new Intent();
- installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
- navit.startActivity(installIntent);
- }
- })
- .setNegativeButton(R.string.no, null)
- .show();
- }
- }
- }
-
- NavitSpeech2(Navit navit)
- {
- this.navit=navit;
- navit.setActivityResult(1, this);
- Log.e("NavitSpeech2","Create");
- Intent checkIntent = new Intent();
- checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
- if (navit.getPackageManager().resolveActivity(checkIntent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
- Log.e("NavitSpeech2","ACTION_CHECK_TTS_DATA available");
- navit.startActivityForResult(checkIntent, MY_DATA_CHECK_CODE);
- } else {
- Log.e("NavitSpeech2","ACTION_CHECK_TTS_DATA not available, assume tts is working");
- mTts = new TextToSpeech(navit, this);
- }
- }
- public void say(String what)
- {
- if (mTts != null) {
- mTts.speak(what, TextToSpeech.QUEUE_FLUSH, null);
- }
- }
-}
-
diff --git a/navit/android/src/org/navitproject/navit/NavitTextTranslations.java b/navit/android/src/org/navitproject/navit/NavitTextTranslations.java
deleted file mode 100644
index 93aa5fe76..000000000
--- a/navit/android/src/org/navitproject/navit/NavitTextTranslations.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package org.navitproject.navit;
-
-import java.util.HashMap;
-
-import android.util.Log;
-
-public class NavitTextTranslations
-{
- static String main_language = "en";
- static String sub_language = "EN";
- static String fallback_language = "en";
- static String fallback_sub_language = "EN";
- private static HashMap<String, HashMap<String, String>> Navit_text_lookup = new HashMap<String, HashMap<String, String>>();
-
- public static void init()
- {
- Log.e("NavitTextTranslations", "initializing translated text ...");
- String k = null;
- String[] v = null;
-/*
- k = "exit navit";
- v = new String[]{"en", "Exit Navit", "de", "Navit beenden", "nl", "Navit afsluiten", "fr","Quittez Navit"};
- p(k, v);
-
- k = "zoom in";
- v = new String[]{"en", "Zoom in", "fr", "Zoom-avant"};
- p(k, v);
-
- k = "zoom out";
- v = new String[]{"en", "Zoom out", "fr", "Zoom-arrière", "nl", "Zoom uit"};
- p(k, v);
-
- k = "address search";
- v = new String[]{"en", "Address search", "de", "Adresse suchen", "nl", "Zoek adres", "fr","Cherchez adresse"};
- p(k, v);
-
- k = "Mapdownload";
- v = new String[]{"en", "Mapdownload", "de", "Kartendownload"};
- p(k, v);
-
- k = "downloading";
- v = new String[]{"en", "downloading"};
- p(k, v);
-
- k = "Downloaded maps";
- v = new String[]{"en", "Downloaded maps", "de", "Heruntergeladene Karten", "nl", "Gedownloade kaarten", "fr","Cartes téléchargées" };
- p(k, v);
-
- k = "ETA";
- v = new String[]{"en", "ETA", "de", "fertig in"};
- p(k, v);
-
- k = "Error downloading map";
- v = new String[]{"en", "Error downloading map!", "de", "Fehler beim Kartendownload"};
- p(k, v);
-
- k = "ready";
- v = new String[]{"en", "ready", "de", "fertig"};
- p(k, v);
-
- k = "Ok";
- v = new String[]{"en", "OK"};
- p(k, v);
-
- k = "No address found";
- v = new String[]{"en", "No address found", "de", "Keine Adresse gefunden"};
- p(k, v);
-
- k = "Enter: City and Street";
- v = new String[]{"en", "Enter: City, Street", "de", "Stadt und Straße:"};
- p(k, v);
-
- k = "No search string entered";
- v = new String[]{"en", "No text entered", "de", "Keine Eingabe"};
- p(k, v);
-
- k = "setting destination to";
- v = new String[]{"en", "Setting destination to:", "de", "neues Fahrziel"};
- p(k, v);
-
- k = "getting search results";
- v = new String[]{"en", "getting search results", "de", "lade Suchergebnisse"};
- p(k, v);
-
- k = "searching ...";
- v = new String[]{"en", "searching ...", "de", "Suche läuft ..."};
- p(k, v);
-
- k = "No Results found!";
- v = new String[]{"en", "No Results found!", "de", "Suche liefert kein Ergebnis!"};
- p(k, v);
-
- k = "Map data (c) OpenStreetMap contributors, CC-BY-SA";
- v = new String[]{"en", "Map data (c) OpenStreetMap contributors, CC-BY-SA"};
- p(k, v);
-
- k = "partial match";
- v = new String[]{"en", "partial match", "de", "ungefähr"};
- p(k, v);
-
- k = "Search";
- v = new String[]{"en", "Search", "de", "suchen"};
- p(k, v);
-
- k = "drive here";
- v = new String[]{"en", "Route to here", "de", "Ziel setzen"};
- p(k, v);
-
- k = "loading search results";
- v = new String[]{"en", "Loading search results", "de", "lade Suchergebnisse"};
- p(k, v);
-
- k = "towns";
- v = new String[]{"en", "Towns", "de", "Städte"};
- p(k, v);
-*/
- Log.e("NavitTextTranslations", "... ready");
- }
-
- private static void p(String key, String[] values)
- {
- HashMap<String, String> t = new HashMap<String, String>();
- //Log.e("NavitTextTranslations", "trying: " + key);
- try
- {
- for (int i = 0; i < (int) (values.length / 2); i++)
- {
- t.put(values[i * 2], values[(i * 2) + 1]);
- }
- Navit_text_lookup.put(key, t);
- }
- catch (Exception e)
- {
- Log.e("NavitTextTranslations", "!!Error in translationkey: " + key);
- }
- }
-
- public static String get_text(String in)
- {
- String out = null;
- //Log.e("NavitTextTranslations", "lookup L:" + main_language + " T:" + in);
- try
- {
- out = Navit_text_lookup.get(in).get(main_language);
- }
- catch (Exception e)
- {
- // most likely there is not translation yet
- //Log.e("NavitTextTranslations", "lookup: exception");
- out = null;
- }
-
- if (out == null)
- {
- // always return a string for output (use fallback language)
- //Log.e("NavitTextTranslations", "using default language");
- try
- {
- out = Navit_text_lookup.get(in).get(fallback_language);
- }
- catch (Exception e)
- {
- //Log.e("NavitTextTranslations", "using default language: exception");
- // most likely there is not translation yet
- out = null;
- }
- }
-
- if (out == null)
- {
- // if we still dont have any text, use the ".mo" file and call the c-function gettext(in)
- out = NavitGraphics.getLocalizedString(in);
- if (out != null)
- {
- HashMap<String, String> langmap = new HashMap<String, String>();
- langmap.put(main_language, out);
- Navit_text_lookup.put(in, langmap);
- }
-
- //Log.e("NavitTextTranslations", "return the value from gettext() = " + out);
- }
- return out;
- }
-
-}
diff --git a/navit/android/src/org/navitproject/navit/NavitTimeout.java b/navit/android/src/org/navitproject/navit/NavitTimeout.java
deleted file mode 100644
index b70d8a1ad..000000000
--- a/navit/android/src/org/navitproject/navit/NavitTimeout.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package org.navitproject.navit;
-
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-
-
-
-public class NavitTimeout implements Runnable {
- private static Handler handler =new Handler() {
- public void handleMessage(Message m) {
- Log.e("Navit","Handler received message");
- }
- };
- private boolean event_multi;
- private int event_callbackid;
- private int event_timeout;
- public native void TimeoutCallback(int id);
-
- NavitTimeout(int timeout, boolean multi, int callbackid)
- {
- event_timeout=timeout;
- event_multi=multi;
- event_callbackid=callbackid;
- handler.postDelayed(this, event_timeout);
- }
- public void run() {
- // Log.e("Navit","Handle Event");
- if (event_multi) {
- handler.postDelayed(this, event_timeout);
- }
- TimeoutCallback(event_callbackid);
- }
- public void remove()
- {
- handler.removeCallbacks(this);
- }
-}
-
diff --git a/navit/android/src/org/navitproject/navit/NavitVehicle.java b/navit/android/src/org/navitproject/navit/NavitVehicle.java
deleted file mode 100644
index 313502b96..000000000
--- a/navit/android/src/org/navitproject/navit/NavitVehicle.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package org.navitproject.navit;
-
-import java.util.List;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.location.Criteria;
-import android.location.GpsSatellite;
-import android.location.GpsStatus;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.os.Bundle;
-import android.util.Log;
-
-public class NavitVehicle {
-
- public static final String GPS_FIX_CHANGE = "android.location.GPS_FIX_CHANGE";
-
- public static Location lastLocation = null;
-
- private static LocationManager sLocationManager = null;
- private static Context context = null;
- private int vehicle_pcbid;
- private int vehicle_scbid;
- private int vehicle_fcbid;
- private String preciseProvider;
- private String fastProvider;
-
- private static NavitLocationListener preciseLocationListener = null;
- private static NavitLocationListener fastLocationListener = null;
-
- public native void VehicleCallback(int id, Location location);
- public native void VehicleCallback(int id, int satsInView, int satsUsed);
- public native void VehicleCallback(int id, int enabled);
-
- private class NavitLocationListener extends BroadcastReceiver implements GpsStatus.Listener, LocationListener {
- public boolean precise = false;
- public void onLocationChanged(Location location) {
- lastLocation = location;
- // Disable the fast provider if still active
- if (precise && fastProvider != null) {
- sLocationManager.removeUpdates(fastLocationListener);
- fastProvider = null;
- }
-
- VehicleCallback(vehicle_pcbid, location);
- VehicleCallback(vehicle_fcbid, 1);
- }
- public void onProviderDisabled(String provider){}
- public void onProviderEnabled(String provider) {}
- public void onStatusChanged(String provider, int status, Bundle extras) {}
-
- /**
- * Called when the status of the GPS changes.
- */
- public void onGpsStatusChanged (int event) {
- GpsStatus status = sLocationManager.getGpsStatus(null);
- int satsInView = 0;
- int satsUsed = 0;
- Iterable<GpsSatellite> sats = status.getSatellites();
- for (GpsSatellite sat : sats) {
- satsInView++;
- if (sat.usedInFix()) {
- satsUsed++;
- }
- }
- VehicleCallback(vehicle_scbid, satsInView, satsUsed);
- }
-
- @Override
- public void onReceive(Context context, Intent intent) {
- if (intent.getAction().equals(GPS_FIX_CHANGE)) {
- if (intent.getBooleanExtra("enabled", false))
- VehicleCallback(vehicle_fcbid, 1);
- else if (!intent.getBooleanExtra("enabled", true))
- VehicleCallback(vehicle_fcbid, 0);
- }
- }
- }
-
- /**
- * @brief Creates a new {@code NavitVehicle}
- *
- * @param context
- * @param pcbid The address of the position callback function which will be called when a location update is received
- * @param scbid The address of the status callback function which will be called when a status update is received
- * @param fcbid The address of the fix callback function which will be called when a
- * {@code android.location.GPS_FIX_CHANGE} is received, indicating a change in GPS fix status
- */
- NavitVehicle (Context context, int pcbid, int scbid, int fcbid) {
- this.context = context;
- sLocationManager = (LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
- preciseLocationListener = new NavitLocationListener();
- preciseLocationListener.precise = true;
- fastLocationListener = new NavitLocationListener();
-
- /* Use 2 LocationProviders, one precise (usually GPS), and one
- not so precise, but possible faster. The fast provider is
- disabled when the precise provider gets its first fix. */
-
- // Selection criteria for the precise provider
- Criteria highCriteria = new Criteria();
- highCriteria.setAccuracy(Criteria.ACCURACY_FINE);
- highCriteria.setAltitudeRequired(true);
- highCriteria.setBearingRequired(true);
- highCriteria.setCostAllowed(true);
- highCriteria.setPowerRequirement(Criteria.POWER_HIGH);
-
- // Selection criteria for the fast provider
- Criteria lowCriteria = new Criteria();
- lowCriteria.setAccuracy(Criteria.ACCURACY_COARSE);
- lowCriteria.setAltitudeRequired(false);
- lowCriteria.setBearingRequired(false);
- lowCriteria.setCostAllowed(true);
- lowCriteria.setPowerRequirement(Criteria.POWER_HIGH);
-
- Log.e("NavitVehicle", "Providers " + sLocationManager.getAllProviders());
-
- preciseProvider = sLocationManager.getBestProvider(highCriteria, false);
- Log.e("NavitVehicle", "Precise Provider " + preciseProvider);
- fastProvider = sLocationManager.getBestProvider(lowCriteria, false);
- Log.e("NavitVehicle", "Fast Provider " + fastProvider);
- vehicle_pcbid = pcbid;
- vehicle_scbid = scbid;
- vehicle_fcbid = fcbid;
-
- context.registerReceiver(preciseLocationListener, new IntentFilter(GPS_FIX_CHANGE));
- sLocationManager.requestLocationUpdates(preciseProvider, 0, 0, preciseLocationListener);
- sLocationManager.addGpsStatusListener(preciseLocationListener);
-
- /*
- * Since Android criteria have no way to specify "fast fix", lowCriteria may return the same
- * provider as highCriteria, even if others are available. In this case, do not register two
- * listeners for the same provider but pick the fast provider manually. (Usually there will
- * only be two providers in total, which makes the choice easy.)
- */
- if (fastProvider == null || preciseProvider.compareTo(fastProvider) == 0) {
- List<String> fastProviderList = sLocationManager.getProviders(lowCriteria, false);
- fastProvider = null;
- for (String fastCandidate: fastProviderList) {
- if (preciseProvider.compareTo(fastCandidate) != 0) {
- fastProvider = fastCandidate;
- break;
- }
- }
- }
- if (fastProvider != null) {
- sLocationManager.requestLocationUpdates(fastProvider, 0, 0, fastLocationListener);
- }
- }
-
- public static void removeListener() {
- if (sLocationManager != null) {
- if (preciseLocationListener != null) {
- sLocationManager.removeUpdates(preciseLocationListener);
- sLocationManager.removeGpsStatusListener(preciseLocationListener);
- context.unregisterReceiver(preciseLocationListener);
- }
- if (fastLocationListener != null) sLocationManager.removeUpdates(fastLocationListener);
- }
-
- }
-}
diff --git a/navit/android/src/org/navitproject/navit/NavitWatch.java b/navit/android/src/org/navitproject/navit/NavitWatch.java
deleted file mode 100644
index ebe5c8727..000000000
--- a/navit/android/src/org/navitproject/navit/NavitWatch.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-package org.navitproject.navit;
-
-import java.lang.Thread;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-
-public class NavitWatch implements Runnable {
- private Thread thread;
- private static Handler handler =new Handler() {
- public void handleMessage(Message m) {
- Log.e("NavitWatch","Handler received message");
- }
- };
- private boolean removed;
- private int watch_func;
- private int watch_fd;
- private int watch_cond;
- private int watch_callbackid;
- private boolean callback_pending;
- private Runnable callback_runnable;
- public native void poll(int func, int fd, int cond);
- public native void WatchCallback(int id);
-
- NavitWatch(int func, int fd, int cond, int callbackid)
- {
- // Log.e("NavitWatch","Creating new thread for "+fd+" "+cond+" from current thread " + java.lang.Thread.currentThread().getName());
- watch_func=func;
- watch_fd=fd;
- watch_cond=cond;
- watch_callbackid=callbackid;
- final NavitWatch navitwatch=this;
- callback_runnable = new Runnable() {
- public void run()
- {
- navitwatch.callback();
- }
- };
- thread = new Thread(this, "poll thread");
- thread.start();
- }
- public void run()
- {
- for (;;) {
- // Log.e("NavitWatch","Polling "+watch_fd+" "+watch_cond + " from " + java.lang.Thread.currentThread().getName());
- poll(watch_func, watch_fd, watch_cond);
- // Log.e("NavitWatch","poll returned");
- if (removed)
- break;
- callback_pending=true;
- handler.post(callback_runnable);
- try {
- // Log.e("NavitWatch","wait");
- synchronized(this) {
- if (callback_pending)
- this.wait();
- }
- // Log.e("NavitWatch","wait returned");
- } catch (Exception e) {
- Log.e("NavitWatch","Exception "+e.getMessage());
- }
- if (removed)
- break;
- }
- }
- public void callback()
- {
- // Log.e("NavitWatch","Calling Callback");
- if (!removed)
- WatchCallback(watch_callbackid);
- synchronized(this) {
- callback_pending=false;
- // Log.e("NavitWatch","Waking up");
- this.notify();
- }
- }
- public void remove()
- {
- removed=true;
- thread.interrupt();
- }
-}
-