Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Commit

Permalink
Basic improvementsand adding the talk and list activities.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpatrick committed Sep 1, 2011
1 parent cab0994 commit b426a18
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 2 deletions.
4 changes: 2 additions & 2 deletions res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<Button android:text="Talk" android:id="@+id/button1" android:layout_height="wrap_content" android:layout_width="fill_parent"></Button>
<Button android:layout_width="fill_parent" android:id="@+id/talkButton" android:layout_height="wrap_content" android:text="Talk"></Button>
<TextView android:text="TextView" android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content"></TextView>
<Button android:text="My Guy List" android:id="@+id/button2" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
<Button android:layout_width="fill_parent" android:id="@+id/guysButton" android:layout_height="wrap_content" android:text="My Guy List"></Button>
</LinearLayout>
9 changes: 9 additions & 0 deletions res/layout/userlist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" android:orientation="vertical">
<ListView android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/listView1"></ListView>
<Button android:text="Add Guy" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<Button android:text="Remove Guy" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>
20 changes: 20 additions & 0 deletions src/org/miloss/ListActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
*
*/
package org.miloss;

import android.app.Activity;
import android.os.Bundle;

/**
*
*
*/
public class ListActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.userlist);
}
}
59 changes: 59 additions & 0 deletions src/org/miloss/TalkActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,71 @@

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.Button;

public class TalkActivity extends Activity {

/**
* Layout items
*/
Button mTalkButton;
Button mGuysButton;

public static final String TAG = "TalkActivity";

/**
* OnTouch listener handles starting and stopping the buzzer sound
*/
private OnTouchListener mTalkTouch = new OnTouchListener() {

public boolean onTouch(View yourButton, MotionEvent motion) {

switch (motion.getAction()) {
case MotionEvent.ACTION_DOWN:
Log.d(TAG, "Talk Down");
break;
case MotionEvent.ACTION_UP:
Log.d(TAG, "Talk Up");
break;
}

return true;
}
};

/**
* Onclick for the guys button
*/
private OnClickListener mGuysClick = new OnClickListener() {
public void onClick(View v) {
Log.d(TAG, "Guys Click");
}
};

/** Get the refs to the ui elements on the page */
public void setupUIReferences() {
mTalkButton = (Button)this.findViewById(R.id.talkButton);
mGuysButton = (Button)this.findViewById(R.id.guysButton);
}

/** Setup my listeners */
public void setupEventListeners()
{
mTalkButton.setOnTouchListener(mTalkTouch);
mGuysButton.setOnClickListener(mGuysClick);
}

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setupUIReferences();
setupEventListeners();
}
}

0 comments on commit b426a18

Please sign in to comment.