UltraViewPager


Source link: https://github.com/alibaba/UltraViewPager

UltraViewPager

????

Project UltraViewPager is a ViewPager extension that encapsulates multiple features, mainly to provide a unified solution for multi-page switching scenarios.

Main Feature

  • support horizontal scrolling and vertical scrolling
  • support multi views in one viewpager
  • support switching views circularly. For example, if there are 3 views to display in a ViewPager, it should switch back to the first view after the third view.
  • support auto-scrolling feature?implemented timer with Handler.
  • support setting max-height and max-width for this ViewPager.
  • support setting the aspect ratio for UltraViewPager.
  • UltraViewPager has a built-in indicator. support circle and icon style.
  • built-in two kind of page tansition animation.

you can combine multiple features at the same time.

Design

UltraViewPager is a super extension for ViewPager. It's actually a RelativeLayout in order to display ViewPager and Indicator.UltraViewPager offers some common method delegate for ViewPager, you can also invoke more method by call getViewPager() and get the actual ViewPager.

In order to achieve vertical scroll, through exchanging MotionEvent in onInterceptTouchEvent and onTouchEvent.For more details, you can read the source code.

Usage

Please find the latest version(1.0.6.1 so far) in maven repository. The newest version has been upload to jcenter and MavenCantral, make sure you have added at least one of these repositories.

Using Gradle:

//gradle compile ('com.alibaba.android:ultraviewpager:1.0.6.1@aar') {
  transitive = true 
}
 

or grab via Maven:

//pom.xml in maven <dependency>
<groupId>com.alibaba.android</groupId>
<artifactId>ultraviewpager</artifactId>
<version>1.0.6.1</version>
<type>aar</type> </dependency>  

Create your own layout using a UltraViewPager:

activity_pager.xml

<com.tmall.ultraviewpager.UltraViewPager
  android:id="@+id/ultra_viewpager"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:layout_centerInParent="true"
  android:background="@android:color/darker_gray" /> 

You can follow my tutorial below on how to use UltraViewPager:

UltraViewPager ultraViewPager = (UltraViewPager)findViewById(R.id.ultra_viewpager);
 ultraViewPager.setScrollMode(UltraViewPager.ScrollMode.HORIZONTAL);
 //initialize UltraPagerAdapter?and add child view to UltraViewPager PagerAdapter adapter = new UltraPagerAdapter(false);
 ultraViewPager.setAdapter(adapter);
  //initialize built-in indicator ultraViewPager.initIndicator();
 //set style of indicators ultraViewPager.getIndicator()
  .setOrientation(UltraViewPager.Orientation.HORIZONTAL)
  .setFocusColor(Color.GREEN)
  .setNormalColor(Color.WHITE)
  .setRadius((int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics()));
 //set the alignment ultraViewPager.getIndicator().setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
 //construct built-in indicator, and add it to  UltraViewPager ultraViewPager.getIndicator().build();
  //set an infinite loop ultraViewPager.setInfiniteLoop(true);
 //enable auto-scroll mode ultraViewPager.setAutoScroll(2000);
  

For other API reference,see this to read more.

DEMO

Demo Project

Contributing

Before you open an issue or create a pull request, please read Contributing Guide first.

LICENSE

UltraViewPager is available under the MIT license.

Resources

It's just a realtime blurring overlay like iOS UIVisualEffectView.

A cool animated RecyclerView clock face scroller.

Android dependency visualizer. This tool helps to visualize current state of your project. It's really easy to see coupling between classes.

Android Image Viewer inspired by StackOverflow's with swipe-to-dismiss and moving animations.

Android Library to help you with your date & time pickers while retaining the instance of the pickers on orientation change.

Simple, easy and super fast dynamic view creation with awesome animations prebuilt!

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes