[Android] Styles: replace colors by attributes
Adrien Maglo
git at videolan.org
Mon Feb 24 12:18:36 CET 2014
vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Mon Feb 24 12:05:21 2014 +0100| [2792575e1e2ffa1f4679e981ed7af69e43c34906] | committer: Adrien Maglo
Styles: replace colors by attributes
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=2792575e1e2ffa1f4679e981ed7af69e43c34906
---
.../src/org/videolan/vlc/gui/audio/AudioPlaylistAdapter.java | 7 +++++--
.../src/org/videolan/vlc/gui/video/VideoListAdapter.java | 5 ++++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistAdapter.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistAdapter.java
index d20efd7..c312bc5 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlaylistAdapter.java
@@ -25,6 +25,7 @@ import java.util.List;
import org.videolan.libvlc.Media;
import org.videolan.vlc.R;
+import org.videolan.vlc.Util;
import org.videolan.vlc.widget.AudioPlaylistItemViewGroup;
import android.content.Context;
@@ -45,9 +46,11 @@ public class AudioPlaylistAdapter extends ArrayAdapter<Media> {
private ArrayList<Media> mMediaList;
private int mCurrentIndex;
+ private Context mContext;
public AudioPlaylistAdapter(Context context) {
super(context, 0);
+ mContext = context;
mMediaList = new ArrayList<Media>();
mCurrentIndex = -1;
}
@@ -106,8 +109,8 @@ public class AudioPlaylistAdapter extends ArrayAdapter<Media> {
holder.title.setText(title);
ColorStateList titleColor = v.getResources().getColorStateList(mCurrentIndex == position
- ? R.color.list_title_last
- : R.color.list_title);
+ ? Util.getResourceFromAttribute(mContext, R.attr.list_title_last)
+ : Util.getResourceFromAttribute(mContext, R.attr.list_title));
holder.title.setTextColor(titleColor);
holder.artist.setText(artist);
holder.position = position;
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index 0e6bd71..b817c2f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -51,10 +51,12 @@ public class VideoListAdapter extends ArrayAdapter<Media>
private int mSortDirection = 1;
private int mSortBy = SORT_BY_TITLE;
private boolean mListMode = false;
+ private Context mContext;
private VideoGridFragment mFragment;
public VideoListAdapter(Context context, VideoGridFragment fragment) {
super(context, 0);
+ mContext = context;
mFragment = fragment;
}
@@ -179,7 +181,8 @@ public class VideoListAdapter extends ArrayAdapter<Media>
holder.thumbnail.setImageBitmap(thumbnail);
/* Color state */
- ColorStateList titleColor = v.getResources().getColorStateList(R.color.list_title);
+ ColorStateList titleColor = v.getResources().getColorStateList(
+ Util.getResourceFromAttribute(mContext, R.attr.list_title));
holder.title.setTextColor(titleColor);
if (media instanceof MediaGroup)
More information about the Android
mailing list