ScrollableViewPagerContent (NestedScrollView integration module)

Prioritize ViewPager's horizontal swipe action over vertical scroll action of inner contents

License

License

GroupId

GroupId

com.h6ah4i.android.scrollableviewpagercontent
ArtifactId

ArtifactId

scrollableviewpagercontent-nestedscrollview
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

aar
Description

Description

ScrollableViewPagerContent (NestedScrollView integration module)
Prioritize ViewPager's horizontal swipe action over vertical scroll action of inner contents
Project URL

Project URL

https://github.com/h6ah4i/android-scrollableviewpagercontent
Source Code Management

Source Code Management

https://github.com/h6ah4i/android-scrollableviewpagercontent

Download scrollableviewpagercontent-nestedscrollview

How to add to project

<!-- https://jarcasting.com/artifacts/com.h6ah4i.android.scrollableviewpagercontent/scrollableviewpagercontent-nestedscrollview/ -->
<dependency>
    <groupId>com.h6ah4i.android.scrollableviewpagercontent</groupId>
    <artifactId>scrollableviewpagercontent-nestedscrollview</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.h6ah4i.android.scrollableviewpagercontent/scrollableviewpagercontent-nestedscrollview/
implementation 'com.h6ah4i.android.scrollableviewpagercontent:scrollableviewpagercontent-nestedscrollview:1.0.0'
// https://jarcasting.com/artifacts/com.h6ah4i.android.scrollableviewpagercontent/scrollableviewpagercontent-nestedscrollview/
implementation ("com.h6ah4i.android.scrollableviewpagercontent:scrollableviewpagercontent-nestedscrollview:1.0.0")
'com.h6ah4i.android.scrollableviewpagercontent:scrollableviewpagercontent-nestedscrollview:aar:1.0.0'
<dependency org="com.h6ah4i.android.scrollableviewpagercontent" name="scrollableviewpagercontent-nestedscrollview" rev="1.0.0">
  <artifact name="scrollableviewpagercontent-nestedscrollview" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.h6ah4i.android.scrollableviewpagercontent', module='scrollableviewpagercontent-nestedscrollview', version='1.0.0')
)
libraryDependencies += "com.h6ah4i.android.scrollableviewpagercontent" % "scrollableviewpagercontent-nestedscrollview" % "1.0.0"
[com.h6ah4i.android.scrollableviewpagercontent/scrollableviewpagercontent-nestedscrollview "1.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
com.h6ah4i.android.scrollableviewpagercontent : scrollableviewpagercontent jar 1.0.0
androidx.appcompat » appcompat jar 1.0.0

Project Modules

There are no modules declared in this project.

ScrollableViewPagerContent

Maven Central

A tiny library which improves UX with ViewPager. This library prioritizes ViewPager's horizontal swipe action over vertical scroll of inner pager contents.

In the standard behavior of Android's ViewPager, paging swipe action of ViewPager has less priority than inner views' vertical scroll. When inner content is in scrolling state, horizontal swipe is completely ignored. However the behavior is considered bad for UX, and that's why I created this library.

Also, I noticed that some major apps implemented the same behavior. (NOTE: These are not using this library.)

  • Play Store app
  • Official Twitter client
  • Mercari

Demo app

Usage

1. Add the following line(s) to build.gradle

// the core module
implementation 'com.h6ah4i.android.scrollableviewpagercontent:scrollableviewpagercontent:1.0.0'

// if you are using RecyclerView, add this too
implementation 'com.h6ah4i.android.scrollableviewpagercontent:scrollableviewpagercontent-recyclerview:1.0.0'

// if you are using NestedScrollView, add this too
implementation 'com.h6ah4i.android.scrollableviewpagercontent:scrollableviewpagercontent-nestedscrollview:1.0.0'

// if you are using ListView, add this too
implementation 'com.h6ah4i.android.scrollableviewpagercontent:scrollableviewpagercontent-listview:1.0.0'

2-A. If using a RecyclerView for the ViewPager content

RecyclerView rv = ...;
rv.addOnItemTouchListener(new ViewPagerContentRecyclerViewTouchEventInterceptor());

2-B. If using a NestedScrollView for the ViewPager content

- <android.support.v4.widget.NestedScrollView> ...
+ <com.h6ah4i.android.scrollableviewpagercontent.nestedscrollview.ViewPagerContentNestedScrollView> ...

2-C. If using a ListView for the ViewPager content

- <ListView> ...
+ <com.h6ah4i.android.scrollableviewpagercontent.listview.ViewPagerContentListView> ...

License

This library is licensed under the Apache Software License, Version 2.0.

See LICENSE for full of the license text.

Copyright (C) 2018 Haruki Hasegawa

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Versions

Version
1.0.0
0.1.2