Fix Dark elements in Light Theme

This commit is contained in:
krlvm 2021-03-27 17:45:49 +03:00
parent 1d51002173
commit fd14c8cdce
No known key found for this signature in database
GPG Key ID: B8552A91FD265536
288 changed files with 327 additions and 560 deletions

View File

@ -6,50 +6,50 @@
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.VideoAudioSettingsFragment"
android:icon="?attr/ic_headset"
android:icon="@drawable/ic_headset"
android:title="@string/settings_category_video_audio_title"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.DownloadSettingsFragment"
android:icon="?attr/ic_file_download"
android:icon="@drawable/ic_file_download"
android:title="@string/settings_category_downloads_title"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.AppearanceSettingsFragment"
android:icon="?attr/ic_palette"
android:icon="@drawable/ic_palette"
android:title="@string/settings_category_appearance_title"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.HistorySettingsFragment"
android:icon="?attr/ic_history"
android:icon="@drawable/ic_history"
android:title="@string/settings_category_history_title"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.ContentSettingsFragment"
android:icon="?attr/ic_language"
android:icon="@drawable/ic_language"
android:title="@string/content"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.NotificationSettingsFragment"
android:icon="?attr/ic_play_arrow"
android:icon="@drawable/ic_play_arrow"
android:title="@string/settings_category_notification_title"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.UpdateSettingsFragment"
android:icon="?attr/ic_settings_update"
android:icon="@drawable/ic_cloud_download"
android:key="update_pref_screen_key"
android:title="@string/settings_category_updates_title"
app:iconSpaceReserved="false" />
<PreferenceScreen
android:fragment="org.schabi.newpipe.settings.DebugSettingsFragment"
android:icon="?attr/ic_bug_report"
android:icon="@drawable/ic_bug_report"
android:key="@string/debug_pref_screen_key"
android:title="@string/settings_category_debug_title"
app:iconSpaceReserved="false" />

View File

@ -182,27 +182,27 @@ public class MainActivity extends AppCompatActivity {
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_SUBSCRIPTIONS, ORDER,
R.string.tab_subscriptions)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_channel));
.setIcon(R.drawable.ic_tv);
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_FEED, ORDER, R.string.fragment_feed_title)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_rss));
.setIcon(R.drawable.ic_rss_feed);
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_BOOKMARKS, ORDER, R.string.tab_bookmarks)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_bookmark));
.setIcon(R.drawable.ic_bookmark);
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_DOWNLOADS, ORDER, R.string.downloads)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_file_download));
.setIcon(R.drawable.ic_file_download);
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_HISTORY, ORDER, R.string.action_history)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_history));
.setIcon(R.drawable.ic_history);
//Settings and About
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_options_about_group, ITEM_ID_SETTINGS, ORDER, R.string.settings)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_settings));
.setIcon(R.drawable.ic_settings);
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_options_about_group, ITEM_ID_ABOUT, ORDER, R.string.tab_about)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_info_outline));
.setIcon(R.drawable.ic_info_outline);
toggle = new ActionBarDrawerToggle(this, mainBinding.getRoot(),
toolbarLayoutBinding.toolbar, R.string.drawer_open, R.string.drawer_close);
@ -348,7 +348,7 @@ public class MainActivity extends AppCompatActivity {
}
private void showServices() {
drawerHeaderBinding.drawerArrow.setImageResource(R.drawable.ic_arrow_drop_up_white_24dp);
drawerHeaderBinding.drawerArrow.setImageResource(R.drawable.ic_arrow_drop_up);
for (final StreamingService s : NewPipe.getServices()) {
final String title = s.getServiceInfo().getName()
@ -414,7 +414,7 @@ public class MainActivity extends AppCompatActivity {
}
private void showTabs() throws ExtractionException {
drawerHeaderBinding.drawerArrow.setImageResource(R.drawable.ic_arrow_drop_down_white_24dp);
drawerHeaderBinding.drawerArrow.setImageResource(R.drawable.ic_arrow_drop_down);
//Tabs
final int currentServiceId = ServiceHelper.getSelectedServiceId(this);
@ -432,27 +432,27 @@ public class MainActivity extends AppCompatActivity {
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_SUBSCRIPTIONS, ORDER, R.string.tab_subscriptions)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_channel));
.setIcon(R.drawable.ic_tv);
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_FEED, ORDER, R.string.fragment_feed_title)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_rss));
.setIcon(R.drawable.ic_rss_feed);
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_BOOKMARKS, ORDER, R.string.tab_bookmarks)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_bookmark));
.setIcon(R.drawable.ic_bookmark);
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_DOWNLOADS, ORDER, R.string.downloads)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_file_download));
.setIcon(R.drawable.ic_file_download);
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_HISTORY, ORDER, R.string.action_history)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_history));
.setIcon(R.drawable.ic_history);
//Settings and About
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_options_about_group, ITEM_ID_SETTINGS, ORDER, R.string.settings)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_settings));
.setIcon(R.drawable.ic_settings);
drawerLayoutBinding.navigation.getMenu()
.add(R.id.menu_options_about_group, ITEM_ID_ABOUT, ORDER, R.string.tab_about)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_info_outline));
.setIcon(R.drawable.ic_info_outline);
}
@Override

View File

@ -91,7 +91,6 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.AUDIO;
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.VIDEO;
import static org.schabi.newpipe.util.ThemeHelper.resolveResourceIdFromAttr;
/**
* Get the url from the intent and open it in the chosen preferred player.
@ -231,7 +230,7 @@ public class RouterActivity extends AppCompatActivity {
new AlertDialog.Builder(context)
.setTitle(R.string.unsupported_url)
.setMessage(R.string.unsupported_url_dialog_message)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_share))
.setIcon(R.drawable.ic_share)
.setPositiveButton(R.string.open_in_browser,
(dialog, which) -> ShareUtils.openUrlInBrowser(this, url))
.setNegativeButton(R.string.share,
@ -427,16 +426,16 @@ public class RouterActivity extends AppCompatActivity {
final AdapterChoiceItem videoPlayer = new AdapterChoiceItem(
getString(R.string.video_player_key), getString(R.string.video_player),
resolveResourceIdFromAttr(context, R.attr.ic_play_arrow));
R.drawable.ic_play_arrow);
final AdapterChoiceItem showInfo = new AdapterChoiceItem(
getString(R.string.show_info_key), getString(R.string.show_info),
resolveResourceIdFromAttr(context, R.attr.ic_info_outline));
R.drawable.ic_info_outline);
final AdapterChoiceItem popupPlayer = new AdapterChoiceItem(
getString(R.string.popup_player_key), getString(R.string.popup_player),
resolveResourceIdFromAttr(context, R.attr.ic_popup));
R.drawable.ic_picture_in_picture);
final AdapterChoiceItem backgroundPlayer = new AdapterChoiceItem(
getString(R.string.background_player_key), getString(R.string.background_player),
resolveResourceIdFromAttr(context, R.attr.ic_headset));
R.drawable.ic_headset);
if (linkType == LinkType.STREAM) {
if (isExtVideoEnabled) {
@ -481,7 +480,7 @@ public class RouterActivity extends AppCompatActivity {
returnList.add(new AdapterChoiceItem(getString(R.string.download_key),
getString(R.string.download),
resolveResourceIdFromAttr(context, R.attr.ic_file_download)));
R.drawable.ic_file_download));
return returnList;
}

View File

@ -394,8 +394,7 @@ public class DownloadDialog extends DialogFragment
}
toolbar.setTitle(R.string.download_dialog_title);
toolbar.setNavigationIcon(
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_arrow_back));
toolbar.setNavigationIcon(R.drawable.ic_arrow_back);
toolbar.inflateMenu(R.menu.dialog_url);
toolbar.setNavigationOnClickListener(v -> requireDialog().dismiss());
toolbar.setNavigationContentDescription(R.string.cancel);

View File

@ -1,7 +1,6 @@
package org.schabi.newpipe.fragments;
import android.content.Context;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
@ -30,7 +29,6 @@ import org.schabi.newpipe.settings.tabs.Tab;
import org.schabi.newpipe.settings.tabs.TabsManager;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.ServiceHelper;
import org.schabi.newpipe.util.ThemeHelper;
import java.util.ArrayList;
import java.util.List;
@ -87,8 +85,6 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
binding = FragmentMainBinding.bind(rootView);
binding.mainTabLayout.setTabIconTint(ColorStateList.valueOf(
ThemeHelper.resolveColorFromAttr(requireContext(), R.attr.colorAccent)));
binding.mainTabLayout.setupWithViewPager(binding.pager);
binding.mainTabLayout.addOnTabSelectedListener(this);

View File

@ -923,21 +923,21 @@ public final class VideoDetailFragment
if (shouldShowComments()) {
pageAdapter.addFragment(
CommentsFragment.getInstance(serviceId, url, title), COMMENTS_TAB_TAG);
tabIcons.add(R.drawable.ic_comment_white_24dp);
tabIcons.add(R.drawable.ic_comment);
tabContentDescriptions.add(R.string.comments_tab_description);
}
if (showRelatedStreams && binding.relatedStreamsLayout == null) {
// temp empty fragment. will be updated in handleResult
pageAdapter.addFragment(new EmptyFragment(false), RELATED_TAB_TAG);
tabIcons.add(R.drawable.ic_art_track_white_24dp);
tabIcons.add(R.drawable.ic_art_track);
tabContentDescriptions.add(R.string.related_streams_tab_description);
}
if (showDescription) {
// temp empty fragment. will be updated in handleResult
pageAdapter.addFragment(new EmptyFragment(false), DESCRIPTION_TAB_TAG);
tabIcons.add(R.drawable.ic_description_white_24dp);
tabIcons.add(R.drawable.ic_description);
tabContentDescriptions.add(R.string.description_tab_description);
}
@ -2274,11 +2274,10 @@ public final class VideoDetailFragment
}
private void setOverlayPlayPauseImage(final boolean playerIsPlaying) {
final int attr = playerIsPlaying
? R.attr.ic_pause
: R.attr.ic_play_arrow;
binding.overlayPlayPauseButton.setImageResource(
ThemeHelper.resolveResourceIdFromAttr(activity, attr));
final int drawable = playerIsPlaying
? R.drawable.ic_pause
: R.drawable.ic_play_arrow;
binding.overlayPlayPauseButton.setImageResource(drawable);
}
private void setOverlayLook(final AppBarLayout appBar,

View File

@ -61,7 +61,6 @@ import io.reactivex.rxjava3.disposables.Disposable;
import static org.schabi.newpipe.ktx.ViewUtils.animate;
import static org.schabi.newpipe.ktx.ViewUtils.animateHideRecyclerViewAllowingScrolling;
import static org.schabi.newpipe.util.ThemeHelper.resolveResourceIdFromAttr;
public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
private CompositeDisposable disposables;
@ -307,7 +306,7 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
getResources().getColor(R.color.transparent_background_color));
headerBinding.uploaderAvatarView.setImageDrawable(
AppCompatResources.getDrawable(requireContext(),
resolveResourceIdFromAttr(requireContext(), R.attr.ic_radio))
R.drawable.ic_radio)
);
} else {
IMAGE_LOADER.displayImage(avatarUrl, headerBinding.uploaderAvatarView,
@ -459,13 +458,13 @@ public class PlaylistFragment extends BaseListInfoFragment<PlaylistInfo> {
return;
}
final int iconAttr = playlistEntity == null
? R.attr.ic_playlist_add : R.attr.ic_playlist_check;
final int drawable = playlistEntity == null
? R.drawable.ic_playlist_add : R.drawable.ic_playlist_add_check;
final int titleRes = playlistEntity == null
? R.string.bookmark_playlist : R.string.unbookmark_playlist;
playlistBookmarkButton.setIcon(resolveResourceIdFromAttr(activity, iconAttr));
playlistBookmarkButton.setIcon(drawable);
playlistBookmarkButton.setTitle(titleRes);
}
}

View File

@ -117,8 +117,8 @@ public class SuggestionListAdapter
queryView = rootView.findViewById(R.id.suggestion_search);
insertView = rootView.findViewById(R.id.suggestion_insert);
historyResId = resolveResourceIdFromAttr(rootView.getContext(), R.attr.ic_history);
searchResId = resolveResourceIdFromAttr(rootView.getContext(), R.attr.ic_search);
historyResId = R.drawable.ic_history;
searchResId = R.drawable.ic_search;
}
private static int resolveResourceIdFromAttr(final Context context,

View File

@ -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);

View File

@ -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
}
}

View File

@ -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)))

View File

@ -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())
}
}

View File

@ -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)

View File

@ -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>) {

View File

@ -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() }

View File

@ -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

View File

@ -50,11 +50,11 @@ public final class NotificationConstants {
R.drawable.exo_icon_fastforward,
R.drawable.exo_icon_previous,
R.drawable.exo_icon_next,
R.drawable.ic_pause_white_24dp,
R.drawable.ic_hourglass_top_white_24dp,
R.drawable.ic_pause,
R.drawable.ic_hourglass_top,
R.drawable.exo_icon_repeat_all,
R.drawable.exo_icon_shuffle_on,
R.drawable.ic_close_white_24dp,
R.drawable.ic_close,
};

View File

@ -273,14 +273,14 @@ public final class NotificationUtil {
|| player.getCurrentState() == Player.STATE_BLOCKED
|| player.getCurrentState() == Player.STATE_BUFFERING) {
// null intent -> show hourglass icon that does nothing when clicked
return new NotificationCompat.Action(R.drawable.ic_hourglass_top_white_24dp_png,
return new NotificationCompat.Action(R.drawable.ic_hourglass_top,
player.getContext().getString(R.string.notification_action_buffering),
null);
}
case NotificationConstants.PLAY_PAUSE:
if (player.getCurrentState() == Player.STATE_COMPLETED) {
return getAction(player, R.drawable.ic_replay_white_24dp_png,
return getAction(player, R.drawable.ic_replay,
R.string.exo_controls_pause_description, ACTION_PLAY_PAUSE);
} else if (player.isPlaying()
|| player.getCurrentState() == Player.STATE_PREFLIGHT
@ -315,7 +315,7 @@ public final class NotificationUtil {
}
case NotificationConstants.CLOSE:
return getAction(player, R.drawable.ic_close_white_24dp_png,
return getAction(player, R.drawable.ic_close,
R.string.close, ACTION_CLOSE);
case NotificationConstants.NOTHING:

View File

@ -589,15 +589,15 @@ public final class PlayQueueActivity extends AppCompatActivity
switch (state) {
case Player.STATE_PAUSED:
queueControlBinding.controlPlayPause
.setImageResource(R.drawable.ic_play_arrow_white_24dp);
.setImageResource(R.drawable.ic_play_arrow);
break;
case Player.STATE_PLAYING:
queueControlBinding.controlPlayPause
.setImageResource(R.drawable.ic_pause_white_24dp);
.setImageResource(R.drawable.ic_pause);
break;
case Player.STATE_COMPLETED:
queueControlBinding.controlPlayPause
.setImageResource(R.drawable.ic_replay_white_24dp);
.setImageResource(R.drawable.ic_replay);
break;
default:
break;
@ -670,8 +670,7 @@ public final class PlayQueueActivity extends AppCompatActivity
//2) Icon change accordingly to current App Theme
// using rootView.getContext() because getApplicationContext() didn't work
final Context context = queueControlBinding.getRoot().getContext();
item.setIcon(ThemeHelper.resolveResourceIdFromAttr(context,
player.isMuted() ? R.attr.ic_volume_off : R.attr.ic_volume_up));
item.setIcon(player.isMuted() ? R.drawable.ic_volume_off : R.drawable.ic_volume_up);
}
}
}

View File

@ -957,7 +957,7 @@ public final class Player implements
= LinearLayout.LayoutParams.MATCH_PARENT;
binding.secondaryControls.setVisibility(View.INVISIBLE);
binding.moreOptionsButton.setImageDrawable(AppCompatResources.getDrawable(context,
R.drawable.ic_expand_more_white_24dp));
R.drawable.ic_expand_more));
binding.share.setVisibility(View.VISIBLE);
binding.openInBrowser.setVisibility(View.VISIBLE);
binding.switchMute.setVisibility(View.VISIBLE);
@ -2020,7 +2020,7 @@ public final class Player implements
animate(binding.loadingPanel, true, 0);
animate(binding.surfaceForeground, true, 100);
binding.playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp);
binding.playPauseButton.setImageResource(R.drawable.ic_play_arrow);
animatePlayButtons(false, 100);
binding.getRoot().setKeepScreenOn(false);
@ -2049,7 +2049,7 @@ public final class Player implements
animate(binding.playPauseButton, false, 80, AnimationType.SCALE_AND_ALPHA, 0,
() -> {
binding.playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp);
binding.playPauseButton.setImageResource(R.drawable.ic_pause);
animatePlayButtons(true, 200);
if (!isQueueVisible) {
binding.playPauseButton.requestFocus();
@ -2090,7 +2090,7 @@ public final class Player implements
animate(binding.playPauseButton, false, 80, AnimationType.SCALE_AND_ALPHA, 0,
() -> {
binding.playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp);
binding.playPauseButton.setImageResource(R.drawable.ic_play_arrow);
animatePlayButtons(true, 200);
if (!isQueueVisible) {
binding.playPauseButton.requestFocus();
@ -2129,7 +2129,7 @@ public final class Player implements
animate(binding.playPauseButton, false, 0, AnimationType.SCALE_AND_ALPHA, 0,
() -> {
binding.playPauseButton.setImageResource(R.drawable.ic_replay_white_24dp);
binding.playPauseButton.setImageResource(R.drawable.ic_replay);
animatePlayButtons(true, DEFAULT_CONTROLS_DURATION);
});
@ -2290,7 +2290,7 @@ public final class Player implements
private void setMuteButton(final ImageButton button, final boolean isMuted) {
button.setImageDrawable(AppCompatResources.getDrawable(context, isMuted
? R.drawable.ic_volume_off_white_24dp : R.drawable.ic_volume_up_white_24dp));
? R.drawable.ic_volume_off : R.drawable.ic_volume_up));
}
//endregion
@ -2734,7 +2734,7 @@ public final class Player implements
}
seekBy(retrieveSeekDurationFromPreferences(this));
triggerProgressUpdate();
showAndAnimateControl(R.drawable.ic_fast_forward_white_24dp, true);
showAndAnimateControl(R.drawable.ic_fast_forward, true);
}
public void fastRewind() {
@ -2743,7 +2743,7 @@ public final class Player implements
}
seekBy(-retrieveSeekDurationFromPreferences(this));
triggerProgressUpdate();
showAndAnimateControl(R.drawable.ic_fast_rewind_white_24dp, true);
showAndAnimateControl(R.drawable.ic_fast_rewind, true);
}
//endregion
@ -3691,8 +3691,8 @@ public final class Player implements
|| DeviceUtils.isTablet(context))
? View.VISIBLE : View.GONE);
binding.screenRotationButton.setImageDrawable(AppCompatResources.getDrawable(context,
isFullscreen ? R.drawable.ic_fullscreen_exit_white_24dp
: R.drawable.ic_fullscreen_white_24dp));
isFullscreen ? R.drawable.ic_fullscreen_exit
: R.drawable.ic_fullscreen));
}
private void setResizeMode(@AspectRatioFrameLayout.ResizeMode final int resizeMode) {

View File

@ -147,10 +147,10 @@ public class PlayerGestureListener
player.getVolumeImageView().setImageDrawable(
AppCompatResources.getDrawable(service, currentProgressPercent <= 0
? R.drawable.ic_volume_off_white_24dp
: currentProgressPercent < 0.25 ? R.drawable.ic_volume_mute_white_24dp
: currentProgressPercent < 0.75 ? R.drawable.ic_volume_down_white_24dp
: R.drawable.ic_volume_up_white_24dp)
? R.drawable.ic_volume_off
: currentProgressPercent < 0.25 ? R.drawable.ic_volume_mute
: currentProgressPercent < 0.75 ? R.drawable.ic_volume_down
: R.drawable.ic_volume_up)
);
if (player.getVolumeRelativeLayout().getVisibility() != View.VISIBLE) {
@ -189,10 +189,10 @@ public class PlayerGestureListener
player.getBrightnessImageView().setImageDrawable(
AppCompatResources.getDrawable(service,
currentProgressPercent < 0.25
? R.drawable.ic_brightness_low_white_24dp
? R.drawable.ic_brightness_low
: currentProgressPercent < 0.75
? R.drawable.ic_brightness_medium_white_24dp
: R.drawable.ic_brightness_high_white_24dp)
? R.drawable.ic_brightness_medium
: R.drawable.ic_brightness_high)
);
if (player.getBrightnessRelativeLayout().getVisibility() != View.VISIBLE) {

View File

@ -145,10 +145,8 @@ public class PeertubeInstanceListFragment extends Fragment {
final MenuItem restoreItem = menu
.add(Menu.NONE, MENU_ITEM_RESTORE_ID, Menu.NONE, R.string.restore_defaults);
restoreItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
final int restoreIcon = ThemeHelper
.resolveResourceIdFromAttr(requireContext(), R.attr.ic_restore_defaults);
restoreItem.setIcon(AppCompatResources.getDrawable(requireContext(), restoreIcon));
restoreItem.setIcon(AppCompatResources.getDrawable(requireContext(),
R.drawable.ic_settings_backup_restore));
}
@Override

View File

@ -14,7 +14,6 @@ import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatImageView;
import org.schabi.newpipe.R;
import org.schabi.newpipe.util.ThemeHelper;
public final class AddTabDialog {
private final AlertDialog dialog;
@ -60,7 +59,7 @@ public final class AddTabDialog {
private DialogListAdapter(final Context context, final ChooseTabListItem[] items) {
this.inflater = LayoutInflater.from(context);
this.items = items;
this.fallbackIcon = ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_kiosk_hot);
this.fallbackIcon = R.drawable.ic_whatshot;
}
@Override

View File

@ -113,9 +113,8 @@ public class ChooseTabsFragment extends Fragment {
R.string.restore_defaults);
restoreItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
final int restoreIcon = ThemeHelper.resolveResourceIdFromAttr(requireContext(),
R.attr.ic_restore_defaults);
restoreItem.setIcon(AppCompatResources.getDrawable(requireContext(), restoreIcon));
restoreItem.setIcon(AppCompatResources.getDrawable(requireContext(),
R.drawable.ic_settings_backup_restore));
}
@Override
@ -241,7 +240,7 @@ public class ChooseTabsFragment extends Fragment {
case KIOSK:
returnList.add(new ChooseTabListItem(tab.getTabId(),
getString(R.string.kiosk_page_summary),
ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_kiosk_hot)));
R.drawable.ic_whatshot));
break;
case CHANNEL:
returnList.add(new ChooseTabListItem(tab.getTabId(),
@ -252,8 +251,7 @@ public class ChooseTabsFragment extends Fragment {
if (!tabList.contains(tab)) {
returnList.add(new ChooseTabListItem(tab.getTabId(),
getString(R.string.default_kiosk_page_summary),
ThemeHelper.resolveResourceIdFromAttr(context,
R.attr.ic_kiosk_hot)));
R.drawable.ic_whatshot));
}
break;
case PLAYLIST:

View File

@ -30,7 +30,6 @@ import org.schabi.newpipe.local.playlist.LocalPlaylistFragment;
import org.schabi.newpipe.local.subscription.SubscriptionFragment;
import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.ServiceHelper;
import org.schabi.newpipe.util.ThemeHelper;
import java.util.Objects;
@ -188,7 +187,7 @@ public abstract class Tab {
@DrawableRes
@Override
public int getTabIconRes(final Context context) {
return ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_blank_page);
return R.drawable.ic_crop_portrait;
}
@Override
@ -213,7 +212,7 @@ public abstract class Tab {
@DrawableRes
@Override
public int getTabIconRes(final Context context) {
return ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_channel);
return R.drawable.ic_tv;
}
@Override
@ -239,7 +238,7 @@ public abstract class Tab {
@DrawableRes
@Override
public int getTabIconRes(final Context context) {
return ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_rss);
return R.drawable.ic_rss_feed;
}
@Override
@ -264,7 +263,7 @@ public abstract class Tab {
@DrawableRes
@Override
public int getTabIconRes(final Context context) {
return ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_bookmark);
return R.drawable.ic_bookmark;
}
@Override
@ -289,7 +288,7 @@ public abstract class Tab {
@DrawableRes
@Override
public int getTabIconRes(final Context context) {
return ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_history);
return R.drawable.ic_history;
}
@Override
@ -409,7 +408,7 @@ public abstract class Tab {
@DrawableRes
@Override
public int getTabIconRes(final Context context) {
return ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_channel);
return R.drawable.ic_tv;
}
@Override
@ -541,7 +540,7 @@ public abstract class Tab {
@DrawableRes
@Override
public int getTabIconRes(final Context context) {
return ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_bookmark);
return R.drawable.ic_bookmark;
}
@Override

View File

@ -63,20 +63,20 @@ public final class KioskTranslator {
case "Top 50":
case "New & hot":
case "conferences":
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_kiosk_hot);
return R.drawable.ic_whatshot;
case "Local":
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_kiosk_local);
return R.drawable.ic_home;
case "Recently added":
case "recent":
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_kiosk_recent);
return R.drawable.ic_add_circle_outline;
case "Most liked":
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_thumb_up);
return R.drawable.ic_thumb_up;
case "live":
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_live_tv);
return R.drawable.ic_live_tv;
case "Featured":
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_stars);
return R.drawable.ic_stars;
case "Radio":
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_radio);
return R.drawable.ic_radio;
default:
return 0;
}

View File

@ -224,10 +224,9 @@ public class MissionsFragment extends Fragment {
mList.setAdapter(mAdapter);
if (mSwitch != null) {
mSwitch.setIcon(ThemeHelper.resolveResourceIdFromAttr(
requireContext(), mLinear
? R.attr.ic_grid
: R.attr.ic_list));
mSwitch.setIcon(mLinear
? R.drawable.ic_apps
: R.drawable.ic_list);
mSwitch.setTitle(mLinear ? R.string.grid : R.string.list);
mPrefs.edit().putBoolean("linear", mLinear).apply();
}

View File

@ -182,12 +182,12 @@ public class Utility {
public static int getIconForFileType(FileType type) {
switch (type) {
case MUSIC:
return R.drawable.ic_headset_white_24dp;
return R.drawable.ic_headset;
default:
case VIDEO:
return R.drawable.ic_movie_white_24dp;
return R.drawable.ic_movie;
case SUBTITLE:
return R.drawable.ic_subtitles_white_24dp;
return R.drawable.ic_subtitles;
}
}

View File

Before

Width:  |  Height:  |  Size: 358 B

After

Width:  |  Height:  |  Size: 358 B

View File

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 262 B

View File

Before

Width:  |  Height:  |  Size: 511 B

After

Width:  |  Height:  |  Size: 511 B

View File

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 244 B

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

Before

Width:  |  Height:  |  Size: 345 B

After

Width:  |  Height:  |  Size: 345 B

Some files were not shown because too many files have changed in this diff Show More