fix remaining issues for view binding with detail activities
This commit is contained in:
parent
cea9801159
commit
ab3dce1100
9 changed files with 111 additions and 192 deletions
|
|
@ -6,17 +6,15 @@ import android.os.Bundle;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.afollestad.materialcab.MaterialCab;
|
import com.afollestad.materialcab.MaterialCab;
|
||||||
import com.afollestad.materialdialogs.util.DialogUtils;
|
import com.afollestad.materialdialogs.util.DialogUtils;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.dkanada.gramophone.databinding.ActivityAlbumDetailBinding;
|
||||||
import com.google.android.material.appbar.AppBarLayout;
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
import com.kabouzeid.appthemehelper.util.ColorUtil;
|
import com.kabouzeid.appthemehelper.util.ColorUtil;
|
||||||
import com.kabouzeid.appthemehelper.util.MaterialValueHelper;
|
import com.kabouzeid.appthemehelper.util.MaterialValueHelper;
|
||||||
|
|
@ -43,54 +41,22 @@ import org.jellyfin.apiclient.model.querying.ItemQuery;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
|
||||||
import butterknife.ButterKnife;
|
|
||||||
|
|
||||||
public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements PaletteColorHolder, CabHolder, AppBarLayout.OnOffsetChangedListener {
|
public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements PaletteColorHolder, CabHolder, AppBarLayout.OnOffsetChangedListener {
|
||||||
public static final String EXTRA_ALBUM = "extra_album";
|
public static final String EXTRA_ALBUM = "extra_album";
|
||||||
|
|
||||||
private Album album;
|
private ActivityAlbumDetailBinding binding;
|
||||||
|
|
||||||
@BindView(R.id.app_bar_layout)
|
|
||||||
AppBarLayout appBarLayout;
|
|
||||||
@BindView(R.id.list)
|
|
||||||
RecyclerView recyclerView;
|
|
||||||
@BindView(R.id.image)
|
|
||||||
ImageView albumArtImageView;
|
|
||||||
@BindView(R.id.toolbar)
|
|
||||||
Toolbar toolbar;
|
|
||||||
@BindView(R.id.header)
|
|
||||||
View headerView;
|
|
||||||
|
|
||||||
@BindView(R.id.artist_icon)
|
|
||||||
ImageView artistIconImageView;
|
|
||||||
@BindView(R.id.duration_icon)
|
|
||||||
ImageView durationIconImageView;
|
|
||||||
@BindView(R.id.song_count_icon)
|
|
||||||
ImageView songCountIconImageView;
|
|
||||||
@BindView(R.id.album_year_icon)
|
|
||||||
ImageView albumYearIconImageView;
|
|
||||||
@BindView(R.id.artist_text)
|
|
||||||
TextView artistTextView;
|
|
||||||
@BindView(R.id.duration_text)
|
|
||||||
TextView durationTextView;
|
|
||||||
@BindView(R.id.song_count_text)
|
|
||||||
TextView songCountTextView;
|
|
||||||
@BindView(R.id.album_year_text)
|
|
||||||
TextView albumYearTextView;
|
|
||||||
|
|
||||||
private AlbumSongAdapter adapter;
|
|
||||||
|
|
||||||
private MaterialCab cab;
|
private MaterialCab cab;
|
||||||
private int headerViewHeight;
|
private int headerViewHeight;
|
||||||
private int toolbarColor;
|
private int toolbarColor;
|
||||||
|
|
||||||
|
private Album album;
|
||||||
|
private AlbumSongAdapter adapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
ButterKnife.bind(this);
|
|
||||||
|
|
||||||
setDrawUnderStatusbar();
|
setDrawUnderStatusbar();
|
||||||
setUpObservableListViewParams();
|
setUpObservableListViewParams();
|
||||||
setUpToolbar();
|
setUpToolbar();
|
||||||
|
|
@ -116,12 +82,14 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
@Override
|
@Override
|
||||||
public void onOffsetChanged (AppBarLayout appBarLayout, int verticalOffset) {
|
public void onOffsetChanged (AppBarLayout appBarLayout, int verticalOffset) {
|
||||||
float headerAlpha = Math.max(0, Math.min(1, 1 + (2 * (float) verticalOffset / headerViewHeight)));
|
float headerAlpha = Math.max(0, Math.min(1, 1 + (2 * (float) verticalOffset / headerViewHeight)));
|
||||||
headerView.setAlpha(headerAlpha);
|
binding.header.setAlpha(headerAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected View createContentView() {
|
protected View createContentView() {
|
||||||
return wrapSlidingMusicPanel(R.layout.activity_album_detail);
|
binding = ActivityAlbumDetailBinding.inflate(getLayoutInflater());
|
||||||
|
|
||||||
|
return wrapSlidingMusicPanel(binding.getRoot());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpObservableListViewParams() {
|
private void setUpObservableListViewParams() {
|
||||||
|
|
@ -131,7 +99,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
private void setUpViews() {
|
private void setUpViews() {
|
||||||
setUpRecyclerView();
|
setUpRecyclerView();
|
||||||
setUpSongsAdapter();
|
setUpSongsAdapter();
|
||||||
artistTextView.setOnClickListener(v -> {
|
binding.artistText.setOnClickListener(v -> {
|
||||||
if (album != null) {
|
if (album != null) {
|
||||||
NavigationUtil.goToArtist(AlbumDetailActivity.this, new Artist(album));
|
NavigationUtil.goToArtist(AlbumDetailActivity.this, new Artist(album));
|
||||||
}
|
}
|
||||||
|
|
@ -145,7 +113,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
.from(Glide.with(this), primary)
|
.from(Glide.with(this), primary)
|
||||||
.generatePalette(this).build()
|
.generatePalette(this).build()
|
||||||
.dontAnimate()
|
.dontAnimate()
|
||||||
.into(new CustomPaletteTarget(albumArtImageView) {
|
.into(new CustomPaletteTarget(binding.image) {
|
||||||
@Override
|
@Override
|
||||||
public void onColorReady(int color) {
|
public void onColorReady(int color) {
|
||||||
setColors(color);
|
setColors(color);
|
||||||
|
|
@ -155,26 +123,26 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
|
|
||||||
private void setColors(int color) {
|
private void setColors(int color) {
|
||||||
toolbarColor = color;
|
toolbarColor = color;
|
||||||
appBarLayout.setBackgroundColor(color);
|
binding.appBarLayout.setBackgroundColor(color);
|
||||||
|
|
||||||
setNavigationbarColor(color);
|
setNavigationbarColor(color);
|
||||||
setTaskDescriptionColor(color);
|
setTaskDescriptionColor(color);
|
||||||
|
|
||||||
toolbar.setBackgroundColor(color);
|
binding.toolbar.setBackgroundColor(color);
|
||||||
// needed to auto readjust the toolbar content color
|
// needed to auto readjust the toolbar content color
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(binding.toolbar);
|
||||||
setStatusbarColor(color);
|
setStatusbarColor(color);
|
||||||
|
|
||||||
int secondaryTextColor = MaterialValueHelper.getSecondaryTextColor(this, ColorUtil.isColorLight(color));
|
int secondaryTextColor = MaterialValueHelper.getSecondaryTextColor(this, ColorUtil.isColorLight(color));
|
||||||
artistIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
binding.artistIcon.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
||||||
durationIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
binding.durationIcon.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
||||||
songCountIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
binding.songCountIcon.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
||||||
albumYearIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
binding.albumYearIcon.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
||||||
|
|
||||||
artistTextView.setTextColor(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(color)));
|
binding.artistText.setTextColor(MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(color)));
|
||||||
durationTextView.setTextColor(secondaryTextColor);
|
binding.durationText.setTextColor(secondaryTextColor);
|
||||||
songCountTextView.setTextColor(secondaryTextColor);
|
binding.songCountText.setTextColor(secondaryTextColor);
|
||||||
albumYearTextView.setTextColor(secondaryTextColor);
|
binding.albumYearText.setTextColor(secondaryTextColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -183,11 +151,11 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpRecyclerView() {
|
private void setUpRecyclerView() {
|
||||||
appBarLayout.addOnOffsetChangedListener(this);
|
binding.appBarLayout.addOnOffsetChangedListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpToolbar() {
|
private void setUpToolbar() {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(binding.toolbar);
|
||||||
// noinspection ConstantConditions
|
// noinspection ConstantConditions
|
||||||
getSupportActionBar().setTitle(null);
|
getSupportActionBar().setTitle(null);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
@ -195,8 +163,8 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
|
|
||||||
private void setUpSongsAdapter() {
|
private void setUpSongsAdapter() {
|
||||||
adapter = new AlbumSongAdapter(this, getAlbum().songs, R.layout.item_list, false, this);
|
adapter = new AlbumSongAdapter(this, getAlbum().songs, R.layout.item_list, false, this);
|
||||||
recyclerView.setLayoutManager(new GridLayoutManager(this, 1));
|
binding.list.setLayoutManager(new GridLayoutManager(this, 1));
|
||||||
recyclerView.setAdapter(adapter);
|
binding.list.setAdapter(adapter);
|
||||||
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged() {
|
public void onChanged() {
|
||||||
|
|
@ -275,7 +243,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
if (cab != null && cab.isActive()) {
|
if (cab != null && cab.isActive()) {
|
||||||
cab.finish();
|
cab.finish();
|
||||||
} else {
|
} else {
|
||||||
recyclerView.stopScroll();
|
binding.list.stopScroll();
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -290,10 +258,10 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
this.album = album;
|
this.album = album;
|
||||||
|
|
||||||
getSupportActionBar().setTitle(album.title);
|
getSupportActionBar().setTitle(album.title);
|
||||||
artistTextView.setText(album.artistName);
|
binding.artistText.setText(album.artistName);
|
||||||
songCountTextView.setText(MusicUtil.getSongCountString(this, album.songs.size()));
|
binding.songCountText.setText(MusicUtil.getSongCountString(this, album.songs.size()));
|
||||||
durationTextView.setText(MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(this, album.songs)));
|
binding.durationText.setText(MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(this, album.songs)));
|
||||||
albumYearTextView.setText(MusicUtil.getYearString(album.year));
|
binding.albumYearText.setText(MusicUtil.getYearString(album.year));
|
||||||
|
|
||||||
if (album.songs.size() != 0) adapter.swapDataSet(album.songs);
|
if (album.songs.size() != 0) adapter.swapDataSet(album.songs);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,11 @@ import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import butterknife.BindView;
|
|
||||||
import butterknife.ButterKnife;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -22,6 +17,7 @@ import com.afollestad.materialcab.MaterialCab;
|
||||||
import com.afollestad.materialdialogs.util.DialogUtils;
|
import com.afollestad.materialdialogs.util.DialogUtils;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.dkanada.gramophone.adapter.song.SongAdapter;
|
import com.dkanada.gramophone.adapter.song.SongAdapter;
|
||||||
|
import com.dkanada.gramophone.databinding.ActivityArtistDetailBinding;
|
||||||
import com.google.android.material.appbar.AppBarLayout;
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
import com.kabouzeid.appthemehelper.util.ColorUtil;
|
import com.kabouzeid.appthemehelper.util.ColorUtil;
|
||||||
import com.kabouzeid.appthemehelper.util.MaterialValueHelper;
|
import com.kabouzeid.appthemehelper.util.MaterialValueHelper;
|
||||||
|
|
@ -49,31 +45,7 @@ import org.jellyfin.apiclient.model.querying.ItemQuery;
|
||||||
public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implements PaletteColorHolder, CabHolder, AppBarLayout.OnOffsetChangedListener {
|
public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implements PaletteColorHolder, CabHolder, AppBarLayout.OnOffsetChangedListener {
|
||||||
public static final String EXTRA_ARTIST = "extra_artist";
|
public static final String EXTRA_ARTIST = "extra_artist";
|
||||||
|
|
||||||
@BindView(R.id.app_bar_layout)
|
private ActivityArtistDetailBinding binding;
|
||||||
AppBarLayout appBarLayout;
|
|
||||||
@BindView(R.id.albums)
|
|
||||||
RecyclerView albumRecyclerView;
|
|
||||||
@BindView(R.id.songs)
|
|
||||||
RecyclerView songRecyclerView;
|
|
||||||
@BindView(R.id.image)
|
|
||||||
ImageView artistImage;
|
|
||||||
@BindView(R.id.toolbar)
|
|
||||||
Toolbar toolbar;
|
|
||||||
@BindView(R.id.header)
|
|
||||||
View headerView;
|
|
||||||
|
|
||||||
@BindView(R.id.duration_icon)
|
|
||||||
ImageView durationIconImageView;
|
|
||||||
@BindView(R.id.song_count_icon)
|
|
||||||
ImageView songCountIconImageView;
|
|
||||||
@BindView(R.id.album_count_icon)
|
|
||||||
ImageView albumCountIconImageView;
|
|
||||||
@BindView(R.id.duration_text)
|
|
||||||
TextView durationTextView;
|
|
||||||
@BindView(R.id.song_count_text)
|
|
||||||
TextView songCountTextView;
|
|
||||||
@BindView(R.id.album_count_text)
|
|
||||||
TextView albumCountTextView;
|
|
||||||
|
|
||||||
private MaterialCab cab;
|
private MaterialCab cab;
|
||||||
private int headerViewHeight;
|
private int headerViewHeight;
|
||||||
|
|
@ -87,8 +59,6 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
ButterKnife.bind(this);
|
|
||||||
|
|
||||||
setDrawUnderStatusbar();
|
setDrawUnderStatusbar();
|
||||||
setUpObservableListViewParams();
|
setUpObservableListViewParams();
|
||||||
setUpToolbar();
|
setUpToolbar();
|
||||||
|
|
@ -124,12 +94,14 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
@Override
|
@Override
|
||||||
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
|
||||||
float headerAlpha = Math.max(0, Math.min(1, 1 + (2 * (float) verticalOffset / headerViewHeight)));
|
float headerAlpha = Math.max(0, Math.min(1, 1 + (2 * (float) verticalOffset / headerViewHeight)));
|
||||||
headerView.setAlpha(headerAlpha);
|
binding.header.setAlpha(headerAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected View createContentView() {
|
protected View createContentView() {
|
||||||
return wrapSlidingMusicPanel(R.layout.activity_artist_detail);
|
binding = ActivityArtistDetailBinding.inflate(getLayoutInflater());
|
||||||
|
|
||||||
|
return wrapSlidingMusicPanel(binding.getRoot());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean usePalette;
|
private boolean usePalette;
|
||||||
|
|
@ -145,18 +117,18 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpSongListView() {
|
private void setUpSongListView() {
|
||||||
appBarLayout.addOnOffsetChangedListener(this);
|
binding.appBarLayout.addOnOffsetChangedListener(this);
|
||||||
|
|
||||||
songAdapter = new SongAdapter(this, getArtist().songs, R.layout.item_list, false, this);
|
songAdapter = new SongAdapter(this, getArtist().songs, R.layout.item_list, false, this);
|
||||||
|
|
||||||
songRecyclerView.setLayoutManager(new GridLayoutManager(this, 1));
|
binding.songs.setLayoutManager(new GridLayoutManager(this, 1));
|
||||||
songRecyclerView.setAdapter(songAdapter);
|
binding.songs.setAdapter(songAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpAlbumRecyclerView() {
|
private void setUpAlbumRecyclerView() {
|
||||||
albumRecyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
binding.albums.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
|
||||||
albumAdapter = new HorizontalAlbumAdapter(this, getArtist().albums, usePalette, this);
|
albumAdapter = new HorizontalAlbumAdapter(this, getArtist().albums, usePalette, this);
|
||||||
albumRecyclerView.setAdapter(albumAdapter);
|
binding.albums.setAdapter(albumAdapter);
|
||||||
albumAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
albumAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged() {
|
public void onChanged() {
|
||||||
|
|
@ -177,7 +149,7 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
.from(Glide.with(this), primary)
|
.from(Glide.with(this), primary)
|
||||||
.generatePalette(this).build()
|
.generatePalette(this).build()
|
||||||
.dontAnimate()
|
.dontAnimate()
|
||||||
.into(new CustomPaletteTarget(artistImage) {
|
.into(new CustomPaletteTarget(binding.image) {
|
||||||
@Override
|
@Override
|
||||||
public void onColorReady(int color) {
|
public void onColorReady(int color) {
|
||||||
setColors(color);
|
setColors(color);
|
||||||
|
|
@ -192,28 +164,28 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
|
|
||||||
private void setColors(int color) {
|
private void setColors(int color) {
|
||||||
toolbarColor = color;
|
toolbarColor = color;
|
||||||
appBarLayout.setBackgroundColor(color);
|
binding.appBarLayout.setBackgroundColor(color);
|
||||||
|
|
||||||
setNavigationbarColor(color);
|
setNavigationbarColor(color);
|
||||||
setTaskDescriptionColor(color);
|
setTaskDescriptionColor(color);
|
||||||
|
|
||||||
toolbar.setBackgroundColor(color);
|
binding.toolbar.setBackgroundColor(color);
|
||||||
// needed to auto readjust the toolbar content color
|
// needed to auto readjust the toolbar content color
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(binding.toolbar);
|
||||||
setStatusbarColor(color);
|
setStatusbarColor(color);
|
||||||
|
|
||||||
int secondaryTextColor = MaterialValueHelper.getSecondaryTextColor(this, ColorUtil.isColorLight(color));
|
int secondaryTextColor = MaterialValueHelper.getSecondaryTextColor(this, ColorUtil.isColorLight(color));
|
||||||
durationIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
binding.durationIcon.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
||||||
songCountIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
binding.songCountIcon.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
||||||
albumCountIconImageView.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
binding.albumCountIcon.setColorFilter(secondaryTextColor, PorterDuff.Mode.SRC_IN);
|
||||||
|
|
||||||
durationTextView.setTextColor(secondaryTextColor);
|
binding.durationText.setTextColor(secondaryTextColor);
|
||||||
songCountTextView.setTextColor(secondaryTextColor);
|
binding.songCountText.setTextColor(secondaryTextColor);
|
||||||
albumCountTextView.setTextColor(secondaryTextColor);
|
binding.albumCountText.setTextColor(secondaryTextColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpToolbar() {
|
private void setUpToolbar() {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(binding.toolbar);
|
||||||
// noinspection ConstantConditions
|
// noinspection ConstantConditions
|
||||||
getSupportActionBar().setTitle(null);
|
getSupportActionBar().setTitle(null);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
@ -290,7 +262,7 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
if (cab != null && cab.isActive()) {
|
if (cab != null && cab.isActive()) {
|
||||||
cab.finish();
|
cab.finish();
|
||||||
} else {
|
} else {
|
||||||
albumRecyclerView.stopScroll();
|
binding.albums.stopScroll();
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -305,9 +277,9 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
this.artist = artist;
|
this.artist = artist;
|
||||||
|
|
||||||
getSupportActionBar().setTitle(artist.name);
|
getSupportActionBar().setTitle(artist.name);
|
||||||
songCountTextView.setText(MusicUtil.getSongCountString(this, artist.songs.size()));
|
binding.songCountText.setText(MusicUtil.getSongCountString(this, artist.songs.size()));
|
||||||
albumCountTextView.setText(MusicUtil.getAlbumCountString(this, artist.albums.size()));
|
binding.albumCountText.setText(MusicUtil.getAlbumCountString(this, artist.albums.size()));
|
||||||
durationTextView.setText(MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(this, artist.songs)));
|
binding.durationText.setText(MusicUtil.getReadableDurationString(MusicUtil.getTotalDuration(this, artist.songs)));
|
||||||
|
|
||||||
if (artist.songs.size() != 0) songAdapter.swapDataSet(artist.songs);
|
if (artist.songs.size() != 0) songAdapter.swapDataSet(artist.songs);
|
||||||
if (artist.albums.size() != 0) albumAdapter.swapDataSet(artist.albums);
|
if (artist.albums.size() != 0) albumAdapter.swapDataSet(artist.albums);
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,12 @@ import android.os.Bundle;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.afollestad.materialcab.MaterialCab;
|
import com.afollestad.materialcab.MaterialCab;
|
||||||
|
import com.dkanada.gramophone.databinding.ActivityGenreDetailBinding;
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils;
|
import com.h6ah4i.android.widget.advrecyclerview.utils.WrapperAdapterUtils;
|
||||||
import com.kabouzeid.appthemehelper.ThemeStore;
|
import com.kabouzeid.appthemehelper.ThemeStore;
|
||||||
import com.dkanada.gramophone.R;
|
import com.dkanada.gramophone.R;
|
||||||
|
|
@ -31,18 +30,10 @@ import org.jellyfin.apiclient.model.querying.ItemQuery;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
|
||||||
import butterknife.ButterKnife;
|
|
||||||
|
|
||||||
public class GenreDetailActivity extends AbsSlidingMusicPanelActivity implements CabHolder {
|
public class GenreDetailActivity extends AbsSlidingMusicPanelActivity implements CabHolder {
|
||||||
public static final String EXTRA_GENRE = "extra_genre";
|
public static final String EXTRA_GENRE = "extra_genre";
|
||||||
|
|
||||||
@BindView(R.id.recycler_view)
|
private ActivityGenreDetailBinding binding;
|
||||||
RecyclerView recyclerView;
|
|
||||||
@BindView(R.id.toolbar)
|
|
||||||
Toolbar toolbar;
|
|
||||||
@BindView(android.R.id.empty)
|
|
||||||
TextView empty;
|
|
||||||
|
|
||||||
private Genre genre;
|
private Genre genre;
|
||||||
|
|
||||||
|
|
@ -55,10 +46,9 @@ public class GenreDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
ButterKnife.bind(this);
|
|
||||||
|
|
||||||
setDrawUnderStatusbar();
|
setDrawUnderStatusbar();
|
||||||
setStatusbarColorAuto();
|
setStatusbarColorAuto();
|
||||||
|
|
||||||
setNavigationbarColorAuto();
|
setNavigationbarColorAuto();
|
||||||
setTaskDescriptionColorAuto();
|
setTaskDescriptionColorAuto();
|
||||||
|
|
||||||
|
|
@ -80,15 +70,17 @@ public class GenreDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected View createContentView() {
|
protected View createContentView() {
|
||||||
return wrapSlidingMusicPanel(R.layout.activity_genre_detail);
|
binding = ActivityGenreDetailBinding.inflate(getLayoutInflater());
|
||||||
|
|
||||||
|
return wrapSlidingMusicPanel(binding.getRoot());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpRecyclerView() {
|
private void setUpRecyclerView() {
|
||||||
ViewUtil.setUpFastScrollRecyclerViewColor(this, ((FastScrollRecyclerView) recyclerView), ThemeStore.accentColor(this));
|
ViewUtil.setUpFastScrollRecyclerViewColor(this, ((FastScrollRecyclerView) binding.recyclerView), ThemeStore.accentColor(this));
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
|
||||||
adapter = new SongAdapter(this, new ArrayList<>(), R.layout.item_list, false, this);
|
adapter = new SongAdapter(this, new ArrayList<>(), R.layout.item_list, false, this);
|
||||||
recyclerView.setAdapter(adapter);
|
binding.recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -100,8 +92,8 @@ public class GenreDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpToolBar() {
|
private void setUpToolBar() {
|
||||||
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
|
binding.toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(binding.toolbar);
|
||||||
// noinspection ConstantConditions
|
// noinspection ConstantConditions
|
||||||
getSupportActionBar().setTitle(genre.name);
|
getSupportActionBar().setTitle(genre.name);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
@ -145,21 +137,18 @@ public class GenreDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (cab != null && cab.isActive()) cab.finish();
|
if (cab != null && cab.isActive()) cab.finish();
|
||||||
else {
|
else {
|
||||||
recyclerView.stopScroll();
|
binding.recyclerView.stopScroll();
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkIsEmpty() {
|
private void checkIsEmpty() {
|
||||||
empty.setVisibility(adapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
|
binding.empty.setVisibility(adapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
if (recyclerView != null) {
|
binding.recyclerView.setAdapter(null);
|
||||||
recyclerView.setAdapter(null);
|
|
||||||
recyclerView = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wrappedAdapter != null) {
|
if (wrappedAdapter != null) {
|
||||||
WrapperAdapterUtils.releaseAll(wrappedAdapter);
|
WrapperAdapterUtils.releaseAll(wrappedAdapter);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import android.os.Handler;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.dkanada.gramophone.databinding.ActivityMainContentBinding;
|
||||||
import com.dkanada.gramophone.databinding.ActivityMainDrawerLayoutBinding;
|
import com.dkanada.gramophone.databinding.ActivityMainDrawerLayoutBinding;
|
||||||
import com.dkanada.gramophone.dialogs.ConfirmLogoutDialog;
|
import com.dkanada.gramophone.dialogs.ConfirmLogoutDialog;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
@ -42,6 +43,7 @@ import java.util.List;
|
||||||
|
|
||||||
public class MainActivity extends AbsSlidingMusicPanelActivity {
|
public class MainActivity extends AbsSlidingMusicPanelActivity {
|
||||||
private ActivityMainDrawerLayoutBinding binding;
|
private ActivityMainDrawerLayoutBinding binding;
|
||||||
|
private ActivityMainContentBinding contentBinding;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
MainActivityFragmentCallbacks currentFragment;
|
MainActivityFragmentCallbacks currentFragment;
|
||||||
|
|
@ -109,9 +111,10 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
||||||
@Override
|
@Override
|
||||||
protected View createContentView() {
|
protected View createContentView() {
|
||||||
binding = ActivityMainDrawerLayoutBinding.inflate(getLayoutInflater());
|
binding = ActivityMainDrawerLayoutBinding.inflate(getLayoutInflater());
|
||||||
|
contentBinding = ActivityMainContentBinding.inflate(getLayoutInflater());
|
||||||
|
|
||||||
ViewGroup drawerContent = binding.getRoot().findViewById(R.id.drawer_content_container);
|
ViewGroup drawerContent = binding.drawerContentContainer;
|
||||||
drawerContent.addView(wrapSlidingMusicPanel(R.layout.activity_main_content));
|
drawerContent.addView(wrapSlidingMusicPanel(contentBinding.getRoot()));
|
||||||
|
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,13 @@ import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.afollestad.materialcab.MaterialCab;
|
import com.afollestad.materialcab.MaterialCab;
|
||||||
|
import com.dkanada.gramophone.databinding.ActivityPlaylistDetailBinding;
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator;
|
import com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator;
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator;
|
import com.h6ah4i.android.widget.advrecyclerview.animator.RefactoredDefaultItemAnimator;
|
||||||
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager;
|
import com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager;
|
||||||
|
|
@ -38,18 +37,10 @@ import org.jellyfin.apiclient.model.playlists.PlaylistItemQuery;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
|
||||||
import butterknife.ButterKnife;
|
|
||||||
|
|
||||||
public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity implements CabHolder {
|
public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity implements CabHolder {
|
||||||
public static String EXTRA_PLAYLIST = "extra_playlist";
|
public static String EXTRA_PLAYLIST = "extra_playlist";
|
||||||
|
|
||||||
@BindView(R.id.recycler_view)
|
private ActivityPlaylistDetailBinding binding;
|
||||||
RecyclerView recyclerView;
|
|
||||||
@BindView(R.id.toolbar)
|
|
||||||
Toolbar toolbar;
|
|
||||||
@BindView(android.R.id.empty)
|
|
||||||
TextView empty;
|
|
||||||
|
|
||||||
private Playlist playlist;
|
private Playlist playlist;
|
||||||
|
|
||||||
|
|
@ -63,8 +54,6 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
ButterKnife.bind(this);
|
|
||||||
|
|
||||||
setDrawUnderStatusbar();
|
setDrawUnderStatusbar();
|
||||||
setStatusbarColorAuto();
|
setStatusbarColorAuto();
|
||||||
|
|
||||||
|
|
@ -89,12 +78,14 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected View createContentView() {
|
protected View createContentView() {
|
||||||
return wrapSlidingMusicPanel(R.layout.activity_playlist_detail);
|
binding = ActivityPlaylistDetailBinding.inflate(getLayoutInflater());
|
||||||
|
|
||||||
|
return wrapSlidingMusicPanel(binding.getRoot());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpRecyclerView() {
|
private void setUpRecyclerView() {
|
||||||
ViewUtil.setUpFastScrollRecyclerViewColor(this, ((FastScrollRecyclerView) recyclerView), ThemeStore.accentColor(this));
|
ViewUtil.setUpFastScrollRecyclerViewColor(this, ((FastScrollRecyclerView) binding.recyclerView), ThemeStore.accentColor(this));
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
|
||||||
recyclerViewDragDropManager = new RecyclerViewDragDropManager();
|
recyclerViewDragDropManager = new RecyclerViewDragDropManager();
|
||||||
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
|
final GeneralItemAnimator animator = new RefactoredDefaultItemAnimator();
|
||||||
|
|
@ -107,10 +98,10 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
||||||
|
|
||||||
wrappedAdapter = recyclerViewDragDropManager.createWrappedAdapter(adapter);
|
wrappedAdapter = recyclerViewDragDropManager.createWrappedAdapter(adapter);
|
||||||
|
|
||||||
recyclerView.setAdapter(wrappedAdapter);
|
binding.recyclerView.setAdapter(wrappedAdapter);
|
||||||
recyclerView.setItemAnimator(animator);
|
binding.recyclerView.setItemAnimator(animator);
|
||||||
|
|
||||||
recyclerViewDragDropManager.attachRecyclerView(recyclerView);
|
recyclerViewDragDropManager.attachRecyclerView(binding.recyclerView);
|
||||||
|
|
||||||
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -122,8 +113,8 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUpToolbar() {
|
private void setUpToolbar() {
|
||||||
toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
|
binding.toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(binding.toolbar);
|
||||||
// noinspection ConstantConditions
|
// noinspection ConstantConditions
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
setToolbarTitle(playlist.name);
|
setToolbarTitle(playlist.name);
|
||||||
|
|
@ -173,13 +164,13 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
||||||
if (cab != null && cab.isActive()) {
|
if (cab != null && cab.isActive()) {
|
||||||
cab.finish();
|
cab.finish();
|
||||||
} else {
|
} else {
|
||||||
recyclerView.stopScroll();
|
binding.recyclerView.stopScroll();
|
||||||
super.onBackPressed();
|
super.onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkIsEmpty() {
|
private void checkIsEmpty() {
|
||||||
empty.setVisibility(adapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
|
binding.empty.setVisibility(adapter.getItemCount() == 0 ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -198,11 +189,8 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
||||||
recyclerViewDragDropManager = null;
|
recyclerViewDragDropManager = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recyclerView != null) {
|
binding.recyclerView.setItemAnimator(null);
|
||||||
recyclerView.setItemAnimator(null);
|
binding.recyclerView.setAdapter(null);
|
||||||
recyclerView.setAdapter(null);
|
|
||||||
recyclerView = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wrappedAdapter != null) {
|
if (wrappedAdapter != null) {
|
||||||
WrapperAdapterUtils.releaseAll(wrappedAdapter);
|
WrapperAdapterUtils.releaseAll(wrappedAdapter);
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,11 @@ package com.dkanada.gramophone.ui.activities.base;
|
||||||
|
|
||||||
import android.animation.ArgbEvaluator;
|
import android.animation.ArgbEvaluator;
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.annotation.ColorInt;
|
import androidx.annotation.ColorInt;
|
||||||
import androidx.annotation.FloatRange;
|
import androidx.annotation.FloatRange;
|
||||||
import androidx.annotation.LayoutRes;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
@ -46,9 +44,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
setContentView(createContentView());
|
setContentView(createContentView());
|
||||||
binding = SlidingMusicPanelLayoutBinding.bind(findViewById(R.id.sliding_layout));
|
|
||||||
|
|
||||||
// TODO use a fragment for the splash activity
|
// TODO use a fragment for the splash activity
|
||||||
if (App.getApiClient() == null) {
|
if (App.getApiClient() == null) {
|
||||||
|
|
@ -122,6 +118,8 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
@Override
|
@Override
|
||||||
public void onServiceConnected() {
|
public void onServiceConnected() {
|
||||||
super.onServiceConnected();
|
super.onServiceConnected();
|
||||||
|
|
||||||
|
// don't call hideBottomBar(true) here as it causes a bug with the SlidingUpPanelLayout
|
||||||
if (!MusicPlayerRemote.getPlayingQueue().isEmpty()) {
|
if (!MusicPlayerRemote.getPlayingQueue().isEmpty()) {
|
||||||
binding.slidingLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
binding.slidingLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -130,7 +128,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
hideBottomBar(false);
|
hideBottomBar(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} // don't call hideBottomBar(true) here as it causes a bug with the SlidingUpPanelLayout
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -215,12 +213,13 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected View wrapSlidingMusicPanel(@LayoutRes int resId) {
|
protected View wrapSlidingMusicPanel(View view) {
|
||||||
@SuppressLint("InflateParams")
|
binding = SlidingMusicPanelLayoutBinding.inflate(getLayoutInflater());
|
||||||
View slidingMusicPanelLayout = getLayoutInflater().inflate(R.layout.sliding_music_panel_layout, null);
|
|
||||||
ViewGroup contentContainer = slidingMusicPanelLayout.findViewById(R.id.content_container);
|
ViewGroup contentContainer = binding.contentContainer;
|
||||||
getLayoutInflater().inflate(resId, contentContainer);
|
contentContainer.addView(view);
|
||||||
return slidingMusicPanelLayout;
|
|
||||||
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue