Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RosmaryFC test #23

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/java/nyc/c4q/AbstractAwesomeClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
}
6 changes: 3 additions & 3 deletions src/main/java/nyc/c4q/AwesomeContainer.java
Original file line number Diff line number Diff line change
@@ -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){
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/nyc/c4q/ConcreteAwesomeClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
46 changes: 46 additions & 0 deletions src/main/java/nyc/c4q/InitialActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
15 changes: 14 additions & 1 deletion src/main/java/nyc/c4q/SubFunClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
63 changes: 56 additions & 7 deletions src/main/res/layout/activity_initial.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<TextView
android:id="@+id/text"
<LinearLayout
android:orientation="horizontal"
android:id="@+id/counterLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="InitialActivity"
/>
android:layout_height="0dp"
android:layout_weight="2">

<LinearLayout
android:id="@+id/counterButtonsLayout"
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">

<Button
android:id="@+id/buttonPlus"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="+"/>

<Button
android:id="@+id/buttonMinus"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="-"/>


</LinearLayout>

<TextView
android:id="@+id/tvCounter"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="0"/>


</LinearLayout>

<Button
android:id="@+id/buttonTileActivity"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="TileActivity"/>

<Button
android:id="@+id/buttonEmpty"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Empty"/>

</LinearLayout>
53 changes: 51 additions & 2 deletions src/main/res/layout/activity_tile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,61 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="nyc.c4q.TileActivity"
android:orientation="horizontal"
android:id="@+id/activity_tile"
>

<TextView
<LinearLayout
android:id="@+id/leftSide"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">

<View
android:id="@+id/redView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="40"
android:background="#ffff0000"/>

<View
android:id="@+id/greenView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="60"
android:background="#ff00ff00"/>

</LinearLayout>

<LinearLayout
android:id="@+id/rightSide"
android:orientation="vertical"
android:layout_width="match_parent"
android:text="TileActivity"/>
android:layout_height="match_parent"
android:layout_weight="1">

<View
android:id="@+id/yellowView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="33"
android:background="#ffffff00"/>

<View
android:id="@+id/whiteView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="44"
android:background="#ffffffff"/>

<View
android:id="@+id/blueView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="22"
android:background="#ff0000ff"/>

</LinearLayout>

</LinearLayout>
8 changes: 4 additions & 4 deletions src/test/java/nyc/c4q/Unit1AssessmentTestsJava.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ public void test01SubFunClassInheritsFromSuperFunClass() throws Exception {
}

@Test
public void test02SubFunClassImplementsAwesomeInterface() throws Exception{
public void test02SubFunClassImplementsAwesomeInterface() throws Exception {
SubFunClass funObject = new SubFunClass();
assertThat(funObject, instanceOf(AwesomeInterface.class));
}

@Test
public void test03AbstractAwesomeClassImplementsAwesomeInterface() throws Exception{
@Test
public void test03AbstractAwesomeClassImplementsAwesomeInterface() throws Exception {
AbstractAwesomeClass awesomeObject = new ConcreteAwesomeClass();
assertEquals(awesomeObject.getData(), 4);
awesomeObject.setData(5);
assertEquals(awesomeObject.getData(), 5);
}

@Test
public void test04AwesomeContainerContainsAwesomeObject() throws Exception{
public void test04AwesomeContainerContainsAwesomeObject() throws Exception {
Collection myList = AwesomeContainer.createAwesomeContainer();
assertEquals(myList.getClass(), List.class);
AwesomeContainer.addAwesomeObject(myList);
Expand Down