aboutsummaryrefslogtreecommitdiff
path: root/src/com/android/tv/ui/sidepanel/ActionItem.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/tv/ui/sidepanel/ActionItem.java')
-rw-r--r--src/com/android/tv/ui/sidepanel/ActionItem.java50
1 files changed, 38 insertions, 12 deletions
diff --git a/src/com/android/tv/ui/sidepanel/ActionItem.java b/src/com/android/tv/ui/sidepanel/ActionItem.java
index 1ef862cd..c75eff9b 100644
--- a/src/com/android/tv/ui/sidepanel/ActionItem.java
+++ b/src/com/android/tv/ui/sidepanel/ActionItem.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,16 +17,32 @@
package com.android.tv.ui.sidepanel;
import android.view.View;
+import android.widget.ImageView;
import android.widget.TextView;
import com.android.tv.R;
-public class ActionItem extends Item {
+public abstract class ActionItem extends Item {
private final String mTitle;
- private TextView mTitleView;
+ private final String mDescription;
+ private final int mIconId;
public ActionItem(String title) {
+ this(title, null, 0);
+ }
+
+ public ActionItem(String title, String description) {
+ this(title, description, 0);
+ }
+
+ public ActionItem(String title, int iconId) {
+ this(title, null, iconId);
+ }
+
+ public ActionItem(String title, String description, int iconId) {
mTitle = title;
+ mDescription = description;
+ mIconId = iconId;
}
@Override
@@ -35,13 +51,23 @@ public class ActionItem extends Item {
}
@Override
- protected void bind(View view) {
- mTitleView = (TextView) view.findViewById(R.id.title);
- mTitleView.setText(mTitle);
- }
-
- @Override
- protected void unbind() {
- mTitleView = null;
+ protected void onBind(View view) {
+ super.onBind(view);
+ TextView titleView = (TextView) view.findViewById(R.id.title);
+ titleView.setText(mTitle);
+ TextView descriptionView = (TextView) view.findViewById(R.id.description);
+ if (mDescription != null) {
+ descriptionView.setVisibility(View.VISIBLE);
+ descriptionView.setText(mDescription);
+ } else {
+ descriptionView.setVisibility(View.GONE);
+ }
+ ImageView iconView = (ImageView) view.findViewById(R.id.icon);
+ if (mIconId != 0) {
+ iconView.setVisibility(View.VISIBLE);
+ iconView.setImageResource(mIconId);
+ } else {
+ iconView.setVisibility(View.GONE);
+ }
}
-} \ No newline at end of file
+}