[Android] Styling TV UI

Geoffrey Métais git at videolan.org
Wed Nov 23 16:25:36 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Nov 23 16:23:00 2016 +0100| [2bc957be471b762983f1796399cd3b6d50118294] | committer: Geoffrey Métais

Styling TV UI

> https://code.videolan.org/videolan/vlc-android/commit/2bc957be471b762983f1796399cd3b6d50118294
---

 vlc-android/res/values/styles.xml                           | 5 +++++
 vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/vlc-android/res/values/styles.xml b/vlc-android/res/values/styles.xml
index 092d5df..1580b21 100644
--- a/vlc-android/res/values/styles.xml
+++ b/vlc-android/res/values/styles.xml
@@ -173,11 +173,16 @@
     </style>
    <style name="Theme.VLC.TV" parent="Theme.Leanback">
         <item name="imageCardViewStyle">@style/VLCardView</item>
+        <item name="imageCardViewTitleStyle">@style/VLCardViewTitleStyle</item>
     </style>
     <style name="VLCardView" parent="Widget.Leanback.ImageCardViewStyle">
         <item name="cardType">infoUnderWithExtra</item>
         <item name="infoVisibility">always</item>
    </style>
+    <style name="VLCardViewTitleStyle" parent="Widget.Leanback.ImageCardView.TitleStyle">
+        <item name="android:maxLines">2</item>
+        <item name="android:ellipsize">middle</item>
+   </style>
 
     <style name="Theme.VLC.Leanback.Preferences" parent="Theme.Leanback">
         <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index 3c73b39..547a12a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -150,6 +150,8 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
         }
 
         mRootContainer = mBrowseFragment.getView();
+        mRootContainer.setBackgroundColor(ContextCompat.getColor(this, R.color.grey850));
+        mBrowseFragment.setBrandColor(ContextCompat.getColor(this, R.color.orange800));
     }
 
     @Override
@@ -200,7 +202,6 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
         if (mService != null)
             mService.addCallback(this);
         mMediaLibrary.setMediaUpdatedCb(this, Medialibrary.FLAG_MEDIA_UPDATED_VIDEO);
-        mBrowseFragment.setBrandColor(getResources().getColor(R.color.orange800));
     }
 
     protected void onPause() {



More information about the Android mailing list