Code Monkey home page Code Monkey logo

progresspageindicator's Introduction

Download Android Arsenal

ProgressPageIndicator

A native library for Android that provides a filling Page Indicator for viewpagers

Sample Screenshot

For a working implementation, Have a look at the Sample Project - app module

  1. Include the library as local library project or get it from jCenter().

    add in your dependencies,

     compile 'com.siriscac:progresspageindicator:1.1.0'
  2. Include the ProgressPageIndicator widget in your layout.

 <com.cepheuen.progresspageindicator.ProgressPageIndicator
      android:id="@+id/pageIndicator"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:dotGap="2dp"
      app:fillColor="#cccccc"
      app:radius="8dp" />
  1. Refer the widget from the layout and set the viewpager to it by using setViewPager().
 pagerIndicator = (ProgressPageIndicator) findViewById(R.id.dotsL);
 pagerIndicator.setViewPager(viewPager);

#Customization

There are five attributes which are applicable to ProgressPageIndicator.

  • strokeRadius Radius of the stroke

  • dotGap Space between the indicators

  • strokeColor Color of the Stroke

  • fillColor Color of the Fill

  • radius Radius of the indicator

  • You can also set these attributes from your java code by calling setStrokeColor(strokeColor), setFillColor(fillColor), setRadius(Radius), setStrokeRadius(strokeRadius), setDotGap(dotGap) respectively.

#Compatibility

  • Android Honeycomb 3.0+

#Changelog

Version: 1.1

  • Fix NPE on setting Empty Adapters

Version: 1.0

  • Initial Build

#Author

#License

Copyright 2015 Muthuramakrishnan

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.

progresspageindicator's People

Contributors

siriscac avatar zmarkan avatar

Stargazers

 avatar Sion avatar Waqas  avatar 김현준 avatar Achuth Narayan avatar  avatar  avatar Mehmet Akif Tütüncü avatar Jer Suen avatar Somasundaram M avatar Pedro Henrique Magalhães Braga avatar Nikos Kermanidis avatar ScYr avatar Igor Morais avatar Raul Nayak avatar TryCatch avatar Benoit Billington avatar Michael Basil avatar  avatar macszh2013 avatar Tinashe avatar wiki avatar Ricardo Amaral avatar Jungle avatar ZiMo(熊文财) avatar Rainer-Lang avatar  avatar  avatar Aizaz AZ avatar  avatar Kent avatar LiqiangZhang avatar haikuowuya avatar MAY3AM avatar  avatar Keishin Yokomaku avatar  avatar G avatar Ren  Yu avatar Ángel Soliño avatar 脉脉不得语 avatar zhoubing avatar mjw avatar Pranav Lathigara avatar  avatar Amine Laadhari avatar Rafael Toledo avatar Hitesh Chavda avatar Vladislav Bauer avatar

Watchers

James Cloos avatar  avatar Ren  Yu avatar  avatar

progresspageindicator's Issues

Clickable

I am using this for a wizard like flow where it would be nice to be able to jump to pages by clicking on dots. With the default sized dots this doesn't make sense but I am using fairly large dots so it would work. A simple onClickListener that passed the section number (dot number) would be perfect.

Crashes on empty adapter.

Tried adding this to a viewpager that has an adapter with no items in it, and it crashes:

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setImageDrawable(android.graphics.drawable.Drawable)' on a null object reference
            at com.cepheuen.progresspageindicator.ProgressPageIndicator.fillDots(ProgressPageIndicator.java:222)
            at com.cepheuen.progresspageindicator.ProgressPageIndicator.initialize(ProgressPageIndicator.java:185)
            at com.cepheuen.progresspageindicator.ProgressPageIndicator.setViewPager(ProgressPageIndicator.java:132)
            at com.seguetech.zippy.fragments.MedicineFragment.onCreateView(MyFragment.java:78)

In my fragment:

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_medicine, container, false);
        viewPager = (ViewPager)v.findViewById(R.id.viewpager);
        imageAdapter = new ImageAdapter();
        viewPager.setAdapter(imageAdapter);
        // crashes on this line.
        ((ProgressPageIndicator)v.findViewById(R.id.pageIndicator)).setViewPager(viewPager); 
    }

The image adapter correctly returns a size of 0, and has no problems waiting for an event to push items into the adapter, where notifyDataSetChanged() is changed, and then the views are populated.

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.