CardPager

A modified ViewPager that behaves like a card stack

Лицензия

Лицензия

Группа

Группа

com.oguzbabaoglu
Идентификатор

Идентификатор

cardpager
Последняя версия

Последняя версия

0.1
Дата

Дата

Тип

Тип

aar
Описание

Описание

CardPager
A modified ViewPager that behaves like a card stack
Ссылка на сайт

Ссылка на сайт

https://github.com/oguzbabaoglu/android-card-pager
Система контроля версий

Система контроля версий

https://github.com/oguzbabaoglu/android-card-pager

Скачать cardpager

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.oguzbabaoglu/cardpager/ -->
<dependency>
    <groupId>com.oguzbabaoglu</groupId>
    <artifactId>cardpager</artifactId>
    <version>0.1</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.oguzbabaoglu/cardpager/
implementation 'com.oguzbabaoglu:cardpager:0.1'
// https://jarcasting.com/artifacts/com.oguzbabaoglu/cardpager/
implementation ("com.oguzbabaoglu:cardpager:0.1")
'com.oguzbabaoglu:cardpager:aar:0.1'
<dependency org="com.oguzbabaoglu" name="cardpager" rev="0.1">
  <artifact name="cardpager" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.oguzbabaoglu', module='cardpager', version='0.1')
)
libraryDependencies += "com.oguzbabaoglu" % "cardpager" % "0.1"
[com.oguzbabaoglu/cardpager "0.1"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
com.android.support » support-v4 jar 22.1.0

Модули Проекта

Данный проект не имеет модулей.

CardPager

A modified ViewPager that behaves like a card stack.

Pages can be swiped left or right, moving onto the next page in the stack. A common use case is to like or dislike content based on swipe direction.

Including In Your Project

Latest version: Maven Central

dependencies {
    compile 'com.oguzbabaoglu:cardpager:0.1'
}

Usage

For a working implementation see the example/ folder.

Usage is very similar to a normal ViewPager.

  1. Include a CardPager in your layout.
<com.oguzbabaoglu.cardpager.CardPager
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/view_cardpager"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
/>
  1. Attach a PagerAdapter.
CardPager cardPager = (CardPager) findViewById(R.id.view_cardpager);
cardPager.setAdapter(new ColorAdapter(this));
  1. Implement a OnCardChangeListener to react to swipes.
cardPager.setOnCardChangeListener(new CardPager.SimpleOnCardChangeListener() {
   @Override
   public void onCardDismissed(int position, boolean right) {
       if (right) {
           onLike(position);
       } else {
           onDisLike(position);
       }
   }
});

Todo

  • Allow margins on pages.
  • Allow transformers for different swipe effects.
  • Add back Accessibility options.

License

Copyright 2015 Oguz Babaoglu

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.

Версии библиотеки

Версия
0.1