Moved playing background into attr
This commit is contained in:
parent
ca6639892d
commit
bb716ce9ea
@ -29,12 +29,12 @@ import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.DateUtils;
|
||||
import de.danoeh.antennapod.core.util.LongList;
|
||||
import de.danoeh.antennapod.core.util.NetworkUtils;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.fragment.ItemFragment;
|
||||
import de.danoeh.antennapod.menuhandler.FeedItemMenuHandler;
|
||||
|
||||
@ -67,13 +67,7 @@ public class AllEpisodesRecycleAdapter extends RecyclerView.Adapter<AllEpisodesR
|
||||
this.actionButtonCallback = actionButtonCallback;
|
||||
this.showOnlyNewEpisodes = showOnlyNewEpisodes;
|
||||
|
||||
if(UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
|
||||
playingBackGroundColor = ContextCompat.getColor(mainActivity, R.color.highlight_dark);
|
||||
} else if(UserPreferences.getTheme() == R.style.Theme_AntennaPod_TrueBlack){
|
||||
playingBackGroundColor = ContextCompat.getColor(mainActivity, R.color.highlight_trueblack);
|
||||
} else {
|
||||
playingBackGroundColor = ContextCompat.getColor(mainActivity, R.color.highlight_light);
|
||||
}
|
||||
playingBackGroundColor = ThemeUtils.getColorFromAttr(mainActivity, R.attr.currently_playing_background);
|
||||
normalBackGroundColor = ContextCompat.getColor(mainActivity, android.R.color.transparent);
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,9 @@ import android.widget.TextView;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.feed.Chapter;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.util.ChapterUtils;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
|
||||
public class ChaptersListAdapter extends ArrayAdapter<Chapter> {
|
||||
@ -143,16 +143,7 @@ public class ChaptersListAdapter extends ArrayAdapter<Chapter> {
|
||||
|
||||
Chapter current = ChapterUtils.getCurrentChapter(media);
|
||||
if (current == sc) {
|
||||
int theme = UserPreferences.getTheme();
|
||||
int highlight = R.color.highlight_light;
|
||||
if (theme == R.style.Theme_AntennaPod_Dark) {
|
||||
highlight = R.color.highlight_dark;
|
||||
}else if (theme == R.style.Theme_AntennaPod_TrueBlack){
|
||||
highlight = R.color.highlight_trueblack;
|
||||
} else if (theme == R.style.Theme_AntennaPod_Light) {
|
||||
highlight = R.color.highlight_light;
|
||||
}
|
||||
int playingBackGroundColor = ContextCompat.getColor(getContext(), highlight);
|
||||
int playingBackGroundColor = ThemeUtils.getColorFromAttr(getContext(), R.attr.currently_playing_background);
|
||||
holder.view.setBackgroundColor(playingBackGroundColor);
|
||||
} else {
|
||||
holder.view.setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent));
|
||||
|
@ -21,7 +21,6 @@ import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.feed.MediaType;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.core.util.DateUtils;
|
||||
import de.danoeh.antennapod.core.util.LongList;
|
||||
@ -60,13 +59,7 @@ public class FeedItemlistAdapter extends BaseAdapter {
|
||||
this.actionButtonUtils = new ActionButtonUtils(context);
|
||||
this.makePlayedItemsTransparent = makePlayedItemsTransparent;
|
||||
|
||||
if(UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
|
||||
playingBackGroundColor = ContextCompat.getColor(context, R.color.highlight_dark);
|
||||
} else if(UserPreferences.getTheme() == R.style.Theme_AntennaPod_TrueBlack) {
|
||||
playingBackGroundColor = ContextCompat.getColor(context, R.color.highlight_trueblack);
|
||||
} else {
|
||||
playingBackGroundColor = ContextCompat.getColor(context, R.color.highlight_light);
|
||||
}
|
||||
playingBackGroundColor = ThemeUtils.getColorFromAttr(context, R.attr.currently_playing_background);
|
||||
normalBackGroundColor = ContextCompat.getColor(context, android.R.color.transparent);
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ import android.widget.TextView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.joanzapata.iconify.Iconify;
|
||||
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
@ -75,13 +76,7 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap
|
||||
this.itemTouchHelper = itemTouchHelper;
|
||||
locked = UserPreferences.isQueueLocked();
|
||||
|
||||
if(UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
|
||||
playingBackGroundColor = ContextCompat.getColor(mainActivity, R.color.highlight_dark);
|
||||
} else if(UserPreferences.getTheme() == R.style.Theme_AntennaPod_TrueBlack) {
|
||||
playingBackGroundColor = ContextCompat.getColor(mainActivity, R.color.highlight_trueblack);
|
||||
} else {
|
||||
playingBackGroundColor = ContextCompat.getColor(mainActivity, R.color.highlight_light);
|
||||
}
|
||||
playingBackGroundColor = ThemeUtils.getColorFromAttr(mainActivity, R.attr.currently_playing_background);
|
||||
normalBackGroundColor = ContextCompat.getColor(mainActivity, android.R.color.transparent);
|
||||
}
|
||||
|
||||
|
@ -113,13 +113,13 @@ public class ItemDescriptionFragment extends Fragment implements MediaplayerInfo
|
||||
Log.d(TAG, "Creating view");
|
||||
webvDescription = new WebView(getActivity().getApplicationContext());
|
||||
webvDescription.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
|
||||
TypedArray ta = getActivity().getTheme().obtainStyledAttributes(new int[]
|
||||
{android.R.attr.colorBackground});
|
||||
int backgroundColor = ta.getColor(0,
|
||||
(UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark ||
|
||||
UserPreferences.getTheme() == R.style.Theme_AntennaPod_TrueBlack)?
|
||||
Color.BLACK : Color.WHITE
|
||||
);
|
||||
boolean black = UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark
|
||||
|| UserPreferences.getTheme() == R.style.Theme_AntennaPod_TrueBlack;
|
||||
int backgroundColor = ta.getColor(0, black ? Color.BLACK : Color.WHITE);
|
||||
|
||||
ta.recycle();
|
||||
webvDescription.setBackgroundColor(backgroundColor);
|
||||
if (!NetworkUtils.networkAvailable()) {
|
||||
|
@ -20,7 +20,7 @@ public class MenuItemUtils extends de.danoeh.antennapod.core.menuhandler.MenuIte
|
||||
public static void adjustTextColor(Context context, SearchView sv) {
|
||||
if(Build.VERSION.SDK_INT < 14) {
|
||||
EditText searchEditText = (EditText) sv.findViewById(R.id.search_src_text);
|
||||
if(UserPreferences.getTheme() == de.danoeh.antennapod.R.style.Theme_AntennaPod_Dark
|
||||
if (UserPreferences.getTheme() == de.danoeh.antennapod.R.style.Theme_AntennaPod_Dark
|
||||
|| UserPreferences.getTheme() == R.style.Theme_AntennaPod_TrueBlack) {
|
||||
searchEditText.setTextColor(Color.WHITE);
|
||||
} else {
|
||||
|
@ -1,7 +1,12 @@
|
||||
package de.danoeh.antennapod.core.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.AttrRes;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.util.Log;
|
||||
|
||||
import android.util.TypedValue;
|
||||
import de.danoeh.antennapod.core.R;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
|
||||
@ -12,7 +17,7 @@ public class ThemeUtils {
|
||||
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){
|
||||
} 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;
|
||||
@ -22,4 +27,10 @@ public class ThemeUtils {
|
||||
return R.color.selection_background_color_light;
|
||||
}
|
||||
}
|
||||
|
||||
public static @ColorInt int getColorFromAttr(Context context, @AttrRes int attr) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
context.getTheme().resolveAttribute(attr, typedValue, true);
|
||||
return typedValue.data;
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,7 @@
|
||||
<attr name="ic_cast_disconnect" format="reference"/>
|
||||
<attr name="ic_swap" format="reference"/>
|
||||
<attr name="master_switch_background" format="color"/>
|
||||
<attr name="currently_playing_background" format="color"/>
|
||||
|
||||
<!-- Used in itemdescription -->
|
||||
<attr name="non_transparent_background" format="reference"/>
|
||||
|
@ -67,6 +67,7 @@
|
||||
<item type="attr" name="ic_create_new_folder">@drawable/ic_create_new_folder_grey600_24dp</item>
|
||||
<item type="attr" name="ic_cast_disconnect">@drawable/ic_cast_disconnect_grey600_36dp</item>
|
||||
<item type="attr" name="master_switch_background">@color/master_switch_background_light</item>
|
||||
<item type="attr" name="currently_playing_background">@color/highlight_light</item>
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
</style>
|
||||
|
||||
@ -136,6 +137,7 @@
|
||||
<item type="attr" name="ic_create_new_folder">@drawable/ic_create_new_folder_white_24dp</item>
|
||||
<item type="attr" name="ic_cast_disconnect">@drawable/ic_cast_disconnect_white_36dp</item>
|
||||
<item type="attr" name="master_switch_background">@color/master_switch_background_dark</item>
|
||||
<item type="attr" name="currently_playing_background">@color/highlight_dark</item>
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
</style>
|
||||
|
||||
@ -227,6 +229,7 @@
|
||||
<item type="attr" name="ic_create_new_folder">@drawable/ic_create_new_folder_grey600_24dp</item>
|
||||
<item type="attr" name="ic_cast_disconnect">@drawable/ic_cast_disconnect_grey600_36dp</item>
|
||||
<item type="attr" name="master_switch_background">@color/master_switch_background_light</item>
|
||||
<item type="attr" name="currently_playing_background">@color/highlight_light</item>
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
</style>
|
||||
|
||||
@ -297,6 +300,7 @@
|
||||
<item type="attr" name="ic_create_new_folder">@drawable/ic_create_new_folder_white_24dp</item>
|
||||
<item type="attr" name="ic_cast_disconnect">@drawable/ic_cast_disconnect_white_36dp</item>
|
||||
<item type="attr" name="master_switch_background">@color/master_switch_background_dark</item>
|
||||
<item type="attr" name="currently_playing_background">@color/highlight_dark</item>
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
</style>
|
||||
|
||||
@ -312,6 +316,7 @@
|
||||
<item type="attr" name="dragview_background">@drawable/ic_drag_vertical_white_48dp</item>
|
||||
<item type="attr" name="dragview_float_background">@color/black</item>
|
||||
<item type="attr" name="nav_drawer_background">@color/black</item>
|
||||
<item type="attr" name="currently_playing_background">@color/highlight_trueblack</item>
|
||||
<item name="android:textColorPrimary">@color/white</item>
|
||||
<item name="android:color">@color/white</item>
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user