Permalink
Browse files

Display "New" and "HD" badges.

Refs #9
  • Loading branch information...
1 parent d54c8b1 commit f243735039482998cb3a8a200bc055d3a0440181 @arantius committed Nov 8, 2011
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -52,6 +52,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FF9500" android:text="Subtitle" />
+ <LinearLayout android:layout_width="fill_parent"
+ android:layout_height="wrap_content" android:paddingTop="3dip"
+ >
+ <ImageView android:id="@+id/badge_new"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:src="@drawable/badge_new" android:paddingLeft="3dip" />
+ <ImageView android:id="@+id/badge_hd"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:src="@drawable/badge_hd" android:paddingLeft="6dip" />
+ </LinearLayout>
<TextView android:id="@+id/content_details"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Details" android:layout_marginTop="2dip" />
@@ -76,8 +86,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<Button android:id="@+id/explore_btn_delete" android:text="Delete"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:onClick="doDelete" />
- <Button android:id="@+id/explore_btn_upcoming"
- android:text="Upcoming" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:onClick="doUpcoming" />
+ <Button android:id="@+id/explore_btn_upcoming" android:text="Upcoming"
+ android:layout_width="fill_parent" android:layout_height="wrap_content"
+ android:onClick="doUpcoming" />
</LinearLayout>
</LinearLayout>
@@ -76,12 +76,12 @@ public String toString() {
private final MindRpcResponseListener mRecordingListener =
new MindRpcResponseListener() {
public void onResponse(MindRpcResponse response) {
- mRecordingState =
- response.getBody().path("recording").path(0).path("state")
- .getTextValue();
+ mRecording = response.getBody().path("recording").path(0);
+ mRecordingState = mRecording.path("state").getTextValue();
finishRequest();
}
};
+ private JsonNode mRecording = null;
private String mRecordingState = null;
private final MindRpcResponseListener mSubscriptionListener =
new MindRpcResponseListener() {
@@ -252,6 +252,14 @@ protected void finishRequest() {
subtitleView.setText(subtitle);
}
+ // Display (only the proper) badges.
+ if (mRecording.path("repeat").getBooleanValue()) {
+ findViewById(R.id.badge_new).setVisibility(View.GONE);
+ }
+ if (!mRecording.path("hdtv").getBooleanValue()) {
+ findViewById(R.id.badge_hd).setVisibility(View.GONE);
+ }
+
// Construct and display details.
ArrayList<String> detailParts = new ArrayList<String>();
int season = mContent.path("seasonNumber").getIntValue();

0 comments on commit f243735

Please sign in to comment.