-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update code - added smooth scroll for horizonal lists - fix conflict …
…with swipy refresh layout
- Loading branch information
Reza Amuzadeh
committed
Jul 13, 2019
1 parent
7f87709
commit bd5b3e3
Showing
8 changed files
with
67 additions
and
27 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
library/src/main/java/com/vasl/recyclerlibrary/customViews/CustomSwipeRefreshLayout.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.vasl.recyclerlibrary.customViews; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.MotionEvent; | ||
import android.view.ViewConfiguration; | ||
|
||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; | ||
|
||
public class CustomSwipeRefreshLayout extends SwipeRefreshLayout { | ||
|
||
private int mTouchSlop; | ||
|
||
private float mPrevX; | ||
|
||
public CustomSwipeRefreshLayout(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); | ||
} | ||
|
||
@Override | ||
public boolean onInterceptTouchEvent(MotionEvent event) { | ||
|
||
switch (event.getAction()) { | ||
case MotionEvent.ACTION_DOWN: | ||
mPrevX = MotionEvent.obtain(event).getX(); | ||
break; | ||
|
||
case MotionEvent.ACTION_MOVE: | ||
final float eventX = event.getX(); | ||
float xDiff = Math.abs(eventX - mPrevX); | ||
|
||
if (xDiff > mTouchSlop) { | ||
return false; | ||
} | ||
} | ||
|
||
return super.onInterceptTouchEvent(event); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters