minor changes and refactoring
This commit is contained in:
parent
e56a20f34c
commit
704502f653
9 changed files with 30 additions and 23 deletions
|
|
@ -98,7 +98,7 @@ public class MainActivity extends AbsMusicPanelActivity {
|
|||
|
||||
// only override when logout selected
|
||||
if (onLogout) {
|
||||
overridePendingTransition(0, R.anim.fade_slow);
|
||||
overridePendingTransition(0, R.anim.fade_quick);
|
||||
onLogout = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -160,8 +160,8 @@ public class MainActivity extends AbsMusicPanelActivity {
|
|||
// it also applies a tacky background color for the checked item
|
||||
// this is a hack to check the current item without that
|
||||
if (menuItem.getItemId() == R.id.nav_settings
|
||||
|| menuItem.getItemId() == R.id.nav_about
|
||||
|| menuItem.getItemId() == R.id.nav_logout) return true;
|
||||
|| menuItem.getItemId() == R.id.nav_about
|
||||
|| menuItem.getItemId() == R.id.nav_logout) return true;
|
||||
|
||||
for (int i = 0; i < binding.navigationView.getMenu().size(); i++) {
|
||||
binding.navigationView.getMenu().getItem(i).setChecked(binding.navigationView.getMenu().getItem(i) == menuItem);
|
||||
|
|
@ -194,8 +194,8 @@ public class MainActivity extends AbsMusicPanelActivity {
|
|||
navigationBinding.text.setText(MusicUtil.getSongInfoString(song));
|
||||
|
||||
CustomGlideRequest.Builder
|
||||
.from(this, song.primary, song.blurHash)
|
||||
.build().centerInside().into(navigationBinding.image);
|
||||
.from(this, song.primary, song.blurHash)
|
||||
.build().centerInside().into(navigationBinding.image);
|
||||
} else if (binding.navigationView.getHeaderCount() != 0) {
|
||||
binding.navigationView.removeHeaderView(navigationBinding.getRoot());
|
||||
navigationBinding = null;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import java.util.List;
|
|||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
public class SearchActivity extends AbsMusicServiceActivity implements SearchView.OnQueryTextListener {
|
||||
private String QUERY = "query";
|
||||
private final String QUERY = "query";
|
||||
|
||||
private ActivitySearchBinding binding;
|
||||
|
||||
|
|
@ -74,11 +74,8 @@ public class SearchActivity extends AbsMusicServiceActivity implements SearchVie
|
|||
|
||||
setUpToolBar();
|
||||
|
||||
query = savedInstanceState.getString(QUERY, "");
|
||||
handler = new Handler();
|
||||
if (savedInstanceState != null) {
|
||||
query = savedInstanceState.getString(QUERY);
|
||||
search(query);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import android.view.animation.PathInterpolator;
|
|||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.FloatRange;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
|
|
@ -103,6 +104,7 @@ public abstract class AbsMusicPanelActivity extends AbsMusicServiceActivity impl
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if (currentNowPlayingScreen != PreferenceUtil.getInstance(this).getNowPlayingScreen()) {
|
||||
postRecreate();
|
||||
}
|
||||
|
|
@ -241,8 +243,11 @@ public abstract class AbsMusicPanelActivity extends AbsMusicServiceActivity impl
|
|||
public void onPaletteColorChanged() {
|
||||
if (getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
|
||||
int playerFragmentColor = playerFragment.getPaletteColor();
|
||||
|
||||
super.setTaskDescriptionColor(playerFragmentColor);
|
||||
animateNavigationBarColor(playerFragmentColor);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
animateNavigationBarColor(playerFragmentColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -268,23 +273,25 @@ public abstract class AbsMusicPanelActivity extends AbsMusicServiceActivity impl
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
private void animateNavigationBarColor(int color) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (navigationBarColorAnimator != null) navigationBarColorAnimator.cancel();
|
||||
|
||||
navigationBarColorAnimator = ValueAnimator
|
||||
.ofArgb(getWindow().getNavigationBarColor(), color)
|
||||
.setDuration(ViewUtil.PHONOGRAPH_ANIM_TIME);
|
||||
|
||||
navigationBarColorAnimator.setInterpolator(new PathInterpolator(0.4f, 0f, 1f, 1f));
|
||||
navigationBarColorAnimator.addUpdateListener(animation -> AbsMusicPanelActivity.super.setNavigationbarColor((Integer) animation.getAnimatedValue()));
|
||||
navigationBarColorAnimator.start();
|
||||
if (navigationBarColorAnimator != null) {
|
||||
navigationBarColorAnimator.cancel();
|
||||
}
|
||||
|
||||
navigationBarColorAnimator = ValueAnimator
|
||||
.ofArgb(getWindow().getNavigationBarColor(), color)
|
||||
.setDuration(ViewUtil.PHONOGRAPH_ANIM_TIME);
|
||||
|
||||
navigationBarColorAnimator.setInterpolator(new PathInterpolator(0.4f, 0f, 1f, 1f));
|
||||
navigationBarColorAnimator.addUpdateListener(animation -> super.setNavigationbarColor((int) animation.getAnimatedValue()));
|
||||
navigationBarColorAnimator.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (navigationBarColorAnimator != null) {
|
||||
navigationBarColorAnimator.cancel();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import android.view.View;
|
|||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
||||
import com.dkanada.gramophone.BuildConfig;
|
||||
import com.kabouzeid.appthemehelper.ATH;
|
||||
import com.kabouzeid.appthemehelper.ThemeStore;
|
||||
import com.kabouzeid.appthemehelper.common.ATHToolbarActivity;
|
||||
|
|
@ -45,7 +46,7 @@ public abstract class AbsThemeActivity extends ATHToolbarActivity {
|
|||
} else {
|
||||
statusBar.setBackgroundColor(color);
|
||||
}
|
||||
} else if (Build.VERSION.SDK_INT >= 21) {
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
getWindow().setStatusBarColor(ColorUtil.darkenColor(color));
|
||||
setLightStatusbarAuto(color);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ public class ArtistDetailActivity extends AbsMusicPanelActivity implements Palet
|
|||
|
||||
ItemQuery albums = new ItemQuery();
|
||||
albums.setArtistIds(new String[]{artist.id});
|
||||
|
||||
QueryUtil.getAlbums(albums, media -> {
|
||||
artist.albums = media;
|
||||
setArtist(artist);
|
||||
|
|
@ -79,6 +80,7 @@ public class ArtistDetailActivity extends AbsMusicPanelActivity implements Palet
|
|||
|
||||
ItemQuery songs = new ItemQuery();
|
||||
songs.setArtistIds(new String[]{artist.id});
|
||||
|
||||
QueryUtil.getSongs(songs, media -> {
|
||||
artist.songs = media;
|
||||
setArtist(artist);
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public class GenreDetailActivity extends AbsMusicPanelActivity implements CabHol
|
|||
|
||||
ItemQuery query = new ItemQuery();
|
||||
query.setGenreIds(new String[]{genre.id});
|
||||
|
||||
QueryUtil.getSongs(query, media -> {
|
||||
adapter.getDataSet().addAll(media);
|
||||
adapter.notifyDataSetChanged();
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ public class PlaylistDetailActivity extends AbsMusicPanelActivity implements Cab
|
|||
|
||||
PlaylistItemQuery query = new PlaylistItemQuery();
|
||||
query.setId(playlist.id);
|
||||
|
||||
PlaylistUtil.getPlaylist(query, media -> {
|
||||
adapter.getDataSet().addAll(media);
|
||||
adapter.notifyDataSetChanged();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ import com.dkanada.gramophone.service.MusicService;
|
|||
import static android.content.Context.NOTIFICATION_SERVICE;
|
||||
|
||||
public abstract class PlayingNotification {
|
||||
|
||||
private static final int NOTIFICATION_ID = 1;
|
||||
protected static final String NOTIFICATION_CHANNEL_ID = "playing_notification";
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import static com.dkanada.gramophone.service.MusicService.ACTION_SKIP;
|
|||
import static com.dkanada.gramophone.service.MusicService.ACTION_TOGGLE;
|
||||
|
||||
public class PlayingNotificationImpl24 extends PlayingNotification {
|
||||
|
||||
@Override
|
||||
public synchronized void update() {
|
||||
stopped = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue