diff --git a/CHANGELOG.md b/CHANGELOG.md index 83b7c80..5f893a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ Change Log ========== +Version 1.3.2 *(In development)* +-------------------------------- +* ... + + +Version 1.3.1 *(2013-10-28)* +-------------------------------- +* Add `SherlockProgressFragment-Sample` project. +* Pushed to Maven Central. + + Version 1.2 *(2013-07-13)* ---------------------------- * Implemented `GridFragment` & `SherlockGridFragment`. diff --git a/README.md b/README.md index 68bb06a..3e8a361 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -[![Stories in Ready](http://badge.waffle.io/johnkil/Android-ProgressFragment.png)](http://waffle.io/johnkil/Android-ProgressFragment) Android-ProgressFragment ======================== @@ -74,6 +73,33 @@ setContentShown(true); ``` +Developed By +------------ + +Android-ProgressFragment library is now pushed to Maven Central as a AAR, so you just need to add the following dependency to your build.gradle. + +ProgressFragment: +``` xml +dependencies { + compile 'com.github.johnkil.android-progressfragment:progressfragment:1.3.1' +} +``` + +SherlockProgressFragment: +``` xml +dependencies { + compile 'com.android.support:support-v4:18.0.0' + compile('com.github.johnkil.android-progressfragment:sherlockprogressfragment:1.3.1') { + exclude module: 'support-v4' + } +} +``` + +Example Gradle project using Android-ProgressFragment: + +* [Android-ProgressFragment-Gradle-Sample](https://github.com/johnkil/Android-ProgressFragment-Gradle-Sample) + + Developed By ------------ * Evgeny Shishkin - diff --git a/build.gradle b/build.gradle index 1f88824..1074676 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,23 @@ buildscript { repositories { mavenCentral() } + dependencies { - classpath 'com.android.tools.build:gradle:0.5.+' + classpath 'com.android.tools.build:gradle:0.6.+' } -} \ No newline at end of file +} + +def isReleaseBuild() { + return version.contains("SNAPSHOT") == false +} + +allprojects { + version = VERSION_NAME + group = GROUP + + repositories { + mavenCentral() + } +} + +// apply plugin: 'android-reporting' \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..dec3a20 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,14 @@ +VERSION_NAME=1.3.1-SNAPSHOT +VERSION_CODE=5 +GROUP=com.github.johnkil.android-progressfragment + +POM_DESCRIPTION=Implementation of the fragment with the ability to display indeterminate progress indicator when you are waiting for the initial data +POM_URL=https://github.com/johnkil/Android-ProgressFragment +POM_SCM_URL=https://github.com/johnkil/Android-ProgressFragment +POM_SCM_CONNECTION=scm:git@github.com:johnkil/Android-ProgressFragment.git +POM_SCM_DEV_CONNECTION=scm:git@github.com:johnkil/Android-ProgressFragment.git +POM_LICENCE_NAME=The Apache Software License, Version 2.0 +POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENCE_DIST=repo +POM_DEVELOPER_ID=johnkil +POM_DEVELOPER_NAME=Evgeny Shishkin \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..667288a Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0b841d3 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Oct 25 13:11:37 MSK 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-all.zip 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/maven_push.gradle b/maven_push.gradle new file mode 100644 index 0000000..ab35ba1 --- /dev/null +++ b/maven_push.gradle @@ -0,0 +1,82 @@ +apply plugin: 'maven' +apply plugin: 'signing' + +def sonatypeRepositoryUrl +if (isReleaseBuild()) { + println 'RELEASE BUILD' + sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" +} else { + println 'DEBUG BUILD' + sonatypeRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/" +} + +afterEvaluate { project -> + uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + pom.artifactId = POM_ARTIFACT_ID + + repository(url: sonatypeRepositoryUrl) { + authentication(userName: nexusUsername, password: nexusPassword) + } + + pom.project { + name POM_NAME + packaging POM_PACKAGING + description POM_DESCRIPTION + url POM_URL + + scm { + url POM_SCM_URL + connection POM_SCM_CONNECTION + developerConnection POM_SCM_DEV_CONNECTION + } + + licenses { + license { + name POM_LICENCE_NAME + url POM_LICENCE_URL + distribution POM_LICENCE_DIST + } + } + + developers { + developer { + id POM_DEVELOPER_ID + name POM_DEVELOPER_NAME + } + } + } + } + } + } + + signing { + required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } + sign configurations.archives + } + + task androidJavadocs(type: Javadoc) { + source = android.sourceSets.main.allJava + } + + task androidJavadocsJar(type: Jar) { + classifier = 'javadoc' + //basename = artifact_id + from androidJavadocs.destinationDir + } + + task androidSourcesJar(type: Jar) { + classifier = 'sources' + //basename = artifact_id + from android.sourceSets.main.allSource + } + + artifacts { + //archives packageReleaseJar + archives androidSourcesJar + archives androidJavadocsJar + } +} \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..ccec14b --- /dev/null +++ b/pom.xml @@ -0,0 +1,131 @@ + + + 4.0.0 + + + org.sonatype.oss + oss-parent + 7 + + + com.devspark.progressfragment + parent + pom + + Android ProgressFragment + Implementation of the fragment with the ability to display indeterminate progress indicator when you + are waiting for the initial data. + + http://johnkil.github.io/Android-ProgressFragment/ + 2013 + 1.3-SNAPSHOT + + + progressfragment + sherlockprogressfragment + progressfragment-sample + + + + + Apache License Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + UTF-8 + UTF-8 + 1.6 + 16 + + + 4.1.1.4 + 13.0.0 + 4.10 + + + 3.6.0 + 3.1 + 2.9.1 + 2.2.1 + + + + + + + com.google.android + android + ${android.version} + + + com.android.support + support-v4 + ${android-support.version} + + + + + com.actionbarsherlock + actionbarsherlock + 4.3.1 + apklib + + + com.google.android + support-v4 + + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + ${java.version} + + + + + com.jayway.maven.plugins.android.generation2 + android-maven-plugin + ${android-maven-plugin.version} + + + ${android.sdk.platform} + + true + false + true + ${project.basedir}/lint.xml + false + + + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + + + + + diff --git a/progressfragment-sample/AndroidManifest.xml b/progressfragment-sample/AndroidManifest.xml index 6658c35..5d4b568 100644 --- a/progressfragment-sample/AndroidManifest.xml +++ b/progressfragment-sample/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="5" + android:versionName="1.3.1"> + 4.0.0 + + + com.devspark.progressfragment + parent + 1.3-SNAPSHOT + + + progressfragment-sample + apk + + Android ProgressFragment (Sample) + + + + + com.google.android + android + provided + + + com.android.support + support-v4 + + + + + com.devspark.progressfragment + progressfragment + ${project.version} + apklib + + + + + src + + + com.jayway.maven.plugins.android.generation2 + android-maven-plugin + true + + + runLint + compile + + lint + + + + + + + \ No newline at end of file diff --git a/progressfragment/AndroidManifest.xml b/progressfragment/AndroidManifest.xml index 963848d..567ea53 100644 --- a/progressfragment/AndroidManifest.xml +++ b/progressfragment/AndroidManifest.xml @@ -1,11 +1,13 @@ + android:versionCode="5" + android:versionName="1.3.1"> + + \ No newline at end of file diff --git a/progressfragment/build.gradle b/progressfragment/build.gradle index cb4b158..6a39488 100644 --- a/progressfragment/build.gradle +++ b/progressfragment/build.gradle @@ -1,12 +1,12 @@ apply plugin: 'android-library' dependencies { - compile fileTree(dir: 'libs', include: '*.jar') + compile 'com.android.support:support-v4:18.0.0' } android { - compileSdkVersion 17 - buildToolsVersion '17.0.0' + compileSdkVersion 18 + buildToolsVersion '18.1.0' sourceSets { main { @@ -17,4 +17,5 @@ android { } } - +// Used to push in maven +apply from: '../maven_push.gradle' diff --git a/progressfragment/gradle.properties b/progressfragment/gradle.properties new file mode 100644 index 0000000..fea9215 --- /dev/null +++ b/progressfragment/gradle.properties @@ -0,0 +1,3 @@ +POM_NAME=ProgressFragment Library +POM_ARTIFACT_ID=progressfragment +POM_PACKAGING=aar \ No newline at end of file diff --git a/progressfragment/libs/android-support-v4.jar b/progressfragment/libs/android-support-v4.jar deleted file mode 100644 index 6080877..0000000 Binary files a/progressfragment/libs/android-support-v4.jar and /dev/null differ diff --git a/progressfragment/pom.xml b/progressfragment/pom.xml new file mode 100644 index 0000000..08b6709 --- /dev/null +++ b/progressfragment/pom.xml @@ -0,0 +1,76 @@ + + 4.0.0 + + + com.devspark.progressfragment + parent + 1.3-SNAPSHOT + + + progressfragment + apklib + + Android ProgressFragment (Library) + + + + + com.google.android + android + provided + + + com.android.support + support-v4 + + + + + src + + + com.jayway.maven.plugins.android.generation2 + android-maven-plugin + true + + + runLint + compile + + lint + + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + attach-javadocs + + jar + + + true + + + + + + + \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 55ec24c..921e318 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,4 @@ +include ':progressfragment' include ':progressfragment-sample' -include ':progressfragment' \ No newline at end of file +include ':sherlockprogressfragment' +include ':sherlockprogressfragment-sample' diff --git a/sherlockprogressfragment-sample/AndroidManifest.xml b/sherlockprogressfragment-sample/AndroidManifest.xml new file mode 100644 index 0000000..afd7962 --- /dev/null +++ b/sherlockprogressfragment-sample/AndroidManifest.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + diff --git a/sherlockprogressfragment-sample/build.gradle b/sherlockprogressfragment-sample/build.gradle new file mode 100644 index 0000000..6f9a7ec --- /dev/null +++ b/sherlockprogressfragment-sample/build.gradle @@ -0,0 +1,18 @@ +apply plugin: 'android' + +dependencies { + compile project(':sherlockprogressfragment') +} + +android { + compileSdkVersion 18 + buildToolsVersion "18.1.0" + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + res.srcDirs = ['res'] + } + } +} diff --git a/sherlockprogressfragment-sample/res/drawable-hdpi-v11/ic_launcher.png b/sherlockprogressfragment-sample/res/drawable-hdpi-v11/ic_launcher.png new file mode 100755 index 0000000..9eb64d2 Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-hdpi-v11/ic_launcher.png differ diff --git a/sherlockprogressfragment-sample/res/drawable-hdpi-v11/ic_menu_refresh.png b/sherlockprogressfragment-sample/res/drawable-hdpi-v11/ic_menu_refresh.png new file mode 100755 index 0000000..553e90b Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-hdpi-v11/ic_menu_refresh.png differ diff --git a/sherlockprogressfragment-sample/res/drawable-hdpi/ic_launcher.png b/sherlockprogressfragment-sample/res/drawable-hdpi/ic_launcher.png new file mode 100755 index 0000000..e47320b Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-hdpi/ic_launcher.png differ diff --git a/sherlockprogressfragment-sample/res/drawable-hdpi/ic_menu_refresh.png b/sherlockprogressfragment-sample/res/drawable-hdpi/ic_menu_refresh.png new file mode 100644 index 0000000..bbb08f1 Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-hdpi/ic_menu_refresh.png differ diff --git a/sherlockprogressfragment-sample/res/drawable-mdpi-v11/ic_menu_refresh.png b/sherlockprogressfragment-sample/res/drawable-mdpi-v11/ic_menu_refresh.png new file mode 100755 index 0000000..a370457 Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-mdpi-v11/ic_menu_refresh.png differ diff --git a/sherlockprogressfragment-sample/res/drawable-mdpi/emo_im_crying.png b/sherlockprogressfragment-sample/res/drawable-mdpi/emo_im_crying.png new file mode 100644 index 0000000..3151125 Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-mdpi/emo_im_crying.png differ diff --git a/sherlockprogressfragment-sample/res/drawable-mdpi/ic_launcher.png b/sherlockprogressfragment-sample/res/drawable-mdpi/ic_launcher.png new file mode 100755 index 0000000..8af11db Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-mdpi/ic_launcher.png differ diff --git a/sherlockprogressfragment-sample/res/drawable-mdpi/ic_menu_refresh.png b/sherlockprogressfragment-sample/res/drawable-mdpi/ic_menu_refresh.png new file mode 100644 index 0000000..c3551be Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-mdpi/ic_menu_refresh.png differ diff --git a/sherlockprogressfragment-sample/res/drawable-xhdpi-v11/ic_menu_refresh.png b/sherlockprogressfragment-sample/res/drawable-xhdpi-v11/ic_menu_refresh.png new file mode 100755 index 0000000..e34cc7b Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-xhdpi-v11/ic_menu_refresh.png differ diff --git a/sherlockprogressfragment-sample/res/drawable-xhdpi/background_card.9.png b/sherlockprogressfragment-sample/res/drawable-xhdpi/background_card.9.png new file mode 100644 index 0000000..8cbd7af Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-xhdpi/background_card.9.png differ diff --git a/sherlockprogressfragment-sample/res/drawable-xhdpi/ic_launcher.png b/sherlockprogressfragment-sample/res/drawable-xhdpi/ic_launcher.png new file mode 100755 index 0000000..307e198 Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-xhdpi/ic_launcher.png differ diff --git a/sherlockprogressfragment-sample/res/drawable-xhdpi/new_york.jpg b/sherlockprogressfragment-sample/res/drawable-xhdpi/new_york.jpg new file mode 100644 index 0000000..a279974 Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-xhdpi/new_york.jpg differ diff --git a/sherlockprogressfragment-sample/res/drawable-xxhdpi/ic_launcher.png b/sherlockprogressfragment-sample/res/drawable-xxhdpi/ic_launcher.png new file mode 100755 index 0000000..069cc2a Binary files /dev/null and b/sherlockprogressfragment-sample/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/sherlockprogressfragment-sample/res/layout/fragment_custom_progress.xml b/sherlockprogressfragment-sample/res/layout/fragment_custom_progress.xml new file mode 100644 index 0000000..e757ea8 --- /dev/null +++ b/sherlockprogressfragment-sample/res/layout/fragment_custom_progress.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sherlockprogressfragment-sample/res/layout/view_content.xml b/sherlockprogressfragment-sample/res/layout/view_content.xml new file mode 100644 index 0000000..2d7a351 --- /dev/null +++ b/sherlockprogressfragment-sample/res/layout/view_content.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sherlockprogressfragment-sample/res/menu/refresh.xml b/sherlockprogressfragment-sample/res/menu/refresh.xml new file mode 100644 index 0000000..02d13fa --- /dev/null +++ b/sherlockprogressfragment-sample/res/menu/refresh.xml @@ -0,0 +1,26 @@ + + + + + + + \ No newline at end of file diff --git a/sherlockprogressfragment-sample/res/values/strings.xml b/sherlockprogressfragment-sample/res/values/strings.xml new file mode 100644 index 0000000..08eae50 --- /dev/null +++ b/sherlockprogressfragment-sample/res/values/strings.xml @@ -0,0 +1,34 @@ + + + + + Android-SherlockProgressFragment + Refresh + New York City + New York is the most populous city in the United States and the center of the New York + Metropolitan Area, one of the most populous urban agglomerations in the world. The city is referred to as New + York City or the City of New York to distinguish it from the State of New York, of which it is a part. A global + power city, New York exerts a significant impact upon commerce, finance, media, art, fashion, research, + technology, education, and entertainment. The home of the United Nations Headquarters, New York is an important + center for international diplomacy and has been described as the cultural capital of the world. + + No Data + Loading… + + + \ No newline at end of file diff --git a/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/CustomLayoutProgressFragment.java b/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/CustomLayoutProgressFragment.java new file mode 100644 index 0000000..9f566b7 --- /dev/null +++ b/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/CustomLayoutProgressFragment.java @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2013 Evgeny Shishkin + * + * 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 com.devspark.progressfragment.sample.sherlock; + +import android.os.Bundle; +import android.os.Handler; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.actionbarsherlock.view.Menu; +import com.actionbarsherlock.view.MenuInflater; +import com.actionbarsherlock.view.MenuItem; +import com.devspark.progressfragment.SherlockProgressFragment; + +/** + * Sample implementation of {@link com.devspark.progressfragment.SherlockProgressFragment}. + * + * @author Evgeny Shishkin + */ +public class CustomLayoutProgressFragment extends SherlockProgressFragment { + private View mContentView; + private Handler mHandler; + private Runnable mShowContentRunnable = new Runnable() { + + @Override + public void run() { + setContentEmpty(true); + setContentShown(true); + } + + }; + + public static CustomLayoutProgressFragment newInstance() { + CustomLayoutProgressFragment fragment = new CustomLayoutProgressFragment(); + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setHasOptionsMenu(true); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + mContentView = inflater.inflate(R.layout.view_content, null); + return inflater.inflate(R.layout.fragment_custom_progress, container, false); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + // Setup content view + setContentView(mContentView); + // Setup text for empty content + setEmptyText(R.string.empty); + obtainData(); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + mHandler.removeCallbacks(mShowContentRunnable); + } + + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + inflater.inflate(R.menu.refresh, menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.menu_refresh: + obtainData(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + private void obtainData() { + // Show indeterminate progress + setContentShown(false); + + mHandler = new Handler(); + mHandler.postDelayed(mShowContentRunnable, 3000); + } +} diff --git a/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/DefaultProgressFragment.java b/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/DefaultProgressFragment.java new file mode 100644 index 0000000..989a82b --- /dev/null +++ b/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/DefaultProgressFragment.java @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2013 Evgeny Shishkin + * + * 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 com.devspark.progressfragment.sample.sherlock; + +import android.os.Bundle; +import android.os.Handler; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.actionbarsherlock.view.Menu; +import com.actionbarsherlock.view.MenuInflater; +import com.actionbarsherlock.view.MenuItem; +import com.devspark.progressfragment.SherlockProgressFragment; + +/** + * Sample implementation of {@link com.devspark.progressfragment.SherlockProgressFragment}. + * + * @author Evgeny Shishkin + */ +public class DefaultProgressFragment extends SherlockProgressFragment { + private View mContentView; + private Handler mHandler; + private Runnable mShowContentRunnable = new Runnable() { + + @Override + public void run() { + setContentShown(true); + } + + }; + + public static DefaultProgressFragment newInstance() { + DefaultProgressFragment fragment = new DefaultProgressFragment(); + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setHasOptionsMenu(true); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + mContentView = inflater.inflate(R.layout.view_content, null); + return super.onCreateView(inflater, container, savedInstanceState); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + // Setup content view + setContentView(mContentView); + // Setup text for empty content + setEmptyText(R.string.empty); + obtainData(); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + mHandler.removeCallbacks(mShowContentRunnable); + } + + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + inflater.inflate(R.menu.refresh, menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.menu_refresh: + obtainData(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + private void obtainData() { + // Show indeterminate progress + setContentShown(false); + + mHandler = new Handler(); + mHandler.postDelayed(mShowContentRunnable, 3000); + } +} diff --git a/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/EmptyContentProgressFragment.java b/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/EmptyContentProgressFragment.java new file mode 100644 index 0000000..4e90677 --- /dev/null +++ b/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/EmptyContentProgressFragment.java @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2013 Evgeny Shishkin + * + * 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 com.devspark.progressfragment.sample.sherlock; + +import android.os.Bundle; +import android.os.Handler; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import com.actionbarsherlock.view.Menu; +import com.actionbarsherlock.view.MenuInflater; +import com.actionbarsherlock.view.MenuItem; +import com.devspark.progressfragment.SherlockProgressFragment; + +/** + * Sample implementation of {@link com.devspark.progressfragment.SherlockProgressFragment}. + * + * @author Evgeny Shishkin + */ +public class EmptyContentProgressFragment extends SherlockProgressFragment { + private View mContentView; + private Handler mHandler; + private Runnable mShowContentRunnable = new Runnable() { + + @Override + public void run() { + setContentEmpty(true); + setContentShown(true); + } + + }; + + public static EmptyContentProgressFragment newInstance() { + EmptyContentProgressFragment fragment = new EmptyContentProgressFragment(); + return fragment; + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setHasOptionsMenu(true); + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + mContentView = inflater.inflate(R.layout.view_content, null); + return super.onCreateView(inflater, container, savedInstanceState); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + // Setup content view + setContentView(mContentView); + // Setup text for empty content + setEmptyText(R.string.empty); + obtainData(); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + mHandler.removeCallbacks(mShowContentRunnable); + } + + @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + inflater.inflate(R.menu.refresh, menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.menu_refresh: + obtainData(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + + private void obtainData() { + // Show indeterminate progress + setContentShown(false); + + mHandler = new Handler(); + mHandler.postDelayed(mShowContentRunnable, 3000); + } +} diff --git a/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/MainActivity.java b/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/MainActivity.java new file mode 100644 index 0000000..215dec8 --- /dev/null +++ b/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/MainActivity.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2013 Evgeny Shishkin + * + * 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 com.devspark.progressfragment.sample.sherlock; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.ListView; + +import com.actionbarsherlock.app.SherlockListActivity; + +/** + * @author Evgeny Shishkin + */ +public class MainActivity extends SherlockListActivity { + + private String[] examples = new String[]{"Default", "Empty content", "Custom layout"}; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + ArrayAdapter arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, examples); + setListAdapter(arrayAdapter); + } + + @Override + protected void onListItemClick(ListView l, View v, int position, long id) { + Intent intent = new Intent(this, ProgressActivity.class); + intent.putExtra(ProgressActivity.EXTRA_TITLE, examples[position]); + switch (position) { + case 0: + intent.putExtra(ProgressActivity.EXTRA_FRAGMENT, ProgressActivity.FRAGMENT_DEFAULT); + break; + case 1: + intent.putExtra(ProgressActivity.EXTRA_FRAGMENT, ProgressActivity.FRAGMENT_EMPTY_CONTENT); + break; + case 2: + intent.putExtra(ProgressActivity.EXTRA_FRAGMENT, ProgressActivity.FRAGMENT_CUSTOM_LAYOUT); + break; + default: + break; + } + startActivity(intent); + } +} diff --git a/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/ProgressActivity.java b/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/ProgressActivity.java new file mode 100644 index 0000000..1e097e1 --- /dev/null +++ b/sherlockprogressfragment-sample/src/com/devspark/progressfragment/sample/sherlock/ProgressActivity.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2013 Evgeny Shishkin + * + * 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 com.devspark.progressfragment.sample.sherlock; + +import android.os.Bundle; +import android.support.v4.app.Fragment; + +import com.actionbarsherlock.app.SherlockFragmentActivity; +import com.actionbarsherlock.view.MenuItem; + +/** + * @author Evgeny Shishkin + */ +public class ProgressActivity extends SherlockFragmentActivity { + public static final String EXTRA_TITLE = "com.github.johnkil.sherlockprogressfragment.gradle.extras.EXTRA_TITLE"; + public static final String EXTRA_FRAGMENT = "com.github.johnkil.sherlockprogressfragment.gradle.extras.EXTRA_FRAGMENT"; + public static final int FRAGMENT_DEFAULT = 0; + public static final int FRAGMENT_EMPTY_CONTENT = 1; + public static final int FRAGMENT_CUSTOM_LAYOUT = 2; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setTitle(getIntent().getStringExtra(EXTRA_TITLE)); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + // Check what fragment is shown, replace if needed. + Fragment fragment = getSupportFragmentManager().findFragmentById(android.R.id.content); + if (fragment == null) { + // Make new fragment to show. + int fragmentId = getIntent().getIntExtra(EXTRA_FRAGMENT, FRAGMENT_DEFAULT); + switch (fragmentId) { + case FRAGMENT_DEFAULT: + fragment = DefaultProgressFragment.newInstance(); + break; + case FRAGMENT_EMPTY_CONTENT: + fragment = EmptyContentProgressFragment.newInstance(); + break; + case FRAGMENT_CUSTOM_LAYOUT: + fragment = CustomLayoutProgressFragment.newInstance(); + break; + default: + fragment = DefaultProgressFragment.newInstance(); + break; + + } + getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit(); + } + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + finish(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + +} diff --git a/sherlockprogressfragment-sample/web_hi_res_512.png b/sherlockprogressfragment-sample/web_hi_res_512.png new file mode 100644 index 0000000..4c5bbc3 Binary files /dev/null and b/sherlockprogressfragment-sample/web_hi_res_512.png differ diff --git a/sherlockprogressfragment/AndroidManifest.xml b/sherlockprogressfragment/AndroidManifest.xml index 963848d..b62ebdc 100644 --- a/sherlockprogressfragment/AndroidManifest.xml +++ b/sherlockprogressfragment/AndroidManifest.xml @@ -1,11 +1,13 @@ + android:versionCode="5" + android:versionName="1.3.1"> + + \ No newline at end of file diff --git a/sherlockprogressfragment/build.gradle b/sherlockprogressfragment/build.gradle new file mode 100644 index 0000000..2c6bae3 --- /dev/null +++ b/sherlockprogressfragment/build.gradle @@ -0,0 +1,22 @@ +apply plugin: 'android-library' + +dependencies { + compile 'com.android.support:support-v4:18.0.0' + compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' +} + +android { + compileSdkVersion 18 + buildToolsVersion '18.1.0' + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + res.srcDirs = ['res'] + } + } +} + +// Used to push in maven +apply from: '../maven_push.gradle' \ No newline at end of file diff --git a/sherlockprogressfragment/gradle.properties b/sherlockprogressfragment/gradle.properties new file mode 100644 index 0000000..e619c6c --- /dev/null +++ b/sherlockprogressfragment/gradle.properties @@ -0,0 +1,3 @@ +POM_NAME=SherlockProgressFragment Library +POM_ARTIFACT_ID=sherlockprogressfragment +POM_PACKAGING=aar \ No newline at end of file diff --git a/sherlockprogressfragment/pom.xml b/sherlockprogressfragment/pom.xml new file mode 100644 index 0000000..1396549 --- /dev/null +++ b/sherlockprogressfragment/pom.xml @@ -0,0 +1,84 @@ + + 4.0.0 + + + com.devspark.progressfragment + parent + 1.3-SNAPSHOT + + + sherlockprogressfragment + apklib + + Android SherlockProgressFragment (Library) + + + + + com.google.android + android + provided + + + com.android.support + support-v4 + + + + + com.actionbarsherlock + actionbarsherlock + apklib + + + + + src + + + com.jayway.maven.plugins.android.generation2 + android-maven-plugin + true + + + runLint + compile + + lint + + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + attach-javadocs + + jar + + + true + + + + + + + + \ No newline at end of file diff --git a/sherlockprogressfragment/project.properties b/sherlockprogressfragment/project.properties index 9121187..4a46b9d 100644 --- a/sherlockprogressfragment/project.properties +++ b/sherlockprogressfragment/project.properties @@ -13,4 +13,3 @@ android.library=true # Project target. target=android-17 -android.library.reference.1=../../ActionBarSherlock/actionbarsherlock