Fix Dark elements in Light Theme
This commit is contained in:
parent
1d51002173
commit
fd14c8cdce
288 changed files with 327 additions and 560 deletions
|
|
@ -40,7 +40,6 @@ import org.schabi.newpipe.util.KoreUtil;
|
|||
import org.schabi.newpipe.util.NavigationHelper;
|
||||
import org.schabi.newpipe.util.OnClickGesture;
|
||||
import org.schabi.newpipe.util.StreamDialogEntry;
|
||||
import org.schabi.newpipe.util.ThemeHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
|
@ -312,14 +311,13 @@ public class StatisticsPlaylistFragment
|
|||
if (sortMode == StatisticSortMode.LAST_PLAYED) {
|
||||
sortMode = StatisticSortMode.MOST_PLAYED;
|
||||
setTitle(getString(R.string.title_most_played));
|
||||
headerBinding.sortButtonIcon.setImageResource(
|
||||
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_history));
|
||||
headerBinding.sortButtonIcon.setImageResource(R.drawable.ic_history);
|
||||
headerBinding.sortButtonText.setText(R.string.title_last_played);
|
||||
} else {
|
||||
sortMode = StatisticSortMode.LAST_PLAYED;
|
||||
setTitle(getString(R.string.title_last_played));
|
||||
headerBinding.sortButtonIcon.setImageResource(
|
||||
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_filter_list));
|
||||
R.drawable.ic_filter_list);
|
||||
headerBinding.sortButtonText.setText(R.string.title_most_played);
|
||||
}
|
||||
startLoading(true);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package org.schabi.newpipe.local.subscription
|
||||
|
||||
import android.content.Context
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.annotation.DrawableRes
|
||||
import org.schabi.newpipe.R
|
||||
import org.schabi.newpipe.util.ThemeHelper
|
||||
|
||||
enum class FeedGroupIcon(
|
||||
/**
|
||||
|
|
@ -13,51 +10,51 @@ enum class FeedGroupIcon(
|
|||
val id: Int,
|
||||
|
||||
/**
|
||||
* The attribute that points to a drawable resource. "R.attr" is used here to support multiple themes.
|
||||
* The drawable resource.
|
||||
*/
|
||||
@AttrRes val drawableResourceAttr: Int
|
||||
@DrawableRes val drawableResource: Int
|
||||
) {
|
||||
ALL(0, R.attr.ic_asterisk),
|
||||
MUSIC(1, R.attr.ic_music_note),
|
||||
EDUCATION(2, R.attr.ic_school),
|
||||
FITNESS(3, R.attr.ic_fitness_center),
|
||||
SPACE(4, R.attr.ic_telescope),
|
||||
COMPUTER(5, R.attr.ic_computer),
|
||||
GAMING(6, R.attr.ic_videogame_asset),
|
||||
SPORTS(7, R.attr.ic_sports),
|
||||
NEWS(8, R.attr.ic_megaphone),
|
||||
FAVORITES(9, R.attr.ic_heart),
|
||||
CAR(10, R.attr.ic_car),
|
||||
MOTORCYCLE(11, R.attr.ic_motorcycle),
|
||||
TREND(12, R.attr.ic_trending_up),
|
||||
MOVIE(13, R.attr.ic_movie),
|
||||
BACKUP(14, R.attr.ic_backup),
|
||||
ART(15, R.attr.ic_palette),
|
||||
PERSON(16, R.attr.ic_person),
|
||||
PEOPLE(17, R.attr.ic_people),
|
||||
MONEY(18, R.attr.ic_money),
|
||||
KIDS(19, R.attr.ic_child_care),
|
||||
FOOD(20, R.attr.ic_fastfood),
|
||||
SMILE(21, R.attr.ic_smile),
|
||||
EXPLORE(22, R.attr.ic_explore),
|
||||
RESTAURANT(23, R.attr.ic_restaurant),
|
||||
MIC(24, R.attr.ic_mic),
|
||||
HEADSET(25, R.attr.ic_headset),
|
||||
RADIO(26, R.attr.ic_radio),
|
||||
SHOPPING_CART(27, R.attr.ic_shopping_cart),
|
||||
WATCH_LATER(28, R.attr.ic_watch_later),
|
||||
WORK(29, R.attr.ic_work),
|
||||
HOT(30, R.attr.ic_kiosk_hot),
|
||||
CHANNEL(31, R.attr.ic_channel),
|
||||
BOOKMARK(32, R.attr.ic_bookmark),
|
||||
PETS(33, R.attr.ic_pets),
|
||||
WORLD(34, R.attr.ic_world),
|
||||
STAR(35, R.attr.ic_stars),
|
||||
SUN(36, R.attr.ic_sunny),
|
||||
RSS(37, R.attr.ic_rss);
|
||||
ALL(0, R.drawable.ic_asterisk),
|
||||
MUSIC(1, R.drawable.ic_music_note),
|
||||
EDUCATION(2, R.drawable.ic_school),
|
||||
FITNESS(3, R.drawable.ic_fitness_center),
|
||||
SPACE(4, R.drawable.ic_telescope),
|
||||
COMPUTER(5, R.drawable.ic_computer),
|
||||
GAMING(6, R.drawable.ic_videogame_asset),
|
||||
SPORTS(7, R.drawable.ic_directions_bike),
|
||||
NEWS(8, R.drawable.ic_megaphone),
|
||||
FAVORITES(9, R.drawable.ic_favorite),
|
||||
CAR(10, R.drawable.ic_directions_car),
|
||||
MOTORCYCLE(11, R.drawable.ic_motorcycle),
|
||||
TREND(12, R.drawable.ic_trending_up),
|
||||
MOVIE(13, R.drawable.ic_movie),
|
||||
BACKUP(14, R.drawable.ic_backup),
|
||||
ART(15, R.drawable.ic_palette),
|
||||
PERSON(16, R.drawable.ic_person),
|
||||
PEOPLE(17, R.drawable.ic_people),
|
||||
MONEY(18, R.drawable.ic_attach_money),
|
||||
KIDS(19, R.drawable.ic_child_care),
|
||||
FOOD(20, R.drawable.ic_fastfood),
|
||||
SMILE(21, R.drawable.ic_insert_emoticon),
|
||||
EXPLORE(22, R.drawable.ic_explore),
|
||||
RESTAURANT(23, R.drawable.ic_restaurant),
|
||||
MIC(24, R.drawable.ic_mic),
|
||||
HEADSET(25, R.drawable.ic_headset),
|
||||
RADIO(26, R.drawable.ic_radio),
|
||||
SHOPPING_CART(27, R.drawable.ic_shopping_cart),
|
||||
WATCH_LATER(28, R.drawable.ic_watch_later),
|
||||
WORK(29, R.drawable.ic_work),
|
||||
HOT(30, R.drawable.ic_whatshot),
|
||||
CHANNEL(31, R.drawable.ic_tv),
|
||||
BOOKMARK(32, R.drawable.ic_bookmark),
|
||||
PETS(33, R.drawable.ic_pets),
|
||||
WORLD(34, R.drawable.ic_public),
|
||||
STAR(35, R.drawable.ic_stars),
|
||||
SUN(36, R.drawable.ic_wb_sunny),
|
||||
RSS(37, R.drawable.ic_rss_feed);
|
||||
|
||||
@DrawableRes
|
||||
fun getDrawableRes(context: Context): Int {
|
||||
return ThemeHelper.resolveResourceIdFromAttr(context, drawableResourceAttr)
|
||||
fun getDrawableRes(): Int {
|
||||
return drawableResource
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ import org.schabi.newpipe.util.FilePickerActivityHelper
|
|||
import org.schabi.newpipe.util.NavigationHelper
|
||||
import org.schabi.newpipe.util.OnClickGesture
|
||||
import org.schabi.newpipe.util.ShareUtils
|
||||
import org.schabi.newpipe.util.ThemeHelper
|
||||
import java.io.File
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
|
@ -257,7 +256,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
|
|||
feedGroupsCarousel = FeedGroupCarouselItem(requireContext(), carouselAdapter)
|
||||
feedGroupsSortMenuItem = HeaderWithMenuItem(
|
||||
getString(R.string.feed_groups_header_title),
|
||||
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_sort),
|
||||
R.drawable.ic_sort,
|
||||
menuItemOnClickListener = ::openReorderDialog
|
||||
)
|
||||
add(Section(feedGroupsSortMenuItem, listOf(feedGroupsCarousel)))
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
|
|||
groupSortOrder = feedGroupEntity?.sortOrder ?: -1
|
||||
|
||||
val feedGroupIcon = if (selectedIcon == null) icon else selectedIcon!!
|
||||
feedGroupCreateBinding.iconPreview.setImageResource(feedGroupIcon.getDrawableRes(requireContext()))
|
||||
feedGroupCreateBinding.iconPreview.setImageResource(feedGroupIcon.getDrawableRes())
|
||||
|
||||
if (feedGroupCreateBinding.groupNameInput.text.isNullOrBlank()) {
|
||||
feedGroupCreateBinding.groupNameInput.setText(name)
|
||||
|
|
@ -404,7 +404,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
|
|||
|
||||
if (groupId == NO_GROUP_SELECTED) {
|
||||
val icon = selectedIcon ?: FeedGroupIcon.ALL
|
||||
feedGroupCreateBinding.iconPreview.setImageResource(icon.getDrawableRes(requireContext()))
|
||||
feedGroupCreateBinding.iconPreview.setImageResource(icon.getDrawableRes())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ data class FeedGroupCardItem(
|
|||
|
||||
override fun bind(viewBinding: FeedGroupCardItemBinding, position: Int) {
|
||||
viewBinding.title.text = name
|
||||
viewBinding.icon.setImageResource(icon.getDrawableRes(viewBinding.root.context))
|
||||
viewBinding.icon.setImageResource(icon.getDrawableRes())
|
||||
}
|
||||
|
||||
override fun initializeViewBinding(view: View) = FeedGroupCardItemBinding.bind(view)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ data class FeedGroupReorderItem(
|
|||
|
||||
override fun bind(viewBinding: FeedGroupReorderItemBinding, position: Int) {
|
||||
viewBinding.groupName.text = name
|
||||
viewBinding.groupIcon.setImageResource(icon.getDrawableRes(viewBinding.root.context))
|
||||
viewBinding.groupIcon.setImageResource(icon.getDrawableRes())
|
||||
}
|
||||
|
||||
override fun bind(viewHolder: GroupieViewHolder<FeedGroupReorderItemBinding>, position: Int, payloads: MutableList<Any>) {
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class FeedImportExportItem(
|
|||
private fun setupImportFromItems(listHolder: ViewGroup) {
|
||||
val previousBackupItem = addItemView(
|
||||
listHolder.context.getString(R.string.previous_export),
|
||||
ThemeHelper.resolveResourceIdFromAttr(listHolder.context, R.attr.ic_backup), listHolder
|
||||
R.drawable.ic_backup, listHolder
|
||||
)
|
||||
previousBackupItem.setOnClickListener { onImportPreviousSelected() }
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ class FeedImportExportItem(
|
|||
private fun setupExportToItems(listHolder: ViewGroup) {
|
||||
val previousBackupItem = addItemView(
|
||||
listHolder.context.getString(R.string.file),
|
||||
ThemeHelper.resolveResourceIdFromAttr(listHolder.context, R.attr.ic_save),
|
||||
R.drawable.ic_save,
|
||||
listHolder
|
||||
)
|
||||
previousBackupItem.setOnClickListener { onExportSelected() }
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class PickerIconItem(
|
|||
val icon: FeedGroupIcon
|
||||
) : BindableItem<PickerIconItemBinding>() {
|
||||
@DrawableRes
|
||||
val iconRes: Int = icon.getDrawableRes(context)
|
||||
val iconRes: Int = icon.getDrawableRes()
|
||||
|
||||
override fun getLayout(): Int = R.layout.picker_icon_item
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue