diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..27f539b2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +out/ +*.class +*.iml +.idea +build/ +.gradle/ diff --git a/AC_05-03/.gitignore b/AC_05-03/.gitignore new file mode 100644 index 00000000..afbdab33 --- /dev/null +++ b/AC_05-03/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/AC_05-03/app/.gitignore b/AC_05-03/app/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/AC_05-03/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/AC_05-03/app/build.gradle b/AC_05-03/app/build.gradle new file mode 100644 index 00000000..63791f9a --- /dev/null +++ b/AC_05-03/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 22 + buildToolsVersion "22.0.1" + + defaultConfig { + applicationId "com.example.c4q_allison.ac_05_03" + minSdkVersion 15 + 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']) + compile 'com.android.support:appcompat-v7:22.1.1' +} diff --git a/AC_05-03/app/proguard-rules.pro b/AC_05-03/app/proguard-rules.pro new file mode 100644 index 00000000..7d838ea9 --- /dev/null +++ b/AC_05-03/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/c4q-Allison/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/AC_05-03/app/src/androidTest/java/com/example/c4q_allison/ac_05_03/ApplicationTest.java b/AC_05-03/app/src/androidTest/java/com/example/c4q_allison/ac_05_03/ApplicationTest.java new file mode 100644 index 00000000..b4054761 --- /dev/null +++ b/AC_05-03/app/src/androidTest/java/com/example/c4q_allison/ac_05_03/ApplicationTest.java @@ -0,0 +1,13 @@ +package com.example.c4q_allison.ac_05_03; + +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/AC_05-03/app/src/main/AndroidManifest.xml b/AC_05-03/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..2f8cec9d --- /dev/null +++ b/AC_05-03/app/src/main/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + diff --git a/AC_05-03/app/src/main/java/com/example/c4q_allison/ac_05_03/MainActivity.java b/AC_05-03/app/src/main/java/com/example/c4q_allison/ac_05_03/MainActivity.java new file mode 100644 index 00000000..6c6c9065 --- /dev/null +++ b/AC_05-03/app/src/main/java/com/example/c4q_allison/ac_05_03/MainActivity.java @@ -0,0 +1,42 @@ +package com.example.c4q_allison.ac_05_03; + +import android.app.Activity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.EditText; + + +public class MainActivity extends Activity { + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + } + + + @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); + 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. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/AC_05-03/app/src/main/java/com/example/c4q_allison/ac_05_03/MainActivity2Activity.java b/AC_05-03/app/src/main/java/com/example/c4q_allison/ac_05_03/MainActivity2Activity.java new file mode 100644 index 00000000..f44ea374 --- /dev/null +++ b/AC_05-03/app/src/main/java/com/example/c4q_allison/ac_05_03/MainActivity2Activity.java @@ -0,0 +1,61 @@ +package com.example.c4q_allison.ac_05_03; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.widget.EditText; + + +public class MainActivity2Activity extends Activity { + + EditText etName; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main_activity2); + Log.e ("SW", "OnCreate"); + etName = ((EditText)this.findViewById(R.id.the_edittext)); + etName.setText("Time to go home!"); + } + @Override + protected void onStart(){ + Log.d("MainActivity", "onStart"); + super.onStart(); + + } + @Override + protected void onRestart(){ + Log.d("MainActivity", "onRestart"); + super.onRestart(); + + } + @Override + protected void onResume(){ + Log.d("MainActivity", "onResume"); + super.onResume(); + + } + @Override + protected void onPause(){ + Log.d("MainActivity", "onPause"); + super.onPause(); + + } + @Override + protected void onStop(){ + Log.d("MainActivity", "onStop"); + super.onStop(); + + } + @Override + protected void onDestroy(){ + Log.d("MainActivity", "onDestroy"); + super.onDestroy(); + + } + + + + + +} diff --git a/AC_05-03/app/src/main/res/layout/activity_main.xml b/AC_05-03/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..a9d1bbd0 --- /dev/null +++ b/AC_05-03/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/AC_05-03/app/src/main/res/layout/activity_main_activity2.xml b/AC_05-03/app/src/main/res/layout/activity_main_activity2.xml new file mode 100644 index 00000000..76d7b7ac --- /dev/null +++ b/AC_05-03/app/src/main/res/layout/activity_main_activity2.xml @@ -0,0 +1,22 @@ + + + + + + + diff --git a/AC_05-03/app/src/main/res/menu/menu_main.xml b/AC_05-03/app/src/main/res/menu/menu_main.xml new file mode 100644 index 00000000..d9c632f6 --- /dev/null +++ b/AC_05-03/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,7 @@ + + + diff --git a/AC_05-03/app/src/main/res/menu/menu_main_activity2.xml b/AC_05-03/app/src/main/res/menu/menu_main_activity2.xml new file mode 100644 index 00000000..7da7b96f --- /dev/null +++ b/AC_05-03/app/src/main/res/menu/menu_main_activity2.xml @@ -0,0 +1,7 @@ + + + diff --git a/AC_05-03/app/src/main/res/mipmap-hdpi/ic_launcher.png b/AC_05-03/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000..cde69bcc Binary files /dev/null and b/AC_05-03/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/AC_05-03/app/src/main/res/mipmap-mdpi/ic_launcher.png b/AC_05-03/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000..c133a0cb Binary files /dev/null and b/AC_05-03/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/AC_05-03/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/AC_05-03/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000..bfa42f0e Binary files /dev/null and b/AC_05-03/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/AC_05-03/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/AC_05-03/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000..324e72cd Binary files /dev/null and b/AC_05-03/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/AC_05-03/app/src/main/res/values-w820dp/dimens.xml b/AC_05-03/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 00000000..63fc8164 --- /dev/null +++ b/AC_05-03/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/AC_05-03/app/src/main/res/values/dimens.xml b/AC_05-03/app/src/main/res/values/dimens.xml new file mode 100644 index 00000000..47c82246 --- /dev/null +++ b/AC_05-03/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git a/AC_05-03/app/src/main/res/values/strings.xml b/AC_05-03/app/src/main/res/values/strings.xml new file mode 100644 index 00000000..35468ebc --- /dev/null +++ b/AC_05-03/app/src/main/res/values/strings.xml @@ -0,0 +1,8 @@ + + AC_05-03 + MainActivity + + Hello world! + Settings + MainActivity2Activity + diff --git a/AC_05-03/app/src/main/res/values/styles.xml b/AC_05-03/app/src/main/res/values/styles.xml new file mode 100644 index 00000000..766ab993 --- /dev/null +++ b/AC_05-03/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/AC_05-03/build.gradle b/AC_05-03/build.gradle new file mode 100644 index 00000000..d3ff69d6 --- /dev/null +++ b/AC_05-03/build.gradle @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.1.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/AC_05-03/gradle.properties b/AC_05-03/gradle.properties new file mode 100644 index 00000000..1d3591c8 --- /dev/null +++ b/AC_05-03/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/AC_05-03/gradle/wrapper/gradle-wrapper.jar b/AC_05-03/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..8c0fb64a Binary files /dev/null and b/AC_05-03/gradle/wrapper/gradle-wrapper.jar differ diff --git a/AC_05-03/gradle/wrapper/gradle-wrapper.properties b/AC_05-03/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..0c71e760 --- /dev/null +++ b/AC_05-03/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/AC_05-03/gradlew b/AC_05-03/gradlew new file mode 100755 index 00000000..91a7e269 --- /dev/null +++ b/AC_05-03/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/AC_05-03/gradlew.bat b/AC_05-03/gradlew.bat new file mode 100644 index 00000000..aec99730 --- /dev/null +++ b/AC_05-03/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/AC_05-03/settings.gradle b/AC_05-03/settings.gradle new file mode 100644 index 00000000..e7b4def4 --- /dev/null +++ b/AC_05-03/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/homework/week-0/AllisonBojarski/AnimalSort(HWproblem#1)/src/nyc/c4q/alizinha/Animal.java b/homework/week-0/AllisonBojarski/AnimalSort(HWproblem#1)/src/nyc/c4q/alizinha/Animal.java new file mode 100644 index 00000000..948dcbe2 --- /dev/null +++ b/homework/week-0/AllisonBojarski/AnimalSort(HWproblem#1)/src/nyc/c4q/alizinha/Animal.java @@ -0,0 +1,30 @@ +package nyc.c4q.alizinha; +/** + * Created by c4q-Allison on 5/1/15. + */ +public class Animal implements Comparable +{ + String species; + + public String getSpecies() + { + return species; + } + + @Override + public int compareTo(Animal o) + { + return this.species.compareTo(o.getSpecies()); + } + + @Override + public boolean equals(Object obj) + { + if (obj instanceof Animal) { + Animal a1 = (Animal) obj; + return this.getSpecies().equals(a1.getSpecies()); + } + return false; + + } +} diff --git a/homework/week-0/AllisonBojarski/AnimalSort(HWproblem#1)/src/nyc/c4q/alizinha/Domestic.java b/homework/week-0/AllisonBojarski/AnimalSort(HWproblem#1)/src/nyc/c4q/alizinha/Domestic.java new file mode 100644 index 00000000..604f43a2 --- /dev/null +++ b/homework/week-0/AllisonBojarski/AnimalSort(HWproblem#1)/src/nyc/c4q/alizinha/Domestic.java @@ -0,0 +1,9 @@ +package nyc.c4q.alizinha; +/** + * Created by c4q-Allison on 5/1/15. + */ +public interface Domestic +{ + String getName(); + void setName(String name); +} diff --git a/homework/week-0/AllisonBojarski/AnimalSort(HWproblem#1)/src/nyc/c4q/alizinha/DomesticCat.java b/homework/week-0/AllisonBojarski/AnimalSort(HWproblem#1)/src/nyc/c4q/alizinha/DomesticCat.java new file mode 100644 index 00000000..8b19033e --- /dev/null +++ b/homework/week-0/AllisonBojarski/AnimalSort(HWproblem#1)/src/nyc/c4q/alizinha/DomesticCat.java @@ -0,0 +1,37 @@ +package nyc.c4q.alizinha; +/** + * Created by c4q-Allison on 5/1/15. + */ +public class DomesticCat extends Animal implements Domestic +{ + + String name; + + @Override + public String getName() + { + return this.name; + } + + @Override + public void setName(String name) + { + this.name = name; + } + + @Override + public int compareTo(Animal o) + { + if (o instanceof Domestic) { + Domestic a1 = (Domestic) o; + return this.getName().compareTo(a1.getName()); + } + return super.compareTo(o); + } + + @Override + public boolean equals(Object obj) + { + return super.equals(obj); + } +} diff --git a/homework/week-0/AllisonBojarski/AnimalSort(HWproblem#1)/src/nyc/c4q/alizinha/Main.java b/homework/week-0/AllisonBojarski/AnimalSort(HWproblem#1)/src/nyc/c4q/alizinha/Main.java new file mode 100644 index 00000000..2d490b7b --- /dev/null +++ b/homework/week-0/AllisonBojarski/AnimalSort(HWproblem#1)/src/nyc/c4q/alizinha/Main.java @@ -0,0 +1,47 @@ +package nyc.c4q.alizinha; + +import java.util.ArrayList; +import java.util.Collections; + +public class Main { +// Problem 1: Animal Sort +// +// Create an Animal class that includes a "species name" field and implements the Comparable interface. Compare two +// animals by species name, alphabetically. +// Implement equals to compare by species name. +// Test your compareTo function by creating an array of Animal instances and calling sort. +// Create the Domestic interface. This interface should include getters and setters for a name field, since pets tend +// to have their own names. +// Create a class for a Domestic Animal, perhaps a DomesticCat, that both inherits from Animal and implements the +// Domestic interface. +// Implement the compareTo function for your Domestic animal so that it compares two such animals by their given name +// instead of their species name. +// Implement equals to compare by given name. +// Create a constructor for your Domestic animal that takes in both the species name and given name. +// Test your compareTo function by creating an array and calling sort. + + public static void main(String[] args) { + + Animal a1 = new Animal(); + Animal a2 = new Animal(); + a1.compareTo(a2); + + ArrayList list = new ArrayList(); + + + DomesticCat c1 = new DomesticCat(); + + + Animal a4 = new DomesticCat(); + + DomesticCat c5 = (DomesticCat) a4; + + DomesticCat c2 = new DomesticCat(); + + ArrayList list5 = new ArrayList(); + + + Collections.sort(list); + + } +} diff --git a/homework/week-0/AllisonBojarski/Cards(HWproblem#2)/src/nyc/c4q/alizinha/Card.java b/homework/week-0/AllisonBojarski/Cards(HWproblem#2)/src/nyc/c4q/alizinha/Card.java new file mode 100644 index 00000000..8a2b59f3 --- /dev/null +++ b/homework/week-0/AllisonBojarski/Cards(HWproblem#2)/src/nyc/c4q/alizinha/Card.java @@ -0,0 +1,14 @@ +package nyc.c4q.alizinha; +/** + * Created by c4q-Allison on 5/2/15. + */ +public class Card +{ + String number; + String suit; + + public Card (String number, String suit){ + this.number = number; + this.suit = suit; + } +} diff --git a/homework/week-0/AllisonBojarski/Cards(HWproblem#2)/src/nyc/c4q/alizinha/Game.java b/homework/week-0/AllisonBojarski/Cards(HWproblem#2)/src/nyc/c4q/alizinha/Game.java new file mode 100644 index 00000000..157ea4e6 --- /dev/null +++ b/homework/week-0/AllisonBojarski/Cards(HWproblem#2)/src/nyc/c4q/alizinha/Game.java @@ -0,0 +1,10 @@ +package nyc.c4q.alizinha; +import java.util.ArrayList; + +/** + * Created by c4q-Allison on 5/2/15. + */ +abstract public class Game +{ + abstract ArrayList getPieces(); +} diff --git a/homework/week-0/AllisonBojarski/Cards(HWproblem#2)/src/nyc/c4q/alizinha/Main.java b/homework/week-0/AllisonBojarski/Cards(HWproblem#2)/src/nyc/c4q/alizinha/Main.java new file mode 100644 index 00000000..1f49776f --- /dev/null +++ b/homework/week-0/AllisonBojarski/Cards(HWproblem#2)/src/nyc/c4q/alizinha/Main.java @@ -0,0 +1,11 @@ +package nyc.c4q.alizinha; + +public class Main { + + public static void main(String[] args) { + // write your code here + + + + } +} diff --git a/homework/week-0/AllisonBojarski/Cards(HWproblem#2)/src/nyc/c4q/alizinha/PlayingCards.java b/homework/week-0/AllisonBojarski/Cards(HWproblem#2)/src/nyc/c4q/alizinha/PlayingCards.java new file mode 100644 index 00000000..0cdebabf --- /dev/null +++ b/homework/week-0/AllisonBojarski/Cards(HWproblem#2)/src/nyc/c4q/alizinha/PlayingCards.java @@ -0,0 +1,30 @@ +package nyc.c4q.alizinha; +import java.util.ArrayList; +import java.util.Collections; + +/** + * Created by c4q-Allison on 5/2/15. + */ +public class PlayingCards extends Game +{ + ArrayList deck; + + public PlayingCards() { + + String[] number = new String[]{"Ace", "Deuce", "Three"}; + String[] suit = new String[] {"Spades", "Clubs",}; + deck = new ArrayList(); + for (int i = 0; i < number.length; i++) { + for (int j = 0; j < suit.length; j++ ){ + deck.add(new Card(number[i], suit[j])); + } + } + + } + @Override + ArrayList getPieces(){ + Collections.shuffle(deck); + return deck; + } + +} diff --git a/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Character.java b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Character.java new file mode 100644 index 00000000..6c0cd241 --- /dev/null +++ b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Character.java @@ -0,0 +1,52 @@ +package nyc.c4q.alizinha; +/** + * Created by c4q-Allison on 5/6/15. + */ +public abstract class Character +{ + // Every character has... + String charName; + int healthPoints; + Weapon weapon; + private Room room; + // inventory of items + + public Character(String charName, int healthPoints, Weapon weapon, Room room) + { + this.charName = charName; + this.healthPoints = healthPoints; + this.weapon = weapon; + this.room = room; + } + + public String getCharName() + { + return charName; + } + + public int getHealthPoints() + { + return healthPoints; + } + + public Weapon getWeapon() + { + return weapon; + } + + public void calcDamage(int damagePoints) + { + healthPoints -= damagePoints; + } + + public void setRoom(Room room) + { + this.room = room; + } + + public Room getRoom() + { + return room; + } + +} diff --git a/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Defender.java b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Defender.java new file mode 100644 index 00000000..ad8d137f --- /dev/null +++ b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Defender.java @@ -0,0 +1,9 @@ +package nyc.c4q.alizinha; +/** + * Created by c4q-Allison on 5/6/15. + */ +public interface Defender +{ + public int calcShieldSize (int damagePoints); + +} diff --git a/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Enemy.java b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Enemy.java new file mode 100644 index 00000000..5287a0e5 --- /dev/null +++ b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Enemy.java @@ -0,0 +1,18 @@ +package nyc.c4q.alizinha; +/** + * Created by c4q-Allison on 5/6/15. + */ +public class Enemy extends Character implements Defender +{ + public Enemy(String charName, int healthPoints, Weapon weapon, Room room) + { + super(charName, healthPoints, weapon, room); + } + + @Override + public int calcShieldSize(int damagePoints) + { + return 10; + } +} + diff --git a/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Fight.java b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Fight.java new file mode 100644 index 00000000..dca37b99 --- /dev/null +++ b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Fight.java @@ -0,0 +1,7 @@ +package nyc.c4q.alizinha; +/** + * Created by c4q-Allison on 5/6/15. + */ +public interface Fight +{ +} diff --git a/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Main.java b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Main.java new file mode 100644 index 00000000..ada02d97 --- /dev/null +++ b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Main.java @@ -0,0 +1,26 @@ +package nyc.c4q.alizinha; + +public class Main +{ + + public static void main(String[] args) + { + Room basement = new Room("Basement", "You can barely see your enemy in the shadows."); + Weapon knife = new Weapon("scimitar", 10); + + Player player = new Player("Stan", 100, knife, basement); + Enemy enemy = new Enemy("Karl", 100, knife, basement); + + if(player.getRoom().equals(enemy.getRoom())) + { + while(player.getHealthPoints() > 0) + { + player.calcDamage(enemy.getWeapon().damagePoints); + System.out.println("Player health points: " + player.getHealthPoints()); + + enemy.calcDamage(player.getWeapon().damagePoints); + System.out.println("Enemy health points: " + enemy.getHealthPoints()); + } + } + } +} diff --git a/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Player.java b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Player.java new file mode 100644 index 00000000..1d7163b5 --- /dev/null +++ b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Player.java @@ -0,0 +1,18 @@ +package nyc.c4q.alizinha; +/** + * Created by c4q-Allison on 5/6/15. + */ +public class Player extends Character implements Defender +{ + public Player(String charName, int healthPoints, Weapon weapon, Room room) + { + super(charName, healthPoints, weapon, room); + } + + @Override + public int calcShieldSize(int damagePoints) + { + return 10; + } +} + diff --git a/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Room.java b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Room.java new file mode 100644 index 00000000..91fe03b7 --- /dev/null +++ b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Room.java @@ -0,0 +1,31 @@ +package nyc.c4q.alizinha; +/** + * Created by c4q-Allison on 5/6/15. + */ +public class Room +{ + // Every room has... + String roomName; + String roomDescription; + // ArrayList items? + + public Room(String roomName, String roomDescription) + { + this.roomName = roomName; + this.roomDescription = roomDescription; + } + + // Get room name + public String getRoomName() + { + return roomName; + } + + // Set room name + public void setRoomName(String name) + { + roomName = name; + } + + // Print desc +} diff --git a/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Weapon.java b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Weapon.java new file mode 100644 index 00000000..bc965dd4 --- /dev/null +++ b/homework/week-0/AllisonBojarski/TextAdvGame(HWproblem#3)/src/nyc/c4q/alizinha/Weapon.java @@ -0,0 +1,16 @@ +package nyc.c4q.alizinha; +/** + * Created by c4q-Allison on 5/6/15. + */ +public class Weapon +{ + // Every weapon has... + String weaponName; + int damagePoints; + + public Weapon(String weaponName, int damagePoints) + { + this.weaponName = weaponName; + this.damagePoints = damagePoints; + } +} diff --git a/homework/week-0.md b/homework/week-0/week-0.md similarity index 100% rename from homework/week-0.md rename to homework/week-0/week-0.md diff --git a/homework/week-1/AllisonBojarski/HoroscopeApp/.gitignore b/homework/week-1/AllisonBojarski/HoroscopeApp/.gitignore new file mode 100644 index 00000000..afbdab33 --- /dev/null +++ b/homework/week-1/AllisonBojarski/HoroscopeApp/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/homework/week-1/AllisonBojarski/HoroscopeApp/app/.gitignore b/homework/week-1/AllisonBojarski/HoroscopeApp/app/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/homework/week-1/AllisonBojarski/HoroscopeApp/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/homework/week-1/AllisonBojarski/HoroscopeApp/app/build.gradle b/homework/week-1/AllisonBojarski/HoroscopeApp/app/build.gradle new file mode 100644 index 00000000..74bbd915 --- /dev/null +++ b/homework/week-1/AllisonBojarski/HoroscopeApp/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 22 + buildToolsVersion "22.0.1" + + defaultConfig { + applicationId "alizinha.c4q.nyc.horoscopeapp" + minSdkVersion 15 + 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']) + compile 'com.android.support:appcompat-v7:22.1.1' +} diff --git a/homework/week-1/AllisonBojarski/HoroscopeApp/app/proguard-rules.pro b/homework/week-1/AllisonBojarski/HoroscopeApp/app/proguard-rules.pro new file mode 100644 index 00000000..7d838ea9 --- /dev/null +++ b/homework/week-1/AllisonBojarski/HoroscopeApp/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/c4q-Allison/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/homework/week-1/AllisonBojarski/HoroscopeApp/app/src/androidTest/java/alizinha/c4q/nyc/horoscopeapp/ApplicationTest.java b/homework/week-1/AllisonBojarski/HoroscopeApp/app/src/androidTest/java/alizinha/c4q/nyc/horoscopeapp/ApplicationTest.java new file mode 100644 index 00000000..8407b406 --- /dev/null +++ b/homework/week-1/AllisonBojarski/HoroscopeApp/app/src/androidTest/java/alizinha/c4q/nyc/horoscopeapp/ApplicationTest.java @@ -0,0 +1,13 @@ +package alizinha.c4q.nyc.horoscopeapp; + +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/homework/week-1/AllisonBojarski/HoroscopeApp/app/src/main/AndroidManifest.xml b/homework/week-1/AllisonBojarski/HoroscopeApp/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000..5d4d572e --- /dev/null +++ b/homework/week-1/AllisonBojarski/HoroscopeApp/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/homework/week-1/AllisonBojarski/HoroscopeApp/app/src/main/java/alizinha/c4q/nyc/horoscopeapp/MainActivity.java b/homework/week-1/AllisonBojarski/HoroscopeApp/app/src/main/java/alizinha/c4q/nyc/horoscopeapp/MainActivity.java new file mode 100644 index 00000000..163df3df --- /dev/null +++ b/homework/week-1/AllisonBojarski/HoroscopeApp/app/src/main/java/alizinha/c4q/nyc/horoscopeapp/MainActivity.java @@ -0,0 +1,39 @@ +package alizinha.c4q.nyc.horoscopeapp; + +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; + + +public class MainActivity extends ActionBarActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } + + + @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); + 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. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/homework/week-1/AllisonBojarski/HoroscopeApp/app/src/main/res/layout/activity_main.xml b/homework/week-1/AllisonBojarski/HoroscopeApp/app/src/main/res/layout/activity_main.xml new file mode 100644 index 00000000..11c51fdb --- /dev/null +++ b/homework/week-1/AllisonBojarski/HoroscopeApp/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,113 @@ + + + +