Merge pull request #2728 from ByteHamster/alifeflow-develop
True Black Theme for AMOLED
This commit is contained in:
commit
f933cd226b
|
@ -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,11 +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 {
|
||||
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,9 +143,7 @@ public class ChaptersListAdapter extends ArrayAdapter<Chapter> {
|
|||
|
||||
Chapter current = ChapterUtils.getCurrentChapter(media);
|
||||
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);
|
||||
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,11 +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 {
|
||||
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,11 +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 {
|
||||
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,10 +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 ? 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()) {
|
||||
|
|
|
@ -185,7 +185,8 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
|
|||
txtvTitle.setEllipsize(TextUtils.TruncateAt.END);
|
||||
}
|
||||
webvDescription = (WebView) layout.findViewById(R.id.webvDescription);
|
||||
if (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark) {
|
||||
if (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark ||
|
||||
UserPreferences.getTheme() == R.style.Theme_AntennaPod_TrueBlack) {
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
|
||||
webvDescription.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@ 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 {
|
||||
searchEditText.setTextColor(Color.BLACK);
|
||||
|
|
|
@ -161,6 +161,8 @@ public class UserPreferences {
|
|||
int theme = getTheme();
|
||||
if (theme == R.style.Theme_AntennaPod_Dark) {
|
||||
return R.style.Theme_AntennaPod_Dark_NoTitle;
|
||||
} else if (theme == R.style.Theme_AntennaPod_TrueBlack) {
|
||||
return R.style.Theme_AntennaPod_TrueBlack_NoTitle;
|
||||
} else {
|
||||
return R.style.Theme_AntennaPod_Light_NoTitle;
|
||||
}
|
||||
|
@ -597,6 +599,8 @@ public class UserPreferences {
|
|||
return R.style.Theme_AntennaPod_Light;
|
||||
case 1:
|
||||
return R.style.Theme_AntennaPod_Dark;
|
||||
case 2:
|
||||
return R.style.Theme_AntennaPod_TrueBlack;
|
||||
default:
|
||||
return R.style.Theme_AntennaPod_Light;
|
||||
}
|
||||
|
|
|
@ -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,6 +17,8 @@ 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){
|
||||
return R.color.selection_background_color_trueblack;
|
||||
} else if (theme == R.style.Theme_AntennaPod_Light) {
|
||||
return R.color.selection_background_color_light;
|
||||
} else {
|
||||
|
@ -20,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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<solid android:color="#000000"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<solid android:color="@color/holo_blue_dark"/>
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
|
@ -6,6 +6,19 @@
|
|||
<style name="Theme.AntennaPod.Dark" parent="Theme.Base.AntennaPod.Dark">
|
||||
<item name="android:windowContentTransitions">true</item>
|
||||
</style>
|
||||
<style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack">
|
||||
<item name="android:windowContentTransitions">true</item>
|
||||
<item name="android:navigationBarColor">@color/black</item>
|
||||
<item name="android:colorAccent">@color/white</item>
|
||||
<item name="android:colorPrimary">@color/black</item>
|
||||
<item name="android:colorPrimaryDark">@color/black</item>
|
||||
</style>
|
||||
<style name="Theme.AntennaPod.TrueBlack.NoTitle" parent="Theme.Base.AntennaPod.TrueBlack.NoTitle">
|
||||
<item name="android:navigationBarColor">@color/black</item>
|
||||
<item name="android:colorAccent">@color/white</item>
|
||||
<item name="android:colorPrimary">@color/black</item>
|
||||
<item name="android:colorPrimaryDark">@color/black</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.AntennaPod.Button" parent="Widget.AppCompat.Button">
|
||||
<item name="textAllCaps">true</item>
|
||||
|
|
|
@ -137,10 +137,12 @@
|
|||
<string-array name="theme_options">
|
||||
<item>@string/pref_theme_title_light</item>
|
||||
<item>@string/pref_theme_title_dark</item>
|
||||
<item>@string/pref_theme_title_trueblack</item>
|
||||
</string-array>
|
||||
<string-array name="theme_values">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="nav_drawer_titles">
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<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>
|
||||
|
||||
|
@ -30,6 +31,7 @@
|
|||
|
||||
<color name="highlight_light">#DDDDDD</color>
|
||||
<color name="highlight_dark">#414141</color>
|
||||
<color name="highlight_trueblack">#000000</color>
|
||||
|
||||
<color name="antennapod_blue">#147BAF</color>
|
||||
|
||||
|
|
|
@ -395,6 +395,7 @@
|
|||
<string name="pref_episode_cache_title">Episode Cache</string>
|
||||
<string name="pref_theme_title_light">Light</string>
|
||||
<string name="pref_theme_title_dark">Dark</string>
|
||||
<string name="pref_theme_title_trueblack">True Black</string>
|
||||
<string name="pref_episode_cache_unlimited">Unlimited</string>
|
||||
<string name="pref_update_interval_hours_plural">hours</string>
|
||||
<string name="pref_update_interval_hours_singular">hour</string>
|
||||
|
|
|
@ -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,9 +137,31 @@
|
|||
<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>
|
||||
|
||||
<style name="Theme.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.TrueBlack">
|
||||
<!-- Room for API dependent attributes -->
|
||||
</style>
|
||||
|
||||
<style name="Theme.Base.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.Dark">
|
||||
<item name="progressBarTheme">@style/ProgressBarTrueBlack</item>
|
||||
<item type="attr" name="non_transparent_background">@color/black</item>
|
||||
<item type="attr" name="overlay_background">@color/overlay_dark</item>
|
||||
<item type="attr" name="overlay_drawable">@drawable/overlay_drawable_dark</item>
|
||||
<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 name="android:textColorPrimary">@color/white</item>
|
||||
<item name="android:color">@color/white</item>
|
||||
<item name="android:windowBackground">@color/black</item>
|
||||
<item name="android:actionBarStyle">@color/black</item>
|
||||
<item name="colorPrimary">@color/black</item>
|
||||
<item name="colorPrimaryDark">@color/black</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="Theme.AntennaPod.Light.NoTitle" parent="Theme.Base.AntennaPod.Light.NoTitle">
|
||||
<!-- Room for API dependent attributes -->
|
||||
</style>
|
||||
|
@ -206,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>
|
||||
|
||||
|
@ -276,9 +300,32 @@
|
|||
<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>
|
||||
|
||||
<style name="Theme.AntennaPod.TrueBlack.NoTitle" parent="Theme.Base.AntennaPod.TrueBlack.NoTitle">
|
||||
<!-- Room for API dependent attributes -->
|
||||
</style>
|
||||
|
||||
<style name="Theme.Base.AntennaPod.TrueBlack.NoTitle" parent="Theme.Base.AntennaPod.Dark.NoTitle">
|
||||
<item name="progressBarTheme">@style/ProgressBarTrueBlack</item>
|
||||
<item type="attr" name="non_transparent_background">@color/black</item>
|
||||
<item type="attr" name="overlay_background">@color/black</item>
|
||||
<item type="attr" name="overlay_drawable">@drawable/overlay_drawable_dark</item>
|
||||
<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>
|
||||
<item name="android:actionBarStyle">@color/black</item>
|
||||
<item name="colorPrimary">@color/black</item>
|
||||
<item name="colorPrimaryDark">@color/black</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="Theme.AntennaPod.Dark.Splash" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="android:windowBackground">@drawable/bg_splash</item>
|
||||
</style>
|
||||
|
@ -366,4 +413,9 @@
|
|||
<item name="android:progressDrawable">@drawable/progress_bar_horizontal_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="ProgressBarTrueBlack">
|
||||
<item name="android:indeterminateOnly">false</item>
|
||||
<item name="android:progressDrawable">@drawable/progress_bar_horizontal_trueblack</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue