Archived
Added price to event list.
This commit is contained in:
1 parent
aff112474d
commit
dea9fe57c2
3 files changed
+26
-13
No files matched your search
@@ -8,7 +8,7 @@
|
||||
|
||||
<TextView android:id="@+id/event_list_row_text"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_alignParentTop="true" />
|
||||
|
||||
<TextView android:id="@+id/event_list_row_date"
|
||||
@@ -17,4 +17,10 @@
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@id/event_list_row_text" />
|
||||
|
||||
<TextView android:id="@+id/event_list_row_price"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentRight="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -91,7 +91,10 @@ public class Event implements Serializable {
|
||||
}
|
||||
|
||||
public String getPriceString() {
|
||||
return "" +this.regularPrice +'/' +this.memberPrice;
|
||||
if (this.regularPrice > 0 || this.memberPrice > 0)
|
||||
return "" +this.regularPrice +'/' +this.memberPrice +"kr";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public Uri getTicketUri() {
|
||||
|
||||
@@ -107,6 +107,7 @@ public class ProgramListActivity extends BaseDnsActivity {
|
||||
|
||||
final Event e = getItem(position);
|
||||
|
||||
/* Set text: */
|
||||
TextView titleView = (TextView) row.findViewById(R.id.event_list_row_text);
|
||||
titleView.setText(Html.fromHtml(e.title));
|
||||
|
||||
@@ -114,6 +115,20 @@ public class ProgramListActivity extends BaseDnsActivity {
|
||||
TextView dateView = (TextView) row.findViewById(R.id.event_list_row_date);
|
||||
dateView.setText(dateFormat.format(e.getDate()));
|
||||
|
||||
TextView priceView = (TextView) row.findViewById(R.id.event_list_row_price);
|
||||
priceView.setText(e.getPriceString());
|
||||
|
||||
/* Apply styles: */
|
||||
if (position % 2 == 0) {
|
||||
row.setBackgroundResource(R.color.ListItemBackgroundEven);
|
||||
} else {
|
||||
row.setBackgroundResource(R.color.ListItemBackgroundOdd);
|
||||
}
|
||||
titleView.setTextAppearance(ProgramListActivity.this, R.style.ListItemTextTitle);
|
||||
dateView.setTextAppearance(ProgramListActivity.this, R.style.ListItemTextDate);
|
||||
priceView.setTextAppearance(ProgramListActivity.this, R.style.ListItemTextDate);
|
||||
|
||||
/* Add onClickListeners: */
|
||||
row.setOnClickListener(new OnClickListener() {
|
||||
|
||||
public void onClick(View v) {
|
||||
@@ -150,17 +165,6 @@ public class ProgramListActivity extends BaseDnsActivity {
|
||||
}
|
||||
});
|
||||
|
||||
/* Apply styles: */
|
||||
if (position % 2 == 0) {
|
||||
row.setBackgroundResource(R.color.ListItemBackgroundEven);
|
||||
titleView.setTextAppearance(ProgramListActivity.this, R.style.ListItemTextTitle);
|
||||
dateView.setTextAppearance(ProgramListActivity.this, R.style.ListItemTextDate);
|
||||
} else {
|
||||
row.setBackgroundResource(R.color.ListItemBackgroundOdd);
|
||||
titleView.setTextAppearance(ProgramListActivity.this, R.style.ListItemTextTitle);
|
||||
dateView.setTextAppearance(ProgramListActivity.this, R.style.ListItemTextDate);
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user