Merge pull request #3399 from ByteHamster/remove-unused-color

Removed unused color resource
This commit is contained in:
H. Lehmann 2019-09-10 23:57:53 +02:00 committed by GitHub
commit eedd3ce755
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 48 deletions

View File

@ -1,7 +1,6 @@
package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -15,20 +14,15 @@ import de.danoeh.antennapod.core.service.download.DownloadRequest;
import de.danoeh.antennapod.core.service.download.DownloadStatus;
import de.danoeh.antennapod.core.service.download.Downloader;
import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.core.util.ThemeUtils;
public class DownloadlistAdapter extends BaseAdapter {
private static final int SELECTION_NONE = -1;
private int selectedItemIndex;
private final ItemAccess itemAccess;
private final Context context;
public DownloadlistAdapter(Context context,
ItemAccess itemAccess) {
super();
this.selectedItemIndex = SELECTION_NONE;
this.context = context;
this.itemAccess = itemAccess;
}
@ -74,13 +68,6 @@ public class DownloadlistAdapter extends BaseAdapter {
holder = (Holder) convertView.getTag();
}
if (position == selectedItemIndex) {
convertView.setBackgroundColor(ContextCompat.getColor(convertView.getContext(),
ThemeUtils.getSelectionBackgroundColor()));
} else {
convertView.setBackgroundResource(0);
}
holder.title.setText(request.getTitle());
holder.progbar.setIndeterminate(request.getSoFar() <= 0);

View File

@ -34,12 +34,8 @@ public class FeedItemlistAdapter extends BaseAdapter {
private final ItemAccess itemAccess;
private final Context context;
private final boolean showFeedtitle;
private final int selectedItemIndex;
/** true if played items should be made partially transparent */
private final boolean makePlayedItemsTransparent;
private static final int SELECTION_NONE = -1;
private final int playingBackGroundColor;
private final int normalBackGroundColor;
@ -51,7 +47,6 @@ public class FeedItemlistAdapter extends BaseAdapter {
this.context = context;
this.itemAccess = itemAccess;
this.showFeedtitle = showFeedtitle;
this.selectedItemIndex = SELECTION_NONE;
this.makePlayedItemsTransparent = makePlayedItemsTransparent;
playingBackGroundColor = ThemeUtils.getColorFromAttr(context, R.attr.currently_playing_background);
@ -112,12 +107,6 @@ public class FeedItemlistAdapter extends BaseAdapter {
if (!(getItemViewType(position) == Adapter.IGNORE_ITEM_VIEW_TYPE)) {
convertView.setVisibility(View.VISIBLE);
if (position == selectedItemIndex) {
convertView.setBackgroundColor(ContextCompat.getColor(convertView.getContext(),
ThemeUtils.getSelectionBackgroundColor()));
} else {
convertView.setBackgroundResource(0);
}
StringBuilder buffer = new StringBuilder(item.getTitle());
if (showFeedtitle) {

View File

@ -3,30 +3,11 @@ package de.danoeh.antennapod.core.util;
import android.content.Context;
import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt;
import android.util.Log;
import android.util.TypedValue;
import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.core.preferences.UserPreferences;
public class ThemeUtils {
private ThemeUtils(){}
private ThemeUtils() {
private static final String TAG = "ThemeUtils";
public static int getSelectionBackgroundColor() {
int theme = UserPreferences.getTheme();
if (theme == R.style.Theme_AntennaPod_Dark) {
return R.color.selection_background_color_dark;
} else if (theme == R.style.Theme_AntennaPod_TrueBlack){
return R.color.selection_background_color_trueblack;
} else if (theme == R.style.Theme_AntennaPod_Light) {
return R.color.selection_background_color_light;
} else {
Log.e(TAG,
"getSelectionBackgroundColor could not match the current theme to any color!");
return R.color.selection_background_color_light;
}
}
public static @ColorInt int getColorFromAttr(Context context, @AttrRes int attr) {

View File

@ -22,10 +22,6 @@
<color name="image_readability_tint">#80000000</color>
<color name="feed_image_bg">#50000000</color>
<color name="selection_background_color_trueblack">#286E8A</color>
<color name="selection_background_color_dark">#286E8A</color>
<color name="selection_background_color_light">#81CFEA</color>
<!-- Theme colors -->
<color name="primary_light">#FFFFFF</color>
<color name="primary_darktheme">#212121</color>