Skip to content
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
5 changes: 4 additions & 1 deletion src/main/java/nyc/c4q/AbstractAwesomeClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ public abstract class AbstractAwesomeClass implements AwesomeInterface {

@Override
public int getData() {


setData(0);

return 0;
}

@Override
public void setData(int someData) {

}
}
11 changes: 11 additions & 0 deletions src/main/java/nyc/c4q/AwesomeContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;

/**
Expand All @@ -13,6 +14,16 @@ public static Collection createAwesomeContainer(){
}

public static void addAwesomeObject(Collection awesomeContainer){





return;
}
}
//Collection myList = AwesomeContainer.createAwesomeContainer();
//assertEquals(myList.getClass(), List.class);
//AwesomeContainer.addAwesomeObject(myList);
//assertEquals(((List) myList).get(0).getClass(), AwesomeInterface.class);
//assertEquals(myList.getClass(), List.class);
106 changes: 81 additions & 25 deletions src/main/java/nyc/c4q/InitialActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,93 @@

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.LinearLayout;
import android.widget.TextView;

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) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_initial);
preferences = getPreferences(Context.MODE_PRIVATE);

Button buttonPlus = (Button) findViewById(R.id.buttonPlus);
buttonPlus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
counter += 1;
TextView textView = (TextView) findViewById(R.id.tvCounter);
textView.setText(counter + "");

}
});

Button buttonMinus = (Button) findViewById(R.id.buttonMinus);
buttonMinus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
counter -= 1;
TextView textView = (TextView) findViewById(R.id.tvCounter);
textView.setText(counter + "");

}
});

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


}

@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);

outState.putString("saveState", preferences.toString());

}

@Override
protected void onPause() {

super.onPause();
}

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
preferences.toString();
}

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

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

@Override
public void setData(int someData) {
}
}
2 changes: 1 addition & 1 deletion src/main/java/nyc/c4q/SuperFunClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Created by amyquispe on 5/19/15.
*/
public class SuperFunClass {
public class SuperFunClass {
private String name;

public SuperFunClass(){
Expand Down
68 changes: 58 additions & 10 deletions src/main/res/layout/activity_initial.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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">
android:orientation="vertical"
tools:context="nyc.c4q.InitialActivity">

<TextView
android:id="@+id/text"
<LinearLayout
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"
android:orientation="horizontal">

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

<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="wrap_content"
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>
57 changes: 53 additions & 4 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
android:layout_height="match_parent"
android:layout_width="match_parent"
android:text="TileActivity"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/leftSide"
android:layout_weight="1">

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

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

</LinearLayout>

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

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

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

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

</LinearLayout>

</LinearLayout>