Skip to content
Browse files

Got the buttons to show up in the view. Still no functionality.

  • Loading branch information...
1 parent 675fdee commit 61dcfd036554be13b0c9f0ec19c15328b2f84c01 @taesup taesup committed Dec 9, 2011
View
24 res/layout/schedule_item.xml
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" >
-
- <org.hicapacity.techhui.AutoResizeTextView
- android:id="@+id/schedule_time"
- android:layout_width="122px"
- android:layout_height="22px"
- android:layout_marginLeft="4px"
- android:layout_marginRight="10px"
- android:layout_marginTop="4px"
- android:text="default text" >
- </org.hicapacity.techhui.AutoResizeTextView>
-
- <org.hicapacity.techhui.AutoResizeTextView
- android:id="@+id/schedule_description"
- android:layout_width="wrap_content"
- android:layout_height="80px"
- android:text="@+id/schedule_description_text"
- android:textSize="20px" >
- </org.hicapacity.techhui.AutoResizeTextView>
-
-</LinearLayout>
View
1 res/values/strings.xml
@@ -2,4 +2,5 @@
<resources>
<string name="hello">Hello World, TechHuiActivity!</string>
<string name="app_name">TechHui</string>
+ <string name="no_notes">Nothing Here...</string>
</resources>
View
54 src/org/hicapacity/techhui/ConferenceActivity.java
@@ -10,30 +10,32 @@
import android.widget.Toast;
public class ConferenceActivity extends ListActivity {
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- System.out.println("creating conference activity");
-
- ScheduleRetriever scheduleRetriever = new FileScheduleRetriever(getAssets());
- List<ScheduleElement> elements = null;
- try {
- elements = scheduleRetriever.getElements();
- }
- catch (IOException e) {
- // TODO: Maybe show user error in this case.
- e.printStackTrace();
- }
-
- System.out.println("create adapter");
- MySimpleArrayAdapter adapter = new MySimpleArrayAdapter(this, elements);
- System.out.println("adapter is " + adapter);
- this.setListAdapter(adapter);
- }
-
- @Override
- protected void onListItemClick(ListView l, View v, int position, long id) {
- ScheduleElement item = (ScheduleElement) getListAdapter().getItem(position);
- String description = item.getFullDescription() + "selected";
- Toast.makeText(this, description, Toast.LENGTH_LONG).show();
- }
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ setContentView(R.layout.schedule_list);
+
+ List<ScheduleElement> elements = null;
+ try {
+ ScheduleRetriever scheduleRetriever = new FileScheduleRetriever(
+ getAssets());
+ elements = scheduleRetriever.getTrack1Elements();
+ elements.addAll(scheduleRetriever.getTrack2Elements());
+ } catch (IOException e) {
+ // TODO: Maybe show user error in this case.
+ e.printStackTrace();
+ }
+
+ System.out.println("create adapter");
+ MySimpleArrayAdapter adapter = new MySimpleArrayAdapter(this, elements);
+ System.out.println("adapter is " + adapter);
+ this.setListAdapter(adapter);
+ }
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ ScheduleElement item = (ScheduleElement) getListAdapter().getItem(
+ position);
+ String description = item.getFullDescription() + "selected";
+ Toast.makeText(this, description, Toast.LENGTH_LONG).show();
+ }
}
View
28 src/org/hicapacity/techhui/MySimpleArrayAdapter.java
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.List;
+import android.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
@@ -15,24 +16,37 @@
private final List<ScheduleElement> values;
public MySimpleArrayAdapter(Context context, List<ScheduleElement> values) {
- super(context, R.layout.schedule_item, values);
+ super(context, org.hicapacity.techhui.R.layout.schedule_list, values);
this.context = context;
this.values = new ArrayList<ScheduleElement>(values);
}
- @Override
+ /* (non-Javadoc)
+ * @see android.widget.ArrayAdapter#getView(int, android.view.View, android.view.ViewGroup)
+ */
+@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View rowView = inflater.inflate(R.layout.schedule_item, parent, false);
- TextView textView = (TextView) rowView.findViewById(R.id.schedule_description);
+ View rowView = inflater.inflate(org.hicapacity.techhui.R.layout.schedule_row, parent, false);
+ TextView textView = (TextView) rowView.findViewById(org.hicapacity.techhui.R.id.schedule_description);
// ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
- TextView timeView = (TextView) rowView.findViewById(R.id.schedule_time);
+ TextView timeView = (TextView) rowView.findViewById(org.hicapacity.techhui.R.id.schedule_time);
ScheduleElement scheduleElement = values.get(position);
- textView.setText(scheduleElement.getTitle());
- timeView.setText(scheduleElement.getTime());
+ if (scheduleElement.getTitle() != null) {
+ textView.setText(scheduleElement.getTitle());
+ }
+ else {
+ textView.setText("");
+ }
+ if (scheduleElement.getTime() != null) {
+ timeView.setText(scheduleElement.getTime());
+ }
+ else {
+ timeView.setText("");
+ }
return rowView;
}

0 comments on commit 61dcfd0

Please sign in to comment.
Something went wrong with that request. Please try again.