diff --git a/.gitignore b/.gitignore index 96247b29..1de744f4 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ dep/libsoldout-1.3/mkd2latex dep/libsoldout-1.3/mkd2man test/*.tst *.class +dep/libsoldout/depends diff --git a/platform/android/build.gradle b/platform/android/build.gradle new file mode 100755 index 00000000..c492b02f --- /dev/null +++ b/platform/android/build.gradle @@ -0,0 +1,12 @@ +allprojects { + + repositories { + jcenter() + } + + buildscript { + repositories { + jcenter() + } + } +} diff --git a/platform/android/functional-test-tests/AndroidManifest.xml b/platform/android/functional-test-tests/AndroidManifest.xml deleted file mode 100644 index ea499621..00000000 --- a/platform/android/functional-test-tests/AndroidManifest.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/platform/android/functional-test-tests/pom.xml b/platform/android/functional-test-tests/pom.xml deleted file mode 100644 index 41e35976..00000000 --- a/platform/android/functional-test-tests/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - 4.0.0 - in.uncod.android.bypass - functional-test-tests - apk - Functional Test Tests - - - in.uncod.android.bypass - parent - 1.2-SNAPSHOT - ../pom.xml - - - - - com.google.android - android - provided - - - com.google.android - android-test - provided - - - in.uncod.android.bypass - functional-test - 1.2-SNAPSHOT - apk - - - - src - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - - - ${env.ANDROID_HOME} - 16 - - - true - - - - diff --git a/platform/android/functional-test-tests/project.properties b/platform/android/functional-test-tests/project.properties deleted file mode 100644 index 9b84a6b4..00000000 --- a/platform/android/functional-test-tests/project.properties +++ /dev/null @@ -1,14 +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-16 diff --git a/platform/android/functional-test-tests/res/drawable-ldpi/ic_launcher.png b/platform/android/functional-test-tests/res/drawable-ldpi/ic_launcher.png deleted file mode 100644 index 99238729..00000000 Binary files a/platform/android/functional-test-tests/res/drawable-ldpi/ic_launcher.png and /dev/null differ diff --git a/platform/android/functional-test-tests/res/values/strings.xml b/platform/android/functional-test-tests/res/values/strings.xml deleted file mode 100644 index 5d79e9bc..00000000 --- a/platform/android/functional-test-tests/res/values/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - Bypass-Test-FrameworkTest - - \ No newline at end of file diff --git a/platform/android/functional-test/pom.xml b/platform/android/functional-test/pom.xml deleted file mode 100644 index fc3611fd..00000000 --- a/platform/android/functional-test/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - 4.0.0 - in.uncod.android.bypass - functional-test - apk - Functional Test - - - in.uncod.android.bypass - parent - 1.2-SNAPSHOT - ../pom.xml - - - - - com.google.android - android - provided - - - in.uncod.android.bypass - bypass - apklib - 1.2-SNAPSHOT - - - - - src - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.6 - 1.6 - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - - - ${env.ANDROID_HOME} - 16 - - - true - - - - - diff --git a/platform/android/functional-test/project.properties b/platform/android/functional-test/project.properties deleted file mode 100644 index 1561d7a9..00000000 --- a/platform/android/functional-test/project.properties +++ /dev/null @@ -1,15 +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-17 -android.library.reference.1=../library diff --git a/platform/android/functional-test/res/drawable-hdpi/ic_launcher.png b/platform/android/functional-test/res/drawable-hdpi/ic_launcher.png deleted file mode 100644 index 96a442e5..00000000 Binary files a/platform/android/functional-test/res/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/platform/android/functional-test/res/drawable-mdpi/ic_launcher.png b/platform/android/functional-test/res/drawable-mdpi/ic_launcher.png deleted file mode 100644 index 359047df..00000000 Binary files a/platform/android/functional-test/res/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/platform/android/functional-test/res/drawable-xhdpi/ic_launcher.png b/platform/android/functional-test/res/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 71c6d760..00000000 Binary files a/platform/android/functional-test/res/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/platform/android/functional-test/res/layout/main.xml~ b/platform/android/functional-test/res/layout/main.xml~ deleted file mode 100644 index b99ec328..00000000 --- a/platform/android/functional-test/res/layout/main.xml~ +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/platform/android/functional-test/src/in/uncod/android/bypass/test/BenchmarkActivity.java b/platform/android/functional-test/src/in/uncod/android/bypass/test/BenchmarkActivity.java deleted file mode 100644 index c0d17ad7..00000000 --- a/platform/android/functional-test/src/in/uncod/android/bypass/test/BenchmarkActivity.java +++ /dev/null @@ -1,57 +0,0 @@ -package in.uncod.android.bypass.test; - -import java.io.InputStream; - -import in.uncod.android.bypass.Bypass; -import in.uncod.andrpod.bypass.bypass_test.R; -import android.app.Activity; -import android.content.res.Resources; -import android.os.Bundle; -import android.text.method.LinkMovementMethod; -import android.util.TimingLogger; -import android.widget.TextView; - -public class BenchmarkActivity extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.main); - - TextView text = (TextView) findViewById(R.id.demoText); - - TimingLogger timings = new TimingLogger("Bypass", "onCreate"); - - String readme = loadFile(); - - timings.addSplit("read raw"); - - Bypass bypass = new Bypass(); - - timings.addSplit("instantiated Bypass"); - - CharSequence string = bypass.markdownToSpannable(readme); - - timings.addSplit("convert to spannable"); - timings.dumpToLog(); - - text.setText(string); - //Allows link clicking - text.setMovementMethod(LinkMovementMethod.getInstance()); - } - - private String loadFile() { - try { - Resources res = getResources(); - InputStream in_s = res.openRawResource(R.raw.readme); - - byte[] b = new byte[in_s.available()]; - in_s.read(b); - return new String(b); - } catch (Exception e) { - // e.printStackTrace(); - } - return ""; - } -} diff --git a/platform/android/gradle/wrapper/gradle-wrapper.jar b/platform/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..8c0fb64a Binary files /dev/null and b/platform/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/platform/android/gradle/wrapper/gradle-wrapper.properties b/platform/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..0c71e760 --- /dev/null +++ b/platform/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/platform/android/gradlew b/platform/android/gradlew new file mode 100644 index 00000000..91a7e269 --- /dev/null +++ b/platform/android/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/platform/android/gradlew.bat b/platform/android/gradlew.bat new file mode 100644 index 00000000..aec99730 --- /dev/null +++ b/platform/android/gradlew.bat @@ -0,0 +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 diff --git a/platform/android/library/AndroidManifest.xml b/platform/android/library/AndroidManifest.xml deleted file mode 100644 index be253fad..00000000 --- a/platform/android/library/AndroidManifest.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - diff --git a/platform/android/library/build.gradle b/platform/android/library/build.gradle new file mode 100644 index 00000000..b1ddbf61 --- /dev/null +++ b/platform/android/library/build.gradle @@ -0,0 +1,48 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:1.2.3' + } +} + +repositories { + mavenCentral() +} + +apply plugin: 'com.android.library' + +android { + compileSdkVersion 22 + buildToolsVersion '22.0.1' + + defaultConfig { + minSdkVersion 8 + targetSdkVersion 22 + } + + lintOptions { + abortOnError false + } + + sourceSets { + main { + jni.srcDirs = [] + jniLibs.srcDirs = ["build/ndk"] + } + } +} + +task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') { + def ndkDir = project.plugins.findPlugin('com.android.library').sdkHandler.ndkFolder + + workingDir "$projectDir/src/main/jni" + + commandLine "$ndkDir/ndk-build" +} + +tasks.withType(JavaCompile) { + compileTask -> compileTask.dependsOn ndkBuild +} \ No newline at end of file diff --git a/platform/android/library/jni/Android.mk b/platform/android/library/jni/Android.mk deleted file mode 100644 index 2e117221..00000000 --- a/platform/android/library/jni/Android.mk +++ /dev/null @@ -1,18 +0,0 @@ -LOCAL_PATH := $(call my-dir) -BYPASS_SRC := ../../../../src/ - -include $(CLEAR_VARS) - -LOCAL_MODULE := bypass -LOCAL_SRC_FILES := \ - bypass.cpp \ - $(BYPASS_SRC)parser.cpp \ - $(BYPASS_SRC)document.cpp \ - $(BYPASS_SRC)element.cpp \ - ../../../../dep/libsoldout/markdown.c \ - ../../../../dep/libsoldout/buffer.c \ - ../../../../dep/libsoldout/array.c - -LOCAL_C_INCLUDES:= ../../../dep/libsoldout ../../../src /opt/local/include /usr/local/include $(BYPASS_INCLUDE_PATH) - -include $(BUILD_SHARED_LIBRARY) diff --git a/platform/android/library/pom.xml b/platform/android/library/pom.xml deleted file mode 100644 index 2c4589ad..00000000 --- a/platform/android/library/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - 4.0.0 - - in.uncod.android.bypass - bypass - apklib - Bypass - - - in.uncod.android.bypass - parent - 1.2-SNAPSHOT - ../pom.xml - - - - - com.google.android - android - provided - - - - - src - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - - - - - ndk-build - - - all - true - - true - - true - - - - true - - - - diff --git a/platform/android/library/project.properties b/platform/android/library/project.properties deleted file mode 100644 index cd0ca122..00000000 --- a/platform/android/library/project.properties +++ /dev/null @@ -1,15 +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 - -android.library=true -# Project target. -target=android-8 diff --git a/platform/android/library/res/values/strings.xml b/platform/android/library/res/values/strings.xml deleted file mode 100644 index 1945135a..00000000 --- a/platform/android/library/res/values/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - Bypass - diff --git a/platform/android/functional-test-tests/src/in/uncod/andrpod/bypass/bypass_test/test/BasicTests.java b/platform/android/library/src/androidTest/java/in/uncod/android/bypass/BasicTests.java similarity index 93% rename from platform/android/functional-test-tests/src/in/uncod/andrpod/bypass/bypass_test/test/BasicTests.java rename to platform/android/library/src/androidTest/java/in/uncod/android/bypass/BasicTests.java index f1bbd51e..18309216 100644 --- a/platform/android/functional-test-tests/src/in/uncod/andrpod/bypass/bypass_test/test/BasicTests.java +++ b/platform/android/library/src/androidTest/java/in/uncod/android/bypass/BasicTests.java @@ -1,12 +1,9 @@ -package in.uncod.andrpod.bypass.bypass_test.test; +package in.uncod.android.bypass; -import in.uncod.android.bypass.Bypass; import android.graphics.Typeface; import android.test.InstrumentationTestCase; import android.text.Spannable; import android.text.SpannedString; -import android.text.style.BulletSpan; -import android.text.style.LeadingMarginSpan; import android.text.style.RelativeSizeSpan; import android.text.style.StyleSpan; import android.text.style.TypefaceSpan; diff --git a/platform/android/library/src/main/AndroidManifest.xml b/platform/android/library/src/main/AndroidManifest.xml new file mode 100644 index 00000000..72c06eed --- /dev/null +++ b/platform/android/library/src/main/AndroidManifest.xml @@ -0,0 +1,8 @@ + + + + + diff --git a/platform/android/library/src/in/uncod/android/bypass/Bypass.java b/platform/android/library/src/main/java/in/uncod/android/bypass/Bypass.java similarity index 100% rename from platform/android/library/src/in/uncod/android/bypass/Bypass.java rename to platform/android/library/src/main/java/in/uncod/android/bypass/Bypass.java diff --git a/platform/android/library/src/in/uncod/android/bypass/Document.java b/platform/android/library/src/main/java/in/uncod/android/bypass/Document.java similarity index 100% rename from platform/android/library/src/in/uncod/android/bypass/Document.java rename to platform/android/library/src/main/java/in/uncod/android/bypass/Document.java diff --git a/platform/android/library/src/in/uncod/android/bypass/Element.java b/platform/android/library/src/main/java/in/uncod/android/bypass/Element.java similarity index 100% rename from platform/android/library/src/in/uncod/android/bypass/Element.java rename to platform/android/library/src/main/java/in/uncod/android/bypass/Element.java diff --git a/platform/android/library/src/in/uncod/android/bypass/ReverseSpannableStringBuilder.java b/platform/android/library/src/main/java/in/uncod/android/bypass/ReverseSpannableStringBuilder.java similarity index 100% rename from platform/android/library/src/in/uncod/android/bypass/ReverseSpannableStringBuilder.java rename to platform/android/library/src/main/java/in/uncod/android/bypass/ReverseSpannableStringBuilder.java diff --git a/platform/android/library/src/in/uncod/android/bypass/style/HorizontalLineSpan.java b/platform/android/library/src/main/java/in/uncod/android/bypass/style/HorizontalLineSpan.java similarity index 100% rename from platform/android/library/src/in/uncod/android/bypass/style/HorizontalLineSpan.java rename to platform/android/library/src/main/java/in/uncod/android/bypass/style/HorizontalLineSpan.java diff --git a/platform/android/library/src/main/jni/Android.mk b/platform/android/library/src/main/jni/Android.mk new file mode 100644 index 00000000..ba817357 --- /dev/null +++ b/platform/android/library/src/main/jni/Android.mk @@ -0,0 +1,20 @@ +LOCAL_PATH := $(call my-dir) +BYPASS_SRC := ../../../../../../src/ + +include $(CLEAR_VARS) + +LOCAL_MODULE := bypass +LOCAL_SRC_FILES := \ + bypass.cpp \ + $(BYPASS_SRC)parser.cpp \ + $(BYPASS_SRC)document.cpp \ + $(BYPASS_SRC)element.cpp \ + ../../../../../../dep/libsoldout/markdown.c \ + ../../../../../../dep/libsoldout/buffer.c \ + ../../../../../../dep/libsoldout/array.c + +LOCAL_C_INCLUDES := ../../../../../../dep/libsoldout ../../../../../../src /opt/local/include /usr/local/include $(BYPASS_INCLUDE_PATH) + +NDK_APP_DST_DIR := ../../../build/ndk/$(TARGET_ARCH_ABI) + +include $(BUILD_SHARED_LIBRARY) diff --git a/platform/android/library/jni/Application.mk b/platform/android/library/src/main/jni/Application.mk similarity index 70% rename from platform/android/library/jni/Application.mk rename to platform/android/library/src/main/jni/Application.mk index b02cc311..c22848a9 100644 --- a/platform/android/library/jni/Application.mk +++ b/platform/android/library/src/main/jni/Application.mk @@ -1,2 +1,4 @@ APP_ABI := armeabi armeabi-v7a arm64-v8a x86 x86_64 mips mips64 APP_STL := gnustl_static + +NDK_APP_OUT := ../../../build/ndk-obj \ No newline at end of file diff --git a/platform/android/library/jni/bypass.cpp b/platform/android/library/src/main/jni/bypass.cpp similarity index 100% rename from platform/android/library/jni/bypass.cpp rename to platform/android/library/src/main/jni/bypass.cpp diff --git a/platform/android/library/jni/in_uncod_android_bypass_Bypass.h b/platform/android/library/src/main/jni/in_uncod_android_bypass_Bypass.h similarity index 100% rename from platform/android/library/jni/in_uncod_android_bypass_Bypass.h rename to platform/android/library/src/main/jni/in_uncod_android_bypass_Bypass.h diff --git a/platform/android/pom.xml b/platform/android/pom.xml deleted file mode 100644 index 8d333049..00000000 --- a/platform/android/pom.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - 4.0.0 - - - org.sonatype.oss - oss-parent - 7 - - - in.uncod.android.bypass - parent - 1.2-SNAPSHOT - pom - - Bypass (Parent) - Skip the HTML, Bypass takes markdown and renders it directly on Android and iOS. - http://uncodin.github.com/bypass/ - 2013 - - - library - functional-test - functional-test-tests - - - - https://github.com/Uncodin/bypass/ - scm:git:git://github.com/Uncodin/bypass.git - scm:git:git@github.com:Uncodin/bypass.git - HEAD - - - - - Colin Edwards - colin@recursivepenguin.com - cedwards - http://recursivepenguin.com/ - -6 - - architect - developer - - - - Damian Carrillo - damian@uncod.in - dcarrillo - -6 - - architect - developer - - - - - - Uncodin - http://uncod.in/ - - - - GitHub Issues - https://github.com/Uncodin/bypass/issues - - - - - Apache License Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - UTF-8 - UTF-8 - - 4.1.1.4 - - 4.10 - - - - - - com.google.android - android - ${android.version} - - - com.google.android - android-test - 4.1.1.4 - provided - - - junit - junit - ${junit.version} - - - - - - - - - com.jayway.maven.plugins.android.generation2 - android-maven-plugin - 3.8.2 - - - - 19 - - - - - - maven-compiler-plugin - 2.5.1 - - 1.6 - 1.6 - - - - - - - - org.apache.maven.plugins - maven-release-plugin - 2.3.2 - - true - - - - - diff --git a/platform/android/sample/build.gradle b/platform/android/sample/build.gradle new file mode 100644 index 00000000..e0eaaa2f --- /dev/null +++ b/platform/android/sample/build.gradle @@ -0,0 +1,27 @@ +repositories { + jcenter() +} + +buildscript { + dependencies { + classpath 'com.android.tools.build:gradle:1.2.3' + } +} + +apply plugin: 'com.android.application' + +android { + + compileSdkVersion 22 + buildToolsVersion '22.0.1' + + defaultConfig { + minSdkVersion 8 + targetSdkVersion 22 + applicationId "in.uncod.android.bypass.test" + } +} + +dependencies { + compile project(':library') +} \ No newline at end of file diff --git a/platform/android/functional-test/AndroidManifest.xml b/platform/android/sample/src/main/AndroidManifest.xml similarity index 73% rename from platform/android/functional-test/AndroidManifest.xml rename to platform/android/sample/src/main/AndroidManifest.xml index 2e0cc2f7..a5c8d809 100644 --- a/platform/android/functional-test/AndroidManifest.xml +++ b/platform/android/sample/src/main/AndroidManifest.xml @@ -1,11 +1,5 @@ - - + package="in.uncod.andrpod.bypass.bypass_test"> - diff --git a/platform/android/sample/src/main/java/in/uncod/android/bypass/test/BenchmarkActivity.java b/platform/android/sample/src/main/java/in/uncod/android/bypass/test/BenchmarkActivity.java new file mode 100644 index 00000000..799bf206 --- /dev/null +++ b/platform/android/sample/src/main/java/in/uncod/android/bypass/test/BenchmarkActivity.java @@ -0,0 +1,58 @@ +package in.uncod.android.bypass.test; + +import android.app.Activity; +import android.content.res.Resources; +import android.os.Bundle; +import android.text.method.LinkMovementMethod; +import android.util.TimingLogger; +import android.widget.TextView; + +import java.io.InputStream; + +import in.uncod.android.bypass.Bypass; +import in.uncod.andrpod.bypass.bypass_test.R; + +public class BenchmarkActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.main); + + TextView text = (TextView) findViewById(R.id.demoText); + + TimingLogger timings = new TimingLogger("Bypass", "onCreate"); + + String readme = loadFile(); + + timings.addSplit("read raw"); + + Bypass bypass = new Bypass(this); + + timings.addSplit("instantiated Bypass"); + + CharSequence string = bypass.markdownToSpannable(readme); + + timings.addSplit("convert to spannable"); + timings.dumpToLog(); + + text.setText(string); + //Allows link clicking + text.setMovementMethod(LinkMovementMethod.getInstance()); + } + + private String loadFile() { + try { + Resources res = getResources(); + InputStream in_s = res.openRawResource(R.raw.readme); + + byte[] b = new byte[in_s.available()]; + in_s.read(b); + return new String(b); + } catch (Exception e) { + // e.printStackTrace(); + } + return ""; + } +} diff --git a/platform/android/functional-test-tests/res/drawable-hdpi/ic_launcher.png b/platform/android/sample/src/main/res/drawable-hdpi/ic_launcher.png similarity index 100% rename from platform/android/functional-test-tests/res/drawable-hdpi/ic_launcher.png rename to platform/android/sample/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/platform/android/functional-test-tests/res/drawable-mdpi/ic_launcher.png b/platform/android/sample/src/main/res/drawable-mdpi/ic_launcher.png similarity index 100% rename from platform/android/functional-test-tests/res/drawable-mdpi/ic_launcher.png rename to platform/android/sample/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/platform/android/functional-test-tests/res/drawable-xhdpi/ic_launcher.png b/platform/android/sample/src/main/res/drawable-xhdpi/ic_launcher.png similarity index 100% rename from platform/android/functional-test-tests/res/drawable-xhdpi/ic_launcher.png rename to platform/android/sample/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/platform/android/functional-test/res/layout/main.xml b/platform/android/sample/src/main/res/layout/main.xml similarity index 100% rename from platform/android/functional-test/res/layout/main.xml rename to platform/android/sample/src/main/res/layout/main.xml diff --git a/platform/android/functional-test/res/raw/readme.txt b/platform/android/sample/src/main/res/raw/readme.txt similarity index 81% rename from platform/android/functional-test/res/raw/readme.txt rename to platform/android/sample/src/main/res/raw/readme.txt index 692fb415..e4b7f4c9 100644 --- a/platform/android/functional-test/res/raw/readme.txt +++ b/platform/android/sample/src/main/res/raw/readme.txt @@ -17,7 +17,7 @@ github page for Bypass [here](https://github.com/Uncodin/bypass). * Two * Three -## Code Block Support +## Code Block Support(Indent) const char* str; str = env->GetStringUTFChars(markdown, NULL); @@ -28,10 +28,25 @@ github page for Bypass [here](https://github.com/Uncodin/bypass). env->ReleaseStringUTFChars(markdown, str); +## Code Block Support + +Inline: ```quotes``` + +` +const char* str; +str = env->GetStringUTFChars(markdown, NULL); + +Bypass::Parser parser; +Bypass::Document document = parser.parse(str); + +env->ReleaseStringUTFChars(markdown, str); +` + #Quote Support > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ullamcorper tempus neque vulputate congue. > Quisque ipsum tellus, pharetra vitae dictum sit amet, placerat vitae felis. Etiam ornare eleifend libero, > et dignissim nibh rhoncus eu. Morbi mattis nisi in velit tristique eu mollis odio molestie. +Text betwen quote > Phasellus pretium dapibus mattis. Nullam mollis nisl id enim vestibulum quis lacinia turpis pellentesque. > Integer id mi quam. Fusce sagittis cursus eros, nec convallis ligula consectetur quis. Suspendisse potenti. diff --git a/platform/android/functional-test/res/values/strings.xml b/platform/android/sample/src/main/res/values/strings.xml similarity index 100% rename from platform/android/functional-test/res/values/strings.xml rename to platform/android/sample/src/main/res/values/strings.xml diff --git a/platform/android/settings.gradle b/platform/android/settings.gradle new file mode 100644 index 00000000..e6209efa --- /dev/null +++ b/platform/android/settings.gradle @@ -0,0 +1,2 @@ +include ':library' +include ':sample' \ No newline at end of file