All Projects → xmuSistone → Cardslidepanel

xmuSistone / Cardslidepanel

enable users to slide card to the left or right smoothly and continuously

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Cardslidepanel

Androidpilelayout
An abnormal horizontal ListView-like pile layout with stretch and contraction effects.
Stars: ✭ 2,104 (-11.49%)
Mutual labels:  card, viewgroup
Android Swipecards View
Android library to implement cards stack view with swipe to remove feature
Stars: ✭ 162 (-93.18%)
Mutual labels:  card
Neumorphismview Android
A Neumorphism library for Android, supporting customizations for shadows/highlights to selected child views.
Stars: ✭ 121 (-94.91%)
Mutual labels:  viewgroup
Stripe
Stripe library for Vapor
Stars: ✭ 151 (-93.65%)
Mutual labels:  card
Ct Material Kit Pro
Premium Bootstrap 4 UI Kit based on Google's Material Design
Stars: ✭ 123 (-94.83%)
Mutual labels:  card
Material
A UI/UX framework for creating beautiful applications.
Stars: ✭ 11,870 (+399.37%)
Mutual labels:  card
Searchstone
🃏 Hearthstone's cards search engine built with algolia instantsearch.
Stars: ✭ 117 (-95.08%)
Mutual labels:  card
Chameleonmini Rebooted
Chameleon Mini revE rebooted - Iceman Fork, the ChameleonMini is a versatile contactless smartcard emulator (NFC/RFID)
Stars: ✭ 208 (-91.25%)
Mutual labels:  card
React Ui Cards
Ready to use card components for React
Stars: ✭ 162 (-93.18%)
Mutual labels:  card
Minigrid
📏 Minimal 2kb zero dependency cascading grid layout
Stars: ✭ 1,801 (-24.23%)
Mutual labels:  card
Uicard
Generic UI for card games like Hearthstone, Magic Arena and Slay the Spire...
Stars: ✭ 142 (-94.03%)
Mutual labels:  card
J2pay
Multi-gateway payment processing library for java
Stars: ✭ 125 (-94.74%)
Mutual labels:  card
Chameleonmini Rebootedgui
Windows based GUI for Chameleon Mini, the contactless smartcard emulator (NFC/RFID)
Stars: ✭ 159 (-93.31%)
Mutual labels:  card
React Native Ezswiper
swiper component for react-native
Stars: ✭ 123 (-94.83%)
Mutual labels:  card
Id Card Of China
🆔一个基于「公民身份号码」规则获取身份证号码中包含的基础信息组件(PHP)
Stars: ✭ 167 (-92.97%)
Mutual labels:  card
React Swipe Card
Tinder style swipe cards
Stars: ✭ 120 (-94.95%)
Mutual labels:  card
Scheduler Card
HA Lovelace card for control of scheduler entities
Stars: ✭ 154 (-93.52%)
Mutual labels:  card
Zlayoutmanager
Some custom LayoutManager .Such as SwipeCard、FLowLayout。一些自定义的LayoutManager,仿探探、人人影视 炫动滑动 卡片层叠 和流式布局等。
Stars: ✭ 2,404 (+1.14%)
Mutual labels:  card
Lovelace Xiaomi Vacuum Card
Simple card for various robot vacuums in Home Assistant's Lovelace UI
Stars: ✭ 137 (-94.24%)
Mutual labels:  card
Vue Info Card
Simple and beautiful card component with an elegant spark line, for VueJS.
Stars: ✭ 159 (-93.31%)
Mutual labels:  card

有图有真相

模仿探探首页的卡片滑动效果:

preview 不得不说,探探的ui效果真的很赞。在着手这个project之前,我没有参考过github上其它类似的开源项目。所以,如果这个project重复造了轮子,请不要打我。

在这个仓库竣工之时,有一个小伙伴发了我另一个开源工程,颇有相似之处。我下载了源码,导入了studio,apk跑起来的时候,发现它存在一些问题:卡片飞到两侧,如果动画没有结束,则不允许下一轮拖动。这对强迫症的用户来说,应该是很不爽的。

然而,探探却克服了所有这些问题。或许,这个问题只有积淀过这些知识点的人才能琢磨的透吧。我确实思考了很久,想到了一个还不错的方案。

无耻一点

如果我能不要脸一些,我会说这个项目有以下优点:

  • 快。真的流畅,滑动的手速再快也赶不上代码刷新view的速度快。
  • 高效。仅仅四个卡片view轻松搞定任意多的数据。
  • 灵活。自定义ViewGroup对卡片view的高度实现了自适应。
  • 细节。卡片之间联动的视觉效果,是像素级的精确。

不信,你下载下来look look。

使用方法

1. 在xml文件中引入CardSlidePanel

<com.stone.card.library.CardSlidePanel
        android:id="@+id/image_slide_panel"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        card:bottomMarginTop="38dp"
        card:itemMarginTop="10dp"
        card:yOffsetStep="13dp" />

2. 左右滑动监听

cardSwitchListener = new CardSlidePanel.CardSwitchListener() {

        @Override
        public void onShow(int index) {
            Log.d("Card", "正在显示-" + dataList.get(index).userName);
        }

        @Override
        public void onCardVanish(int index, int type) {
            Log.d("Card", "正在消失-" + dataList.get(index).userName + " 消失type=" + type);
        }
};
slidePanel.setCardSwitchListener(cardSwitchListener);

3. 绑定Adapter

slidePanel.setAdapter(new CardAdapter() {
        @Override
        public int getLayoutId() {
            // layout文件
            return R.layout.card_item;
        }

        @Override
        public int getCount() {
            // 卡片个数
            return dataList.size();
        }
        
        @Override
        public Rect obtainDraggableArea(View view) {
            // 可滑动区域定制,仅调用一次
            return new Rect(....)
        }

        @Override
        public void bindView(View view, int index) {
            // 数据绑定,参看demo
            viewHolder.bindData(dataList.get(index));
        }
});

4. 数据更新

// appendDataList
adapter.notifyDataSetChanged();

Demo安装包

apk download (就在thisProj工程之中)

License

Copyright 2016, xmuSistone

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.
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].