diff --git a/android/3rdparty/expansion_downloader/AndroidManifest.xml b/android/3rdparty/expansion_downloader/AndroidManifest.xml index 5301670..2c14698 100644 --- a/android/3rdparty/expansion_downloader/AndroidManifest.xml +++ b/android/3rdparty/expansion_downloader/AndroidManifest.xml @@ -4,10 +4,7 @@ android:versionCode="2" android:versionName="1.1" > - - + \ No newline at end of file diff --git a/android/3rdparty/expansion_downloader/build.gradle b/android/3rdparty/expansion_downloader/build.gradle index 07d5e51..3f7764a 100644 --- a/android/3rdparty/expansion_downloader/build.gradle +++ b/android/3rdparty/expansion_downloader/build.gradle @@ -1,35 +1,23 @@ apply plugin: 'android-library' dependencies { - compile fileTree(dir: 'libs', include: '*.jar') compile project(':3rdparty:play_licensing') } android { - compileSdkVersion 19 - buildToolsVersion "19" - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = ['src'] - resources.srcDirs = ['src'] - aidl.srcDirs = ['src'] - renderscript.srcDirs = ['src'] - res.srcDirs = ['res'] - assets.srcDirs = ['assets'] - } + // Define these properties in the gradle.properties file in the root project folder + compileSdkVersion propTargetSdkVersion.toInteger() + buildToolsVersion propBuildToolsVersion - // Move the tests to tests/java, tests/res, etc... - instrumentTest.setRoot('tests') + defaultConfig { + minSdkVersion propMinSdkVersion.toInteger() + targetSdkVersion propTargetSdkVersion.toInteger() + } - // Move the build types to build-types/ - // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... - // This moves them out of them default location under src//... which would - // conflict with src/ being used by the main source set. - // Adding new build types or product flavors should be accompanied - // by a similar customization. - debug.setRoot('build-types/debug') - release.setRoot('build-types/release') - } + sourceSets.main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + res.srcDirs = ['res'] + } } diff --git a/android/3rdparty/expansion_downloader/project.properties b/android/3rdparty/expansion_downloader/project.properties deleted file mode 100644 index 299201a..0000000 --- a/android/3rdparty/expansion_downloader/project.properties +++ /dev/null @@ -1,13 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=android-19 -android.library=true -android.library.reference.1=../play_licensing diff --git a/android/3rdparty/play_licensing/AndroidManifest.xml b/android/3rdparty/play_licensing/AndroidManifest.xml index 27183dd..8baf635 100644 --- a/android/3rdparty/play_licensing/AndroidManifest.xml +++ b/android/3rdparty/play_licensing/AndroidManifest.xml @@ -1,6 +1,5 @@ - - + - - - - - \ No newline at end of file + + diff --git a/android/3rdparty/play_licensing/build.gradle b/android/3rdparty/play_licensing/build.gradle index 12dac15..290ba79 100644 --- a/android/3rdparty/play_licensing/build.gradle +++ b/android/3rdparty/play_licensing/build.gradle @@ -1,34 +1,20 @@ apply plugin: 'android-library' -dependencies { - compile fileTree(dir: 'libs', include: '*.jar') -} - android { - compileSdkVersion 19 - buildToolsVersion "19" - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = ['src'] - resources.srcDirs = ['src'] - aidl.srcDirs = ['src'] - renderscript.srcDirs = ['src'] - res.srcDirs = ['res'] - assets.srcDirs = ['assets'] - } + // Define these properties in the gradle.properties file in the root project folder + compileSdkVersion propTargetSdkVersion.toInteger() + buildToolsVersion propBuildToolsVersion - // Move the tests to tests/java, tests/res, etc... - instrumentTest.setRoot('tests') + defaultConfig { + minSdkVersion propMinSdkVersion.toInteger() + targetSdkVersion propTargetSdkVersion.toInteger() + } - // Move the build types to build-types/ - // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... - // This moves them out of them default location under src//... which would - // conflict with src/ being used by the main source set. - // Adding new build types or product flavors should be accompanied - // by a similar customization. - debug.setRoot('build-types/debug') - release.setRoot('build-types/release') - } + sourceSets.main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + aidl.srcDirs = ['src'] + res.srcDirs = ['res'] + } } diff --git a/android/3rdparty/play_licensing/project.properties b/android/3rdparty/play_licensing/project.properties deleted file mode 100644 index c57400d..0000000 --- a/android/3rdparty/play_licensing/project.properties +++ /dev/null @@ -1,12 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "ant.properties", and override values to adapt the script to your -# project structure. - -android.library=true -# Project target. -target=android-19 diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index f85679e..89411c7 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,13 +1,8 @@ + android:installLocation="preferExternal"> - diff --git a/android/README.txt b/android/README.txt new file mode 100644 index 0000000..9a456f0 --- /dev/null +++ b/android/README.txt @@ -0,0 +1,10 @@ +To compile guides apk you need to create local.properties file with two values: +sdk.dir=/Full/path/to/android/sdk +ndk.dir=/Full/path/to/android/ndk + +and you need to clone mapswithme android api repo (don't forget to update it if already cloned): +cd 3rdparty; git clone git@github.com:mapswithme/api-android.git + +Use +./gradlew installDebug (or iD) to build and install debug version or +./gradlew assembleRelease (or aR) to create release apk (installRelease to test it on a device) \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 931dbda..c3ea106 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,49 +1,21 @@ buildscript { repositories { mavenCentral() } - - dependencies { classpath 'com.android.tools.build:gradle:0.5.7' } -} - -// need it for :clean -apply plugin:'base' - -task ndkBuild(type:Exec) { - def clParts = (['ndk-build', '-j', Runtime.runtime.availableProcessors() + 1] + GWMndkFlags.split(' ')).flatten() - println(clParts.join(" ")) - commandLine clParts -} - -task ndkBuildClean(type:Exec) { - commandLine 'ndk-build','clean' -} - -task copyNativeLibs(type: Copy, dependsOn: 'ndkBuild') { - from(new File('libs')) { include '**/*.so' } - into new File(buildDir, 'native-libs') -} - -tasks.withType(Compile) { compileTask -> compileTask.dependsOn ndkBuild } -tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs } - -clean.dependsOn 'cleanCopyNativeLibs' -clean.dependsOn 'ndkBuildClean' - -tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask -> - pkgTask.jniDir new File(buildDir, 'native-libs') + dependencies { classpath 'com.android.tools.build:gradle:0.9.2' } } apply plugin: 'android' dependencies { - compile fileTree(dir: 'libs', include: '*.jar') - compile project(':android-mwm') + compile propAndroidSupportLibrary + compile project(':3rdparty:play_licensing') + compile project(':3rdparty:api-android:lib') compile project(':3rdparty:expansion_downloader') } android { - compileSdkVersion 19 - buildToolsVersion "19" - project.archivesBaseName = GWMapk + "_" + GWMvn + "_" +GWMvc + compileSdkVersion propTargetSdkVersion.toInteger() + buildToolsVersion propBuildToolsVersion + project.archivesBaseName = GWMapk + "_" + GWMvn + "_" + GWMvc signingConfigs { @@ -71,8 +43,8 @@ android { versionCode = Integer.valueOf(GWMvc) versionName = GWMvn packageName = GWMpn - minSdkVersion 11 - targetSdkVersion 19 + minSdkVersion propMinSdkVersion.toInteger() + targetSdkVersion propTargetSdkVersion.toInteger() } sourceSets { @@ -85,10 +57,6 @@ android { res.srcDirs = ['res'] assets.srcDirs = ['assets'] } - - instrumentTest.setRoot('tests') - debug.setRoot('build-types/debug') - release.setRoot('build-types/release') } } @@ -106,6 +74,35 @@ android.applicationVariants.all { variant -> } } -task wrapper(type: Wrapper) { - gradleVersion = '1.7' +// need it for :clean +apply plugin:'base' + +Properties properties = new Properties() +properties.load(project.rootProject.file('local.properties').newDataInputStream()) +def NDK_BUILD = properties.getProperty('ndk.dir') + '/ndk-build' + +task ndkBuild(type:Exec) { + def clParts = ([NDK_BUILD, '-j' + (Runtime.runtime.availableProcessors() + 1)] + GWMndkFlags.split(' ')).flatten() + println(clParts.join(" ")) + commandLine clParts +} + +task ndkBuildClean(type:Exec) { + commandLine NDK_BUILD, 'clean' +} + +task copyNativeLibs(type: Copy, dependsOn: 'ndkBuild') { + from(new File('libs')) { include '**/*.so' } + into new File(buildDir, 'native-libs') +} + +tasks.withType(Compile) { compileTask -> compileTask.dependsOn ndkBuild } +tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs } + +clean.dependsOn 'cleanCopyNativeLibs' +clean.dependsOn 'ndkBuildClean' + +tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask -> + pkgTask.jniFolders = new HashSet() + pkgTask.jniFolders.add(new File(buildDir, 'native-libs')) } diff --git a/android/gradle.properties b/android/gradle.properties index 6175f86..82e9969 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,6 +1,10 @@ -GWMvc=123 -GWMvn=1.2.3 +GWMvc=124 +GWMvn=1.2.4 GWMpn=com.guidewithme.germany GWMapk=GuideWithMe Germany GWMappName=GuideWithMe Germany -GWMndkFlags=propNdkFlags=V=0 NDK_DEBUG=0 \ No newline at end of file +GWMndkFlags=propNdkFlags=V=0 NDK_DEBUG=0 +propAndroidSupportLibrary=com.android.support:support-v4:19.1.+ +propMinSdkVersion=11 +propTargetSdkVersion=19 +propBuildToolsVersion=19.0.3 \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar index b979729..3c7abdf 100644 Binary files a/android/gradle/wrapper/gradle-wrapper.jar and b/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index e79ef4d..cfdcae9 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Sep 27 16:30:13 FET 2013 +#Sun May 04 20:21:28 FET 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.7-bin.zip +distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-bin.zip diff --git a/android/gradlew.bat b/android/gradlew.bat index 8a0b282..aec9973 100644 --- a/android/gradlew.bat +++ b/android/gradlew.bat @@ -1,90 +1,90 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/android/libs/android-support-v4.jar b/android/libs/android-support-v4.jar deleted file mode 100644 index 9056828..0000000 Binary files a/android/libs/android-support-v4.jar and /dev/null differ diff --git a/android/proguard-project.txt b/android/proguard-project.txt deleted file mode 100644 index f2fe155..0000000 --- a/android/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/android/project.properties b/android/project.properties deleted file mode 100644 index dd7974e..0000000 --- a/android/project.properties +++ /dev/null @@ -1,16 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-19 -android.library.reference.1=../3rdparty/android-mwm/lib -android.library.reference.2=3rdparty/expansion_downloader diff --git a/android/settings.gradle b/android/settings.gradle index 06c16d5..7ac7ce3 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,4 +1,3 @@ include ':3rdparty:play_licensing' include ':3rdparty:expansion_downloader' -include ':android-mwm' -project(':android-mwm').projectDir = new File(settingsDir, '../3rdparty/android-mwm/lib') +include ':3rdparty:api-android:lib' diff --git a/android/src/com/guidewithme/ArticleInfoDetailFragment.java b/android/src/com/guidewithme/ArticleInfoDetailFragment.java index fb7088d..b7c4c01 100644 --- a/android/src/com/guidewithme/ArticleInfoDetailFragment.java +++ b/android/src/com/guidewithme/ArticleInfoDetailFragment.java @@ -208,11 +208,10 @@ public class ArticleInfoDetailFragment extends Fragment final InputStream is = mZippedGuidesStorage.getData(url.replace("file:///", "data/")); if (is != null) { - final String type = getActivity().getContentResolver().getType(Uri.parse(url)); + String type = getActivity().getContentResolver().getType(Uri.parse(url)); if (type == null) { Log.d(TAG, "ERROR: Unknown mime-type for " + url); - ex.printStackTrace(); type = "application/octet-stream"; } return new WebResourceResponse(type, "UTF-8", is); diff --git a/builder/wikivoyage/makeapk.sh b/builder/wikivoyage/makeapk.sh index fa0729a..10d2aba 100644 --- a/builder/wikivoyage/makeapk.sh +++ b/builder/wikivoyage/makeapk.sh @@ -1,5 +1,3 @@ -export PATH=~/android-ndk-r9/:$PATH - set -e -u cat countries_to_generate.txt | while read country; do diff --git a/builder/wikivoyage/missing_images.list b/builder/wikivoyage/missing_images.list deleted file mode 100644 index 78d7768..0000000 --- a/builder/wikivoyage/missing_images.list +++ /dev/null @@ -1,8 +0,0 @@ -http://upload.wikimedia.org/wikivoyage/en/f/f2/Pagebanner_default.jpg -http://upload.wikimedia.org/wikipedia/commons/4/49/Stornoway_page_banner.jpg -http://en.wikivoyage.org/wiki/File:Heaton_Park_Banner.jpg -http://upload.wikimedia.org/wikipedia/commons/c/c3/Tobermory_banner_Shoreline.jpg -http://upload.wikimedia.org/wikipedia/commons/d/d2/Crosby_banner.jpg -http://upload.wikimedia.org/wikipedia/commons/d/da/Severn_Crossing_banner.jpg -http://upload.wikimedia.org/wikipedia/commons/d/d3/Reflections_on_Tr%C3%A0igh_Mh%C3%B2r_-_geograph.org.uk_-_320488.jpg -http://upload.wikimedia.org/wikipedia/commons/9/99/Bridport%2C_West_Street_fa%C3%A7ades_catch_the_sun_-_geograph.org.uk_-_1364356.jpg