v2.2.100
This commit is contained in:
parent
b70c66abeb
commit
6001b21c42
72 changed files with 1809 additions and 1420 deletions
|
@ -93,7 +93,7 @@ public class LyricsActivity extends AbsMusicServiceActivity implements
|
|||
setTaskDescriptionColorAuto();
|
||||
setNavigationbarColorAuto();
|
||||
|
||||
fitSystemWindowsLayout.setFit(true);
|
||||
fitSystemWindowsLayout.setFit(!PreferenceUtil.getInstance().getFullScreenMode());
|
||||
|
||||
setSupportActionBar(bottomAppBar);
|
||||
Objects.requireNonNull(bottomAppBar.getNavigationIcon())
|
||||
|
|
|
@ -99,7 +99,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity implements Shared
|
|||
|
||||
if (savedInstanceState == null) {
|
||||
selectedFragment(PreferenceUtil.getInstance().getLastPage());
|
||||
//setCurrentFragment(new LibraryFragment(), false, LibraryFragment.TAG);
|
||||
} else {
|
||||
restoreCurrentFragment();
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ public class NowPayingActivity extends AbsMusicServiceActivity implements AbsPla
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setLightNavigationBar(true);
|
||||
setDrawUnderNavigationBar();
|
||||
setupWindowTransition();
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_now_playng);
|
||||
|
@ -65,19 +66,30 @@ public class NowPayingActivity extends AbsMusicServiceActivity implements AbsPla
|
|||
@Override
|
||||
public void onPaletteColorChanged() {
|
||||
int paletteColor = playerFragment.getPaletteColor();
|
||||
boolean isColorLight = ColorUtil.isColorLight(paletteColor);
|
||||
super.setTaskDescriptionColor(paletteColor);
|
||||
if ((currentNowPlayingScreen == NowPlayingScreen.FLAT || currentNowPlayingScreen == NowPlayingScreen.NORMAL) && PreferenceUtil.getInstance().getAdaptiveColor()) {
|
||||
setLightNavigationBar(true);
|
||||
setLightStatusbar(ColorUtil.isColorLight(paletteColor));
|
||||
setLightNavigationBar(ColorUtil.isColorLight(ThemeStore.primaryColor(this)));
|
||||
setLightStatusbar(isColorLight);
|
||||
} else if (currentNowPlayingScreen == NowPlayingScreen.COLOR) {
|
||||
setLightStatusbar(ColorUtil.isColorLight(paletteColor));
|
||||
setLightStatusbar(isColorLight);
|
||||
setLightNavigationBar(isColorLight);
|
||||
setNavigationbarColor(paletteColor);
|
||||
} else if (currentNowPlayingScreen == NowPlayingScreen.BLUR || currentNowPlayingScreen == NowPlayingScreen.BLUR_CARD) {
|
||||
setLightStatusbar(false);
|
||||
setLightNavigationBar(false);
|
||||
} else if (currentNowPlayingScreen == NowPlayingScreen.CARD || currentNowPlayingScreen == NowPlayingScreen.FULL) {
|
||||
setNavigationbarColor(Color.TRANSPARENT);
|
||||
setLightStatusbar(false);
|
||||
setLightNavigationBar(false);
|
||||
} else if (currentNowPlayingScreen == NowPlayingScreen.FIT) {
|
||||
setNavigationbarColor(ThemeStore.primaryColor(this));
|
||||
setLightNavigationBar(ColorUtil.isColorLight(ThemeStore.primaryColor(this)));
|
||||
setLightStatusbar(false);
|
||||
} else {
|
||||
boolean isTheme = isOneOfTheseThemes() && ColorUtil.isColorLight(ThemeStore.primaryColor(this));
|
||||
setStatusbarColor(Color.TRANSPARENT);
|
||||
setLightStatusbar(isOneOfTheseThemes() && ColorUtil.isColorLight(ThemeStore.primaryColor(this)));
|
||||
setNavigationbarColorAuto();
|
||||
setLightStatusbar(isTheme);
|
||||
setLightNavigationBar(isTheme);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,6 +167,8 @@ public class NowPayingActivity extends AbsMusicServiceActivity implements AbsPla
|
|||
|
||||
playerFragment = (AbsPlayerFragment) getSupportFragmentManager()
|
||||
.findFragmentById(R.id.player_fragment_container);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,19 +5,28 @@ import android.os.Bundle;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
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 androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import butterknife.BindDrawable;
|
||||
import butterknife.BindString;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.ToolbarContentTintHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
||||
import code.name.monkey.retromusic.ui.activities.base.AbsMusicServiceActivity;
|
||||
import code.name.monkey.retromusic.ui.fragments.PlayingQueueFragment;
|
||||
import code.name.monkey.retromusic.ui.adapter.song.PlayingQueueAdapter;
|
||||
import code.name.monkey.retromusic.util.MusicUtil;
|
||||
import code.name.monkey.retromusic.views.CollapsingFAB;
|
||||
|
||||
|
||||
public class PlayingQueueActivity extends AbsMusicServiceActivity {
|
||||
|
@ -40,6 +49,17 @@ public class PlayingQueueActivity extends AbsMusicServiceActivity {
|
|||
@BindView(R.id.title)
|
||||
TextView title;
|
||||
|
||||
@BindView(R.id.recycler_view)
|
||||
RecyclerView mRecyclerView;
|
||||
|
||||
@BindView(R.id.clear_queue)
|
||||
CollapsingFAB clearQueue;
|
||||
|
||||
private RecyclerView.Adapter mWrappedAdapter;
|
||||
private RecyclerViewDragDropManager mRecyclerViewDragDropManager;
|
||||
private PlayingQueueAdapter mPlayingQueueAdapter;
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -52,11 +72,109 @@ public class PlayingQueueActivity extends AbsMusicServiceActivity {
|
|||
setLightNavigationBar(true);
|
||||
|
||||
setupToolbar();
|
||||
if (savedInstanceState == null) {
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.fragment_container, new PlayingQueueFragment())
|
||||
.commit();
|
||||
setUpRecyclerView();
|
||||
}
|
||||
|
||||
private void setUpRecyclerView() {
|
||||
mRecyclerViewDragDropManager = new RecyclerViewDragDropManager();
|
||||
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
|
||||
|
||||
mPlayingQueueAdapter = new PlayingQueueAdapter(
|
||||
this,
|
||||
MusicPlayerRemote.getPlayingQueue(),
|
||||
MusicPlayerRemote.getPosition(),
|
||||
R.layout.item_queue);
|
||||
mWrappedAdapter = mRecyclerViewDragDropManager.createWrappedAdapter(mPlayingQueueAdapter);
|
||||
|
||||
mLayoutManager = new LinearLayoutManager(this);
|
||||
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mRecyclerView.setAdapter(mWrappedAdapter);
|
||||
mRecyclerView.setItemAnimator(animator);
|
||||
mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
|
||||
mLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.getPosition() + 1, 0);
|
||||
|
||||
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
super.onScrolled(recyclerView, dx, dy);
|
||||
if (dy > 0) {
|
||||
clearQueue.setShowTitle(false);
|
||||
} else if (dy < 0) {
|
||||
clearQueue.setShowTitle(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueueChanged() {
|
||||
if (MusicPlayerRemote.getPlayingQueue().isEmpty()) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
updateQueue();
|
||||
updateCurrentSong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMediaStoreChanged() {
|
||||
updateQueue();
|
||||
updateCurrentSong();
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
private void updateCurrentSong() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayingMetaChanged() {
|
||||
updateQueuePosition();
|
||||
}
|
||||
|
||||
private void updateQueuePosition() {
|
||||
mPlayingQueueAdapter.setCurrent(MusicPlayerRemote.getPosition());
|
||||
resetToCurrentPosition();
|
||||
}
|
||||
|
||||
private void updateQueue() {
|
||||
mPlayingQueueAdapter.swapDataSet(MusicPlayerRemote.getPlayingQueue(), MusicPlayerRemote.getPosition());
|
||||
resetToCurrentPosition();
|
||||
}
|
||||
|
||||
private void resetToCurrentPosition() {
|
||||
mRecyclerView.stopScroll();
|
||||
mLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.getPosition() + 1, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
if (mRecyclerViewDragDropManager != null) {
|
||||
mRecyclerViewDragDropManager.cancelDrag();
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (mRecyclerViewDragDropManager != null) {
|
||||
mRecyclerViewDragDropManager.release();
|
||||
mRecyclerViewDragDropManager = null;
|
||||
}
|
||||
|
||||
if (mRecyclerView != null) {
|
||||
mRecyclerView.setItemAnimator(null);
|
||||
mRecyclerView.setAdapter(null);
|
||||
mRecyclerView = null;
|
||||
}
|
||||
|
||||
if (mWrappedAdapter != null) {
|
||||
WrapperAdapterUtils.releaseAll(mWrappedAdapter);
|
||||
mWrappedAdapter = null;
|
||||
}
|
||||
mPlayingQueueAdapter = null;
|
||||
mLayoutManager = null;
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
protected String getUpNextAndQueueTime() {
|
||||
|
@ -75,5 +193,11 @@ public class PlayingQueueActivity extends AbsMusicServiceActivity {
|
|||
setTitle(null);
|
||||
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
||||
ToolbarContentTintHelper.colorBackButton(toolbar, ThemeStore.accentColor(this));
|
||||
clearQueue.setColor(ThemeStore.accentColor(this));
|
||||
}
|
||||
|
||||
@OnClick(R.id.clear_queue)
|
||||
void clearQueue() {
|
||||
MusicPlayerRemote.clearQueue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package code.name.monkey.retromusic.ui.activities;
|
|||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Paint;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
@ -14,6 +15,7 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog;
|
||||
import com.afollestad.materialdialogs.internal.MDTintHelper;
|
||||
import com.anjlab.android.iab.v3.BillingProcessor;
|
||||
import com.anjlab.android.iab.v3.SkuDetails;
|
||||
|
@ -57,31 +59,25 @@ import static code.name.monkey.retromusic.Constants.PAYPAL_ME_URL;
|
|||
public class SupportDevelopmentActivity extends AbsBaseActivity implements BillingProcessor.IBillingHandler {
|
||||
public static final String TAG = SupportDevelopmentActivity.class.getSimpleName();
|
||||
private static final int DONATION_PRODUCT_IDS = R.array.donation_ids;
|
||||
private static final int TEZ_REQUEST_CODE = 123;
|
||||
private static final String GOOGLE_TEZ_PACKAGE_NAME = "com.google.android.apps.nbu.paisa.user";
|
||||
|
||||
@BindView(R.id.progress)
|
||||
ProgressBar progressBar;
|
||||
|
||||
@BindView(R.id.progress_container)
|
||||
View progressContainer;
|
||||
|
||||
@BindView(R.id.list)
|
||||
RecyclerView recyclerView;
|
||||
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
|
||||
@BindView(R.id.app_bar)
|
||||
AppBarLayout appBarLayout;
|
||||
|
||||
@BindView(R.id.root)
|
||||
ViewGroup viewGroup;
|
||||
|
||||
@BindView(R.id.title)
|
||||
TextView title;
|
||||
|
||||
@BindView(R.id.donate)
|
||||
MaterialButton materialButton;
|
||||
|
||||
private BillingProcessor billingProcessor;
|
||||
private AsyncTask skuDetailsLoadAsyncTask;
|
||||
|
||||
|
@ -192,6 +188,10 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
|
|||
if (!billingProcessor.handleActivityResult(requestCode, resultCode, data)) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
if (requestCode == TEZ_REQUEST_CODE) {
|
||||
// Process based on the data in response.
|
||||
Log.d("result", data.getStringExtra("Status"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -205,6 +205,33 @@ public class SupportDevelopmentActivity extends AbsBaseActivity implements Billi
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
@OnClick(R.id.google_pay)
|
||||
void googlePay() {
|
||||
|
||||
new MaterialDialog.Builder(this)
|
||||
.title(R.string.support_development)
|
||||
.input("Enter amount", null, false, (dialog, input) -> {
|
||||
Uri uri = new Uri.Builder()
|
||||
.scheme("upi")
|
||||
.authority("pay")
|
||||
.appendQueryParameter("pa", "hemanth.vaniraviram@okaxis")
|
||||
.appendQueryParameter("pn", "Retro Music")
|
||||
.appendQueryParameter("mc", "1234")
|
||||
.appendQueryParameter("tr", "7406201323")
|
||||
.appendQueryParameter("tn", "Retro Music Player Donation")
|
||||
.appendQueryParameter("am", "10.01")
|
||||
.appendQueryParameter("cu", "INR")
|
||||
.build();
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(uri);
|
||||
intent.setPackage(GOOGLE_TEZ_PACKAGE_NAME);
|
||||
startActivityForResult(intent, TEZ_REQUEST_CODE);
|
||||
}).positiveText("Donate")
|
||||
.onPositive((dialog, which) -> {
|
||||
|
||||
}).show();
|
||||
}
|
||||
|
||||
private static class SkuDetailsLoadAsyncTask extends AsyncTask<Void, Void, List<SkuDetails>> {
|
||||
private final WeakReference<SupportDevelopmentActivity> donationDialogWeakReference;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import android.view.ViewGroup;
|
|||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.PathInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import com.google.android.gms.cast.framework.CastSession;
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
|
@ -21,7 +20,6 @@ import com.sothree.slidinguppanel.SlidingUpPanelLayout.PanelState;
|
|||
import androidx.annotation.FloatRange;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
@ -45,10 +43,10 @@ import code.name.monkey.retromusic.ui.fragments.player.material.MaterialFragment
|
|||
import code.name.monkey.retromusic.ui.fragments.player.normal.PlayerFragment;
|
||||
import code.name.monkey.retromusic.ui.fragments.player.plain.PlainPlayerFragment;
|
||||
import code.name.monkey.retromusic.ui.fragments.player.simple.SimplePlayerFragment;
|
||||
import code.name.monkey.retromusic.util.NavigationUtil;
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
import code.name.monkey.retromusic.util.ViewUtil;
|
||||
import code.name.monkey.retromusic.views.BottomNavigationBarTinted;
|
||||
import code.name.monkey.retromusic.views.FitSystemWindowsLayout;
|
||||
|
||||
public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivity implements
|
||||
SlidingUpPanelLayout.PanelSlideListener, PlayerFragment.Callbacks {
|
||||
|
@ -227,61 +225,6 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
|
||||
}
|
||||
|
||||
protected void applyInsets() {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(coordinatorLayout, (v, insets) -> {
|
||||
//Bottom navigation view
|
||||
ViewGroup.MarginLayoutParams bParams = (ViewGroup.MarginLayoutParams) bottomNavigationView.getLayoutParams();
|
||||
if (!PreferenceUtil.getInstance().getFullScreenMode())
|
||||
bParams.bottomMargin = insets.getSystemWindowInsetBottom();
|
||||
bParams.rightMargin = insets.getSystemWindowInsetRight();
|
||||
bParams.leftMargin = insets.getSystemWindowInsetLeft();
|
||||
|
||||
|
||||
//For now playing screen
|
||||
FrameLayout layout = findViewById(R.id.safeArea);
|
||||
if (layout != null) {
|
||||
ViewGroup.MarginLayoutParams fParams = (ViewGroup.MarginLayoutParams) layout.getLayoutParams();
|
||||
if (!PreferenceUtil.getInstance().getFullScreenMode()) {
|
||||
fParams.topMargin = insets.getSystemWindowInsetTop();
|
||||
fParams.bottomMargin = insets.getSystemWindowInsetBottom();
|
||||
}
|
||||
fParams.leftMargin = insets.getSystemWindowInsetLeft();
|
||||
fParams.rightMargin = insets.getSystemWindowInsetRight();
|
||||
}
|
||||
|
||||
//Mini player
|
||||
FitSystemWindowsLayout miniPlayer = (FitSystemWindowsLayout) miniPlayerFragment.getView();
|
||||
if (miniPlayer != null) {
|
||||
ViewGroup.MarginLayoutParams mParams = (ViewGroup.MarginLayoutParams) miniPlayer.getLayoutParams();
|
||||
mParams.bottomMargin = insets.getSystemWindowInsetBottom();//RetroUtil.checkNavigationBarHeight() ? 0 : getResources().getDimensionPixelSize(R.dimen.mini_player_height);
|
||||
mParams.leftMargin = insets.getSystemWindowInsetLeft();
|
||||
mParams.rightMargin = insets.getSystemWindowInsetRight();
|
||||
}
|
||||
|
||||
//For Library, Folder, Home etc
|
||||
ViewGroup viewGroup = findViewById(R.id.content_container);
|
||||
if (viewGroup != null) {
|
||||
ViewGroup.MarginLayoutParams mParams = (ViewGroup.MarginLayoutParams) viewGroup.getLayoutParams();
|
||||
mParams.leftMargin = insets.getSystemWindowInsetLeft();
|
||||
mParams.rightMargin = insets.getSystemWindowInsetRight();
|
||||
mParams.bottomMargin = insets.getSystemWindowInsetBottom();
|
||||
}
|
||||
|
||||
FrameLayout frameLayout = findViewById(R.id.sliding_panel);
|
||||
if (frameLayout != null) {
|
||||
ViewGroup.MarginLayoutParams mParams = (ViewGroup.MarginLayoutParams) frameLayout.getLayoutParams();
|
||||
mParams.leftMargin = insets.getSystemWindowInsetLeft();
|
||||
mParams.rightMargin = insets.getSystemWindowInsetRight();
|
||||
if (!PreferenceUtil.getInstance().getFullScreenMode()) {
|
||||
mParams.bottomMargin = insets.getSystemWindowInsetBottom();
|
||||
}
|
||||
}
|
||||
|
||||
coordinatorLayout.setOnApplyWindowInsetsListener(null);
|
||||
return insets.consumeSystemWindowInsets();
|
||||
});
|
||||
}
|
||||
|
||||
public SlidingUpPanelLayout.PanelState getPanelState() {
|
||||
return slidingUpPanelLayout == null ? null : slidingUpPanelLayout.getPanelState();
|
||||
}
|
||||
|
@ -313,7 +256,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
// restore values
|
||||
super.setLightStatusbar(lightStatusbar);
|
||||
super.setTaskDescriptionColor(taskColor);
|
||||
super.setNavigationbarColor(ThemeStore.primaryColor(this));
|
||||
super.setNavigationbarColor(navigationbarColor);
|
||||
super.setLightNavigationBar(lightNavigationBar);
|
||||
|
||||
|
||||
|
@ -325,12 +268,11 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
public void onPanelExpanded(View panel) {
|
||||
int playerFragmentColor = playerFragment.getPaletteColor();
|
||||
super.setTaskDescriptionColor(playerFragmentColor);
|
||||
super.setLightStatusbar(lightStatusbar);
|
||||
|
||||
playerFragment.setMenuVisibility(true);
|
||||
playerFragment.setUserVisibleHint(true);
|
||||
playerFragment.onShow();
|
||||
|
||||
onPaletteColorChanged();
|
||||
}
|
||||
|
||||
private void setMiniPlayerAlphaProgress(@FloatRange(from = 0, to = 1) float progress) {
|
||||
|
@ -395,6 +337,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
|
||||
//noinspection ConstantConditions
|
||||
miniPlayerFragment.getView().setOnClickListener(v -> expandPanel());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -437,7 +380,8 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
super.setLightStatusbar(false);
|
||||
super.setLightNavigationBar(ColorUtil.isColorLight(ThemeStore.primaryColor(this)));
|
||||
} else if (currentNowPlayingScreen == NowPlayingScreen.FIT) {
|
||||
super.setNavigationbarColor(Color.TRANSPARENT);
|
||||
super.setNavigationbarColor(ThemeStore.primaryColor(this));
|
||||
super.setLightNavigationBar(ColorUtil.isColorLight(ThemeStore.primaryColor(this)));
|
||||
super.setLightStatusbar(false);
|
||||
} else {
|
||||
boolean isTheme = isOneOfTheseThemes() && ColorUtil.isColorLight(ThemeStore.primaryColor(this));
|
||||
|
@ -476,13 +420,21 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
|
||||
@Override
|
||||
public void setNavigationbarColor(int color) {
|
||||
this.navigationbarColor = color;
|
||||
if (getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||
navigationbarColor = color;
|
||||
if (getPanelState() == PanelState.COLLAPSED) {
|
||||
if (navigationBarColorAnimator != null) navigationBarColorAnimator.cancel();
|
||||
super.setNavigationbarColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTaskDescriptionColor(int color) {
|
||||
taskColor = color;
|
||||
if (getPanelState() == PanelState.COLLAPSED) {
|
||||
super.setTaskDescriptionColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
private void animateNavigationBarColor(int color) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (navigationBarColorAnimator != null) navigationBarColorAnimator.cancel();
|
||||
|
|
|
@ -74,6 +74,7 @@ public class CollageSongAdapter extends RecyclerView.Adapter<CollageSongViewHold
|
|||
R.id.image_7, R.id.image_8, R.id.image_9})
|
||||
@Nullable
|
||||
List<ImageView> imageViews;
|
||||
|
||||
@BindView(R.id.image_1)
|
||||
TextView view;
|
||||
|
||||
|
@ -82,6 +83,9 @@ public class CollageSongAdapter extends RecyclerView.Adapter<CollageSongViewHold
|
|||
ButterKnife.bind(this, itemView);
|
||||
Context context = itemView.getContext();
|
||||
int color = ThemeStore.accentColor(context);
|
||||
view.setOnClickListener(v -> {
|
||||
MusicPlayerRemote.openQueue(dataSet, 0, true);
|
||||
});
|
||||
view.setBackgroundColor(color);
|
||||
view.setTextColor(MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(color)));
|
||||
}
|
||||
|
|
|
@ -22,12 +22,16 @@ import code.name.monkey.retromusic.R;
|
|||
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
||||
import code.name.monkey.retromusic.ui.adapter.song.PlayingQueueAdapter;
|
||||
import code.name.monkey.retromusic.ui.fragments.base.AbsMusicServiceFragment;
|
||||
import code.name.monkey.retromusic.views.CollapsingFAB;
|
||||
|
||||
public class PlayingQueueFragment extends AbsMusicServiceFragment {
|
||||
|
||||
@BindView(R.id.recycler_view)
|
||||
RecyclerView mRecyclerView;
|
||||
|
||||
|
||||
Unbinder unbinder;
|
||||
|
||||
private RecyclerView.Adapter mWrappedAdapter;
|
||||
private RecyclerViewDragDropManager mRecyclerViewDragDropManager;
|
||||
private PlayingQueueAdapter mPlayingQueueAdapter;
|
||||
|
@ -66,6 +70,7 @@ public class PlayingQueueFragment extends AbsMusicServiceFragment {
|
|||
mRecyclerView.setItemAnimator(animator);
|
||||
mRecyclerViewDragDropManager.attachRecyclerView(mRecyclerView);
|
||||
mLayoutManager.scrollToPositionWithOffset(MusicPlayerRemote.getPosition() + 1, 0);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,6 +34,7 @@ import code.name.monkey.retromusic.util.MusicUtil;
|
|||
import code.name.monkey.retromusic.util.NavigationUtil;
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
import code.name.monkey.retromusic.util.RetroUtil;
|
||||
import code.name.monkey.retromusic.views.FitSystemWindowsLayout;
|
||||
|
||||
public abstract class AbsPlayerFragment extends AbsMusicServiceFragment implements Toolbar.OnMenuItemClickListener, PaletteColorHolder {
|
||||
public static final String TAG = AbsPlayerFragment.class.getSimpleName();
|
||||
|
@ -208,12 +209,20 @@ public abstract class AbsPlayerFragment extends AbsMusicServiceFragment implemen
|
|||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
view.setBackgroundColor(ThemeStore.primaryColor(getActivity()));
|
||||
|
||||
if (PreferenceUtil.getInstance().getFullScreenMode()) {
|
||||
if (view.findViewById(R.id.status_bar) != null)
|
||||
view.findViewById(R.id.status_bar).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSafeArea(View safeArea) {
|
||||
FitSystemWindowsLayout layout = safeArea.findViewById(R.id.safeArea);
|
||||
if (layout != null) {
|
||||
layout.setFit(!PreferenceUtil.getInstance().getFullScreenMode());
|
||||
}
|
||||
}
|
||||
|
||||
public interface Callbacks {
|
||||
|
||||
void onPaletteColorChanged();
|
||||
|
|
|
@ -238,11 +238,11 @@ public class FoldersFragment extends AbsMainActivityFragment implements
|
|||
int primaryColor = ThemeStore.primaryColor(getContext());
|
||||
|
||||
|
||||
toolbar.setNavigationIcon(R.drawable.ic_menu_white_24dp);
|
||||
toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_black_24dp);
|
||||
//noinspection ConstantConditions
|
||||
getActivity().setTitle(null);
|
||||
getMainActivity().setSupportActionBar(toolbar);
|
||||
toolbar.setNavigationOnClickListener(v -> showMainMenu());
|
||||
toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed());
|
||||
TintHelper.setTintAuto(container, primaryColor, true);
|
||||
appbar.setBackgroundColor(primaryColor);
|
||||
toolbar.setBackgroundColor(primaryColor);
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.Random;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
@ -31,7 +30,6 @@ import butterknife.ButterKnife;
|
|||
import butterknife.OnClick;
|
||||
import butterknife.Unbinder;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.TintHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.helper.MusicPlayerRemote;
|
||||
import code.name.monkey.retromusic.interfaces.MainActivityFragmentCallbacks;
|
||||
|
@ -67,8 +65,6 @@ import static code.name.monkey.retromusic.Constants.USER_PROFILE;
|
|||
public class BannerHomeFragment extends AbsMainActivityFragment implements MainActivityFragmentCallbacks, HomeContract.HomeView {
|
||||
|
||||
public static final String TAG = "BannerHomeFragment";
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
|
||||
@BindView(R.id.image)
|
||||
@Nullable
|
||||
|
@ -110,6 +106,9 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
|
|||
@BindView(R.id.container)
|
||||
View container;
|
||||
|
||||
@BindView(R.id.content_container)
|
||||
View contentContainer;
|
||||
|
||||
@BindView(R.id.suggestion_songs)
|
||||
RecyclerView suggestionsSongs;
|
||||
|
||||
|
@ -204,10 +203,11 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
|
|||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(PreferenceUtil.getInstance().toggleHomeBanner() ? R.layout.fragment_banner_home : R.layout.fragment_home,
|
||||
View view = inflater.inflate(PreferenceUtil.getInstance().isHomeBanner() ? R.layout.fragment_banner_home : R.layout.fragment_home,
|
||||
container, false);
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
setStatusbarColorAuto(view);
|
||||
if (!PreferenceUtil.getInstance().isHomeBanner())
|
||||
setStatusbarColorAuto(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -217,20 +217,18 @@ public class BannerHomeFragment extends AbsMainActivityFragment implements MainA
|
|||
setupToolbar();
|
||||
loadImageFromStorage(userImage);
|
||||
homePresenter.subscribe();
|
||||
getTimeOfTheDay(PreferenceUtil.getInstance().toggleHomeBanner());
|
||||
getTimeOfTheDay(PreferenceUtil.getInstance().isHomeBanner());
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
private void setupToolbar() {
|
||||
int primaryColor = ThemeStore.primaryColor(getContext());
|
||||
TintHelper.setTintAuto(container, primaryColor, true);
|
||||
userImage.setOnClickListener(v -> showMainMenu());
|
||||
contentContainer.setBackgroundColor(ThemeStore.primaryColor(getMainActivity()));
|
||||
}
|
||||
|
||||
getActivity().setTitle(null);
|
||||
getMainActivity().setSupportActionBar(toolbar);
|
||||
toolbar.setNavigationIcon(RetroUtil.getTintedDrawable(getMainActivity(), R.drawable.ic_menu_white_24dp, ThemeStore.textColorPrimary(getMainActivity())));
|
||||
toolbar.setOnClickListener(v -> NavigationUtil.goToSearch(getMainActivity()));
|
||||
toolbar.setNavigationOnClickListener(v -> showMainMenu());
|
||||
@OnClick(R.id.searchIcon)
|
||||
void search() {
|
||||
NavigationUtil.goToSearch(getMainActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -146,14 +146,12 @@ public class BlurPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
|||
@Override
|
||||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
setUpSubFragments();
|
||||
setUpPlayerToolbar();
|
||||
}
|
||||
|
||||
private void setUpSubFragments() {
|
||||
playbackControlsFragment = (BlurPlaybackControlsFragment) getChildFragmentManager()
|
||||
.findFragmentById(R.id.playback_controls_fragment);
|
||||
playbackControlsFragment = (BlurPlaybackControlsFragment) getChildFragmentManager().findFragmentById(R.id.playback_controls_fragment);
|
||||
|
||||
PlayerAlbumCoverFragment playerAlbumCoverFragment =
|
||||
(PlayerAlbumCoverFragment) getChildFragmentManager()
|
||||
|
@ -269,6 +267,5 @@ public class BlurPlayerFragment extends AbsPlayerFragment implements PlayerAlbum
|
|||
recyclerView.stopScroll();
|
||||
layoutManager.scrollToPositionWithOffset(MusicPlayerRemote.getPosition() + 1, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,6 @@ public class PlayerFragment extends AbsPlayerFragment implements PlayerAlbumCove
|
|||
@Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_player, container, false);
|
||||
unbinder = ButterKnife.bind(this, view);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -147,12 +146,8 @@ public class PlayerFragment extends AbsPlayerFragment implements PlayerAlbumCove
|
|||
}
|
||||
|
||||
private void setUpSubFragments() {
|
||||
playbackControlsFragment = (PlayerPlaybackControlsFragment) getChildFragmentManager()
|
||||
.findFragmentById(R.id.playback_controls_fragment);
|
||||
|
||||
PlayerAlbumCoverFragment playerAlbumCoverFragment =
|
||||
(PlayerAlbumCoverFragment) getChildFragmentManager()
|
||||
.findFragmentById(R.id.player_album_cover_fragment);
|
||||
playbackControlsFragment = (PlayerPlaybackControlsFragment) getChildFragmentManager().findFragmentById(R.id.playback_controls_fragment);
|
||||
PlayerAlbumCoverFragment playerAlbumCoverFragment = (PlayerAlbumCoverFragment) getChildFragmentManager().findFragmentById(R.id.player_album_cover_fragment);
|
||||
if (playerAlbumCoverFragment != null) {
|
||||
playerAlbumCoverFragment.setCallbacks(this);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import code.name.monkey.retromusic.ui.activities.SupportDevelopmentActivity;
|
|||
import code.name.monkey.retromusic.ui.activities.UserInfoActivity;
|
||||
import code.name.monkey.retromusic.ui.activities.WhatsNewActivity;
|
||||
import code.name.monkey.retromusic.ui.activities.AlbumDetailsActivity;
|
||||
import code.name.monkey.retromusic.ui.activities.base.AbsSlidingMusicPanelActivity;
|
||||
|
||||
import static code.name.monkey.retromusic.Constants.RATE_ON_GOOGLE_PLAY;
|
||||
import static code.name.monkey.retromusic.ui.activities.GenreDetailsActivity.EXTRA_GENRE_ID;
|
||||
|
@ -152,4 +153,8 @@ public class NavigationUtil {
|
|||
ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, sharedElements).toBundle());
|
||||
|
||||
}
|
||||
|
||||
public static void gotoNowPlaying(Activity activity) {
|
||||
ActivityCompat.startActivity(activity, new Intent(activity, NowPayingActivity.class),null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,6 +112,7 @@ public final class PreferenceUtil {
|
|||
private static final String LAST_KNOWN_LYRICS_TYPE = "LAST_KNOWN_LYRICS_TYPE";
|
||||
private static final String ALBUM_DETAIL_STYLE = "album_detail_style";
|
||||
private static final String PAUSE_ON_ZERO_VOLUME = "pause_on_zero_volume";
|
||||
private static final String NOW_PLAYING_SCREEN = "now_playing_screen";
|
||||
private static PreferenceUtil sInstance;
|
||||
private final SharedPreferences mPreferences;
|
||||
|
||||
|
@ -157,7 +158,7 @@ public final class PreferenceUtil {
|
|||
return mPreferences.getString(ARTIST_SONG_SORT_ORDER, SortOrder.ArtistSongSortOrder.SONG_A_Z);
|
||||
}
|
||||
|
||||
public final boolean toggleHomeBanner() {
|
||||
public final boolean isHomeBanner() {
|
||||
return mPreferences.getBoolean(TOGGLE_HOME_BANNER, false);
|
||||
}
|
||||
|
||||
|
@ -807,4 +808,7 @@ public final class PreferenceUtil {
|
|||
return layoutRes;
|
||||
}
|
||||
|
||||
public boolean isClickOrSave() {
|
||||
return mPreferences.getBoolean(NOW_PLAYING_SCREEN, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
@ -24,6 +25,10 @@ import code.name.monkey.retromusic.R;
|
|||
public class CollapsingFAB extends FrameLayout {
|
||||
@ColorInt
|
||||
int color = Color.WHITE;
|
||||
|
||||
String title;
|
||||
Drawable icon;
|
||||
|
||||
boolean showTitle;
|
||||
|
||||
ImageView shuffleIcon;
|
||||
|
@ -40,13 +45,18 @@ public class CollapsingFAB extends FrameLayout {
|
|||
|
||||
public CollapsingFAB(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
TypedArray attributes = getContext().obtainStyledAttributes(attrs, R.styleable.CollapsingFAB, 0, 0);
|
||||
icon = attributes.getDrawable(R.styleable.CollapsingFAB_setIcon);
|
||||
color = attributes.getColor(R.styleable.CollapsingFAB_shuffleBackgroundColor, 0);
|
||||
showTitle = attributes.getBoolean(R.styleable.CollapsingFAB_showTitle, false);
|
||||
title = attributes.getString(R.styleable.CollapsingFAB_setText);
|
||||
|
||||
View view = inflate(context, R.layout.collapsing_floating_action_button, this);
|
||||
shuffleIcon = view.findViewById(R.id.icon);
|
||||
shuffleIcon.setImageDrawable(icon);
|
||||
|
||||
textView = view.findViewById(R.id.shuffle_text);
|
||||
textView.setText(title);
|
||||
textView.setVisibility(showTitle ? VISIBLE : GONE);
|
||||
cardView = view.findViewById(R.id.container);
|
||||
attributes.recycle();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue