Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #5959 from mahdihijazi/tv_version_number
[Android] Show the version number on the title for the Android TV UI
- Loading branch information
Showing
6 changed files
with
135 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| package org.dolphinemu.dolphinemu.ui.main; | ||
|
|
||
| import android.content.Context; | ||
| import android.graphics.drawable.Drawable; | ||
| import android.support.v17.leanback.widget.TitleViewAdapter; | ||
| import android.util.AttributeSet; | ||
| import android.view.LayoutInflater; | ||
| import android.view.View; | ||
| import android.widget.LinearLayout; | ||
| import android.widget.TextView; | ||
|
|
||
| import org.dolphinemu.dolphinemu.R; | ||
|
|
||
| public class CustomTitleView extends LinearLayout implements TitleViewAdapter.Provider { | ||
| private final TextView mTitleView; | ||
| private final View mBadgeView; | ||
|
|
||
| private final TitleViewAdapter mTitleViewAdapter = new TitleViewAdapter() { | ||
| @Override | ||
| public View getSearchAffordanceView() | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public void setTitle(CharSequence titleText) | ||
| { | ||
| CustomTitleView.this.setTitle(titleText); | ||
| } | ||
|
|
||
| @Override | ||
| public void setBadgeDrawable(Drawable drawable) | ||
| { | ||
| CustomTitleView.this.setBadgeDrawable(drawable); | ||
| } | ||
| }; | ||
|
|
||
| public CustomTitleView(Context context) | ||
| { | ||
| this(context, null); | ||
| } | ||
|
|
||
| public CustomTitleView(Context context, AttributeSet attrs) | ||
| { | ||
| this(context, attrs, 0); | ||
| } | ||
|
|
||
| public CustomTitleView(Context context, AttributeSet attrs, int defStyle) | ||
| { | ||
| super(context, attrs, defStyle); | ||
| View root = LayoutInflater.from(context).inflate(R.layout.tv_title, this); | ||
| mTitleView = (TextView) root.findViewById(R.id.title); | ||
| mBadgeView = root.findViewById(R.id.badge); | ||
| } | ||
|
|
||
| public void setTitle(CharSequence title) | ||
| { | ||
| if (title != null) | ||
| { | ||
| mTitleView.setText(title); | ||
| mTitleView.setVisibility(View.VISIBLE); | ||
| mBadgeView.setVisibility(View.VISIBLE); | ||
| } | ||
| } | ||
|
|
||
| public void setBadgeDrawable(Drawable drawable) | ||
| { | ||
| if (drawable != null) | ||
| { | ||
| mTitleView.setVisibility(View.GONE); | ||
| mBadgeView.setVisibility(View.VISIBLE); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public TitleViewAdapter getTitleViewAdapter() | ||
| { | ||
| return mTitleViewAdapter; | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <org.dolphinemu.dolphinemu.ui.main.CustomTitleView | ||
| xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:id="@+id/browse_title_group" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:padding="16dp"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <android.support.v17.leanback.widget.TitleView | ||
| xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent"> | ||
|
|
||
| <RelativeLayout | ||
| android:layout_width="match_parent" | ||
| android:layout_height="match_parent"> | ||
|
|
||
| <TextView | ||
| android:visibility="gone" | ||
| android:layout_alignTop="@+id/badge" | ||
| android:layout_alignBottom="@+id/badge" | ||
| android:layout_alignParentRight="true" | ||
| android:id="@+id/title" | ||
| android:gravity="center_vertical" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:textAppearance="?android:attr/textAppearanceSmall"/> | ||
|
|
||
| <ImageView | ||
| android:visibility="gone" | ||
| android:layout_toLeftOf="@id/title" | ||
| android:id="@+id/badge" | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:src="@drawable/ic_launcher"/> | ||
|
|
||
| </RelativeLayout> | ||
| </android.support.v17.leanback.widget.TitleView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters