All Projects → BakerJQ → Android Infinitecards

BakerJQ / Android Infinitecards

Licence: apache-2.0
An infinite card switching UI for Android, support custom animation 自定义实现神奇动效的卡片切换视图

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android Infinitecards

Android-Material-Design-Template
Android Material Design UI Template , with Google Design support , card view , butterknife , CoordinateLayout , CollapsingToolbar .
Stars: ✭ 56 (-96.69%)
Mutual labels:  card, cardview
Uicard
Generic UI for card games like Hearthstone, Magic Arena and Slay the Spire...
Stars: ✭ 142 (-91.61%)
Mutual labels:  card, cardview
Flutter Infinitecards
An infinite card switching UI for Flutter, support custom animation 自定义实现神奇动效的卡片切换视图
Stars: ✭ 333 (-80.32%)
Mutual labels:  card, cardview
flip view
A Flutter app with flip animation to view profiles of friends. 🌟
Stars: ✭ 69 (-95.92%)
Mutual labels:  card, cardview
react-native-shadow-cards
Cards are a great way to display information, usually containing content and actions about a single subject. Cards can contain images, buttons, text and more.
Stars: ✭ 42 (-97.52%)
Mutual labels:  card, cardview
Cardslideview
一行代码实现ViewPager卡片效果,比ViewPager2更强大,底层同样是RecyclerView
Stars: ✭ 301 (-82.21%)
Mutual labels:  card, cardview
React Native Cardview
Native CardView for react-native (All Android version and iOS)
Stars: ✭ 426 (-74.82%)
Mutual labels:  card, cardview
Vue Card Diy
Canvas-based custom card vue app
Stars: ✭ 83 (-95.09%)
Mutual labels:  card
Pokerhandevaluator
Poker-Hand-Evaluator: An efficient poker hand evaluation algorithm and its implementation, supporting 7-card poker and Omaha poker evaluation
Stars: ✭ 101 (-94.03%)
Mutual labels:  card
Stacked Cards
Give your content boxes a stacked cards look with each card swapping with other.
Stars: ✭ 83 (-95.09%)
Mutual labels:  card
Android Cardview Recyclerview
Let's play with Android CardView, RecyclerView, Retrofit and Picasso Library. You can read details procedure about those library in my Bengali blog site.
Stars: ✭ 72 (-95.74%)
Mutual labels:  cardview
Card Game Simulator
Create, Share, and Play
Stars: ✭ 87 (-94.86%)
Mutual labels:  card
Xamarincontrols
Cross-platform controls for Xamarin and Xamarin.Forms.
Stars: ✭ 104 (-93.85%)
Mutual labels:  card
React Native Deck Swiper
tinder like react-native deck swiper
Stars: ✭ 1,261 (-25.47%)
Mutual labels:  card
React Swipe Card
Tinder style swipe cards
Stars: ✭ 120 (-92.91%)
Mutual labels:  card
Mage
Magic Another Game Engine
Stars: ✭ 1,180 (-30.26%)
Mutual labels:  card
Ct Material Kit Pro
Premium Bootstrap 4 UI Kit based on Google's Material Design
Stars: ✭ 123 (-92.73%)
Mutual labels:  card
Searchstone
🃏 Hearthstone's cards search engine built with algolia instantsearch.
Stars: ✭ 117 (-93.09%)
Mutual labels:  card
Cardsstack
An awesome set of cards at your disposal ✌️ ⚡️
Stars: ✭ 97 (-94.27%)
Mutual labels:  card
Sunwell
Canvas-based high quality Hearthstone card renderer
Stars: ✭ 93 (-94.5%)
Mutual labels:  card

InfiniteCards

License

An infinite card switching UI for Android, support custom animation
可自定义动效的卡片切换视图(中文文档

Flutter version

https://github.com/BakerJQ/Flutter-InfiniteCards

Screenshot

Gradle via JitPack

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

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

Add the dependency

dependencies {
    implementation 'com.github.BakerJQ:Android-InfiniteCards:1.0.5'
}

Attrs

  • animType : animation type
    • front : move the selected card to first
    • switchPosition : move the selected card to first, and the first card to the selected position
    • frontToLast : move the first card to last position
  • cardRatio : ratio of the card
  • animDuration : duration of each card's animation
  • animAddRemoveDelay : delay of animation of add and remove between each card
  • animAddRemoveDuration : duration of add and remove each card's animation

How to use

layout in xml

<com.bakerj.infinitecards.InfiniteCardView
        android:id="@+id/view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        infiniteCard:animDuration="1000"
        infiniteCard:cardRatio="1"/>

Set Adapter

Just extends the BaseAdapter

class MyAdapter extends BaseAdapter{
  ...
}
mAdapter = new MyAdapter(resId);
mCardView.setAdapter(mAdapter);

Animation transformers and interpolators

Default

If you just use all default animations, just do nothing.

mCardView.setAnimInterpolator(new LinearInterpolator());
mCardView.setTransformerToFront(new DefaultTransformerToFront());
mCardView.setTransformerToBack(new DefaultTransformerToBack());
mCardView.setZIndexTransformerToBack(new DefaultZIndexTransformerCommon());

Customisation

mCardView.setTransformerToBack(new AnimationTransformer() {
    @Override
    public void transformAnimation(View view, float fraction, int cardWidth, int cardHeight, int fromPosition, int toPosition) {
        int positionCount = fromPosition - toPosition;
        float scale = (0.8f - 0.1f * fromPosition) + (0.1f * fraction * positionCount);
        ViewHelper.setScaleX(view, scale);
        ViewHelper.setScaleY(view, scale);
        if (fraction < 0.5) {
            ViewCompat.setRotationX(view, 180 * fraction);
        } else {
            ViewCompat.setRotationX(view, 180 * (1 - fraction));
        }
    }

    @Override
    public void transformInterpolatedAnimation(View view, float fraction, int cardWidth, int cardHeight, int fromPosition, int toPosition) {
        int positionCount = fromPosition - toPosition;
        float scale = (0.8f - 0.1f * fromPosition) + (0.1f * fraction * positionCount);
        ViewHelper.setTranslationY(view, -cardHeight * (0.8f - scale) * 0.5f - cardWidth * (0.02f *
                fromPosition - 0.02f * fraction * positionCount));
    }
});
mCardView.setZIndexTransformerToBack(new ZIndexTransformer() {
    @Override
    public void transformAnimation(CardItem card, float fraction, int cardWidth, int cardHeight, int fromPosition, int toPosition) {
        if (fraction < 0.4f) {
            card.zIndex = 1f + 0.01f * fromPosition;
        } else {
            card.zIndex = 1f + 0.01f * toPosition;
        }
    }

    @Override
    public void transformInterpolatedAnimation(CardItem card, float fraction, int cardWidth, int cardHeight, int fromPosition, int toPosition) {

    }
});

License

InfiniteCards is released under the Apache 2.0 license.

Copyright 2017 BakerJ.

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 following link.

     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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].