mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 13:01:50 +01:00
Animate recycler view decorations
This commit is contained in:
parent
a304ccaaea
commit
49a38821f2
@ -3,6 +3,7 @@ package eu.kanade.mangafeed.ui.catalogue;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
import com.pushtorefresh.storio.sqlite.operations.put.PutResult;
|
import com.pushtorefresh.storio.sqlite.operations.put.PutResult;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -77,6 +78,13 @@ public class CataloguePresenter extends BasePresenter<CatalogueFragment> {
|
|||||||
(view, error) -> Timber.e(error.getMessage()));
|
(view, error) -> Timber.e(error.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
// Catalogue covers are probably not going to be needed for a long time
|
||||||
|
Glide.get(getContext()).clearMemory();
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
public void startRequesting(int sourceId) {
|
public void startRequesting(int sourceId) {
|
||||||
source = sourceManager.get(sourceId);
|
source = sourceManager.get(sourceId);
|
||||||
restartRequest(null);
|
restartRequest(null);
|
||||||
|
@ -40,13 +40,14 @@ public class DividerItemDecoration extends RecyclerView.ItemDecoration {
|
|||||||
final int left = parent.getPaddingLeft();
|
final int left = parent.getPaddingLeft();
|
||||||
final int right = parent.getWidth() - parent.getPaddingRight();
|
final int right = parent.getWidth() - parent.getPaddingRight();
|
||||||
final int childCount = parent.getChildCount();
|
final int childCount = parent.getChildCount();
|
||||||
|
final int dividerHeight = mDivider.getIntrinsicHeight();
|
||||||
|
|
||||||
for (int i=1; i < childCount; i++) {
|
for (int i=1; i < childCount; i++) {
|
||||||
final View child = parent.getChildAt(i);
|
final View child = parent.getChildAt(i);
|
||||||
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
|
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
|
||||||
final int size = mDivider.getIntrinsicHeight();
|
final int ty = (int)(child.getTranslationY() + 0.5f);
|
||||||
final int top = child.getTop() - params.topMargin;
|
final int top = child.getTop() - params.topMargin + ty;
|
||||||
final int bottom = top + size;
|
final int bottom = top + dividerHeight;
|
||||||
mDivider.setBounds(left, top, right, bottom);
|
mDivider.setBounds(left, top, right, bottom);
|
||||||
mDivider.draw(c);
|
mDivider.draw(c);
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,7 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
|
|||||||
linearLayout = new LinearLayoutManager(getActivity());
|
linearLayout = new LinearLayoutManager(getActivity());
|
||||||
recyclerView.setLayoutManager(linearLayout);
|
recyclerView.setLayoutManager(linearLayout);
|
||||||
recyclerView.addItemDecoration(new DividerItemDecoration(ContextCompat.getDrawable(getContext(), R.drawable.line_divider)));
|
recyclerView.addItemDecoration(new DividerItemDecoration(ContextCompat.getDrawable(getContext(), R.drawable.line_divider)));
|
||||||
|
recyclerView.setHasFixedSize(true);
|
||||||
adapter = new ChaptersAdapter(this);
|
adapter = new ChaptersAdapter(this);
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user