refactor some code and fix ide warnings
This commit is contained in:
parent
24cb549681
commit
a68066fa61
11 changed files with 15 additions and 57 deletions
|
|
@ -210,22 +210,7 @@ public class AlbumDetailActivity extends AbsMusicContentActivity implements Pale
|
|||
.setMenu(menuRes)
|
||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||
.setBackgroundColor(ThemeUtil.shiftBackgroundColorForLightText(getPaletteColor()))
|
||||
.start(new MaterialCab.Callback() {
|
||||
@Override
|
||||
public boolean onCabCreated(MaterialCab materialCab, Menu menu) {
|
||||
return callback.onCabCreated(materialCab, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCabItemClicked(MenuItem menuItem) {
|
||||
return callback.onCabItemClicked(menuItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCabFinished(MaterialCab materialCab) {
|
||||
return callback.onCabFinished(materialCab);
|
||||
}
|
||||
});
|
||||
.start(callback);
|
||||
return cab;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -238,22 +238,7 @@ public class ArtistDetailActivity extends AbsMusicContentActivity implements Pal
|
|||
.setMenu(menuRes)
|
||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||
.setBackgroundColor(ThemeUtil.shiftBackgroundColorForLightText(getPaletteColor()))
|
||||
.start(new MaterialCab.Callback() {
|
||||
@Override
|
||||
public boolean onCabCreated(MaterialCab materialCab, Menu menu) {
|
||||
return callback.onCabCreated(materialCab, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCabItemClicked(MenuItem menuItem) {
|
||||
return callback.onCabItemClicked(menuItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCabFinished(MaterialCab materialCab) {
|
||||
return callback.onCabFinished(materialCab);
|
||||
}
|
||||
});
|
||||
.start(callback);
|
||||
return cab;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class GenreDetailActivity extends AbsMusicContentActivity implements CabH
|
|||
}
|
||||
|
||||
private void setUpRecyclerView() {
|
||||
ViewUtil.setUpFastScrollRecyclerViewColor(this, ((FastScrollRecyclerView) binding.recyclerView), ThemeStore.accentColor(this));
|
||||
ViewUtil.setUpFastScrollRecyclerViewColor(this, binding.recyclerView, ThemeStore.accentColor(this));
|
||||
binding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
adapter = new SongAdapter(this, new ArrayList<>(), R.layout.item_list, false, this);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import com.dkanada.gramophone.model.Song;
|
|||
import java.util.List;
|
||||
|
||||
public class AlbumCoverPagerAdapter extends CustomFragmentStatePagerAdapter {
|
||||
private List<Song> dataSet;
|
||||
private final List<Song> dataSet;
|
||||
|
||||
private AlbumCoverFragment.ColorReceiver currentColorReceiver;
|
||||
private int currentColorReceiverPosition = -1;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ import com.dkanada.gramophone.fragments.library.PlaylistsFragment;
|
|||
import com.dkanada.gramophone.fragments.library.SongsFragment;
|
||||
import com.dkanada.gramophone.util.PreferenceUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -31,7 +33,6 @@ public class MusicLibraryPagerAdapter extends FragmentPagerAdapter {
|
|||
|
||||
private final List<Holder> mHolderList = new ArrayList<>();
|
||||
|
||||
@NonNull
|
||||
private final Context mContext;
|
||||
|
||||
public MusicLibraryPagerAdapter(@NonNull final Context context, final FragmentManager fragmentManager) {
|
||||
|
|
@ -99,15 +100,18 @@ public class MusicLibraryPagerAdapter extends FragmentPagerAdapter {
|
|||
return mFragment;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Fragment getItem(final int position) {
|
||||
final Holder mCurrentHolder = mHolderList.get(position);
|
||||
|
||||
return Fragment.instantiate(mContext, mCurrentHolder.mClassName, mCurrentHolder.mParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(final ViewGroup container, final int position, final Object object) {
|
||||
public void destroyItem(@NotNull ViewGroup container, int position, @NotNull Object object) {
|
||||
super.destroyItem(container, position, object);
|
||||
|
||||
final WeakReference<Fragment> mWeakFragment = mFragmentArray.get(position);
|
||||
if (mWeakFragment != null) {
|
||||
mWeakFragment.clear();
|
||||
|
|
@ -125,9 +129,6 @@ public class MusicLibraryPagerAdapter extends FragmentPagerAdapter {
|
|||
return mHolderList.get(position).title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Aligns the fragment cache with the current category layout.
|
||||
*/
|
||||
private void alignCache() {
|
||||
if (mFragmentArray.size() == 0) return;
|
||||
|
||||
|
|
@ -176,7 +177,7 @@ public class MusicLibraryPagerAdapter extends FragmentPagerAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Unknown music fragment " + cl);
|
||||
throw new IllegalArgumentException(String.format("unknown music fragment: %s", cl));
|
||||
}
|
||||
|
||||
private static class All {
|
||||
|
|
|
|||
|
|
@ -63,11 +63,7 @@ public class PlaylistAdapter extends AbsMultiSelectAdapter<PlaylistAdapter.ViewH
|
|||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(activity).inflate(itemLayoutRes, parent, false);
|
||||
|
||||
return createViewHolder(view, viewType);
|
||||
}
|
||||
|
||||
protected ViewHolder createViewHolder(View view, int viewType) {
|
||||
return new ViewHolder(view, viewType);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -143,7 +139,7 @@ public class PlaylistAdapter extends AbsMultiSelectAdapter<PlaylistAdapter.ViewH
|
|||
}
|
||||
|
||||
public class ViewHolder extends MediaEntryViewHolder implements PopupMenu.OnMenuItemClickListener {
|
||||
public ViewHolder(@NonNull View itemView, int itemViewType) {
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
if (menu != null) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ public class HorizontalAlbumAdapter extends AlbumAdapter {
|
|||
protected ViewHolder createViewHolder(View view, int viewType) {
|
||||
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
|
||||
HorizontalAdapterHelper.applyMarginToLayoutParams(activity, params, viewType);
|
||||
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,10 +72,7 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
@NonNull
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(activity).inflate(itemLayoutRes, parent, false);
|
||||
return createViewHolder(view);
|
||||
}
|
||||
|
||||
protected ViewHolder createViewHolder(View view) {
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public class SongMenuHelper {
|
|||
NavigationUtil.startArtist(activity, new Artist(song), null);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue