diff --git a/.gitignore b/.gitignore
index c6cbe56..71d3065 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,5 @@
.DS_Store
/build
/captures
+app
+.idea
diff --git a/.idea/.name b/.idea/.name
deleted file mode 100644
index 2b7b4cd..0000000
--- a/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-ChipCloud
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index 96cc43e..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
deleted file mode 100644
index e7bedf3..0000000
--- a/.idea/copyright/profiles_settings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
deleted file mode 100644
index 261ec28..0000000
--- a/.idea/gradle.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 1a3eaff..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 3a74172..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 7f68460..0000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 6564d52..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index a5370e2..7d55c32 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,8 @@
language: android
android:
components:
- - build-tools-23.0.0
- - android-23
+ - build-tools-23.0.3
+ - android-24
- extra-android-m2repository
- extra-google-m2repository
diff --git a/README.md b/README.md
index 4cbbbdd..7dfd710 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,16 @@
# ChipCloud
-[](https://jitpack.io/#fiskurgit/ChipCloud) [](https://travis-ci.org/fiskurgit/ChipCloud)
+
+The ChipCloud library was originally a (very) quickly knocked up Android view for some larger hackathon project by [fiskurgit](https://github.com/fiskurgit). It creates a wrapping cloud of material '[Chips](https://www.google.com/design/spec/components/chips.html)'. Basic demo of their version is [available on the Play Store](https://play.google.com/store/apps/details?id=eu.fiskur.chipclouddemo) - I'm maintaining this fork for features I required in it.
-ChipCloud is an Android view (very) quickly knocked up for a larger hackathon project, it creates a wrapping cloud of single choice '[Chips](https://www.google.com/design/spec/components/chips.html)' (see screenshot below).
-
-Basic demo available on the Play Store:
-
+
## Usage
Add to your Android layout xml:
```xml
-
@@ -18,7 +18,7 @@ Add to your Android layout xml:
Configure in xml:
```xml
-
+ chipcloud:selectTransitionMS="750"
+ chipcloud:labels="@array/labels"
+ chipcloud:selectMode="required"
+ chipcloud:allCaps="true"
+ chipcloud:gravity="staggered"
+ chipcloud:minHorizontalSpacing="32dp"
+ chipcloud:verticalSpacing="16dp"
+ chipcloud:textSize="14sp"
+ chipcloud:typeface="RobotoSlab-Regular.ttf"/>
```
or in code:
```java
ChipCloud chipCloud = (ChipCloud) findViewById(R.id.chip_cloud);
-new ChipCloud.ChipCloudBuilder()
+new ChipCloud.Configure()
.chipCloud(chipCloud)
.selectedColor(Color.parseColor("#ff00cc"))
.selectedFontColor(Color.parseColor("#ffffff"))
- .unselectedColor(Color.parseColor("#e1e1e1"))
- .unselectedFontColor(Color.parseColor("#333333"))
+ .deselectedColor(Color.parseColor("#e1e1e1"))
+ .deselectedFontColor(Color.parseColor("#333333"))
.selectTransitionMS(500)
.deselectTransitionMS(250)
+ .labels(someStringArray)
+ .mode(ChipCloud.Mode.MULTI)
+ .allCaps(false)
+ .gravity(ChipCloud.Gravity.CENTER)
+ .textSize(getResources().getDimensionPixelSize(R.dimen.default_textsize))
+ .verticalSpacing(getResources().getDimensionPixelSize(R.dimen.vertical_spacing))
+ .minHorizontalSpacing(getResources().getDimensionPixelSize(R.dimen.min_horizontal_spacing))
+ .typeface(Typeface.createFromAsset(getContext().getAssets(), "RobotoSlab-Regular.ttf"))
.chipListener(new ChipListener() {
@Override
public void chipSelected(int index) {
//...
}
+ @Override
+ public void chipDeselected(int index) {
+ //...
+ }
})
.build();
```
-Then add your items:
+Default value of textSize is equivalent to 13sp, of verticalSpacing is equivalent to 8dp, of minHorizontalSpacing is equivalent to 8dp, of allCaps is false.
+
+All chips have a height of 32dp and a padding of 12dp on left and right within the chip, [as per material guidelines](https://www.google.com/design/spec/components/chips.html).
+
+Add items dynamically too:
```java
chipCloud.addChip("Foo");
chipCloud.addChip("Bar");
-```
-Which produces:
-
+//or
+
+chipCloud.addChips(someStringArray);
+```
Set the selected index using ```chipCloud.setSelectedChip(2)```
Real-world example for shoe sizes:

-##Dependency
+Labels can also be updated in-place, e.g.
+
+from  to 
+using ```update()``` as illustrated below
+
+```java
+new ChipCloud.Configure().chipCloud(binding.chipCloud).labels(newChipLabels).update();
+```
+
+## Modes
+
+```java
+public enum Mode {
+ SINGLE, MULTI, REQUIRED, NONE
+}
+```
+
+The default mode is single choice (where it's valid to have no chip selected), if you want a RadioGroup manadatory style where once a chip is selected there must always be a selected item use ```chipCloud.setMode(ChipCloud.Mode.REQUIRED);``` (or set in xml or the builder). There's a multiple select mode too: ```chipCloud.setMode(ChipCloud.Mode.MULTIPLE);```. If you want to deactiviate selecting of chips you can set the select mode to ```chipCloud.setMode(ChipCloud.Mode.NONE);```.
+
+## Gravity
+
+```java
+public enum Gravity {
+ LEFT, RIGHT, CENTER, STAGGERED
+}
+```
+
+The default gravity is LEFT. CENTER and STAGGERED are similar except that CENTER leaves only minimum horizontal spacing between the chips whereas in STAGGERED chips occupy the available space equally while having at least minimum horizontal spacing between them.
+
+|  |  |  |  |
+|:---:|:---:|:---:|:---:|
+| LEFT | RIGHT | CENTER | STAGGERED |
+
+## Dependency
Add jitpack.io to your root build.gradle, eg:
@@ -83,19 +141,14 @@ then add the dependency to your project build.gradle:
```groovy
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.github.fiskurgit:ChipCloud:2.0.0'
+ compile 'com.github.adroitandroid:ChipCloud:2.2.1'
}
```
-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
-
-##Screenshots
-
+You can find the latest version in the releases tab above: https://github.com/adroitandroid/ChipCloud/releases
-##Licence
+## Licence
-Full licence here: https://github.com/fiskurgit/ChipCloud/blob/master/LICENSE.md
+Full licence here: https://github.com/fiskurgit/ChipCloud/blob/master/LICENSE
In short:
diff --git a/build.gradle b/build.gradle
index 2e0ab6f..a3efe93 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.5.0'
+ classpath 'com.android.tools.build:gradle:2.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index f23df6e..b289e68 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Oct 21 11:34:03 PDT 2015
+#Tue Sep 27 11:02:57 GMT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
diff --git a/images/gravity_center.png b/images/gravity_center.png
new file mode 100755
index 0000000..0980bea
Binary files /dev/null and b/images/gravity_center.png differ
diff --git a/images/gravity_left.png b/images/gravity_left.png
new file mode 100755
index 0000000..5672a5b
Binary files /dev/null and b/images/gravity_left.png differ
diff --git a/images/gravity_right.png b/images/gravity_right.png
new file mode 100755
index 0000000..c97ee17
Binary files /dev/null and b/images/gravity_right.png differ
diff --git a/images/gravity_staggered.png b/images/gravity_staggered.png
new file mode 100755
index 0000000..7fef40c
Binary files /dev/null and b/images/gravity_staggered.png differ
diff --git a/images/label_update_after.png b/images/label_update_after.png
new file mode 100755
index 0000000..82819f5
Binary files /dev/null and b/images/label_update_after.png differ
diff --git a/images/label_update_before.png b/images/label_update_before.png
new file mode 100755
index 0000000..566eafa
Binary files /dev/null and b/images/label_update_before.png differ
diff --git a/library/build.gradle b/library/build.gradle
index 2fa287f..27f38ee 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 23
- buildToolsVersion "23.0.0"
+ compileSdkVersion 25
+ buildToolsVersion '25.0.2'
defaultConfig {
minSdkVersion 14
- targetSdkVersion 23
+ targetSdkVersion 25
versionCode 1
versionName "1.0"
}
@@ -21,5 +21,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
- compile 'com.android.support:appcompat-v7:23.1.1'
+ compile 'com.android.support:appcompat-v7:25.1.0'
}
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
index 5e3a0bf..3e96901 100644
--- a/library/src/main/AndroidManifest.xml
+++ b/library/src/main/AndroidManifest.xml
@@ -1,9 +1,8 @@
-
diff --git a/library/src/main/java/com/adroitandroid/chipcloud/Chip.java b/library/src/main/java/com/adroitandroid/chipcloud/Chip.java
new file mode 100644
index 0000000..63115ef
--- /dev/null
+++ b/library/src/main/java/com/adroitandroid/chipcloud/Chip.java
@@ -0,0 +1,276 @@
+package com.adroitandroid.chipcloud;
+
+import android.content.Context;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
+import android.graphics.Typeface;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.TransitionDrawable;
+import android.support.v4.content.ContextCompat;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.view.LayoutInflater;
+import android.view.View;
+
+public class Chip extends android.support.v7.widget.AppCompatTextView implements View.OnClickListener {
+
+ private int index = -1;
+ private boolean selected = false;
+ private ChipListener listener = null;
+ private int selectedFontColor = -1;
+ private int unselectedFontColor = -1;
+ private TransitionDrawable crossfader;
+ private int selectTransitionMS = 750;
+ private int deselectTransitionMS = 500;
+ private boolean isLocked = false;
+ private ChipCloud.Mode mode;
+
+ public void setChipListener(ChipListener listener) {
+ this.listener = listener;
+ }
+
+ public Chip(Context context) {
+ super(context);
+ init();
+ }
+
+ public Chip(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ init();
+ }
+
+ public Chip(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ init();
+ }
+
+ public void initChip(Context context, int index, String label, Typeface typeface, int textSizePx,
+ boolean allCaps, int selectedColor, int selectedFontColor, int unselectedColor,
+ int unselectedFontColor, ChipCloud.Mode mode) {
+
+ this.index = index;
+ this.selectedFontColor = selectedFontColor;
+ this.unselectedFontColor = unselectedFontColor;
+ this.mode = mode;
+
+ Drawable selectedDrawable = ContextCompat.getDrawable(context, R.drawable.chip_selected);
+
+ if (selectedColor == -1) {
+ selectedDrawable.setColorFilter(new PorterDuffColorFilter(ContextCompat.getColor(context, R.color.dark_grey), PorterDuff.Mode.MULTIPLY));
+ } else {
+ selectedDrawable.setColorFilter(new PorterDuffColorFilter(selectedColor, PorterDuff.Mode.MULTIPLY));
+ }
+
+ if (selectedFontColor == -1) {
+ this.selectedFontColor = ContextCompat.getColor(context, R.color.white);
+ }
+
+ Drawable unselectedDrawable = ContextCompat.getDrawable(context, R.drawable.chip_selected);
+ if (unselectedColor == -1) {
+ unselectedDrawable.setColorFilter(new PorterDuffColorFilter(ContextCompat.getColor(context, R.color.light_grey), PorterDuff.Mode.MULTIPLY));
+ } else {
+ unselectedDrawable.setColorFilter(new PorterDuffColorFilter(unselectedColor, PorterDuff.Mode.MULTIPLY));
+ }
+
+ if (unselectedFontColor == -1) {
+ this.unselectedFontColor = ContextCompat.getColor(context, R.color.chip);
+ }
+
+ Drawable backgrounds[] = new Drawable[2];
+ backgrounds[0] = unselectedDrawable;
+ backgrounds[1] = selectedDrawable;
+
+ crossfader = new TransitionDrawable(backgrounds);
+
+ //Bug reported on KitKat where padding was removed, so we read the padding values then set again after setting background
+ int leftPad = getPaddingLeft();
+ int topPad = getPaddingTop();
+ int rightPad = getPaddingRight();
+ int bottomPad = getPaddingBottom();
+
+ setBackgroundCompat(crossfader);
+
+ setPadding(leftPad, topPad, rightPad, bottomPad);
+
+ setText(label);
+ unselect();
+
+ if (typeface != null) {
+ setTypeface(typeface);
+ }
+ setAllCaps(allCaps);
+ if (textSizePx > 0) {
+ setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePx);
+ }
+ }
+
+ public void setLocked(boolean isLocked) {
+ this.isLocked = isLocked;
+ }
+
+ public void setSelectTransitionMS(int selectTransitionMS) {
+ this.selectTransitionMS = selectTransitionMS;
+ }
+
+ public void setDeselectTransitionMS(int deselectTransitionMS) {
+ this.deselectTransitionMS = deselectTransitionMS;
+ }
+
+ private void init() {
+ setOnClickListener(this);
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (mode != ChipCloud.Mode.NONE)
+ if (selected && !isLocked) {
+ //set as unselected
+ unselect();
+ if (listener != null) {
+ listener.chipDeselected(index);
+ }
+ } else if (!selected) {
+ //set as selected
+ crossfader.startTransition(selectTransitionMS);
+
+ setTextColor(selectedFontColor);
+ if (listener != null) {
+ listener.chipSelected(index);
+ }
+ }
+
+ selected = !selected;
+ }
+
+ public void select() {
+ selected = true;
+ crossfader.startTransition(selectTransitionMS);
+ setTextColor(selectedFontColor);
+ if (listener != null) {
+ listener.chipSelected(index);
+ }
+ }
+
+ private void unselect() {
+ if (selected) {
+ crossfader.reverseTransition(deselectTransitionMS);
+ } else {
+ crossfader.resetTransition();
+ }
+
+ setTextColor(unselectedFontColor);
+ }
+
+ @SuppressWarnings("deprecation")
+ private void setBackgroundCompat(Drawable background) {
+ if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
+ setBackgroundDrawable(background);
+ } else {
+ setBackground(background);
+ }
+ }
+
+ public void deselect() {
+ unselect();
+ selected = false;
+ }
+
+ public static class ChipBuilder {
+ private int index;
+ private String label;
+ private Typeface typeface;
+ private int textSizePx;
+ private boolean allCaps;
+ private int selectedColor;
+ private int selectedFontColor;
+ private int unselectedColor;
+ private int unselectedFontColor;
+ private int chipHeight;
+ private int selectTransitionMS = 750;
+ private int deselectTransitionMS = 500;
+
+ private ChipListener chipListener;
+ private ChipCloud.Mode mode;
+
+ public ChipBuilder index(int index) {
+ this.index = index;
+ return this;
+ }
+
+ public ChipBuilder selectedColor(int selectedColor) {
+ this.selectedColor = selectedColor;
+ return this;
+ }
+
+ public ChipBuilder selectedFontColor(int selectedFontColor) {
+ this.selectedFontColor = selectedFontColor;
+ return this;
+ }
+
+ public ChipBuilder unselectedColor(int unselectedColor) {
+ this.unselectedColor = unselectedColor;
+ return this;
+ }
+
+ public ChipBuilder unselectedFontColor(int unselectedFontColor) {
+ this.unselectedFontColor = unselectedFontColor;
+ return this;
+ }
+
+ public ChipBuilder label(String label) {
+ this.label = label;
+ return this;
+ }
+
+ public ChipBuilder typeface(Typeface typeface) {
+ this.typeface = typeface;
+ return this;
+ }
+
+ public ChipBuilder allCaps(boolean allCaps) {
+ this.allCaps = allCaps;
+ return this;
+ }
+
+ public ChipBuilder textSize(int textSizePx) {
+ this.textSizePx = textSizePx;
+ return this;
+ }
+
+ public ChipBuilder chipHeight(int chipHeight) {
+ this.chipHeight = chipHeight;
+ return this;
+ }
+
+ public ChipBuilder chipListener(ChipListener chipListener) {
+ this.chipListener = chipListener;
+ return this;
+ }
+
+ public ChipBuilder mode(ChipCloud.Mode mode) {
+ this.mode = mode;
+ return this;
+ }
+
+ public ChipBuilder selectTransitionMS(int selectTransitionMS) {
+ this.selectTransitionMS = selectTransitionMS;
+ return this;
+ }
+
+ public ChipBuilder deselectTransitionMS(int deselectTransitionMS) {
+ this.deselectTransitionMS = deselectTransitionMS;
+ return this;
+ }
+
+ public Chip build(Context context) {
+ Chip chip = (Chip) LayoutInflater.from(context).inflate(R.layout.chip, null);
+ chip.initChip(context, index, label, typeface, textSizePx, allCaps, selectedColor,
+ selectedFontColor, unselectedColor, unselectedFontColor, mode);
+ chip.setSelectTransitionMS(selectTransitionMS);
+ chip.setDeselectTransitionMS(deselectTransitionMS);
+ chip.setChipListener(chipListener);
+ chip.setHeight(chipHeight);
+ return chip;
+ }
+ }
+}
diff --git a/library/src/main/java/com/adroitandroid/chipcloud/ChipCloud.java b/library/src/main/java/com/adroitandroid/chipcloud/ChipCloud.java
new file mode 100644
index 0000000..952bfb9
--- /dev/null
+++ b/library/src/main/java/com/adroitandroid/chipcloud/ChipCloud.java
@@ -0,0 +1,404 @@
+package com.adroitandroid.chipcloud;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Typeface;
+import android.util.AttributeSet;
+
+public class ChipCloud extends FlowLayout implements ChipListener {
+
+ public enum Mode {
+ SINGLE, MULTI, REQUIRED, NONE
+ }
+
+ private Context context;
+ private int chipHeight;
+ private int selectedColor = -1;
+ private int selectedFontColor = -1;
+ private int unselectedColor = -1;
+ private int unselectedFontColor = -1;
+ private int selectTransitionMS = 750;
+ private int deselectTransitionMS = 500;
+ private Mode mode = Mode.SINGLE;
+ private Gravity gravity = Gravity.LEFT;
+ private Typeface typeface;
+ private boolean allCaps;
+ private int textSizePx = -1;
+ private int verticalSpacing;
+ private int minHorizontalSpacing;
+
+ private ChipListener chipListener;
+
+ public ChipCloud(Context context) {
+ super(context);
+ this.context = context;
+ init();
+ }
+
+ public ChipCloud(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.context = context;
+
+ TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ChipCloud, 0, 0);
+ int arrayReference = -1;
+ try {
+ selectedColor = a.getColor(R.styleable.ChipCloud_selectedColor, -1);
+ selectedFontColor = a.getColor(R.styleable.ChipCloud_selectedFontColor, -1);
+ unselectedColor = a.getColor(R.styleable.ChipCloud_deselectedColor, -1);
+ unselectedFontColor = a.getColor(R.styleable.ChipCloud_deselectedFontColor, -1);
+ selectTransitionMS = a.getInt(R.styleable.ChipCloud_selectTransitionMS, 750);
+ deselectTransitionMS = a.getInt(R.styleable.ChipCloud_deselectTransitionMS, 500);
+ String typefaceString = a.getString(R.styleable.ChipCloud_typeface);
+ if (typefaceString != null) {
+ typeface = Typeface.createFromAsset(getContext().getAssets(), typefaceString);
+ }
+ textSizePx = a.getDimensionPixelSize(R.styleable.ChipCloud_textSize,
+ getResources().getDimensionPixelSize(R.dimen.default_textsize));
+ allCaps = a.getBoolean(R.styleable.ChipCloud_allCaps, false);
+ int selectMode = a.getInt(R.styleable.ChipCloud_selectMode, 1);
+ switch (selectMode) {
+ case 0:
+ mode = Mode.SINGLE;
+ break;
+ case 1:
+ mode = Mode.MULTI;
+ break;
+ case 2:
+ mode = Mode.REQUIRED;
+ break;
+ case 3:
+ mode = Mode.NONE;
+ break;
+ default:
+ mode = Mode.SINGLE;
+ }
+ int gravityType = a.getInt(R.styleable.ChipCloud_gravity, 0);
+ switch (gravityType) {
+ case 0:
+ gravity = Gravity.LEFT;
+ break;
+ case 1:
+ gravity = Gravity.RIGHT;
+ break;
+ case 2:
+ gravity = Gravity.CENTER;
+ break;
+ case 3:
+ gravity = Gravity.STAGGERED;
+ break;
+ default:
+ gravity = Gravity.LEFT;
+ break;
+ }
+ minHorizontalSpacing = a.getDimensionPixelSize(R.styleable.ChipCloud_minHorizontalSpacing,
+ getResources().getDimensionPixelSize(R.dimen.min_horizontal_spacing));
+ verticalSpacing = a.getDimensionPixelSize(R.styleable.ChipCloud_verticalSpacing,
+ getResources().getDimensionPixelSize(R.dimen.vertical_spacing));
+ arrayReference = a.getResourceId(R.styleable.ChipCloud_labels, -1);
+
+ } finally {
+ a.recycle();
+ }
+
+ init();
+
+ if (arrayReference != -1) {
+ String[] labels = getResources().getStringArray(arrayReference);
+ addChips(labels);
+ }
+ }
+
+ @Override
+ protected int getMinimumHorizontalSpacing() {
+ return minHorizontalSpacing;
+ }
+
+ @Override
+ protected int getVerticalSpacing() {
+ return verticalSpacing;
+ }
+
+ @Override
+ protected Gravity getGravity() {
+ return gravity;
+ }
+
+ private void init() {
+ chipHeight = getResources().getDimensionPixelSize(R.dimen.material_chip_height);
+ }
+
+ public void setSelectedColor(int selectedColor) {
+ this.selectedColor = selectedColor;
+ }
+
+ public void setSelectedFontColor(int selectedFontColor) {
+ this.selectedFontColor = selectedFontColor;
+ }
+
+ public void setUnselectedColor(int unselectedColor) {
+ this.unselectedColor = unselectedColor;
+ }
+
+ public void setUnselectedFontColor(int unselectedFontColor) {
+ this.unselectedFontColor = unselectedFontColor;
+ }
+
+ public void setSelectTransitionMS(int selectTransitionMS) {
+ this.selectTransitionMS = selectTransitionMS;
+ }
+
+ public void setDeselectTransitionMS(int deselectTransitionMS) {
+ this.deselectTransitionMS = deselectTransitionMS;
+ }
+
+ public void setMode(Mode mode) {
+ this.mode = mode;
+ for (int i = 0; i < getChildCount(); i++) {
+ Chip chip = (Chip) getChildAt(i);
+ chip.deselect();
+ chip.setLocked(false);
+ }
+ }
+
+ public void setGravity(Gravity gravity) {
+ this.gravity = gravity;
+ }
+
+ public void setTypeface(Typeface typeface) {
+ this.typeface = typeface;
+ }
+
+ public void setTextSize(int textSize) {
+ this.textSizePx = textSize;
+ }
+
+ public void setAllCaps(boolean isAllCaps) {
+ this.allCaps = isAllCaps;
+ }
+
+ public void setMinimumHorizontalSpacing(int spacingInPx) {
+ this.minHorizontalSpacing = spacingInPx;
+ }
+
+ public void setVerticalSpacing(int spacingInPx) {
+ this.verticalSpacing = spacingInPx;
+ }
+
+ public void setChipListener(ChipListener chipListener) {
+ this.chipListener = chipListener;
+ }
+
+ public void addChips(String[] labels) {
+ for (String label : labels) {
+ addChip(label);
+ }
+ }
+
+ public void addChip(String label) {
+ Chip chip = new Chip.ChipBuilder().index(getChildCount())
+ .label(label)
+ .typeface(typeface)
+ .textSize(textSizePx)
+ .allCaps(allCaps)
+ .selectedColor(selectedColor)
+ .selectedFontColor(selectedFontColor)
+ .unselectedColor(unselectedColor)
+ .unselectedFontColor(unselectedFontColor)
+ .selectTransitionMS(selectTransitionMS)
+ .deselectTransitionMS(deselectTransitionMS)
+ .chipHeight(chipHeight)
+ .chipListener(this)
+ .mode(mode)
+ .build(context);
+
+ addView(chip);
+ }
+
+ public void setSelectedChip(int index) {
+ Chip chip = (Chip) getChildAt(index);
+ chip.select();
+ if (mode == Mode.REQUIRED) {
+ for (int i = 0; i < getChildCount(); i++) {
+ Chip chipp = (Chip) getChildAt(i);
+ if (i == index) {
+ chipp.setLocked(true);
+ } else {
+ chipp.setLocked(false);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void chipSelected(int index) {
+
+ switch (mode) {
+ case SINGLE:
+ case REQUIRED:
+ for (int i = 0; i < getChildCount(); i++) {
+ Chip chip = (Chip) getChildAt(i);
+ if (i == index) {
+ if (mode == Mode.REQUIRED) chip.setLocked(true);
+ } else {
+ chip.deselect();
+ chip.setLocked(false);
+ }
+ }
+ break;
+ default:
+ //
+ }
+
+ if (chipListener != null) {
+ chipListener.chipSelected(index);
+ }
+ }
+
+ @Override
+ public void chipDeselected(int index) {
+ if (chipListener != null) {
+ chipListener.chipDeselected(index);
+ }
+ }
+
+ public boolean isSelected(int index) {
+ if (index > 0 && index < getChildCount()) {
+ Chip chip = (Chip) getChildAt(index);
+ return chip.isSelected();
+ }
+ return false;
+ }
+
+ //Apparently using the builder pattern to configure an object has been labelled a 'Bloch Builder'.
+ public static class Configure {
+ private ChipCloud chipCloud;
+ private int selectedColor = -1;
+ private int selectedFontColor = -1;
+ private int deselectedColor = -1;
+ private int deselectedFontColor = -1;
+ private int selectTransitionMS = -1;
+ private int deselectTransitionMS = -1;
+ private Mode mode = null;
+ private String[] labels = null;
+ private ChipListener chipListener;
+ private Gravity gravity = null;
+ private Typeface typeface;
+ private Boolean allCaps = null;
+ private int textSize = -1;
+ private int minHorizontalSpacing = -1;
+ private int verticalSpacing = -1;
+
+ public Configure chipCloud(ChipCloud chipCloud) {
+ this.chipCloud = chipCloud;
+ return this;
+ }
+
+ public Configure mode(Mode mode) {
+ this.mode = mode;
+ return this;
+ }
+
+ public Configure selectedColor(int selectedColor) {
+ this.selectedColor = selectedColor;
+ return this;
+ }
+
+ public Configure selectedFontColor(int selectedFontColor) {
+ this.selectedFontColor = selectedFontColor;
+ return this;
+ }
+
+ public Configure deselectedColor(int deselectedColor) {
+ this.deselectedColor = deselectedColor;
+ return this;
+ }
+
+ public Configure deselectedFontColor(int deselectedFontColor) {
+ this.deselectedFontColor = deselectedFontColor;
+ return this;
+ }
+
+ public Configure selectTransitionMS(int selectTransitionMS) {
+ this.selectTransitionMS = selectTransitionMS;
+ return this;
+ }
+
+ public Configure deselectTransitionMS(int deselectTransitionMS) {
+ this.deselectTransitionMS = deselectTransitionMS;
+ return this;
+ }
+
+ public Configure labels(String[] labels) {
+ this.labels = labels;
+ return this;
+ }
+
+ public Configure chipListener(ChipListener chipListener) {
+ this.chipListener = chipListener;
+ return this;
+ }
+
+ public Configure gravity(Gravity gravity) {
+ this.gravity = gravity;
+ return this;
+ }
+
+ public Configure typeface(Typeface typeface) {
+ this.typeface = typeface;
+ return this;
+ }
+
+ /**
+ * @param textSize value in pixels as obtained from @{@link android.content.res.Resources#getDimensionPixelSize(int)}
+ */
+ public Configure textSize(int textSize) {
+ this.textSize = textSize;
+ return this;
+ }
+
+ public Configure allCaps(boolean isAllCaps) {
+ this.allCaps = isAllCaps;
+ return this;
+ }
+
+ public Configure minHorizontalSpacing(int spacingInPx) {
+ this.minHorizontalSpacing = spacingInPx;
+ return this;
+ }
+
+ public Configure verticalSpacing(int spacingInPx) {
+ this.verticalSpacing = spacingInPx;
+ return this;
+ }
+
+ public void build() {
+ chipCloud.removeAllViews();
+ if (mode != null) chipCloud.setMode(mode);
+ if (gravity != null) chipCloud.setGravity(gravity);
+ if (typeface != null) chipCloud.setTypeface(typeface);
+ if (textSize != -1) chipCloud.setTextSize(textSize);
+ if (allCaps != null) chipCloud.setAllCaps(allCaps);
+ if (selectedColor != -1) chipCloud.setSelectedColor(selectedColor);
+ if (selectedFontColor != -1) chipCloud.setSelectedFontColor(selectedFontColor);
+ if (deselectedColor != -1) chipCloud.setUnselectedColor(deselectedColor);
+ if (deselectedFontColor != -1) chipCloud.setUnselectedFontColor(deselectedFontColor);
+ if (selectTransitionMS != -1) chipCloud.setSelectTransitionMS(selectTransitionMS);
+ if (deselectTransitionMS != -1) chipCloud.setDeselectTransitionMS(deselectTransitionMS);
+ if (minHorizontalSpacing != -1) chipCloud.setMinimumHorizontalSpacing(minHorizontalSpacing);
+ if (verticalSpacing != -1) chipCloud.setVerticalSpacing(verticalSpacing);
+ chipCloud.setChipListener(chipListener);
+ chipCloud.addChips(labels);
+ }
+
+ public void update() {
+ int childCount = chipCloud.getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ Chip chip = (Chip) chipCloud.getChildAt(i);
+ chip.setText(labels[i]);
+ chip.invalidate();
+ }
+ chipCloud.invalidate();
+ chipCloud.requestLayout();
+ }
+ }
+}
diff --git a/library/src/main/java/com/adroitandroid/chipcloud/ChipListener.java b/library/src/main/java/com/adroitandroid/chipcloud/ChipListener.java
new file mode 100644
index 0000000..4eab5d9
--- /dev/null
+++ b/library/src/main/java/com/adroitandroid/chipcloud/ChipListener.java
@@ -0,0 +1,7 @@
+package com.adroitandroid.chipcloud;
+
+public interface ChipListener {
+ void chipSelected(int index);
+
+ void chipDeselected(int index);
+}
diff --git a/library/src/main/java/com/adroitandroid/chipcloud/FlowLayout.java b/library/src/main/java/com/adroitandroid/chipcloud/FlowLayout.java
new file mode 100644
index 0000000..bffe8f0
--- /dev/null
+++ b/library/src/main/java/com/adroitandroid/chipcloud/FlowLayout.java
@@ -0,0 +1,185 @@
+package com.adroitandroid.chipcloud;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author RAW
+ */
+public abstract class FlowLayout extends ViewGroup {
+
+ private int lineHeight;
+ private LayoutProcessor layoutProcessor = new LayoutProcessor();
+
+ public enum Gravity {
+ LEFT, RIGHT, CENTER, STAGGERED
+ }
+
+ public FlowLayout(Context context) {
+ super(context);
+ }
+
+ public FlowLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ assert (MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED);
+
+ final int width = MeasureSpec.getSize(widthMeasureSpec) - getPaddingLeft() - getPaddingRight();
+ int height = MeasureSpec.getSize(heightMeasureSpec) - getPaddingTop() - getPaddingBottom();
+ final int count = getChildCount();
+ int lineHeight = 0;
+
+ int xPos = getPaddingLeft();
+ int yPos = getPaddingTop();
+
+ int childHeightMeasureSpec;
+ if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) {
+ childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);
+ } else {
+ childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ }
+
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.getVisibility() != GONE) {
+ child.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST),
+ childHeightMeasureSpec);
+ final int childW = child.getMeasuredWidth();
+ lineHeight = Math.max(lineHeight, child.getMeasuredHeight() + getVerticalSpacing());
+
+ if (xPos + childW > width) {
+ xPos = getPaddingLeft();
+ yPos += lineHeight;
+ }
+
+ xPos += childW + getMinimumHorizontalSpacing();
+ }
+ }
+ this.lineHeight = lineHeight;
+
+ if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED || (MeasureSpec.getMode(
+ heightMeasureSpec) == MeasureSpec.AT_MOST && yPos + lineHeight < height)) {
+ height = yPos + lineHeight;
+ }
+ setMeasuredDimension(width, height);
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
+ final int count = getChildCount();
+ final int width = r - l;
+ int xPos = getPaddingLeft();
+ int yPos = getPaddingTop();
+ layoutProcessor.setWidth(width);
+ for (int i = 0; i < count; i++) {
+ final View child = getChildAt(i);
+ if (child.getVisibility() != GONE) {
+ final int childW = child.getMeasuredWidth();
+ final int childH = child.getMeasuredHeight();
+ if (xPos + childW > width) {
+ xPos = getPaddingLeft();
+ yPos += lineHeight;
+ layoutProcessor.layoutPreviousRow();
+ }
+ layoutProcessor.addViewForLayout(child, yPos, childW, childH);
+ xPos += childW + getMinimumHorizontalSpacing();
+ }
+ }
+ layoutProcessor.layoutPreviousRow();
+ layoutProcessor.clear();
+ }
+
+ protected abstract int getMinimumHorizontalSpacing();
+
+ protected abstract int getVerticalSpacing();
+
+ protected abstract Gravity getGravity();
+
+ private class LayoutProcessor {
+
+ private int rowY;
+ private final List viewsInCurrentRow;
+ private final List viewWidths;
+ private final List viewHeights;
+ private int width;
+
+ private LayoutProcessor() {
+ viewsInCurrentRow = new ArrayList<>();
+ viewWidths = new ArrayList<>();
+ viewHeights = new ArrayList<>();
+ }
+
+ void addViewForLayout(View view, int yPos, int childW, int childH) {
+ rowY = yPos;
+ viewsInCurrentRow.add(view);
+ viewWidths.add(childW);
+ viewHeights.add(childH);
+ }
+
+ void clear() {
+ viewsInCurrentRow.clear();
+ viewWidths.clear();
+ viewHeights.clear();
+ }
+
+ void layoutPreviousRow() {
+ Gravity gravity = getGravity();
+ int minimumHorizontalSpacing = getMinimumHorizontalSpacing();
+ switch (gravity) {
+ case LEFT:
+ int xPos = getPaddingLeft();
+ for (int i = 0; i < viewsInCurrentRow.size(); i++) {
+ viewsInCurrentRow.get(i).layout(xPos, rowY, xPos + viewWidths.get(i), rowY + viewHeights.get(i));
+ xPos += viewWidths.get(i) + minimumHorizontalSpacing;
+ }
+ break;
+ case RIGHT:
+ int xEnd = width - getPaddingRight();
+ for (int i = viewsInCurrentRow.size() - 1; i >= 0; i--) {
+ int xStart = xEnd - viewWidths.get(i);
+ viewsInCurrentRow.get(i).layout(xStart, rowY, xEnd, rowY + viewHeights.get(i));
+ xEnd = xStart - minimumHorizontalSpacing;
+ }
+ break;
+ case STAGGERED:
+ int totalWidthOfChildren = 0;
+ for (int i = 0; i < viewWidths.size(); i++) {
+ totalWidthOfChildren += viewWidths.get(i);
+ }
+ int horizontalSpacingForStaggered = (width - totalWidthOfChildren - getPaddingLeft()
+ - getPaddingRight()) / (viewsInCurrentRow.size() + 1);
+ xPos = getPaddingLeft() + horizontalSpacingForStaggered;
+ for (int i = 0; i < viewsInCurrentRow.size(); i++) {
+ viewsInCurrentRow.get(i).layout(xPos, rowY, xPos + viewWidths.get(i), rowY + viewHeights.get(i));
+ xPos += viewWidths.get(i) + horizontalSpacingForStaggered;
+ }
+ break;
+ case CENTER:
+ totalWidthOfChildren = 0;
+ for (int i = 0; i < viewWidths.size(); i++) {
+ totalWidthOfChildren += viewWidths.get(i);
+ }
+ xPos = getPaddingLeft() + (width - getPaddingLeft() - getPaddingRight() -
+ totalWidthOfChildren - (minimumHorizontalSpacing * (viewsInCurrentRow.size() - 1))) / 2;
+ for (int i = 0; i < viewsInCurrentRow.size(); i++) {
+ viewsInCurrentRow.get(i).layout(xPos, rowY, xPos + viewWidths.get(i), rowY + viewHeights.get(i));
+ xPos += viewWidths.get(i) + minimumHorizontalSpacing;
+ }
+ break;
+ }
+ clear();
+ }
+
+ void setWidth(int width) {
+ this.width = width;
+ }
+ }
+}
diff --git a/library/src/main/java/eu/fiskur/chipcloud/Chip.java b/library/src/main/java/eu/fiskur/chipcloud/Chip.java
deleted file mode 100644
index 766410d..0000000
--- a/library/src/main/java/eu/fiskur/chipcloud/Chip.java
+++ /dev/null
@@ -1,239 +0,0 @@
-package eu.fiskur.chipcloud;
-
-import android.content.Context;
-import android.graphics.Color;
-import android.graphics.PorterDuff;
-import android.graphics.PorterDuffColorFilter;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.TransitionDrawable;
-import android.support.v4.content.ContextCompat;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.TextView;
-
-public class Chip extends TextView implements View.OnClickListener{
-
- private Context context;
- private int index = -1;
- private boolean selected = false;
- private ChipListener listener = null;
- private int selectedColor = -1;
- private int selectedFontColor = -1;
- private int unselectedColor = -1;
- private int unselectedFontColor = -1;
- private Drawable selectedDrawable;
- private Drawable unselectedDrawable;
- private TransitionDrawable crossfader;
- private int selectTransitionMS = 750;
- private int deselectTransitionMS = 500;
-
- public void setChipListener(ChipListener listener){
- this.listener = listener;
- }
-
- public Chip(Context context) {
- super(context);
- init();
- }
-
- public Chip(Context context, AttributeSet attrs) {
- super(context, attrs);
- init();
- }
-
- public Chip(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- init();
- }
-
- public void initChip(Context context,
- int index,
- String label,
- int selectedColor,
- int selectedFontColor,
- int unselectedColor,
- int unselectedFontColor){
-
- this.context = context;
- this.index = index;
- this.selectedColor = selectedColor;
- this.selectedFontColor = selectedFontColor;
- this.unselectedColor = unselectedColor;
- this.unselectedFontColor = unselectedFontColor;
-
- selectedDrawable = ContextCompat.getDrawable(context, R.drawable.chip_selected);
- if(selectedColor == -1){
- selectedColor = ContextCompat.getColor(context, R.color.dark_grey);
- }
- selectedDrawable.setColorFilter(new PorterDuffColorFilter(selectedColor, PorterDuff.Mode.MULTIPLY));
-
- if(selectedFontColor == -1){
- selectedFontColor = ContextCompat.getColor(context, R.color.white);
- }
-
- unselectedDrawable = ContextCompat.getDrawable(context, R.drawable.chip_selected);
- if(unselectedColor == -1){
- unselectedColor = ContextCompat.getColor(context, R.color.light_grey);
- }
- unselectedDrawable.setColorFilter(new PorterDuffColorFilter(unselectedColor, PorterDuff.Mode.MULTIPLY));
-
- if(unselectedFontColor == -1){
- unselectedFontColor = ContextCompat.getColor(context, R.color.chip);
- }
-
- Drawable backgrounds[] = new Drawable[2];
- backgrounds[0] = unselectedDrawable;
- backgrounds[1] = selectedDrawable;
-
- crossfader = new TransitionDrawable(backgrounds);
- setBackgroundCompat(crossfader);
-
- setText(label);
- unselect();
- }
-
- public void setSelectTransitionMS(int selectTransitionMS){
- this.selectTransitionMS = selectTransitionMS;
- }
-
- public void setDeselectTransitionMS(int deselectTransitionMS){
- this.deselectTransitionMS = deselectTransitionMS;
- }
-
- private void init(){
- setOnClickListener(this);
- }
-
-
- @Override
- public void onClick(View v) {
- if(selected){
- //set as unselected
- unselect();
- }else{
- //set as selected
- crossfader.startTransition(selectTransitionMS);
-
- setTextColor(selectedFontColor);
- if(listener != null){
- listener.chipSelected(index);
- }
- }
-
- selected = !selected;
- }
-
- public void select(){
- crossfader.startTransition(selectTransitionMS);
-
- setTextColor(selectedFontColor);
- if(listener != null){
- listener.chipSelected(index);
- }
- }
-
- private void unselect(){
- if(selected){
- crossfader.reverseTransition(deselectTransitionMS);
- }else{
- crossfader.resetTransition();
- }
-
- setTextColor(unselectedFontColor);
- }
-
- @SuppressWarnings("deprecation")
- private void setBackgroundCompat(Drawable background){
- if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
- setBackgroundDrawable(background);
- } else {
- setBackground(background);
- }
- }
-
- public void deselect(){
- unselect();
- selected = false;
- }
-
- public interface ChipListener{
- void chipSelected(int index);
- }
-
-
- public static class ChipBuilder{
- int index;
- String label;
- int selectedColor;
- int selectedFontColor;
- int unselectedColor;
- int unselectedFontColor;
- int chipHeight;
- int selectTransitionMS = 750;
- int deselectTransitionMS = 500;
-
- ChipListener chipListener;
-
- public ChipBuilder index(int index){
- this.index = index;
- return this;
- }
-
- public ChipBuilder selectedColor(int selectedColor){
- this.selectedColor = selectedColor;
- return this;
- }
-
- public ChipBuilder selectedFontColor(int selectedFontColor){
- this.selectedFontColor = selectedFontColor;
- return this;
- }
-
- public ChipBuilder unselectedColor(int unselectedColor){
- this.unselectedColor = unselectedColor;
- return this;
- }
-
- public ChipBuilder unselectedFontColor(int unselectedFontColor){
- this.unselectedFontColor = unselectedFontColor;
- return this;
- }
-
- public ChipBuilder label(String label){
- this.label = label;
- return this;
- }
-
- public ChipBuilder chipHeight(int chipHeight){
- this.chipHeight = chipHeight;
- return this;
- }
-
- public ChipBuilder chipListener(ChipListener chipListener){
- this.chipListener = chipListener;
- return this;
- }
-
- public ChipBuilder selectTransitionMS(int selectTransitionMS){
- this.selectTransitionMS = selectTransitionMS;
- return this;
- }
-
- public ChipBuilder deselectTransitionMS(int deselectTransitionMS){
- this.deselectTransitionMS = deselectTransitionMS;
- return this;
- }
-
- public Chip build(Context context){
- Chip chip = (Chip) LayoutInflater.from(context).inflate(R.layout.chip, null);
- chip.initChip(context, index, label, selectedColor, selectedFontColor, unselectedColor, unselectedFontColor);
- chip.setSelectTransitionMS(selectTransitionMS);
- chip.setDeselectTransitionMS(deselectTransitionMS);
- chip.setChipListener(chipListener);
- chip.setHeight(chipHeight);
- return chip;
- }
- }
-}
-
diff --git a/library/src/main/java/eu/fiskur/chipcloud/ChipCloud.java b/library/src/main/java/eu/fiskur/chipcloud/ChipCloud.java
deleted file mode 100644
index 8f339de..0000000
--- a/library/src/main/java/eu/fiskur/chipcloud/ChipCloud.java
+++ /dev/null
@@ -1,182 +0,0 @@
-package eu.fiskur.chipcloud;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ChipCloud extends FlowLayout implements Chip.ChipListener {
-
- private Context context;
- private int chipHeight;
- private int selectedColor = -1;
- private int selectedFontColor = -1;
- private int unselectedColor = -1;
- private int unselectedFontColor = -1;
- private int selectTransitionMS = 750;
- private int deselectTransitionMS = 500;
-
- private List