Use vector drawables instead of PNGs for material icons

For all manually-created images PNG have been kept.
- rename all icon attrs to have a `ic_` prefix
- always use `_24dp` icons, because there is no real difference, since they are vector drawables
- always use the original name found on material.io for icon drawables, as to not create confusion and possibly duplicates. Icon names can still be different from real drawable names, though I have made some of them compliant to this or maybe more meaningul.
- remove duplicate `getIconByAttr()` in ThemeHelper (use `resolveResourceIdFromAttr()`
- use standard icons for `expand_more` and `expand_less` instead of triangles
- use `play_button_outline` instead of custom PNG as play button in VideoDetailFragment (questionable, as there is no shadow anymore)
This commit is contained in:
Stypox 2020-03-25 16:23:47 +01:00
parent a3e2a085b6
commit ea43b28f74
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
758 changed files with 1165 additions and 730 deletions

View file

@ -655,7 +655,7 @@ public final class BackgroundPlayer extends Service {
super.onPlaying();
resetNotification();
updateNotificationThumbnail();
updateNotification(R.drawable.ic_pause_white);
updateNotification(R.drawable.ic_pause_white_24dp);
}
@Override
@ -663,7 +663,7 @@ public final class BackgroundPlayer extends Service {
super.onPaused();
resetNotification();
updateNotificationThumbnail();
updateNotification(R.drawable.ic_play_arrow_white);
updateNotification(R.drawable.ic_play_arrow_white_24dp);
}
@Override
@ -677,7 +677,7 @@ public final class BackgroundPlayer extends Service {
notRemoteView.setProgressBar(R.id.notificationProgressBar, 100, 100, false);
}
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) {
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
public void onBlocked() {
super.onBlocked();
playPauseButton.setImageResource(R.drawable.ic_pause_white);
playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp);
animatePlayButtons(false, 100);
animateView(closeButton, false, DEFAULT_CONTROLS_DURATION);
getRootView().setKeepScreenOn(true);
@ -1005,7 +1005,7 @@ public final class MainVideoPlayer extends AppCompatActivity
public void onPlaying() {
super.onPlaying();
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);
playPauseButton.requestFocus();
animateView(closeButton, false, DEFAULT_CONTROLS_DURATION);
@ -1018,7 +1018,7 @@ public final class MainVideoPlayer extends AppCompatActivity
public void onPaused() {
super.onPaused();
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);
playPauseButton.requestFocus();
animateView(closeButton, false, DEFAULT_CONTROLS_DURATION);
@ -1039,7 +1039,7 @@ public final class MainVideoPlayer extends AppCompatActivity
@Override
public void onCompleted() {
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);
animateView(closeButton, true, DEFAULT_CONTROLS_DURATION);
});
@ -1368,12 +1368,12 @@ public final class MainVideoPlayer extends AppCompatActivity
}
final int resId = currentProgressPercent <= 0
? R.drawable.ic_volume_off_white_72dp
? R.drawable.ic_volume_off_white_24dp
: currentProgressPercent < 0.25
? R.drawable.ic_volume_mute_white_72dp
? R.drawable.ic_volume_mute_white_24dp
: currentProgressPercent < 0.75
? R.drawable.ic_volume_down_white_72dp
: R.drawable.ic_volume_up_white_72dp;
? R.drawable.ic_volume_down_white_24dp
: R.drawable.ic_volume_up_white_24dp;
playerImpl.getVolumeImageView().setImageDrawable(
AppCompatResources.getDrawable(getApplicationContext(), resId)
@ -1400,10 +1400,10 @@ public final class MainVideoPlayer extends AppCompatActivity
}
final int resId = currentProgressPercent < 0.25
? R.drawable.ic_brightness_low_white_72dp
? R.drawable.ic_brightness_low_white_24dp
: currentProgressPercent < 0.75
? R.drawable.ic_brightness_medium_white_72dp
: R.drawable.ic_brightness_high_white_72dp;
? R.drawable.ic_brightness_medium_white_24dp
: R.drawable.ic_brightness_high_white_24dp;
playerImpl.getBrightnessImageView().setImageDrawable(
AppCompatResources.getDrawable(getApplicationContext(), resId)

View file

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

View file

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

View file

@ -682,13 +682,13 @@ public abstract class VideoPlayer extends BasePlayer
@Override
public void onFastRewind() {
super.onFastRewind();
showAndAnimateControl(R.drawable.ic_action_av_fast_rewind, true);
showAndAnimateControl(R.drawable.ic_fast_rewind_white_24dp, true);
}
@Override
public void onFastForward() {
super.onFastForward();
showAndAnimateControl(R.drawable.ic_action_av_fast_forward, true);
showAndAnimateControl(R.drawable.ic_fast_forward_white_24dp, true);
}
/*//////////////////////////////////////////////////////////////////////////