diff options
author | Dongwon Kang <dwkang@google.com> | 2014-06-02 13:28:19 +0900 |
---|---|---|
committer | Jae Seo <jaeseo@google.com> | 2014-06-02 15:25:55 -0700 |
commit | e51a084c2518f17cee43c86e2f9df907d1f2cafb (patch) | |
tree | 68029971468e77d76745196f56d5eadfba97049f /src/com | |
parent | 9035590d94d136a020e499ce720b9d2cf1f6f45c (diff) | |
download | TV-e51a084c2518f17cee43c86e2f9df907d1f2cafb.tar.gz |
Apply new UX on channel banner.
Bug: 14628404
Change-Id: I2546469ee126241f3fc530d221568c49fa29682b
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/tv/data/StreamInfo.java | 4 | ||||
-rw-r--r-- | src/com/android/tv/ui/ChannelBannerView.java | 54 | ||||
-rw-r--r-- | src/com/android/tv/ui/TunableTvView.java | 14 | ||||
-rw-r--r-- | src/com/android/tv/util/Utils.java | 13 |
4 files changed, 67 insertions, 18 deletions
diff --git a/src/com/android/tv/data/StreamInfo.java b/src/com/android/tv/data/StreamInfo.java index 1cb1f30d..e2524258 100644 --- a/src/com/android/tv/data/StreamInfo.java +++ b/src/com/android/tv/data/StreamInfo.java @@ -23,5 +23,9 @@ public interface StreamInfo { public final int VIDEO_DEFINITION_LEVEL_FULL_HD = 3; public final int VIDEO_DEFINITION_LEVEL_ULTRA_HD = 4; + public final int AUDIO_CHANNEL_COUNT_UNKNOWN = 0; + int getVideoDefinitionLevel(); + int getAudioChannelCount(); + boolean hasClosedCaption(); } diff --git a/src/com/android/tv/ui/ChannelBannerView.java b/src/com/android/tv/ui/ChannelBannerView.java index f9a6d6f0..ecec41b7 100644 --- a/src/com/android/tv/ui/ChannelBannerView.java +++ b/src/com/android/tv/ui/ChannelBannerView.java @@ -40,12 +40,14 @@ import com.android.tv.util.Utils; * A view to render channel banner. */ public class ChannelBannerView extends LinearLayout { + private TextView mClosedCaptionTextView; private TextView mResolutionTextView; private TextView mAspectRatioTextView; + private TextView mAudioChannelTextView; private ProgressBar mRemainingTimeView; - private LinearLayout mProgramInfoContainer; private TextView mProgrameDescriptionTextView; private TextView mChannelTextView; + private TextView mChannelNameTextView; private TextView mProgramTextView; private TextView mProgramTimeTextView; private Uri mCurrentChannelUri; @@ -89,12 +91,14 @@ public class ChannelBannerView extends LinearLayout { protected void onFinishInflate() { super.onFinishInflate(); + mClosedCaptionTextView = (TextView) findViewById(R.id.closed_caption); mResolutionTextView = (TextView) findViewById(R.id.resolution); mAspectRatioTextView = (TextView) findViewById(R.id.aspect_ratio); + mAudioChannelTextView = (TextView) findViewById(R.id.audio_channel); mRemainingTimeView = (ProgressBar) findViewById(R.id.remaining_time); mChannelTextView = (TextView) findViewById(R.id.channel_text); + mChannelNameTextView = (TextView) findViewById(R.id.channel_name); mProgramTimeTextView = (TextView) findViewById(R.id.program_time_text); - mProgramInfoContainer = (LinearLayout) findViewById(R.id.program_info); mProgrameDescriptionTextView = (TextView) findViewById(R.id.program_description); mProgramTextView = (TextView) findViewById(R.id.program_text); } @@ -104,10 +108,24 @@ public class ChannelBannerView extends LinearLayout { return; } - mResolutionTextView.setText(Utils.getVideoDefinitionLevelString( - info.getVideoDefinitionLevel())); + if (info.hasClosedCaption()) { + mClosedCaptionTextView.setText("CC"); + } else { + mResolutionTextView.setVisibility(View.GONE); + } + if (info.getVideoDefinitionLevel() != StreamInfo.VIDEO_DEFINITION_LEVEL_UNKNOWN) { + mResolutionTextView.setText(Utils.getVideoDefinitionLevelString( + info.getVideoDefinitionLevel())); + } else { + mResolutionTextView.setVisibility(View.GONE); + } + // TODO: implement aspect ratio. mAspectRatioTextView.setVisibility(View.GONE); - mProgrameDescriptionTextView.setVisibility(View.GONE); + if (!TextUtils.isEmpty(Utils.getAudioChannelString(info.getAudioChannelCount()))) { + mAudioChannelTextView.setText(Utils.getAudioChannelString(info.getAudioChannelCount())); + } else { + mAudioChannelTextView.setVisibility(View.GONE); + } String displayNumber = channelMap.getCurrentDisplayNumber(); String displayName = channelMap.getCurrentDisplayName(); @@ -117,8 +135,8 @@ public class ChannelBannerView extends LinearLayout { if (displayName == null) { displayName = ""; } - mChannelTextView.setText(Html.fromHtml(mContext.getString( - R.string.channel_banner_channel_title, displayNumber, displayName))); + mChannelTextView.setText(displayNumber); + mChannelNameTextView.setText(displayName); mCurrentChannelUri = channelMap.getCurrentChannelUri(); updateProgramInfo(); @@ -131,23 +149,21 @@ public class ChannelBannerView extends LinearLayout { public void updateProgramInfo() { if (mCurrentChannelUri == null) { - hideProgramInformation(); + handleNoProgramInformation(); return; } Program program = Utils.getCurrentProgram(mContext, mCurrentChannelUri); if (program == null) { - hideProgramInformation(); + handleNoProgramInformation(); return; } if (!TextUtils.isEmpty(program.getTitle())) { - mProgramInfoContainer.setVisibility(View.VISIBLE); mProgramTextView.setText(program.getTitle()); long startTime = program.getStartTimeUtcMillis(); long endTime = program.getEndTimeUtcMillis(); if (startTime > 0 && endTime > 0) { - mProgramTimeTextView.setVisibility(View.VISIBLE); mRemainingTimeView.setVisibility(View.VISIBLE); String startTimeText = getFormattedTimeString(startTime); @@ -166,17 +182,19 @@ public class ChannelBannerView extends LinearLayout { (int) (100 *(currTime - startTime) / (endTime - startTime))); } } else { - mProgramTimeTextView.setVisibility(View.INVISIBLE); - mRemainingTimeView.setVisibility(View.INVISIBLE); + mProgramTimeTextView.setVisibility(View.GONE); + mRemainingTimeView.setVisibility(View.GONE); } - } else { - hideProgramInformation(); + } + if (!TextUtils.isEmpty(program.getDescription())) { + mProgrameDescriptionTextView.setText(program.getDescription()); } } - private void hideProgramInformation() { - mProgramInfoContainer.setVisibility(View.INVISIBLE); - mProgramTimeTextView.setVisibility(View.INVISIBLE); + private void handleNoProgramInformation() { + mProgramTextView.setText(mContext.getString(R.string.channel_banner_no_title)); + mProgramTimeTextView.setVisibility(View.GONE); mRemainingTimeView.setVisibility(View.GONE); + mProgrameDescriptionTextView.setVisibility(View.GONE); } } diff --git a/src/com/android/tv/ui/TunableTvView.java b/src/com/android/tv/ui/TunableTvView.java index 2302eba2..bd74ec44 100644 --- a/src/com/android/tv/ui/TunableTvView.java +++ b/src/com/android/tv/ui/TunableTvView.java @@ -33,6 +33,8 @@ public class TunableTvView extends TvView implements StreamInfo { private TvInputManager.Session mSession; private OnTuneListener mOnTuneListener; private int mVideoFormat = StreamInfo.VIDEO_DEFINITION_LEVEL_UNKNOWN; + private int mAudioChannelCount = StreamInfo.AUDIO_CHANNEL_COUNT_UNKNOWN; + private boolean mHasClosedCaption = false; private final Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { @@ -159,6 +161,8 @@ public class TunableTvView extends TvView implements StreamInfo { if (DEBUG) Log.d(TAG, "tuneTo " + channelId); mHandler.removeMessages(MSG_TUNE); mVideoFormat = StreamInfo.VIDEO_DEFINITION_LEVEL_UNKNOWN; + mAudioChannelCount = StreamInfo.AUDIO_CHANNEL_COUNT_UNKNOWN; + mHasClosedCaption = false; String inputId = Utils.getInputIdForChannel(getContext(), channelId); TvInputInfo inputInfo = mInputManagerHelper.getTvInputInfo(inputId); if (inputInfo == null || !mInputManagerHelper.isAvailable(inputInfo)) { @@ -220,4 +224,14 @@ public class TunableTvView extends TvView implements StreamInfo { public int getVideoDefinitionLevel() { return mVideoFormat; } + + @Override + public int getAudioChannelCount() { + return mAudioChannelCount; + } + + @Override + public boolean hasClosedCaption() { + return mHasClosedCaption; + } } diff --git a/src/com/android/tv/util/Utils.java b/src/com/android/tv/util/Utils.java index 98766ac9..5f2f53e1 100644 --- a/src/com/android/tv/util/Utils.java +++ b/src/com/android/tv/util/Utils.java @@ -258,6 +258,19 @@ public class Utils { return ""; } + /* TODO: remove this method once we have assets for audio channels */ + public static String getAudioChannelString(int channelCount) { + switch (channelCount) { + case 1: + return "MONO"; + case 2: + return "STEREO"; + case 6: + return "5.1"; + } + return ""; + } + private static ActivityInfo getActivityInfo(Context context, TvInputInfo input, String action) { if (input == null) { return null; |