mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Animate recycler view decorations
This commit is contained in:
		| @@ -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); | ||||
|   | ||||
| @@ -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); | ||||
|             } | ||||
|   | ||||
| @@ -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); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user