Skip to content
Projekte

anton46/Foursquare-CollectionPicker

Auf GitHub ansehen

Über uns

Collection Picker ist eine Android-View-Bibliothek, die dem Foursquare-Tastes-Auswahldialog ähnelt.

Entwicklerwerkzeuge

So werden diese Zahlen gemessen

Gemessener Sternzuwachs

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Verlauf wird gesammelt

Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.

README.md

Original

Android Gems

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.

Ähnliche Projekte entdecken

Wird geladen…