Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rayacevedo45 committed May 20, 2015
1 parent 3e8f32c commit a4e44e0
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 10 deletions.
18 changes: 18 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 All @@ -10,6 +11,7 @@
import android.widget.TextView;

public class InitialActivity extends Activity {
int numtest = 0;

public int counter = 0;
public SharedPreferences preferences = null;
Expand All @@ -35,4 +37,20 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_initial);
preferences = getPreferences(Context.MODE_PRIVATE);
}
public void addone(View v){

numtest+=1;
TextView t = (TextView) findViewById(R.id.counter);
t.setText(numtest+"");
}
public void subone(View v){

numtest-=1;
TextView t = (TextView) findViewById(R.id.counter);
t.setText(numtest+"");
}
public void toTile(View v) {
Intent intent = new Intent(InitialActivity.this, TileActivity.class);
startActivity(intent);
}
}
88 changes: 82 additions & 6 deletions src/main/res/layout/activity_initial.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="nyc.c4q.InitialActivity"
android:id="@+id/activity_initial">

<TextView
android:id="@+id/text"

<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight=".5">

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">

<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="+"
android:textSize="30dp"
android:layout_weight="1"
android:onClick="addone"
/>

<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="-"
android:textSize="30dp"
android:layout_weight="1"
android:onClick="subone"
/>


</LinearLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">

<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="0"
android:textSize="30dp"
android:paddingTop="10dp"
android:onClick="addone"
android:layout_gravity="right"
android:layout_weight="2"
android:id="@+id/counter"
/>


</LinearLayout>

</LinearLayout>

<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="TileActivity"
android:textSize="30dp"
android:onClick="toTile"
android:layout_weight="1"
android:id="@+id/tile"
/>

<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="InitialActivity"
android:text="Empty"
android:textSize="30dp"
android:layout_weight="1"
/>
</LinearLayout>


</LinearLayout>







66 changes: 62 additions & 4 deletions src/main/res/layout/activity_tile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,67 @@
android:id="@+id/activity_tile"
>

<TextView
android:layout_height="match_parent"
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:text="TileActivity"/>
android:layout_height="match_parent"
android:layout_weight=".5">

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF0000"
android:textSize="30dp"
android:layout_weight="1.5"
/>

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00FF00"
android:layout_weight="1"
/>

</LinearLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFF00"
android:layout_gravity="right"
android:layout_weight="1.3"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:layout_gravity="right"
android:layout_weight="1"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0000FF"
android:layout_gravity="right"
android:layout_weight="1.5"
/>


</LinearLayout>

</LinearLayout>


</LinearLayout>
</LinearLayout>

0 comments on commit a4e44e0

Please sign in to comment.