From e2210e8a4026ff1738ea19ea1ab41c1d01c0d8f1 Mon Sep 17 00:00:00 2001 From: Kevin Meyer Date: Mon, 7 Jul 2014 21:46:57 +0200 Subject: [PATCH 01/16] ported project to android studio --- .gitignore | 5 ++ Poche.iml | 21 ++++++ android-app.iml | 64 ++++++++++++++++++ build.gradle | 49 ++++++++++++++ gradlew | 164 +++++++++++++++++++++++++++++++++++++++++++++ gradlew.bat | 90 +++++++++++++++++++++++++ project.properties | 14 ---- 7 files changed, 393 insertions(+), 14 deletions(-) create mode 100644 Poche.iml create mode 100644 android-app.iml create mode 100644 build.gradle create mode 100755 gradlew create mode 100644 gradlew.bat delete mode 100644 project.properties diff --git a/.gitignore b/.gitignore index 7843a1d..7e05cf1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,8 @@ gen/ *.apk *.ap_ *.class +.idea/ +.gradle/ +build/ +gradle/ +local.properties diff --git a/Poche.iml b/Poche.iml new file mode 100644 index 0000000..7ded604 --- /dev/null +++ b/Poche.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/android-app.iml b/android-app.iml new file mode 100644 index 0000000..33d9feb --- /dev/null +++ b/android-app.iml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..fcea494 --- /dev/null +++ b/build.gradle @@ -0,0 +1,49 @@ +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:0.12.+' + } +} +apply plugin: 'com.android.application' + +dependencies { + compile fileTree(dir: 'libs', include: '*.jar') +} + +android { + compileSdkVersion 20 + buildToolsVersion "20.0.0" + + defaultConfig { + minSdkVersion 8 + targetSdkVersion 20 + versionCode 1 + versionName "1.0" + } + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + resources.srcDirs = ['src'] + aidl.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + res.srcDirs = ['res'] + assets.srcDirs = ['assets'] + } + + // Move the tests to tests/java, tests/res, etc... + instrumentTest.setRoot('tests') + + // 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') + } +} diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..91a7e26 --- /dev/null +++ b/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/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/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/project.properties b/project.properties deleted file mode 100644 index 85aac54..0000000 --- a/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-8 From 4c5c27fedca55cf3280b82e8e86c0243d5591a48 Mon Sep 17 00:00:00 2001 From: Kevin Meyer Date: Tue, 19 Aug 2014 12:37:38 +0200 Subject: [PATCH 02/16] display the article content in a webview --- android-app.iml | 20 +++++++++++++- res/layout/article.xml | 7 ++--- src/fr/gaulupeau/apps/Poche/Poche.java | 6 ++-- src/fr/gaulupeau/apps/Poche/ReadArticle.java | 29 +++++++++++++++++--- 4 files changed, 50 insertions(+), 12 deletions(-) diff --git a/android-app.iml b/android-app.iml index 33d9feb..4e9a28d 100644 --- a/android-app.iml +++ b/android-app.iml @@ -51,7 +51,25 @@ - + + + + + + + + + + + + + + + + + + + diff --git a/res/layout/article.xml b/res/layout/article.xml index 210eb1d..eb1bd3e 100644 --- a/res/layout/article.xml +++ b/res/layout/article.xml @@ -32,11 +32,10 @@ android:layout_marginTop="5sp" android:background="#000000" /> - + android:layout_height="wrap_content" /> \n" + + "\t\t\n" + + "\t\t\n" + + "\t\n" + + "\t\t
\n" + + "\t\t\t\n" + + "\t\t\t\t
\n" + + "\t\t\t\t\t
\n" + + "\t\t\t\t\t\t
"; + String htmlFooter = "
\n" + + "\t\t\t\t\t
\n" + + "\t\t\t\t
\n" + + "\t\t\t\n" + + "\t\t
\n" + + ""; + String htmlContent = ac.getString(3); + + + webViewContent = (WebView)findViewById(R.id.webViewContent); + webViewContent.loadData(htmlHeader + htmlContent + htmlFooter, "text/html; charset=utf-8", null); + + txtAuthor = (TextView)findViewById(R.id.txtAuthor); txtAuthor.setText(ac.getString(0)); btnMarkRead = (Button)findViewById(R.id.btnMarkRead); From 65089ff16c15d90302541f86de2a497a303ac824 Mon Sep 17 00:00:00 2001 From: Kevin Meyer Date: Tue, 19 Aug 2014 13:15:02 +0200 Subject: [PATCH 03/16] improved article style: using same style as in iphone app --- assets/main.css | 243 +++++++++++++++++++ assets/ratatouille.css | 155 ++++++++++++ res/layout/article.xml | 59 ++--- src/fr/gaulupeau/apps/Poche/ReadArticle.java | 31 ++- 4 files changed, 444 insertions(+), 44 deletions(-) create mode 100755 assets/main.css create mode 100644 assets/ratatouille.css diff --git a/assets/main.css b/assets/main.css new file mode 100755 index 0000000..40f485e --- /dev/null +++ b/assets/main.css @@ -0,0 +1,243 @@ +/* ========================================================================== + Sommaire + + 1 = Style Guide + 2 = Layout + 3 = Pictos + 4 = Messages + 5 = Article + 6 = Media queries + + ========================================================================== */ + +html { + min-height: 100%; +} + +body { + background: #EEE; +} + +/* ========================================================================== + 1 = Style Guide + ========================================================================== */ + +::selection { + color: #FFF; + background: #000; +} + +h2, h3, h4 { + font-family: 'PT Sans', sans-serif; + text-transform: uppercase; +} + +p, li { + color: #666; +} + +a { + color: #000; + font-weight: bold; +} + +a:hover, a:focus { + text-decoration: none; +} + +h2:after { + content: ""; + height: 4px; + width: 70px; + background: #000; + display: block; +} + +.links { + padding: 0; + margin: 0; +} + .links li { + list-style: none; + margin: 0; + padding: 0; + } + + +#links { + position: fixed; + top: 0; + width: 10em; + left: 0; + text-align: right; + background: #333; + padding-top: 9.5em; + height: 100%; + box-shadow:inset -4px 0 20px rgba(0,0,0,0.6); + z-index: 10; +} + +#main { + margin-left: 13em; + position: relative; + z-index: 10; + padding-right: 5%; + padding-bottom: 1em; +} + + #links a { + display: block; + padding: 0.5em 2em 0.5em 1em; + color: #FFF; + position: relative; + text-transform: uppercase; + text-decoration: none; + font-weight: normal; + font-family: 'PT Sans', sans-serif; + -webkit-transition: all 0.5s ease; + -moz-transition: all 0.5s ease; + -ms-transition: all 0.5s ease; + -o-transition: all 0.5s ease; + transition: all 0.5s ease; + } + + #links a:hover, #links a:focus { + background: #999; + color: #000; + } + + #links .current:after { + content: ""; + width: 0; + height: 0; + position: absolute; + border-style: solid; + border-width: 10px; + border-color: transparent #EEE transparent transparent; + right: 0; + top: 50%; + margin-top: -10px; + } + + #links li:last-child { + position: fixed; + bottom: 1em; + width: 10em; + } + + #links li:last-child a:before { + font-size: 1.2em; + position: relative; + top: 2px; + } + + + +/* ========================================================================== + 2 = Layout + ========================================================================== */ + +#content { + margin-top: 1em; + min-height: 30em; +} + +footer { + text-align: right; + position: relative; + bottom: 0; + right: 5em; + color: #999; + font-size: 0.8em; + font-style: italic; + z-index: 20; +} + +footer a { + color: #999; + font-weight: normal; +} + +/* ========================================================================== + 5 = Article + ========================================================================== */ + +header.mbm { + text-align: left; +} + +#article { + width: 70%; +/* margin-bottom: 3em; */ + text-align: justify; + word-wrap: break-word; +} + +#article .tags { + margin-bottom: 1em; +} + +#article i { + font-style: normal; +} + +blockquote { + border:1px solid #999; + background: #FFF; + padding: 1em; + margin: 0; +} + +#article h2, #article h3, #article h4 { + text-transform: none; +} + +#article h2:after { + content: none; +} + +/* ========================================================================== + 6 = Media Queries + ========================================================================== */ + + +@media screen { + body > header { + background: #333; + position: fixed; + top: 0; + width: 100%; + height: 3em; + z-index: 11; + } + #links li:last-child { + position: static; + width: auto; + } + #links li:last-child a:before { + content: none; + } + #links { + display: none; + width: 100%; + height: auto; + padding-top: 3em; + } + footer { + position: static; + margin-right: 3em; + } + #main { + margin-left: 1.5em; + padding-right: 1.5em; + position: static; + } + + #article { + width: 100%; + } + + #article h1 { + font-size: 1.2em; + } +} diff --git a/assets/ratatouille.css b/assets/ratatouille.css new file mode 100644 index 0000000..1901693 --- /dev/null +++ b/assets/ratatouille.css @@ -0,0 +1,155 @@ +/* + Ratatouille mini Framework css by Thomas LEBEAU + Base on KNACSS => www.KNACSS.com (2013-10) @author: Raphael Goetter, Alsacreations + and normalize.css +*/ + +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +body { + font-size: 1em; + line-height:1.5; + margin: 0; +} + +/* ========================================================================== + Mise en forme + ========================================================================== */ + +h1:first-child, +h2:first-child, +h3:first-child, +h4:first-child, +h5:first-child, +h6:first-child, +p:first-child, +ul:first-child, +ol:first-child, +dl:first-child{ + margin-top: 0; +} + +code, +kbd, +pre, +samp { + font-family: monospace, serif; +} + +pre { + white-space: pre-wrap; +} + + +.upper { + text-transform: uppercase; +} + +.bold { + font-weight: bold; +} + +.inner { + margin: 0 auto; + max-width: 61.25em;/*980px*/ +} + +table, img { + max-width: 100%; + height :auto; +} + +iframe { + max-width: 100%; +} + +.fl { + float: left; +} + +.fr { + float: right; +} + +table { + border-collapse: collapse; +} + +figure { + margin: 0; +} + +button, +input, +select, +textarea { + font-family: inherit; + font-size: 100%; + margin: 0; +} + +input[type="search"] { + -webkit-appearance: textfield; +} + +/* ========================================================================== + Mise en page + ========================================================================== */ + +.dib { + display: inline-block; + vertical-align: middle; +} + +.dnone { + display: none; +} + +.dtable { display:table } + + .dtable > * { display:table-row; } + + .dtable > * > * { display:table-cell; } + +.element-invisible { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} + +.small { + font-size:0.8em; +} + +.big { + font-size: 1.2em; +} + +/*Width*/ + +.w100 { width:100%; } +.w90 { width:90%; } +.w80 { width:80%; } +.w70 { width:70%; } +.w60 { width:60%; } +.w50 { width:50%; } +.w40 { width:40%; } +.w30 { width:30%; } +.w20 { width:20%; } +.w10 { width:10%; } + diff --git a/res/layout/article.xml b/res/layout/article.xml index eb1bd3e..4e9b073 100644 --- a/res/layout/article.xml +++ b/res/layout/article.xml @@ -7,49 +7,36 @@ - - - - - - + android:orientation="vertical" > - - -