diff --git a/src/main/java/nyc/c4q/InitialActivity.java b/src/main/java/nyc/c4q/InitialActivity.java
index 2213b83..6ef2204 100644
--- a/src/main/java/nyc/c4q/InitialActivity.java
+++ b/src/main/java/nyc/c4q/InitialActivity.java
@@ -11,28 +11,73 @@
public class InitialActivity extends Activity {
- public int counter = 0;
- public SharedPreferences preferences = null;
- public final static String TAG = "C4QTAG";
-
- public void loadState(){
- Log.d(TAG, "loadState()");
- counter = preferences.getInt("counter", 0);
- Log.d(TAG, "loadState(): counter=="+counter);
- }
-
- public void saveState(){
- Log.d(TAG, "saveState()");
- Log.d(TAG, "saveState(): counter=="+counter);
- SharedPreferences.Editor editor = preferences.edit();
- editor.putInt("counter", counter);
- editor.commit();
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_initial);
- preferences = getPreferences(Context.MODE_PRIVATE);
- }
+ public int counter = 0;
+ public SharedPreferences preferences = null;
+ public final static String TAG = "C4QTAG";
+
+ public void loadState() {
+ Log.d(TAG, "loadState()");
+ counter = preferences.getInt("counter", 0);
+ Log.d(TAG, "loadState(): counter==" + counter);
+ }
+
+ public void saveState() {
+ Log.d(TAG, "saveState()");
+ Log.d(TAG, "saveState(): counter==" + counter);
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putInt("counter", counter);
+ editor.commit();
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ Log.d(TAG, "onCreate(): counter==" + counter);
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_initial);
+ preferences = getPreferences(Context.MODE_PRIVATE);
+
+ Button plus = (Button) findViewById(R.id.buttonPlus);
+ Button minus = (Button) findViewById(R.id.buttonMinus);
+ final TextView tvCounter = (TextView) findViewById(R.id.tvCounter);
+
+ plus.setOnClickListener(
+ new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ counter++;
+ Log.d(TAG, "plus:" + counter);
+ tvCounter.setText(String.valueOf(counter));
+ }
+ }
+ );
+
+ minus.setOnClickListener(
+ new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ counter--;
+ Log.d(TAG, "minus:" + counter);
+ tvCounter.setText(String.valueOf(counter));
+ }
+ }
+ );
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ Log.d(TAG, "onPause()");
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ Log.d(TAG, "onStop()");
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ Log.d(TAG, "onDestroy()");
+ }
}
diff --git a/src/main/res/layout/activity_initial.xml b/src/main/res/layout/activity_initial.xml
index 49e22b0..c6d0a52 100644
--- a/src/main/res/layout/activity_initial.xml
+++ b/src/main/res/layout/activity_initial.xml
@@ -9,10 +9,56 @@
tools:context="nyc.c4q.InitialActivity"
android:id="@+id/activity_initial">
-
+ android:layout_height="0dp"
+ android:id="@+id/counterLayout"
+ android:orientation="horizontal"
+ android:layout_weight="2">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/java/nyc/c4q/Unit1AssessmentTestsJava.java b/src/test/java/nyc/c4q/Unit1AssessmentTestsJava.java
index de10077..ae9b679 100644
--- a/src/test/java/nyc/c4q/Unit1AssessmentTestsJava.java
+++ b/src/test/java/nyc/c4q/Unit1AssessmentTestsJava.java
@@ -7,6 +7,7 @@
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;