diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-03-12 23:17:59 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-03-12 23:17:59 +0000 |
commit | 1fe9b40c7c5c3fdeaa688ac40b94a919edb48436 (patch) | |
tree | 99dcc86bd0f9a6116929d511f4319a83b4e42398 /src/com/android/tv/ui/EmptyInputStatusBlockView.java | |
parent | d3d7eb45a540ca32ffb42ce8a1087fd5506c823f (diff) | |
parent | 124b35f6a01ae9eb581bed789b9032c77772bd98 (diff) | |
download | TV-1fe9b40c7c5c3fdeaa688ac40b94a919edb48436.tar.gz |
Snap for 11566117 from 124b35f6a01ae9eb581bed789b9032c77772bd98 to sdk-releaseplatform-tools-35.0.1
Change-Id: Id2713a34d856788e5c019e290787ca1a1ce3bac8
Diffstat (limited to 'src/com/android/tv/ui/EmptyInputStatusBlockView.java')
-rw-r--r-- | src/com/android/tv/ui/EmptyInputStatusBlockView.java | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/com/android/tv/ui/EmptyInputStatusBlockView.java b/src/com/android/tv/ui/EmptyInputStatusBlockView.java new file mode 100644 index 00000000..a7f91661 --- /dev/null +++ b/src/com/android/tv/ui/EmptyInputStatusBlockView.java @@ -0,0 +1,68 @@ +/* + * Copyright 2023 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.tv.ui; + +import android.content.Context; +import android.media.tv.TvInputInfo; +import android.util.AttributeSet; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.TextView; + +import com.android.tv.R; + +public class EmptyInputStatusBlockView extends FrameLayout { + private ImageView mEmptyInputStatusIcon; + private TextView mEmptyInputTitleTextView; + + public EmptyInputStatusBlockView(Context context) { + this(context, null, 0); + } + + public EmptyInputStatusBlockView(Context context, AttributeSet attrs) { + this(context, attrs, 0); + } + + public EmptyInputStatusBlockView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + inflate(context, R.layout.empty_input_status_block, this); + } + + @Override + protected void onFinishInflate() { + super.onFinishInflate(); + + mEmptyInputStatusIcon = findViewById(R.id.empty_input_status_icon); + mEmptyInputTitleTextView = findViewById(R.id.empty_input_status_title_text); + } + + public void setIconAndLabelByInputInfo(TvInputInfo inputInfo) { + CharSequence label = inputInfo.loadLabel(getContext()); + String title = getResources().getString(R.string.empty_input_status_title_format, label); + mEmptyInputTitleTextView.setText(title); + + if (inputInfo.isPassthroughInput()) { + mEmptyInputStatusIcon.setImageDrawable( + getResources().getDrawable(R.drawable.ic_empty_input_hdmi, null) + ); + } else { + mEmptyInputStatusIcon.setImageDrawable( + getResources().getDrawable(R.drawable.ic_empty_input_tuner, null) + ); + } + } +} |