Fix getClipToPadding NoSuchMethod
This commit is contained in:
1 parent
352b2c1834
commit
e2eb8ed9ea
1 file changed
+12
-2
@@ -169,6 +169,8 @@ public class EasyRecyclerView extends RecyclerView {
|
||||
|
||||
private OnDrawSelectorListener mOnDrawSelectorListener;
|
||||
|
||||
private boolean mClipToPadding = false;
|
||||
|
||||
public EasyRecyclerView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@@ -190,6 +192,13 @@ public class EasyRecyclerView extends RecyclerView {
|
||||
mActionBarActivity = actionBarActivity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClipToPadding(boolean clipToPadding) {
|
||||
super.setClipToPadding(clipToPadding);
|
||||
|
||||
mClipToPadding = clipToPadding;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -268,8 +277,9 @@ public class EasyRecyclerView extends RecyclerView {
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(@NonNull Canvas canvas) {
|
||||
boolean clipToPadding = mClipToPadding;
|
||||
int saveCount = 0;
|
||||
if (getClipToPadding()) {
|
||||
if (clipToPadding) {
|
||||
saveCount = canvas.save();
|
||||
final int scrollX = getScrollX();
|
||||
final int scrollY = getScrollY();
|
||||
@@ -295,7 +305,7 @@ public class EasyRecyclerView extends RecyclerView {
|
||||
drawSelector(canvas);
|
||||
}
|
||||
|
||||
if (getClipToPadding()) {
|
||||
if (clipToPadding) {
|
||||
canvas.restoreToCount(saveCount);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user