RollViewPager


Source link: https://github.com/Jude95/RollViewPager

RollViewPager

A Viewpager can auto-play.

?? | English

The touch will pause playback, continue to play until a delay period after the end of the touch.
looks like this,Indicator can be customized to point or number, the gravity can be changed also.

Depandence

compile 'com.jude:rollviewpager:1.4.6'

Usage

<com.jude.rollviewpager.RollPagerView
  android:layout_width="match_parent"
  android:layout_height="180dp"
  app:rollviewpager_play_delay="3000"/>

app:rollviewpager_play_delay="3000" period?unit is ms?0 for no auto-play? default is 0.
app:rollviewpager_hint_gravity="center" graviengty. left, center, right?default is center.
app:rollviewpager_hint_color="#7c7c7c" color for indicator's container.default is black.
app:rollviewpager_hint_alpha="80" alpha for indicator's container?0 for complete transparent?255 for no transparent?default is 0.
app:rollviewpager_hint_paddingLeft="16dp" padding for indicator's container
app:rollviewpager_hint_paddingRight="16dp"
app:rollviewpager_hint_paddingTop="16dp"
app:rollviewpager_hint_paddingBottom="16dp"

Generally just need set the play_delay.

##HintView provide Hintview to DIY the indicator; setHintView(HintView hintview)

  • HintView
    • ShapeHintView
      • IconHintView
      • ColorPointHintView
    • TextHintView

For example:

mRollViewPager.setHintView(new IconHintView(this,R.drawable.point_focus,R.drawable.point_normal));
 mRollViewPager.setHintView(new ColorPointHintView(this, Color.YELLOW,Color.WHITE));
 mRollViewPager.setHintView(new TextHintView(this));
 mRollViewPager.setHintView(null);
//hide the indicator

##ItemClickListener

mRollViewPager.setOnItemClickListener(new OnItemClickListener() {

@Override
public void onItemClick(int position) {

 Toast.makeText(MainActivity.this,"Item "+position+" clicked",Toast.LENGTH_SHORT).show();

}
 
}
);

##Adapter There offer two Adapter for use conveniently.the RollViewPager can also user other PagerAdapter.

####StaticPagerAdapter this Adapter will store the every page(View), Once create multiple use.may take up more memory. Like FragmentPagerAdapter.this can use for any ViewPager;

####DynamicPagerAdapter this Adapter will not store the View.it create new View every time.save the memory. Like FragmentStatePagerAdapter.this can use for any ViewPager;

//the usage of the 2 adapter is same; mRollViewPager.setAdapter(new TestNomalAdapter());
 private class TestNomalAdapter extends StaticPagerAdapter{

  private int[] imgs = {

 R.drawable.img1,

 R.drawable.img2,

 R.drawable.img3,

 R.drawable.img4,
  
}
;

@Override
  public View getView(ViewGroup container, int position) {

ImageView view = new ImageView(container.getContext());

view.setImageResource(imgs[position]);

view.setScaleType(ImageView.ScaleType.CENTER_CROP);

view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

return view;
  
}

 @Override
  public int getCount() {

return imgs.length;
  
}
 
}

####LoopPagerAdapter A loop adapter.realize by return MAX_INT in getCount(). same as StaticPagerAdapter in page store.Once create multiple use. this adapter only for RollViewPager. the usage is very simple?

mRollViewPager.setAdapter(new TestLoopAdapter(mRollViewPager));
 private class TestLoopAdapter extends LoopPagerAdapter{

  private int[] imgs = {

 R.drawable.img1,

 R.drawable.img2,

 R.drawable.img3,

 R.drawable.img4,
  
}
;

 public TestLoopAdapter(RollPagerView viewPager) {

super(viewPager);

  
}

 @Override
  public View getView(ViewGroup container, int position) {

ImageView view = new ImageView(container.getContext());

view.setImageResource(imgs[position]);

view.setScaleType(ImageView.ScaleType.CENTER_CROP);

view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

return view;
  
}

 @Override
  public int getRealCount() {

return imgs.length;
  
}
 
}

Play Control

rollViewPager.pause() rollViewPager.resume() rollViewPager.isPlaying()

License

Copyright 2015 Jude  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. 

Resources

Trianglify is an Android library that helps creates views with beautiful patterns. Trianglify is based on MVP architecture and licensed under MIT license.

Simple threading library using annotations for Android. This library makes it very easier to do any task on any thread. You can simply annotate a method to execute on any particular task and you are ready to go.

Clean MVP Architecture with Dagger2 + Retrofit2 + Fresco + GenericRecyclerAdapter for Kotlin.

This repo contains demo module which retrieves mars images from the NASA API. The main purpose of the repo is to reduce the time spent on starting a new project or adding new modules to your existing project. You can add new modules with just 2-3 clicks without writing any code.

This application is example of Android Architecture Components which implements MVVM Pattern.

Configurable typing indicator for Android

A lightweight Android library for customizable alerts.

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