diff --git a/ClothTalk/.gitignore b/ClothTalk/.gitignore new file mode 100644 index 0000000..c6cbe56 --- /dev/null +++ b/ClothTalk/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/ClothTalk/.idea/.name b/ClothTalk/.idea/.name new file mode 100644 index 0000000..dc81a2e --- /dev/null +++ b/ClothTalk/.idea/.name @@ -0,0 +1 @@ +ClothTalk \ No newline at end of file diff --git a/ClothTalk/.idea/compiler.xml b/ClothTalk/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/ClothTalk/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/.idea/copyright/profiles_settings.xml b/ClothTalk/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/ClothTalk/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/ClothTalk/.idea/dbnavigator.xml b/ClothTalk/.idea/dbnavigator.xml new file mode 100644 index 0000000..13e0684 --- /dev/null +++ b/ClothTalk/.idea/dbnavigator.xml @@ -0,0 +1,449 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/.idea/gradle.xml b/ClothTalk/.idea/gradle.xml new file mode 100644 index 0000000..39139a6 --- /dev/null +++ b/ClothTalk/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/ClothTalk/.idea/misc.xml b/ClothTalk/.idea/misc.xml new file mode 100644 index 0000000..5d19981 --- /dev/null +++ b/ClothTalk/.idea/misc.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/.idea/modules.xml b/ClothTalk/.idea/modules.xml new file mode 100644 index 0000000..bc21bbd --- /dev/null +++ b/ClothTalk/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/.idea/runConfigurations.xml b/ClothTalk/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/ClothTalk/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/ClothTalk/.idea/vcs.xml b/ClothTalk/.idea/vcs.xml new file mode 100644 index 0000000..6564d52 --- /dev/null +++ b/ClothTalk/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.gitignore b/ClothTalk/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/ClothTalk/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/ClothTalk/app/.idea/.name b/ClothTalk/app/.idea/.name new file mode 100644 index 0000000..7a0b7f0 --- /dev/null +++ b/ClothTalk/app/.idea/.name @@ -0,0 +1 @@ +app \ No newline at end of file diff --git a/ClothTalk/app/.idea/compiler.xml b/ClothTalk/app/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/ClothTalk/app/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/copyright/profiles_settings.xml b/ClothTalk/app/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/ClothTalk/app/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/dbnavigator.xml b/ClothTalk/app/.idea/dbnavigator.xml new file mode 100644 index 0000000..b9d5f59 --- /dev/null +++ b/ClothTalk/app/.idea/dbnavigator.xml @@ -0,0 +1,449 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/gradle.xml b/ClothTalk/app/.idea/gradle.xml new file mode 100644 index 0000000..5023e28 --- /dev/null +++ b/ClothTalk/app/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/animated_vector_drawable_23_2_0.xml b/ClothTalk/app/.idea/libraries/animated_vector_drawable_23_2_0.xml new file mode 100644 index 0000000..061ebb5 --- /dev/null +++ b/ClothTalk/app/.idea/libraries/animated_vector_drawable_23_2_0.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/appcompat_v7_23_2_0.xml b/ClothTalk/app/.idea/libraries/appcompat_v7_23_2_0.xml new file mode 100644 index 0000000..ec48856 --- /dev/null +++ b/ClothTalk/app/.idea/libraries/appcompat_v7_23_2_0.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/design_23_2_0.xml b/ClothTalk/app/.idea/libraries/design_23_2_0.xml new file mode 100644 index 0000000..6446f20 --- /dev/null +++ b/ClothTalk/app/.idea/libraries/design_23_2_0.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/google_api_client_1_20_0.xml b/ClothTalk/app/.idea/libraries/google_api_client_1_20_0.xml new file mode 100644 index 0000000..2e946bb --- /dev/null +++ b/ClothTalk/app/.idea/libraries/google_api_client_1_20_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/google_api_client_android_1_20_0.xml b/ClothTalk/app/.idea/libraries/google_api_client_android_1_20_0.xml new file mode 100644 index 0000000..73ffc00 --- /dev/null +++ b/ClothTalk/app/.idea/libraries/google_api_client_android_1_20_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/google_api_services_gmail_v1_rev29_1_20_0.xml b/ClothTalk/app/.idea/libraries/google_api_services_gmail_v1_rev29_1_20_0.xml new file mode 100644 index 0000000..7190b7a --- /dev/null +++ b/ClothTalk/app/.idea/libraries/google_api_services_gmail_v1_rev29_1_20_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/google_http_client_1_20_0.xml b/ClothTalk/app/.idea/libraries/google_http_client_1_20_0.xml new file mode 100644 index 0000000..ef947f6 --- /dev/null +++ b/ClothTalk/app/.idea/libraries/google_http_client_1_20_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/google_http_client_android_1_20_0.xml b/ClothTalk/app/.idea/libraries/google_http_client_android_1_20_0.xml new file mode 100644 index 0000000..3f07d43 --- /dev/null +++ b/ClothTalk/app/.idea/libraries/google_http_client_android_1_20_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/google_http_client_jackson2_1_20_0.xml b/ClothTalk/app/.idea/libraries/google_http_client_jackson2_1_20_0.xml new file mode 100644 index 0000000..ddc4c1c --- /dev/null +++ b/ClothTalk/app/.idea/libraries/google_http_client_jackson2_1_20_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/google_oauth_client_1_20_0.xml b/ClothTalk/app/.idea/libraries/google_oauth_client_1_20_0.xml new file mode 100644 index 0000000..6b79fb3 --- /dev/null +++ b/ClothTalk/app/.idea/libraries/google_oauth_client_1_20_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/guava_jdk5_13_0.xml b/ClothTalk/app/.idea/libraries/guava_jdk5_13_0.xml new file mode 100644 index 0000000..b72d4fb --- /dev/null +++ b/ClothTalk/app/.idea/libraries/guava_jdk5_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/jackson_core_2_1_3.xml b/ClothTalk/app/.idea/libraries/jackson_core_2_1_3.xml new file mode 100644 index 0000000..9ce9945 --- /dev/null +++ b/ClothTalk/app/.idea/libraries/jackson_core_2_1_3.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/jsr305_1_3_9.xml b/ClothTalk/app/.idea/libraries/jsr305_1_3_9.xml new file mode 100644 index 0000000..52ccf61 --- /dev/null +++ b/ClothTalk/app/.idea/libraries/jsr305_1_3_9.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/play_services_base_7_8_0.xml b/ClothTalk/app/.idea/libraries/play_services_base_7_8_0.xml new file mode 100644 index 0000000..7ddfa5a --- /dev/null +++ b/ClothTalk/app/.idea/libraries/play_services_base_7_8_0.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/play_services_identity_7_8_0.xml b/ClothTalk/app/.idea/libraries/play_services_identity_7_8_0.xml new file mode 100644 index 0000000..6218812 --- /dev/null +++ b/ClothTalk/app/.idea/libraries/play_services_identity_7_8_0.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/recyclerview_v7_23_2_0.xml b/ClothTalk/app/.idea/libraries/recyclerview_v7_23_2_0.xml new file mode 100644 index 0000000..1d216f9 --- /dev/null +++ b/ClothTalk/app/.idea/libraries/recyclerview_v7_23_2_0.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/support_annotations_23_2_0.xml b/ClothTalk/app/.idea/libraries/support_annotations_23_2_0.xml new file mode 100644 index 0000000..4739eeb --- /dev/null +++ b/ClothTalk/app/.idea/libraries/support_annotations_23_2_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/support_v4_23_2_0.xml b/ClothTalk/app/.idea/libraries/support_v4_23_2_0.xml new file mode 100644 index 0000000..56bb070 --- /dev/null +++ b/ClothTalk/app/.idea/libraries/support_v4_23_2_0.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/libraries/support_vector_drawable_23_2_0.xml b/ClothTalk/app/.idea/libraries/support_vector_drawable_23_2_0.xml new file mode 100644 index 0000000..1eb633a --- /dev/null +++ b/ClothTalk/app/.idea/libraries/support_vector_drawable_23_2_0.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/misc.xml b/ClothTalk/app/.idea/misc.xml new file mode 100644 index 0000000..5d19981 --- /dev/null +++ b/ClothTalk/app/.idea/misc.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/modules.xml b/ClothTalk/app/.idea/modules.xml new file mode 100644 index 0000000..79f3768 --- /dev/null +++ b/ClothTalk/app/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/runConfigurations.xml b/ClothTalk/app/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/ClothTalk/app/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/vcs.xml b/ClothTalk/app/.idea/vcs.xml new file mode 100644 index 0000000..6564d52 --- /dev/null +++ b/ClothTalk/app/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/.idea/workspace.xml b/ClothTalk/app/.idea/workspace.xml new file mode 100644 index 0000000..d2f7c17 --- /dev/null +++ b/ClothTalk/app/.idea/workspace.xml @@ -0,0 +1,2357 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1456679049464 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/build.gradle b/ClothTalk/app/build.gradle new file mode 100644 index 0000000..f6555e6 --- /dev/null +++ b/ClothTalk/app/build.gradle @@ -0,0 +1,35 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.2" + + defaultConfig { + applicationId "com.example.mom.clothtalk" + minSdkVersion 16 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + testCompile 'junit:junit:4.12' + compile('com.google.api-client:google-api-client-android:1.20.0') { + exclude group: 'org.apache.httpcomponents' + } + compile('com.google.apis:google-api-services-gmail:v1-rev29-1.20.0') { + exclude group: 'org.apache.httpcomponents' + } + compile 'com.android.support:appcompat-v7:23.2.0' + compile 'com.android.support:design:23.2.0' + compile 'com.google.android.gms:play-services-identity:7.8.0' + compile 'com.android.support:support-v4:23.2.0' +} diff --git a/ClothTalk/app/gradle/wrapper/gradle-wrapper.jar b/ClothTalk/app/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..05ef575 Binary files /dev/null and b/ClothTalk/app/gradle/wrapper/gradle-wrapper.jar differ diff --git a/ClothTalk/app/gradle/wrapper/gradle-wrapper.properties b/ClothTalk/app/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..f23df6e --- /dev/null +++ b/ClothTalk/app/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Oct 21 11:34:03 PDT 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip diff --git a/ClothTalk/app/gradlew b/ClothTalk/app/gradlew new file mode 100644 index 0000000..9d82f78 --- /dev/null +++ b/ClothTalk/app/gradlew @@ -0,0 +1,160 @@ +#!/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 + +# 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\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +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"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # 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/ClothTalk/app/gradlew.bat b/ClothTalk/app/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/ClothTalk/app/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/ClothTalk/app/local.properties b/ClothTalk/app/local.properties new file mode 100644 index 0000000..f4e7200 --- /dev/null +++ b/ClothTalk/app/local.properties @@ -0,0 +1,11 @@ +## This file is automatically generated by Android Studio. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Sun Feb 28 12:04:05 EST 2016 +sdk.dir=/Users/MOM/Library/Android/sdk diff --git a/ClothTalk/app/proguard-rules.pro b/ClothTalk/app/proguard-rules.pro new file mode 100644 index 0000000..b4cda16 --- /dev/null +++ b/ClothTalk/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/MOM/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/ClothTalk/app/src/androidTest/java/com/example/mom/clothtalk/ApplicationTest.java b/ClothTalk/app/src/androidTest/java/com/example/mom/clothtalk/ApplicationTest.java new file mode 100644 index 0000000..50d14a5 --- /dev/null +++ b/ClothTalk/app/src/androidTest/java/com/example/mom/clothtalk/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.example.mom.clothtalk; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/ClothTalk/app/src/main/AndroidManifest.xml b/ClothTalk/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..9546145 --- /dev/null +++ b/ClothTalk/app/src/main/AndroidManifest.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ClothTalk/app/src/main/java/com/example/mom/clothtalk/DetailActivity.java b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/DetailActivity.java new file mode 100644 index 0000000..0a19ebc --- /dev/null +++ b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/DetailActivity.java @@ -0,0 +1,29 @@ +package com.example.mom.clothtalk; + +import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; +import android.support.design.widget.Snackbar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.View; + +public class DetailActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_detail); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); + fab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) + .setAction("Action", null).show(); + } + }); + } + +} diff --git a/ClothTalk/app/src/main/java/com/example/mom/clothtalk/DetailFragment.java b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/DetailFragment.java new file mode 100644 index 0000000..c0a9825 --- /dev/null +++ b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/DetailFragment.java @@ -0,0 +1,31 @@ +package com.example.mom.clothtalk; + + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + + +/** + * A simple {@link Fragment} subclass. + */ +public class DetailFragment extends Fragment { + + + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_detail, container, false); + } + + public void setEmailInfo (String emailInfo){ + TextView textView = (TextView)getView().findViewById(R.id.emailSubjectTextView); + textView.setText(emailInfo); + } + +} diff --git a/ClothTalk/app/src/main/java/com/example/mom/clothtalk/Email.java b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/Email.java new file mode 100644 index 0000000..fe8deea --- /dev/null +++ b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/Email.java @@ -0,0 +1,120 @@ +package com.example.mom.clothtalk; + +/** + * Created by MOM on 2/28/16. + */ +public class Email { + private String mEmailID; + private String[] mLabelIDs = new String[0]; + private String mSnippet; + + private String mPayloadHeadersDate; + private String mPayloadHeadersSubject; + private String mPayloadHeadersFrom; + private String mPayloadHeadersTo; + private String mPayloadHeadersCc; + private String mPayloadHeadersBcc; + private String mPayloadPartsBodyData; + + public Email(){} + + public Email(String mEmailID, String mPayloadHeadersDate, String mPayloadHeadersFrom, String mPayloadHeadersTo) { + this.mEmailID = mEmailID; + this.mPayloadHeadersDate = mPayloadHeadersDate; + this.mPayloadHeadersFrom = mPayloadHeadersFrom; + this.mPayloadHeadersTo = mPayloadHeadersTo; + } + + public Email(String mEmailID, String[] mLabelIDs, String mSnippet, String mPayloadHeadersDate, String mPayloadHeadersSubject, String mPayloadHeadersFrom, String mPayloadHeadersTo, String mPayloadHeadersCc, String mPayloadHeadersBcc, String mPayloadPartsBodyData) { + this.mEmailID = mEmailID; + this.mLabelIDs = mLabelIDs; + this.mSnippet = mSnippet; + this.mPayloadHeadersDate = mPayloadHeadersDate; + this.mPayloadHeadersSubject = mPayloadHeadersSubject; + this.mPayloadHeadersFrom = mPayloadHeadersFrom; + this.mPayloadHeadersTo = mPayloadHeadersTo; + this.mPayloadHeadersCc = mPayloadHeadersCc; + this.mPayloadHeadersBcc = mPayloadHeadersBcc; + this.mPayloadPartsBodyData = mPayloadPartsBodyData; + } + + public String getmEmailID() { + return mEmailID; + } + + public void setmEmailID(String mEmailID) { + this.mEmailID = mEmailID; + } + + public String[] getmLabelIDs() { + return mLabelIDs; + } + + public void setmLabelIDs(String[] mLabelIDs) { + this.mLabelIDs = mLabelIDs; + } + + public String getmSnippet() { + return mSnippet; + } + + public void setmSnippet(String mSnippet) { + this.mSnippet = mSnippet; + } + + public String getmPayloadHeadersDate() { + return mPayloadHeadersDate; + } + + public void setmPayloadHeadersDate(String mPayloadHeadersDate) { + this.mPayloadHeadersDate = mPayloadHeadersDate; + } + + public String getmPayloadHeadersSubject() { + return mPayloadHeadersSubject; + } + + public void setmPayloadHeadersSubject(String mPayloadHeadersSubject) { + this.mPayloadHeadersSubject = mPayloadHeadersSubject; + } + + public String getmPayloadHeadersFrom() { + return mPayloadHeadersFrom; + } + + public void setmPayloadHeadersFrom(String mPayloadHeadersFrom) { + this.mPayloadHeadersFrom = mPayloadHeadersFrom; + } + + public String getmPayloadHeadersTo() { + return mPayloadHeadersTo; + } + + public void setmPayloadHeadersTo(String mPayloadHeadersTo) { + this.mPayloadHeadersTo = mPayloadHeadersTo; + } + + public String getmPayloadHeadersCc() { + return mPayloadHeadersCc; + } + + public void setmPayloadHeadersCc(String mPayloadHeadersCc) { + this.mPayloadHeadersCc = mPayloadHeadersCc; + } + + public String getmPayloadHeadersBcc() { + return mPayloadHeadersBcc; + } + + public void setmPayloadHeadersBcc(String mPayloadHeadersBcc) { + this.mPayloadHeadersBcc = mPayloadHeadersBcc; + } + + public String getmPayloadPartsBodyData() { + return mPayloadPartsBodyData; + } + + public void setmPayloadPartsBodyData(String mPayloadPartsBodyData) { + this.mPayloadPartsBodyData = mPayloadPartsBodyData; + } +} diff --git a/ClothTalk/app/src/main/java/com/example/mom/clothtalk/EmailListAdapter.java b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/EmailListAdapter.java new file mode 100644 index 0000000..c97ae09 --- /dev/null +++ b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/EmailListAdapter.java @@ -0,0 +1,61 @@ +package com.example.mom.clothtalk; + +/** + * Created by MOM on 2/28/16. + */ +import android.app.Activity; +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.BaseAdapter; +import android.widget.TextView; + +import java.util.ArrayList; + +/** + * Created by sbabba on 2/26/16. + */ +public class EmailListAdapter extends ArrayAdapter { + + ArrayList mEmailViewArrayList; + + public EmailListAdapter(Context context, ArrayList newEmailViewArrayList) { + super(context, -1); + this.mEmailViewArrayList = mEmailViewArrayList; + + mEmailViewArrayList = new ArrayList(); + + mEmailViewArrayList.addAll(newEmailViewArrayList); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + InboxEmailList inboxEmailList = mEmailViewArrayList.get(position); + + Context context = getContext(); + LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + + View inboxEmailsLayoutView = inflater.inflate(R.layout.email_layout,parent,false); + + TextView headerText = (TextView) inboxEmailsLayoutView.findViewById(R.id.headerText); + TextView subjectText = (TextView) inboxEmailsLayoutView.findViewById(R.id.subjectText); + TextView snippetText = (TextView) inboxEmailsLayoutView.findViewById(R.id.snippetText); + TextView timeText = (TextView) inboxEmailsLayoutView.findViewById(R.id.timeText); +// +// headerText.setText(inboxEmailList.getHeaderText()); +// subjectText.setText(inboxEmailList.getSubjectText()); +// snippetText.setText(inboxEmailList.getSnippetText()); +// timeText.setText(inboxEmailList.getTimeText()); + + return inboxEmailsLayoutView; + } + + @Override + public int getCount() { + return super.getCount(); + } +} \ No newline at end of file diff --git a/ClothTalk/app/src/main/java/com/example/mom/clothtalk/InboxEmailList.java b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/InboxEmailList.java new file mode 100644 index 0000000..33386ba --- /dev/null +++ b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/InboxEmailList.java @@ -0,0 +1,76 @@ +package com.example.mom.clothtalk; + +import java.util.ArrayList; + +/** + * Created by MOM on 2/28/16. + */ + +public class InboxEmailList { + + private static InboxEmailList mInstance; + private static ArrayList mEmailArrayList; + + private InboxEmailList(){ + mEmailArrayList = new ArrayList(); + } + + public static InboxEmailList getInstance(){ + if(mInstance==null){ + mInstance = new InboxEmailList(); + } + return mInstance; + } + + public ArrayList getAllEmails(){ + return mEmailArrayList; + } + + public ArrayList getInbox(){ + ArrayList inbox = new ArrayList<>(); + for (Email email:mEmailArrayList) { + if(email.getmLabelIDs()!=null){ + for(String x:email.getmLabelIDs()){ + if(x.equals("INBOX")){ + inbox.add(email); + } + } + } + } + return inbox; + } + + public ArrayList getSentMail(){ + ArrayList sentMail = new ArrayList<>(); + for (Email email:mEmailArrayList) { + if(email.getmLabelIDs()!=null){ + for(String x:email.getmLabelIDs()){ + if(x.equals("SENT")){ + sentMail.add(email); + } + } + } + } + return sentMail; + } + + public void addEmail(Email email){ + mEmailArrayList.add(email); + } + + public void addEmail (int position, Email email){ + mEmailArrayList.add(position,email); + } + + public void replaceEmail (int position, Email email){ + mEmailArrayList.set(position,email); + } + + public Email get (int position){ + return mEmailArrayList.get(position); + } + + public void clear (){ + mEmailArrayList.clear(); + } +} \ No newline at end of file diff --git a/ClothTalk/app/src/main/java/com/example/mom/clothtalk/MainActivity.java b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/MainActivity.java new file mode 100644 index 0000000..6c14359 --- /dev/null +++ b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/MainActivity.java @@ -0,0 +1,363 @@ +package com.example.mom.clothtalk; + +import android.content.res.Configuration; +import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; +import android.support.design.widget.Snackbar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.view.View; +import android.view.Menu; +import android.view.MenuItem; + +import com.google.android.gms.auth.GoogleAuthException; +import com.google.android.gms.common.GoogleApiAvailability; +import com.google.android.gms.common.GooglePlayServicesUtil; +import com.google.api.client.extensions.android.http.AndroidHttp; +import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential; +import com.google.api.client.http.HttpTransport; +import com.google.api.client.json.JsonFactory; +import com.google.api.client.json.jackson2.JacksonFactory; +import com.google.api.client.util.ExponentialBackOff; +import android.accounts.AccountManager; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.app.SearchManager; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.os.AsyncTask; +import android.os.Bundle; +import android.support.design.widget.FloatingActionButton; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.SearchView; +import android.support.v7.widget.Toolbar; +import android.util.Log; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.ListView; +import android.widget.Toast; +import com.google.api.services.gmail.GmailScopes; +import com.google.api.services.gmail.model.Label; +import com.google.api.services.gmail.model.ListLabelsResponse; +import com.google.android.gms.common.ConnectionResult; +import com.google.api.client.googleapis.extensions.android.gms.auth.GooglePlayServicesAvailabilityIOException; +import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; +import com.google.api.services.gmail.model.ListMessagesResponse; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class MainActivity extends AppCompatActivity { + + private GoogleAccountCredential mCredential; + private ListView mEmailsListView; + private ProgressDialog mProgress; + private ArrayList mInboxArrayList; + private ArrayAdapter mAdapter; + + private boolean mTwoPane; + + static final int REQUEST_ACCOUNT_PICKER = 1000; + static final int REQUEST_AUTHORIZATION = 1001; + static final int REQUEST_GOOGLE_PLAY_SERVICES = 1002; + private static final String PREF_ACCOUNT_NAME = "accountName"; + private static final String[] SCOPES = {GmailScopes.GMAIL_LABELS,GmailScopes.GMAIL_READONLY, GmailScopes.GMAIL_COMPOSE, GmailScopes.GMAIL_INSERT, GmailScopes.GMAIL_MODIFY, GmailScopes.MAIL_GOOGLE_COM}; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + mProgress = new ProgressDialog(this); + mProgress.setMessage("Calling Gmail API..."); + + mEmailsListView = (ListView) findViewById(R.id.emails_ListView); + mInboxArrayList = new ArrayList(); + + mEmailsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + Intent intent= new Intent(MainActivity.this,DetailActivity.class); + Object o= mEmailsListView.getItemAtPosition(position); + String email= o.toString(); + Toast.makeText(MainActivity.this,"You have selected "+ email,Toast.LENGTH_SHORT).show(); + } + }); + + + mAdapter = new ArrayAdapter(MainActivity.this, android.R.layout.simple_list_item_1, mInboxArrayList); + mEmailsListView.setAdapter(mAdapter); + + MailAsyncTask mailAsyncTask = new MailAsyncTask(mCredential); + mailAsyncTask.execute(); + + SharedPreferences settings = getPreferences(Context.MODE_PRIVATE); + + + + mCredential = GoogleAccountCredential.usingOAuth2( + getApplicationContext(), Arrays.asList(SCOPES)) + .setBackOff(new ExponentialBackOff()) + .setSelectedAccountName(settings.getString(PREF_ACCOUNT_NAME, null)); + + FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); + fab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent intent = new Intent(MainActivity.this, DetailActivity.class); + startActivity(intent); + Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) + .setAction("Action", null).show(); + } + }); + } + + @Override + protected void onResume() { +// mInboxArrayList.clear(); + super.onResume(); + if (isGooglePlayServicesAvailable()) { + refreshResults(); + } else { + Toast.makeText(MainActivity.this, "Google Play Services require: after installing, close and relaunch this app", Toast.LENGTH_SHORT).show(); + } + } + + + @Override + protected void onActivityResult( + int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + switch (requestCode) { + case REQUEST_GOOGLE_PLAY_SERVICES: + if (resultCode != RESULT_OK) { + isGooglePlayServicesAvailable(); + } + break; + case REQUEST_ACCOUNT_PICKER: + if (resultCode == RESULT_OK && data != null && + data.getExtras() != null) { + String accountName = + data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME); + if (accountName != null) { + mCredential.setSelectedAccountName(accountName); + SharedPreferences settings = + getPreferences(Context.MODE_PRIVATE); + SharedPreferences.Editor editor = settings.edit(); + editor.putString(PREF_ACCOUNT_NAME, accountName); + editor.apply(); + } + } else if (resultCode == RESULT_CANCELED) { + Toast.makeText(MainActivity.this, "Account unspecified.", Toast.LENGTH_SHORT).show(); + } + break; + case REQUEST_AUTHORIZATION: + if (resultCode != RESULT_OK) { + chooseAccount(); + } + break; + } + super.onActivityResult(requestCode, resultCode, data); + } + private void refreshResults() { + if (mCredential.getSelectedAccountName() == null) { + chooseAccount(); + } else { + if (isDeviceOnline()) { +// Log.d("Gets here","GET GERE"); + new MailAsyncTask(mCredential).execute(); + } else { + Toast.makeText(MainActivity.this, "No network connection available.", Toast.LENGTH_SHORT).show(); + } + } + } + private void chooseAccount() { + startActivityForResult( + mCredential.newChooseAccountIntent(), REQUEST_ACCOUNT_PICKER); + } + private boolean isDeviceOnline() { + ConnectivityManager connMgr = + (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); + return (networkInfo != null && networkInfo.isConnected()); + } + private boolean isGooglePlayServicesAvailable() { + GoogleApiAvailability googleApi = GoogleApiAvailability.getInstance(); + int connectionStatusCode = + googleApi.isGooglePlayServicesAvailable(this); + if (googleApi.isUserResolvableError(connectionStatusCode)) { + showGooglePlayServicesAvailabilityErrorDialog(connectionStatusCode); + return false; + } else if (connectionStatusCode != ConnectionResult.SUCCESS ) { + return false; + } + return true; + } + + void showGooglePlayServicesAvailabilityErrorDialog( + final int connectionStatusCode) { + Dialog dialog = GooglePlayServicesUtil.getErrorDialog( + connectionStatusCode, + MainActivity.this, + REQUEST_GOOGLE_PLAY_SERVICES); + dialog.show(); + } + + private String getInputData(InputStream inputStream)throws IOException { + StringBuilder stringBuilder = new StringBuilder(); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); + String data; + while ((data = reader.readLine())!= null){ + stringBuilder.append(data); + } + reader.close(); + return stringBuilder.toString(); + } + + public void OnEmailSelected(String selectedEmail){ + if(getResources().getConfiguration().orientation== Configuration.ORIENTATION_PORTRAIT){ + Intent intent= new Intent(MainActivity.this,DetailActivity.class); + intent.putExtra("email",selectedEmail); + startActivity(intent); + } + } + + public class MailAsyncTask extends AsyncTask>{ + private com.google.api.services.gmail.Gmail mService = null; + private Exception mLastError = null; + + public MailAsyncTask(GoogleAccountCredential credential){ + System.out.println("In MailAsyncTask..."); + HttpTransport transport = AndroidHttp.newCompatibleTransport(); + JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); + mService = new com.google.api.services.gmail.Gmail.Builder( + transport, jsonFactory, credential) + .setApplicationName("Gmail API Android Quickstart") + .build(); + } + @Override + protected void onPreExecute() { + mProgress.show(); + } + + @Override + protected List doInBackground(String... urls) { + try { + return getDataFromApi(); + } catch (Exception e) { + mLastError = e; + cancel(true); + return null; + } + } + private List getDataFromApi() throws IOException { +// Log.d("String", "Gets Here"); + String user = "me"; + List labels = new ArrayList(); + List messages = new ArrayList<>(); + + ListLabelsResponse listResponse = mService.users().labels().list(user).execute(); + ListMessagesResponse messageResponse = mService.users().messages().list(user).execute(); + + for (Label label : listResponse.getLabels()) { + labels.add(label.getName()); + String labelName = label.getName(); + + } + int counter = 0; + for (com.google.api.services.gmail.model.Message message : messageResponse.getMessages()) { + + counter++; + com.google.api.services.gmail.model.Message messageContent = mService.users().messages().get("me", message.getId()).execute(); + String s = messageContent.getSnippet(); + mInboxArrayList.add(s); + if (counter >= 25) { + break; + } + } + return labels; + } + @Override + protected void onPostExecute(List urls) { + mProgress.hide(); + if (urls == null || urls.size() == 0){ + Toast.makeText(MainActivity.this, "No Results Returned", Toast.LENGTH_SHORT).show(); + } + urls.add(0, "Data retrieved using the Gmail API:"); + mAdapter.notifyDataSetChanged(); + } + @Override + protected void onCancelled() { + mProgress.hide(); + if (mLastError != null) { + if (mLastError instanceof GooglePlayServicesAvailabilityIOException) { + showGooglePlayServicesAvailabilityErrorDialog( + ((GooglePlayServicesAvailabilityIOException) mLastError) + .getConnectionStatusCode()); + } else if (mLastError instanceof UserRecoverableAuthIOException) { + startActivityForResult( + ((UserRecoverableAuthIOException) mLastError).getIntent(), + MainActivity.REQUEST_AUTHORIZATION); + } else { + Toast.makeText(MainActivity.this, "The following error occured: " + mLastError.getMessage(), Toast.LENGTH_SHORT).show(); +// mOutputText.setText("The following error occurred:\n" +// + mLastError.getMessage()); + mLastError.getMessage(); + } + } else { + Toast.makeText(MainActivity.this, "Request cancelled.", Toast.LENGTH_SHORT).show(); +// mOutputText.setText("Request cancelled."); + } + } + + + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + + SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); + final SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); + + ComponentName component = new ComponentName(this, MainActivity.class); + searchView.setSearchableInfo(searchManager.getSearchableInfo(component)); + searchView.getSuggestionsAdapter(); + + + return super.onCreateOptionsMenu(menu); + } + + @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. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } + + +} diff --git a/ClothTalk/app/src/main/java/com/example/mom/clothtalk/MyListFragment.java b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/MyListFragment.java new file mode 100644 index 0000000..1ac765b --- /dev/null +++ b/ClothTalk/app/src/main/java/com/example/mom/clothtalk/MyListFragment.java @@ -0,0 +1,55 @@ +package com.example.mom.clothtalk; + + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.support.v4.app.ListFragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ListView; + +import java.util.ArrayList; + +/** + * Created by MOM on 2/28/16. + */ +public class MyListFragment extends ListFragment { + + ArrayList mStringArray; + onEmailSelectedListener mListener; + + public interface onEmailSelectedListener { + public void onEmailSelectedListener(String selectedEmail); + } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + + try { + mListener = (onEmailSelectedListener) getActivity(); + } catch (ClassCastException e){ + e.printStackTrace(); + } + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + ArrayAdapter myFragmentAdapter = new ArrayAdapter(getContext(), android.R.layout.simple_list_item_1, mStringArray); + + setListAdapter(myFragmentAdapter); + + return super.onCreateView(inflater, container, savedInstanceState); + } + + @Override + public void onListItemClick(ListView l, View v, int position, long id) { + mListener.onEmailSelectedListener(getListAdapter().getItem(position).toString()); + } +} + diff --git a/ClothTalk/app/src/main/res/drawable-hdpi/ic_action_search.png b/ClothTalk/app/src/main/res/drawable-hdpi/ic_action_search.png new file mode 100644 index 0000000..45c099a Binary files /dev/null and b/ClothTalk/app/src/main/res/drawable-hdpi/ic_action_search.png differ diff --git a/ClothTalk/app/src/main/res/drawable-ldpi/ic_action_search.png b/ClothTalk/app/src/main/res/drawable-ldpi/ic_action_search.png new file mode 100644 index 0000000..7ca935a Binary files /dev/null and b/ClothTalk/app/src/main/res/drawable-ldpi/ic_action_search.png differ diff --git a/ClothTalk/app/src/main/res/drawable-mdpi/ic_action_search.png b/ClothTalk/app/src/main/res/drawable-mdpi/ic_action_search.png new file mode 100644 index 0000000..174ccaa Binary files /dev/null and b/ClothTalk/app/src/main/res/drawable-mdpi/ic_action_search.png differ diff --git a/ClothTalk/app/src/main/res/drawable-tvdpi/ic_action_search.png b/ClothTalk/app/src/main/res/drawable-tvdpi/ic_action_search.png new file mode 100644 index 0000000..d4f1d42 Binary files /dev/null and b/ClothTalk/app/src/main/res/drawable-tvdpi/ic_action_search.png differ diff --git a/ClothTalk/app/src/main/res/drawable-xhdpi/ic_action_search.png b/ClothTalk/app/src/main/res/drawable-xhdpi/ic_action_search.png new file mode 100644 index 0000000..079c9a3 Binary files /dev/null and b/ClothTalk/app/src/main/res/drawable-xhdpi/ic_action_search.png differ diff --git a/ClothTalk/app/src/main/res/drawable-xxhdpi/ic_action_search.png b/ClothTalk/app/src/main/res/drawable-xxhdpi/ic_action_search.png new file mode 100644 index 0000000..7d8c57b Binary files /dev/null and b/ClothTalk/app/src/main/res/drawable-xxhdpi/ic_action_search.png differ diff --git a/ClothTalk/app/src/main/res/drawable-xxxhdpi/ic_action_search.png b/ClothTalk/app/src/main/res/drawable-xxxhdpi/ic_action_search.png new file mode 100644 index 0000000..c1457dd Binary files /dev/null and b/ClothTalk/app/src/main/res/drawable-xxxhdpi/ic_action_search.png differ diff --git a/ClothTalk/app/src/main/res/layout/activity_detail.xml b/ClothTalk/app/src/main/res/layout/activity_detail.xml new file mode 100644 index 0000000..e3ccd27 --- /dev/null +++ b/ClothTalk/app/src/main/res/layout/activity_detail.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/ClothTalk/app/src/main/res/layout/activity_main.xml b/ClothTalk/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..6f0b39b --- /dev/null +++ b/ClothTalk/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/ClothTalk/app/src/main/res/layout/content_detail.xml b/ClothTalk/app/src/main/res/layout/content_detail.xml new file mode 100644 index 0000000..9525320 --- /dev/null +++ b/ClothTalk/app/src/main/res/layout/content_detail.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/ClothTalk/app/src/main/res/layout/content_main.xml b/ClothTalk/app/src/main/res/layout/content_main.xml new file mode 100644 index 0000000..1e21094 --- /dev/null +++ b/ClothTalk/app/src/main/res/layout/content_main.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/ClothTalk/app/src/main/res/layout/email_layout.xml b/ClothTalk/app/src/main/res/layout/email_layout.xml new file mode 100644 index 0000000..d14cd10 --- /dev/null +++ b/ClothTalk/app/src/main/res/layout/email_layout.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/ClothTalk/app/src/main/res/layout/fragment_detail.xml b/ClothTalk/app/src/main/res/layout/fragment_detail.xml new file mode 100644 index 0000000..f499b44 --- /dev/null +++ b/ClothTalk/app/src/main/res/layout/fragment_detail.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/ClothTalk/app/src/main/res/menu/menu_main.xml b/ClothTalk/app/src/main/res/menu/menu_main.xml new file mode 100644 index 0000000..975cf95 --- /dev/null +++ b/ClothTalk/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,16 @@ + + + + diff --git a/ClothTalk/app/src/main/res/mipmap-hdpi/ic_launcher.png b/ClothTalk/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..cde69bc Binary files /dev/null and b/ClothTalk/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/ClothTalk/app/src/main/res/mipmap-mdpi/ic_launcher.png b/ClothTalk/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..c133a0c Binary files /dev/null and b/ClothTalk/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/ClothTalk/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/ClothTalk/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..bfa42f0 Binary files /dev/null and b/ClothTalk/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/ClothTalk/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/ClothTalk/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..324e72c Binary files /dev/null and b/ClothTalk/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/ClothTalk/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/ClothTalk/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..aee44e1 Binary files /dev/null and b/ClothTalk/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/ClothTalk/app/src/main/res/values-v21/styles.xml b/ClothTalk/app/src/main/res/values-v21/styles.xml new file mode 100644 index 0000000..251fb9f --- /dev/null +++ b/ClothTalk/app/src/main/res/values-v21/styles.xml @@ -0,0 +1,9 @@ +> + + + diff --git a/ClothTalk/app/src/main/res/values-w820dp/dimens.xml b/ClothTalk/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/ClothTalk/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/ClothTalk/app/src/main/res/values/colors.xml b/ClothTalk/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..3ab3e9c --- /dev/null +++ b/ClothTalk/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/ClothTalk/app/src/main/res/values/dimens.xml b/ClothTalk/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..812cb7b --- /dev/null +++ b/ClothTalk/app/src/main/res/values/dimens.xml @@ -0,0 +1,6 @@ + + + 16dp + 16dp + 16dp + diff --git a/ClothTalk/app/src/main/res/values/strings.xml b/ClothTalk/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..35326c5 --- /dev/null +++ b/ClothTalk/app/src/main/res/values/strings.xml @@ -0,0 +1,8 @@ + + ClothTalk + Settings + DetailActivity + + + Hello blank fragment + diff --git a/ClothTalk/app/src/main/res/values/styles.xml b/ClothTalk/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..545b9c6 --- /dev/null +++ b/ClothTalk/app/src/main/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + +