diff --git a/src/main/java/nyc/c4q/AbstractAwesomeClass.java b/src/main/java/nyc/c4q/AbstractAwesomeClass.java index e3f9c21..cd73fa4 100644 --- a/src/main/java/nyc/c4q/AbstractAwesomeClass.java +++ b/src/main/java/nyc/c4q/AbstractAwesomeClass.java @@ -4,14 +4,16 @@ * Created by amyquispe on 5/19/15. */ public abstract class AbstractAwesomeClass implements AwesomeInterface { + public int someData = 4; @Override public int getData() { - return 0; + return this.someData; } @Override public void setData(int someData) { + this.someData = someData; } } diff --git a/src/main/java/nyc/c4q/AwesomeContainer.java b/src/main/java/nyc/c4q/AwesomeContainer.java index 64e9fd9..1a41e08 100644 --- a/src/main/java/nyc/c4q/AwesomeContainer.java +++ b/src/main/java/nyc/c4q/AwesomeContainer.java @@ -1,15 +1,15 @@ package nyc.c4q; -import java.util.ArrayList; import java.util.Collection; -import java.util.Iterator; /** * Created by amyquispe on 5/19/15. */ public class AwesomeContainer { + public static Collection awesomeContainer; + public static Collection createAwesomeContainer(){ - return null; + return awesomeContainer; } public static void addAwesomeObject(Collection awesomeContainer){ diff --git a/src/main/java/nyc/c4q/ConcreteAwesomeClass.java b/src/main/java/nyc/c4q/ConcreteAwesomeClass.java index f39acca..7953f14 100644 --- a/src/main/java/nyc/c4q/ConcreteAwesomeClass.java +++ b/src/main/java/nyc/c4q/ConcreteAwesomeClass.java @@ -4,8 +4,11 @@ * Created by amyquispe on 5/19/15. */ public class ConcreteAwesomeClass extends AbstractAwesomeClass { + public int startData; + public ConcreteAwesomeClass(){ } public ConcreteAwesomeClass(int startData){ + this.startData = startData; } } diff --git a/src/main/java/nyc/c4q/InitialActivity.java b/src/main/java/nyc/c4q/InitialActivity.java index 2213b83..ad25a54 100644 --- a/src/main/java/nyc/c4q/InitialActivity.java +++ b/src/main/java/nyc/c4q/InitialActivity.java @@ -2,6 +2,7 @@ import android.app.Activity; import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.util.Log; @@ -34,5 +35,50 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_initial); preferences = getPreferences(Context.MODE_PRIVATE); + + loadState(); + + + final TextView tvCounter = (TextView) findViewById(R.id.tvCounter); + + tvCounter.setText(Integer.toString(counter)); + + + Button buttonPlus = (Button) findViewById(R.id.buttonPlus); + buttonPlus.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + + counter += 1; + tvCounter.setText(Integer.toString(counter)); + } + }); + + Button buttonMinus = (Button) findViewById(R.id.buttonMinus); + buttonMinus.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + + counter -= 1; + tvCounter.setText(Integer.toString(counter)); + } + }); + + Button buttonTileActivity = (Button) findViewById(R.id.buttonTileActivity); + buttonTileActivity.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Intent activityTile = new Intent(InitialActivity.this, TileActivity.class); + startActivity(activityTile); + } + }); + + } + + @Override + protected void onDestroy() { + saveState(); + super.onDestroy(); + } } diff --git a/src/main/java/nyc/c4q/SubFunClass.java b/src/main/java/nyc/c4q/SubFunClass.java index ef94dce..7a9afd5 100644 --- a/src/main/java/nyc/c4q/SubFunClass.java +++ b/src/main/java/nyc/c4q/SubFunClass.java @@ -3,7 +3,20 @@ /** * Created by amyquispe on 5/19/15. */ -public class SubFunClass { +public class SubFunClass extends SuperFunClass implements AwesomeInterface{ + int Data; + public SubFunClass(){ } + + @Override + public int getData() { + + return this.Data; + } + + @Override + public void setData(int someData) { + someData = this.Data; + } } diff --git a/src/main/res/layout/activity_initial.xml b/src/main/res/layout/activity_initial.xml index 49e22b0..bc8909e 100644 --- a/src/main/res/layout/activity_initial.xml +++ b/src/main/res/layout/activity_initial.xml @@ -4,15 +4,64 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" + android:id="@+id/activity_initial" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context="nyc.c4q.InitialActivity" - android:id="@+id/activity_initial"> + tools:context="nyc.c4q.InitialActivity"> - + android:layout_height="0dp" + android:layout_weight="2"> + + + +