mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-02-05 13:08:12 +01:00
Changed implementation using themeUtils instead
This commit is contained in:
parent
ecff66eff6
commit
7da762b8ea
@ -34,6 +34,7 @@ import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.util.ThemeUtils;
|
||||
import de.danoeh.antennapod.fragment.AddFeedFragment;
|
||||
import de.danoeh.antennapod.fragment.AllEpisodesFragment;
|
||||
import de.danoeh.antennapod.fragment.DownloadsFragment;
|
||||
@ -216,8 +217,10 @@ public class NavListAdapter extends BaseAdapter
|
||||
TextView txtvTitle = v.findViewById(R.id.txtvTitle);
|
||||
if (position == itemAccess.getSelectedItemIndex()) {
|
||||
txtvTitle.setTypeface(null, Typeface.BOLD);
|
||||
v.setBackgroundResource(ThemeUtils.getSelectionDrawerActivatedColor());
|
||||
} else {
|
||||
txtvTitle.setTypeface(null, Typeface.NORMAL);
|
||||
v.setBackgroundResource(ThemeUtils.getSelectionDrawerNotActivatedColor());
|
||||
}
|
||||
}
|
||||
return v;
|
||||
|
@ -5,8 +5,7 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/listitem_iconwithtext_height"
|
||||
tools:background="@android:color/darker_gray"
|
||||
android:background= "?attr/nav_drawer_list_selector">
|
||||
tools:background="@android:color/darker_gray">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgvCover"
|
||||
|
@ -5,8 +5,7 @@
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/listitem_iconwithtext_height"
|
||||
tools:background="@android:color/darker_gray"
|
||||
android:background= "?attr/nav_drawer_list_selector">
|
||||
tools:background="@android:color/darker_gray">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imgvCover"
|
||||
|
@ -29,6 +29,38 @@ public class ThemeUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static int getSelectionDrawerActivatedColor() {
|
||||
int theme = UserPreferences.getTheme();
|
||||
if (theme == R.style.Theme_AntennaPod_Dark) {
|
||||
return R.color.overlay_dark;
|
||||
} else if (theme == R.style.Theme_AntennaPod_TrueBlack){
|
||||
return R.color.highlight_trueblack;
|
||||
} else if (theme == R.style.Theme_AntennaPod_Light) {
|
||||
return R.color.highlight_light;
|
||||
} else {
|
||||
Log.e(TAG,
|
||||
"getSelectionBackgroundColor could not match the current theme to any color!");
|
||||
return R.color.highlight_light;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int getSelectionDrawerNotActivatedColor() {
|
||||
int theme = UserPreferences.getTheme();
|
||||
if (theme == R.style.Theme_AntennaPod_Dark) {
|
||||
return R.color.darktheme_drawer;
|
||||
} else if (theme == R.style.Theme_AntennaPod_TrueBlack){
|
||||
return R.color.black;
|
||||
} else if (theme == R.style.Theme_AntennaPod_Light) {
|
||||
return R.color.primary_light;
|
||||
} else {
|
||||
Log.e(TAG,
|
||||
"getSelectionBackgroundColor could not match the current theme to any color!");
|
||||
return R.color.highlight_light;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static @ColorInt int getColorFromAttr(Context context, @AttrRes int attr) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
context.getTheme().resolveAttribute(attr, typedValue, true);
|
||||
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/overlay_dark"/>
|
||||
</shape>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/highlight_light"/>
|
||||
</shape>
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/highlight_trueblack"/>
|
||||
</shape>
|
@ -1,4 +0,0 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_activated="true" android:drawable="@drawable/activated_color_dark" />
|
||||
<item android:drawable="@android:color/transparent" />
|
||||
</selector>
|
@ -1,4 +0,0 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_activated="true" android:drawable="@drawable/activated_color_light" />
|
||||
<item android:drawable="@android:color/transparent" />
|
||||
</selector>
|
@ -1,4 +0,0 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_activated="true" android:drawable="@drawable/activated_color_trueblack" />
|
||||
<item android:drawable="@android:color/transparent" />
|
||||
</selector>
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<attr name="nav_drawer_list_selector" format="reference"/>
|
||||
<attr name="action_bar_icon_color" format="reference"/>
|
||||
<attr name="action_about" format="reference"/>
|
||||
<attr name="action_search" format="reference"/>
|
||||
|
@ -29,6 +29,7 @@
|
||||
<!-- Theme colors -->
|
||||
<color name="primary_light">#FFFFFF</color>
|
||||
<color name="primary_darktheme">#212121</color>
|
||||
<color name="darktheme_drawer">#3B3B3B</color>
|
||||
|
||||
<color name="highlight_light">#DDDDDD</color>
|
||||
<color name="highlight_dark">#414141</color>
|
||||
|
@ -11,7 +11,6 @@
|
||||
<item name="progressBarTheme">@style/ProgressBarLight</item>
|
||||
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
||||
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Light</item>
|
||||
<item type="attr" name="nav_drawer_list_selector">@drawable/drawer_list_selector_light</item>
|
||||
<item type="attr" name="action_bar_icon_color">@color/grey600</item>
|
||||
<item type="attr" name="storage">@drawable/ic_sd_grey600_24dp</item>
|
||||
<item type="attr" name="ic_swap">@drawable/ic_swap_vertical_grey600_24dp</item>
|
||||
@ -95,7 +94,6 @@
|
||||
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
||||
<item name="progressBarTheme">@style/ProgressBarDark</item>
|
||||
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Dark</item>
|
||||
<item type="attr" name="nav_drawer_list_selector">@drawable/drawer_list_selector_dark</item>
|
||||
<item type="attr" name="action_bar_icon_color">@color/white</item>
|
||||
<item type="attr" name="storage">@drawable/ic_sd_white_24dp</item>
|
||||
<item type="attr" name="ic_swap">@drawable/ic_swap_vertical_white_24dp</item>
|
||||
@ -171,7 +169,6 @@
|
||||
|
||||
<style name="Theme.Base.AntennaPod.TrueBlack" parent="Theme.Base.AntennaPod.Dark">
|
||||
<item name="progressBarTheme">@style/ProgressBarTrueBlack</item>
|
||||
<item type="attr" name="nav_drawer_list_selector">@drawable/drawer_list_selector_trueblack</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_trueblack</item>
|
||||
@ -200,7 +197,6 @@
|
||||
<item name="colorAccent">@color/holo_blue_light</item>
|
||||
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
||||
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Light</item>
|
||||
<item type="attr" name="nav_drawer_list_selector">@drawable/drawer_list_selector_light</item>
|
||||
<item type="attr" name="storage">@drawable/ic_sd_grey600_24dp</item>
|
||||
<item type="attr" name="ic_swap">@drawable/ic_swap_vertical_grey600_24dp</item>
|
||||
<item type="attr" name="statistics">@drawable/ic_poll_box_grey600_24dp</item>
|
||||
@ -283,7 +279,6 @@
|
||||
<item name="colorControlNormal">@color/white</item>
|
||||
<item name="buttonStyle">@style/Widget.AntennaPod.Button</item>
|
||||
<item name="alertDialogTheme">@style/AntennaPod.Dialog.Dark</item>
|
||||
<item type="attr" name="nav_drawer_list_selector">@drawable/drawer_list_selector_dark</item>
|
||||
<item type="attr" name="storage">@drawable/ic_sd_white_24dp</item>
|
||||
<item type="attr" name="ic_swap">@drawable/ic_swap_vertical_white_24dp</item>
|
||||
<item type="attr" name="statistics">@drawable/ic_poll_box_white_24dp</item>
|
||||
@ -358,7 +353,6 @@
|
||||
|
||||
<style name="Theme.Base.AntennaPod.TrueBlack.NoTitle" parent="Theme.Base.AntennaPod.Dark.NoTitle">
|
||||
<item name="progressBarTheme">@style/ProgressBarTrueBlack</item>
|
||||
<item type="attr" name="nav_drawer_list_selector">@drawable/drawer_list_selector_trueblack</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_trueblack</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user