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