diff --git a/app/app.iml b/app/app.iml index d01c8bb4..cf066c09 100644 --- a/app/app.iml +++ b/app/app.iml @@ -191,7 +191,6 @@ - @@ -206,9 +205,7 @@ - - diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png index 924099d5..ed5e3a83 100644 Binary files a/app/src/main/ic_launcher-web.png and b/app/src/main/ic_launcher-web.png differ diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/AlbumDetailsActivity.java b/app/src/main/java/code/name/monkey/retromusic/ui/activities/AlbumDetailsActivity.java index 76c3184c..e4580c39 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/AlbumDetailsActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/AlbumDetailsActivity.java @@ -108,7 +108,7 @@ public class AlbumDetailsActivity extends AbsSlidingMusicPanelActivity implement @Override protected void onCreate(Bundle savedInstanceState) { - setDrawUnderStatusbar(true); + setDrawUnderStatusBar(true); super.onCreate(savedInstanceState); ButterKnife.bind(this); diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/ArtistDetailActivity.java b/app/src/main/java/code/name/monkey/retromusic/ui/activities/ArtistDetailActivity.java index 44d95f4e..fed141f6 100755 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/ArtistDetailActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/ArtistDetailActivity.java @@ -118,7 +118,7 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement @Override protected void onCreate(Bundle bundle) { - setDrawUnderStatusbar(true); + setDrawUnderStatusBar(true); super.onCreate(bundle); ButterKnife.bind(this); diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/GenreDetailsActivity.java b/app/src/main/java/code/name/monkey/retromusic/ui/activities/GenreDetailsActivity.java index bd1d0742..b72bfc56 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/GenreDetailsActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/GenreDetailsActivity.java @@ -88,7 +88,7 @@ public class GenreDetailsActivity extends AbsSlidingMusicPanelActivity implement @Override protected void onCreate(Bundle savedInstanceState) { - setDrawUnderStatusbar(true); + setDrawUnderStatusBar(true); super.onCreate(savedInstanceState); ButterKnife.bind(this); diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/LockScreenActivity.java b/app/src/main/java/code/name/monkey/retromusic/ui/activities/LockScreenActivity.java index 8a993189..9b075d05 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/LockScreenActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/LockScreenActivity.java @@ -30,7 +30,7 @@ public class LockScreenActivity extends AbsMusicServiceActivity { | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); - setDrawUnderStatusbar(true); + setDrawUnderStatusBar(true); setContentView(R.layout.activity_lock_screen_old_style); hideStatusBar(); diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/MainActivity.java b/app/src/main/java/code/name/monkey/retromusic/ui/activities/MainActivity.java index 9bea7bd3..45a8e93e 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/MainActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/MainActivity.java @@ -88,7 +88,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements @Override protected void onCreate(Bundle savedInstanceState) { - setDrawUnderStatusbar(true); + setDrawUnderStatusBar(true); super.onCreate(savedInstanceState); ButterKnife.bind(this); diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/PlaylistDetailActivity.java b/app/src/main/java/code/name/monkey/retromusic/ui/activities/PlaylistDetailActivity.java index 1f383fcf..60f34e44 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/PlaylistDetailActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/PlaylistDetailActivity.java @@ -87,7 +87,7 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme @Override protected void onCreate(Bundle savedInstanceState) { - setDrawUnderStatusbar(true); + setDrawUnderStatusBar(true); super.onCreate(savedInstanceState); ButterKnife.bind(this); diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/ProVersionActivity.java b/app/src/main/java/code/name/monkey/retromusic/ui/activities/ProVersionActivity.java index 5381a064..64f10c0b 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/ProVersionActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/ProVersionActivity.java @@ -53,7 +53,7 @@ public class ProVersionActivity extends AbsBaseActivity implements protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pro_version); - setDrawUnderStatusbar(true); + setDrawUnderStatusBar(true); ButterKnife.bind(this); RetroUtil.statusBarHeight(statusBar); setStatusbarColorAuto(); diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/SearchActivity.java b/app/src/main/java/code/name/monkey/retromusic/ui/activities/SearchActivity.java index 961b5b64..7733e190 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/SearchActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/SearchActivity.java @@ -68,7 +68,7 @@ public class SearchActivity extends AbsMusicServiceActivity implements OnQueryTe @Override protected void onCreate(Bundle savedInstanceState) { - setDrawUnderStatusbar(true); + setDrawUnderStatusBar(true); super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/UserInfoActivity.java b/app/src/main/java/code/name/monkey/retromusic/ui/activities/UserInfoActivity.java index 303d1cf9..bb4d480f 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/UserInfoActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/UserInfoActivity.java @@ -12,7 +12,7 @@ public class UserInfoActivity extends AbsBaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { - setDrawUnderStatusbar(true); + setDrawUnderStatusBar(true); super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_info); diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/activities/base/AbsThemeActivity.java b/app/src/main/java/code/name/monkey/retromusic/ui/activities/base/AbsThemeActivity.java index 1a4632ac..7fe40e3e 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/activities/base/AbsThemeActivity.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/activities/base/AbsThemeActivity.java @@ -1,21 +1,22 @@ package code.name.monkey.retromusic.ui.activities.base; import android.graphics.Color; -import android.graphics.drawable.GradientDrawable; +import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.annotation.ColorInt; +import android.support.v4.content.ContextCompat; import android.view.KeyEvent; import android.view.View; import android.view.WindowManager; - import code.name.monkey.appthemehelper.ATH; import code.name.monkey.appthemehelper.ThemeStore; import code.name.monkey.appthemehelper.common.ATHToolbarActivity; import code.name.monkey.appthemehelper.util.ATHUtil; import code.name.monkey.appthemehelper.util.ColorUtil; import code.name.monkey.appthemehelper.util.MaterialDialogsUtil; +import code.name.monkey.appthemehelper.util.TintHelper; import code.name.monkey.appthemehelper.util.VersionUtils; import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.util.PreferenceUtil; @@ -23,191 +24,190 @@ import code.name.monkey.retromusic.util.RetroUtil; public abstract class AbsThemeActivity extends ATHToolbarActivity implements Runnable { - private Handler handler = new Handler(); + private Handler handler = new Handler(); - @Override - protected void onCreate(Bundle savedInstanceState) { - setTheme(PreferenceUtil.getInstance(this).getGeneralTheme()); - hideStatusBar(); - super.onCreate(savedInstanceState); - MaterialDialogsUtil.updateMaterialDialogsThemeSingleton(this); + @Override + protected void onCreate(Bundle savedInstanceState) { + setTheme(PreferenceUtil.getInstance(this).getGeneralTheme()); + hideStatusBar(); + super.onCreate(savedInstanceState); + MaterialDialogsUtil.updateMaterialDialogsThemeSingleton(this); - changeBackgroundShape(); - setImmersiveFullscreen(); - registerSystemUiVisibility(); - toggleScreenOn(); + changeBackgroundShape(); + setImmersiveFullscreen(); + registerSystemUiVisibility(); + toggleScreenOn(); + } + private void toggleScreenOn() { + if (PreferenceUtil.getInstance(this).isScreenOnEnabled()) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } else { + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } + } - private void toggleScreenOn() { - if (PreferenceUtil.getInstance(this).isScreenOnEnabled()) { - getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - } else { - getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - } + @Override + public void onWindowFocusChanged(boolean hasFocus) { + super.onWindowFocusChanged(hasFocus); + if (hasFocus) { + hideStatusBar(); + handler.removeCallbacks(this); + handler.postDelayed(this, 300); + } else { + handler.removeCallbacks(this); } + } - @Override - public void onWindowFocusChanged(boolean hasFocus) { - super.onWindowFocusChanged(hasFocus); - if (hasFocus) { - hideStatusBar(); - handler.removeCallbacks(this); - handler.postDelayed(this, 300); - } else { - handler.removeCallbacks(this); - } + public void hideStatusBar() { + hideStatusBar(PreferenceUtil.getInstance(this).getFullScreenMode()); + } + + private void hideStatusBar(boolean fullscreen) { + final View statusBar = getWindow().getDecorView().getRootView().findViewById(R.id.status_bar); + if (statusBar != null) { + statusBar.setVisibility(fullscreen ? View.GONE : View.VISIBLE); } + } - public void hideStatusBar() { - hideStatusBar(PreferenceUtil.getInstance(this).getFullScreenMode()); + + private void changeBackgroundShape() { + Drawable background = PreferenceUtil.getInstance(this).isRoundCorners() ? + ContextCompat.getDrawable(this, R.drawable.round_window) + : ContextCompat.getDrawable(this, R.drawable.square_window); + background = TintHelper.createTintedDrawable(background, ThemeStore.primaryColor(this)); + getWindow().setBackgroundDrawable(background); + //View decor = getWindow().getDecorView(); + //GradientDrawable gradientDrawable = (GradientDrawable) decor.getBackground(); + //gradientDrawable.setColor(ThemeStore.primaryColor(this)); + } + + protected void setDrawUnderStatusBar(boolean drawUnderStatusbar) { + if (VersionUtils.hasLollipop()) { + RetroUtil.setAllowDrawUnderStatusBar(getWindow()); + } else if (VersionUtils.hasKitKat()) { + RetroUtil.setStatusBarTranslucent(getWindow()); } + } - private void hideStatusBar(boolean fullscreen) { - final View statusBar = getWindow().getDecorView().getRootView().findViewById(R.id.status_bar); - if (statusBar != null) { - statusBar.setVisibility(fullscreen ? View.GONE : View.VISIBLE); - } - } - - - private void changeBackgroundShape() { - if (PreferenceUtil.getInstance(this).isRoundCorners()) { - getWindow().setBackgroundDrawableResource(R.drawable.round_window); - } else { - getWindow().setBackgroundDrawableResource(R.drawable.square_window); - } - View decor = getWindow().getDecorView(); - GradientDrawable gradientDrawable = (GradientDrawable) decor.getBackground(); - gradientDrawable.setColor(ThemeStore.primaryColor(this)); - } - - protected void setDrawUnderStatusbar(boolean drawUnderStatusbar) { + /** + * This will set the color of the view with the id "status_bar" on KitKat and Lollipop. On + * Lollipop if no such view is found it will set the statusbar color using the native method. + * + * @param color the new statusbar color (will be shifted down on Lollipop and above) + */ + public void setStatusbarColor(int color) { + if (VersionUtils.hasKitKat()) { + final View statusBar = getWindow().getDecorView().getRootView().findViewById(R.id.status_bar); + if (statusBar != null) { if (VersionUtils.hasLollipop()) { - RetroUtil.setAllowDrawUnderStatusBar(getWindow()); - } else if (VersionUtils.hasKitKat()) { - RetroUtil.setStatusBarTranslucent(getWindow()); - } - } - - /** - * This will set the color of the view with the id "status_bar" on KitKat and Lollipop. On - * Lollipop if no such view is found it will set the statusbar color using the native method. - * - * @param color the new statusbar color (will be shifted down on Lollipop and above) - */ - public void setStatusbarColor(int color) { - if (VersionUtils.hasKitKat()) { - final View statusBar = getWindow().getDecorView().getRootView().findViewById(R.id.status_bar); - if (statusBar != null) { - if (VersionUtils.hasLollipop()) { - statusBar.setBackgroundColor(ColorUtil.darkenColor(color)); - setLightStatusbarAuto(color); - } else { - statusBar.setBackgroundColor(color); - } - } else if (Build.VERSION.SDK_INT >= 21) { - getWindow().setStatusBarColor(ColorUtil.darkenColor(color)); - setLightStatusbarAuto(color); - } - } - } - - public void setStatusbarColorAuto() { - // we don't want to use statusbar color because we are doing the color darkening on our own to support KitKat - setStatusbarColor(ThemeStore.primaryColor(this)); - } - - public void setTaskDescriptionColor(@ColorInt int color) { - ATH.setTaskDescriptionColor(this, color); - } - - public void setTaskDescriptionColorAuto() { - setTaskDescriptionColor(ThemeStore.primaryColor(this)); - } - - public void setNavigationbarColor(int color) { - if (ThemeStore.coloredNavigationBar(this)) { - ATH.setNavigationbarColor(this, color); + statusBar.setBackgroundColor(ColorUtil.darkenColor(color)); + setLightStatusbarAuto(color); } else { - ATH.setNavigationbarColor(this, Color.BLACK); + statusBar.setBackgroundColor(color); } + } else if (Build.VERSION.SDK_INT >= 21) { + getWindow().setStatusBarColor(ColorUtil.darkenColor(color)); + setLightStatusbarAuto(color); + } } + } - public void setNavigationbarColorAuto() { - setNavigationbarColor(ThemeStore.navigationBarColor(this)); + public void setStatusbarColorAuto() { + // we don't want to use statusbar color because we are doing the color darkening on our own to support KitKat + setStatusbarColor(ThemeStore.primaryColor(this)); + } + + public void setTaskDescriptionColor(@ColorInt int color) { + ATH.setTaskDescriptionColor(this, color); + } + + public void setTaskDescriptionColorAuto() { + setTaskDescriptionColor(ThemeStore.primaryColor(this)); + } + + public void setNavigationbarColor(int color) { + if (ThemeStore.coloredNavigationBar(this)) { + ATH.setNavigationbarColor(this, color); + } else { + ATH.setNavigationbarColor(this, Color.BLACK); } + } - public void setLightStatusbar(boolean enabled) { - ATH.setLightStatusbar(this, enabled); + public void setNavigationbarColorAuto() { + setNavigationbarColor(ThemeStore.navigationBarColor(this)); + } + + public void setLightStatusbar(boolean enabled) { + ATH.setLightStatusbar(this, enabled); + } + + public void setLightStatusbarAuto(int bgColor) { + setLightStatusbar(ColorUtil.isColorLight(bgColor)); + } + + public void setLightNavigationBar(boolean enabled) { + if (!ATHUtil.isWindowBackgroundDark(this) && ThemeStore.coloredNavigationBar(this)) { + ATH.setLightNavigationbar(this, enabled); } + } - public void setLightStatusbarAuto(int bgColor) { - setLightStatusbar(ColorUtil.isColorLight(bgColor)); - } - - public void setLightNavigationBar(boolean enabled) { - if (!ATHUtil.isWindowBackgroundDark(this) && ThemeStore.coloredNavigationBar(this)) { - ATH.setLightNavigationbar(this, enabled); - } - } - - private void registerSystemUiVisibility() { - final View decorView = getWindow().getDecorView(); - decorView.setOnSystemUiVisibilityChangeListener(visibility -> { - if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) { - setImmersiveFullscreen(); - } - }); - } - - private void unregisterSystemUiVisibility() { - final View decorView = getWindow().getDecorView(); - decorView.setOnSystemUiVisibilityChangeListener(null); - } - - public void setImmersiveFullscreen() { - int flags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | - View.SYSTEM_UI_FLAG_FULLSCREEN | - View.SYSTEM_UI_FLAG_LAYOUT_STABLE | - View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | - View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | - View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; - if (PreferenceUtil.getInstance(this).getFullScreenMode()) { - getWindow().getDecorView().setSystemUiVisibility(flags); - } - } - - public void exitFullscreen() { - getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); - } - - @Override - public void run() { + private void registerSystemUiVisibility() { + final View decorView = getWindow().getDecorView(); + decorView.setOnSystemUiVisibilityChangeListener(visibility -> { + if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) { setImmersiveFullscreen(); + } + }); + } + + private void unregisterSystemUiVisibility() { + final View decorView = getWindow().getDecorView(); + decorView.setOnSystemUiVisibilityChangeListener(null); + } + + public void setImmersiveFullscreen() { + int flags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | + View.SYSTEM_UI_FLAG_FULLSCREEN | + View.SYSTEM_UI_FLAG_LAYOUT_STABLE | + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; + if (PreferenceUtil.getInstance(this).getFullScreenMode()) { + getWindow().getDecorView().setSystemUiVisibility(flags); } + } - @Override - protected void onStop() { - handler.removeCallbacks(this); - super.onStop(); + public void exitFullscreen() { + getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); + } + + @Override + public void run() { + setImmersiveFullscreen(); + } + + @Override + protected void onStop() { + handler.removeCallbacks(this); + super.onStop(); + } + + @Override + public void onDestroy() { + super.onDestroy(); + unregisterSystemUiVisibility(); + exitFullscreen(); + } + + + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP)) { + handler.removeCallbacks(this); + handler.postDelayed(this, 500); } + return super.onKeyDown(keyCode, event); - @Override - public void onDestroy() { - super.onDestroy(); - unregisterSystemUiVisibility(); - exitFullscreen(); - } - - - @Override - public boolean onKeyDown(int keyCode, KeyEvent event) { - if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP)) { - handler.removeCallbacks(this); - handler.postDelayed(this, 500); - } - return super.onKeyDown(keyCode, event); - - } + } } \ No newline at end of file diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/MiniPlayerFragment.java b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/MiniPlayerFragment.java index 6035247b..601c6b96 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/MiniPlayerFragment.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/MiniPlayerFragment.java @@ -16,7 +16,6 @@ import android.view.ViewGroup; import android.view.animation.DecelerateInterpolator; import android.widget.ImageView; import android.widget.TextView; - import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; @@ -31,146 +30,147 @@ import code.name.monkey.retromusic.views.PlayPauseDrawable; import me.zhanghai.android.materialprogressbar.MaterialProgressBar; public class MiniPlayerFragment extends AbsMusicServiceFragment implements - MusicProgressViewUpdateHelper.Callback { + MusicProgressViewUpdateHelper.Callback { - @BindView(R.id.mini_player_title) - TextView miniPlayerTitle; - @BindView(R.id.mini_player_play_pause_button) - ImageView miniPlayerPlayPauseButton; - @BindView(R.id.progress_bar) - MaterialProgressBar progressBar; + @BindView(R.id.mini_player_title) + TextView miniPlayerTitle; + @BindView(R.id.mini_player_play_pause_button) + ImageView miniPlayerPlayPauseButton; + @BindView(R.id.progress_bar) + MaterialProgressBar progressBar; - private Unbinder unbinder; - private PlayPauseDrawable miniPlayerPlayPauseDrawable; - private MusicProgressViewUpdateHelper progressViewUpdateHelper; + private Unbinder unbinder; + private PlayPauseDrawable miniPlayerPlayPauseDrawable; + private MusicProgressViewUpdateHelper progressViewUpdateHelper; + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + progressViewUpdateHelper = new MusicProgressViewUpdateHelper(this); + } + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View layout = inflater.inflate(R.layout.fragment_mini_player, container, false); + unbinder = ButterKnife.bind(this, layout); + return layout; + } + + @Override + public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + //noinspection ConstantConditions + view.setBackgroundColor(ThemeStore.primaryColor(getContext())); + view.setOnTouchListener(new FlingPlayBackController(getActivity())); + setUpMiniPlayer(); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + unbinder.unbind(); + } + + @SuppressWarnings({"ConstantConditions"}) + private void setUpMiniPlayer() { + setUpPlayPauseButton(); + progressBar.setProgressTintList(ColorStateList.valueOf(ThemeStore.accentColor(getActivity()))); + } + + private void setUpPlayPauseButton() { + //noinspection ConstantConditions + miniPlayerPlayPauseDrawable = new PlayPauseDrawable(getActivity()); + miniPlayerPlayPauseButton.setImageDrawable(miniPlayerPlayPauseDrawable); + miniPlayerPlayPauseButton.setColorFilter(ATHUtil.resolveColor(getActivity(), + R.attr.iconColor, + ThemeStore.textColorSecondary(getActivity())), PorterDuff.Mode.SRC_IN); + miniPlayerPlayPauseButton.setOnClickListener(new PlayPauseButtonOnClickHandler()); + } + + private void updateSongTitle() { + miniPlayerTitle.setText(MusicPlayerRemote.getCurrentSong().title); + } + + @Override + public void onServiceConnected() { + updateSongTitle(); + updatePlayPauseDrawableState(false); + } + + @Override + public void onPlayingMetaChanged() { + updateSongTitle(); + } + + @Override + public void onPlayStateChanged() { + updatePlayPauseDrawableState(true); + } + + @Override + public void onUpdateProgressViews(int progress, int total) { + progressBar.setMax(total); + ObjectAnimator animator = ObjectAnimator.ofInt(progressBar, "progress", progress); + animator.setDuration(1000); + animator.setInterpolator(new DecelerateInterpolator()); + animator.start(); + } + + @Override + public void onResume() { + super.onResume(); + progressViewUpdateHelper.start(); + } + + @Override + public void onPause() { + super.onPause(); + progressViewUpdateHelper.stop(); + } + + protected void updatePlayPauseDrawableState(boolean animate) { + if (MusicPlayerRemote.isPlaying()) { + miniPlayerPlayPauseDrawable.setPause(animate); + } else { + miniPlayerPlayPauseDrawable.setPlay(animate); + } + } + + public void setColor(int playerFragmentColor) { + //noinspection ConstantConditions + getView().setBackgroundColor(playerFragmentColor); + } + + public static class FlingPlayBackController implements View.OnTouchListener { + + GestureDetector flingPlayBackController; + + public FlingPlayBackController(Context context) { + flingPlayBackController = new GestureDetector(context, + new GestureDetector.SimpleOnGestureListener() { + @Override + public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, + float velocityY) { + if (Math.abs(velocityX) > Math.abs(velocityY)) { + if (velocityX < 0) { + MusicPlayerRemote.playNextSong(); + return true; + } else if (velocityX > 0) { + MusicPlayerRemote.playPreviousSong(); + return true; + } + } + return false; + } + }); + } + + @SuppressLint("ClickableViewAccessibility") @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - progressViewUpdateHelper = new MusicProgressViewUpdateHelper(this); - } - - @Nullable - @Override - public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View layout = inflater.inflate(R.layout.fragment_mini_player, container, false); - unbinder = ButterKnife.bind(this, layout); - return layout; - } - - @Override - public void onViewCreated(View view, Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - view.setBackgroundColor(ThemeStore.primaryColor(getContext())); - view.setOnTouchListener(new FlingPlayBackController(getActivity())); - setUpMiniPlayer(); - } - - @Override - public void onDestroyView() { - super.onDestroyView(); - unbinder.unbind(); - } - - @SuppressWarnings({"ConstantConditions"}) - private void setUpMiniPlayer() { - setUpPlayPauseButton(); - progressBar.setProgressTintList(ColorStateList.valueOf(ThemeStore.accentColor(getActivity()))); - } - - private void setUpPlayPauseButton() { - //noinspection ConstantConditions - miniPlayerPlayPauseDrawable = new PlayPauseDrawable(getActivity()); - miniPlayerPlayPauseButton.setImageDrawable(miniPlayerPlayPauseDrawable); - miniPlayerPlayPauseButton.setColorFilter(ATHUtil.resolveColor(getActivity(), - R.attr.iconColor, - ThemeStore.textColorSecondary(getActivity())), PorterDuff.Mode.SRC_IN); - miniPlayerPlayPauseButton.setOnClickListener(new PlayPauseButtonOnClickHandler()); - } - - private void updateSongTitle() { - miniPlayerTitle.setText(MusicPlayerRemote.getCurrentSong().title); - } - - @Override - public void onServiceConnected() { - updateSongTitle(); - updatePlayPauseDrawableState(false); - } - - @Override - public void onPlayingMetaChanged() { - updateSongTitle(); - } - - @Override - public void onPlayStateChanged() { - updatePlayPauseDrawableState(true); - } - - @Override - public void onUpdateProgressViews(int progress, int total) { - progressBar.setMax(total); - ObjectAnimator animator = ObjectAnimator.ofInt(progressBar, "progress", progress); - animator.setDuration(1000); - animator.setInterpolator(new DecelerateInterpolator()); - animator.start(); - } - - @Override - public void onResume() { - super.onResume(); - progressViewUpdateHelper.start(); - } - - @Override - public void onPause() { - super.onPause(); - progressViewUpdateHelper.stop(); - } - - protected void updatePlayPauseDrawableState(boolean animate) { - if (MusicPlayerRemote.isPlaying()) { - miniPlayerPlayPauseDrawable.setPause(animate); - } else { - miniPlayerPlayPauseDrawable.setPlay(animate); - } - } - - public void setColor(int playerFragmentColor) { - //noinspection ConstantConditions - getView().setBackgroundColor(playerFragmentColor); - } - - public static class FlingPlayBackController implements View.OnTouchListener { - - GestureDetector flingPlayBackController; - - public FlingPlayBackController(Context context) { - flingPlayBackController = new GestureDetector(context, - new GestureDetector.SimpleOnGestureListener() { - @Override - public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, - float velocityY) { - if (Math.abs(velocityX) > Math.abs(velocityY)) { - if (velocityX < 0) { - MusicPlayerRemote.playNextSong(); - return true; - } else if (velocityX > 0) { - MusicPlayerRemote.playPreviousSong(); - return true; - } - } - return false; - } - }); - } - - @SuppressLint("ClickableViewAccessibility") - @Override - public boolean onTouch(View v, MotionEvent event) { - return flingPlayBackController.onTouchEvent(event); - } + public boolean onTouch(View v, MotionEvent event) { + return flingPlayBackController.onTouchEvent(event); } + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/blur/BlurPlayerFragment.java b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/blur/BlurPlayerFragment.java index 02c7cd2c..19e15356 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/blur/BlurPlayerFragment.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/blur/BlurPlayerFragment.java @@ -22,6 +22,7 @@ import butterknife.Unbinder; import code.name.monkey.appthemehelper.util.ColorUtil; import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper; import code.name.monkey.retromusic.R; +import code.name.monkey.retromusic.glide.BlurTransformation; import code.name.monkey.retromusic.glide.RetroMusicColoredTarget; import code.name.monkey.retromusic.glide.SongGlideRequest; import code.name.monkey.retromusic.helper.MusicPlayerRemote; @@ -35,7 +36,6 @@ import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator; import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator; import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager; import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils; -import jp.wasabeef.glide.transformations.BlurTransformation; /** * @author Hemanth S (h4h13). @@ -207,7 +207,7 @@ public class BlurPlayerFragment extends AbsPlayerFragment implements } int blurAmount = PreferenceManager.getDefaultSharedPreferences(getContext()) - .getInt("blur_amount", 25); + .getInt("new_blur_amount", 25); colorBackground.clearColorFilter(); @@ -216,7 +216,7 @@ public class BlurPlayerFragment extends AbsPlayerFragment implements .generatePalette(activity) .build() .override(320, 480) - .transform(new BlurTransformation(getActivity(), blurAmount)) + .transform(new BlurTransformation.Builder(getActivity()).blurRadius(blurAmount).build()) .into(new RetroMusicColoredTarget(colorBackground) { @Override public void onColorReady(int color) { diff --git a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/cardblur/CardBlurFragment.java b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/cardblur/CardBlurFragment.java index 3d6e2436..f813c743 100644 --- a/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/cardblur/CardBlurFragment.java +++ b/app/src/main/java/code/name/monkey/retromusic/ui/fragments/player/cardblur/CardBlurFragment.java @@ -9,19 +9,15 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; -import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; -import android.widget.TextView; - -import com.bumptech.glide.Glide; - import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper; import code.name.monkey.retromusic.R; +import code.name.monkey.retromusic.glide.BlurTransformation; import code.name.monkey.retromusic.glide.RetroMusicColoredTarget; import code.name.monkey.retromusic.glide.SongGlideRequest; import code.name.monkey.retromusic.helper.MusicPlayerRemote; @@ -29,164 +25,167 @@ import code.name.monkey.retromusic.model.Song; import code.name.monkey.retromusic.ui.fragments.base.AbsPlayerFragment; import code.name.monkey.retromusic.ui.fragments.player.PlayerAlbumCoverFragment; import code.name.monkey.retromusic.ui.fragments.player.normal.PlayerFragment; -import jp.wasabeef.glide.transformations.BlurTransformation; +import com.bumptech.glide.Glide; -public class CardBlurFragment extends AbsPlayerFragment implements PlayerAlbumCoverFragment.Callbacks { - @BindView(R.id.player_toolbar) - Toolbar toolbar; - @BindView(R.id.status_bar) - View statusBar; - @BindView(R.id.gradient_background) - ImageView colorBackground; +public class CardBlurFragment extends AbsPlayerFragment implements + PlayerAlbumCoverFragment.Callbacks { - private int lastColor; - private CardBlurPlaybackControlsFragment playbackControlsFragment; - private Unbinder unbinder; + @BindView(R.id.player_toolbar) + Toolbar toolbar; + @BindView(R.id.status_bar) + View statusBar; + @BindView(R.id.gradient_background) + ImageView colorBackground; - public static PlayerFragment newInstance() { - Bundle args = new Bundle(); - PlayerFragment fragment = new PlayerFragment(); - fragment.setArguments(args); - return fragment; + private int lastColor; + private CardBlurPlaybackControlsFragment playbackControlsFragment; + private Unbinder unbinder; + + public static PlayerFragment newInstance() { + Bundle args = new Bundle(); + PlayerFragment fragment = new PlayerFragment(); + fragment.setArguments(args); + return fragment; + } + + @Override + @ColorInt + public int getPaletteColor() { + return lastColor; + } + + @Override + public void onShow() { + playbackControlsFragment.show(); + } + + @Override + public void onHide() { + playbackControlsFragment.hide(); + onBackPressed(); + } + + @Override + public void onResume() { + super.onResume(); + } + + @Override + public boolean onBackPressed() { + return false; + } + + @Override + public Toolbar getToolbar() { + return toolbar; + } + + @Override + public int toolbarIconColor() { + return Color.WHITE; + } + + @Override + public void onColorChanged(int color) { + playbackControlsFragment.setDark(color); + lastColor = color; + getCallbacks().onPaletteColorChanged(); + ToolbarContentTintHelper.colorizeToolbar(toolbar, Color.WHITE, getActivity()); + } + + @Override + protected void toggleFavorite(Song song) { + super.toggleFavorite(song); + if (song.id == MusicPlayerRemote.getCurrentSong().id) { + updateIsFavorite(); } + } - @Override - @ColorInt - public int getPaletteColor() { - return lastColor; - } + @Override + public void onFavoriteToggled() { + toggleFavorite(MusicPlayerRemote.getCurrentSong()); + } - @Override - public void onShow() { - playbackControlsFragment.show(); - } + @Override + public void onDestroyView() { + super.onDestroyView(); + unbinder.unbind(); + } - @Override - public void onHide() { - playbackControlsFragment.hide(); - onBackPressed(); - } + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, + @Nullable Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.fragment_card_blur_player, container, false); + unbinder = ButterKnife.bind(this, view); + return view; + } - @Override - public void onResume() { - super.onResume(); - } + @Override + public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + toggleStatusBar(statusBar); - @Override - public boolean onBackPressed() { - return false; - } + setUpSubFragments(); + setUpPlayerToolbar(); + } - @Override - public Toolbar getToolbar() { - return toolbar; - } + private void setUpSubFragments() { + playbackControlsFragment = (CardBlurPlaybackControlsFragment) getChildFragmentManager() + .findFragmentById(R.id.playback_controls_fragment); - @Override - public int toolbarIconColor() { - return Color.WHITE; - } + PlayerAlbumCoverFragment playerAlbumCoverFragment = + (PlayerAlbumCoverFragment) getChildFragmentManager() + .findFragmentById(R.id.player_album_cover_fragment); + playerAlbumCoverFragment.setCallbacks(this); + playerAlbumCoverFragment.removeEffect(); + } - @Override - public void onColorChanged(int color) { - playbackControlsFragment.setDark(color); - lastColor = color; - getCallbacks().onPaletteColorChanged(); - ToolbarContentTintHelper.colorizeToolbar(toolbar, Color.WHITE, getActivity()); - } - - @Override - protected void toggleFavorite(Song song) { - super.toggleFavorite(song); - if (song.id == MusicPlayerRemote.getCurrentSong().id) { - updateIsFavorite(); - } - } - - @Override - public void onFavoriteToggled() { - toggleFavorite(MusicPlayerRemote.getCurrentSong()); - } - - @Override - public void onDestroyView() { - super.onDestroyView(); - unbinder.unbind(); - } - - @Nullable - @Override - public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, - @Nullable Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_card_blur_player, container, false); - unbinder = ButterKnife.bind(this, view); - return view; - } - - @Override - public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - toggleStatusBar(statusBar); - - setUpSubFragments(); - setUpPlayerToolbar(); - } - - private void setUpSubFragments() { - playbackControlsFragment = (CardBlurPlaybackControlsFragment) getChildFragmentManager() - .findFragmentById(R.id.playback_controls_fragment); - - PlayerAlbumCoverFragment playerAlbumCoverFragment = - (PlayerAlbumCoverFragment) getChildFragmentManager() - .findFragmentById(R.id.player_album_cover_fragment); - playerAlbumCoverFragment.setCallbacks(this); - playerAlbumCoverFragment.removeEffect(); - } - - private void setUpPlayerToolbar() { - toolbar.inflateMenu(R.menu.menu_player); - toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed()); - toolbar.setOnMenuItemClickListener(this); + private void setUpPlayerToolbar() { + toolbar.inflateMenu(R.menu.menu_player); + toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed()); + toolbar.setOnMenuItemClickListener(this); /* for (int i = 0; i < toolbar.getMenu().size(); i++) { MenuItem menuItem = toolbar.getMenu().getItem(i); menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); }*/ - ToolbarContentTintHelper.colorizeToolbar(toolbar, Color.WHITE, getActivity()); - } + ToolbarContentTintHelper.colorizeToolbar(toolbar, Color.WHITE, getActivity()); + } - @Override - public void onServiceConnected() { - updateIsFavorite(); - updateBlur(); - } + @Override + public void onServiceConnected() { + updateIsFavorite(); + updateBlur(); + } - @Override - public void onPlayingMetaChanged() { - updateIsFavorite(); - updateBlur(); - } + @Override + public void onPlayingMetaChanged() { + updateIsFavorite(); + updateBlur(); + } - private void updateBlur() { - Activity activity = getActivity(); - if (activity == null) { - return; - } - int blurAmount = PreferenceManager.getDefaultSharedPreferences(getContext()).getInt("blur_amount", 25); - - colorBackground.clearColorFilter(); - SongGlideRequest.Builder.from(Glide.with(activity), MusicPlayerRemote.getCurrentSong()) - .checkIgnoreMediaStore(activity) - .generatePalette(activity) - .build() - .transform(new BlurTransformation(getActivity(), blurAmount)) - .into(new RetroMusicColoredTarget(colorBackground) { - @Override - public void onColorReady(int color) { - if (color == getDefaultFooterColor()) { - colorBackground.setColorFilter(color); - } - } - }); + private void updateBlur() { + Activity activity = getActivity(); + if (activity == null) { + return; } + int blurAmount = PreferenceManager.getDefaultSharedPreferences(getContext()) + .getInt("new_blur_amount", 25); + + colorBackground.clearColorFilter(); + SongGlideRequest.Builder.from(Glide.with(activity), MusicPlayerRemote.getCurrentSong()) + .checkIgnoreMediaStore(activity) + .generatePalette(activity) + .build() + .transform(new BlurTransformation.Builder(getActivity()).blurRadius(blurAmount).build()) + .into(new RetroMusicColoredTarget(colorBackground) { + @Override + public void onColorReady(int color) { + if (color == getDefaultFooterColor()) { + colorBackground.setColorFilter(color); + } + } + }); + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java b/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java index 49b1c0a7..b14d63a5 100644 --- a/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java +++ b/app/src/main/java/code/name/monkey/retromusic/util/MusicUtil.java @@ -18,17 +18,6 @@ import android.support.v4.content.FileProvider; import android.text.TextUtils; import android.util.Log; import android.widget.Toast; - -import org.jaudiotagger.audio.AudioFileIO; -import org.jaudiotagger.tag.FieldKey; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; -import java.util.regex.Pattern; - import code.name.monkey.retromusic.R; import code.name.monkey.retromusic.helper.MusicPlayerRemote; import code.name.monkey.retromusic.loaders.PlaylistLoader; @@ -38,373 +27,384 @@ import code.name.monkey.retromusic.model.Playlist; import code.name.monkey.retromusic.model.Song; import code.name.monkey.retromusic.model.lyrics.AbsSynchronizedLyrics; import io.reactivex.Observable; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.regex.Pattern; +import org.jaudiotagger.audio.AudioFileIO; +import org.jaudiotagger.tag.FieldKey; public class MusicUtil { - public static final String TAG = MusicUtil.class.getSimpleName(); - private static Playlist playlist; + public static final String TAG = MusicUtil.class.getSimpleName(); + private static Playlist playlist; - public static Uri getMediaStoreAlbumCoverUri(int albumId) { - final Uri sArtworkUri = Uri - .parse("content://media/external/audio/albumart"); + public static Uri getMediaStoreAlbumCoverUri(int albumId) { + final Uri sArtworkUri = Uri + .parse("content://media/external/audio/albumart"); - return ContentUris.withAppendedId(sArtworkUri, albumId); + return ContentUris.withAppendedId(sArtworkUri, albumId); + } + + public static Uri getSongFileUri(int songId) { + return ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, songId); + } + + @NonNull + public static Intent createShareSongFileIntent(@NonNull final Song song, Context context) { + try { + + return new Intent() + .setAction(Intent.ACTION_SEND) + .putExtra(Intent.EXTRA_STREAM, + FileProvider.getUriForFile(context, + context.getApplicationContext().getPackageName(), + new File(song.data))) + .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + .setType("audio/*"); + } catch (IllegalArgumentException e) { + // TODO the path is most likely not like /storage/emulated/0/... but something like /storage/28C7-75B0/... + e.printStackTrace(); + Toast.makeText(context, "Could not share this file, I'm aware of the issue.", + Toast.LENGTH_SHORT).show(); + return new Intent(); + } + } + + public static void setRingtone(@NonNull final Context context, final int id) { + final ContentResolver resolver = context.getContentResolver(); + final Uri uri = getSongFileUri(id); + try { + final ContentValues values = new ContentValues(2); + values.put(MediaStore.Audio.AudioColumns.IS_RINGTONE, "1"); + values.put(MediaStore.Audio.AudioColumns.IS_ALARM, "1"); + resolver.update(uri, values, null, null); + } catch (@NonNull final UnsupportedOperationException ignored) { + return; } - public static Uri getSongFileUri(int songId) { - return ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, songId); - } - - @NonNull - public static Intent createShareSongFileIntent(@NonNull final Song song, Context context) { - try { - - return new Intent() - .setAction(Intent.ACTION_SEND) - .putExtra(Intent.EXTRA_STREAM, - FileProvider.getUriForFile(context, - context.getApplicationContext().getPackageName(), - new File(song.data))) - .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - .setType("audio/*"); - } catch (IllegalArgumentException e) { - // TODO the path is most likely not like /storage/emulated/0/... but something like /storage/28C7-75B0/... - e.printStackTrace(); - Toast.makeText(context, "Could not share this file, I'm aware of the issue.", - Toast.LENGTH_SHORT).show(); - return new Intent(); + try { + Cursor cursor = resolver.query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, + new String[]{MediaStore.MediaColumns.TITLE}, + BaseColumns._ID + "=?", + new String[]{String.valueOf(id)}, + null); + try { + if (cursor != null && cursor.getCount() == 1) { + cursor.moveToFirst(); + Settings.System.putString(resolver, Settings.System.RINGTONE, uri.toString()); + final String message = context + .getString(R.string.x_has_been_set_as_ringtone, cursor.getString(0)); + Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); } + } finally { + if (cursor != null) { + cursor.close(); + } + } + } catch (SecurityException ignored) { + } + } + + @NonNull + public static String getArtistInfoString(@NonNull final Context context, + @NonNull final Artist artist) { + int albumCount = artist.getAlbumCount(); + int songCount = artist.getSongCount(); + String albumString = albumCount == 1 ? context.getResources().getString(R.string.album) + : context.getResources().getString(R.string.albums); + String songString = songCount == 1 ? context.getResources().getString(R.string.song) + : context.getResources().getString(R.string.songs); + return albumCount + " " + albumString + " • " + songCount + " " + songString; + } + + @NonNull + public static String getArtistInfoStringSmall(@NonNull final Context context, + @NonNull final Artist artist) { + int songCount = artist.getSongCount(); + String songString = songCount == 1 ? context.getResources().getString(R.string.song) + : context.getResources().getString(R.string.songs); + return songCount + " " + songString; + } + + @NonNull + public static String getPlaylistInfoString(@NonNull final Context context, + @NonNull List songs) { + final int songCount = songs.size(); + final String songString = songCount == 1 ? context.getResources().getString(R.string.song) + : context.getResources().getString(R.string.songs); + + long duration = 0; + for (int i = 0; i < songs.size(); i++) { + duration += songs.get(i).duration; } - public static void setRingtone(@NonNull final Context context, final int id) { - final ContentResolver resolver = context.getContentResolver(); - final Uri uri = getSongFileUri(id); - try { - final ContentValues values = new ContentValues(2); - values.put(MediaStore.Audio.AudioColumns.IS_RINGTONE, "1"); - values.put(MediaStore.Audio.AudioColumns.IS_ALARM, "1"); - resolver.update(uri, values, null, null); - } catch (@NonNull final UnsupportedOperationException ignored) { - return; + return songCount + " " + songString + " • " + MusicUtil.getReadableDurationString(duration); + } + + public static String getReadableDurationString(long songDurationMillis) { + long minutes = (songDurationMillis / 1000) / 60; + long seconds = (songDurationMillis / 1000) % 60; + if (minutes < 60) { + return String.format(Locale.getDefault(), "%01d:%02d", minutes, seconds); + } else { + long hours = minutes / 60; + minutes = minutes % 60; + return String.format(Locale.getDefault(), "%d:%02d:%02d", hours, minutes, seconds); + } + } + + //iTunes uses for example 1002 for track 2 CD1 or 3011 for track 11 CD3. + //this method converts those values to normal tracknumbers + public static int getFixedTrackNumber(int trackNumberToFix) { + return trackNumberToFix % 1000; + } + + public static void insertAlbumArt(@NonNull Context context, int albumId, String path) { + ContentResolver contentResolver = context.getContentResolver(); + + Uri artworkUri = Uri.parse("content://media/external/audio/albumart"); + contentResolver.delete(ContentUris.withAppendedId(artworkUri, albumId), null, null); + + ContentValues values = new ContentValues(); + values.put("album_id", albumId); + values.put("_data", path); + + contentResolver.insert(artworkUri, values); + } + + @NonNull + public static File createAlbumArtFile() { + return new File(createAlbumArtDir(), String.valueOf(System.currentTimeMillis())); + } + + @NonNull + @SuppressWarnings("ResultOfMethodCallIgnored") + private static File createAlbumArtDir() { + File albumArtDir = new File(Environment.getExternalStorageDirectory(), "/albumthumbs/"); + if (!albumArtDir.exists()) { + albumArtDir.mkdirs(); + try { + new File(albumArtDir, ".nomedia").createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return albumArtDir; + } + + public static void deleteTracks(@NonNull final Activity activity, + @NonNull final List songs) { + final String[] projection = new String[]{ + BaseColumns._ID, MediaStore.MediaColumns.DATA + }; + final StringBuilder selection = new StringBuilder(); + selection.append(BaseColumns._ID + " IN ("); + for (int i = 0; i < songs.size(); i++) { + selection.append(songs.get(i).id); + if (i < songs.size() - 1) { + selection.append(","); + } + } + selection.append(")"); + + try { + final Cursor cursor = activity.getContentResolver().query( + MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection.toString(), + null, null); + if (cursor != null) { + // Step 1: Remove selected tracks from the current playlist, as well + // as from the album art cache + cursor.moveToFirst(); + while (!cursor.isAfterLast()) { + final int id = cursor.getInt(0); + Song song = SongLoader.getSong(activity, id).blockingFirst(); + MusicPlayerRemote.removeFromQueue(song); + cursor.moveToNext(); } - try { - Cursor cursor = resolver.query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, - new String[]{MediaStore.MediaColumns.TITLE}, - BaseColumns._ID + "=?", - new String[]{String.valueOf(id)}, - null); + // Step 2: Remove selected tracks from the database + activity.getContentResolver().delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, + selection.toString(), null); + + // Step 3: Remove files from card + cursor.moveToFirst(); + while (!cursor.isAfterLast()) { + final String name = cursor.getString(1); + try { // File.delete can throw a security exception + final File f = new File(name); + if (!f.delete()) { + // I'm not sure if we'd ever get here (deletion would + // have to fail, but no exception thrown) + Log.e("MusicUtils", "Failed to delete file " + name); + } + cursor.moveToNext(); + } catch (@NonNull final SecurityException ex) { + cursor.moveToNext(); + } catch (NullPointerException e) { + Log.e("MusicUtils", "Failed to find file " + name); + } + } + cursor.close(); + } + activity.getContentResolver().notifyChange(Uri.parse("content://media"), null); + Toast.makeText(activity, activity.getString(R.string.deleted_x_songs, songs.size()), + Toast.LENGTH_SHORT).show(); + } catch (SecurityException ignored) { + } + } + + public static void deleteAlbumArt(@NonNull Context context, int albumId) { + ContentResolver contentResolver = context.getContentResolver(); + Uri localUri = Uri.parse("content://media/external/audio/albumart"); + contentResolver.delete(ContentUris.withAppendedId(localUri, albumId), null, null); + } + + + @Nullable + public static String getLyrics(Song song) { + String lyrics = null; + + File file = new File(song.data); + + try { + lyrics = AudioFileIO.read(file).getTagOrCreateDefault().getFirst(FieldKey.LYRICS); + } catch (Exception e) { + e.printStackTrace(); + } + + if (lyrics == null || lyrics.trim().isEmpty() || !AbsSynchronizedLyrics + .isSynchronized(lyrics)) { + File dir = file.getAbsoluteFile().getParentFile(); + + if (dir != null && dir.exists() && dir.isDirectory()) { + String format = ".*%s.*\\.(lrc|txt)"; + String filename = Pattern.quote(FileUtil.stripExtension(file.getName())); + String songtitle = Pattern.quote(song.title); + + final ArrayList patterns = new ArrayList<>(); + patterns.add(Pattern.compile(String.format(format, filename), + Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE)); + patterns.add(Pattern.compile(String.format(format, songtitle), + Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE)); + + File[] files = dir.listFiles(f -> { + for (Pattern pattern : patterns) { + if (pattern.matcher(f.getName()).matches()) { + return true; + } + } + return false; + }); + + if (files != null && files.length > 0) { + for (File f : files) { try { - if (cursor != null && cursor.getCount() == 1) { - cursor.moveToFirst(); - Settings.System.putString(resolver, Settings.System.RINGTONE, uri.toString()); - final String message = context - .getString(R.string.x_has_been_set_as_ringtone, cursor.getString(0)); - Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); - } - } finally { - if (cursor != null) { - cursor.close(); + String newLyrics = FileUtil.read(f); + if (newLyrics != null && !newLyrics.trim().isEmpty()) { + if (AbsSynchronizedLyrics.isSynchronized(newLyrics)) { + return newLyrics; } + lyrics = newLyrics; + } + } catch (Exception e) { + e.printStackTrace(); } - } catch (SecurityException ignored) { + } } + } } - @NonNull - public static String getArtistInfoString(@NonNull final Context context, - @NonNull final Artist artist) { - int albumCount = artist.getAlbumCount(); - int songCount = artist.getSongCount(); - String albumString = albumCount == 1 ? context.getResources().getString(R.string.album) - : context.getResources().getString(R.string.albums); - String songString = songCount == 1 ? context.getResources().getString(R.string.song) - : context.getResources().getString(R.string.songs); - return albumCount + " " + albumString + " • " + songCount + " " + songString; + return lyrics; + } + + public static void toggleFavorite(@NonNull final Context context, @NonNull final Song song) { + if (isFavorite(context, song)) { + PlaylistsUtil + .removeFromPlaylist(context, song, getFavoritesPlaylist(context).blockingFirst().id); + } else { + PlaylistsUtil + .addToPlaylist(context, song, getOrCreateFavoritesPlaylist(context).blockingFirst().id, + false); } + } - @NonNull - public static String getArtistInfoStringSmall(@NonNull final Context context, - @NonNull final Artist artist) { - int songCount = artist.getSongCount(); - String songString = songCount == 1 ? context.getResources().getString(R.string.song) - : context.getResources().getString(R.string.songs); - return songCount + " " + songString; - } + public static boolean isFavoritePlaylist(@NonNull final Context context, + @NonNull final Playlist playlist) { + return playlist.name != null && playlist.name.equals(context.getString(R.string.favorites)); + } - @NonNull - public static String getPlaylistInfoString(@NonNull final Context context, - @NonNull List songs) { - final int songCount = songs.size(); - final String songString = songCount == 1 ? context.getResources().getString(R.string.song) - : context.getResources().getString(R.string.songs); + private static Observable getFavoritesPlaylist(@NonNull final Context context) { + return PlaylistLoader.getPlaylist(context, context.getString(R.string.favorites)); + } - long duration = 0; - for (int i = 0; i < songs.size(); i++) { - duration += songs.get(i).duration; - } + private static Observable getOrCreateFavoritesPlaylist(@NonNull final Context context) { + return PlaylistLoader.getPlaylist(context, + PlaylistsUtil.createPlaylist(context, context.getString(R.string.favorites))); + } - return songCount + " " + songString + " • " + MusicUtil.getReadableDurationString(duration); - } - - public static String getReadableDurationString(long songDurationMillis) { - long minutes = (songDurationMillis / 1000) / 60; - long seconds = (songDurationMillis / 1000) % 60; - if (minutes < 60) { - return String.format(Locale.getDefault(), "%01d:%02d", minutes, seconds); - } else { - long hours = minutes / 60; - minutes = minutes % 60; - return String.format(Locale.getDefault(), "%d:%02d:%02d", hours, minutes, seconds); - } - } - - //iTunes uses for example 1002 for track 2 CD1 or 3011 for track 11 CD3. - //this method converts those values to normal tracknumbers - public static int getFixedTrackNumber(int trackNumberToFix) { - return trackNumberToFix % 1000; - } - - public static void insertAlbumArt(@NonNull Context context, int albumId, String path) { - ContentResolver contentResolver = context.getContentResolver(); - - Uri artworkUri = Uri.parse("content://media/external/audio/albumart"); - contentResolver.delete(ContentUris.withAppendedId(artworkUri, albumId), null, null); - - ContentValues values = new ContentValues(); - values.put("album_id", albumId); - values.put("_data", path); - - contentResolver.insert(artworkUri, values); - } - - @NonNull - public static File createAlbumArtFile() { - return new File(createAlbumArtDir(), String.valueOf(System.currentTimeMillis())); - } - - @NonNull - @SuppressWarnings("ResultOfMethodCallIgnored") - private static File createAlbumArtDir() { - File albumArtDir = new File(Environment.getExternalStorageDirectory(), "/albumthumbs/"); - if (!albumArtDir.exists()) { - albumArtDir.mkdirs(); - try { - new File(albumArtDir, ".nomedia").createNewFile(); - } catch (IOException e) { - e.printStackTrace(); - } - } - return albumArtDir; - } - - public static void deleteTracks(@NonNull final Activity activity, - @NonNull final List songs) { - final String[] projection = new String[]{ - BaseColumns._ID, MediaStore.MediaColumns.DATA - }; - final StringBuilder selection = new StringBuilder(); - selection.append(BaseColumns._ID + " IN ("); - for (int i = 0; i < songs.size(); i++) { - selection.append(songs.get(i).id); - if (i < songs.size() - 1) { - selection.append(","); - } - } - selection.append(")"); - - try { - final Cursor cursor = activity.getContentResolver().query( - MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection.toString(), - null, null); - if (cursor != null) { - // Step 1: Remove selected tracks from the current playlist, as well - // as from the album art cache - cursor.moveToFirst(); - while (!cursor.isAfterLast()) { - final int id = cursor.getInt(0); - SongLoader.getSong(activity, id).subscribe(song -> { - MusicPlayerRemote.removeFromQueue(song); - cursor.moveToNext(); - }); - } - - // Step 2: Remove selected tracks from the database - activity.getContentResolver().delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, - selection.toString(), null); - - // Step 3: Remove files from card - cursor.moveToFirst(); - while (!cursor.isAfterLast()) { - final String name = cursor.getString(1); - try { // File.delete can throw a security exception - final File f = new File(name); - if (!f.delete()) { - // I'm not sure if we'd ever get here (deletion would - // have to fail, but no exception thrown) - Log.e("MusicUtils", "Failed to delete file " + name); - } - cursor.moveToNext(); - } catch (@NonNull final SecurityException ex) { - cursor.moveToNext(); - } catch (NullPointerException e) { - Log.e("MusicUtils", "Failed to find file " + name); - } - } - cursor.close(); - } - activity.getContentResolver().notifyChange(Uri.parse("content://media"), null); - Toast.makeText(activity, activity.getString(R.string.deleted_x_songs, songs.size()), - Toast.LENGTH_SHORT).show(); - } catch (SecurityException ignored) { - } - } - - public static void deleteAlbumArt(@NonNull Context context, int albumId) { - ContentResolver contentResolver = context.getContentResolver(); - Uri localUri = Uri.parse("content://media/external/audio/albumart"); - contentResolver.delete(ContentUris.withAppendedId(localUri, albumId), null, null); - } - - - @Nullable - public static String getLyrics(Song song) { - String lyrics = null; - - File file = new File(song.data); - - try { - lyrics = AudioFileIO.read(file).getTagOrCreateDefault().getFirst(FieldKey.LYRICS); - } catch (Exception e) { - e.printStackTrace(); - } - - if (lyrics == null || lyrics.trim().isEmpty() || !AbsSynchronizedLyrics - .isSynchronized(lyrics)) { - File dir = file.getAbsoluteFile().getParentFile(); - - if (dir != null && dir.exists() && dir.isDirectory()) { - String format = ".*%s.*\\.(lrc|txt)"; - String filename = Pattern.quote(FileUtil.stripExtension(file.getName())); - String songtitle = Pattern.quote(song.title); - - final ArrayList patterns = new ArrayList<>(); - patterns.add(Pattern.compile(String.format(format, filename), - Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE)); - patterns.add(Pattern.compile(String.format(format, songtitle), - Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE)); - - File[] files = dir.listFiles(f -> { - for (Pattern pattern : patterns) { - if (pattern.matcher(f.getName()).matches()) { - return true; - } - } - return false; - }); - - if (files != null && files.length > 0) { - for (File f : files) { - try { - String newLyrics = FileUtil.read(f); - if (newLyrics != null && !newLyrics.trim().isEmpty()) { - if (AbsSynchronizedLyrics.isSynchronized(newLyrics)) { - return newLyrics; - } - lyrics = newLyrics; - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } - } - } - - return lyrics; - } - - public static void toggleFavorite(@NonNull final Context context, @NonNull final Song song) { - if (isFavorite(context, song)) { - PlaylistsUtil - .removeFromPlaylist(context, song, getFavoritesPlaylist(context).blockingFirst().id); - } else { - PlaylistsUtil - .addToPlaylist(context, song, getOrCreateFavoritesPlaylist(context).blockingFirst().id, - false); - } - } - - public static boolean isFavoritePlaylist(@NonNull final Context context, - @NonNull final Playlist playlist) { - return playlist.name != null && playlist.name.equals(context.getString(R.string.favorites)); - } - - private static Observable getFavoritesPlaylist(@NonNull final Context context) { - return PlaylistLoader.getPlaylist(context, context.getString(R.string.favorites)); - } - - private static Observable getOrCreateFavoritesPlaylist(@NonNull final Context context) { - return PlaylistLoader.getPlaylist(context, - PlaylistsUtil.createPlaylist(context, context.getString(R.string.favorites))); - } - - public static boolean isFavorite(@NonNull final Context context, @NonNull final Song song) { + public static boolean isFavorite(@NonNull final Context context, @NonNull final Song song) { /*return Observable.create(e -> getFavoritesPlaylist(context).subscribe(playlist1 -> { boolean isBoolean = PlaylistsUtil.doPlaylistContains(context, playlist1.id, song.id); e.onNext(isBoolean); e.onComplete(); }));*/ - //getFavoritesPlaylist(context).blockingFirst().id.subscribe(MusicUtil::setPlaylist); - //return PlaylistsUtil.doPlaylistContains(context, getFavoritesPlaylist(context).blockingFirst().id, song.id); - return PlaylistsUtil - .doPlaylistContains(context, getFavoritesPlaylist(context).blockingFirst().id, song.id); - } + //getFavoritesPlaylist(context).blockingFirst().id.subscribe(MusicUtil::setPlaylist); + //return PlaylistsUtil.doPlaylistContains(context, getFavoritesPlaylist(context).blockingFirst().id, song.id); + return PlaylistsUtil + .doPlaylistContains(context, getFavoritesPlaylist(context).blockingFirst().id, song.id); + } - public static boolean isArtistNameUnknown(@Nullable String artistName) { - if (TextUtils.isEmpty(artistName)) return false; - if (artistName.equals(Artist.UNKNOWN_ARTIST_DISPLAY_NAME)) return true; - artistName = artistName.trim().toLowerCase(); - return artistName.equals("unknown") || artistName.equals(""); + public static boolean isArtistNameUnknown(@Nullable String artistName) { + if (TextUtils.isEmpty(artistName)) { + return false; } + if (artistName.equals(Artist.UNKNOWN_ARTIST_DISPLAY_NAME)) { + return true; + } + artistName = artistName.trim().toLowerCase(); + return artistName.equals("unknown") || artistName.equals(""); + } - @NonNull - public static String getSectionName(@Nullable String musicMediaTitle) { - if (TextUtils.isEmpty(musicMediaTitle)) { - return ""; - } - musicMediaTitle = musicMediaTitle.trim().toLowerCase(); - if (musicMediaTitle.startsWith("the ")) { - musicMediaTitle = musicMediaTitle.substring(4); - } else if (musicMediaTitle.startsWith("a ")) { - musicMediaTitle = musicMediaTitle.substring(2); - } - if (musicMediaTitle.isEmpty()) { - return ""; - } - return String.valueOf(musicMediaTitle.charAt(0)).toUpperCase(); + @NonNull + public static String getSectionName(@Nullable String musicMediaTitle) { + if (TextUtils.isEmpty(musicMediaTitle)) { + return ""; } + musicMediaTitle = musicMediaTitle.trim().toLowerCase(); + if (musicMediaTitle.startsWith("the ")) { + musicMediaTitle = musicMediaTitle.substring(4); + } else if (musicMediaTitle.startsWith("a ")) { + musicMediaTitle = musicMediaTitle.substring(2); + } + if (musicMediaTitle.isEmpty()) { + return ""; + } + return String.valueOf(musicMediaTitle.charAt(0)).toUpperCase(); + } - public static Playlist getPlaylist() { - return playlist; - } + public static Playlist getPlaylist() { + return playlist; + } - public static void setPlaylist(Playlist playlist) { - MusicUtil.playlist = playlist; - } + public static void setPlaylist(Playlist playlist) { + MusicUtil.playlist = playlist; + } - public static long getTotalDuration(@NonNull final Context context, @NonNull List songs) { - long duration = 0; - for (int i = 0; i < songs.size(); i++) { - duration += songs.get(i).duration; - } - return duration; + public static long getTotalDuration(@NonNull final Context context, @NonNull List songs) { + long duration = 0; + for (int i = 0; i < songs.size(); i++) { + duration += songs.get(i).duration; } + return duration; + } - @NonNull - public static String getYearString(int year) { - return year > 0 ? String.valueOf(year) : "-"; - } + @NonNull + public static String getYearString(int year) { + return year > 0 ? String.valueOf(year) : "-"; + } } diff --git a/app/src/main/java/code/name/monkey/retromusic/util/SwipeAndDragHelper.java b/app/src/main/java/code/name/monkey/retromusic/util/SwipeAndDragHelper.java deleted file mode 100644 index 52870404..00000000 --- a/app/src/main/java/code/name/monkey/retromusic/util/SwipeAndDragHelper.java +++ /dev/null @@ -1,55 +0,0 @@ -package code.name.monkey.retromusic.util; - -import android.graphics.Canvas; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.helper.ItemTouchHelper; - -public class SwipeAndDragHelper extends ItemTouchHelper.Callback { - - private ActionCompletionContract contract; - - public SwipeAndDragHelper(ActionCompletionContract contract) { - this.contract = contract; - } - - @Override - public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { - int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; - return makeMovementFlags(dragFlags, 0); - } - - @Override - public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { - contract.onViewMoved(viewHolder.getAdapterPosition(), target.getAdapterPosition()); - return true; - } - - @Override - public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { - } - - @Override - public boolean isLongPressDragEnabled() { - return false; - } - - @Override - public void onChildDraw(Canvas c, - RecyclerView recyclerView, - RecyclerView.ViewHolder viewHolder, - float dX, - float dY, - int actionState, - boolean isCurrentlyActive) { - if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) { - float alpha = 1 - (Math.abs(dX) / recyclerView.getWidth()); - viewHolder.itemView.setAlpha(alpha); - } - super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive); - } - - public interface ActionCompletionContract { - void onViewMoved(int oldPosition, int newPosition); - } - -} \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/ic_notification.png b/app/src/main/res/drawable-hdpi/ic_notification.png index f151b30a..609cbfe0 100644 Binary files a/app/src/main/res/drawable-hdpi/ic_notification.png and b/app/src/main/res/drawable-hdpi/ic_notification.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_notification.png b/app/src/main/res/drawable-mdpi/ic_notification.png index 611a6484..ee816ae5 100644 Binary files a/app/src/main/res/drawable-mdpi/ic_notification.png and b/app/src/main/res/drawable-mdpi/ic_notification.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_notification.png b/app/src/main/res/drawable-xhdpi/ic_notification.png index a02b4550..7a1dbf2f 100644 Binary files a/app/src/main/res/drawable-xhdpi/ic_notification.png and b/app/src/main/res/drawable-xhdpi/ic_notification.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_notification.png b/app/src/main/res/drawable-xxhdpi/ic_notification.png index 28f4890c..b78d1cdd 100644 Binary files a/app/src/main/res/drawable-xxhdpi/ic_notification.png and b/app/src/main/res/drawable-xxhdpi/ic_notification.png differ diff --git a/app/src/main/res/drawable/bg_circular_top_corners.xml b/app/src/main/res/drawable/bg_circular_top_corners.xml new file mode 100644 index 00000000..ba57cb30 --- /dev/null +++ b/app/src/main/res/drawable/bg_circular_top_corners.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/circler_corners.xml b/app/src/main/res/drawable/circler_corners.xml deleted file mode 100644 index 74954d1a..00000000 --- a/app/src/main/res/drawable/circler_corners.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_close_white_24dp.xml b/app/src/main/res/drawable/ic_close_white_24dp.xml index bbd0e311..f6775303 100644 --- a/app/src/main/res/drawable/ic_close_white_24dp.xml +++ b/app/src/main/res/drawable/ic_close_white_24dp.xml @@ -1,9 +1,9 @@ - + android:height="24dp" + android:viewportHeight="24" + android:viewportWidth="24" + android:width="24dp"> + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml index 7de11d5a..41bf969e 100644 --- a/app/src/main/res/drawable/ic_launcher_foreground.xml +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -1,14 +1,17 @@ - - + android:width="108dp" + android:height="108dp" + android:viewportWidth="135" + android:viewportHeight="135"> + + + + diff --git a/app/src/main/res/drawable/luis_gmzz.webp b/app/src/main/res/drawable/luis_gmzz.webp deleted file mode 100644 index f77b7039..00000000 Binary files a/app/src/main/res/drawable/luis_gmzz.webp and /dev/null differ diff --git a/app/src/main/res/drawable/round_window.xml b/app/src/main/res/drawable/round_window.xml index 7e4dcae2..40a02af8 100755 --- a/app/src/main/res/drawable/round_window.xml +++ b/app/src/main/res/drawable/round_window.xml @@ -1,5 +1,5 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/drawable/search_gradient.xml b/app/src/main/res/drawable/search_gradient.xml deleted file mode 100644 index 856e9def..00000000 --- a/app/src/main/res/drawable/search_gradient.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/square_window.xml b/app/src/main/res/drawable/square_window.xml index f18ea8dd..16787a09 100755 --- a/app/src/main/res/drawable/square_window.xml +++ b/app/src/main/res/drawable/square_window.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/thumb_material.xml b/app/src/main/res/drawable/thumb_material.xml deleted file mode 100644 index 8bd8cf9b..00000000 --- a/app/src/main/res/drawable/thumb_material.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/top_corners.xml b/app/src/main/res/drawable/top_corners.xml deleted file mode 100644 index d17bd811..00000000 --- a/app/src/main/res/drawable/top_corners.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-v24/layout_notification_collapsed.xml b/app/src/main/res/layout-v24/layout_notification_collapsed.xml index 903cc2f2..2d7d57d9 100644 --- a/app/src/main/res/layout-v24/layout_notification_collapsed.xml +++ b/app/src/main/res/layout-v24/layout_notification_collapsed.xml @@ -1,151 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + android:layout_alignParentStart="true" + android:layout_below="@id/app" + android:layout_toStartOf="@id/actions" + android:paddingBottom="12dp" + android:paddingStart="0dp" + android:paddingEnd="12dp" + android:orientation="vertical"> - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + \ No newline at end of file diff --git a/app/src/main/res/layout-v24/layout_notification_expanded.xml b/app/src/main/res/layout-v24/layout_notification_expanded.xml index 14f5b9f0..79c9f6df 100644 --- a/app/src/main/res/layout-v24/layout_notification_expanded.xml +++ b/app/src/main/res/layout-v24/layout_notification_expanded.xml @@ -1,143 +1,143 @@ + + + android:layout_height="match_parent" + android:layout_alignBottom="@+id/content" + android:layout_alignParentEnd="true"> - + - + - + - + + + + + + android:layout_marginStart="4dp" + android:ellipsize="end" + android:lines="1" + android:singleLine="true" + android:textSize="13sp" + tools:text="@string/app_name"/> - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge-land/fragment_blur.xml b/app/src/main/res/layout-xlarge-land/fragment_blur.xml index 894f6a6c..a5cf3aa1 100644 --- a/app/src/main/res/layout-xlarge-land/fragment_blur.xml +++ b/app/src/main/res/layout-xlarge-land/fragment_blur.xml @@ -1,123 +1,134 @@ + + + android:scaleType="centerCrop" + tools:src="@drawable/hemanth_s"/> - + - + - + + + + + + + + + android:layout_width="match_parent" + android:layout_height="wrap_content"> - + - - + + + android:layout_weight="1" + android:padding="24dp" + android:gravity="center" + android:orientation="vertical"> + + + + + + + + + + + + + + + - - - - + tools:background="@color/md_white_1000"> + + - - - - - - - - - - - - - - - - - - + - + \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/fragment_blur.xml b/app/src/main/res/layout-xlarge/fragment_blur.xml index 7944caf0..225855ca 100644 --- a/app/src/main/res/layout-xlarge/fragment_blur.xml +++ b/app/src/main/res/layout-xlarge/fragment_blur.xml @@ -13,12 +13,14 @@ android:layout_height="match_parent" android:scaleType="centerCrop" tools:src="@drawable/hemanth_s"/> + + + + + + + - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/fragment_mini_player.xml b/app/src/main/res/layout-xlarge/fragment_mini_player.xml deleted file mode 100644 index 64f764b2..00000000 --- a/app/src/main/res/layout-xlarge/fragment_mini_player.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_album.xml b/app/src/main/res/layout/activity_album.xml index 154255b4..aaca9424 100755 --- a/app/src/main/res/layout/activity_album.xml +++ b/app/src/main/res/layout/activity_album.xml @@ -1,164 +1,170 @@ + + + android:layout_height="wrap_content"> - + - - - - - - - - - - - - - - - + android:background="@android:color/transparent" + app:layout_collapseMode="parallax"> + + + + + + + + + + + + + + + + + + + + + android:maxLines="2" + android:textAppearance="@style/TextAppearance.AppCompat.Title" + tools:ignore="MissingPrefix"/> - + - - - - - - - - - - - - - - - - - - - + - + android:paddingTop="12dp" + android:paddingBottom="12dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + android:text="@string/songs" + android:textAppearance="@style/TextAppearance.AppCompat.Subhead" + tools:ignore="MissingPrefix"/> + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_artist_details.xml b/app/src/main/res/layout/activity_artist_details.xml index 78ac4f5c..80f043d7 100755 --- a/app/src/main/res/layout/activity_artist_details.xml +++ b/app/src/main/res/layout/activity_artist_details.xml @@ -1,174 +1,178 @@ + + + android:layout_height="wrap_content"> - + - - - - - - - - - - - - - - - - + android:background="@android:color/transparent" + app:layout_collapseMode="parallax"> + + + + + + + + + + + + + + + + + + + + android:maxLines="2" + android:textAppearance="@style/TextAppearance.AppCompat.Title" + tools:ignore="MissingPrefix" + tools:text="Title"/> - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_lyrics.xml b/app/src/main/res/layout/activity_lyrics.xml index fd456d26..485abb2f 100644 --- a/app/src/main/res/layout/activity_lyrics.xml +++ b/app/src/main/res/layout/activity_lyrics.xml @@ -6,119 +6,96 @@ android:layout_height="match_parent" android:orientation="vertical"> - - - - - - - - - - - - - - - - - - - - + android:layout_weight="0" + android:padding="12dp" + android:src="@drawable/ic_keyboard_backspace_black_24dp"/> - - - + + + + + + + + + + @@ -126,8 +103,14 @@ + android:layout_height="match_parent"> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/card_credit.xml b/app/src/main/res/layout/card_credit.xml index b23b0c75..2a10b3ce 100644 --- a/app/src/main/res/layout/card_credit.xml +++ b/app/src/main/res/layout/card_credit.xml @@ -1,185 +1,185 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> - + + + + + android:padding="12dp" + android:text="@string/credit_title" + android:textAppearance="@style/TextAppearance.AppCompat.Title" + android:textColor="@color/md_white_1000" + tools:ignore="MissingPrefix"/> + + + + + + + android:text="@string/marko_name" + android:textAppearance="@style/TextAppearance.AppCompat.Subhead" + android:textColor="@color/md_white_1000"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - + android:paddingStart="16dp" + android:paddingEnd="0dp" + android:background="?attr/rectSelector" + android:clickable="true" + android:focusable="true" + android:gravity="center_vertical" + android:minHeight="@dimen/md_listitem_height" + android:orientation="horizontal" + tools:ignore="PrivateResource"> + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 75e6a099..0d918197 100755 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -1,102 +1,102 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent"> - + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + android:layout_weight="1" + android:gravity="center" + android:text="@string/app_name" + android:textAppearance="@style/TextAppearance.AppCompat.Title" + tools:ignore="MissingPrefix"/> - - - + - + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_mini_player.xml b/app/src/main/res/layout/fragment_mini_player.xml index 700e9fe3..75b0e0a8 100644 --- a/app/src/main/res/layout/fragment_mini_player.xml +++ b/app/src/main/res/layout/fragment_mini_player.xml @@ -1,63 +1,63 @@ + + + android:layout_height="match_parent" + android:orientation="horizontal"> - + - + - + - + - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_notification_collapsed.xml b/app/src/main/res/layout/layout_notification_collapsed.xml index b6cf1664..2d7d57d9 100644 --- a/app/src/main/res/layout/layout_notification_collapsed.xml +++ b/app/src/main/res/layout/layout_notification_collapsed.xml @@ -1,146 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + android:layout_alignParentStart="true" + android:layout_below="@id/app" + android:layout_toStartOf="@id/actions" + android:paddingBottom="12dp" + android:paddingStart="0dp" + android:paddingEnd="12dp" + android:orientation="vertical"> - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_notification_expanded.xml b/app/src/main/res/layout/layout_notification_expanded.xml index 6c812487..37003b99 100644 --- a/app/src/main/res/layout/layout_notification_expanded.xml +++ b/app/src/main/res/layout/layout_notification_expanded.xml @@ -1,130 +1,135 @@ + + + android:layout_height="match_parent" + android:layout_alignBottom="@+id/content" + android:layout_alignParentEnd="true"> - + - + - + - + + + + + + android:layout_marginStart="4dp" + android:ellipsize="end" + android:lines="1" + android:singleLine="true" + android:textSize="13sp" + tools:text="@string/app_name"/> - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png index 3a41fb79..e458a06e 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_background.png b/app/src/main/res/mipmap-hdpi/ic_launcher_background.png index be518e47..9bc0251f 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_background.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png index 6ebce6af..ba190388 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png index 3a41fb79..e458a06e 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png index c79b24c6..352f7800 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_background.png b/app/src/main/res/mipmap-mdpi/ic_launcher_background.png index aa1d5dcc..d16a54a1 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_background.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png index 78e39207..40696361 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png index c79b24c6..352f7800 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 50e9924d..eb643e0a 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png index cfa84500..e6f9dbdf 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png index 8a578a54..e266d07c 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png index 50e9924d..eb643e0a 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 26d80b11..30ae7df3 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png index b8496ea9..ca9082b5 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png index da463283..1198d4ea 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png index 26d80b11..30ae7df3 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 3156b0c1..5e914389 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png index ced4c990..e2be82e7 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png index df3db4d5..f63423f9 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png index 3156b0c1..5e914389 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 238f3739..0d4ca1cc 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -1,30 +1,44 @@ - - - + + + - + - + - - + + - - - + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 23eb2e78..3e4afcef 100755 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -38,8 +38,8 @@ fonts/circular_std_book.otf fonts/product_sans_regular.ttf fonts/product_sans_bold.ttf - Leo - Moderator + Marko Ivanović + Contributor Gaming Inc Discord server maintainer Moderator diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 39a025c1..a5d7a46c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -401,10 +401,10 @@ Can increase the album cover quality, but causes slower image loading times. Only enable this if you have problems with low resolution artworks Change app language forcefully to english(this is testing for multiple language option) Configure visibility and order of library categories. - Use Retro Music's custom lockscreen controls + Use Retro Music\'s custom lockscreen controls Show full controls from the lock screen License details for open source software - Round the app's edges + Round the app\'s edges Toggle titles for the bottom navigation bar tabs Animations makes some device run slow, load images slow Disable titles from bottom navigation bar diff --git a/app/src/main/res/xml/pref_advanced.xml b/app/src/main/res/xml/pref_advanced.xml index fc02bf3a..e3706485 100755 --- a/app/src/main/res/xml/pref_advanced.xml +++ b/app/src/main/res/xml/pref_advanced.xml @@ -15,9 +15,9 @@ android:title="@string/pref_title_toggle_toggle_shuffle" />