mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-01-27 09:01:22 +01:00
Remove deprecation warnings by using ContextCompat.getColor().
This commit is contained in:
parent
a2431be0be
commit
31111332e9
@ -2,6 +2,7 @@ package de.danoeh.antennapod.adapter;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||
import android.util.Log;
|
||||
@ -70,11 +71,11 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR
|
||||
this.showOnlyNewEpisodes = showOnlyNewEpisodes;
|
||||
|
||||
if(UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
|
||||
playingBackGroundColor = mainActivity.getResources().getColor(R.color.highlight_dark);
|
||||
playingBackGroundColor = ContextCompat.getColor(mainActivity, R.color.highlight_dark);
|
||||
} else {
|
||||
playingBackGroundColor = mainActivity.getResources().getColor(R.color.highlight_light);
|
||||
playingBackGroundColor = ContextCompat.getColor(mainActivity, R.color.highlight_light);
|
||||
}
|
||||
normalBackGroundColor = mainActivity.getResources().getColor(android.R.color.transparent);
|
||||
normalBackGroundColor = ContextCompat.getColor(mainActivity, android.R.color.transparent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.danoeh.antennapod.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.Layout;
|
||||
import android.text.Selection;
|
||||
import android.text.Spannable;
|
||||
@ -132,13 +133,13 @@ public class ChaptersListAdapter extends ArrayAdapter<Chapter> {
|
||||
if (current == sc) {
|
||||
int playingBackGroundColor;
|
||||
if(UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
|
||||
playingBackGroundColor = getContext().getResources().getColor(R.color.highlight_dark);
|
||||
playingBackGroundColor = ContextCompat.getColor(getContext(), R.color.highlight_dark);
|
||||
} else {
|
||||
playingBackGroundColor = getContext().getResources().getColor(R.color.highlight_light);
|
||||
playingBackGroundColor = ContextCompat.getColor(getContext(), R.color.highlight_light);
|
||||
}
|
||||
holder.view.setBackgroundColor(playingBackGroundColor);
|
||||
} else {
|
||||
holder.view.setBackgroundColor(getContext().getResources().getColor(android.R.color.transparent));
|
||||
holder.view.setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent));
|
||||
holder.title.setTextColor(defaultTextColor);
|
||||
holder.start.setTextColor(defaultTextColor);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.danoeh.antennapod.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@ -74,14 +75,14 @@ public class DownloadLogAdapter extends BaseAdapter {
|
||||
status.getCompletionDate().getTime(),
|
||||
System.currentTimeMillis(), 0, 0));
|
||||
if (status.isSuccessful()) {
|
||||
holder.icon.setTextColor(convertView.getResources().getColor(
|
||||
holder.icon.setTextColor(ContextCompat.getColor(convertView.getContext(),
|
||||
R.color.download_success_green));
|
||||
holder.icon.setText("{fa-check-circle}");
|
||||
Iconify.addIcons(holder.icon);
|
||||
holder.retry.setVisibility(View.GONE);
|
||||
holder.reason.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.icon.setTextColor(convertView.getResources().getColor(
|
||||
holder.icon.setTextColor(ContextCompat.getColor(convertView.getContext(),
|
||||
R.color.download_failed_red));
|
||||
holder.icon.setText("{fa-times-circle}");
|
||||
Iconify.addIcons(holder.icon);
|
||||
|
@ -1,6 +1,7 @@
|
||||
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;
|
||||
@ -74,7 +75,7 @@ public class DownloadlistAdapter extends BaseAdapter {
|
||||
}
|
||||
|
||||
if (position == selectedItemIndex) {
|
||||
convertView.setBackgroundColor(convertView.getResources().getColor(
|
||||
convertView.setBackgroundColor(ContextCompat.getColor(convertView.getContext(),
|
||||
ThemeUtils.getSelectionBackgroundColor()));
|
||||
} else {
|
||||
convertView.setBackgroundResource(0);
|
||||
|
@ -2,6 +2,7 @@ package de.danoeh.antennapod.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
@ -59,11 +60,11 @@ public class FeedItemlistAdapter extends BaseAdapter {
|
||||
this.makePlayedItemsTransparent = makePlayedItemsTransparent;
|
||||
|
||||
if(UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
|
||||
playingBackGroundColor = context.getResources().getColor(R.color.highlight_dark);
|
||||
playingBackGroundColor = ContextCompat.getColor(context, R.color.highlight_dark);
|
||||
} else {
|
||||
playingBackGroundColor = context.getResources().getColor(R.color.highlight_light);
|
||||
playingBackGroundColor = ContextCompat.getColor(context, R.color.highlight_light);
|
||||
}
|
||||
normalBackGroundColor = context.getResources().getColor(android.R.color.transparent);
|
||||
normalBackGroundColor = ContextCompat.getColor(context, android.R.color.transparent);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -118,8 +119,8 @@ public class FeedItemlistAdapter extends BaseAdapter {
|
||||
if (!(getItemViewType(position) == Adapter.IGNORE_ITEM_VIEW_TYPE)) {
|
||||
convertView.setVisibility(View.VISIBLE);
|
||||
if (position == selectedItemIndex) {
|
||||
convertView.setBackgroundColor(convertView.getResources()
|
||||
.getColor(ThemeUtils.getSelectionBackgroundColor()));
|
||||
convertView.setBackgroundColor(ContextCompat.getColor(convertView.getContext(),
|
||||
ThemeUtils.getSelectionBackgroundColor()));
|
||||
} else {
|
||||
convertView.setBackgroundResource(0);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package de.danoeh.antennapod.adapter;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.MotionEventCompat;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||
@ -78,11 +79,11 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap
|
||||
locked = UserPreferences.isQueueLocked();
|
||||
|
||||
if(UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
|
||||
playingBackGroundColor = mainActivity.getResources().getColor(R.color.highlight_dark);
|
||||
playingBackGroundColor = ContextCompat.getColor(mainActivity, R.color.highlight_dark);
|
||||
} else {
|
||||
playingBackGroundColor = mainActivity.getResources().getColor(R.color.highlight_light);
|
||||
playingBackGroundColor = ContextCompat.getColor(mainActivity, R.color.highlight_light);
|
||||
}
|
||||
normalBackGroundColor = mainActivity.getResources().getColor(android.R.color.transparent);
|
||||
normalBackGroundColor = ContextCompat.getColor(mainActivity, android.R.color.transparent);
|
||||
}
|
||||
|
||||
public void setLocked(boolean locked) {
|
||||
|
@ -9,6 +9,7 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.ContextMenu;
|
||||
@ -146,8 +147,7 @@ public class ItemFragment extends Fragment {
|
||||
&& Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
|
||||
webvDescription.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
}
|
||||
webvDescription.setBackgroundColor(getResources().getColor(
|
||||
R.color.black));
|
||||
webvDescription.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.black));
|
||||
}
|
||||
webvDescription.getSettings().setUseWideViewPort(false);
|
||||
webvDescription.getSettings().setLayoutAlgorithm(
|
||||
|
Loading…
x
Reference in New Issue
Block a user