-
Notifications
You must be signed in to change notification settings - Fork 911
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix viewpager onInterceptTouchEvent issue
- Loading branch information
Showing
7 changed files
with
84 additions
and
13 deletions.
There are no files selected for viewing
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
29 changes: 29 additions & 0 deletions
29
chat/src/main/java/cn/wildfire/chat/kit/widget/ViewPagerFixed.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,29 @@ | ||
package cn.wildfire.chat.kit.widget; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.MotionEvent; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.viewpager.widget.ViewPager; | ||
|
||
public class ViewPagerFixed extends ViewPager { | ||
public ViewPagerFixed(@NonNull Context context) { | ||
super(context); | ||
} | ||
|
||
public ViewPagerFixed(@NonNull Context context, @Nullable AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
@Override | ||
public boolean onInterceptTouchEvent(MotionEvent ev) { | ||
try { | ||
return super.onInterceptTouchEvent(ev); | ||
} catch (IllegalArgumentException ex) { | ||
ex.printStackTrace(); | ||
} | ||
return false; | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
emojilibrary/src/main/java/com/lqr/emoji/ViewPagerFixed.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,38 @@ | ||
package com.lqr.emoji; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
import android.view.MotionEvent; | ||
|
||
import androidx.viewpager.widget.ViewPager; | ||
|
||
public class ViewPagerFixed extends ViewPager { | ||
|
||
public ViewPagerFixed(Context context) { | ||
super(context); | ||
} | ||
|
||
public ViewPagerFixed(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
@Override | ||
public boolean onTouchEvent(MotionEvent ev) { | ||
try { | ||
return super.onTouchEvent(ev); | ||
} catch (IllegalArgumentException ex) { | ||
ex.printStackTrace(); | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean onInterceptTouchEvent(MotionEvent ev) { | ||
try { | ||
return super.onInterceptTouchEvent(ev); | ||
} catch (IllegalArgumentException ex) { | ||
ex.printStackTrace(); | ||
} | ||
return false; | ||
} | ||
} |