Giter VIP home page Giter VIP logo

pager's Introduction

Pager

API Android Arsenal Pager AndroidDevDigest UX Planet AndroidWeekly AwesomeAndroid Download

๐Ÿ”ฅ An android library to get simple menu options to ๐Ÿ’ช. Inspired by AndroidResideMenu.

GIF

AndroidPub(Medium) Post

You can read the AndroidPub post about this library, the perks it provides and other details here.

Prerequisites

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
		repositories {
			...
			maven { url 'https://www.jitpack.io' }
		}
	}

Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies 
	        implementation 'com.github.Pradyuman7:Pager:V1.1'
	}

Usage

  • Add the layout in your XML file for the activity, like this:
<?xml version="1.0" encoding="utf-8"?>
<merge
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.pd.cards.Main2Activity"
    tools:ignore="all"
    tools:showIn="@layout/activity_main2">

    <com.pd.pager.PagerLayout
        android:id="@+id/rl_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        app:num="five"/>
</merge>

<com.pd.pager.PagerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

</com.pd.pager.PagerLayout>

  • Configure the layout and add the fragments like this:
PagerLayout pager = findViewById(R.id.rl_main);

        List<String> titleList = new ArrayList<>();
        titleList.add("Page1");
        titleList.add("Page2");
        titleList.add("Page3");
        titleList.add("Page4");
        titleList.add("Page5");

        if(pager == null)
            Log.i("Pager_Null","Pager is null");


        pager.setTitles(titleList);


        fragments.add(new Page1());
        fragments.add(new Page2());
        fragments.add(new Page3());
        fragments.add(new Page4());
        fragments.add(new Page5());

        FragmentPagerAdapter adapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
            @Override
            public Fragment getItem(int position) {
                return fragments.get(position);
            }

            @Override
            public int getCount() {
                return fragments.size();
            }
        };

        pager.setAdapter(adapter);
  • See the app code to know more about this.

Pull Request

Have some new ideas or found a bug? Do not hesitate to open an issue and make a pull request.

License

Pager is under License: GPL v3. See the LICENSE file for more info.

pager's People

Contributors

pradyuman7 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

pager's Issues

IndexOutOfBoundsException for pager.setTitles()

Describe the bug
IndexOutOfBoundsException for pager.setTitles() occurs

To Reproduce
Steps to reproduce the behavior:

  1. Just make two pages and try pager.setTitles()

Expected behavior
Exception causes the app to crash.

Add tests

Test everything and with get the most code coverage.
Understand what lowers the quality of the code and improve it.
Try different techniques to maximise the amount of bugs solved.
Unit tests, mocks, integration tests and everything else to test the library working thoroughly

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.