ChipCloud


Source link: https://github.com/fiskurgit/ChipCloud

ChipCloud

An easy to use implementation of Google's Material Design 'Chip' ui element. Version 3 was a fresh rewrite of the original quickly hacked together library, version 3.0.4 introduces support for images/avatars and the close icon and matches the Google spec. The previous iteration was becoming popular as an easy replacement for a dropdown/spinner with improved UX and more efficient use of screen real estate. Versions 3+ have an improved API with a fraction of the code. The biggest change is it's now not a custom Layout, it's a simple helper class that adds Chips to a supplied ViewGroup, complex layout is delegated to dedicated layout libraries such as FlexboxLayout.

Usage

Although ChipCloud can be used with any ViewGroup to get the wrapping 'Chip Cloud' that was the original focus of the library you should use Google's FlexboxLayout - see the demo project for a full example.

//To create the same wrapping cloud as previous incarnation use Google's FlexboxLayout: FlexboxLayout flexbox = (FlexboxLayout) findViewById(R.id.flexbox);
  //Create a new ChipCloud with a Context and ViewGroup: ChipCloud chipCloud = new ChipCloud(this, flexbox);
  //Add a single Chip: chipCloud.addChip("HelloWorld!");
  //or pass a List or Array of any Object: String[] demoArray = getResources().getStringArray(R.array.demo_array);
 chipCloud.addChips(demoArray);

Customisation

Use the ChipCloudConfig builder to customise colors, fonts, turn padding on, and set select mode:

FlexboxLayout flexbox = (FlexboxLayout) findViewById(R.id.flexbox);
  ChipCloudConfig config = new ChipCloudConfig()
  .selectMode(ChipCloud.SelectMode.multi)
  .checkedChipColor(Color.parseColor("#ddaa00"))
  .checkedTextColor(Color.parseColor("#ffffff"))
  .uncheckedChipColor(Color.parseColor("#efefef"))
  .uncheckedTextColor(Color.parseColor("#666666"))
  .useInsetPadding(true)
  .typeface(someCustomeTypeface);
  ChipCloud chipCloud = new ChipCloud(this, flexbox, config);
 

Images/Avatars

Pass a drawable when you create a chip, they'll be made round and scaled to 32dp, but pass appropriately sized images - scaling images is expensive:

ChipCloud avatarChipCloud = new ChipCloud(this, avatarLayout, chipcloudConfig);
 drawableChipCloud.addChip("Anna A", ContextCompat.getDrawable(this, R.drawable.anna_a));

Delete/Remove

With avatars:

Labels only:

Use showClose in ChipCloudConfig, the colour is the tint for the cross icon, the long value is an optional fadeout time when the chip is deleted:

 ChipCloudConfig chipcloudConfig = new ChipCloudConfig()

.selectMode(ChipCloud.SelectMode.multi)

.checkedChipColor(Color.parseColor("#ddaa00"))

.checkedTextColor(Color.parseColor("#ffffff"))

.uncheckedChipColor(Color.parseColor("#e0e0e0"))

.uncheckedTextColor(Color.parseColor("#000000"))

.showClose(Color.parseColor("#a6a6a6"), 500);

alternatively just use .showClose(Color.parseColor("#a6a6a6") and the chip will pop with no animation. Add a listener so you can update your model when a user deletes a chip (the index will shuffle so you must do this, or you'll have issues):

 deleteableCloud.setDeleteListener(new ChipDeletedListener() {

 @Override

 public void chipDeleted(int index, String label) {

Log.d(TAG, String.format("chipDeleted at index: %d label: %s", index, label));

 
}

  
}
);

Modes

Multi

ChipCloud.SelectMode.multi

The default mode; multiple chips can be selected.

Single

ChipCloud.SelectMode.single

Only one chip can be selected at a time.

Mandatory

ChipCloud.SelectMode.mandatory

Similar to a RadioGroup, only one chip can be selected, and once one has been chosen it's not possible to deselect it, you can click on another chip but one will always be checked.

None

ChipCloud.SelectMode.none

No interaction, the chips just act as feedback for a user (eg. to display a list of tags associated with a news article).

Dependency

Add jitpack.io to your root build.gradle, eg:

allprojects {

  repositories {

jcenter()

maven {
 url "https://jitpack.io" 
}

  
}
 
}

then add the dependency to your project build.gradle:

dependencies {

  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.github.fiskurgit:ChipCloud:3.0.5' 
}

You can find the latest version in the releases tab above: https://github.com/fiskurgit/ChipCloud/releases

More options at jitpack.io: https://jitpack.io/#fiskurgit/ChipCloud

Licence

Full licence here: https://github.com/fiskurgit/ChipCloud/blob/master/LICENSE

In short:

The MIT License is a permissive license that is short and to the point. It lets people do anything they want with your code as long as they provide attribution back to you and don’t hold you liable.

Resources

Under the Hood is a flexible and powerful Android debug view library. It uses a modular template system that can be easily extended to your needs, although coming with many useful elements built-in.

There is a lot of "default" debug data that can be easily embedded (e.g. current runtime-permission status, app version and device info). There are 2 basic themes (dark and light) which can be customized to your needs.

Sticky header view or suspending view for RecyclerView. RecyclerStickyHeaderView is an Android library that makes it easy to integrate section headers stick to the top in RecyclerView.

Official Google Actions SDK is written in Node.js. But in many situations voice interfaces like Google Home or Google Assistant will extend or replace mobile apps. If you are old fashioned Android engineer and the most of your code is already written in Java, why not reuse it and build voice extension to app on your own? And this is the main reason to build Google Actions Java SDK - enabling as much developers as possible to build their brilliant ideas for Google Assistant and Home.

Currently this is just working proof of concept of Google Actions Java SDK. It means that there is no documentation, fixed interface, (not much) unit tests and many, many others.

Google Actions Java SDK is build based on official Node.js library, but it's not a mirror copy of it. The goal is to make it fully compatible with Conversational Protocol of Assistant Platform.

Applozic Android Video Calling SDK lets you integrate video call, audio call, real time chat and in-app messaging in just few lines of code.

A versatile layout that fades its edges regardless of child view type.

WDate is a short way utility class that wraps the standard Date class, providing many useful methods without using the Calendar object.

This class aims to help developers to avoid writing boring DateUtils classes for every project.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes