summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/danoeh/antennapod/adapter
diff options
context:
space:
mode:
authorMartin Fietz <martin.fietz@gmail.com>2018-01-02 20:42:34 +0100
committerMartin Fietz <martin.fietz@gmail.com>2018-01-02 20:42:34 +0100
commiteddc0a6a13bf70fd64266897a8f098f63b4d20a1 (patch)
tree805ede344e57523685a1ef85964e16e0dc0c919a /app/src/main/java/de/danoeh/antennapod/adapter
parent717a1ec00ea140bd6ae2962449cffbc37e7d3725 (diff)
parentf9686ffba71ae0c569acca351a2385b3d04207b4 (diff)
downloadAntennaPod-eddc0a6a13bf70fd64266897a8f098f63b4d20a1.zip
Merge branch 'develop'
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/adapter')
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java32
1 files changed, 14 insertions, 18 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java
index d7bebb672..75514abb1 100644
--- a/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java
+++ b/app/src/main/java/de/danoeh/antennapod/adapter/ChaptersListAdapter.java
@@ -1,6 +1,7 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
+import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.text.Layout;
import android.text.Selection;
@@ -42,8 +43,9 @@ public class ChaptersListAdapter extends ArrayAdapter<Chapter> {
this.media = media;
}
+ @NonNull
@Override
- public View getView(final int position, View convertView, ViewGroup parent) {
+ public View getView(final int position, View convertView, @NonNull ViewGroup parent) {
Holder holder;
Chapter sc = getItem(position);
@@ -120,7 +122,7 @@ public class ChaptersListAdapter extends ArrayAdapter<Chapter> {
if (link.length != 0) {
if (action == MotionEvent.ACTION_UP) {
link[0].onClick(widget);
- } else if (action == MotionEvent.ACTION_DOWN){
+ } else if (action == MotionEvent.ACTION_DOWN) {
Selection.setSelection(buffer,
buffer.getSpanStart(link[0]),
buffer.getSpanEnd(link[0]));
@@ -139,23 +141,17 @@ public class ChaptersListAdapter extends ArrayAdapter<Chapter> {
callback.onPlayChapterButtonClicked(position);
}
});
+
Chapter current = ChapterUtils.getCurrentChapter(media);
- if (current != null) {
- if (current == sc) {
- int playingBackGroundColor;
- if(UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
- playingBackGroundColor = ContextCompat.getColor(getContext(), R.color.highlight_dark);
- } else {
- playingBackGroundColor = ContextCompat.getColor(getContext(), R.color.highlight_light);
- }
- holder.view.setBackgroundColor(playingBackGroundColor);
- } else {
- holder.view.setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent));
- holder.title.setTextColor(defaultTextColor);
- holder.start.setTextColor(defaultTextColor);
- }
+ if (current == sc) {
+ boolean darkTheme = UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark;
+ int highlight = darkTheme ? R.color.highlight_dark : R.color.highlight_light;
+ int playingBackGroundColor = ContextCompat.getColor(getContext(), highlight);
+ holder.view.setBackgroundColor(playingBackGroundColor);
} else {
- Log.w(TAG, "Could not find out what the current chapter is.");
+ holder.view.setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent));
+ holder.title.setTextColor(defaultTextColor);
+ holder.start.setTextColor(defaultTextColor);
}
return convertView;
@@ -172,7 +168,7 @@ public class ChaptersListAdapter extends ArrayAdapter<Chapter> {
@Override
public int getCount() {
- if(media == null || media.getChapters() == null) {
+ if (media == null || media.getChapters() == null) {
return 0;
}
// ignore invalid chapters