summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-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