-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Support ViewPager in BottomSheet #2188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Fix swipe gestures
return view; | ||
} | ||
if (view instanceof ViewPager2) { | ||
ViewPager2 viewPager2 = (ViewPager2) view; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to declare a separate local variable.
@@ -1286,12 +1288,32 @@ boolean shouldHide(@NonNull View child, float yvel) { | |||
return Math.abs(newTop - collapsedOffset) / (float) peek > HIDE_THRESHOLD; | |||
} | |||
|
|||
@Nullable | |||
private View getCurrentViewWithVP2(ViewPager2 viewPager) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getCurrentViewFromViewPager?
if(((RecyclerView) child).getLayoutManager() == null) | ||
return null; | ||
child = ((RecyclerView) child).getLayoutManager().findViewByPosition(currentItem); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else return null?
@@ -65,6 +65,8 @@ | |||
import com.google.android.material.resources.MaterialResources; | |||
import com.google.android.material.shape.MaterialShapeDrawable; | |||
import com.google.android.material.shape.ShapeAppearanceModel; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import androidx.viewpager2.widget.ViewPager2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need dependency to ViewPager2? This code may be applied to any ViewGroup
Fix swipe gestures
Thanks for starting a pull request on Material Components!
Don't forget:
[Buttons] Updated documentation
closes #1234
Contributing
has more information and tips for a great pull request.