Giter Site home page Giter Site logo

ryandzhunter / foursquare-collectionpicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anton46/foursquare-collectionpicker

0.0 2.0 0.0 1.24 MB

Collection Picker is an Android View library that looks like Foursquare Tastes picker

License: Apache License 2.0

Java 100.00%

foursquare-collectionpicker's Introduction

Forsquare-CollectionPicker

Maven Central Android Arsenal API

Collection Picker is an Android View library which looks like Foursquare Tastes picker. For more information see the website.

Example image Example image

Usage

Gradle

compile 'com.anton46:collection-picker:1.0.2'

Maven

<dependency>
    <groupId>com.anton46</groupId>
    <artifactId>collection-picker</artifactId>
    <version>1.0.2</version>
</dependency>

Declare a CollectionPicker inside your XML layout file

 <com.anton46.collectionitempicker.CollectionPicker
        android:id="@+id/collection_item_picker"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        app:cp_addIcon="@android:drawable/ic_menu_add"
        app:cp_cancelIcon="@android:drawable/ic_menu_close_clear_cancel"
        app:cp_itemBackgroundNormal="@color/blue"
        app:cp_itemBackgroundPressed="@color/red"
        app:cp_itemMargin="5dp"
        app:cp_textPaddingBottom="5dp"
        app:cp_textPaddingLeft="10dp"
        app:cp_textPaddingRight="10dp"
        app:cp_textPaddingTop="5dp" 
        app:cp_simplified="false" />

Add Items

        List<Item> items = new ArrayList<>();
        items.add(new Item("item1", "Items 1"));
        
        CollectionPicker picker = (CollectionPicker) findViewById(R.id.collection_item_picker);
        picker.setItems(items);
        picker.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onClick(Item item, int position) {
            
            }
        });

Configure using xml attributes in code :

        //Layout radius
        <attr name="cp_itemRadius" format="dimension" />
        //Layout background normal
        <attr name="cp_itemBackgroundNormal" format="color" />
        //Layout background pressed/selected
        <attr name="cp_itemBackgroundPressed" format="color" />
        //Add icon indicator
        <attr name="cp_addIcon" format="reference" />
        //Cancel icon indicator
        <attr name="cp_cancelIcon" format="reference" />
        //Margin beetwen items (Horizontal and vertical)
        <attr name="cp_itemMargin" format="dimension" />
        //Text color
        <attr name="cp_itemTextColor" format="color"/>
        //Text paddding to left
        <attr name="cp_textPaddingLeft" format="dimension" />
         //Text paddding to right 
        <attr name="cp_textPaddingRight" format="dimension" />
         //Text paddding to top 
        <attr name="cp_textPaddingTop" format="dimension" />
         //Text paddding to bottom  
        <attr name="cp_textPaddingBottom" format="dimension" />
        //Simplify tags (No icons)
        <attr name="cp_simplified" format="boolean" />

Developed by

License

Copyright 2015 Anton Nurdin Tuhadiansyah

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.

foursquare-collectionpicker's People

Contributors

anton46 avatar charbgr avatar

Watchers

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