Giter Site home page Giter Site logo

yablokovdmitry / stepviewpager Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 1.0 184 KB

Android directional Step View Pager with customizable indicators

License: Apache License 2.0

Java 100.00%
android android-ui android-library stepview viewpager steps animated-steps

stepviewpager's Introduction

Android StepViewPager

Implementation of the compatibility library ViewPager with customizable Indicators (drawables not required) that supports paging both vertically and horizontally. You can configure the appearance by simply specifying various attributes.

how to use

Add it in your root build.gradle at the end of repositories:

        repositories {
	    ...
	    maven { url "https://jitpack.io" }
         }	

Add the dependency

        dependencies {
            ...
            implementation 'com.android.support:recyclerview-v7:28.0.0'
            implementation 'com.google.guava:guava:27.0.1-android'
            implementation 'com.github.YablokovDmitry:StateViewPager:v1.1'
        }

use StepViewPager

in code

        StateViewPager mPager = findViewById(R.id.pager);
        mPager.setAdapter(new TestAdapter(getSupportFragmentManager()));
        
        // Setting options
        mPager.setNumberOfIcons(4)
                .setOrientation(LinearLayout.VERTICAL)
                .setMargins(10, 10, 10, 10)
                .setGravity(Gravity.LEFT)
                .setIconSize(26, 26)
                .setSelectedIconSize(25, 25)
                .setOnIconClickListener(new StateViewPager.OnIconClickListener() {
                    @Override
                    public void onIconClick(int iconNum) {
                        mPager.setPage(iconNum, true);
                    }
                })
                .setMarginBetweenIcons(0)
                .setIntermediateIconSize(3, 130)
                .setShowCheckmarks(false, false, false)
                .setShowNumbers(false, false, false)
                .setNumberColors(Color.GRAY, Color.WHITE, Color.GRAY)
                .setBorderColors(Color.parseColor("#D6DBDF"), Color.parseColor("#f0f0f0"), Color.parseColor("#D6DBDF"))
                .setGradientColors(false, false, false)
                .setTitles(new String[]{
                        "Shipping",
                        "Payment",
                        "Confirm",
                        "Done!"})
                .setIconColors(Color.parseColor("#0288D1"), Color.parseColor("#0288D1"), Color.parseColor("#f0f0f0"))
                .setRectangularIcons(false, false, false)
                .setBorderSizes(0, 7, 0)
                .setTextColors(Color.parseColor("#909090"), Color.parseColor("#0288D1"), Color.GRAY)
                .setTextStyles(Typeface.BOLD, Typeface.BOLD, Typeface.BOLD)
                .setTextGravities(Gravity.RIGHT, Gravity.RIGHT, Gravity.RIGHT)
                .setTextSizes(12, 12, 12)
                .setTextMargins(5, 5, 5)
                .setIntermediateIconColors(Color.parseColor("#0288D1"), Color.parseColor("#f0f0f0"))
                .setIntermediateIconStyles("solid", "solid");
        
        mPager.setCurrentItem(0);
      

in xml

<com.ydn.viewpagerwithicons.StateViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="400dp"
        android:orientation="horizontal"/>

Setting options in layout are also possible

<com.ydn.viewpagerwithicons.StateViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:entries="@array/titles"
        android:orientation="horizontal"

        app:topMargin="10dp"
        app:bottomMargin="10dp"
        app:leftMargin="10dp"
        app:rightMargin="10dp"
        
        app:iconHeight="30dp"
        app:iconWidth="30dp"

        app:iconsGravity="left"
        app:intermediateHeight="2dp"
        app:intermediateWidth="90dp"
        app:marginBetweenIcons="30dp"
        app:numOfIcons="3"
        app:rectangularSelectedIcon="true"

        app:selectedBorderColor="#FFA233"
        app:selectedBorderWidth="15dp"
        app:selectedColor="#e0e0e0"
        app:selectedHeight="30dp"
        app:selectedTextColor="#FFA233"
        app:selectedTextGravity="right"
        app:selectedTextMargin="10dp"
        app:selectedTextSize="14sp"
        app:selectedTextStyle="bold"
        app:selectedWidth="30dp"
        app:showVisitedCheckmark="true"

        app:unvisitedBorderColor="#909090"
        app:unvisitedBorderWidth="2dp"
        app:unvisitedColor="#e0e0e0"
        app:unvisitedIntermediateColor="#909090"
        app:unvisitedIntermediateStyle="dotted"
        app:unvisitedTextColor="#909090"

        app:unvisitedTextGravity="bottom"
        app:unvisitedTextMargin="10dp"
        app:unvisitedTextSize="14sp"
        app:unvisitedTextStyle="normal"

        app:visitedBorderColor="#FFA233"
        app:visitedBorderWidth="2dp"
        app:visitedCheckmarkColor="@android:color/holo_blue_light"

        app:visitedColor="#e0e0e0"
        app:visitedIntermediateColor="#FFA233"
        app:visitedIntermediateStyle="solid"
        app:visitedTextColor="#909090"
        app:visitedTextGravity="bottom"
        app:visitedTextMargin="10dp"
        app:visitedTextSize="14sp"
        app:visitedTextStyle="normal" />

Sample application

Sample application is also available in the releases section

Developed By

License


Copyright 2021 Dmitry Yablokov.

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.

stepviewpager's People

Contributors

yablokovdmitry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.