Skip to content

Commit

Permalink
Display "New" and "HD" badges.
Browse files Browse the repository at this point in the history
Refs #9
  • Loading branch information
arantius committed Nov 8, 2011
1 parent d54c8b1 commit f243735
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
Binary file added res/drawable-hdpi/badge_hd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-hdpi/badge_new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 13 additions & 3 deletions res/layout/explore.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand All @@ -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>
14 changes: 11 additions & 3 deletions src/com/arantius/tivocommander/Explore.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit f243735

Please sign in to comment.