Page MenuHomeGitPull.it

No OneTemporary

Authored By
Unknown
Size
67 KB
Referenced Files
None
Subscribers
None
diff --git a/.bzrignore b/.bzrignore
index fcf06f2f..56406708 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1,5 +1,10 @@
gen
bin
assets
libs
.settings
+local.properties
+.gradle
+.idea/workspace.xml
+.idea/libraries
+build
diff --git a/.classpath b/.classpath
index 59cebc08..1457e3c3 100644
--- a/.classpath
+++ b/.classpath
@@ -1,30 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
-
- <classpathentry
- kind="con"
- path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK" />
-
- <classpathentry
- exported="true"
- kind="con"
- path="com.android.ide.eclipse.adt.DEPENDENCIES" />
-
- <classpathentry
- exported="true"
- kind="con"
- path="com.android.ide.eclipse.adt.LIBRARIES" />
-
- <classpathentry
- kind="src"
- path="src" />
-
- <classpathentry
- kind="src"
- path="gen" />
-
- <classpathentry
- kind="output"
- path="bin/classes" />
-
-</classpath>
\ No newline at end of file
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
+ <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
+ <classpathentry kind="output" path="bin/classes"/>
+</classpath>
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 00000000..f9a37449
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+bus-torino
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 00000000..217af471
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <resourceExtensions />
+ <wildcardResourcePatterns>
+ <entry name="!?*.java" />
+ <entry name="!?*.form" />
+ <entry name="!?*.class" />
+ <entry name="!?*.groovy" />
+ <entry name="!?*.scala" />
+ <entry name="!?*.flex" />
+ <entry name="!?*.kt" />
+ <entry name="!?*.clj" />
+ </wildcardResourcePatterns>
+ <annotationProcessing>
+ <profile default="true" name="Default" enabled="false">
+ <processorPath useClasspath="true" />
+ </profile>
+ </annotationProcessing>
+ </component>
+</project>
+
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 00000000..e7bedf33
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+<component name="CopyrightManager">
+ <settings default="" />
+</component>
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 00000000..e206d70d
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+</project>
+
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 00000000..2caec4fa
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="GradleSettings">
+ <option name="linkedExternalProjectsSettings">
+ <GradleProjectSettings>
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
+ <option name="modules">
+ <set>
+ <option value="$PROJECT_DIR$" />
+ </set>
+ </option>
+ </GradleProjectSettings>
+ </option>
+ </component>
+</project>
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000..848eb1ef
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
+ <output url="file://$PROJECT_DIR$/build/classes" />
+ </component>
+</project>
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..d7ee6c51
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/bus-torino.iml" filepath="$PROJECT_DIR$/bus-torino.iml" />
+ </modules>
+ </component>
+</project>
+
diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml
new file mode 100644
index 00000000..922003b8
--- /dev/null
+++ b/.idea/scopes/scope_settings.xml
@@ -0,0 +1,5 @@
+<component name="DependencyValidationManager">
+ <state>
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </state>
+</component>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..def6a6a1
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ </component>
+</project>
+
diff --git a/build.gradle b/build.gradle
index e11b7a90..12cefdc7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,52 +1,53 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
lintOptions {
abortOnError false
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
compile 'com.android.support:support-v4:21.0.+'
compile 'com.android.support:appcompat-v7:21.0.+'
+ compile 'com.melnykov:floatingactionbutton:1.1.0'
}
}
\ No newline at end of file
diff --git a/bus-torino.iml b/bus-torino.iml
new file mode 100644
index 00000000..4c81aabe
--- /dev/null
+++ b/bus-torino.iml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="android-gradle" name="Android-Gradle">
+ <configuration>
+ <option name="GRADLE_PROJECT_PATH" value=":" />
+ </configuration>
+ </facet>
+ <facet type="android" name="Android">
+ <configuration>
+ <option name="SELECTED_BUILD_VARIANT" value="debug" />
+ <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
+ <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugJava" />
+ <option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
+ <option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
+ <option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
+ <option name="ALLOW_USER_CONFIGURATION" value="false" />
+ <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/res" />
+ </configuration>
+ </facet>
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
+ <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/assets" type="java-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
+ <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
+ <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
+ <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
+ </content>
+ <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" exported="" name="recyclerview-v7-21.0.0" level="project" />
+ <orderEntry type="library" exported="" name="floatingactionbutton-1.1.0" level="project" />
+ <orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
+ <orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
+ <orderEntry type="library" exported="" name="library-2.4.0" level="project" />
+ <orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" />
+ </component>
+</module>
+
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100755
index 00000000..8c0fb64a
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 100755
index 00000000..f7f483b9
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Tue Jan 20 22:06:47 CET 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 00000000..91a7e269
--- /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 100755
index 00000000..aec99730
--- /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
index f74b9d7e..b3da2954 100644
--- a/project.properties
+++ b/project.properties
@@ -1,15 +1,15 @@
# 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-21
-android.library.reference.1=../workspace/android-support-v7-appcompat
+android.library.reference.1=../../EclipseWorkspace/android-support-v7-appcompat
diff --git a/res/drawable-hdpi/ic_add_black_24dp.png b/res/drawable-hdpi/ic_add_black_24dp.png
new file mode 100644
index 00000000..a48d4000
Binary files /dev/null and b/res/drawable-hdpi/ic_add_black_24dp.png differ
diff --git a/res/drawable-hdpi/ic_add_white_24dp.png b/res/drawable-hdpi/ic_add_white_24dp.png
new file mode 100644
index 00000000..481643ec
Binary files /dev/null and b/res/drawable-hdpi/ic_add_white_24dp.png differ
diff --git a/res/drawable-hdpi/ic_keyboard_black_24dp.png b/res/drawable-hdpi/ic_keyboard_black_24dp.png
new file mode 100644
index 00000000..b5ab2eb2
Binary files /dev/null and b/res/drawable-hdpi/ic_keyboard_black_24dp.png differ
diff --git a/res/drawable-hdpi/ic_keyboard_white_24dp.png b/res/drawable-hdpi/ic_keyboard_white_24dp.png
new file mode 100644
index 00000000..9a664618
Binary files /dev/null and b/res/drawable-hdpi/ic_keyboard_white_24dp.png differ
diff --git a/res/drawable-hdpi/ic_looks_one_black_24dp.png b/res/drawable-hdpi/ic_looks_one_black_24dp.png
new file mode 100644
index 00000000..5a86b268
Binary files /dev/null and b/res/drawable-hdpi/ic_looks_one_black_24dp.png differ
diff --git a/res/drawable-hdpi/ic_looks_one_white_24dp.png b/res/drawable-hdpi/ic_looks_one_white_24dp.png
new file mode 100644
index 00000000..c0875723
Binary files /dev/null and b/res/drawable-hdpi/ic_looks_one_white_24dp.png differ
diff --git a/res/drawable-xxxhdpi/changetochar.xml b/res/drawable-xxxhdpi/changetochar.xml
deleted file mode 100644
index 2e41f644..00000000
--- a/res/drawable-xxxhdpi/changetochar.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:drawable="@drawable/changetochar_pressed" android:state_pressed="true"/>
- <item android:drawable="@drawable/changetochar_pressed" android:state_focused="true"/>
- <item android:drawable="@drawable/changetochar_default"/>
-
-</selector>
\ No newline at end of file
diff --git a/res/drawable-xxxhdpi/changetochar_default.png b/res/drawable-xxxhdpi/changetochar_default.png
deleted file mode 100644
index 38dab9a9..00000000
Binary files a/res/drawable-xxxhdpi/changetochar_default.png and /dev/null differ
diff --git a/res/drawable-xxxhdpi/changetochar_pressed.png b/res/drawable-xxxhdpi/changetochar_pressed.png
deleted file mode 100644
index 8d41f1ff..00000000
Binary files a/res/drawable-xxxhdpi/changetochar_pressed.png and /dev/null differ
diff --git a/res/drawable-xxxhdpi/changetoint.xml b/res/drawable-xxxhdpi/changetoint.xml
deleted file mode 100644
index bea3684c..00000000
--- a/res/drawable-xxxhdpi/changetoint.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:drawable="@drawable/changetoint_pressed" android:state_pressed="true"/>
- <item android:drawable="@drawable/changetoint_pressed" android:state_focused="true"/>
- <item android:drawable="@drawable/changetoint_default"/>
-
-</selector>
\ No newline at end of file
diff --git a/res/drawable-xxxhdpi/changetoint_default.png b/res/drawable-xxxhdpi/changetoint_default.png
deleted file mode 100644
index 08385392..00000000
Binary files a/res/drawable-xxxhdpi/changetoint_default.png and /dev/null differ
diff --git a/res/drawable-xxxhdpi/changetoint_pressed.png b/res/drawable-xxxhdpi/changetoint_pressed.png
deleted file mode 100644
index 6d81e74f..00000000
Binary files a/res/drawable-xxxhdpi/changetoint_pressed.png and /dev/null differ
diff --git a/res/drawable-xxxhdpi/shadow.png b/res/drawable-xxxhdpi/shadow.png
deleted file mode 100644
index 3db28cb0..00000000
Binary files a/res/drawable-xxxhdpi/shadow.png and /dev/null differ
diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml
index 5ab9708f..2d7945c7 100644
--- a/res/layout/activity_main.xml
+++ b/res/layout/activity_main.xml
@@ -1,198 +1,170 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
+ xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="it.reyboz.bustorino.MainActivity" >
<!--
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="14dip" -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true" >
<EditText
android:id="@+id/busStopSearchByIDEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/searchButton"
android:layout_toStartOf="@+id/searchButton"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="16dip"
android:layout_marginRight="5dip"
android:layout_marginEnd="5dp"
android:ems="10"
android:hint="@string/insert_bus_stop_number"
android:imeOptions="actionSearch"
android:inputType="number"
android:singleLine="true" >
<requestFocus>
</requestFocus>
</EditText>
<EditText
android:id="@+id/busStopSearchByNameEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/searchButton"
android:layout_toStartOf="@+id/searchButton"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="16dip"
android:layout_marginRight="5dip"
android:layout_marginEnd="5dp"
android:ems="10"
android:hint="@string/insert_bus_stop_name"
android:imeOptions="actionSearch"
android:singleLine="true"
android:visibility="gone" >
<requestFocus>
</requestFocus>
</EditText>
<ImageButton
android:id="@+id/searchButton"
style="?android:attr/borderlessButtonStyle"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_marginRight="16dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/busStopSearchByIDEditText"
android:background="@drawable/search_button_custom"
android:contentDescription="@string/search"
android:onClick="onSearchClick" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dip"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/searchButton"
android:indeterminateOnly="true"
android:visibility="gone" />
<TextView
android:id="@+id/busStopNameTextView"
android:layout_width="wrap_content"
android:layout_height="48dip"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dip"
android:layout_marginTop="10dp"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/searchButton"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:gravity="center_vertical"
android:onClick="addInFavorites"
android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="gone" />
<TextView
android:id="@+id/howDoesItWorkTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/hideHintButton"
android:layout_below="@+id/busStopNameTextView"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dip"
- android:layout_marginEnd="16dp"
android:layout_marginBottom="10dp"
android:text="@string/howDoesItWork"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/blue_500"
android:visibility="gone" />
<Button
android:id="@+id/hideHintButton"
style="?android:attr/buttonStyleSmall"
android:layout_width="85dip"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
- android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
- android:layout_marginEnd="16dp"
android:layout_alignBottom="@+id/howDoesItWorkTextView"
android:background="@drawable/bus_background"
android:text="@string/hint_button"
android:textColor="@color/grey_100"
android:textSize="19sp"
android:visibility="gone"
android:onClick="onHideHint" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:animateLayoutChanges="true"
- android:layout_below="@+id/busStopNameTextView"
+ android:layout_below="@+id/howDoesItWorkTextView"
android:visibility="gone" >
- <it.reyboz.bustorino.MyListView
+ <ListView
android:id="@+id/resultsListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" >
- </it.reyboz.bustorino.MyListView>
+ </ListView>
+
</android.support.v4.widget.SwipeRefreshLayout>
+
+ <com.melnykov.fab.FloatingActionButton
+ android:id="@+id/floatingActionButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="16dp"
+ android:layout_gravity="bottom|right"
+ android:src="@drawable/ic_keyboard_white_24dp"
+ fab:fab_colorNormal="@color/orange_500"
+ fab:fab_colorPressed="@color/orange_700"
+ fab:fab_colorRipple="@color/accent"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentEnd="true"
+ android:onClick="onToggleKeyboardLayout"/>
</RelativeLayout>
-
- <RelativeLayout
- android:animateLayoutChanges="false"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentEnd="true"
- android:layout_alignParentRight="true"
- android:layout_alignParentBottom="true" >
-
- <Button
- android:id="@+id/changeKeyboardToBusStopIDFloatingButton"
- android:layout_height="56dip"
- android:layout_width="56dip"
- android:background="@drawable/changetochar"
- android:layout_marginBottom="16dp"
- android:layout_marginRight="16dp"
- android:clickable="true"
- android:onClick="onChangeKeyboardToBusStopName"
- android:visibility="visible" />
-
- <Button
- android:id="@+id/changeKeyboardToBusStopNameFloatingButton"
- android:layout_height="56dip"
- android:layout_width="56dip"
- android:background="@drawable/changetoint"
- android:layout_marginBottom="16dp"
- android:layout_marginRight="16dp"
- android:clickable="true"
- android:onClick="onChangeKeyboardToBusStopID"
- android:visibility="gone" />
-
- <ImageView
- android:id="@+id/shadowFloatingButton"
- android:layout_width="58dip"
- android:layout_height="58dip"
- android:layout_marginRight="14dp"
- android:layout_marginBottom="14dp"
- android:animateLayoutChanges="false"
- android:background="@drawable/shadow"
- android:visibility="visible" />
-
- </RelativeLayout>
</RelativeLayout>
\ No newline at end of file
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index 70214367..844f1b0a 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -1,70 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_description">Stai utilizzando l\'ultimo ritrovato in materia di rispetto della tua privacy.</string>
<string name="search">Cerca</string>
<string name="insert_bus_stop_number">Numero fermata</string>
<string name="insert_bus_stop_name">Nome fermata</string>
<string name="insert_bus_stop_number_error">Inserisci il numero della fermata</string>
<string name="encoding_error">Alcuni caratteri non sono stati riconosciuti</string>
<string name="network_error">Verifica l\'accesso ad Internet!</string>
<string name="no_arrival_times">Nessun arrivo previsto per questa fermata</string>
<string name="passages">Fermata: %1$s</string>
<string name="lines">Linee: %1$s</string>
<string name="results">Risultati…</string>
<string name="no_passages">Nessun passaggio</string>
<string name="action_about">Informazioni</string>
<string name="action_favorites">Preferiti</string>
<string name="added_in_favorites">Fermata aggiunta ai preferiti</string>
<string name="title_activity_favorites">Preferiti</string>
<string name="tip_add_favorite">Premi sul nome di una fermata per inserirla in questa lista</string>
<string name="action_remove_from_favourites">Rimuovi</string>
<string name="about">Informazioni</string>
<string name="howDoesItWork">- <b>Premi sul nome della fermata</b> per aggiungerla ai preferiti.\n- <b>Come leggere gli orari:</b>\n<b>&#160;&#160;&#160;12:56*</b> Orario in tempo reale\n<b>&#160;&#160;&#160;12:56</b> &#160; Orario programmato\n- <b>Trascina giù per aggiornare</b> l\'orario.</string>
<string name="hint_button">OK !</string>
<string name="action_help">Aiuto</string>
<string name="about_history">
<![CDATA[
<h1>Benvenuto!</h1>
<p>Grazie per aver scelto BusTO, un\'app <b>indipendente</b> nata dalla necessità di spostarsi a Torino attraverso <b>software libero</b>:</p>
<p>Perchè usare BusTO?</p>
<p>
- Non sei <b>monitorato</b><br>
- Non ci sono <b>pubblicità</b><br>
- La tua <b>privacy</b> è al sicuro<br>
- Inoltre l\'app è molto leggera!<br>
</p>
<h2>Come Funziona?</h2>
<p>Quest\'app ottiene i passaggi dei bus in tempo reale filtrando i dati forniti pubblicamente sul sito <i>www.5t.torino.it</i> «per uso personale».</p>
<p>Ingredienti:<br>
- <b>Valerio Bozzolan</b> come sviluppatore principale.<br>
- <b>Marco Gagino</b> come intenso collaboratore.<br>
- <b>Paolo Alloatti</b> per l\'idea dell\'icona.<br>
- - <b>JSoup</b> libreria per "<i>web scaping</i>"<br>
+ - <b>JSoup</b> libreria per "<i>web scaping</i>".<br>
+ - <b>makovkastar</b> per i floating button.<br>
+ - <b>Google</b> per le icone Material Design.</br>
E tutti i contributori!
</p>
<h2>Licenze</h2>
<p>L\'app e il relativo codice sorgente sono distribuiti sotto doppia licenza:
<i>GNU GPL</i> e <i>CC By-Sa</i>.
Ciò <b>significa</b> che puoi usare, studiare, migliorare e ricondividere quest\'app con <b>qualunque mezzo</b> e per <b>qualsiasi scopo</b>: a patto di mantenere sempre questi diritti a tua volta e di attribuire sempre a Valerio Bozzolan gli \"sforzi\" per il codice sorgente.
</p>
<h2>Note</h2>
<p>Quest\'applicazione è rilasciata <b>nella speranza che sia utile a tutti</b> ma senza alcuna garanzia.</p>
<p>Invio di bugs/idee: <a href="https://bugs.launchpad.net/bus-torino">lamentati qui</a>.</p>
<p>Codice sorgente: <a href="https://code.launchpad.net/bus-torino">lp:bus-torino</a>.</p>
<p>Cosa è cambiato: <a href="http://bustorino.reyboz.it/CONTRIBUTORS_AND_CHANGES.txt">changes.txt</a></p>
<p>Contatta l\'autore: <a href="mailto:valerio.bozzolan@studenti.polito.it?subject=BusTO">Valerio Bozzolan</a>.</p>
<p>Buon utilizzo! :)</p>
]]>
</string>
-</resources>
\ No newline at end of file
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d4d507f3..3be1d0c5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,66 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">BusTO</string>
<string name="app_description">Stai utilizzando l\'ultimo ritrovato in materia di rispetto della tua privacy.</string>
<string name="search">Search</string>
<string name="insert_bus_stop_number">Bus stop number</string>
<string name="insert_bus_stop_name">Bus stop name</string>
<string name="insert_bus_stop_number_error">Insert bus stop number</string>
<string name="encoding_error">Sorry but you are using not allowed characters</string>
<string name="network_error">Verify the state of your Internet connection!</string>
<string name="no_arrival_times">No bus is supposed to arrive at this stop</string>
<string name="passages">Arrivals at: %1$s</string>
<string name="results">Search results…</string>
<string name="lines">Lines: %1$s</string>
<string name="no_passages">No passages</string>
<string name="action_about">About</string>
<string name="action_favorites">Favorites</string>
<string name="added_in_favorites">Bus stop is now in your favorites</string>
<string name="title_activity_favorites">Favorites</string>
<string name="tip_add_favorite">Press on a bus stop name to populate this list</string>
<string name="action_remove_from_favourites">Delete</string>
<string name="about">About</string>
<string name="howDoesItWork">- <b>Press on the bus stop name</b> above to add it to the favourites.\n- <b>How to read timelines:</b>\n<b>&#160;&#160;&#160;12:56*</b> Real time arrival\n<b>&#160;&#160;&#160;12:56</b> &#160; Scheduled time of arrival\n- <b>Pull down to refresh</b> the timetable.</string>
<string name="hint_button">GOT IT!</string>
<string name="action_help">Help</string>
<string name="about_history">
<![CDATA[
<h1>Welcome!</h1>
<p>Thanks for using BusTO, an <b>indipendent</b> app useful to move around Torino using a <b>Free/Libre and Open Source software</b>.</p>
<p>Why using this app?</p>
<p>
- You\'ll never be <b>tracked</b><br>
- You\'ll never see boring <b>ads</b><br>
- We\'ll always respect your <b>privacy</b><br>
- Moreover, it\'s lightweight!<br>
</p>
<h2>How does it work?</h2>
<p>This app will show you the timetable of the buses using the information published on the site <b>http://www.5t.torino.it</b>.</p>
<p>Who worked on BusTO:<br>
- <b>Valerio Bozzolan</b>, the main developer.<br>
- <b>Marco Gagino</b>, contributor.<br>
- <b>Paolo Alloatti</b>, the concept of the icon.<br>
+ - <b>JSoup</b> for the web scraper library.<br>
+ - <b>makovkastar</b> for the floating buttons.<br>
+ - <b>Google</b> for Material Design icons.<br>
+
Thanks to all the contributors!
</p>
<h2>Licenses</h2>
<p>The app and the related source code are released by <a href="mailto:valerio.bozzolan@studenti.polito.it?subject=BusTO">Valerio Bozzolan</a> under the terms of two different licences:
the <i>Gnu General Public License v3+</i> (<a href="http://www.gnu.org/licenses/gpl.html">GNU GPLv3+</a>) and the <i>Creative Commons Attribution - Share alike 4.0 International</i> (<a href="http://creativecommons.org/licenses/by-sa/4.0/deed.en">CC 4.0 By-Sa</a>).
So everyone is allowed to use, to study, to improve and to share this app by <b>any kind of means</b> and for <b>any purpose</b>: under the conditions of manteining this rights and of attributing the original source code to Valerio Bozzolan.</p>
<h2>Notes</h2>
<p>This app has been developed <b>hoping to be useful to everyone</b> but without any warranty (such as commercial warranties). If you discover some bugs or if you have some idea, please <a href="https://bugs.launchpad.net/bus-torino">report them</a>.</p>
>
<p>Source code: <a href="https://code.launchpad.net/bus-torino">lp:bus-torino</a>.</p>
<p>Mail the author: <a href="mailto:valerio.bozzolan@studenti.polito.it?subject=BusTO">Valerio Bozzolan</a>.</p>
<p>This translation is kindly provided by Riccardo Caniato and Marco Gagino.</p>
]]>
</string>
-</resources>
\ No newline at end of file
+</resources>
diff --git a/src/it/reyboz/bustorino/MainActivity.java b/src/it/reyboz/bustorino/MainActivity.java
index d22705d1..da930d8f 100644
--- a/src/it/reyboz/bustorino/MainActivity.java
+++ b/src/it/reyboz/bustorino/MainActivity.java
@@ -1,534 +1,505 @@
/*
BusTO - Arrival times for Turin public transports.
Copyright (C) 2014 Valerio Bozzolan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package it.reyboz.bustorino;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import it.reyboz.bustorino.GTTSiteSucker.BusLine;
import it.reyboz.bustorino.GTTSiteSucker.BusStop;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
+import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import android.view.KeyEvent;
+import com.melnykov.fab.FloatingActionButton;
public class MainActivity extends ActionBarActivity {
private final boolean DOUBLE_SPINNER = true;
private final boolean NORMAL_SPINNER = false;
/*
* Various layout elements
*/
private EditText busStopSearchByIDEditText;
private EditText busStopSearchByNameEditText;
private TextView busStopNameTextView;
private ProgressBar progressBar;
private TextView howDoesItWorkTextView;
private Button hideHintButton;
private MenuItem actionHelpMenuItem;
- private it.reyboz.bustorino.MyListView resultsListView;
+ private ListView resultsListView;
private SwipeRefreshLayout swipeRefreshLayout;
- private Button changeKeyboardToBusStopIDFloatingButton;
- private Button changeKeyboardToBusStopNameFloatingButton;
- private ImageView shadowFloatingButton;
+ private FloatingActionButton floatingActionButton;
/*
* @see swipeRefreshLayout
*/
private Handler handler = new Handler();
private final Runnable refreshing = new Runnable() {
public void run() {
runSearchTask(String.valueOf(lastSearchedBusStopID), DOUBLE_SPINNER);
}
};
/**
* Last successfully searched bus stop ID
*/
private Integer lastSearchedBusStopID;
private final boolean SEARCH_BY_ID = true;
private final boolean SEARCH_BY_NAME = false;
private boolean searchMode;
- private final boolean SCROLL_UP = true;
- private final boolean SCROLL_DOWN = false;
- private boolean lastScrollDirection = SCROLL_UP; // Workaround :)
-
private MyAsyncWget myAsyncWget;
private MyDB mDbHelper;
private SQLiteDatabase db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
busStopSearchByIDEditText = (EditText) findViewById(R.id.busStopSearchByIDEditText);
busStopSearchByNameEditText = (EditText) findViewById(R.id.busStopSearchByNameEditText);
busStopNameTextView = (TextView) findViewById(R.id.busStopNameTextView);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
howDoesItWorkTextView = (TextView) findViewById(R.id.howDoesItWorkTextView);
hideHintButton = (Button) findViewById(R.id.hideHintButton);
- resultsListView = (it.reyboz.bustorino.MyListView) findViewById(R.id.resultsListView);
+ resultsListView = (ListView) findViewById(R.id.resultsListView);
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);
- changeKeyboardToBusStopIDFloatingButton = (Button) findViewById(R.id.changeKeyboardToBusStopIDFloatingButton);
- changeKeyboardToBusStopNameFloatingButton = (Button) findViewById(R.id.changeKeyboardToBusStopNameFloatingButton);
- shadowFloatingButton = (ImageView) findViewById(R.id.shadowFloatingButton);
+ floatingActionButton = (FloatingActionButton) findViewById(R.id.floatingActionButton);
myAsyncWget = new MyAsyncWget();
+ floatingActionButton.attachToListView(resultsListView);
+
// IME_ACTION_SEARCH keyboard option
busStopSearchByIDEditText
.setOnEditorActionListener(new TextView.OnEditorActionListener() {
- @Override
- public boolean onEditorAction(TextView v, int actionId,
- KeyEvent event) {
- if (actionId == EditorInfo.IME_ACTION_SEARCH) {
- onSearchClick(v);
- return true;
- }
- return false;
- }
- });
+ @Override
+ public boolean onEditorAction(TextView v, int actionId,
+ KeyEvent event) {
+ if (actionId == EditorInfo.IME_ACTION_SEARCH) {
+ onSearchClick(v);
+ return true;
+ }
+ return false;
+ }
+ });
// IME_ACTION_SEARCH keyboard option
busStopSearchByNameEditText
.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
onSearchClick(v);
return true;
}
return false;
}
});
// Get database in write mode
mDbHelper = new MyDB(this);
db = mDbHelper.getWritableDatabase();
// Called when the layout is pulled down
swipeRefreshLayout
.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
handler.post(refreshing);
}
});
/**
* Deprecated! D:
*
* @author Marco Gagino!!!
* @deprecated
* @see https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html#setColorSchemeResources%28int...%29
*/
swipeRefreshLayout.setColorScheme(R.color.blue_500, R.color.orange_500);
- resultsListView.setOnDetectScrollListener(new OnDetectScrollListener() {
- @Override
- public void onUpScrolling() {
- notifyScrollToFloatingButton(SCROLL_UP);
- lastScrollDirection = SCROLL_UP;
- }
-
- @Override
- public void onDownScrolling() {
- notifyScrollToFloatingButton(SCROLL_DOWN);
- lastScrollDirection = SCROLL_DOWN;
- }
- });
-
+ searchMode = SEARCH_BY_ID;
setSearchModeBusStopID();
// Intercept calls from other activities
Bundle b = getIntent().getExtras();
if (b != null) {
String busStopID = b.getString("busStopID");
if (busStopID != null) {
busStopSearchByIDEditText.setText(busStopID);
runSearchTask(busStopID, NORMAL_SPINNER);
}
} else {
showKeyboard();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
actionHelpMenuItem = menu.findItem(R.id.action_help);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
switch (item.getItemId()) {
case R.id.action_about:
startActivity(new Intent(MainActivity.this, AboutActivity.class));
return true;
case R.id.action_favorites:
startActivity(new Intent(MainActivity.this, FavoritesActivity.class));
return true;
case R.id.action_help:
showHints();
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* Catch the Async action!
*
* @author boz
*/
public class MyAsyncWget extends AsyncWget {
protected void onPostExecute(String htmlResponse) {
// Network errors?
if (htmlResponse == null || exceptions != null) {
NetworkTools.showNetworkError(MainActivity.this);
hideSpinner();
Log.e("MainActivity", "Network error!");
return;
}
// Try parsing arrivals
BusStop[] busStops = GTTSiteSucker.getBusStopsSuckingHTML(db,
htmlResponse);
// Parse errors?
if (busStops == null || busStops.length == 0) {
Toast.makeText(getApplicationContext(),
R.string.no_arrival_times, Toast.LENGTH_SHORT).show();
hideSpinner();
Log.e("MainActivity", "Parse error! htmlResponse: "
+ htmlResponse);
} else if(busStops.length == 1) {
// There is only one bus stop to show
BusStop busStop = busStops[0];
// Order bus lines by first arrival time :D
busStop.orderBusLinesByFirstArrival();
// Remember as last successfully searched busStopID
Integer busStopID = busStop.getBusStopID();
lastSearchedBusStopID = busStopID;
// Retrieve passages
BusLine[] busLines = busStop.getBusLines();
// No passages?
if (busLines.length == 0) {
Toast.makeText(getApplicationContext(),
R.string.no_arrival_times, Toast.LENGTH_SHORT).show();
hideSpinner();
Log.d("MainActivity", "No passages!");
return;
}
String busStopName = busStop.getBusStopName();
String busStopNameDisplay;
if (busStopName == null) {
busStopNameDisplay = String.valueOf(busStopID);
} else {
busStopNameDisplay = busStopName;
}
busStopNameTextView.setText(String.format(
getString(R.string.passages), busStopNameDisplay));
// Insert GTTBusStop info in the DB
MyDB.BusStop.addBusStop(db, busStopID, busStopName);
// Populate the stupid ListView SimpleAdapter
ArrayList<HashMap<String, Object>> entries = new ArrayList<HashMap<String, Object>>();
for (BusLine busLine : busLines) {
HashMap<String, Object> entry = new HashMap<String, Object>();
String passages = busLine.getTimePassagesString();
if (passages == null) {
passages = getString(R.string.no_passages);
}
entry.put("icon", busLine.getBusLineName());
entry.put("passages", passages);
entries.add(entry);
}
// Hide the keyboard before showing passages
hideKeyboard();
// Shows hints
if (getOption("show_legend", true)) {
showHints();
} else {
hideHints();
}
-
+ busStopNameTextView.setVisibility(View.VISIBLE);
swipeRefreshLayout.setEnabled(true);
swipeRefreshLayout.setVisibility(View.VISIBLE);
resultsListView.setVisibility(View.VISIBLE);
// Stops spinner
hideSpinner();
// Show results using the stupid SimpleAdapter
String[] from = { "icon", "passages" };
int[] to = { R.id.busLineIcon, R.id.busLineNames };
SimpleAdapter adapter = new SimpleAdapter(getApplicationContext(),
entries, R.layout.bus_line_passage_entry, from, to);
resultsListView.setAdapter(adapter);
resultsListView.invalidate();
resultsListView
.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> av, View view,
int i, long l) {
String busLine = ((TextView) av.getChildAt(i)
.findViewById(R.id.busLineIcon)).getText()
.toString();
Log.d("MainActivity", "Tapped busLine: " + busLine);
}
});
} else {
// Show a list of bus stops
// Populate the stupid ListView SimpleAdapter
ArrayList<HashMap<String, Object>> data = new ArrayList<HashMap<String, Object>>();
for(int i=0; i<busStops.length; i++) {
HashMap<String, Object> singleEntry = new HashMap<String, Object>();
busStops[i].orderBusLinesByName();
int busStopID = busStops[i].getBusStopID();
String busStopName = busStops[i].getBusStopName();
String busLineNames = busStops[i].toString();
singleEntry.put("bus-stop-ID", busStopID);
singleEntry.put("bus-stop-name", busStopName);
singleEntry.put("bus-line-names", String.format(getResources()
.getString(R.string.lines), "\n" + busLineNames));
data.add(singleEntry);
}
// Hide the keyboard before showing bus stops
hideKeyboard();
- busStopNameTextView.setText(getString(R.string.results));
+ /* busStopNameTextView.setText(getString(R.string.results));
+ * con questo non funziona piu' il salvataggio delle fermate nei preferiti
+ * (e' scomparso per un altro motivo, in activity_main.xml)
+ * */
+ busStopNameTextView.setVisibility(View.GONE);
swipeRefreshLayout.setEnabled(false);
swipeRefreshLayout.setVisibility(View.VISIBLE);
resultsListView.setVisibility(View.VISIBLE);
// Stops spinner
hideSpinner();
// Show results
String[] from = { "bus-stop-ID", "bus-stop-name", "bus-line-names" };
int[] to = { R.id.busStopID, R.id.busStopName, R.id.busLineNames };
SimpleAdapter adapter = new SimpleAdapter(getApplicationContext(),
data, R.layout.bus_stop_entry, from, to);
resultsListView.setAdapter(adapter);
resultsListView
.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> av, View view,
int i, long l) {
String busStopID = ((TextView) view
.findViewById(R.id.busStopID)).getText()
.toString();
Log.d("MainActivity", "Tapped on bus stop ID: "
+ busStopID);
setSearchModeBusStopID();
busStopSearchByIDEditText.setText(busStopID);
runSearchTask(busStopID, NORMAL_SPINNER);
}
});
}
}
}
public void onSearchClick(View v) {
String query;
if (searchMode == SEARCH_BY_ID) {
query = busStopSearchByIDEditText.getText().toString();
} else {
query = busStopSearchByNameEditText.getText().toString();
}
runSearchTask(query, NORMAL_SPINNER);
}
public void onHideHint(View v) {
hideHints();
setOption("show_legend", false);
}
+ public void onToggleKeyboardLayout(View v) {
+ searchMode = !searchMode;
+ if(searchMode == SEARCH_BY_ID) {
+ setSearchModeBusStopID();
+ if (busStopSearchByIDEditText.requestFocus()) {
+ showKeyboard();
+ }
+ } else {
+ setSearchModeBusStopName();
+ if (busStopSearchByNameEditText.requestFocus()) {
+ showKeyboard();
+ }
+ }
+ }
+
public void runSearchTask(String busStopQuery, boolean spinnerType) {
if (busStopQuery.isEmpty()) {
Toast.makeText(getApplicationContext(),
R.string.insert_bus_stop_number_error, Toast.LENGTH_SHORT)
.show();
return;
} else if (!NetworkTools.isConnected(this)) {
NetworkTools.showNetworkError(this);
return;
} else {
showSpinner(spinnerType);
myAsyncWget.cancel(true);
myAsyncWget = new MyAsyncWget();
try {
myAsyncWget.execute(GTTSiteSucker
.busLinesByQuery(busStopQuery));
} catch (UnsupportedEncodingException e) {
Toast.makeText(getApplicationContext(),
R.string.encoding_error, Toast.LENGTH_SHORT).show();
}
}
}
public void addInFavorites(View v) {
if (lastSearchedBusStopID != null) {
ContentValues newValues = new ContentValues();
newValues.put(MyDB.BusStop.COLUMN_NAME_BUSSTOP_ISFAVORITE, 1);
db.update(MyDB.BusStop.TABLE_NAME, newValues, MyDB
.somethingEqualsInt(MyDB.BusStop.COLUMN_NAME_BUSSTOP_ID),
new String[] { String.valueOf(lastSearchedBusStopID) });
Toast.makeText(getApplicationContext(),
R.string.added_in_favorites, Toast.LENGTH_SHORT).show();
}
}
private void setOption(String optionName, boolean value) {
SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit();
editor.putBoolean(optionName, value);
editor.commit();
}
private boolean getOption(String optionName, boolean optDefault) {
SharedPreferences preferences = getPreferences(MODE_PRIVATE);
return preferences.getBoolean(optionName, optDefault);
}
private void showKeyboard() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(busStopSearchByNameEditText,
InputMethodManager.SHOW_IMPLICIT);
}
private void hideKeyboard() {
View view = getCurrentFocus();
if (view != null) {
((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(view.getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
}
}
- public void onChangeKeyboardToBusStopName(View v) {
- setSearchModeBusStopName();
- if (busStopSearchByNameEditText.requestFocus()) {
- showKeyboard();
- }
- }
-
- public void onChangeKeyboardToBusStopID(View v) {
- setSearchModeBusStopID();
- if (busStopSearchByIDEditText.requestFocus()) {
- showKeyboard();
- }
- }
-
private void setSearchModeBusStopID() {
- searchMode = SEARCH_BY_ID;
busStopSearchByNameEditText.setVisibility(View.GONE);
busStopSearchByIDEditText.setVisibility(View.VISIBLE);
- changeKeyboardToBusStopIDFloatingButton.setVisibility(View.VISIBLE);
- changeKeyboardToBusStopNameFloatingButton.setVisibility(View.GONE);
+ floatingActionButton.setImageResource(R.drawable.ic_keyboard_white_24dp);
}
private void setSearchModeBusStopName() {
- searchMode = SEARCH_BY_NAME;
busStopSearchByIDEditText.setVisibility(View.GONE);
busStopSearchByNameEditText.setVisibility(View.VISIBLE);
- changeKeyboardToBusStopIDFloatingButton.setVisibility(View.GONE);
- changeKeyboardToBusStopNameFloatingButton.setVisibility(View.VISIBLE);
+ floatingActionButton.setImageResource(R.drawable.ic_looks_one_white_24dp);
}
private void showHints() {
howDoesItWorkTextView.setVisibility(View.VISIBLE);
hideHintButton.setVisibility(View.VISIBLE);
actionHelpMenuItem.setVisible(false);
}
private void hideHints() {
howDoesItWorkTextView.setVisibility(View.GONE);
hideHintButton.setVisibility(View.GONE);
actionHelpMenuItem.setVisible(true);
}
private void showSpinner(boolean swipeSpinner) {
if (swipeSpinner == DOUBLE_SPINNER) {
swipeRefreshLayout.setRefreshing(true);
}
progressBar.setVisibility(View.VISIBLE);
}
- private void showSpinner() {
- showSpinner(NORMAL_SPINNER);
- }
-
private void hideSpinner() {
swipeRefreshLayout.setRefreshing(false);
progressBar.setVisibility(View.INVISIBLE);
}
-
- private void notifyScrollToFloatingButton(boolean scrollDirection) {
- if(scrollDirection != lastScrollDirection) {
- int mode = scrollDirection == SCROLL_UP ? View.VISIBLE : View.GONE;
- changeKeyboardToBusStopIDFloatingButton.setVisibility(mode);
- changeKeyboardToBusStopNameFloatingButton.setVisibility(mode);
- shadowFloatingButton.setVisibility(mode);
- }
- }
}
\ No newline at end of file
diff --git a/src/it/reyboz/bustorino/MyListView.java b/src/it/reyboz/bustorino/MyListView.java
deleted file mode 100644
index d487601f..00000000
--- a/src/it/reyboz/bustorino/MyListView.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- BusTO - Arrival times for Turin public transports.
- Copyright (C) 2014 Valerio Bozzolan
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package it.reyboz.bustorino;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.AbsListView;
-
-public class MyListView extends android.widget.ListView {
-
- private OnScrollListener onScrollListener;
- private OnDetectScrollListener onDetectScrollListener;
-
- public MyListView(Context context) {
- super(context);
- onCreate(context, null, null);
- }
-
- public MyListView(Context context, AttributeSet attrs) {
- super(context, attrs);
- onCreate(context, attrs, null);
- }
-
- public MyListView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- onCreate(context, attrs, defStyle);
- }
-
- private void onCreate(Context context, AttributeSet attrs, Integer defStyle) {
- setListeners();
- }
-
- private void setListeners() {
- super.setOnScrollListener(new OnScrollListener() {
-
- private int oldTop;
- private int oldFirstVisibleItem;
-
- @Override
- public void onScrollStateChanged(AbsListView view, int scrollState) {
- if (onScrollListener != null) {
- onScrollListener.onScrollStateChanged(view, scrollState);
- }
- }
-
- @Override
- public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
- if (onScrollListener != null) {
- onScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
- }
-
- if (onDetectScrollListener != null) {
- onDetectedListScroll(view, firstVisibleItem);
- }
- }
-
- private void onDetectedListScroll(AbsListView absListView, int firstVisibleItem) {
- View view = absListView.getChildAt(0);
- int top = (view == null) ? 0 : view.getTop();
-
- if (firstVisibleItem == oldFirstVisibleItem) {
- if (top > oldTop) {
- onDetectScrollListener.onUpScrolling();
- } else if (top < oldTop) {
- onDetectScrollListener.onDownScrolling();
- }
- } else {
- if (firstVisibleItem < oldFirstVisibleItem) {
- onDetectScrollListener.onUpScrolling();
- } else {
- onDetectScrollListener.onDownScrolling();
- }
- }
-
- oldTop = top;
- oldFirstVisibleItem = firstVisibleItem;
- }
- });
- }
-
- @Override
- public void setOnScrollListener(OnScrollListener onScrollListener) {
- this.onScrollListener = onScrollListener;
- }
-
- public void setOnDetectScrollListener(OnDetectScrollListener onDetectScrollListener) {
- this.onDetectScrollListener = onDetectScrollListener;
- }
-}
\ No newline at end of file
diff --git a/src/it/reyboz/bustorino/OnDetectScrollListener.java b/src/it/reyboz/bustorino/OnDetectScrollListener.java
deleted file mode 100644
index 053c6bc9..00000000
--- a/src/it/reyboz/bustorino/OnDetectScrollListener.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- BusTO - Arrival times for Turin public transports.
- Copyright (C) 2014 Valerio Bozzolan
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package it.reyboz.bustorino;
-
-public interface OnDetectScrollListener {
- void onUpScrolling();
-
- void onDownScrolling();
-}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Nov 19, 03:45 (13 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2264611
Default Alt Text
(67 KB)

Event Timeline