diff --git a/.gitignore b/.gitignore
index d6bfc95..156194a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,24 @@
-.gradle
-/local.properties
-/.idea/workspace.xml
+# Android Studio project files
+*.iws
+.idea/workspace.xml
+.idea/tasks.xml
.DS_Store
+
+# generated folders
+build/
+bin/
+gen/
+.gradle/
+
+# Local configuration file (sdk path, etc)
+local.properties
+
+#built application files
+*.apk
+*.ap_
+
+# files for the dex VM
+*.dex
+
+# Java class files
+*.class
diff --git a/.idea/.name b/.idea/.name
index ea23bb6..146ef2b 100644
--- a/.idea/.name
+++ b/.idea/.name
@@ -1 +1 @@
-Recycle Austin
\ No newline at end of file
+RecycleAustin
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index e0c956e..5b28541 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -5,10 +5,12 @@
+
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..cb6c532
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..3b31283
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/appcompat_v7_19_1_0.xml b/.idea/libraries/appcompat_v7_19_1_0.xml
deleted file mode 100644
index 5bd6ea8..0000000
--- a/.idea/libraries/appcompat_v7_19_1_0.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/hamcrest_core_1_3.xml b/.idea/libraries/hamcrest_core_1_3.xml
new file mode 100644
index 0000000..157e3f3
--- /dev/null
+++ b/.idea/libraries/hamcrest_core_1_3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/jsoup_1_7_3.xml b/.idea/libraries/jsoup_1_7_3.xml
new file mode 100644
index 0000000..988200c
--- /dev/null
+++ b/.idea/libraries/jsoup_1_7_3.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/junit_4_11.xml b/.idea/libraries/junit_4_11.xml
new file mode 100644
index 0000000..40820ce
--- /dev/null
+++ b/.idea/libraries/junit_4_11.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/support_v4_19_1_0.xml b/.idea/libraries/support_v4_19_1_0.xml
deleted file mode 100644
index 3f6ff2d..0000000
--- a/.idea/libraries/support_v4_19_1_0.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index e0bebd3..c0dc56f 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,6 +3,9 @@
+
+
+
@@ -21,19 +24,7 @@
- Android 4.2.2
-
-
-
-
-
-
-
-
-
-
-
- Android 4.2.2
+ JDK
diff --git a/.idea/modules.xml b/.idea/modules.xml
index d6566e3..ad30f18 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -4,6 +4,7 @@
+
diff --git a/README.md b/README.md
index f7c1e5c..bb17f36 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
Recycle Austin
=============
-Android app being developed by the Austin Droid's group (http://www.meetup.com/Austin-Android/) to help Austinites learn about Recycling options and services in their communities.
+Android app being developed by the Austin Droid group (http://www.meetup.com/Austin-Android/) to help Austinites learn about Recycling options and services in their communities.
diff --git a/Recycle Austin/.gitignore b/Recycle Austin/.gitignore
index 796b96d..e0c213f 100644
--- a/Recycle Austin/.gitignore
+++ b/Recycle Austin/.gitignore
@@ -1 +1,5 @@
-/build
+*.gradle
+build/
+local.properties
+.idea/workspace.xml
+.DS_Store
\ No newline at end of file
diff --git a/Recycle Austin/Recycle Austin.iml b/Recycle Austin/Recycle Austin.iml
index a6fbf22..0277e55 100644
--- a/Recycle Austin/Recycle Austin.iml
+++ b/Recycle Austin/Recycle Austin.iml
@@ -22,19 +22,19 @@
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -56,22 +56,13 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
diff --git a/Recycle Austin/build.gradle b/Recycle Austin/build.gradle
index a0c7ae8..6620337 100644
--- a/Recycle Austin/build.gradle
+++ b/Recycle Austin/build.gradle
@@ -2,13 +2,12 @@ apply plugin: 'android'
android {
compileSdkVersion 19
- buildToolsVersion "19.1.0"
-
+ buildToolsVersion '19.1.0'
defaultConfig {
- minSdkVersion 8
+ minSdkVersion 11
targetSdkVersion 19
versionCode 1
- versionName "1.0"
+ versionName '1.0'
}
buildTypes {
release {
@@ -16,10 +15,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
+ productFlavors {
+ }
}
dependencies {
+ compile project(':Services')
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:support-v4:19.1.0'
- compile 'com.android.support:appcompat-v7:19.1.0'
}
diff --git a/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/activities/MainActivityUnitTest.java b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/activities/MainActivityUnitTest.java
new file mode 100644
index 0000000..85a9286
--- /dev/null
+++ b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/activities/MainActivityUnitTest.java
@@ -0,0 +1,74 @@
+package com.austindroids.recycleaustin.activities;
+
+import android.content.ComponentName;
+import android.content.Intent;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.widget.AdapterView;
+import android.widget.GridView;
+import android.widget.ListAdapter;
+
+import com.austindroids.recycleaustin.R;
+
+
+/**
+ * Provides unit testing of an Activity. This test creates the Activity in isolation, and provides it with a context.
+ *
+ * @author Dutch
+ */
+public class MainActivityUnitTest extends
+ android.test.ActivityUnitTestCase {
+
+ private int gridviewId;
+ private MainActivity activity;
+
+ public MainActivityUnitTest() {
+ super(MainActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ Intent intent = new Intent(getInstrumentation().getTargetContext(),
+ MainActivity.class);
+ startActivity(intent, null, null);
+ activity = getActivity();
+ }
+
+ @SmallTest
+ public void testLayout() {
+ gridviewId = R.id.dashboard_grid;
+ assertNotNull(activity.findViewById(gridviewId));
+ GridView view = (GridView) activity.findViewById(gridviewId);
+
+ assertEquals("Incorrect stretchmode", GridView.STRETCH_COLUMN_WIDTH, view.getStretchMode());
+ }
+
+ @SmallTest
+ public void testIntentTriggerViaOnClick() {
+ int position = 1;
+ assertNotNull(activity);
+ GridView gridview = (GridView) activity.findViewById(R.id.dashboard_grid);
+ ListAdapter adapter = gridview.getAdapter();
+
+
+ gridview.setSelection(position);
+ assertEquals(position, gridview.getSelectedItemPosition());
+
+ AdapterView.OnItemClickListener listener = (AdapterView.OnItemClickListener) activity;
+
+ gridview.performItemClick(
+ gridview.getAdapter().getView(position, null, null),
+ position,
+ gridview.getAdapter().getItemId(position));
+
+ // TouchUtils cannot be used, only allowed in
+ // InstrumentationTestCase or ActivityInstrumentationTestCase2
+
+ // Check the intent which was started
+ Intent triggeredIntent = getStartedActivityIntent();
+ ComponentName className = triggeredIntent.getComponent();
+ assertEquals("Activity doesn't match",
+ "com.austindroids.recycleaustin.activities.RecycleLocationsActivity",
+ className.getClassName());
+ }
+}
\ No newline at end of file
diff --git a/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/activities/RecycleFlowScreenActivityFunctionalTest.java b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/activities/RecycleFlowScreenActivityFunctionalTest.java
new file mode 100644
index 0000000..56cfc12
--- /dev/null
+++ b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/activities/RecycleFlowScreenActivityFunctionalTest.java
@@ -0,0 +1,98 @@
+package com.austindroids.recycleaustin.activities;
+
+import android.app.KeyguardManager;
+import android.content.Context;
+import android.os.SystemClock;
+import android.test.ActivityInstrumentationTestCase2;
+import android.test.TouchUtils;
+import android.view.KeyEvent;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import com.austindroids.recycleaustin.R;
+
+/**
+ * Created by Dutch on 6/27/2014.
+ *
+ * Provides functional testing of an Activity. It uses TouchUtils to simulate a user actually operating the UI.
+ *
+ */
+public class RecycleFlowScreenActivityFunctionalTest
+ extends
+ ActivityInstrumentationTestCase2 {
+
+ private RecycleFlowScreenActivity activity;
+ /** The Spinner widget to be tested */
+ Spinner mSpinner;
+
+ public RecycleFlowScreenActivityFunctionalTest() {
+ super(RecycleFlowScreenActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ setActivityInitialTouchMode(true);
+ activity = getActivity();
+ Context context = activity.getApplicationContext();
+ KeyguardManager km =
+ (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
+ if (km.inKeyguardRestrictedInputMode())
+ {
+ KeyguardManager.KeyguardLock lock = km.newKeyguardLock("some_tag");
+ lock.disableKeyguard();
+ SystemClock.sleep(2000);
+ }
+ }
+
+ public void testClickSpinner() {
+ mSpinner = (Spinner) activity.findViewById(R.id.spinnerOps1);
+
+ final int INITIAL_POSITION=0;
+ final int FINAL_POSITION=mSpinner.getAdapter().getCount();
+ String expected = "Expected";
+ String actual;
+
+ /** Iterates through each item in the Spinner widget */
+ for(int i=INITIAL_POSITION;i<=FINAL_POSITION;i++){
+ try {
+ runTestOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ /** Sets the first item as the current item in the Spinner widget */
+ mSpinner.setSelection(INITIAL_POSITION);
+ }
+ });
+ }catch (Throwable e) {
+ e.printStackTrace();
+ }
+
+ /** Taps the Spinner Widget */
+ TouchUtils.tapView(this, mSpinner);
+
+ /** Send i number of Down KeyPad event to Spinner widget,
+ * since it is the currently selected widget */
+ sendRepeatedKeys(i,KeyEvent.KEYCODE_DPAD_DOWN);
+
+ /** Sets the currently selected item as the current item of the Spinner */
+ sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
+
+ /** Getting the currently selected item */
+ actual = mSpinner.getSelectedItem().toString();
+
+ /** Checks, whether currently selected Spinner item and the text displayed are same
+ * If same, then the test is success, otherwise failed*/
+ assertEquals("Text of Spinner was not expected.", expected, actual);
+
+ /** This Thread.sleep() is not necessary, but provided just to slow down the testing process
+ * so that we can manually monitor the happenings while testing in progress
+ */
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+}
diff --git a/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/activities/StubActivity.java b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/activities/StubActivity.java
new file mode 100644
index 0000000..ec2bbbc
--- /dev/null
+++ b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/activities/StubActivity.java
@@ -0,0 +1,70 @@
+package com.austindroids.recycleaustin.activities;
+
+import android.app.Activity;
+import android.content.Context;
+import android.location.Location;
+import android.location.LocationListener;
+import android.location.LocationManager;
+import android.os.Bundle;
+import android.text.Layout;
+import android.view.View;
+import android.widget.Button;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.austindroids.recycleaustin.R;
+import com.austindroids.recycleaustin.service.GeoCodingService;
+
+public class StubActivity extends Activity {
+
+ Button button;
+
+Location currentLocation=null;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ createLayout();
+ addListenerOnButton();
+ }
+
+ public void addListenerOnButton() {
+ GeoCodingService service = new GeoCodingService((getApplicationContext()));
+ this.currentLocation = service.getCurrentLocation();
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View arg0) {
+ GeoCodingService service = new GeoCodingService(getApplicationContext());
+ Toast.makeText(getApplicationContext(),
+ "Location:" + service.getCurrentLocation(), Toast.LENGTH_SHORT)
+ .show();
+
+
+ }
+ });
+ }
+
+ void createLayout() {
+ LinearLayout lLayout = new LinearLayout(this);
+ lLayout.setOrientation(LinearLayout.VERTICAL);
+ //-1(LayoutParams.MATCH_PARENT) is fill_parent or match_parent since API level 8
+ //-2(LayoutParams.WRAP_CONTENT) is wrap_content
+ lLayout.setLayoutParams(new LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.MATCH_PARENT,
+ LinearLayout.LayoutParams.MATCH_PARENT));
+ this.button = new Button(this);
+ TextView tView = new TextView(this);
+ tView.setText("Hello, This is a view created programmatically! " +
+ "You CANNOT change me that easily :-)");
+ tView.setLayoutParams(new LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.MATCH_PARENT,
+ LinearLayout.LayoutParams.WRAP_CONTENT));
+ lLayout.addView(tView);
+ lLayout.addView(this.button);
+ setContentView(lLayout);
+
+ }
+
+
+}
diff --git a/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/activities/StubActivityFuctionalTest.java b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/activities/StubActivityFuctionalTest.java
new file mode 100644
index 0000000..dd566bf
--- /dev/null
+++ b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/activities/StubActivityFuctionalTest.java
@@ -0,0 +1,58 @@
+package com.austindroids.recycleaustin.activities;
+
+import android.app.KeyguardManager;
+import android.content.Context;
+import android.location.Location;
+import android.os.SystemClock;
+import android.test.ActivityInstrumentationTestCase2;
+import android.test.TouchUtils;
+import android.view.KeyEvent;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import com.austindroids.recycleaustin.R;
+import com.austindroids.recycleaustin.service.GeoCodingService;
+
+/**
+ * Created by Dutch on 6/27/2014.
+ */
+public class StubActivityFuctionalTest
+ extends
+ ActivityInstrumentationTestCase2 {
+
+ private StubActivity activity;
+
+
+ String [] items = new String [] {"paper", "aluminumMetals", "boxCardBoard", "glass", "plastics", "rigidPlastics", "organicMatter"};
+
+
+
+ String [] itemsdesc = new String [] {"Paper", "Aluminum and Metals", "Boxboards and Cardboard", "Glass", "Plastics", "Rigid Plastic Containers (Labeled #1-7)", "Organic Matter"};
+
+ public StubActivityFuctionalTest() {
+ super(StubActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ setActivityInitialTouchMode(true);
+ activity = getActivity();
+ Context context = activity.getApplicationContext();
+ KeyguardManager km =
+ (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
+ if (km.inKeyguardRestrictedInputMode())
+ {
+ KeyguardManager.KeyguardLock lock = km.newKeyguardLock("some_tag");
+ lock.disableKeyguard();
+ SystemClock.sleep(2000);
+ }
+ }
+
+ public void testStub() {
+ GeoCodingService service = new GeoCodingService((activity.getApplicationContext()));
+ Location location = service.getCurrentLocation();
+ assertNotNull("Location is null", service.getCurrentLocation());
+ }
+
+}
diff --git a/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/service/GeoCodingServiceTest.java b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/service/GeoCodingServiceTest.java
new file mode 100644
index 0000000..9c71f66
--- /dev/null
+++ b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/service/GeoCodingServiceTest.java
@@ -0,0 +1,36 @@
+package com.austindroids.recycleaustin.service;
+
+import android.app.Application;
+import android.content.Context;
+import android.location.Location;
+import android.test.AndroidTestCase;
+import android.test.ApplicationTestCase;
+import android.test.InstrumentationTestCase;
+
+
+/**
+ * Provides unit testing of a service, but does so in an Android environment. Provides a real (not mock) context to
+ * the service being tested.
+ *
+ * @author Dutch
+ */
+public class GeoCodingServiceTest extends ApplicationTestCase {
+
+
+
+ public GeoCodingServiceTest() {
+ super(TestApplication.class);
+ }
+
+ public void testService() {
+ //testApplicationTestCaseSetUpProperly();
+ Context context = getSystemContext();
+ GeoCodingService service = new GeoCodingService(context);
+ assertNotNull("Context is null.", context);
+ Location location = service.getCurrentLocation();
+ assertNotNull("Returned location is null.", location);
+ assertTrue("Location is not valid in austin", (location.getLatitude() > 0));
+
+ }
+
+}
diff --git a/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/service/SodaQueryServiceTest.java b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/service/SodaQueryServiceTest.java
new file mode 100644
index 0000000..9a36d6a
--- /dev/null
+++ b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/service/SodaQueryServiceTest.java
@@ -0,0 +1,96 @@
+package com.austindroids.recycleaustin.service;
+
+import android.test.InstrumentationTestCase;
+
+import java.util.ArrayList;
+
+public class SodaQueryServiceTest extends InstrumentationTestCase {
+ private SodaQueryService query;
+ private String address;
+
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void tearDown() throws Exception {
+
+ }
+
+ public void testSend() throws Exception {
+ address = "6608 Marble Creek Loop";
+ query = new SodaQueryService(address);
+ ArrayList results = query.send();
+ boolean check1 = results.contains("Google JSON Address Problem");
+ boolean check2 = results.contains("Address Problem");
+ boolean check3 = results.contains("Schedule JSON Exception");
+ boolean check4 = results.contains("Not in Austin");
+ boolean check5 = results.size() == 4;
+ assertEquals("A problem parsing the Google JSON response happened. If this occurs, God help us!", false, check1);
+ assertEquals("This will be true if a badly formatted address was passed", false, check2);
+ assertEquals("This will be true if an Austin address was passed, but the schedule doesn't exist", false, check3);
+ assertEquals("This will be true if someone typed in a different city than Austin", false, check4);
+ assertEquals("Successful queries should always produce 4 items in results", true, check5);
+ assertNotNull("Queries should never return null for results even if they fail", results);
+
+ address = "";
+ query = new SodaQueryService(address);
+ results = query.send();
+ check1 = results.contains("Google JSON Address Problem");
+ check2 = results.contains("Address Problem");
+ check3 = results.contains("Schedule JSON Exception");
+ check4 = results.contains("Not in Austin");
+ check5 = results.size() == 4;
+ assertEquals("A problem parsing the Google JSON response happened. If this occurs, God help us!", false, check1);
+ assertEquals("This will be true if a badly formatted address was passed", true, check2);
+ assertEquals("This will be true if an Austin address was passed, but the schedule doesn't exist", false, check3);
+ assertEquals("This will be true if someone typed in a different city than Austin", false, check4);
+ assertEquals("Failed queries should always produce less than 4 items in results", false, check5);
+ assertNotNull("Queries should never return null for results even if they fail", results);
+
+ address = "bjkaldhngaw";
+ query = new SodaQueryService(address);
+ results = query.send();
+ check1 = results.contains("Google JSON Address Problem");
+ check2 = results.contains("Address Problem");
+ check3 = results.contains("Schedule JSON Exception");
+ check4 = results.contains("Not in Austin");
+ check5 = results.size() == 4;
+ assertEquals("A problem parsing the Google JSON response happened. If this occurs, God help us!", false, check1);
+ assertEquals("This will be true if a badly formatted address was passed", true, check2);
+ assertEquals("This will be true if an Austin address was passed, but the schedule doesn't exist", false, check3);
+ assertEquals("This will be true if someone typed in a different city than Austin", false, check4);
+ assertEquals("Failed queries should always produce less than 4 items in results", false, check5);
+ assertNotNull("Queries should never return null for results even if they fail", results);
+
+ address = "2028 Greenlee Dr, El Paso, Tx 79936";
+ query = new SodaQueryService(address);
+ results = query.send();
+ check1 = results.contains("Google JSON Address Problem");
+ check2 = results.contains("Address Problem");
+ check3 = results.contains("Schedule JSON Exception");
+ check4 = results.contains("Not in Austin");
+ check5 = results.size() == 4;
+ assertEquals("A problem parsing the Google JSON response happened. If this occurs, God help us!", false, check1);
+ assertEquals("This will be true if a badly formatted address was passed", false, check2);
+ assertEquals("This will be true if an Austin address was passed, but the schedule doesn't exist", false, check3);
+ assertEquals("This will be true if someone typed in a different city than Austin", true, check4);
+ assertEquals("Failed queries should always produce less than 4 items in results", false, check5);
+ assertNotNull("Queries should never return null for results even if they fail", results);
+
+ address = "1016 La Posada Dr";
+ query = new SodaQueryService(address);
+ results = query.send();
+ check1 = results.contains("Google JSON Address Problem");
+ check2 = results.contains("Address Problem");
+ check3 = results.contains("Schedule JSON Exception");
+ check4 = results.contains("Not in Austin");
+ check5 = results.size() == 4;
+ assertEquals("A problem parsing the Google JSON response happened. If this occurs, God help us!", false, check1);
+ assertEquals("This will be true if a badly formatted address was passed", false, check2);
+ assertEquals("This will be true if an Austin address was passed, but the schedule doesn't exist", true, check3);
+ assertEquals("This will be true if someone typed in a different city than Austin", false, check4);
+ assertEquals("Failed queries should always produce less than 4 items in results", false, check5);
+ assertNotNull("Queries should never return null for results even if they fail", results);
+ }
+
+}
\ No newline at end of file
diff --git a/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/service/TestApplication.java b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/service/TestApplication.java
new file mode 100644
index 0000000..3c84be5
--- /dev/null
+++ b/Recycle Austin/src/androidTest/java/com/austindroids/recycleaustin/service/TestApplication.java
@@ -0,0 +1,13 @@
+package com.austindroids.recycleaustin.service;
+
+import android.app.Application;
+
+/**
+ * Created by dutch on 6/30/14.
+ */
+public class TestApplication extends Application {
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ }
+}
diff --git a/Recycle Austin/src/main/AndroidManifest.xml b/Recycle Austin/src/main/AndroidManifest.xml
index 135fc51..fb8dd0f 100644
--- a/Recycle Austin/src/main/AndroidManifest.xml
+++ b/Recycle Austin/src/main/AndroidManifest.xml
@@ -1,21 +1,43 @@
+ package="com.austindroids.recycleaustin">
+
+
+
+
+ android:theme="@style/AppTheme">
+ android:name=".activities.MainActivity"
+ android:label="@string/app_name">
-
+
+
+
+
+
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/MainActivity.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/MainActivity.java
deleted file mode 100644
index 6730242..0000000
--- a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/MainActivity.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.austindroids.recycleaustin;
-
-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.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();
- if (id == R.id.action_settings) {
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-}
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/FindRecycleServiceActivity.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/FindRecycleServiceActivity.java
new file mode 100644
index 0000000..ed751d7
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/FindRecycleServiceActivity.java
@@ -0,0 +1,14 @@
+package com.austindroids.recycleaustin.activities;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class FindRecycleServiceActivity extends Activity {
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+}
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/MainActivity.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/MainActivity.java
new file mode 100644
index 0000000..7ae3698
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/MainActivity.java
@@ -0,0 +1,102 @@
+package com.austindroids.recycleaustin.activities;
+
+import android.app.Activity;
+import android.app.ActionBar;
+import android.app.AlertDialog;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.GridView;
+import android.widget.Toast;
+
+import com.austindroids.recycleaustin.adapters.DashboardAdapter;
+import com.austindroids.recycleaustin.R;
+
+public class MainActivity extends Activity implements OnItemClickListener {
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ GridView gridview = (GridView) findViewById(R.id.dashboard_grid);
+ gridview.setAdapter(new DashboardAdapter(this));
+ gridview.setOnItemClickListener(this);
+
+ // Hack to disable GridView scrolling
+ gridview.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ return event.getAction() == MotionEvent.ACTION_MOVE;
+ }
+ });
+ }
+
+ @Override
+ public void onItemClick(AdapterView> parent, View v, int position, long id) {
+ Intent intent;
+
+ switch (position) {
+ case 0:
+ intent = new Intent(this, SodaQueryActivity.class);
+ break;
+ case 1:
+ intent = new Intent(this, RecycleLocationsActivity.class);
+ break;
+ case 2:
+ intent = new Intent(this, FindRecycleServiceActivity.class);
+ break;
+ case 3:
+ intent = new Intent(this, RecycleFlowScreenActivity.class);
+ break;
+ default:
+ intent = new Intent(this, SodaQueryActivity.class);
+ break;
+ }
+
+ startActivity(intent);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.main, menu);
+ ActionBar actionBar = getActionBar();
+ actionBar.setSubtitle("Recycler App");
+ actionBar.setTitle("Recycler App");
+ //actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.ic_launcher));
+ // Dim navigation buttons on bottom
+ getWindow().
+ getDecorView().
+ setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.menu_appteam:
+ String teamInfo = "Jessica Tyler\nNitin Kurian John\nMatt Hernandez";
+ AlertDialog.Builder infoDialog = new AlertDialog.Builder(MainActivity.this);
+ infoDialog.setTitle("App Team");
+ infoDialog.setMessage(teamInfo);
+ infoDialog.show();
+ return true;
+ case R.id.action_settings:
+ Toast.makeText(getApplicationContext(),
+ "Settings not Available.", Toast.LENGTH_SHORT)
+ .show();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+
+}
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/RecycleFlowScreenActivity.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/RecycleFlowScreenActivity.java
new file mode 100644
index 0000000..c62d9ef
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/RecycleFlowScreenActivity.java
@@ -0,0 +1,414 @@
+package com.austindroids.recycleaustin.activities;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.Spinner;
+
+import com.austindroids.recycleaustin.R;
+import com.austindroids.recycleaustin.beans.RecyclableTrueFalse;
+
+
+public class RecycleFlowScreenActivity extends Activity {
+
+ Button RecyclableButton;
+ Button NonRecyclableButton;
+
+
+ private RecyclableTrueFalse[] boxcardBoardAnswerBank = new RecyclableTrueFalse[]{
+
+ new RecyclableTrueFalse(R.string.cardBoard, true),
+ new RecyclableTrueFalse(R.string.boxBoard, true),
+ new RecyclableTrueFalse(R.string.shoeBox, true),
+ new RecyclableTrueFalse(R.string.pizzaBox, false)
+
+ };
+
+
+ private RecyclableTrueFalse[] dummyAnswerBank = new RecyclableTrueFalse[]{
+
+ new RecyclableTrueFalse(R.string.dummyTrueItem, true),
+ new RecyclableTrueFalse(R.string.dummyFalseItem, false),
+
+ };
+
+
+ private Button showRecyclableButton(Button bt1, Button bt2) {
+ bt1.setVisibility(View.VISIBLE);
+ bt2.setVisibility(View.INVISIBLE);
+ return bt1;
+
+ }
+
+
+ private Button showNonRecyclableButton(Button bt1, Button bt2) {
+ bt1.setVisibility(View.VISIBLE);
+ bt2.setVisibility(View.INVISIBLE);
+ return bt1;
+
+ }
+
+ private Button hideNonRecyclableButton(Button bt) {
+ bt.setVisibility(View.INVISIBLE);
+ return bt;
+
+ }
+
+
+ private void hideBothRecyclableButtons(Button bt1, Button bt2) {
+ bt1.setVisibility(View.INVISIBLE);
+ bt2.setVisibility(View.INVISIBLE);
+
+ }
+
+
+ private Button hideRecyclableButton(Button bt) {
+ bt.setVisibility(View.INVISIBLE);
+ return bt;
+
+ }
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+
+ final Spinner mainItemsSpinner, subItemsSpinner;
+ final ArrayAdapter paperAdapter, boxCardBoardAdapter, aluminumMetalsAdapter, glassAdapter, plasticsAdapter, rigidPlasticsAdapter, organicMatterAdapter, dummyItemsAdapter;
+
+
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_recycle_flow_screen);
+
+
+ RecyclableButton = (Button) findViewById(R.id.RecycableButton);
+ NonRecyclableButton = (Button) findViewById(R.id.NonRecycableButton);
+
+
+ // Set first spinner to items for the major recycling categories like paper, plastics
+ mainItemsSpinner = (Spinner) findViewById(R.id.spinnerOps1);
+ ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.majorOptions, android.R.layout.simple_spinner_item);
+ adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ mainItemsSpinner.setAdapter(adapter);
+
+
+ // Set second spinner to sub-items corresponding to their major recycling categories in the first spinner
+ subItemsSpinner = (Spinner) findViewById(R.id.spinnerOps2);
+
+ paperAdapter = ArrayAdapter.createFromResource(this, R.array.paperOptions, android.R.layout.simple_spinner_item);
+ paperAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+
+ boxCardBoardAdapter = ArrayAdapter.createFromResource(this, R.array.boxCardBoardOptions, android.R.layout.simple_spinner_item);
+ boxCardBoardAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+
+ aluminumMetalsAdapter = ArrayAdapter.createFromResource(this, R.array.alumninumMetalsOptions, android.R.layout.simple_spinner_item);
+ aluminumMetalsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+
+ glassAdapter = ArrayAdapter.createFromResource(this, R.array.glassOptions, android.R.layout.simple_spinner_item);
+ glassAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+
+ plasticsAdapter = ArrayAdapter.createFromResource(this, R.array.plasticsOptions, android.R.layout.simple_spinner_item);
+ plasticsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+
+ rigidPlasticsAdapter = ArrayAdapter.createFromResource(this, R.array.rigidPlasticsOptions, android.R.layout.simple_spinner_item);
+ rigidPlasticsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+
+ organicMatterAdapter = ArrayAdapter.createFromResource(this, R.array.organicMatterOptions, android.R.layout.simple_spinner_item);
+ organicMatterAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+
+ dummyItemsAdapter = ArrayAdapter.createFromResource(this, R.array.dummyItemsOptions, android.R.layout.simple_spinner_item);
+ organicMatterAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+
+
+ mainItemsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ public void onItemSelected(AdapterView> parent, View view, int pos, long id) {
+
+ /* Sets & resets the sub-item spinner whenever another main category item is different from the
+ initial selection. */
+ subItemsSpinner.setVisibility(View.INVISIBLE);
+
+ /* On first spinner selection, call setSpinner(int) to determine which sub-item options to show in
+ in the second spinner */
+ setSpinners(pos);
+
+
+ }
+
+
+ /*The setSpinners(int) method determines which sub-items to show in the 2nd spinner by determining
+ which main category was selected in the first spinner. The method also determines if the
+ the sub-item is recyclable or not and returns the appropriate information in a non-clickable
+ button.
+
+ Future enhancement-- return an ImageView image instead of a non-clickable button.
+ */
+ public void setSpinners(int spinnerSelection) {
+
+ switch (spinnerSelection) {
+ case 0: // Paper
+
+ subItemsSpinner.setVisibility(View.VISIBLE);
+ // subItemsSpinner.setAdapter(paperAdapter);
+
+ subItemsSpinner.setAdapter(dummyItemsAdapter);
+ // showNonRecyclableButton(NonRecyclableButton, RecyclableButton);
+ // hideRecyclableButton(RecyclableButton);
+
+ // hideBothRecyclableButtons(RecyclableButton, NonRecyclableButton);
+
+ subItemsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+
+ public void onItemSelected(AdapterView> parent, View view, int pos, long id) {
+
+ int currentIndex;
+
+ currentIndex = pos;
+ if (dummyAnswerBank[currentIndex].isTrueQuestion()) {
+ showRecyclableButton(RecyclableButton, NonRecyclableButton);
+
+ } else {
+ showNonRecyclableButton(NonRecyclableButton, RecyclableButton);
+
+ }
+
+
+ }
+
+
+ public void onNothingSelected(AdapterView> parent) {
+ // nothing here
+ }
+
+
+ });
+
+
+ break;
+
+
+ case 1: // Boxboards & Cardboards
+
+ subItemsSpinner.setVisibility(View.VISIBLE);
+ subItemsSpinner.setAdapter(boxCardBoardAdapter);
+
+
+ subItemsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+
+ public void onItemSelected(AdapterView> parent, View view, int pos, long id) {
+
+ int currentIndex;
+
+ currentIndex = pos;
+ if (boxcardBoardAnswerBank[currentIndex].isTrueQuestion()) {
+ showRecyclableButton(RecyclableButton, NonRecyclableButton);
+
+ } else {
+ showNonRecyclableButton(NonRecyclableButton, RecyclableButton);
+
+ }
+ }
+
+
+ public void onNothingSelected(AdapterView> parent) {
+ // nothing here
+ }
+
+
+ });
+
+ break;
+
+ case 2: // Aluminum & Metals
+
+ subItemsSpinner.setVisibility(View.VISIBLE);
+ //subItemsSpinner.setAdapter(aluminumMetalsAdapter);
+
+ subItemsSpinner.setAdapter(dummyItemsAdapter);
+ subItemsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+
+ public void onItemSelected(AdapterView> parent, View view, int pos, long id) {
+ //if ()
+ int currentIndex;
+
+ currentIndex = pos;
+ if (dummyAnswerBank[currentIndex].isTrueQuestion()) {
+ showRecyclableButton(RecyclableButton, NonRecyclableButton);
+
+ } else {
+ showNonRecyclableButton(NonRecyclableButton, RecyclableButton);
+
+ }
+
+
+ }
+
+
+ public void onNothingSelected(AdapterView> parent) {
+ // nothing here
+ }
+
+
+ });
+
+
+ break;
+
+ case 3: // Glass
+
+ subItemsSpinner.setVisibility(View.VISIBLE);
+ //subItemsSpinner.setAdapter(glassAdapter);
+
+ subItemsSpinner.setAdapter(dummyItemsAdapter);
+ subItemsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+
+ public void onItemSelected(AdapterView> parent, View view, int pos, long id) {
+ //if ()
+ int currentIndex;
+
+ currentIndex = pos;
+ if (dummyAnswerBank[currentIndex].isTrueQuestion()) {
+ showRecyclableButton(RecyclableButton, NonRecyclableButton);
+
+ } else {
+ showNonRecyclableButton(NonRecyclableButton, RecyclableButton);
+
+ }
+
+
+ }
+
+
+ public void onNothingSelected(AdapterView> parent) {
+ // nothing here
+ }
+
+
+ });
+
+ break;
+
+ case 4: // Plastics
+
+ subItemsSpinner.setVisibility(View.VISIBLE);
+ //subItemsSpinner.setAdapter(plasticsAdapter);
+
+ subItemsSpinner.setAdapter(dummyItemsAdapter);
+ subItemsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+
+ public void onItemSelected(AdapterView> parent, View view, int pos, long id) {
+ //if ()
+ int currentIndex;
+
+ currentIndex = pos;
+ if (dummyAnswerBank[currentIndex].isTrueQuestion()) {
+ showRecyclableButton(RecyclableButton, NonRecyclableButton);
+
+ } else {
+ showNonRecyclableButton(NonRecyclableButton, RecyclableButton);
+
+ }
+
+
+ }
+
+
+ public void onNothingSelected(AdapterView> parent) {
+ // nothing here
+ }
+
+
+ });
+
+ break;
+
+ case 5: // Rigid Plastics
+
+ subItemsSpinner.setVisibility(View.VISIBLE);
+ //subItemsSpinner.setAdapter(rigidPlasticsAdapter);
+
+ subItemsSpinner.setAdapter(dummyItemsAdapter);
+ subItemsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+
+ public void onItemSelected(AdapterView> parent, View view, int pos, long id) {
+ //if ()
+ int currentIndex;
+
+ currentIndex = pos;
+ if (dummyAnswerBank[currentIndex].isTrueQuestion()) {
+ showRecyclableButton(RecyclableButton, NonRecyclableButton);
+
+ } else {
+ showNonRecyclableButton(NonRecyclableButton, RecyclableButton);
+
+ }
+
+
+ }
+
+
+ public void onNothingSelected(AdapterView> parent) {
+ // nothing here
+ }
+
+
+ });
+
+ break;
+
+ case 6: // Organic Matter
+ subItemsSpinner.setVisibility(View.VISIBLE);
+ //subItemsSpinner.setAdapter(organicMatterAdapter);
+
+ subItemsSpinner.setAdapter(dummyItemsAdapter);
+ subItemsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+
+ public void onItemSelected(AdapterView> parent, View view, int pos, long id) {
+ //if ()
+ int currentIndex;
+
+ currentIndex = pos;
+ if (dummyAnswerBank[currentIndex].isTrueQuestion()) {
+ showRecyclableButton(RecyclableButton, NonRecyclableButton);
+
+ } else {
+ showNonRecyclableButton(NonRecyclableButton, RecyclableButton);
+
+ }
+
+
+ }
+
+
+ public void onNothingSelected(AdapterView> parent) {
+ // nothing here
+ }
+
+
+ });
+
+ break;
+
+ default:
+ hideBothRecyclableButtons(RecyclableButton, NonRecyclableButton);
+
+
+ }
+ ;
+
+
+ }
+
+
+ public void onNothingSelected(AdapterView> parent) {
+ // nothing here
+ }
+
+ });
+
+
+ }
+
+
+}
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/RecycleLocationsActivity.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/RecycleLocationsActivity.java
new file mode 100644
index 0000000..d58a421
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/RecycleLocationsActivity.java
@@ -0,0 +1,14 @@
+package com.austindroids.recycleaustin.activities;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class RecycleLocationsActivity extends Activity {
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+}
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/ScheduleActivity.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/ScheduleActivity.java
new file mode 100644
index 0000000..b30cc4d
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/ScheduleActivity.java
@@ -0,0 +1,83 @@
+package com.austindroids.recycleaustin.activities;
+
+import android.app.Activity;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.style.ForegroundColorSpan;
+import android.widget.TextView;
+
+import com.austindroids.recycleaustin.R;
+
+
+public class ScheduleActivity extends Activity {
+
+
+ // constants for Intent string extra names
+ public static final String SCHEDULE_STREET = "schedule street";
+ public static final String SCHEDULE_CITY_STATE = "schedule city state";
+ public static final String SCHEDULE_WEEK = "schedule week";
+ public static final String SCHEDULE_DAY = "scedule day";
+
+ private TextView instructionsTV;
+ private TextView scheduleStreetTV;
+ private TextView scheduleCityStateTV;
+ private TextView collectionWeekTV;
+ private TextView collectionDayTV;
+
+ private String scheduleStreet;
+ private String scheduleCityState;
+ private String scheduleWeek;
+ private String scheduleDay;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_schedule);
+
+ // get references to TextViews
+ instructionsTV = (TextView) findViewById(R.id.textViewScheduleInstuctions);
+ scheduleStreetTV = (TextView) findViewById(R.id.textViewScheduleStreet);
+ scheduleCityStateTV = (TextView) findViewById(R.id.textViewScheduleCityState);
+ collectionWeekTV = (TextView) findViewById(R.id.textViewCollectionWeek);
+ collectionDayTV = (TextView) findViewById(R.id.textViewCollectionDay);
+
+ // Add color to "Not My Address" text in the instructions.
+ String instructionsString = getString(R.string.schedule_instructions);
+ int startIndex = instructionsString.indexOf("\"");
+ int endIndex = instructionsString.indexOf("\"", startIndex + 1);
+ Spannable instructionsText = new SpannableString(instructionsString);
+ instructionsText.setSpan(new ForegroundColorSpan(Color.RED), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ instructionsTV.setText(instructionsText);
+
+ // Get Address and Schedule from Intent
+ Bundle extras = getIntent().getExtras();
+ if (extras != null){
+ scheduleStreet = extras.getString(SCHEDULE_STREET);
+ scheduleCityState = extras.getString(SCHEDULE_CITY_STATE);
+ scheduleWeek = extras.getString(SCHEDULE_WEEK);
+ scheduleDay = extras.getString(SCHEDULE_DAY);
+ }
+
+ // Set textView text from Intent string extras
+ scheduleStreet = setDefaultIfNull(scheduleStreet);
+ scheduleCityState = setDefaultIfNull(scheduleCityState);
+ scheduleWeek = setDefaultIfNull(scheduleWeek);
+ scheduleDay = setDefaultIfNull(scheduleDay);
+
+ scheduleStreetTV.setText(scheduleStreet);
+ scheduleCityStateTV.setText(scheduleCityState);
+ collectionWeekTV.setText(scheduleWeek);
+ collectionDayTV.setText(scheduleDay);
+
+ }
+
+ private String setDefaultIfNull(String str){
+ if (str == null){
+ str = "[value not passed to Intent]";
+ }
+ return str;
+ }
+
+}
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/SodaQueryActivity.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/SodaQueryActivity.java
new file mode 100755
index 0000000..14c97fe
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/activities/SodaQueryActivity.java
@@ -0,0 +1,74 @@
+package com.austindroids.recycleaustin.activities;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.austindroids.recycleaustin.R;
+import com.austindroids.recycleaustin.service.SodaQueryService;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class SodaQueryActivity extends Activity{
+ private Button sendButton;
+ private EditText addressField;
+ private TextView addressTest;
+
+ public static final String RESULTS = "Results";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_sodaquery);
+
+
+
+ addressTest = (TextView) findViewById(R.id.test_address);
+ sendButton = (Button) findViewById(R.id.send_button);
+ sendButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ addressField = (EditText) findViewById(R.id.address_field);
+ String address = addressField.getText().toString();
+
+ ///////////// Check if address is blank //////////////////////
+ if (address.equals("")) {
+ Toast.makeText(v.getContext(), "Please enter a valid address", Toast.LENGTH_SHORT).show();
+ } else {
+ ///////////// Show Alert before AsyncTask starts ////////////
+ AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
+ builder.setMessage("Loading");
+ AlertDialog alert = builder.create();
+ alert.setCancelable(false);
+ alert.show();
+
+ ArrayList results = new SodaQueryService(address).send();
+ alert.dismiss();
+ if (results.isEmpty() || results.contains("Timeout")) {
+ Toast.makeText(SodaQueryActivity.this, "Problem contacting database", Toast.LENGTH_LONG).show();
+ } else if (results.contains("Address Problem") || results.contains("JSON Address Problem")) {
+ Toast.makeText(SodaQueryActivity.this, "Problem getting address", Toast.LENGTH_LONG).show();
+ } else if (results.contains("Schedule JSON Exception")) {
+ Toast.makeText(SodaQueryActivity.this, "No schedule for address", Toast.LENGTH_LONG).show();
+ } else {
+ Intent intent = new Intent(SodaQueryActivity.this, ScheduleActivity.class);
+ intent.putExtra(ScheduleActivity.SCHEDULE_STREET, results.get(0));
+ intent.putExtra(ScheduleActivity.SCHEDULE_CITY_STATE, results.get(1));
+ intent.putExtra(ScheduleActivity.SCHEDULE_DAY, results.get(2));
+ intent.putExtra(ScheduleActivity.SCHEDULE_WEEK, results.get(3));
+ startActivity(intent);
+ }
+ }
+ }
+ });
+ }
+
+}
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/adapters/DashboardAdapter.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/adapters/DashboardAdapter.java
new file mode 100644
index 0000000..71cb959
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/adapters/DashboardAdapter.java
@@ -0,0 +1,83 @@
+package com.austindroids.recycleaustin.adapters;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.austindroids.recycleaustin.R;
+
+
+public class DashboardAdapter extends BaseAdapter {
+ private Context mContext;
+
+ static final LauncherIcon[] ICONS = {
+ new LauncherIcon(R.drawable.ic_launcher, "Schedule"),
+ new LauncherIcon(R.drawable.ic_launcher, "Recycling Locations"),
+ new LauncherIcon(R.drawable.ic_launcher, "Find a Recycling Service"),
+ new LauncherIcon(R.drawable.ic_launcher, "Can I Recycle It?"),
+ };
+
+ public DashboardAdapter(Context c) {
+ mContext = c;
+ }
+
+ @Override
+ public int getCount() {
+ return ICONS.length;
+ }
+
+ @Override
+ public LauncherIcon getItem(int position) {
+ return null;
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return 0;
+ }
+
+ // Create a new ImageView for each item referenced by the Adapter
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ View v = convertView;
+ ViewHolder holder;
+ if (v == null) {
+ LayoutInflater vi = (LayoutInflater) mContext.getSystemService(
+ Context.LAYOUT_INFLATER_SERVICE);
+
+ v = vi.inflate(R.layout.dashboard_icon, null);
+ holder = new ViewHolder();
+ holder.text = (TextView) v.findViewById(R.id.dashboard_icon_text);
+ holder.icon = (ImageView) v.findViewById(R.id.dashboard_icon_img);
+ v.setTag(holder);
+ } else {
+ holder = (ViewHolder) v.getTag();
+ }
+
+ holder.icon.setImageResource(ICONS[position].imgId);
+ holder.text.setText(ICONS[position].text);
+
+ return v;
+ }
+
+ static class ViewHolder {
+ public ImageView icon;
+ public TextView text;
+ }
+
+ static class LauncherIcon {
+ final String text;
+ final int imgId;
+
+ public LauncherIcon(int imgId, String text) {
+ super();
+ this.imgId = imgId;
+ this.text = text;
+ }
+
+ }
+}
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/beans/PostalAddress.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/beans/PostalAddress.java
new file mode 100644
index 0000000..95644dc
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/beans/PostalAddress.java
@@ -0,0 +1,54 @@
+package com.austindroids.recycleaustin.beans;
+
+/**
+ * Created by dutch on 6/18/14.
+ */
+public class PostalAddress {
+ private String houseNumber;
+ private String street;
+ private String city;
+ private String state;
+ private String zip;
+
+ public String getHouseNumber() {
+ return houseNumber;
+ }
+
+ public void setHouseNumber(String houseNumber) {
+ this.houseNumber = houseNumber;
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getZip() {
+ return zip;
+ }
+
+ public void setZip(String zip) {
+ this.zip = zip;
+ }
+
+
+}
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/beans/RecyclableTrueFalse.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/beans/RecyclableTrueFalse.java
new file mode 100644
index 0000000..64e3e37
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/beans/RecyclableTrueFalse.java
@@ -0,0 +1,42 @@
+package com.austindroids.recycleaustin.beans;
+
+/*
+
+This class is used to store the recyclable status of the sub-items. Use the constructor to
+create an array of sub-otems for each major item category. Use isTrueQuestion() to get the status
+of each sub-item.
+
+ */
+public class RecyclableTrueFalse {
+
+
+ private int recyclableQuestion;
+ private boolean answerToQuestion;
+ private String sQuestion;
+
+ public RecyclableTrueFalse(int question, boolean isTrueQuestion){
+ recyclableQuestion = question;
+ answerToQuestion = isTrueQuestion;
+
+ }
+
+
+ public int getQuestion(){
+ return recyclableQuestion;
+ }
+
+ public void setQuestion(int question){
+ recyclableQuestion = question;
+ }
+
+ public boolean isTrueQuestion(){
+ return answerToQuestion;
+ }
+
+ public void setAnswerToQuestion(boolean trueQuestion){
+ answerToQuestion = trueQuestion;
+ }
+
+
+}
+
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/service/GeoCodingService.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/service/GeoCodingService.java
new file mode 100644
index 0000000..559a42d
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/service/GeoCodingService.java
@@ -0,0 +1,131 @@
+package com.austindroids.recycleaustin.service;
+
+import android.content.Context;
+import android.location.Criteria;
+import android.location.Location;
+import android.location.LocationListener;
+import android.location.LocationManager;
+import android.os.Bundle;
+import android.util.Log;
+import android.widget.Toast;
+
+import com.austindroids.recycleaustin.beans.PostalAddress;
+
+import java.util.List;
+
+/**
+ * Created by dutch on 6/18/14.
+ */
+
+public class GeoCodingService {
+
+ Context thisContext;
+
+ public GeoCodingService(Context thisContext) {
+ this.thisContext = thisContext;
+ LocationManager locationManager = (LocationManager) thisContext.getSystemService(Context.LOCATION_SERVICE);
+ LocationListener mlocListener = new MyLocationListener();
+
+ locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener);
+ }
+
+ public PostalAddress getAddressFromLocation(Location location) {
+ PostalAddress address = new PostalAddress();
+ address.setHouseNumber("2302");
+ address.setStreet("10TH");
+ address.setCity("AUSTIN");
+ address.setState("TX");
+ address.setZip("78703");
+ return address;
+ }
+
+
+ public Location getCurrentLocation() {
+ // Get the location manager
+ LocationManager locationManager = (LocationManager) thisContext.getSystemService(Context.LOCATION_SERVICE);
+ // Define the criteria to select location provider (default)
+ Criteria criteria = new Criteria();
+ String provider = locationManager.getBestProvider(criteria, false);
+ // this does not actually do a GPS lookup!
+ Location location = locationManager.getLastKnownLocation(provider);
+ if (location == null) {
+ location = this.getPreviousLocation();
+ }
+
+ return location;
+ }
+
+ private Location getPreviousLocation() {
+ String location_context = Context.LOCATION_SERVICE;
+ LocationManager locationManager = (LocationManager) thisContext.getSystemService(location_context);
+ List providers = locationManager.getProviders(true);
+ Location bestLocation = null;
+ for (String provider : providers) {
+ Location l = locationManager.getLastKnownLocation(provider);
+ log("","last known location, provider: %s, location: %s", provider,
+ l);
+
+ if (l == null) {
+ continue;
+ }
+ if (bestLocation == null
+ || l.getAccuracy() < bestLocation.getAccuracy()) {
+ log("found best last known location: %s", l);
+ bestLocation = l;
+ }
+ }
+ if (bestLocation == null) {
+ return null;
+ }
+ System.out.println("GOTHERE");
+ return bestLocation;
+ }
+
+ protected void log(String format, Object... msg) {
+ Log.i("com.austindroids.recycleaustin", String.format(format, msg));
+ }
+
+ /* Class My Location Listener */
+
+ public class MyLocationListener implements LocationListener
+ {
+ @Override
+ public void onLocationChanged(Location loc)
+ {
+
+ loc.getLatitude();
+ loc.getLongitude();
+ String Text = "My current location is: " +
+ "Latitud = " + loc.getLatitude() +
+ "Longitud = " + loc.getLongitude();
+ Toast.makeText(thisContext,
+ Text,
+ Toast.LENGTH_SHORT).show();
+ }
+
+ @Override
+ public void onProviderDisabled(String provider)
+ {
+ Toast.makeText( thisContext,
+ "Gps Disabled",
+ Toast.LENGTH_SHORT ).show();
+ }
+
+ @Override
+ public void onProviderEnabled(String provider)
+ {
+ Toast.makeText(thisContext,
+ "Gps Enabled",
+ Toast.LENGTH_SHORT).show();
+ }
+
+ @Override
+ public void onStatusChanged(String provider, int status, Bundle extras)
+ {
+
+ }
+
+ }/* End of Class MyLocationListener */
+
+
+}
\ No newline at end of file
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/service/SodaQueryService.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/service/SodaQueryService.java
new file mode 100644
index 0000000..7caaf80
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/service/SodaQueryService.java
@@ -0,0 +1,266 @@
+package com.austindroids.recycleaustin.service;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.os.AsyncTask;
+import android.util.Log;
+import android.widget.Toast;
+
+import com.austindroids.recycleaustin.beans.PostalAddress;
+import com.austindroids.recycleaustin.sodaquery.StreetDirectionMap;
+import com.austindroids.recycleaustin.sodaquery.StreetTypeMap;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+/**
+ * Created by mt_slasher on 7/11/14.
+ */
+
+public class SodaQueryService {
+ private String addr;
+ private ArrayList results = new ArrayList();
+ private PostalAddress postalAddress;
+
+ public SodaQueryService(String anAddress) {
+ addr = anAddress;
+ }
+
+ public ArrayList send() {
+ GoogleHTTPGetRequest googleRequest = new GoogleHTTPGetRequest(addr);
+ googleRequest.execute();
+ try {
+ googleRequest.get(10, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ } catch (TimeoutException e) {
+ results.add("Timeout");
+ }
+ if (!results.contains("Timeout") && !results.contains("JSON Address Problem") && !results.contains("Not in Austin")
+ && !results.contains("Address Problem")) {
+ SODAHTTPGetRequest sodaRequest = new SODAHTTPGetRequest(postalAddress.getHouseNumber(), postalAddress.getStreet());
+ sodaRequest.execute();
+ try {
+ sodaRequest.get(10, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (ExecutionException e) {
+ e.printStackTrace();
+ } catch (TimeoutException e) {
+ results.add("Timeout");
+ }
+ }
+ return results;
+ }
+
+ private class GoogleHTTPGetRequest extends AsyncTask {
+
+ private String URLaddress = "https://maps.googleapis.com/maps/api/geocode/json?address=";
+ private final String longName = "long_name";
+
+ private GoogleHTTPGetRequest(String addr) {
+ addr = addr.trim().replace(" ", "+");
+ URLaddress += addr + "+Austin,+Texas&key=AIzaSyCVfKDEiicmXo56w2Jrz0GHJ9z4wocMnoM";
+ }
+
+ @Override
+ protected Void doInBackground(Void... params) {
+ HttpURLConnection connection = null;
+ try {
+ connection = (HttpURLConnection) new URL(URLaddress).openConnection();
+ connection.setRequestMethod("GET");
+ connection.connect();
+
+ InputStream in = new BufferedInputStream(connection.getInputStream());
+ readStream(in);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ return null;
+ }
+
+ protected void readStream(InputStream in) {
+ BufferedReader br = null;
+ StringBuilder sb = new StringBuilder();
+ try {
+ br = new BufferedReader(new InputStreamReader(in));
+ String line = null;
+ while ((line = br.readLine()) != null) {
+ sb.append(line);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ postalAddress = new PostalAddress();
+ try {
+ JSONObject topObj = (JSONObject) new JSONTokener(sb.toString()).nextValue();
+ JSONArray jArray = topObj.getJSONArray("results");
+ JSONObject addressObj = jArray.getJSONObject(0);
+ JSONArray addressCompsArray = addressObj.getJSONArray("address_components");
+ for (int i = 0; i < addressCompsArray.length(); i++) {
+ JSONObject object = addressCompsArray.getJSONObject(i);
+ JSONArray types = object.getJSONArray("types");
+ String component = types.getString(0);
+ if (component.equals("street_number")) {
+ postalAddress.setHouseNumber(object.getString(longName));
+ } else if (component.equals("route")) {
+ postalAddress.setStreet(object.getString(longName));
+ } else if (component.equals("locality") || component.equals("sublocality")) {
+ postalAddress.setCity(object.getString(longName));
+ } else if (component.equals("administrative_area_level_1")) {
+ postalAddress.setState(object.getString(longName));
+ } else if (component.equals("postal_code")) {
+ postalAddress.setZip(object.getString(longName));
+ }
+ }
+ } catch (JSONException e) {
+ results.add("Google JSON Address Problem");
+ return;
+ }
+ String houseNumber = postalAddress.getHouseNumber();
+ String streetName = postalAddress.getStreet();
+ if (!postalAddress.getCity().equals("Austin")) {
+ results.add("Not in Austin");
+ } else if (houseNumber != null && streetName != null) {
+ results.add(houseNumber + " " + streetName);
+ results.add(postalAddress.getCity() + ", " + postalAddress.getState() + " " + postalAddress.getZip());
+ } else {
+ results.add("Address Problem");
+ }
+ }
+ }
+
+ private class SODAHTTPGetRequest extends AsyncTask {
+
+ private String URLaddress = "https://data.austintexas.gov/resource/rfif-mmvg.json?$select=collection_day,collection_week&$where=";
+ private String houseNo;
+ private String addr;
+
+ private SODAHTTPGetRequest(String houseNo, String addr) {
+ this.houseNo = houseNo;
+ this.addr = addr;
+ URLaddress += "house_no=\'" + houseNo + "\'";
+ }
+
+ @Override
+ protected Void doInBackground(Void... params) {
+ HttpURLConnection connection = null;
+ String[] addrComponents = addr.split("\\s");
+ List addrComponentsParsed = new LinkedList(Arrays.asList(addrComponents));
+
+ String possibleStreetDir = addrComponentsParsed.get(0);
+ Map streetDirContainer = new StreetDirectionMap();
+
+ if (streetDirContainer.containsKey(possibleStreetDir)) {
+ addrComponentsParsed.remove(possibleStreetDir);
+ String streetDirAbbr = streetDirContainer.get(possibleStreetDir);
+ URLaddress += "&st_dir=" + streetDirAbbr;
+ }
+ Map streetTypeContainer = new StreetTypeMap();
+ int endingIndex = addrComponentsParsed.size() - 1;
+ String possibleStreetType = addrComponentsParsed.get(endingIndex);
+
+ if (streetTypeContainer.containsKey(possibleStreetType)) {
+ addrComponentsParsed.remove(endingIndex);
+ String streetTypeAbbr = streetTypeContainer.get(possibleStreetType);
+ URLaddress += "&street_typ=" + streetTypeAbbr;
+ }
+
+ Iterator it = addrComponentsParsed.iterator();
+ StringBuilder sb = new StringBuilder();
+ while (it.hasNext()) {
+ sb.append(it.next());
+ if (it.hasNext()) {
+ sb.append(" ");
+ }
+ }
+ URLaddress += "&street_nam=" + sb.toString();
+ try {
+ connection = (HttpURLConnection) new URL(URLaddress.replace(" ", "+")).openConnection();
+ connection.setRequestMethod("GET");
+ connection.connect();
+
+ InputStream in = new BufferedInputStream(connection.getInputStream());
+ readStream(in);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ return null;
+ }
+
+ protected void readStream(InputStream in) {
+ BufferedReader br = null;
+ StringBuilder sb = new StringBuilder();
+ try {
+ br = new BufferedReader(new InputStreamReader(in));
+ String line = null;
+ while ((line = br.readLine()) != null) {
+ sb.append(line);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ String collectionDay = null;
+ String collectionWeek = null;
+ try {
+ JSONArray topArray = (JSONArray) new JSONTokener(sb.toString()).nextValue();
+ JSONObject jObj = topArray.getJSONObject(0);
+ collectionDay = jObj.getString("collection_day");
+ collectionWeek = jObj.getString("collection_week");
+ } catch (JSONException e) {
+ results.add("Schedule JSON Exception");
+ return;
+ }
+
+ results.add("Collection Day: " + collectionDay);
+ results.add("Collection Week: " + collectionWeek);
+ }
+ }
+}
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/sodaquery/StreetDirectionMap.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/sodaquery/StreetDirectionMap.java
new file mode 100644
index 0000000..062c197
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/sodaquery/StreetDirectionMap.java
@@ -0,0 +1,13 @@
+package com.austindroids.recycleaustin.sodaquery;
+
+import java.util.HashMap;
+
+public class StreetDirectionMap extends HashMap {
+
+ public StreetDirectionMap() {
+ put("West", "W");
+ put("East", "E");
+ put("North", "N");
+ put("South", "S");
+ }
+}
diff --git a/Recycle Austin/src/main/java/com/austindroids/recycleaustin/sodaquery/StreetTypeMap.java b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/sodaquery/StreetTypeMap.java
new file mode 100644
index 0000000..b73fa92
--- /dev/null
+++ b/Recycle Austin/src/main/java/com/austindroids/recycleaustin/sodaquery/StreetTypeMap.java
@@ -0,0 +1,43 @@
+package com.austindroids.recycleaustin.sodaquery;
+
+import java.util.HashMap;
+
+public class StreetTypeMap extends HashMap {
+
+ public StreetTypeMap() {
+ put("Crescent", "CRES");
+ put("Plaza", "PLZ");
+ put("Vale", "VALE");
+ put("View", "VW");
+ put("Skyway", "SKWY");
+ put("Square", "SQ");
+ put("Walk", "WALK");
+ put("Glen", "GLN");
+ put("Bridge", "BRG");
+ put("Park", "PARK");
+ put("Highway", "HWY");
+ put("Crossing", "XING");
+ put("Point", "PT");
+ put("Terrace", "TER");
+ put("Pass", "PASS");
+ put("Run", "RUN");
+ put("Row", "ROW");
+ put("Hollow", "HOLW");
+ put("Place", "PL");
+ put("Avenue", "AVE");
+ put("Way", "WAY");
+ put("Loop", "LOOP");
+ put("Parkway", "PKWY");
+ put("Path", "PATH");
+ put("Boulevard", "BLVD");
+ put("Court", "CT");
+ put("Road", "RD");
+ put("Circle", "CIR");
+ put("Lane", "LN");
+ put("Street", "ST");
+ put("Bend", "BND");
+ put("Drive", "DR");
+ put("Cove", "CV");
+ put("Trail", "TRL");
+ }
+}
diff --git a/Recycle Austin/src/main/res/drawable-mdpi/nonrecyclable_img.jpg b/Recycle Austin/src/main/res/drawable-mdpi/nonrecyclable_img.jpg
new file mode 100644
index 0000000..75fe9c3
Binary files /dev/null and b/Recycle Austin/src/main/res/drawable-mdpi/nonrecyclable_img.jpg differ
diff --git a/Recycle Austin/src/main/res/drawable-mdpi/recyclable_img.jpg b/Recycle Austin/src/main/res/drawable-mdpi/recyclable_img.jpg
new file mode 100644
index 0000000..4178bb2
Binary files /dev/null and b/Recycle Austin/src/main/res/drawable-mdpi/recyclable_img.jpg differ
diff --git a/Recycle Austin/src/main/res/layout/activity_main.xml b/Recycle Austin/src/main/res/layout/activity_main.xml
index 04a83bb..8c98aa8 100644
--- a/Recycle Austin/src/main/res/layout/activity_main.xml
+++ b/Recycle Austin/src/main/res/layout/activity_main.xml
@@ -1,16 +1,22 @@
-
+
-
+
-
+
\ No newline at end of file
diff --git a/Recycle Austin/src/main/res/layout/activity_recycle_flow_screen.xml b/Recycle Austin/src/main/res/layout/activity_recycle_flow_screen.xml
new file mode 100644
index 0000000..673bfbd
--- /dev/null
+++ b/Recycle Austin/src/main/res/layout/activity_recycle_flow_screen.xml
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Recycle Austin/src/main/res/layout/activity_schedule.xml b/Recycle Austin/src/main/res/layout/activity_schedule.xml
new file mode 100644
index 0000000..b056537
--- /dev/null
+++ b/Recycle Austin/src/main/res/layout/activity_schedule.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Recycle Austin/src/main/res/layout/activity_sodaquery.xml b/Recycle Austin/src/main/res/layout/activity_sodaquery.xml
new file mode 100644
index 0000000..6d99224
--- /dev/null
+++ b/Recycle Austin/src/main/res/layout/activity_sodaquery.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
diff --git a/Recycle Austin/src/main/res/layout/dashboard_icon.xml b/Recycle Austin/src/main/res/layout/dashboard_icon.xml
new file mode 100644
index 0000000..427bc26
--- /dev/null
+++ b/Recycle Austin/src/main/res/layout/dashboard_icon.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Recycle Austin/src/main/res/menu/main.xml b/Recycle Austin/src/main/res/menu/main.xml
index 8975d7b..4f1a364 100644
--- a/Recycle Austin/src/main/res/menu/main.xml
+++ b/Recycle Austin/src/main/res/menu/main.xml
@@ -1,9 +1,14 @@
diff --git a/Recycle Austin/src/main/res/values/schedule_screen_strings.xml b/Recycle Austin/src/main/res/values/schedule_screen_strings.xml
new file mode 100644
index 0000000..e46c4a8
--- /dev/null
+++ b/Recycle Austin/src/main/res/values/schedule_screen_strings.xml
@@ -0,0 +1,13 @@
+
+
+
+ ScheduleActivity
+ Click the home icon to automatically find your
+ address and see the local Recycling Schedule for your address. If the address
+ is not yours, click on the button that says \"Not My Address\" to manually enter it.
+
+ Not My Address
+ Collection Week
+ Collection Day
+
+
diff --git a/Recycle Austin/src/main/res/values/strings.xml b/Recycle Austin/src/main/res/values/strings.xml
index 4ba168c..6bec49e 100644
--- a/Recycle Austin/src/main/res/values/strings.xml
+++ b/Recycle Austin/src/main/res/values/strings.xml
@@ -2,7 +2,146 @@
Recycle Austin
- Hello Droids!
+ Hello World
Settings
+ App Team
+ Recycle Flow
+
+ Send
+ Enter Your Address Here
+ City
+ Zip Code
+ MainActivity
+
+
+
+
+
+
+ Paper
+ Aluminum and Metals
+ Boxboards and Cardboard
+ Glass
+ Plastics
+ Rigid Plastic Containers (Labeled #1-7)
+ Organic Matter
+
+
+
+ - @string/paper
+ - @string/boxCardBoard
+ - @string/aluminumMetals
+ - @string/glass
+ - @string/plastics
+ - @string/rigidPlastics
+ - @string/organicMatter
+
+
+
+
+
+
+
+
+ - Glossy and Matte paper
+ - Envelopes
+ - Junk mail
+ - Greeting cards
+ - Catalogs
+ - Newspapers
+ - Coupons
+ - Posters
+ - Sticky Notes
+ - Paper Bags
+ - Wrapping Paper (non-foil)
+ - Magazines
+
+
+
+
+
+ - @string/cardBoard
+ - @string/boxBoard
+ - @string/shoeBox
+ - @string/pizzaBox
+
+
+
+
+
+
+ - @string/dummyFalseItem
+ - @string/boxBoard
+ - @string/shoeBox
+ - @string/pizzaBox
+
+
+
+
+
+
+ - @string/dummyFalseItem
+ - @string/boxBoard
+ - @string/shoeBox
+ - @string/pizzaBox
+
+
+
+
+
+
+ - @string/dummyTrueItem
+ - @string/boxBoard
+ - @string/shoeBox
+ - @string/pizzaBox
+
+
+
+
+
+
+
+ - @string/dummyTrueItem
+ - @string/boxBoard
+ - @string/shoeBox
+ - @string/pizzaBox
+
+
+
+
+
+
+ - @string/food
+ - @string/yardLeaves
+
+
+
+
+
+
+ - @string/dummyTrueItem
+ - @string/dummyFalseItem
+
+
+
+
+
+
+
+
+ Shoe box
+ Pizza box
+ Boxboard
+ Corrugated Cardboard
+ Food
+ Yard Leaves
+ DUMMY RECYCLABLE ITEM
+ DUMMY NON-RECYCLABLE ITEM
+
diff --git a/Recycle Austin/src/main/res/values/styles.xml b/Recycle Austin/src/main/res/values/styles.xml
index 766ab99..7ee69cf 100644
--- a/Recycle Austin/src/main/res/values/styles.xml
+++ b/Recycle Austin/src/main/res/values/styles.xml
@@ -1,8 +1,11 @@
-
-
+ #C2902F
+
diff --git a/RecycleAustin.iml b/RecycleAustin.iml
index 58a239a..135c0f9 100644
--- a/RecycleAustin.iml
+++ b/RecycleAustin.iml
@@ -1,10 +1,16 @@
+
+
+
+
+
+
+
-
diff --git a/Services/.gitignore b/Services/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/Services/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/Services/Services.iml b/Services/Services.iml
new file mode 100644
index 0000000..d2d13fb
--- /dev/null
+++ b/Services/Services.iml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Services/build.gradle b/Services/build.gradle
new file mode 100644
index 0000000..e960cfa
--- /dev/null
+++ b/Services/build.gradle
@@ -0,0 +1,9 @@
+apply plugin: 'java'
+
+targetCompatibility=1.7
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile group: 'org.jsoup', name: 'jsoup', version: '1.7.3'
+ testCompile group: 'junit', name: 'junit', version: '4.11'
+}
\ No newline at end of file
diff --git a/Services/src/main/java/com/austindroids/recycleaustin/beans/RecyclableItem.java b/Services/src/main/java/com/austindroids/recycleaustin/beans/RecyclableItem.java
new file mode 100644
index 0000000..ffe2215
--- /dev/null
+++ b/Services/src/main/java/com/austindroids/recycleaustin/beans/RecyclableItem.java
@@ -0,0 +1,66 @@
+package com.austindroids.recycleaustin.beans;
+
+/**
+ * Created by dutch on 6/20/14.
+ */
+public class RecyclableItem {
+
+ boolean recyclable;
+ String description;
+ String category;
+ String subCategory;
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getSubCategory() {
+ return subCategory;
+ }
+
+ public void setSubCategory(String subCategory) {
+ this.subCategory = subCategory;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ RecyclableItem that = (RecyclableItem) o;
+
+ if (!category.equals(that.category)) return false;
+ if (subCategory != null ? !subCategory.equals(that.subCategory) : that.subCategory != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = category.hashCode();
+ result = 31 * result + (subCategory != null ? subCategory.hashCode() : 0);
+ return result;
+ }
+
+ public String getCategory() {
+
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public boolean isRecyclable() {
+ return recyclable;
+ }
+
+ public void setRecyclable(boolean recyclable) {
+ this.recyclable = recyclable;
+ }
+}
diff --git a/Services/src/main/java/com/austindroids/recycleaustin/service/CheckRecyclableService.java b/Services/src/main/java/com/austindroids/recycleaustin/service/CheckRecyclableService.java
new file mode 100644
index 0000000..7e62d95
--- /dev/null
+++ b/Services/src/main/java/com/austindroids/recycleaustin/service/CheckRecyclableService.java
@@ -0,0 +1,73 @@
+package com.austindroids.recycleaustin.service;
+
+
+import com.austindroids.recycleaustin.beans.RecyclableItem;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.TreeSet;
+
+/**
+ * Created by dutch on 6/18/14.
+ */
+
+public class CheckRecyclableService {
+ public CheckRecyclableService() {
+ this.allItems = loadAll();
+ System.out.println(this.allItems);
+ }
+
+ public List getCategories(){
+ TreeSet categories = new TreeSet();
+ for (RecyclableItem item : allItems)
+ categories.add(item.getCategory());
+ return new ArrayList(categories);
+ }
+
+ public List getSubcategories(String category) {
+ TreeSet subcats = new TreeSet(); //sorted
+ //return Arrays.asList(categories);
+ for (RecyclableItem item : allItems)
+ if (category.equals(item.getCategory()))
+ subcats.add(item.getSubCategory());
+ return new ArrayList(subcats);
+ }
+
+ public RecyclableItem getRecyclableItem(String category, String subcategory) {
+ for (RecyclableItem item : allItems)
+ if (category.equals(item.getCategory()) && subcategory.equals(item.getSubCategory()) )
+ return item;
+ return null;
+ }
+
+ String [] rawData = {
+ "category1|subcategory1|True|some data",
+ "category1|subcategory2|True|some more data",
+ "category2|subcategory1|True|even some nsome data"
+ };
+ List allItems = null;
+
+
+ private List loadAll(){
+ List allItems = new ArrayList();
+ System.out.println(rawData[0] + "here");
+ for (String e : rawData) {
+ String[] tokens = e.split("\\|");
+ RecyclableItem item = new RecyclableItem();
+ System.out.println(tokens[1]);
+ System.out.println(e);
+ item.setCategory(tokens[0]);
+ item.setSubCategory(tokens[1]);
+ item.setRecyclable(new Boolean(tokens[2]));
+ item.setDescription(tokens[3]);
+ allItems.add(item);
+ }
+ return allItems;
+ }
+
+ public static void main(String [] args) {
+ System.out.println("Run main.");
+ }
+}
diff --git a/Services/src/test/java/com/austindroids/recycleaustin/service/CheckRecyclableServiceTest.java b/Services/src/test/java/com/austindroids/recycleaustin/service/CheckRecyclableServiceTest.java
new file mode 100644
index 0000000..ed9a2ca
--- /dev/null
+++ b/Services/src/test/java/com/austindroids/recycleaustin/service/CheckRecyclableServiceTest.java
@@ -0,0 +1,76 @@
+package com.austindroids.recycleaustin.service;
+
+/**
+ * Created by dutch on 7/2/14.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * A unit test class based on junit 4+ and using annotations. Note you do not have to inherit from UnitTest.
+ */
+public class CheckRecyclableServiceTest {
+
+ CheckRecyclableService service;
+ /**
+ * Does setup before any unit test is run
+ */
+ @Before
+ public void setup() {
+ service = new CheckRecyclableService();
+ }
+
+ /**
+ * Do any cleanup after a single test is run.
+ */
+ @After
+ public void teardown() {
+ }
+
+ /**
+ * does setup before the start of all unit tests
+ */
+ @BeforeClass
+ public static void setupClass() {
+ }
+
+ @Test
+ public void testGetCategories() {
+ String [] cats = {"category1", "category2"};
+ List expected = Arrays.asList(cats);
+
+ List actual = service.getCategories();
+ assertNotNull("Returned categories was null.", actual);
+ assertNotEquals("Returned categories have no entries", 0, actual.size());
+ assertEquals("Categories returned was different from expected.", expected, actual);
+ }
+
+ /**
+ * This test method will be ignored by the runner.
+ */
+ @Ignore
+ public void testSomething() {
+ // will always fail
+ fail();
+ }
+
+
+ @Test(expected=NullPointerException.class)
+ public void testFailure() {
+ String str = null;
+ str.compareTo("something");
+ }
+}
diff --git a/build.gradle b/build.gradle
index 4327157..e33f142 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:0.10.1+'
+ classpath 'com.android.tools.build:gradle:0.12.+'
}
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 5de946b..e1308ea 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Thu Jun 12 11:59:50 CDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
diff --git a/settings.gradle b/settings.gradle
index 1c9bfcd..6856197 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':Recycle Austin'
+include ':Recycle Austin', 'Services'