Commit some old stuff that cannot be identified or explained
This commit is contained in:
parent
52b0c71eb2
commit
af7de9e783
0
app/src/main/java/com/hikapro/backpack/model/dao/ImageDownloadHelper.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/model/dao/ImageDownloadHelper.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/model/entities/SharingPicture.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/model/entities/SharingPicture.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/model/entities/Timestamp.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/model/entities/Timestamp.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/model/entities/UpdateLog.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/model/entities/UpdateLog.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/ItemDetailPresenter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/ItemDetailPresenter.java
Normal file → Executable file
17
app/src/main/java/com/hikapro/backpack/presenter/ItemListPresenter.java
Normal file → Executable file
17
app/src/main/java/com/hikapro/backpack/presenter/ItemListPresenter.java
Normal file → Executable file
|
@ -28,6 +28,7 @@ import com.hikapro.backpack.presenter.adapters.helper.AppRater;
|
||||||
import com.hikapro.backpack.presenter.adapters.helper.Util;
|
import com.hikapro.backpack.presenter.adapters.helper.Util;
|
||||||
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2;
|
import com.hikapro.backpack.presenter.adapters.helper.items.DividerDecoration2;
|
||||||
import com.hikapro.backpack.presenter.adapters.helper.items.StickyHeaderDecoration;
|
import com.hikapro.backpack.presenter.adapters.helper.items.StickyHeaderDecoration;
|
||||||
|
import com.hikapro.backpack.presenter.adapters.helper.items.StickyHeaderDecorationCopy;
|
||||||
import com.hikapro.backpack.view.View;
|
import com.hikapro.backpack.view.View;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
@ -77,7 +78,13 @@ public class ItemListPresenter implements Presenter.ItemList {
|
||||||
recycler.setLayoutManager(llm);
|
recycler.setLayoutManager(llm);
|
||||||
recycler.setAdapter(adapter);
|
recycler.setAdapter(adapter);
|
||||||
|
|
||||||
final StickyHeaderDecoration decoration = new StickyHeaderDecoration(adapter);
|
if (set != null) {
|
||||||
|
android.view.View con = view.findViewById(R.id.item_list_container);
|
||||||
|
applyBackground(con, set.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
//final StickyHeaderDecoration decoration = new StickyHeaderDecoration(adapter);
|
||||||
|
final StickyHeaderDecorationCopy decoration = new StickyHeaderDecorationCopy(adapter, getActivityContext(), R.drawable.divider2, Util.dp2px(getAppContext(), 16), view.getBackground());
|
||||||
recycler.addItemDecoration(decoration);
|
recycler.addItemDecoration(decoration);
|
||||||
//recycler.addItemDecoration(new DividerDecoration(getActivityContext()));
|
//recycler.addItemDecoration(new DividerDecoration(getActivityContext()));
|
||||||
recycler.addItemDecoration(new DividerDecoration2(getActivityContext(), R.drawable.divider, Util.dp2px(getAppContext(), 16)));
|
recycler.addItemDecoration(new DividerDecoration2(getActivityContext(), R.drawable.divider, Util.dp2px(getAppContext(), 16)));
|
||||||
|
@ -101,10 +108,10 @@ public class ItemListPresenter implements Presenter.ItemList {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (set != null) {
|
// if (set != null) {
|
||||||
android.view.View con = view.findViewById(R.id.item_list_container);
|
// android.view.View con = view.findViewById(R.id.item_list_container);
|
||||||
applyBackground(con, set.getId());
|
// applyBackground(con, set.getId());
|
||||||
}
|
// }
|
||||||
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
|
NetworkUtil.sendGoogleAnalyticsScreen(TAG);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
0
app/src/main/java/com/hikapro/backpack/presenter/PackedListPresenter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/PackedListPresenter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/SetListPresenter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/SetListPresenter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/SharePresenter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/SharePresenter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/AddListAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/AddListAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/ItemDetailAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/ItemDetailAdapter.java
Normal file → Executable file
6
app/src/main/java/com/hikapro/backpack/presenter/adapters/ItemListAdapter.java
Normal file → Executable file
6
app/src/main/java/com/hikapro/backpack/presenter/adapters/ItemListAdapter.java
Normal file → Executable file
|
@ -207,11 +207,7 @@ public class ItemListAdapter extends RecyclerView.Adapter<ItemViewHolder> implem
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getHeaderId(int position) {
|
public long getHeaderId(int position) {
|
||||||
/*if (position == 0) {
|
return presenter.getModel().getHeaderId(position);
|
||||||
return -1;
|
|
||||||
} else {*/
|
|
||||||
return presenter.getModel().getHeaderId(position);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/PackedListAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/PackedListAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/SetListAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/SetListAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/AppRater.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/AppRater.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/AutoResizeTextView.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/AutoResizeTextView.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/FlowLayout.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/FlowLayout.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/OnSwipeTouchListener.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/OnSwipeTouchListener.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/Util.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/Util.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/DimensionCalculator.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/DimensionCalculator.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/DividerDecoration.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/DividerDecoration.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/DividerDecoration2.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/DividerDecoration2.java
Normal file → Executable file
7
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/HeaderPositionCalculator.java
Normal file → Executable file
7
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/HeaderPositionCalculator.java
Normal file → Executable file
|
@ -62,7 +62,6 @@ public class HeaderPositionCalculator {
|
||||||
* list that immediately precedes it. Items with no headers will always return false.
|
* list that immediately precedes it. Items with no headers will always return false.
|
||||||
*
|
*
|
||||||
* @param position of the list item in questions
|
* @param position of the list item in questions
|
||||||
* @param isReverseLayout TRUE if layout manager has flag isReverseLayout
|
|
||||||
* @return true if this item has a different header than the previous item in the list
|
* @return true if this item has a different header than the previous item in the list
|
||||||
*/
|
*/
|
||||||
public boolean hasNewHeader(int position) {
|
public boolean hasNewHeader(int position) {
|
||||||
|
@ -76,8 +75,8 @@ public class HeaderPositionCalculator {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
long nextItemHeaderId = -1;//TODO -1
|
long nextItemHeaderId = -1;
|
||||||
int nextItemPosition = position - 1; // TODO -1
|
int nextItemPosition = position - 1;
|
||||||
if (!indexOutOfBounds(nextItemPosition)) {
|
if (!indexOutOfBounds(nextItemPosition)) {
|
||||||
nextItemHeaderId = adapter.getHeaderId(nextItemPosition);
|
nextItemHeaderId = adapter.getHeaderId(nextItemPosition);
|
||||||
}
|
}
|
||||||
|
@ -216,8 +215,6 @@ public class HeaderPositionCalculator {
|
||||||
|
|
||||||
int adapterPosition = parent.getChildAdapterPosition(item);
|
int adapterPosition = parent.getChildAdapterPosition(item);
|
||||||
if (adapterPosition == RecyclerView.NO_POSITION || headerProvider.getHeader(parent, adapterPosition) != header) {
|
if (adapterPosition == RecyclerView.NO_POSITION || headerProvider.getHeader(parent, adapterPosition) != header) {
|
||||||
// Resolves https://github.com/timehop/sticky-headers-recyclerview/issues/36
|
|
||||||
// Handles an edge case where a trailing header is smaller than the current sticky header.
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/HeaderProvider.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/HeaderProvider.java
Normal file → Executable file
7
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/HeaderRenderer.java
Normal file → Executable file
7
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/HeaderRenderer.java
Normal file → Executable file
|
@ -1,7 +1,9 @@
|
||||||
package com.hikapro.backpack.presenter.adapters.helper.items;
|
package com.hikapro.backpack.presenter.adapters.helper.items;
|
||||||
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
@ -41,7 +43,10 @@ public class HeaderRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.translate(offset.left, offset.top);
|
canvas.translate(offset.left, offset.top);
|
||||||
|
//header.setBackgroundColor(Color.BLUE); //TODO del
|
||||||
|
// Drawable drawable = header.getBackground();
|
||||||
|
// Drawable drawable1 = header.getglo
|
||||||
|
// header.getBackground().setAlpha(126);
|
||||||
header.draw(canvas);
|
header.draw(canvas);
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/HeaderViewCache.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/HeaderViewCache.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/ItemSwipeCallback.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/ItemSwipeCallback.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/ItemSwipeDecoration.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/ItemSwipeDecoration.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/ItemVisibilityAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/ItemVisibilityAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/StickyHeaderAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/StickyHeaderAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/StickyHeaderDecoration.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/StickyHeaderDecoration.java
Normal file → Executable file
|
@ -0,0 +1,214 @@
|
||||||
|
package com.hikapro.backpack.presenter.adapters.helper.items;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
|
import com.hikapro.backpack.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by tariel on 01/05/16.
|
||||||
|
*/
|
||||||
|
public class StickyHeaderDecorationCopy extends RecyclerView.ItemDecoration {
|
||||||
|
|
||||||
|
private final StickyHeaderAdapter adapter;
|
||||||
|
private final ItemVisibilityAdapter visibilityAdapter;
|
||||||
|
private final SparseArray<Rect> headerRects = new SparseArray<>();
|
||||||
|
private final HeaderProvider headerProvider;
|
||||||
|
private final HeaderPositionCalculator headerPositionCalculator;
|
||||||
|
private final HeaderRenderer renderer;
|
||||||
|
private final DimensionCalculator dimensionCalculator;
|
||||||
|
|
||||||
|
private Drawable divider;
|
||||||
|
private Drawable background;
|
||||||
|
private int paddingX;
|
||||||
|
|
||||||
|
private final Rect rect = new Rect();
|
||||||
|
|
||||||
|
public StickyHeaderDecorationCopy(StickyHeaderAdapter adapter, Context context, int resId, int paddingX, Drawable background) {
|
||||||
|
this(adapter, new DimensionCalculator(), null);
|
||||||
|
divider = ContextCompat.getDrawable(context, resId);
|
||||||
|
this.paddingX = paddingX;
|
||||||
|
this.background = background;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public StickyHeaderDecorationCopy(StickyHeaderAdapter adapter, Context context, int resId, int paddingX) {
|
||||||
|
this(adapter, new DimensionCalculator(), null);
|
||||||
|
divider = ContextCompat.getDrawable(context, resId);
|
||||||
|
this.paddingX = paddingX;
|
||||||
|
}
|
||||||
|
|
||||||
|
private StickyHeaderDecorationCopy(StickyHeaderAdapter adapter,
|
||||||
|
DimensionCalculator dimensionCalculator, ItemVisibilityAdapter visibilityAdapter) {
|
||||||
|
this(adapter, dimensionCalculator, new HeaderRenderer(), new HeaderViewCache(adapter), visibilityAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private StickyHeaderDecorationCopy(StickyHeaderAdapter adapter, DimensionCalculator dimensionCalculator,
|
||||||
|
HeaderRenderer headerRenderer, HeaderProvider headerProvider,
|
||||||
|
ItemVisibilityAdapter visibilityAdapter) {
|
||||||
|
this(adapter, headerRenderer, dimensionCalculator, headerProvider,
|
||||||
|
new HeaderPositionCalculator(adapter, headerProvider,
|
||||||
|
dimensionCalculator), visibilityAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private StickyHeaderDecorationCopy(StickyHeaderAdapter adapter, HeaderRenderer headerRenderer,
|
||||||
|
DimensionCalculator dimensionCalculator, HeaderProvider headerProvider,
|
||||||
|
HeaderPositionCalculator headerPositionCalculator, ItemVisibilityAdapter visibilityAdapter) {
|
||||||
|
this.adapter = adapter;
|
||||||
|
this.headerProvider = headerProvider;
|
||||||
|
this.renderer = headerRenderer;
|
||||||
|
this.dimensionCalculator = dimensionCalculator;
|
||||||
|
this.headerPositionCalculator = headerPositionCalculator;
|
||||||
|
this.visibilityAdapter = visibilityAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||||
|
super.getItemOffsets(outRect, view, parent, state);
|
||||||
|
|
||||||
|
int itemPosition = parent.getChildAdapterPosition(view);
|
||||||
|
if (itemPosition == RecyclerView.NO_POSITION) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (headerPositionCalculator.hasNewHeader(itemPosition)) {
|
||||||
|
View header = getHeaderView(parent, itemPosition);
|
||||||
|
setItemOffsetsForHeader(outRect, header, LinearLayout.VERTICAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the offsets for the first item in a section to make room for the header view
|
||||||
|
*
|
||||||
|
* @param itemOffsets rectangle to define offsets for the item
|
||||||
|
* @param header view used to calculate offset for the item
|
||||||
|
* @param orientation used to calculate offset for the item
|
||||||
|
*/
|
||||||
|
private void setItemOffsetsForHeader(Rect itemOffsets, View header, int orientation) {
|
||||||
|
dimensionCalculator.initMargins(rect, header);
|
||||||
|
if (orientation == LinearLayoutManager.VERTICAL) {
|
||||||
|
itemOffsets.top = header.getHeight() + rect.top + rect.bottom;
|
||||||
|
} else {
|
||||||
|
itemOffsets.left = header.getWidth() + rect.left + rect.right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||||
|
super.onDrawOver(c, parent, state);
|
||||||
|
|
||||||
|
final int childCount = parent.getChildCount();
|
||||||
|
if (childCount <= 0 || adapter.getItemCount() <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < childCount; i++) {
|
||||||
|
View itemView = parent.getChildAt(i);
|
||||||
|
int position = parent.getChildAdapterPosition(itemView);
|
||||||
|
if (position == RecyclerView.NO_POSITION) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean hasStickyHeader = headerPositionCalculator.hasStickyHeader(itemView, LinearLayout.VERTICAL, position);
|
||||||
|
if (hasStickyHeader || headerPositionCalculator.hasNewHeader(position)) {
|
||||||
|
View header = headerProvider.getHeader(parent, position);
|
||||||
|
//re-use existing Rect, if any.
|
||||||
|
Rect headerOffset = headerRects.get(position);
|
||||||
|
if (headerOffset == null) {
|
||||||
|
headerOffset = new Rect();
|
||||||
|
headerRects.put(position, headerOffset);
|
||||||
|
}
|
||||||
|
headerPositionCalculator.initHeaderBounds(headerOffset, parent, header, itemView, hasStickyHeader);
|
||||||
|
renderer.drawHeader(parent, c, header, headerOffset);
|
||||||
|
drawDivider(c, headerOffset, header);// TODO move to renderer?
|
||||||
|
drawBackground(header);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the position of the header under the specified (x, y) coordinates.
|
||||||
|
*
|
||||||
|
* @param x x-coordinate
|
||||||
|
* @param y y-coordinate
|
||||||
|
* @return position of header, or -1 if not found
|
||||||
|
*/
|
||||||
|
public int findHeaderPositionUnder(int x, int y) {
|
||||||
|
for (int i = 0; i < headerRects.size(); i++) {
|
||||||
|
Rect rect = headerRects.get(headerRects.keyAt(i));
|
||||||
|
if (rect.contains(x, y)) {
|
||||||
|
int position = headerRects.keyAt(i);
|
||||||
|
if (visibilityAdapter == null || visibilityAdapter.isPositionVisible(position)) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the header view for the associated position. If it doesn't exist yet, it will be
|
||||||
|
* created, measured, and laid out.
|
||||||
|
*
|
||||||
|
* @param parent the recyclerview
|
||||||
|
* @param position the position to get the header view for
|
||||||
|
* @return Header view
|
||||||
|
*/
|
||||||
|
public View getHeaderView(RecyclerView parent, int position) {
|
||||||
|
return headerProvider.getHeader(parent, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invalidates cached headers. This does not invalidate the recyclerview, you should do that manually after
|
||||||
|
* calling this method.
|
||||||
|
*/
|
||||||
|
public void invalidateHeaders() {
|
||||||
|
headerProvider.invalidate();
|
||||||
|
headerRects.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawDivider(Canvas c, Rect bounds, View header) {
|
||||||
|
int left = bounds.left;
|
||||||
|
int right = bounds.right;
|
||||||
|
|
||||||
|
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) header.getLayoutParams();
|
||||||
|
|
||||||
|
int top = header.getBottom() + params.bottomMargin;
|
||||||
|
int bottom = top + divider.getIntrinsicHeight();
|
||||||
|
|
||||||
|
divider.setBounds(left + paddingX, top, right - paddingX, bottom);
|
||||||
|
divider.draw(c);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawBackground(View header) {
|
||||||
|
if (this.background != null) {
|
||||||
|
|
||||||
|
Bitmap bitmap = ((BitmapDrawable)background).getBitmap();
|
||||||
|
Bitmap croppedBitmap = Bitmap.createBitmap(bitmap, (int) header.getX(), (int) header.getY(), header.getWidth(), header.getHeight());
|
||||||
|
header.setBackground(new BitmapDrawable(croppedBitmap));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawBackground(RecyclerView parent, View header) {
|
||||||
|
View rootView = parent.getRootView();
|
||||||
|
Bitmap originalBitmap = ((BitmapDrawable)rootView.getBackground()).getBitmap();;
|
||||||
|
|
||||||
|
Bitmap croppedBitmap = Bitmap.createBitmap(originalBitmap, (int)header.getX(), (int)header.getY(), header.getWidth(), header.getHeight());
|
||||||
|
header.setBackground(new BitmapDrawable(croppedBitmap));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/swipe2/SwipableElement.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/swipe2/SwipableElement.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/swipe2/SwipableRecycler.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/swipe2/SwipableRecycler.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/swipe2/SwipeMenu.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/swipe2/SwipeMenu.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/swipe2/SwipeMenuItem.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/swipe2/SwipeMenuItem.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/swipe2/SwipeMenuLayout.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/items/swipe2/SwipeMenuLayout.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/sets/ItemTouchHelperAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/sets/ItemTouchHelperAdapter.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/sets/ItemTouchHelperViewHolder.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/sets/ItemTouchHelperViewHolder.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/sets/OnStartDragListener.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/sets/OnStartDragListener.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/sets/SimpleItemTouchHelperCallback.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/presenter/adapters/helper/sets/SimpleItemTouchHelperCallback.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/fragments/AddFragment.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/fragments/AddFragment.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/fragments/ItemDetailFragment.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/fragments/ItemDetailFragment.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/fragments/ItemListFragment.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/fragments/ItemListFragment.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/fragments/PackedListFragment.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/fragments/PackedListFragment.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/fragments/SetListFragment.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/fragments/SetListFragment.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/fragments/ShareFragment.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/fragments/ShareFragment.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/recycler/AddItemViewHolder.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/recycler/AddItemViewHolder.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/recycler/HeaderViewHolder.java
Normal file → Executable file
0
app/src/main/java/com/hikapro/backpack/view/recycler/HeaderViewHolder.java
Normal file → Executable file
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue