remove all traces of theme helper library
This commit is contained in:
parent
7fbb5b85f8
commit
6daf166172
20 changed files with 62 additions and 50 deletions
|
|
@ -80,7 +80,6 @@ dependencies {
|
||||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
implementation 'androidx.preference:preference-ktx:1.1.1'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||||
|
|
||||||
implementation 'com.github.kabouzeid:app-theme-helper:1.3.10'
|
|
||||||
implementation 'com.github.kabouzeid:RecyclerView-FastScroll:1.0.16-kmod'
|
implementation 'com.github.kabouzeid:RecyclerView-FastScroll:1.0.16-kmod'
|
||||||
implementation 'com.github.kabouzeid:SeekArc:1.2-kmod'
|
implementation 'com.github.kabouzeid:SeekArc:1.2-kmod'
|
||||||
implementation 'com.github.kabouzeid:AndroidSlidingUpPanel:3.3.3-kmod'
|
implementation 'com.github.kabouzeid:AndroidSlidingUpPanel:3.3.3-kmod'
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ public class LoginActivity extends AbsBaseActivity implements View.OnClickListen
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.login.setEnabled(false);
|
binding.login.setEnabled(false);
|
||||||
binding.login.setBackgroundColor(getResources().getColor(R.color.md_grey_800));
|
binding.login.setBackgroundColor(getResources().getColor(android.R.color.darker_gray));
|
||||||
|
|
||||||
App.getApiClient().ChangeServerLocation(server);
|
App.getApiClient().ChangeServerLocation(server);
|
||||||
App.getApiClient().AuthenticateUserAsync(username, password, new Response<AuthenticationResult>() {
|
App.getApiClient().AuthenticateUserAsync(username, password, new Response<AuthenticationResult>() {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ import com.dkanada.gramophone.activities.base.AbsMusicContentActivity;
|
||||||
import com.dkanada.gramophone.util.NavigationUtil;
|
import com.dkanada.gramophone.util.NavigationUtil;
|
||||||
import com.dkanada.gramophone.util.PreferenceUtil;
|
import com.dkanada.gramophone.util.PreferenceUtil;
|
||||||
import com.dkanada.gramophone.util.ThemeUtil;
|
import com.dkanada.gramophone.util.ThemeUtil;
|
||||||
import com.kabouzeid.appthemehelper.ThemeStore;
|
|
||||||
import com.dkanada.gramophone.databinding.ActivityMainContentBinding;
|
import com.dkanada.gramophone.databinding.ActivityMainContentBinding;
|
||||||
import com.dkanada.gramophone.databinding.ActivityMainDrawerLayoutBinding;
|
import com.dkanada.gramophone.databinding.ActivityMainDrawerLayoutBinding;
|
||||||
import com.dkanada.gramophone.databinding.NavigationDrawerHeaderBinding;
|
import com.dkanada.gramophone.databinding.NavigationDrawerHeaderBinding;
|
||||||
|
|
@ -132,7 +131,7 @@ public class MainActivity extends AbsMusicContentActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpNavigationView() {
|
private void setUpNavigationView() {
|
||||||
int normalColor = ThemeStore.textColorPrimary(this);
|
int normalColor = ThemeUtil.getColorResource(this, android.R.attr.textColorPrimary);
|
||||||
int activeColor = PreferenceUtil.getInstance(this).getAccentColor();
|
int activeColor = PreferenceUtil.getInstance(this).getAccentColor();
|
||||||
|
|
||||||
binding.navigationView.setItemIconTintList(ThemeUtil.getColorStateList(normalColor, activeColor));
|
binding.navigationView.setItemIconTintList(ThemeUtil.getColorStateList(normalColor, activeColor));
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import com.dkanada.gramophone.fragments.player.MiniPlayerFragment;
|
||||||
import com.dkanada.gramophone.fragments.player.NowPlayingScreen;
|
import com.dkanada.gramophone.fragments.player.NowPlayingScreen;
|
||||||
import com.dkanada.gramophone.fragments.player.card.CardPlayerFragment;
|
import com.dkanada.gramophone.fragments.player.card.CardPlayerFragment;
|
||||||
import com.dkanada.gramophone.fragments.player.flat.FlatPlayerFragment;
|
import com.dkanada.gramophone.fragments.player.flat.FlatPlayerFragment;
|
||||||
|
import com.dkanada.gramophone.util.NavigationUtil;
|
||||||
import com.dkanada.gramophone.util.PreferenceUtil;
|
import com.dkanada.gramophone.util.PreferenceUtil;
|
||||||
import com.dkanada.gramophone.util.ViewUtil;
|
import com.dkanada.gramophone.util.ViewUtil;
|
||||||
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
||||||
|
|
@ -98,7 +99,7 @@ public abstract class AbsMusicPanelActivity extends AbsMusicServiceActivity impl
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
if (currentNowPlayingScreen != PreferenceUtil.getInstance(this).getNowPlayingScreen()) {
|
if (currentNowPlayingScreen != PreferenceUtil.getInstance(this).getNowPlayingScreen()) {
|
||||||
recreate();
|
NavigationUtil.recreateMain(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import android.view.Window;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import com.dkanada.gramophone.util.NavigationUtil;
|
||||||
import com.dkanada.gramophone.util.ThemeUtil;
|
import com.dkanada.gramophone.util.ThemeUtil;
|
||||||
import com.dkanada.gramophone.R;
|
import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.util.PreferenceUtil;
|
import com.dkanada.gramophone.util.PreferenceUtil;
|
||||||
|
|
@ -17,6 +18,8 @@ import com.google.android.material.color.MaterialColors;
|
||||||
|
|
||||||
public abstract class AbsThemeActivity extends AppCompatActivity {
|
public abstract class AbsThemeActivity extends AppCompatActivity {
|
||||||
private int currentTheme;
|
private int currentTheme;
|
||||||
|
private int primaryColor;
|
||||||
|
private int accentColor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
@ -24,14 +27,19 @@ public abstract class AbsThemeActivity extends AppCompatActivity {
|
||||||
|
|
||||||
setTheme(PreferenceUtil.getInstance(this).getTheme().style);
|
setTheme(PreferenceUtil.getInstance(this).getTheme().style);
|
||||||
setColor(PreferenceUtil.getInstance(this).getPrimaryColor());
|
setColor(PreferenceUtil.getInstance(this).getPrimaryColor());
|
||||||
|
|
||||||
|
primaryColor = PreferenceUtil.getInstance(this).getPrimaryColor();
|
||||||
|
accentColor = PreferenceUtil.getInstance(this).getAccentColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
if (PreferenceUtil.getInstance(this).getTheme().style != currentTheme) {
|
if (PreferenceUtil.getInstance(this).getTheme().style != currentTheme
|
||||||
recreate();
|
|| PreferenceUtil.getInstance(this).getPrimaryColor() != primaryColor
|
||||||
|
|| PreferenceUtil.getInstance(this).getAccentColor() != accentColor) {
|
||||||
|
NavigationUtil.recreateMain(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import androidx.core.util.Pair;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
|
||||||
import com.dkanada.gramophone.R;
|
import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.adapter.base.MediaEntryViewHolder;
|
import com.dkanada.gramophone.adapter.base.MediaEntryViewHolder;
|
||||||
import com.dkanada.gramophone.glide.CustomGlideRequest;
|
import com.dkanada.gramophone.glide.CustomGlideRequest;
|
||||||
|
|
@ -21,6 +20,7 @@ import com.dkanada.gramophone.model.Artist;
|
||||||
import com.dkanada.gramophone.model.Song;
|
import com.dkanada.gramophone.model.Song;
|
||||||
import com.dkanada.gramophone.util.MusicUtil;
|
import com.dkanada.gramophone.util.MusicUtil;
|
||||||
import com.dkanada.gramophone.util.NavigationUtil;
|
import com.dkanada.gramophone.util.NavigationUtil;
|
||||||
|
import com.dkanada.gramophone.util.ThemeUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -102,7 +102,7 @@ public class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.ViewHolder
|
||||||
itemView.setOnLongClickListener(null);
|
itemView.setOnLongClickListener(null);
|
||||||
|
|
||||||
if (itemViewType != HEADER) {
|
if (itemViewType != HEADER) {
|
||||||
itemView.setBackgroundColor(ATHUtil.resolveColor(activity, R.attr.cardBackgroundColor));
|
itemView.setBackgroundColor(ThemeUtil.getColorResource(activity, R.attr.cardBackgroundColor));
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
itemView.setElevation(activity.getResources().getDimensionPixelSize(R.dimen.card_elevation));
|
itemView.setElevation(activity.getResources().getDimensionPixelSize(R.dimen.card_elevation));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.dkanada.gramophone.dialogs.RemoveFromPlaylistDialog;
|
import com.dkanada.gramophone.dialogs.RemoveFromPlaylistDialog;
|
||||||
import com.kabouzeid.appthemehelper.ThemeStore;
|
|
||||||
import com.dkanada.gramophone.R;
|
import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.interfaces.CabHolder;
|
import com.dkanada.gramophone.interfaces.CabHolder;
|
||||||
import com.dkanada.gramophone.model.Song;
|
import com.dkanada.gramophone.model.Song;
|
||||||
import com.dkanada.gramophone.util.MusicUtil;
|
import com.dkanada.gramophone.util.MusicUtil;
|
||||||
|
import com.dkanada.gramophone.util.ThemeUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ public class PlaylistSongAdapter extends AbsOffsetSongAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull final SongAdapter.ViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull final SongAdapter.ViewHolder holder, int position) {
|
||||||
if (holder.getItemViewType() == OFFSET_ITEM) {
|
if (holder.getItemViewType() == OFFSET_ITEM) {
|
||||||
int textColor = ThemeStore.textColorSecondary(activity);
|
int textColor = ThemeUtil.getColorResource(activity, android.R.attr.textColorSecondary);
|
||||||
if (holder.title != null) {
|
if (holder.title != null) {
|
||||||
holder.title.setText(MusicUtil.getPlaylistInfoString(activity, dataSet));
|
holder.title.setText(MusicUtil.getPlaylistInfoString(activity, dataSet));
|
||||||
holder.title.setTextColor(textColor);
|
holder.title.setTextColor(textColor);
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,12 @@ import androidx.annotation.Nullable;
|
||||||
import com.dkanada.gramophone.databinding.FragmentMiniPlayerBinding;
|
import com.dkanada.gramophone.databinding.FragmentMiniPlayerBinding;
|
||||||
import com.dkanada.gramophone.model.Song;
|
import com.dkanada.gramophone.model.Song;
|
||||||
import com.dkanada.gramophone.util.PreferenceUtil;
|
import com.dkanada.gramophone.util.PreferenceUtil;
|
||||||
import com.kabouzeid.appthemehelper.ThemeStore;
|
|
||||||
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
|
||||||
import com.dkanada.gramophone.R;
|
import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.helper.MusicPlayerRemote;
|
import com.dkanada.gramophone.helper.MusicPlayerRemote;
|
||||||
import com.dkanada.gramophone.helper.MusicProgressViewUpdateHelper;
|
import com.dkanada.gramophone.helper.MusicProgressViewUpdateHelper;
|
||||||
import com.dkanada.gramophone.helper.PlayPauseButtonOnClickHandler;
|
import com.dkanada.gramophone.helper.PlayPauseButtonOnClickHandler;
|
||||||
import com.dkanada.gramophone.fragments.AbsMusicServiceFragment;
|
import com.dkanada.gramophone.fragments.AbsMusicServiceFragment;
|
||||||
|
import com.dkanada.gramophone.util.ThemeUtil;
|
||||||
import com.dkanada.gramophone.views.PlayPauseDrawable;
|
import com.dkanada.gramophone.views.PlayPauseDrawable;
|
||||||
|
|
||||||
public class MiniPlayerFragment extends AbsMusicServiceFragment implements MusicProgressViewUpdateHelper.Callback {
|
public class MiniPlayerFragment extends AbsMusicServiceFragment implements MusicProgressViewUpdateHelper.Callback {
|
||||||
|
|
@ -67,7 +66,7 @@ public class MiniPlayerFragment extends AbsMusicServiceFragment implements Music
|
||||||
miniPlayerPlayPauseDrawable = new PlayPauseDrawable(requireActivity());
|
miniPlayerPlayPauseDrawable = new PlayPauseDrawable(requireActivity());
|
||||||
|
|
||||||
binding.miniPlayerPlayPauseButton.setImageDrawable(miniPlayerPlayPauseDrawable);
|
binding.miniPlayerPlayPauseButton.setImageDrawable(miniPlayerPlayPauseDrawable);
|
||||||
binding.miniPlayerPlayPauseButton.setColorFilter(ATHUtil.resolveColor(requireActivity(), R.attr.iconColor, ThemeStore.textColorSecondary(requireActivity())), PorterDuff.Mode.SRC_IN);
|
binding.miniPlayerPlayPauseButton.setColorFilter(ThemeUtil.getColorResource(requireActivity(), R.attr.iconColor), PorterDuff.Mode.SRC_IN);
|
||||||
binding.miniPlayerPlayPauseButton.setOnClickListener(new PlayPauseButtonOnClickHandler());
|
binding.miniPlayerPlayPauseButton.setOnClickListener(new PlayPauseButtonOnClickHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,6 @@ import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator;
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator;
|
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator;
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager;
|
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager;
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils;
|
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils;
|
||||||
import com.kabouzeid.appthemehelper.ThemeStore;
|
|
||||||
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
|
||||||
import com.dkanada.gramophone.R;
|
import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.adapter.base.MediaEntryViewHolder;
|
import com.dkanada.gramophone.adapter.base.MediaEntryViewHolder;
|
||||||
import com.dkanada.gramophone.adapter.song.PlayingQueueAdapter;
|
import com.dkanada.gramophone.adapter.song.PlayingQueueAdapter;
|
||||||
|
|
@ -99,7 +97,7 @@ public class CardPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
});
|
});
|
||||||
|
|
||||||
// for some reason the xml attribute doesn't get applied here.
|
// for some reason the xml attribute doesn't get applied here.
|
||||||
binding.playingQueueCard.setCardBackgroundColor(ATHUtil.resolveColor(getActivity(), R.attr.cardBackgroundColor));
|
binding.playingQueueCard.setCardBackgroundColor(ThemeUtil.getColorResource(getActivity(), R.attr.cardBackgroundColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -224,7 +222,7 @@ public class CardPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
private void updateIsFavorite() {
|
private void updateIsFavorite() {
|
||||||
boolean favorite = MusicPlayerRemote.getCurrentSong().favorite;
|
boolean favorite = MusicPlayerRemote.getCurrentSong().favorite;
|
||||||
int res = favorite ? R.drawable.ic_favorite_white_24dp : R.drawable.ic_favorite_border_white_24dp;
|
int res = favorite ? R.drawable.ic_favorite_white_24dp : R.drawable.ic_favorite_border_white_24dp;
|
||||||
int color = ThemeUtil.getColorResource(requireContext(), android.R.color.white, 255);
|
int color = ThemeUtil.getColorResource(requireContext(), android.R.color.white);
|
||||||
Drawable drawable = ImageUtil.getTintedVectorDrawable(getActivity(), res, color);
|
Drawable drawable = ImageUtil.getTintedVectorDrawable(getActivity(), res, color);
|
||||||
|
|
||||||
binding.playerToolbar.getMenu().findItem(R.id.action_toggle_favorite)
|
binding.playerToolbar.getMenu().findItem(R.id.action_toggle_favorite)
|
||||||
|
|
@ -377,7 +375,7 @@ public class CardPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
currentSongViewHolder.separator.setVisibility(View.VISIBLE);
|
currentSongViewHolder.separator.setVisibility(View.VISIBLE);
|
||||||
currentSongViewHolder.shortSeparator.setVisibility(View.GONE);
|
currentSongViewHolder.shortSeparator.setVisibility(View.GONE);
|
||||||
currentSongViewHolder.image.setScaleType(ImageView.ScaleType.CENTER);
|
currentSongViewHolder.image.setScaleType(ImageView.ScaleType.CENTER);
|
||||||
currentSongViewHolder.image.setColorFilter(ATHUtil.resolveColor(fragment.getActivity(), R.attr.iconColor, ThemeStore.textColorSecondary(fragment.getActivity())), PorterDuff.Mode.SRC_IN);
|
currentSongViewHolder.image.setColorFilter(ThemeUtil.getColorResource(fragment.getActivity(), R.attr.iconColor), PorterDuff.Mode.SRC_IN);
|
||||||
currentSongViewHolder.image.setImageResource(R.drawable.ic_volume_up_white_24dp);
|
currentSongViewHolder.image.setImageResource(R.drawable.ic_volume_up_white_24dp);
|
||||||
currentSongViewHolder.itemView.setOnClickListener(v -> {
|
currentSongViewHolder.itemView.setOnClickListener(v -> {
|
||||||
if (binding.playerSlidingLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
if (binding.playerSlidingLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import android.widget.SeekBar;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.dkanada.gramophone.util.ThemeUtil;
|
import com.dkanada.gramophone.util.ThemeUtil;
|
||||||
import com.kabouzeid.appthemehelper.util.TintHelper;
|
|
||||||
import com.dkanada.gramophone.R;
|
import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.helper.MusicPlayerRemote;
|
import com.dkanada.gramophone.helper.MusicPlayerRemote;
|
||||||
import com.dkanada.gramophone.databinding.FragmentCardPlayerPlaybackControlsBinding;
|
import com.dkanada.gramophone.databinding.FragmentCardPlayerPlaybackControlsBinding;
|
||||||
|
|
@ -111,13 +110,10 @@ public class CardPlayerPlaybackControlsFragment extends AbsMusicServiceFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpPlayPauseFab() {
|
private void setUpPlayPauseFab() {
|
||||||
final int fabColor = Color.WHITE;
|
|
||||||
TintHelper.setTintAuto(binding.playerPlayPauseFab, fabColor, true);
|
|
||||||
|
|
||||||
playerFabPlayPauseDrawable = new PlayPauseDrawable(requireActivity());
|
playerFabPlayPauseDrawable = new PlayPauseDrawable(requireActivity());
|
||||||
|
|
||||||
binding.playerPlayPauseFab.setImageDrawable(playerFabPlayPauseDrawable);
|
binding.playerPlayPauseFab.setImageDrawable(playerFabPlayPauseDrawable);
|
||||||
binding.playerPlayPauseFab.setColorFilter(ThemeUtil.getPrimaryTextColor(requireContext(), fabColor), PorterDuff.Mode.SRC_IN);
|
binding.playerPlayPauseFab.setColorFilter(ThemeUtil.getPrimaryTextColor(requireContext(), Color.WHITE), PorterDuff.Mode.SRC_IN);
|
||||||
binding.playerPlayPauseFab.setOnClickListener(new PlayPauseButtonOnClickHandler());
|
binding.playerPlayPauseFab.setOnClickListener(new PlayPauseButtonOnClickHandler());
|
||||||
binding.playerPlayPauseFab.post(() -> {
|
binding.playerPlayPauseFab.post(() -> {
|
||||||
binding.playerPlayPauseFab.setPivotX(binding.playerPlayPauseFab.getWidth() / 2f);
|
binding.playerPlayPauseFab.setPivotX(binding.playerPlayPauseFab.getWidth() / 2f);
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@ import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator;
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator;
|
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator;
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager;
|
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager;
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils;
|
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils;
|
||||||
import com.kabouzeid.appthemehelper.ThemeStore;
|
|
||||||
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
|
||||||
import com.dkanada.gramophone.R;
|
import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.adapter.base.MediaEntryViewHolder;
|
import com.dkanada.gramophone.adapter.base.MediaEntryViewHolder;
|
||||||
import com.dkanada.gramophone.adapter.song.PlayingQueueAdapter;
|
import com.dkanada.gramophone.adapter.song.PlayingQueueAdapter;
|
||||||
|
|
@ -224,7 +222,7 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
private void updateIsFavorite() {
|
private void updateIsFavorite() {
|
||||||
boolean favorite = MusicPlayerRemote.getCurrentSong().favorite;
|
boolean favorite = MusicPlayerRemote.getCurrentSong().favorite;
|
||||||
int res = favorite ? R.drawable.ic_favorite_white_24dp : R.drawable.ic_favorite_border_white_24dp;
|
int res = favorite ? R.drawable.ic_favorite_white_24dp : R.drawable.ic_favorite_border_white_24dp;
|
||||||
int color = ThemeUtil.getColorResource(requireContext(), android.R.color.white, 255);
|
int color = ThemeUtil.getColorResource(requireContext(), android.R.color.white);
|
||||||
Drawable drawable = ImageUtil.getTintedVectorDrawable(requireActivity(), res, color);
|
Drawable drawable = ImageUtil.getTintedVectorDrawable(requireActivity(), res, color);
|
||||||
|
|
||||||
binding.playerToolbar.getMenu().findItem(R.id.action_toggle_favorite)
|
binding.playerToolbar.getMenu().findItem(R.id.action_toggle_favorite)
|
||||||
|
|
@ -364,7 +362,7 @@ public class FlatPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
||||||
currentSongViewHolder.separator.setVisibility(View.VISIBLE);
|
currentSongViewHolder.separator.setVisibility(View.VISIBLE);
|
||||||
currentSongViewHolder.shortSeparator.setVisibility(View.GONE);
|
currentSongViewHolder.shortSeparator.setVisibility(View.GONE);
|
||||||
currentSongViewHolder.image.setScaleType(ImageView.ScaleType.CENTER);
|
currentSongViewHolder.image.setScaleType(ImageView.ScaleType.CENTER);
|
||||||
currentSongViewHolder.image.setColorFilter(ATHUtil.resolveColor(fragment.getActivity(), R.attr.iconColor, ThemeStore.textColorSecondary(fragment.getActivity())), PorterDuff.Mode.SRC_IN);
|
currentSongViewHolder.image.setColorFilter(ThemeUtil.getColorResource(fragment.getActivity(), R.attr.iconColor), PorterDuff.Mode.SRC_IN);
|
||||||
currentSongViewHolder.image.setImageResource(R.drawable.ic_volume_up_white_24dp);
|
currentSongViewHolder.image.setImageResource(R.drawable.ic_volume_up_white_24dp);
|
||||||
currentSongViewHolder.itemView.setOnClickListener(v -> {
|
currentSongViewHolder.itemView.setOnClickListener(v -> {
|
||||||
if (binding.playerSlidingLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
if (binding.playerSlidingLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import android.widget.ImageView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.bumptech.glide.request.transition.Transition;
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
|
||||||
import com.dkanada.gramophone.R;
|
import com.dkanada.gramophone.R;
|
||||||
import com.dkanada.gramophone.glide.palette.BitmapPaletteTarget;
|
import com.dkanada.gramophone.glide.palette.BitmapPaletteTarget;
|
||||||
import com.dkanada.gramophone.glide.palette.BitmapPaletteWrapper;
|
import com.dkanada.gramophone.glide.palette.BitmapPaletteWrapper;
|
||||||
|
|
@ -30,11 +29,11 @@ public abstract class CustomPaletteTarget extends BitmapPaletteTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getDefaultFooterColor() {
|
protected int getDefaultFooterColor() {
|
||||||
return ATHUtil.resolveColor(getView().getContext(), R.attr.defaultFooterColor);
|
return ThemeUtil.getColorResource(getView().getContext(), R.attr.defaultFooterColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getAlbumArtistFooterColor() {
|
protected int getAlbumArtistFooterColor() {
|
||||||
return ATHUtil.resolveColor(getView().getContext(), R.attr.cardBackgroundColor);
|
return ThemeUtil.getColorResource(getView().getContext(), R.attr.cardBackgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void onColorReady(int color);
|
public abstract void onColorReady(int color);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import android.content.res.TypedArray;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
import androidx.annotation.AttrRes;
|
import androidx.annotation.AttrRes;
|
||||||
|
|
@ -13,10 +14,9 @@ import androidx.annotation.ColorInt;
|
||||||
import androidx.annotation.DrawableRes;
|
import androidx.annotation.DrawableRes;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.graphics.drawable.DrawableCompat;
|
||||||
import androidx.core.content.res.ResourcesCompat;
|
import androidx.core.content.res.ResourcesCompat;
|
||||||
|
|
||||||
import com.kabouzeid.appthemehelper.util.TintHelper;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
public class ImageUtil {
|
public class ImageUtil {
|
||||||
|
|
@ -90,12 +90,13 @@ public class ImageUtil {
|
||||||
return ResourcesCompat.getDrawable(res, resId, theme);
|
return ResourcesCompat.getDrawable(res, resId, theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Drawable getTintedVectorDrawable(@NonNull Resources res, @DrawableRes int resId, @Nullable Resources.Theme theme, @ColorInt int color) {
|
|
||||||
return TintHelper.createTintedDrawable(getVectorDrawable(res, resId, theme), color);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Drawable getTintedVectorDrawable(@NonNull Context context, @DrawableRes int resId, @ColorInt int color) {
|
public static Drawable getTintedVectorDrawable(@NonNull Context context, @DrawableRes int resId, @ColorInt int color) {
|
||||||
return TintHelper.createTintedDrawable(getVectorDrawable(context.getResources(), resId, context.getTheme()), color);
|
Drawable drawable = getVectorDrawable(context.getResources(), resId, context.getTheme());
|
||||||
|
|
||||||
|
DrawableCompat.setTintMode(drawable, PorterDuff.Mode.SRC_IN);
|
||||||
|
DrawableCompat.setTint(drawable, color);
|
||||||
|
|
||||||
|
return drawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Drawable getVectorDrawable(@NonNull Context context, @DrawableRes int resId) {
|
public static Drawable getVectorDrawable(@NonNull Context context, @DrawableRes int resId) {
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,15 @@ public class NavigationUtil {
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO investigate why the normal recreate method wont work
|
||||||
|
// initial recreate is fine but subsequent runs will incorrectly apply the light theme on main
|
||||||
|
public static void recreateMain(Activity activity) {
|
||||||
|
NavigationUtil.startMain(activity);
|
||||||
|
|
||||||
|
activity.overridePendingTransition(0, android.R.anim.fade_out);
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
|
||||||
public static void startLogin(Context context) {
|
public static void startLogin(Context context) {
|
||||||
final Intent intent = new Intent(context, LoginActivity.class);
|
final Intent intent = new Intent(context, LoginActivity.class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,11 @@ public class ThemeUtil {
|
||||||
return getSecondaryTextColor(context, MaterialColors.isColorLight(color));
|
return getSecondaryTextColor(context, MaterialColors.isColorLight(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ColorInt
|
||||||
|
public static int getColorResource(Context context, int resource) {
|
||||||
|
return getColorResource(context, resource, 255);
|
||||||
|
}
|
||||||
|
|
||||||
@ColorInt
|
@ColorInt
|
||||||
public static int getColorResource(Context context, int resource, int alpha) {
|
public static int getColorResource(Context context, int resource, int alpha) {
|
||||||
TypedArray array = context.obtainStyledAttributes(new int[]{resource});
|
TypedArray array = context.obtainStyledAttributes(new int[]{resource});
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import android.util.AttributeSet;
|
||||||
|
|
||||||
import androidx.appcompat.widget.AppCompatImageView;
|
import androidx.appcompat.widget.AppCompatImageView;
|
||||||
|
|
||||||
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
import com.dkanada.gramophone.util.ThemeUtil;
|
||||||
import com.dkanada.gramophone.R;
|
import com.dkanada.gramophone.R;
|
||||||
|
|
||||||
public class IconImageView extends AppCompatImageView {
|
public class IconImageView extends AppCompatImageView {
|
||||||
|
|
@ -27,6 +27,6 @@ public class IconImageView extends AppCompatImageView {
|
||||||
|
|
||||||
private void init(Context context) {
|
private void init(Context context) {
|
||||||
if (context == null) return;
|
if (context == null) return;
|
||||||
setColorFilter(ATHUtil.resolveColor(context, R.attr.iconColor), PorterDuff.Mode.SRC_IN);
|
setColorFilter(ThemeUtil.getColorResource(context, R.attr.iconColor), PorterDuff.Mode.SRC_IN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:color="@color/ate_control_normal_light">
|
android:color="@color/color_text_secondary_light">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@android:id/mask"
|
android:id="@android:id/mask"
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
<item>
|
<item>
|
||||||
<selector>
|
<selector>
|
||||||
<item
|
<item
|
||||||
android:drawable="@color/ate_control_normal_light"
|
android:drawable="@color/color_text_secondary_light"
|
||||||
android:state_activated="true" />
|
android:state_activated="true" />
|
||||||
</selector>
|
</selector>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:color="@color/ate_control_normal_dark">
|
android:color="@color/color_text_secondary_dark">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@android:id/mask"
|
android:id="@android:id/mask"
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<item>
|
<item>
|
||||||
<selector>
|
<selector>
|
||||||
<item
|
<item
|
||||||
android:drawable="@color/ate_control_normal_dark"
|
android:drawable="@color/color_text_secondary_dark"
|
||||||
android:state_activated="true" />
|
android:state_activated="true" />
|
||||||
</selector>
|
</selector>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<item android:drawable="@color/ate_control_normal_light" android:state_activated="true" android:state_pressed="true" />
|
<item android:drawable="@color/color_text_secondary_light" android:state_activated="true" android:state_pressed="true" />
|
||||||
<item android:drawable="@color/ate_control_normal_light" android:state_activated="true" />
|
<item android:drawable="@color/color_text_secondary_light" android:state_activated="true" />
|
||||||
<item android:drawable="@color/ate_control_normal_light" android:state_pressed="true" />
|
<item android:drawable="@color/color_text_secondary_light" android:state_pressed="true" />
|
||||||
<item android:drawable="@android:color/transparent" />
|
<item android:drawable="@android:color/transparent" />
|
||||||
|
|
||||||
</selector>
|
</selector>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<item android:drawable="@color/ate_control_normal_dark" android:state_activated="true" android:state_pressed="true" />
|
<item android:drawable="@color/color_text_secondary_dark" android:state_activated="true" android:state_pressed="true" />
|
||||||
<item android:drawable="@color/ate_control_normal_dark" android:state_activated="true" />
|
<item android:drawable="@color/color_text_secondary_dark" android:state_activated="true" />
|
||||||
<item android:drawable="@color/ate_control_normal_dark" android:state_pressed="true" />
|
<item android:drawable="@color/color_text_secondary_dark" android:state_pressed="true" />
|
||||||
<item android:drawable="@android:color/transparent" />
|
<item android:drawable="@android:color/transparent" />
|
||||||
|
|
||||||
</selector>
|
</selector>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue