Animate recycler view decorations

This commit is contained in:
inorichi 2015-12-06 10:02:29 +01:00
parent a304ccaaea
commit 49a38821f2
3 changed files with 13 additions and 3 deletions

View file

@ -3,6 +3,7 @@ package eu.kanade.mangafeed.ui.catalogue;
import android.os.Bundle;
import android.text.TextUtils;
import com.bumptech.glide.Glide;
import com.pushtorefresh.storio.sqlite.operations.put.PutResult;
import java.util.List;
@ -77,6 +78,13 @@ public class CataloguePresenter extends BasePresenter<CatalogueFragment> {
(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) {
source = sourceManager.get(sourceId);
restartRequest(null);

View file

@ -40,13 +40,14 @@ public class DividerItemDecoration extends RecyclerView.ItemDecoration {
final int left = parent.getPaddingLeft();
final int right = parent.getWidth() - parent.getPaddingRight();
final int childCount = parent.getChildCount();
final int dividerHeight = mDivider.getIntrinsicHeight();
for (int i=1; i < childCount; i++) {
final View child = parent.getChildAt(i);
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
final int size = mDivider.getIntrinsicHeight();
final int top = child.getTop() - params.topMargin;
final int bottom = top + size;
final int ty = (int)(child.getTranslationY() + 0.5f);
final int top = child.getTop() - params.topMargin + ty;
final int bottom = top + dividerHeight;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}

View file

@ -76,6 +76,7 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
linearLayout = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(linearLayout);
recyclerView.addItemDecoration(new DividerItemDecoration(ContextCompat.getDrawable(getContext(), R.drawable.line_divider)));
recyclerView.setHasFixedSize(true);
adapter = new ChaptersAdapter(this);
recyclerView.setAdapter(adapter);