Merge pull request #3271 from Stypox/icons

Use vector drawables instead of PNGs for material icons
This commit is contained in:
Tobias Groza 2020-05-21 19:32:43 +02:00 committed by GitHub
commit 176d57b35a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
774 changed files with 1736 additions and 1257 deletions

View file

@ -80,7 +80,7 @@ android {
} }
ext { ext {
androidxLibVersion = '1.0.0' androidxLibVersion = '1.1.0'
exoPlayerLibVersion = '2.11.4' exoPlayerLibVersion = '2.11.4'
roomDbLibVersion = '2.1.0' roomDbLibVersion = '2.1.0'
leakCanaryLibVersion = '1.5.4' //1.6.1 leakCanaryLibVersion = '1.5.4' //1.6.1
@ -153,13 +153,12 @@ dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.23.0' testImplementation 'org.mockito:mockito-core:2.23.0'
implementation 'androidx.appcompat:appcompat:1.1.0' implementation "androidx.appcompat:appcompat:${androidxLibVersion}"
implementation "androidx.legacy:legacy-support-v4:${androidxLibVersion}"
implementation "com.google.android.material:material:${androidxLibVersion}" implementation "com.google.android.material:material:${androidxLibVersion}"
implementation "androidx.recyclerview:recyclerview:${androidxLibVersion}" implementation "androidx.recyclerview:recyclerview:${androidxLibVersion}"
implementation "androidx.legacy:legacy-preference-v14:${androidxLibVersion}" implementation "androidx.preference:preference:${androidxLibVersion}"
implementation "androidx.cardview:cardview:${androidxLibVersion}" implementation "androidx.cardview:cardview:1.0.0"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation 'com.xwray:groupie:2.7.0' implementation 'com.xwray:groupie:2.7.0'
implementation 'com.xwray:groupie-kotlin-android-extensions:2.7.0' implementation 'com.xwray:groupie-kotlin-android-extensions:2.7.0'

View file

@ -165,8 +165,7 @@ public class MainActivity extends AppCompatActivity {
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_tabs_group, kioskId, 0, KioskTranslator .add(R.id.menu_tabs_group, kioskId, 0, KioskTranslator
.getTranslatedKioskName(ks, this)) .getTranslatedKioskName(ks, this))
.setIcon(KioskTranslator.getKioskIcons(ks, this)); .setIcon(KioskTranslator.getKioskIcon(ks, this));
kioskId++;
} }
drawerItems.getMenu() drawerItems.getMenu()
@ -175,24 +174,24 @@ public class MainActivity extends AppCompatActivity {
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_channel)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_channel));
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_FEED, ORDER, R.string.fragment_feed_title) .add(R.id.menu_tabs_group, ITEM_ID_FEED, ORDER, R.string.fragment_feed_title)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.rss)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_rss));
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_BOOKMARKS, ORDER, R.string.tab_bookmarks) .add(R.id.menu_tabs_group, ITEM_ID_BOOKMARKS, ORDER, R.string.tab_bookmarks)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_bookmark)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_bookmark));
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_DOWNLOADS, ORDER, R.string.downloads) .add(R.id.menu_tabs_group, ITEM_ID_DOWNLOADS, ORDER, R.string.downloads)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.download)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_file_download));
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_HISTORY, ORDER, R.string.action_history) .add(R.id.menu_tabs_group, ITEM_ID_HISTORY, ORDER, R.string.action_history)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.history)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_history));
//Settings and About //Settings and About
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_options_about_group, ITEM_ID_SETTINGS, ORDER, R.string.settings) .add(R.id.menu_options_about_group, ITEM_ID_SETTINGS, ORDER, R.string.settings)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.settings)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_settings));
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_options_about_group, ITEM_ID_ABOUT, ORDER, R.string.tab_about) .add(R.id.menu_options_about_group, ITEM_ID_ABOUT, ORDER, R.string.tab_about)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.info)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_info_outline));
toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.drawer_open, toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.drawer_open,
R.string.drawer_close); R.string.drawer_close);
@ -420,7 +419,7 @@ public class MainActivity extends AppCompatActivity {
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_tabs_group, kioskId, ORDER, .add(R.id.menu_tabs_group, kioskId, ORDER,
KioskTranslator.getTranslatedKioskName(ks, this)) KioskTranslator.getTranslatedKioskName(ks, this))
.setIcon(KioskTranslator.getKioskIcons(ks, this)); .setIcon(KioskTranslator.getKioskIcon(ks, this));
kioskId++; kioskId++;
} }
@ -429,24 +428,24 @@ public class MainActivity extends AppCompatActivity {
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_channel)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_channel));
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_FEED, ORDER, R.string.fragment_feed_title) .add(R.id.menu_tabs_group, ITEM_ID_FEED, ORDER, R.string.fragment_feed_title)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.rss)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_rss));
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_BOOKMARKS, ORDER, R.string.tab_bookmarks) .add(R.id.menu_tabs_group, ITEM_ID_BOOKMARKS, ORDER, R.string.tab_bookmarks)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_bookmark)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_bookmark));
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_DOWNLOADS, ORDER, R.string.downloads) .add(R.id.menu_tabs_group, ITEM_ID_DOWNLOADS, ORDER, R.string.downloads)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.download)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_file_download));
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_tabs_group, ITEM_ID_HISTORY, ORDER, R.string.action_history) .add(R.id.menu_tabs_group, ITEM_ID_HISTORY, ORDER, R.string.action_history)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.history)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_history));
//Settings and About //Settings and About
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_options_about_group, ITEM_ID_SETTINGS, ORDER, R.string.settings) .add(R.id.menu_options_about_group, ITEM_ID_SETTINGS, ORDER, R.string.settings)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.settings)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_settings));
drawerItems.getMenu() drawerItems.getMenu()
.add(R.id.menu_options_about_group, ITEM_ID_ABOUT, ORDER, R.string.tab_about) .add(R.id.menu_options_about_group, ITEM_ID_ABOUT, ORDER, R.string.tab_about)
.setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.info)); .setIcon(ThemeHelper.resolveResourceIdFromAttr(this, R.attr.ic_info_outline));
} }
@Override @Override

View file

@ -25,6 +25,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
@ -313,7 +314,9 @@ public class RouterActivity extends AppCompatActivity {
final RadioButton radioButton final RadioButton radioButton
= (RadioButton) inflater.inflate(R.layout.list_radio_icon_item, null); = (RadioButton) inflater.inflate(R.layout.list_radio_icon_item, null);
radioButton.setText(item.description); radioButton.setText(item.description);
radioButton.setCompoundDrawablesWithIntrinsicBounds(item.icon, 0, 0, 0); radioButton.setCompoundDrawablesWithIntrinsicBounds(
AppCompatResources.getDrawable(getApplicationContext(), item.icon),
null, null, null);
radioButton.setChecked(false); radioButton.setChecked(false);
radioButton.setId(id++); radioButton.setId(id++);
radioButton.setLayoutParams(new RadioGroup.LayoutParams( radioButton.setLayoutParams(new RadioGroup.LayoutParams(
@ -366,26 +369,26 @@ public class RouterActivity extends AppCompatActivity {
returnList.add(new AdapterChoiceItem(getString(R.string.show_info_key), returnList.add(new AdapterChoiceItem(getString(R.string.show_info_key),
getString(R.string.show_info), getString(R.string.show_info),
resolveResourceIdFromAttr(context, R.attr.info))); resolveResourceIdFromAttr(context, R.attr.ic_info_outline)));
if (capabilities.contains(VIDEO) && !(isExtVideoEnabled && linkType != LinkType.STREAM)) { if (capabilities.contains(VIDEO) && !(isExtVideoEnabled && linkType != LinkType.STREAM)) {
returnList.add(new AdapterChoiceItem(getString(R.string.video_player_key), returnList.add(new AdapterChoiceItem(getString(R.string.video_player_key),
getString(R.string.video_player), getString(R.string.video_player),
resolveResourceIdFromAttr(context, R.attr.play))); resolveResourceIdFromAttr(context, R.attr.ic_play_arrow)));
returnList.add(new AdapterChoiceItem(getString(R.string.popup_player_key), returnList.add(new AdapterChoiceItem(getString(R.string.popup_player_key),
getString(R.string.popup_player), getString(R.string.popup_player),
resolveResourceIdFromAttr(context, R.attr.popup))); resolveResourceIdFromAttr(context, R.attr.ic_popup)));
} }
if (capabilities.contains(AUDIO) && !(isExtAudioEnabled && linkType != LinkType.STREAM)) { if (capabilities.contains(AUDIO) && !(isExtAudioEnabled && linkType != LinkType.STREAM)) {
returnList.add(new AdapterChoiceItem(getString(R.string.background_player_key), returnList.add(new AdapterChoiceItem(getString(R.string.background_player_key),
getString(R.string.background_player), getString(R.string.background_player),
resolveResourceIdFromAttr(context, R.attr.audio))); resolveResourceIdFromAttr(context, R.attr.ic_headset)));
} }
returnList.add(new AdapterChoiceItem(getString(R.string.download_key), returnList.add(new AdapterChoiceItem(getString(R.string.download_key),
getString(R.string.download), getString(R.string.download),
resolveResourceIdFromAttr(context, R.attr.download))); resolveResourceIdFromAttr(context, R.attr.ic_file_download)));
return returnList; return returnList;
} }

View file

@ -396,13 +396,11 @@ public class DownloadDialog extends DialogFragment
Log.d(TAG, "initToolbar() called with: toolbar = [" + toolbar + "]"); Log.d(TAG, "initToolbar() called with: toolbar = [" + toolbar + "]");
} }
boolean isLight = ThemeHelper.isLightThemeSelected(getActivity());
toolbar.setTitle(R.string.download_dialog_title); toolbar.setTitle(R.string.download_dialog_title);
toolbar.setNavigationIcon(isLight ? R.drawable.ic_arrow_back_black_24dp toolbar.setNavigationIcon(
: R.drawable.ic_arrow_back_white_24dp); ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_arrow_back));
toolbar.inflateMenu(R.menu.dialog_url); toolbar.inflateMenu(R.menu.dialog_url);
toolbar.setNavigationOnClickListener(v -> getDialog().dismiss()); toolbar.setNavigationOnClickListener(v -> requireDialog().dismiss());
toolbar.setNavigationContentDescription(R.string.cancel); toolbar.setNavigationContentDescription(R.string.cancel);
okButton = toolbar.findViewById(R.id.okay); okButton = toolbar.findViewById(R.id.okay);

View file

@ -1,6 +1,7 @@
package org.schabi.newpipe.fragments; package org.schabi.newpipe.fragments;
import android.content.Context; import android.content.Context;
import android.content.res.ColorStateList;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
@ -31,6 +32,7 @@ import org.schabi.newpipe.settings.tabs.Tab;
import org.schabi.newpipe.settings.tabs.TabsManager; import org.schabi.newpipe.settings.tabs.TabsManager;
import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.ServiceHelper; import org.schabi.newpipe.util.ServiceHelper;
import org.schabi.newpipe.util.ThemeHelper;
import org.schabi.newpipe.views.ScrollableTabLayout; import org.schabi.newpipe.views.ScrollableTabLayout;
import java.util.ArrayList; import java.util.ArrayList;
@ -90,6 +92,8 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
tabLayout = rootView.findViewById(R.id.main_tab_layout); tabLayout = rootView.findViewById(R.id.main_tab_layout);
viewPager = rootView.findViewById(R.id.pager); viewPager = rootView.findViewById(R.id.pager);
tabLayout.setTabIconTint(ColorStateList.valueOf(
ThemeHelper.resolveColorFromAttr(requireContext(), R.attr.colorAccent)));
tabLayout.setupWithViewPager(viewPager); tabLayout.setupWithViewPager(viewPager);
tabLayout.addOnTabSelectedListener(this); tabLayout.addOnTabSelectedListener(this);

View file

@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -35,6 +36,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
@ -85,6 +87,7 @@ import org.schabi.newpipe.util.PermissionHelper;
import org.schabi.newpipe.util.ShareUtils; import org.schabi.newpipe.util.ShareUtils;
import org.schabi.newpipe.util.StreamItemAdapter; import org.schabi.newpipe.util.StreamItemAdapter;
import org.schabi.newpipe.util.StreamItemAdapter.StreamSizeWrapper; import org.schabi.newpipe.util.StreamItemAdapter.StreamSizeWrapper;
import org.schabi.newpipe.util.ThemeHelper;
import org.schabi.newpipe.views.AnimatedProgressBar; import org.schabi.newpipe.views.AnimatedProgressBar;
import org.schabi.newpipe.views.LargeTextMovementMethod; import org.schabi.newpipe.views.LargeTextMovementMethod;
@ -495,13 +498,15 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
videoTitleTextView.setMaxLines(1); videoTitleTextView.setMaxLines(1);
videoDescriptionRootLayout.setVisibility(View.GONE); videoDescriptionRootLayout.setVisibility(View.GONE);
videoDescriptionView.setFocusable(false); videoDescriptionView.setFocusable(false);
videoTitleToggleArrow.setImageResource(R.drawable.arrow_down); videoTitleToggleArrow.setImageResource(
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_expand_more));
} else { } else {
videoTitleTextView.setMaxLines(10); videoTitleTextView.setMaxLines(10);
videoDescriptionRootLayout.setVisibility(View.VISIBLE); videoDescriptionRootLayout.setVisibility(View.VISIBLE);
videoDescriptionView.setFocusable(true); videoDescriptionView.setFocusable(true);
videoDescriptionView.setMovementMethod(new LargeTextMovementMethod()); videoDescriptionView.setMovementMethod(new LargeTextMovementMethod());
videoTitleToggleArrow.setImageResource(R.drawable.arrow_up); videoTitleToggleArrow.setImageResource(
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_expand_less));
} }
} }
@ -1073,7 +1078,8 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
return; return;
} }
thumbnailImageView.setImageDrawable(ContextCompat.getDrawable(activity, imageResource)); thumbnailImageView.setImageDrawable(
AppCompatResources.getDrawable(requireContext(), imageResource));
animateView(thumbnailImageView, false, 0, 0, animateView(thumbnailImageView, false, 0, 0,
() -> animateView(thumbnailImageView, true, 500)); () -> animateView(thumbnailImageView, true, 500));
} }
@ -1114,7 +1120,6 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
animateView(videoTitleTextView, true, 0); animateView(videoTitleTextView, true, 0);
videoDescriptionRootLayout.setVisibility(View.GONE); videoDescriptionRootLayout.setVisibility(View.GONE);
videoTitleToggleArrow.setImageResource(R.drawable.arrow_down);
videoTitleToggleArrow.setVisibility(View.GONE); videoTitleToggleArrow.setVisibility(View.GONE);
videoTitleRoot.setClickable(false); videoTitleRoot.setClickable(false);
@ -1166,8 +1171,9 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
uploaderThumb.setVisibility(View.GONE); uploaderThumb.setVisibility(View.GONE);
} }
subChannelThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); Drawable buddyDrawable = AppCompatResources.getDrawable(activity, R.drawable.buddy);
uploaderThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy)); subChannelThumb.setImageDrawable(buddyDrawable);
uploaderThumb.setImageDrawable(buddyDrawable);
if (info.getViewCount() >= 0) { if (info.getViewCount() >= 0) {
if (info.getStreamType().equals(StreamType.AUDIO_LIVE_STREAM)) { if (info.getStreamType().equals(StreamType.AUDIO_LIVE_STREAM)) {
@ -1229,8 +1235,9 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
videoDescriptionView.setVisibility(View.GONE); videoDescriptionView.setVisibility(View.GONE);
videoTitleRoot.setClickable(true); videoTitleRoot.setClickable(true);
videoTitleToggleArrow.setImageResource(
ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_expand_more));
videoTitleToggleArrow.setVisibility(View.VISIBLE); videoTitleToggleArrow.setVisibility(View.VISIBLE);
videoTitleToggleArrow.setImageResource(R.drawable.arrow_down);
videoDescriptionRootLayout.setVisibility(View.GONE); videoDescriptionRootLayout.setVisibility(View.GONE);
if (info.getUploadDate() != null) { if (info.getUploadDate() != null) {
@ -1276,7 +1283,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
detailControlsPopup.setVisibility(View.GONE); detailControlsPopup.setVisibility(View.GONE);
spinnerToolbar.setVisibility(View.GONE); spinnerToolbar.setVisibility(View.GONE);
thumbnailPlayButton.setImageResource(R.drawable.ic_headset_white_24dp); thumbnailPlayButton.setImageResource(R.drawable.ic_headset_shadow);
break; break;
} }

View file

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

View file

@ -362,14 +362,14 @@ public class StatisticsPlaylistFragment
if (sortMode == StatisticSortMode.LAST_PLAYED) { if (sortMode == StatisticSortMode.LAST_PLAYED) {
sortMode = StatisticSortMode.MOST_PLAYED; sortMode = StatisticSortMode.MOST_PLAYED;
setTitle(getString(R.string.title_most_played)); setTitle(getString(R.string.title_most_played));
sortButtonIcon sortButtonIcon.setImageResource(
.setImageResource(ThemeHelper.getIconByAttr(R.attr.history, getContext())); ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_history));
sortButtonText.setText(R.string.title_last_played); sortButtonText.setText(R.string.title_last_played);
} else { } else {
sortMode = StatisticSortMode.LAST_PLAYED; sortMode = StatisticSortMode.LAST_PLAYED;
setTitle(getString(R.string.title_last_played)); setTitle(getString(R.string.title_last_played));
sortButtonIcon sortButtonIcon.setImageResource(
.setImageResource(ThemeHelper.getIconByAttr(R.attr.filter, getContext())); ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_filter_list));
sortButtonText.setText(R.string.title_most_played); sortButtonText.setText(R.string.title_most_played);
} }
startLoading(true); startLoading(true);

View file

@ -20,10 +20,10 @@ enum class FeedGroupIcon(
ALL(0, R.attr.ic_asterisk), ALL(0, R.attr.ic_asterisk),
MUSIC(1, R.attr.ic_music_note), MUSIC(1, R.attr.ic_music_note),
EDUCATION(2, R.attr.ic_school), EDUCATION(2, R.attr.ic_school),
FITNESS(3, R.attr.ic_fitness), FITNESS(3, R.attr.ic_fitness_center),
SPACE(4, R.attr.ic_telescope), SPACE(4, R.attr.ic_telescope),
COMPUTER(5, R.attr.ic_computer), COMPUTER(5, R.attr.ic_computer),
GAMING(6, R.attr.ic_videogame), GAMING(6, R.attr.ic_videogame_asset),
SPORTS(7, R.attr.ic_sports), SPORTS(7, R.attr.ic_sports),
NEWS(8, R.attr.ic_megaphone), NEWS(8, R.attr.ic_megaphone),
FAVORITES(9, R.attr.ic_heart), FAVORITES(9, R.attr.ic_heart),
@ -32,29 +32,29 @@ enum class FeedGroupIcon(
TREND(12, R.attr.ic_trending_up), TREND(12, R.attr.ic_trending_up),
MOVIE(13, R.attr.ic_movie), MOVIE(13, R.attr.ic_movie),
BACKUP(14, R.attr.ic_backup), BACKUP(14, R.attr.ic_backup),
ART(15, R.attr.palette), ART(15, R.attr.ic_palette),
PERSON(16, R.attr.ic_person), PERSON(16, R.attr.ic_person),
PEOPLE(17, R.attr.ic_people), PEOPLE(17, R.attr.ic_people),
MONEY(18, R.attr.ic_money), MONEY(18, R.attr.ic_money),
KIDS(19, R.attr.ic_kids), KIDS(19, R.attr.ic_child_care),
FOOD(20, R.attr.ic_fastfood), FOOD(20, R.attr.ic_fastfood),
SMILE(21, R.attr.ic_smile), SMILE(21, R.attr.ic_smile),
EXPLORE(22, R.attr.ic_explore), EXPLORE(22, R.attr.ic_explore),
RESTAURANT(23, R.attr.ic_restaurant), RESTAURANT(23, R.attr.ic_restaurant),
MIC(24, R.attr.ic_mic), MIC(24, R.attr.ic_mic),
HEADSET(25, R.attr.audio), HEADSET(25, R.attr.ic_headset),
RADIO(26, R.attr.ic_radio), RADIO(26, R.attr.ic_radio),
SHOPPING_CART(27, R.attr.ic_shopping_cart), SHOPPING_CART(27, R.attr.ic_shopping_cart),
WATCH_LATER(28, R.attr.ic_watch_later), WATCH_LATER(28, R.attr.ic_watch_later),
WORK(29, R.attr.ic_work), WORK(29, R.attr.ic_work),
HOT(30, R.attr.ic_hot), HOT(30, R.attr.ic_kiosk_hot),
CHANNEL(31, R.attr.ic_channel), CHANNEL(31, R.attr.ic_channel),
BOOKMARK(32, R.attr.ic_bookmark), BOOKMARK(32, R.attr.ic_bookmark),
PETS(33, R.attr.ic_pets), PETS(33, R.attr.ic_pets),
WORLD(34, R.attr.ic_world), WORLD(34, R.attr.ic_world),
STAR(35, R.attr.ic_stars), STAR(35, R.attr.ic_stars),
SUN(36, R.attr.ic_sunny), SUN(36, R.attr.ic_sunny),
RSS(37, R.attr.rss); RSS(37, R.attr.ic_rss);
@DrawableRes @DrawableRes
fun getDrawableRes(context: Context): Int { fun getDrawableRes(context: Context): Int {

View file

@ -201,9 +201,10 @@ public final class BackgroundPlayer extends Service {
} }
private NotificationCompat.Builder createNotification() { private NotificationCompat.Builder createNotification() {
notRemoteView = new RemoteViews(BuildConfig.APPLICATION_ID, R.layout.player_notification); notRemoteView = new RemoteViews(BuildConfig.APPLICATION_ID,
R.layout.player_background_notification);
bigNotRemoteView = new RemoteViews(BuildConfig.APPLICATION_ID, bigNotRemoteView = new RemoteViews(BuildConfig.APPLICATION_ID,
R.layout.player_notification_expanded); R.layout.player_background_notification_expanded);
setupNotification(notRemoteView); setupNotification(notRemoteView);
setupNotification(bigNotRemoteView); setupNotification(bigNotRemoteView);
@ -655,7 +656,7 @@ public final class BackgroundPlayer extends Service {
super.onPlaying(); super.onPlaying();
resetNotification(); resetNotification();
updateNotificationThumbnail(); updateNotificationThumbnail();
updateNotification(R.drawable.ic_pause_white); updateNotification(R.drawable.exo_controls_pause);
} }
@Override @Override
@ -663,7 +664,7 @@ public final class BackgroundPlayer extends Service {
super.onPaused(); super.onPaused();
resetNotification(); resetNotification();
updateNotificationThumbnail(); updateNotificationThumbnail();
updateNotification(R.drawable.ic_play_arrow_white); updateNotification(R.drawable.exo_controls_play);
} }
@Override @Override
@ -677,7 +678,7 @@ public final class BackgroundPlayer extends Service {
notRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false); notRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false);
} }
updateNotificationThumbnail(); updateNotificationThumbnail();
updateNotification(R.drawable.ic_replay_white); updateNotification(R.drawable.ic_replay_white_24dp);
} }
} }
} }

View file

@ -491,7 +491,7 @@ public final class MainVideoPlayer extends AppCompatActivity
protected void setMuteButton(final ImageButton muteButton, final boolean isMuted) { protected void setMuteButton(final ImageButton muteButton, final boolean isMuted) {
muteButton.setImageDrawable(AppCompatResources.getDrawable(getApplicationContext(), isMuted muteButton.setImageDrawable(AppCompatResources.getDrawable(getApplicationContext(), isMuted
? R.drawable.ic_volume_off_white_72dp : R.drawable.ic_volume_up_white_72dp)); ? R.drawable.ic_volume_off_white_24dp : R.drawable.ic_volume_up_white_24dp));
} }
@ -989,7 +989,7 @@ public final class MainVideoPlayer extends AppCompatActivity
@Override @Override
public void onBlocked() { public void onBlocked() {
super.onBlocked(); super.onBlocked();
playPauseButton.setImageResource(R.drawable.ic_pause_white); playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp);
animatePlayButtons(false, 100); animatePlayButtons(false, 100);
animateView(closeButton, false, DEFAULT_CONTROLS_DURATION); animateView(closeButton, false, DEFAULT_CONTROLS_DURATION);
getRootView().setKeepScreenOn(true); getRootView().setKeepScreenOn(true);
@ -1005,7 +1005,7 @@ public final class MainVideoPlayer extends AppCompatActivity
public void onPlaying() { public void onPlaying() {
super.onPlaying(); super.onPlaying();
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> { animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> {
playPauseButton.setImageResource(R.drawable.ic_pause_white); playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp);
animatePlayButtons(true, 200); animatePlayButtons(true, 200);
playPauseButton.requestFocus(); playPauseButton.requestFocus();
animateView(closeButton, false, DEFAULT_CONTROLS_DURATION); animateView(closeButton, false, DEFAULT_CONTROLS_DURATION);
@ -1018,7 +1018,7 @@ public final class MainVideoPlayer extends AppCompatActivity
public void onPaused() { public void onPaused() {
super.onPaused(); super.onPaused();
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> { animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> {
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white); playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp);
animatePlayButtons(true, 200); animatePlayButtons(true, 200);
playPauseButton.requestFocus(); playPauseButton.requestFocus();
animateView(closeButton, false, DEFAULT_CONTROLS_DURATION); animateView(closeButton, false, DEFAULT_CONTROLS_DURATION);
@ -1039,7 +1039,7 @@ public final class MainVideoPlayer extends AppCompatActivity
@Override @Override
public void onCompleted() { public void onCompleted() {
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 0, 0, () -> { animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 0, 0, () -> {
playPauseButton.setImageResource(R.drawable.ic_replay_white); playPauseButton.setImageResource(R.drawable.ic_replay_white_24dp);
animatePlayButtons(true, DEFAULT_CONTROLS_DURATION); animatePlayButtons(true, DEFAULT_CONTROLS_DURATION);
animateView(closeButton, true, DEFAULT_CONTROLS_DURATION); animateView(closeButton, true, DEFAULT_CONTROLS_DURATION);
}); });
@ -1368,12 +1368,12 @@ public final class MainVideoPlayer extends AppCompatActivity
} }
final int resId = currentProgressPercent <= 0 final int resId = currentProgressPercent <= 0
? R.drawable.ic_volume_off_white_72dp ? R.drawable.ic_volume_off_white_24dp
: currentProgressPercent < 0.25 : currentProgressPercent < 0.25
? R.drawable.ic_volume_mute_white_72dp ? R.drawable.ic_volume_mute_white_24dp
: currentProgressPercent < 0.75 : currentProgressPercent < 0.75
? R.drawable.ic_volume_down_white_72dp ? R.drawable.ic_volume_down_white_24dp
: R.drawable.ic_volume_up_white_72dp; : R.drawable.ic_volume_up_white_24dp;
playerImpl.getVolumeImageView().setImageDrawable( playerImpl.getVolumeImageView().setImageDrawable(
AppCompatResources.getDrawable(getApplicationContext(), resId) AppCompatResources.getDrawable(getApplicationContext(), resId)
@ -1400,10 +1400,10 @@ public final class MainVideoPlayer extends AppCompatActivity
} }
final int resId = currentProgressPercent < 0.25 final int resId = currentProgressPercent < 0.25
? R.drawable.ic_brightness_low_white_72dp ? R.drawable.ic_brightness_low_white_24dp
: currentProgressPercent < 0.75 : currentProgressPercent < 0.75
? R.drawable.ic_brightness_medium_white_72dp ? R.drawable.ic_brightness_medium_white_24dp
: R.drawable.ic_brightness_high_white_72dp; : R.drawable.ic_brightness_high_white_24dp;
playerImpl.getBrightnessImageView().setImageDrawable( playerImpl.getBrightnessImageView().setImageDrawable(
AppCompatResources.getDrawable(getApplicationContext(), resId) AppCompatResources.getDrawable(getApplicationContext(), resId)

View file

@ -892,7 +892,7 @@ public final class PopupVideoPlayer extends Service {
public void onBlocked() { public void onBlocked() {
super.onBlocked(); super.onBlocked();
resetNotification(); resetNotification();
updateNotification(R.drawable.ic_play_arrow_white); updateNotification(R.drawable.exo_controls_play);
} }
@Override @Override
@ -902,9 +902,9 @@ public final class PopupVideoPlayer extends Service {
updateWindowFlags(ONGOING_PLAYBACK_WINDOW_FLAGS); updateWindowFlags(ONGOING_PLAYBACK_WINDOW_FLAGS);
resetNotification(); resetNotification();
updateNotification(R.drawable.ic_pause_white); updateNotification(R.drawable.exo_controls_pause);
videoPlayPause.setBackgroundResource(R.drawable.ic_pause_white); videoPlayPause.setBackgroundResource(R.drawable.exo_controls_pause);
hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME); hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME);
startForeground(NOTIFICATION_ID, notBuilder.build()); startForeground(NOTIFICATION_ID, notBuilder.build());
@ -914,7 +914,7 @@ public final class PopupVideoPlayer extends Service {
public void onBuffering() { public void onBuffering() {
super.onBuffering(); super.onBuffering();
resetNotification(); resetNotification();
updateNotification(R.drawable.ic_play_arrow_white); updateNotification(R.drawable.exo_controls_play);
} }
@Override @Override
@ -924,8 +924,8 @@ public final class PopupVideoPlayer extends Service {
updateWindowFlags(IDLE_WINDOW_FLAGS); updateWindowFlags(IDLE_WINDOW_FLAGS);
resetNotification(); resetNotification();
updateNotification(R.drawable.ic_play_arrow_white); updateNotification(R.drawable.exo_controls_play);
videoPlayPause.setBackgroundResource(R.drawable.ic_play_arrow_white); videoPlayPause.setBackgroundResource(R.drawable.exo_controls_play);
stopForeground(false); stopForeground(false);
} }
@ -934,9 +934,9 @@ public final class PopupVideoPlayer extends Service {
public void onPausedSeek() { public void onPausedSeek() {
super.onPausedSeek(); super.onPausedSeek();
resetNotification(); resetNotification();
updateNotification(R.drawable.ic_play_arrow_white); updateNotification(R.drawable.exo_controls_play);
videoPlayPause.setBackgroundResource(R.drawable.ic_pause_white); videoPlayPause.setBackgroundResource(R.drawable.exo_controls_play);
} }
@Override @Override
@ -946,8 +946,8 @@ public final class PopupVideoPlayer extends Service {
updateWindowFlags(IDLE_WINDOW_FLAGS); updateWindowFlags(IDLE_WINDOW_FLAGS);
resetNotification(); resetNotification();
updateNotification(R.drawable.ic_replay_white); updateNotification(R.drawable.ic_replay_white_24dp);
videoPlayPause.setBackgroundResource(R.drawable.ic_replay_white); videoPlayPause.setBackgroundResource(R.drawable.ic_replay_white_24dp);
stopForeground(false); stopForeground(false);
} }

View file

@ -643,13 +643,13 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
private void onStateChanged(final int state) { private void onStateChanged(final int state) {
switch (state) { switch (state) {
case BasePlayer.STATE_PAUSED: case BasePlayer.STATE_PAUSED:
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white); playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp);
break; break;
case BasePlayer.STATE_PLAYING: case BasePlayer.STATE_PLAYING:
playPauseButton.setImageResource(R.drawable.ic_pause_white); playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp);
break; break;
case BasePlayer.STATE_COMPLETED: case BasePlayer.STATE_COMPLETED:
playPauseButton.setImageResource(R.drawable.ic_replay_white); playPauseButton.setImageResource(R.drawable.ic_replay_white_24dp);
break; break;
default: default:
break; break;
@ -717,9 +717,9 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
// using rootView.getContext() because getApplicationContext() didn't work // using rootView.getContext() because getApplicationContext() didn't work
item.setIcon(player.isMuted() item.setIcon(player.isMuted()
? ThemeHelper.resolveResourceIdFromAttr(rootView.getContext(), ? ThemeHelper.resolveResourceIdFromAttr(rootView.getContext(),
R.attr.volume_off) R.attr.ic_volume_off)
: ThemeHelper.resolveResourceIdFromAttr(rootView.getContext(), : ThemeHelper.resolveResourceIdFromAttr(rootView.getContext(),
R.attr.volume_on)); R.attr.ic_volume_up));
} }
} }
} }

View file

@ -46,7 +46,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.appcompat.content.res.AppCompatResources;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackParameters;
@ -682,13 +682,13 @@ public abstract class VideoPlayer extends BasePlayer
@Override @Override
public void onFastRewind() { public void onFastRewind() {
super.onFastRewind(); super.onFastRewind();
showAndAnimateControl(R.drawable.ic_action_av_fast_rewind, true); showAndAnimateControl(R.drawable.ic_fast_rewind_white_24dp, true);
} }
@Override @Override
public void onFastForward() { public void onFastForward() {
super.onFastForward(); super.onFastForward();
showAndAnimateControl(R.drawable.ic_action_av_fast_forward, true); showAndAnimateControl(R.drawable.ic_fast_forward_white_24dp, true);
} }
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////
@ -956,7 +956,7 @@ public abstract class VideoPlayer extends BasePlayer
controlAnimationView.setVisibility(View.VISIBLE); controlAnimationView.setVisibility(View.VISIBLE);
controlAnimationView.setImageDrawable(ContextCompat.getDrawable(context, drawableId)); controlAnimationView.setImageDrawable(AppCompatResources.getDrawable(context, drawableId));
controlViewAnimator.start(); controlViewAnimator.start();
} }

View file

@ -10,6 +10,7 @@ import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -22,6 +23,7 @@ import org.schabi.newpipe.database.subscription.SubscriptionEntity;
import org.schabi.newpipe.local.subscription.SubscriptionManager; import org.schabi.newpipe.local.subscription.SubscriptionManager;
import org.schabi.newpipe.report.ErrorActivity; import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.ThemeHelper;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
@ -83,6 +85,12 @@ public class SelectChannelFragment extends DialogFragment {
// Init // Init
//////////////////////////////////////////////////////////////////////////*/ //////////////////////////////////////////////////////////////////////////*/
@Override
public void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(STYLE_NO_TITLE, ThemeHelper.getMinWidthDialogTheme(requireContext()));
}
@Override @Override
public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) { final Bundle savedInstanceState) {

View file

@ -9,7 +9,8 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.core.content.ContextCompat; import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.fragment.app.DialogFragment; import androidx.fragment.app.DialogFragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -21,6 +22,7 @@ import org.schabi.newpipe.report.ErrorActivity;
import org.schabi.newpipe.report.UserAction; import org.schabi.newpipe.report.UserAction;
import org.schabi.newpipe.util.KioskTranslator; import org.schabi.newpipe.util.KioskTranslator;
import org.schabi.newpipe.util.ServiceHelper; import org.schabi.newpipe.util.ServiceHelper;
import org.schabi.newpipe.util.ThemeHelper;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
@ -61,6 +63,16 @@ public class SelectKioskFragment extends DialogFragment {
onCancelListener = listener; onCancelListener = listener;
} }
/*//////////////////////////////////////////////////////////////////////////
// Init
//////////////////////////////////////////////////////////////////////////*/
@Override
public void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(STYLE_NO_TITLE, ThemeHelper.getMinWidthDialogTheme(requireContext()));
}
@Override @Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) { final Bundle savedInstanceState) {
@ -148,13 +160,8 @@ public class SelectKioskFragment extends DialogFragment {
final Entry entry = kioskList.get(position); final Entry entry = kioskList.get(position);
holder.titleView.setText(entry.kioskName); holder.titleView.setText(entry.kioskName);
holder.thumbnailView holder.thumbnailView
.setImageDrawable(ContextCompat.getDrawable(getContext(), entry.icon)); .setImageDrawable(AppCompatResources.getDrawable(requireContext(), entry.icon));
holder.view.setOnClickListener(new View.OnClickListener() { holder.view.setOnClickListener(view -> clickedItem(entry));
@Override
public void onClick(final View view) {
clickedItem(entry);
}
});
} }
class Entry { class Entry {

View file

@ -60,7 +60,7 @@ public final class AddTabDialog {
private DialogListAdapter(final Context context, final ChooseTabListItem[] items) { private DialogListAdapter(final Context context, final ChooseTabListItem[] items) {
this.inflater = LayoutInflater.from(context); this.inflater = LayoutInflater.from(context);
this.items = items; this.items = items;
this.fallbackIcon = ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_hot); this.fallbackIcon = ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_kiosk_hot);
} }
@Override @Override

View file

@ -233,7 +233,7 @@ public class ChooseTabsFragment extends Fragment {
case KIOSK: case KIOSK:
returnList.add(new ChooseTabListItem(tab.getTabId(), returnList.add(new ChooseTabListItem(tab.getTabId(),
getString(R.string.kiosk_page_summary), getString(R.string.kiosk_page_summary),
ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_hot))); ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_kiosk_hot)));
break; break;
case CHANNEL: case CHANNEL:
returnList.add(new ChooseTabListItem(tab.getTabId(), returnList.add(new ChooseTabListItem(tab.getTabId(),
@ -244,7 +244,8 @@ public class ChooseTabsFragment extends Fragment {
if (!tabList.contains(tab)) { if (!tabList.contains(tab)) {
returnList.add(new ChooseTabListItem(tab.getTabId(), returnList.add(new ChooseTabListItem(tab.getTabId(),
getString(R.string.default_kiosk_page_summary), getString(R.string.default_kiosk_page_summary),
ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_hot))); ThemeHelper.resolveResourceIdFromAttr(context,
R.attr.ic_kiosk_hot)));
} }
break; break;
default: default:

View file

@ -231,7 +231,7 @@ public abstract class Tab {
@DrawableRes @DrawableRes
@Override @Override
public int getTabIconRes(final Context context) { public int getTabIconRes(final Context context) {
return ThemeHelper.resolveResourceIdFromAttr(context, R.attr.rss); return ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_rss);
} }
@Override @Override
@ -281,7 +281,7 @@ public abstract class Tab {
@DrawableRes @DrawableRes
@Override @Override
public int getTabIconRes(final Context context) { public int getTabIconRes(final Context context) {
return ThemeHelper.resolveResourceIdFromAttr(context, R.attr.history); return ThemeHelper.resolveResourceIdFromAttr(context, R.attr.ic_history);
} }
@Override @Override
@ -323,7 +323,7 @@ public abstract class Tab {
@DrawableRes @DrawableRes
@Override @Override
public int getTabIconRes(final Context context) { public int getTabIconRes(final Context context) {
final int kioskIcon = KioskTranslator.getKioskIcons(kioskId, context); final int kioskIcon = KioskTranslator.getKioskIcon(kioskId, context);
if (kioskIcon <= 0) { if (kioskIcon <= 0) {
throw new IllegalStateException("Kiosk ID is not valid: \"" + kioskId + "\""); throw new IllegalStateException("Kiosk ID is not valid: \"" + kioskId + "\"");
@ -459,7 +459,7 @@ public abstract class Tab {
@DrawableRes @DrawableRes
@Override @Override
public int getTabIconRes(final Context context) { public int getTabIconRes(final Context context) {
return KioskTranslator.getKioskIcons(getDefaultKioskId(context), context); return KioskTranslator.getKioskIcon(getDefaultKioskId(context), context);
} }
@Override @Override

View file

@ -49,19 +49,19 @@ public final class KioskTranslator {
} }
} }
public static int getKioskIcons(final String kioskId, final Context c) { public static int getKioskIcon(final String kioskId, final Context c) {
switch (kioskId) { switch (kioskId) {
case "Trending": case "Trending":
case "Top 50": case "Top 50":
case "New & hot": case "New & hot":
case "conferences": case "conferences":
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_hot); return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_kiosk_hot);
case "Local": case "Local":
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_kiosk_local); return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_kiosk_local);
case "Recently added": case "Recently added":
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_kiosk_recent); return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_kiosk_recent);
case "Most liked": case "Most liked":
return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.thumbs_up); return ThemeHelper.resolveResourceIdFromAttr(c, R.attr.ic_thumb_up);
default: default:
return 0; return 0;
} }

View file

@ -231,16 +231,4 @@ public final class ThemeHelper {
return PreferenceManager.getDefaultSharedPreferences(context) return PreferenceManager.getDefaultSharedPreferences(context)
.getString(themeKey, defaultTheme); .getString(themeKey, defaultTheme);
} }
/**
* This will get the R.drawable.* resource to which attr is currently pointing to.
*
* @param attr a R.attribute.* resource value
* @param context the context to use
* @return a R.drawable.* resource value
*/
public static int getIconByAttr(final int attr, final Context context) {
return context.obtainStyledAttributes(new int[]{attr})
.getResourceId(0, -1);
}
} }

View file

@ -224,15 +224,9 @@ public class MissionsFragment extends Fragment {
mList.setAdapter(mAdapter); mList.setAdapter(mAdapter);
if (mSwitch != null) { if (mSwitch != null) {
boolean isLight = ThemeHelper.isLightThemeSelected(mContext); mSwitch.setIcon(mLinear
int icon; ? ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_grid)
: ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_list));
if (mLinear)
icon = isLight ? R.drawable.ic_grid_black_24dp : R.drawable.ic_grid_white_24dp;
else
icon = isLight ? R.drawable.ic_list_black_24dp : R.drawable.ic_list_white_24dp;
mSwitch.setIcon(icon);
mSwitch.setTitle(mLinear ? R.string.grid : R.string.list); mSwitch.setTitle(mLinear ? R.string.grid : R.string.list);
mPrefs.edit().putBoolean("linear", mLinear).apply(); mPrefs.edit().putBoolean("linear", mLinear).apply();
} }

View file

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

View file

Before

Width:  |  Height:  |  Size: 675 B

After

Width:  |  Height:  |  Size: 675 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 417 B

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