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

Unit Assessment #9

Open
wants to merge 11 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
9 changes: 6 additions & 3 deletions src/main/java/nyc/c4q/AbstractAwesomeClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
* Created by amyquispe on 5/19/15.
*/
public abstract class AbstractAwesomeClass implements AwesomeInterface {
private int data;



@Override
public int getData() {
return 0;
return this.data;
}

@Override
public void setData(int someData) {

public void setData(int someData) {
this.data = someData;
}
}
9 changes: 8 additions & 1 deletion src/main/java/nyc/c4q/AwesomeContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

/**
* Created by amyquispe on 5/19/15.
*/
public class AwesomeContainer {
static ArrayList awesomeStuff;

public static Collection createAwesomeContainer(){
return null;
awesomeStuff = new ArrayList();
return (List) awesomeStuff;
}

public static void addAwesomeObject(Collection awesomeContainer){
awesomeContainer.add(new ConcreteAwesomeClass());
awesomeContainer.add(new ConcreteAwesomeClass());
return;

}
}
17 changes: 17 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,25 @@
* Created by amyquispe on 5/19/15.
*/
public class ConcreteAwesomeClass extends AbstractAwesomeClass {
private int data;


@Override
public int getData() {
return this.data;
}

@Override
public void setData(int someData) {
this.data = someData;
}

public ConcreteAwesomeClass(){
this.data = 4;
}

public ConcreteAwesomeClass(int startData){

this.data = startData;
}
}
77 changes: 71 additions & 6 deletions src/main/java/nyc/c4q/InitialActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,28 @@

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;


public class InitialActivity extends Activity {
private int textCount;
private TextView tvCount;
private Button buttonPlus;
private Button buttonMinus;
private Button tileActivity;

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);
Expand All @@ -29,10 +38,66 @@ public void saveState(){
editor.commit();
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_initial);
preferences = getPreferences(Context.MODE_PRIVATE);

@Override
protected void onPause() {
saveState();
super.onPause();
}

@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_initial);


preferences = getPreferences(Context.MODE_PRIVATE);
loadState();


buttonPlus = (Button) findViewById(R.id.buttonPlus);
buttonMinus = (Button) findViewById(R.id.buttonMinus);
tvCount = (TextView) findViewById(R.id.tvCounter);
tvCount.setText("" + counter);

// if ((preferences != null)) {
// loadState();
// textCount = preferences.getInt("counter", counter);
// } else {
// textCount = -1;
//
// //textCount = Integer.parseInt( (String) tvCount.getText());
// }

View redView = findViewById(R.id.redView);
//redView.setBackground(-65536);


Button tileActivityBtn = (Button) findViewById(R.id.buttonTileActivity);
tileActivityBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(InitialActivity.this, TileActivity.class);
startActivity(intent);
}
});
}


public void onPlusClick(View view) {
counter += 1;
tvCount.setText("" + counter);
}

public void onMinusClick(View view) {
counter -= 1;
tvCount.setText("" + counter);
}



}
}




14 changes: 13 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,19 @@
/**
* Created by amyquispe on 5/19/15.
*/
public class SubFunClass {
public class SubFunClass extends SuperFunClass
implements AwesomeInterface{
public SubFunClass(){
}


@Override
public int getData() {
return 0;
}

@Override
public void setData(int someData) {

}
}
21 changes: 21 additions & 0 deletions src/main/java/nyc/c4q/TileActivity.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
package nyc.c4q;

import android.app.Activity;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.Layout;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

public class TileActivity extends Activity {

// public Color ColorDrawable(int colorRed){
//
// }



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tile);

View redView = findViewById(R.id.redView);
View greenView = findViewById(R.id.greenView);
View yelloWView = findViewById(R.id.yellowView);
View blueView = findViewById(R.id.blueView);
redView.setBackgroundColor(Color.RED);
greenView.setBackgroundColor(Color.GREEN);
blueView.setBackgroundColor(Color.BLUE);
yelloWView.setBackgroundColor(Color.YELLOW);


}

@Override
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/nyc/c4q/Unit1AssessmentApplication.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package nyc.c4q;

import android.app.Application;
import android.widget.Button;


public class Unit1AssessmentApplication extends Application {





}
Loading