Code Monkey home page Code Monkey logo

android-sku's Introduction

Sku

Android Sku选择器, 类似于淘宝,天猫,京东,支持多维属性,购物车动画,支持MVVM架构,可以直接使用

Demo下载

功能描述

  1. 支持多维属性,库存为空判断;
  2. 支持设置选中指定的sku;
  3. 支持手动输入数量;
screenshot screenshot

添加依赖

Download

buildscript {
    allprojects {
        repositories {
            jcenter()
        }
    }
}

dependencies {
    compile 'com.wuhenzhizao:sku:1.0.4'
}

绑定数据

SkuSelectScrollView.setSkuList(List<Sku> skuList);

设置选中的sku(一个sku时,默认选中)

SkuSelectScrollView.setSelectedSku(Sku sku);

设置监听

SkuSelectScrollView.setListener(new OnSkuListener() {
    /**
     * 属性取消选中
     *
     * @param unselectedAttribute
     */
    public void onUnselected(SkuAttribute unselectedAttribute) {}

    /**
     * 属性选中
     *
     * @param selectAttribute
     */
    public void onSelect(SkuAttribute selectAttribute) {}

    /**
     * sku选中
     *
     * @param sku
     */
    public void onSkuSelected(Sku sku) {});

使用MVVM架构

组件提供SkuViewDelegate来对MVVM模式下的交互进行支持

<SkuSelectScrollView
    xmlns:sku="http://schemas.android.com/apk/res-auto"
    android:id="@+id/sku_databinding"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="50dp"
    sku:skuList="@{vm.skuList}"
    sku:skuViewDelegate="@{vm.delegate}" />

技术交流

QQ交流群
screenshot

android-sku's People

Contributors

wuhenzhizao avatar protectedman avatar

Watchers

James Cloos avatar hss01248 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.