[Android] TV: fix compatibility with Android below 23

Geoffrey Métais git at videolan.org
Tue Jan 16 12:32:34 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Jan 16 12:31:00 2018 +0100| [c17b29cbd5d274665b0697bd53dd96ff52b2c132] | committer: Geoffrey Métais

TV: fix compatibility with Android below 23

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

 .../org/videolan/vlc/gui/tv/audioplayer/PlaylistAdapter.java  | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/PlaylistAdapter.java b/vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/PlaylistAdapter.java
index 2fa7f7214..608605e22 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/PlaylistAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/audioplayer/PlaylistAdapter.java
@@ -20,6 +20,7 @@
  *****************************************************************************/
 package org.videolan.vlc.gui.tv.audioplayer;
 
+import android.content.Context;
 import android.support.v7.widget.RecyclerView;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -67,8 +68,9 @@ public class PlaylistAdapter extends RecyclerView.Adapter<PlaylistAdapter.ViewHo
     public void onBindViewHolder(ViewHolder holder, int position) {
         holder.binding.setMedia(dataset.get(position));
         final int textAppearance = position == selectedItem ? R.style.TextAppearance_AppCompat_Title : R.style.TextAppearance_AppCompat_Medium;
-        holder.binding.artist.setTextAppearance(textAppearance);
-        holder.binding.title.setTextAppearance(textAppearance);
+        final Context ctx = holder.itemView.getContext();
+        holder.binding.artist.setTextAppearance(ctx, textAppearance);
+        holder.binding.title.setTextAppearance(ctx, textAppearance);
     }
 
     @Override
@@ -76,8 +78,9 @@ public class PlaylistAdapter extends RecyclerView.Adapter<PlaylistAdapter.ViewHo
         if (Util.isListEmpty(payloads)) super.onBindViewHolder(holder, position, payloads);
         else {
             final int textAppearance = (boolean) payloads.get(0) ? R.style.TextAppearance_AppCompat_Title : R.style.TextAppearance_AppCompat_Medium;
-            holder.binding.artist.setTextAppearance(textAppearance);
-            holder.binding.title.setTextAppearance(textAppearance);
+            final Context ctx = holder.itemView.getContext();
+            holder.binding.artist.setTextAppearance(ctx, textAppearance);
+            holder.binding.title.setTextAppearance(ctx, textAppearance);
         }
     }
 



More information about the Android mailing list