minor changes to albums fragment
This commit is contained in:
parent
82997e97c9
commit
3d436b1f56
6 changed files with 43 additions and 34 deletions
|
|
@ -46,7 +46,9 @@ android {
|
|||
|
||||
dependencies {
|
||||
implementation 'com.github.jellyfin.jellyfin-apiclient-java:android:0.6.3'
|
||||
|
||||
implementation 'com.google.android.exoplayer:exoplayer:2.11.4'
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
|
||||
implementation 'androidx.core:core:1.3.1'
|
||||
implementation 'androidx.media:media:1.1.0'
|
||||
|
|
@ -66,6 +68,7 @@ dependencies {
|
|||
implementation 'com.github.kabouzeid:RecyclerView-FastScroll:1.0.16-kmod'
|
||||
implementation 'com.github.kabouzeid:SeekArc:1.2-kmod'
|
||||
implementation 'com.github.kabouzeid:AndroidSlidingUpPanel:3.3.3-kmod'
|
||||
|
||||
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
|
||||
implementation 'com.afollestad.material-dialogs:commons:0.9.6.0'
|
||||
implementation 'com.afollestad:material-cab:0.1.12'
|
||||
|
|
@ -78,7 +81,6 @@ dependencies {
|
|||
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
|
||||
implementation 'com.github.bumptech.glide:glide:3.8.0'
|
||||
implementation 'com.github.bumptech.glide:okhttp3-integration:1.5.0'
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ public class LibraryFragment extends AbsMainActivityFragment implements CabHolde
|
|||
absLibraryRecyclerViewCustomGridSizeFragment.setAndSaveUsePalette(item.isChecked());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (handleGridSizeMenuItem(absLibraryRecyclerViewCustomGridSizeFragment, item)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import android.view.View;
|
|||
import com.dkanada.gramophone.R;
|
||||
import com.dkanada.gramophone.util.Util;
|
||||
|
||||
public abstract class AbsLibraryPagerRecyclerViewCustomGridSizeFragment<A extends RecyclerView.Adapter, LM extends RecyclerView.LayoutManager> extends AbsLibraryPagerRecyclerViewFragment<A, LM> {
|
||||
public abstract class AbsLibraryPagerRecyclerViewCustomGridSizeFragment<A extends RecyclerView.Adapter, L extends RecyclerView.LayoutManager> extends AbsLibraryPagerRecyclerViewFragment<A, L> {
|
||||
private int gridSize;
|
||||
private String sortMethod;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
public abstract class AbsLibraryPagerRecyclerViewFragment<A extends RecyclerView.Adapter, LM extends RecyclerView.LayoutManager> extends AbsLibraryPagerFragment implements OnOffsetChangedListener {
|
||||
public abstract class AbsLibraryPagerRecyclerViewFragment<A extends RecyclerView.Adapter, L extends RecyclerView.LayoutManager> extends AbsLibraryPagerFragment implements OnOffsetChangedListener {
|
||||
|
||||
private Unbinder unbinder;
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ public abstract class AbsLibraryPagerRecyclerViewFragment<A extends RecyclerView
|
|||
TextView empty;
|
||||
|
||||
private A adapter;
|
||||
private LM layoutManager;
|
||||
private L layoutManager;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
|
@ -50,26 +50,7 @@ public abstract class AbsLibraryPagerRecyclerViewFragment<A extends RecyclerView
|
|||
|
||||
initLayoutManager();
|
||||
initAdapter();
|
||||
setUpRecyclerView();
|
||||
}
|
||||
|
||||
private void setUpRecyclerView() {
|
||||
if (recyclerView instanceof FastScrollRecyclerView) {
|
||||
ViewUtil.setUpFastScrollRecyclerViewColor(getActivity(), ((FastScrollRecyclerView) recyclerView), ThemeStore.accentColor(getActivity()));
|
||||
}
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
protected void invalidateLayoutManager() {
|
||||
initLayoutManager();
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
}
|
||||
|
||||
protected void invalidateAdapter() {
|
||||
initAdapter();
|
||||
checkIsEmpty();
|
||||
recyclerView.setAdapter(adapter);
|
||||
initRecyclerView();
|
||||
}
|
||||
|
||||
private void initAdapter() {
|
||||
|
|
@ -87,21 +68,35 @@ public abstract class AbsLibraryPagerRecyclerViewFragment<A extends RecyclerView
|
|||
layoutManager = createLayoutManager();
|
||||
}
|
||||
|
||||
protected A getAdapter() {
|
||||
return adapter;
|
||||
private void initRecyclerView() {
|
||||
if (recyclerView instanceof FastScrollRecyclerView) {
|
||||
ViewUtil.setUpFastScrollRecyclerViewColor(getActivity(), ((FastScrollRecyclerView) recyclerView), ThemeStore.accentColor(getActivity()));
|
||||
}
|
||||
|
||||
protected LM getLayoutManager() {
|
||||
return layoutManager;
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
protected void invalidateAdapter() {
|
||||
initAdapter();
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
protected void invalidateLayoutManager() {
|
||||
initLayoutManager();
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
}
|
||||
|
||||
protected RecyclerView getRecyclerView() {
|
||||
return recyclerView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
|
||||
container.setPadding(container.getPaddingLeft(), container.getPaddingTop(), container.getPaddingRight(), getLibraryFragment().getTotalAppBarScrollingRange() + i);
|
||||
protected A getAdapter() {
|
||||
return adapter;
|
||||
}
|
||||
|
||||
protected L getLayoutManager() {
|
||||
return layoutManager;
|
||||
}
|
||||
|
||||
private void checkIsEmpty() {
|
||||
|
|
@ -121,14 +116,21 @@ public abstract class AbsLibraryPagerRecyclerViewFragment<A extends RecyclerView
|
|||
return R.layout.fragment_main_activity_recycler_view;
|
||||
}
|
||||
|
||||
protected abstract LM createLayoutManager();
|
||||
|
||||
@NonNull
|
||||
protected abstract A createAdapter();
|
||||
|
||||
@NonNull
|
||||
protected abstract L createLayoutManager();
|
||||
|
||||
@Override
|
||||
public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
|
||||
container.setPadding(container.getPaddingLeft(), container.getPaddingTop(), container.getPaddingRight(), getLibraryFragment().getTotalAppBarScrollingRange() + i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
getLibraryFragment().removeOnAppBarOffsetChangedListener(this);
|
||||
unbinder.unbind();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.dkanada.gramophone.ui.fragments.mainactivity.library.pager;
|
|||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.dkanada.gramophone.R;
|
||||
|
|
@ -23,11 +24,13 @@ public class AlbumsFragment extends AbsLibraryPagerRecyclerViewCustomGridSizeFra
|
|||
super.onActivityCreated(savedInstanceState);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected GridLayoutManager createLayoutManager() {
|
||||
return new GridLayoutManager(getActivity(), getGridSize());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected AlbumAdapter createAdapter() {
|
||||
int itemLayoutRes = getItemLayoutRes();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue