Selected list items are now highlighted with the correct color

This commit is contained in:
daniel oeh 2012-11-23 19:57:11 +01:00
parent 349b5970f2
commit a8463d54f1
5 changed files with 28 additions and 4 deletions

View File

@ -19,7 +19,6 @@
<color name="black">#000000</color>
<color name="bright_blue">#33B5E5</color>
<color name="ics_gray">#858585</color>
<color name="selection_background">#FEBB20</color>
<color name="actionbar_gray">#DDDDDD</color>
<color name="download_success_green">#669900</color>
<color name="download_failed_red">#CC0000</color>

View File

@ -17,6 +17,7 @@ import de.danoeh.antennapod.feed.FeedImage;
import de.danoeh.antennapod.feed.FeedMedia;
import de.danoeh.antennapod.service.download.Downloader;
import de.danoeh.antennapod.util.Converter;
import de.danoeh.antennapod.util.ThemeUtils;
public class DownloadlistAdapter extends ArrayAdapter<Downloader> {
private int selectedItemIndex;
@ -57,7 +58,7 @@ public class DownloadlistAdapter extends ArrayAdapter<Downloader> {
if (position == selectedItemIndex) {
convertView.setBackgroundColor(convertView.getResources().getColor(
R.color.selection_background));
ThemeUtils.getSelectionBackgroundColor()));
} else {
convertView.setBackgroundResource(0);
}

View File

@ -24,6 +24,7 @@ import de.danoeh.antennapod.feed.MediaType;
import de.danoeh.antennapod.storage.DownloadRequester;
import de.danoeh.antennapod.util.Converter;
import de.danoeh.antennapod.util.EpisodeFilter;
import de.danoeh.antennapod.util.ThemeUtils;
public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
private OnClickListener onButActionClicked;
@ -83,7 +84,7 @@ public class FeedItemlistAdapter extends ArrayAdapter<FeedItem> {
convertView.setVisibility(View.VISIBLE);
if (position == selectedItemIndex) {
convertView.setBackgroundColor(convertView.getResources()
.getColor(R.color.selection_background));
.getColor(ThemeUtils.getSelectionBackgroundColor()));
} else {
convertView.setBackgroundResource(0);
}

View File

@ -15,6 +15,7 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.asynctask.FeedImageLoader;
import de.danoeh.antennapod.feed.Feed;
import de.danoeh.antennapod.storage.DownloadRequester;
import de.danoeh.antennapod.util.ThemeUtils;
public class FeedlistAdapter extends ArrayAdapter<Feed> {
private static final String TAG = "FeedlistAdapter";
@ -67,7 +68,7 @@ public class FeedlistAdapter extends ArrayAdapter<Feed> {
if (position == selectedItemIndex) {
convertView.setBackgroundColor(convertView.getResources().getColor(
R.color.selection_background));
ThemeUtils.getSelectionBackgroundColor()));
} else {
convertView.setBackgroundResource(0);
}

View File

@ -0,0 +1,22 @@
package de.danoeh.antennapod.util;
import android.util.Log;
import de.danoeh.antennapod.PodcastApp;
import de.danoeh.antennapod.R;
public class ThemeUtils {
private static final String TAG = "ThemeUtils";
public static int getSelectionBackgroundColor() {
switch (PodcastApp.getThemeResourceId()) {
case R.style.Theme_AntennaPod_Dark:
return R.color.selection_background_color_dark;
case R.style.Theme_AntennaPod_Light:
return R.color.selection_background_color_light;
default:
Log.e(TAG,
"getSelectionBackgroundColor could not match the current theme to any color!");
return R.color.selection_background_color_light;
}
}
}