Giter VIP home page Giter VIP logo

viewpagerslideshow's Introduction

#ViewPager SlideShow

ViewPageSlideShow is a simple transaformation of Android's ViewPager into a slide show widget that displays image from URLs as well as app resources.

#####Important: This code is incomplete, has not been fully tested and was not written for production but as a demo! So use at your own risk ;)

##Features

  • Play, stop, next & previous TODO
  • Slide timer & transitionsFIXME
  • Auto zoom & pan TODO
  • Image title & description TODO
  • Asynchronous loading of images, loading happens outside the UI thread
  • Images are cached to memory and to disk for super fast loading

##Usage

For a working implementation of this project see the exmaple/ folder.

  1. Include the widget in your view.

    <com.aksalj.viewpagerslideshow.ViewPagerSlideShow xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="0.7" android:background="#fff" android:id="@+id/slideshow" app:unselectedColor="#fff" app:strokeWidth="5dp" app:autoPlay="true" app:lineStyle="bar" app:timerPosition="topRight" app:slideTransition="fade" app:timerOpacity="0.5" app:slideDelay="4500" />

  2. In your onCreate method (or onCreateView for a fragment), add an adapter to the slide show widget

    //Have your image resources
    //int[] IMAGES = {R.drawable.img_1, R.drawable.img_2};
    // or urls
    String[] IMAGES = {"http://somesite.xx/img.png", "http://someothersite.xc/img.jpg"};
    
    
    //Set the slideshow with an adapter
    ViewPager slideshow = (pagerSlideshow)findViewById(R.id.slideshow);
    SlideShowAdapter adapter = new SlideShowAdapter(getSupportFragmentManager(), IMAGES);
    slideshow.setAdapter(adapter);
    
  3. Now you can play/stop, the slide show

    //continued from above
    slideshow.play();
    slideshow.next();
    slideshow.prev();
    slideshow.stop();
    
  4. (Optional) If you what to listen to slide change, use an OnPageChangeListener and set it as follows:

    //continued from above
    slideshow.setOnSlideChangeListener(mPageChangeListener);
    //or
    slideshow.setOnPageChangeListener(mPageChangeListener);
    

This project depends on the ViewPager class which is available in the Android Support Library or ActionBarSherlock.

##Customization TODO

##Credit TODO

###License TODO

viewpagerslideshow's People

Contributors

aksalj avatar

Watchers

James Cloos avatar Syifa Afifah  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.