From b7be3fa4509c4bd66cfdc32a2de49cecf5a99ef2 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Thu, 9 Jun 2016 09:53:03 +0700
Subject: [PATCH 01/41] Update README.md
---
README.md | 3 +++
1 file changed, 3 insertions(+)
diff --git a/README.md b/README.md
index 2a6aa9f..709007a 100644
--- a/README.md
+++ b/README.md
@@ -70,6 +70,9 @@ To delete a tag as user press "Backspace" key or double-tap the tag which you wa
Implement a callback interface: `TagGroup.OnTagClickListener`, and set the listener via `setOnTagClickListener()`.
+#### Gravity for TagGroup
+
+To set gravity for TagGroup: use `setGravity(...)` supported `TagGroup.Gravity.LEFT`, `TagGroup.Gravity.MIDDLE` and `TagGroup.Gravity.RIGHT`
# Build
From bd16ded49f8d8a95c2437c2d3e5ae13c46e2fd30 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Thu, 9 Jun 2016 10:37:02 +0700
Subject: [PATCH 02/41] Update README.md
---
README.md | 25 +++++++------------------
1 file changed, 7 insertions(+), 18 deletions(-)
diff --git a/README.md b/README.md
index 709007a..e7ffb22 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,8 @@ The TagGroup is a special layout with a set of tags. You can use it to tag peopl
Also you can contribute new idea to me.
+New update supported Tag Gravity
+
# Demo
### Screenshot
@@ -18,28 +20,15 @@ Also you can contribute new idea to me.
![screenshot2](http://ww4.sinaimg.cn/large/bce2dea9jw1esbsbngv8fj20u005w75v.jpg)
![screenshot3](http://ww4.sinaimg.cn/large/bce2dea9jw1esbsbmoagij20u005sabl.jpg)
-[Download Demo](https://github.com/2dxgujun/AndroidTagGroup/releases/download/v1.4/AndroidTagGroup-Demo-v1.4.apk)
+### Tag Gravity
+![screenshot4](https://dl.dropboxusercontent.com/u/25101600/tag_gravity.png)
+
+[Download Demo](https://dl.dropboxusercontent.com/u/25101600/TagGroup-demo-release.apk)
# Usage
## Step 1
-
-#### Gradle
-```groovy
-dependencies {
- compile 'me.gujun.android.taggroup:library:1.4@aar'
-}
-```
-
-#### Maven
-```xml
-
- me.gujun.android.taggroup
- library
- 1.4
- apklib
-
-```
+Clone the project and import library to your project.
## Step 2
From f7ecd2af52002cf007422d958ebcb573338dbba1 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Thu, 9 Jun 2016 10:41:24 +0700
Subject: [PATCH 03/41] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index e7ffb22..ab8b685 100644
--- a/README.md
+++ b/README.md
@@ -102,6 +102,7 @@ There are several attributes you can set:
# Developed By
Jun Gu - <2dxgujun@gmail.com>
+Tuan Dinh - (Tag Gravity)
From 15af3729fc2ce46df884e3f06cadd81a3aa5d823 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Thu, 9 Jun 2016 10:42:14 +0700
Subject: [PATCH 04/41] Add Tag Gravity
---
build.gradle | 2 +-
demo/build.gradle | 6 +-
.../android/taggroup/demo/MainActivity.java | 13 ++
.../taggroup/demo/TagEditorActivity.java | 1 +
demo/src/main/res/layout/activity_main.xml | 174 ++++++++------
demo/src/main/res/values-en/strings.xml | 9 -
demo/src/main/res/values-zh/strings.xml | 12 +
demo/src/main/res/values/strings.xml | 19 +-
gradle/wrapper/gradle-wrapper.properties | 4 +-
library/build.gradle | 6 +-
.../me/gujun/android/taggroup/TagGroup.java | 221 +++++++++++++++---
11 files changed, 331 insertions(+), 136 deletions(-)
delete mode 100644 demo/src/main/res/values-en/strings.xml
create mode 100644 demo/src/main/res/values-zh/strings.xml
diff --git a/build.gradle b/build.gradle
index cd74ded..da5e0da 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.2.3'
+ classpath 'com.android.tools.build:gradle:2.1.2'
}
}
diff --git a/demo/build.gradle b/demo/build.gradle
index 8b3ed8d..fe98fb6 100644
--- a/demo/build.gradle
+++ b/demo/build.gradle
@@ -1,8 +1,8 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 21
- buildToolsVersion '21.1.1'
+ compileSdkVersion 22
+ buildToolsVersion '22.0.1'
defaultConfig {
applicationId 'me.gujun.android.taggroup.demo'
minSdkVersion 8
@@ -22,5 +22,5 @@ android {
dependencies {
compile project(':library')
- compile 'com.android.support:appcompat-v7:21.0.3'
+ compile 'com.android.support:appcompat-v7:22.2.1'
}
\ No newline at end of file
diff --git a/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java b/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java
index 872bf9f..41e7b3d 100644
--- a/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java
+++ b/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java
@@ -19,6 +19,8 @@ public class MainActivity extends ActionBarActivity {
private TagGroup mDefaultTagGroup;
private TagGroup mSmallTagGroup;
private TagGroup mLargeTagGroup;
+ private TagGroup mLargeMiddleTagGroup;
+ private TagGroup mLargeRightTagGroup;
private TagGroup mBeautyTagGroup;
private TagGroup mBeautyInverseTagGroup;
@@ -50,6 +52,8 @@ public void onClick(View v) {
mDefaultTagGroup = (TagGroup) findViewById(R.id.tag_group);
mSmallTagGroup = (TagGroup) findViewById(R.id.tag_group_small);
mLargeTagGroup = (TagGroup) findViewById(R.id.tag_group_large);
+ mLargeMiddleTagGroup = (TagGroup) findViewById(R.id.tag_group_large_middle);
+ mLargeRightTagGroup = (TagGroup) findViewById(R.id.tag_group_large_right);
mBeautyTagGroup = (TagGroup) findViewById(R.id.tag_group_beauty);
mBeautyInverseTagGroup = (TagGroup) findViewById(R.id.tag_group_beauty_inverse);
if (tags != null && tags.length > 0) {
@@ -58,6 +62,11 @@ public void onClick(View v) {
mLargeTagGroup.setTags(tags);
mBeautyTagGroup.setTags(tags);
mBeautyInverseTagGroup.setTags(tags);
+
+ mLargeMiddleTagGroup.setTags(tags);
+ mLargeMiddleTagGroup.setGravity(TagGroup.TagGravity.MIDDLE);
+ mLargeRightTagGroup.setTags(tags);
+ mLargeRightTagGroup.setGravity(TagGroup.TagGravity.RIGHT);
}
MyTagGroupOnClickListener tgClickListener = new MyTagGroupOnClickListener();
@@ -85,6 +94,10 @@ protected void onResume() {
mLargeTagGroup.setTags(tags);
mBeautyTagGroup.setTags(tags);
mBeautyInverseTagGroup.setTags(tags);
+ mLargeMiddleTagGroup.setTags(tags);
+ mLargeMiddleTagGroup.setGravity(TagGroup.TagGravity.MIDDLE);
+ mLargeRightTagGroup.setTags(tags);
+ mLargeRightTagGroup.setGravity(TagGroup.TagGravity.RIGHT);
}
@Override
diff --git a/demo/src/main/java/me/gujun/android/taggroup/demo/TagEditorActivity.java b/demo/src/main/java/me/gujun/android/taggroup/demo/TagEditorActivity.java
index 27d2ea1..9dd5770 100644
--- a/demo/src/main/java/me/gujun/android/taggroup/demo/TagEditorActivity.java
+++ b/demo/src/main/java/me/gujun/android/taggroup/demo/TagEditorActivity.java
@@ -22,6 +22,7 @@ protected void onCreate(Bundle savedInstanceState) {
String[] tags = mTagsManager.getTags();
mTagGroup = (TagGroup) findViewById(R.id.tag_group);
+ mTagGroup.setGravity(TagGroup.TagGravity.LEFT);
mTagGroup.setTags(tags);
}
diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml
index db8f830..a96fd01 100644
--- a/demo/src/main/res/layout/activity_main.xml
+++ b/demo/src/main/res/layout/activity_main.xml
@@ -1,81 +1,111 @@
-
-
-
+ android:layout_height="match_parent">
-
+ android:orientation="vertical"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context=".MainActivity">
-
+
-
-
-
-
-
-
-
-
-
+
-
+
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/demo/src/main/res/values-en/strings.xml b/demo/src/main/res/values-en/strings.xml
deleted file mode 100644
index 5f2428d..0000000
--- a/demo/src/main/res/values-en/strings.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- TagGroup-Demo
- Add Tags
- Edit Tags
- Tags (Default)
- Tags (Large)
- Tags (Small)
-
\ No newline at end of file
diff --git a/demo/src/main/res/values-zh/strings.xml b/demo/src/main/res/values-zh/strings.xml
new file mode 100644
index 0000000..9f66a03
--- /dev/null
+++ b/demo/src/main/res/values-zh/strings.xml
@@ -0,0 +1,12 @@
+
+ TagGroup-Demo
+ 编辑标签
+ 添加标签
+ 标签(默认)
+ 标签(小号)
+ 标签(大号)
+ Submit
+ Edit
+ Tags (Large-Middle)
+ Tags (Large-Right)
+
diff --git a/demo/src/main/res/values/strings.xml b/demo/src/main/res/values/strings.xml
index 88f07de..f59f303 100644
--- a/demo/src/main/res/values/strings.xml
+++ b/demo/src/main/res/values/strings.xml
@@ -1,10 +1,13 @@
+
TagGroup-Demo
- 编辑标签
- 添加标签
- 标签(默认)
- 标签(小号)
- 标签(大号)
- Submit
- Edit
-
+ Add Tags
+ Edit Tags
+ Tags (Default)
+ Tags (Large-Left-Default)
+ Tags (Small)
+ Submit
+ Edit
+ Tags (Large-Middle)
+ Tags (Large-Right)
+
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 0c71e76..59120a3 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Thu Jun 09 09:55:18 ICT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
diff --git a/library/build.gradle b/library/build.gradle
index 87bfd43..0312e36 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,10 +1,10 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 21
- buildToolsVersion '21.1.1'
+ compileSdkVersion 22
+ buildToolsVersion '22.0.1'
defaultConfig {
minSdkVersion 8
- targetSdkVersion 21
+ targetSdkVersion 22
}
lintOptions {
abortOnError false
diff --git a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java
index 5f2ae99..fd41168 100644
--- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java
+++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java
@@ -17,8 +17,8 @@
import android.text.TextWatcher;
import android.text.method.ArrowKeyMovementMethod;
import android.util.AttributeSet;
+import android.util.Log;
import android.util.TypedValue;
-import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@@ -44,6 +44,10 @@
* When in DISPLAY mode, the group is only contain NORMAL state tags, and the tags in group
* is not focusable.
*
+ *
+ * * Add TagGravity for TagGroup
+ * * @modified Tuan Dinh (http://aotasoft.com)
+ * * @updated 2016-6-9 09:32:20
*
* @author Jun Gu (http://2dxgujun.com)
* @version 2.0
@@ -68,72 +72,136 @@ public class TagGroup extends ViewGroup {
private final float default_horizontal_padding;
private final float default_vertical_padding;
- /** Indicates whether this TagGroup is set up to APPEND mode or DISPLAY mode. Default is false. */
+ /**
+ * Indicates whether this TagGroup is set up to APPEND mode or DISPLAY mode. Default is false.
+ */
private boolean isAppendMode;
- /** The text to be displayed when the text of the INPUT tag is empty. */
+ /**
+ * The text to be displayed when the text of the INPUT tag is empty.
+ */
private CharSequence inputHint;
- /** The tag outline border color. */
+ /**
+ * The tag outline border color.
+ */
private int borderColor;
- /** The tag text color. */
+ /**
+ * The tag text color.
+ */
private int textColor;
- /** The tag background color. */
+ /**
+ * The tag background color.
+ */
private int backgroundColor;
- /** The dash outline border color. */
+ /**
+ * The dash outline border color.
+ */
private int dashBorderColor;
- /** The input tag hint text color. */
+ /**
+ * The input tag hint text color.
+ */
private int inputHintColor;
- /** The input tag type text color. */
+ /**
+ * The input tag type text color.
+ */
private int inputTextColor;
- /** The checked tag outline border color. */
+ /**
+ * The checked tag outline border color.
+ */
private int checkedBorderColor;
- /** The check text color */
+ /**
+ * The check text color
+ */
private int checkedTextColor;
- /** The checked marker color. */
+ /**
+ * The checked marker color.
+ */
private int checkedMarkerColor;
- /** The checked tag background color. */
+ /**
+ * The checked tag background color.
+ */
private int checkedBackgroundColor;
- /** The tag background color, when the tag is being pressed. */
+ /**
+ * The tag background color, when the tag is being pressed.
+ */
private int pressedBackgroundColor;
- /** The tag outline border stroke width, default is 0.5dp. */
+ /**
+ * The tag outline border stroke width, default is 0.5dp.
+ */
private float borderStrokeWidth;
- /** The tag text size, default is 13sp. */
+ /**
+ * The tag text size, default is 13sp.
+ */
private float textSize;
- /** The horizontal tag spacing, default is 8.0dp. */
+ /**
+ * The horizontal tag spacing, default is 8.0dp.
+ */
private int horizontalSpacing;
- /** The vertical tag spacing, default is 4.0dp. */
+ /**
+ * The vertical tag spacing, default is 4.0dp.
+ */
private int verticalSpacing;
- /** The horizontal tag padding, default is 12.0dp. */
+ /**
+ * The horizontal tag padding, default is 12.0dp.
+ */
private int horizontalPadding;
- /** The vertical tag padding, default is 3.0dp. */
+ /**
+ * The vertical tag padding, default is 3.0dp.
+ */
private int verticalPadding;
- /** Listener used to dispatch tag change event. */
+ /**
+ * Listener used to dispatch tag change event.
+ */
private OnTagChangeListener mOnTagChangeListener;
- /** Listener used to dispatch tag click event. */
+ /**
+ * Listener used to dispatch tag click event.
+ */
private OnTagClickListener mOnTagClickListener;
- /** Listener used to handle tag click event. */
+ /**
+ * Listener used to handle tag click event.
+ */
private InternalTagClickListener mInternalTagClickListener = new InternalTagClickListener();
+ /**
+ * TagGravity in taggroup
+ * Added by Tuan Dinh
+ */
+ private TagGravity gravity = TagGravity.LEFT;
+
+ public void setGravity(TagGravity gravity) {
+ this.gravity = gravity;
+ }
+
+ public TagGravity getGravity() {
+ return this.gravity;
+ }
+
+ public enum TagGravity {
+ LEFT,
+ MIDDLE,
+ RIGHT
+ }
+
public TagGroup(Context context) {
this(context, null);
}
@@ -259,6 +327,9 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
heightMode == MeasureSpec.EXACTLY ? heightSize : height);
}
+
+ List> _tags = new ArrayList<>();
+
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
final int parentLeft = getPaddingLeft();
@@ -270,6 +341,9 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
int childTop = parentTop;
int rowMaxHeight = 0;
+ int row = 0;
+
+ _tags.clear();
final int count = getChildCount();
for (int i = 0; i < count; i++) {
@@ -282,14 +356,51 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
childLeft = parentLeft;
childTop += rowMaxHeight + verticalSpacing;
rowMaxHeight = height;
+ row++;
} else {
rowMaxHeight = Math.max(rowMaxHeight, height);
}
- child.layout(childLeft, childTop, childLeft + width, childTop + height);
+ //Comment by Tuan Dinh
+// child.layout(childLeft, childTop, childLeft + width, childTop + height);
+ ArrayList tagrow = new ArrayList<>();
+ if (_tags.size() == row)
+ _tags.add(tagrow);
+ else
+ tagrow = _tags.get(row);
+ ChildHolder childHolder = new ChildHolder();
+ childHolder.child = child;
+ childHolder.left = childLeft;
+ childHolder.top = childTop;
+ childHolder.right = childLeft + width;
+ childHolder.bottom = childTop + height;
+ tagrow.add(childHolder);
childLeft += width + horizontalSpacing;
}
}
+
+
+ /**
+ * Calculating new postion for Tags in TagGravity
+ * Added by Tuan Dinh
+ * */
+ for (int i = 0; i < _tags.size(); i++) {
+ ArrayList tagrow = _tags.get(i);
+ if (tagrow.size() > 0) {
+ ChildHolder lastChildHolder = tagrow.get(tagrow.size() - 1);
+ int space = (parentRight - lastChildHolder.right);
+ int space2 = space / 2;
+ for (int j = 0; j < tagrow.size(); j++) {
+ ChildHolder childHolder = tagrow.get(j);
+ if (getGravity() == TagGravity.MIDDLE)
+ childHolder.child.layout(childHolder.left + space2, childHolder.top, childHolder.right + space2, childHolder.bottom);
+ if (getGravity() == TagGravity.LEFT)
+ childHolder.child.layout(childHolder.left, childHolder.top, childHolder.right, childHolder.bottom);
+ if (getGravity() == TagGravity.RIGHT)
+ childHolder.child.layout(childHolder.left + space, childHolder.top, childHolder.right + space, childHolder.bottom);
+ }
+ }
+ }
}
@Override
@@ -652,19 +763,29 @@ class TagView extends TextView {
public static final int STATE_NORMAL = 1;
public static final int STATE_INPUT = 2;
- /** The offset to the text. */
+ /**
+ * The offset to the text.
+ */
private static final int CHECKED_MARKER_OFFSET = 3;
- /** The stroke width of the checked marker */
+ /**
+ * The stroke width of the checked marker
+ */
private static final int CHECKED_MARKER_STROKE_WIDTH = 4;
- /** The current state. */
+ /**
+ * The current state.
+ */
private int mState;
- /** Indicates the tag if checked. */
+ /**
+ * Indicates the tag if checked.
+ */
private boolean isChecked = false;
- /** Indicates the tag if pressed. */
+ /**
+ * Indicates the tag if pressed.
+ */
private boolean isPressed = false;
private Paint mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
@@ -673,28 +794,44 @@ class TagView extends TextView {
private Paint mCheckedMarkerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
- /** The rect for the tag's left corner drawing. */
+ /**
+ * The rect for the tag's left corner drawing.
+ */
private RectF mLeftCornerRectF = new RectF();
- /** The rect for the tag's right corner drawing. */
+ /**
+ * The rect for the tag's right corner drawing.
+ */
private RectF mRightCornerRectF = new RectF();
- /** The rect for the tag's horizontal blank fill area. */
+ /**
+ * The rect for the tag's horizontal blank fill area.
+ */
private RectF mHorizontalBlankFillRectF = new RectF();
- /** The rect for the tag's vertical blank fill area. */
+ /**
+ * The rect for the tag's vertical blank fill area.
+ */
private RectF mVerticalBlankFillRectF = new RectF();
- /** The rect for the checked mark draw bound. */
+ /**
+ * The rect for the checked mark draw bound.
+ */
private RectF mCheckedMarkerBound = new RectF();
- /** Used to detect the touch event. */
+ /**
+ * Used to detect the touch event.
+ */
private Rect mOutRect = new Rect();
- /** The path for draw the tag's outline border. */
+ /**
+ * The path for draw the tag's outline border.
+ */
private Path mBorderPath = new Path();
- /** The path effect provide draw the dash border. */
+ /**
+ * The path effect provide draw the dash border.
+ */
private PathEffect mPathEffect = new DashPathEffect(new float[]{10, 5}, 0);
{
@@ -714,7 +851,7 @@ public TagView(Context context, final int state, CharSequence text) {
TagGroup.LayoutParams.WRAP_CONTENT,
TagGroup.LayoutParams.WRAP_CONTENT));
- setGravity(Gravity.CENTER);
+ setGravity(android.view.Gravity.CENTER);
setText(text);
setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
@@ -1022,4 +1159,12 @@ public boolean deleteSurroundingText(int beforeLength, int afterLength) {
}
}
}
+
+ /**
+ * A class holder a Tag (TagGravity)
+ */
+ class ChildHolder {
+ View child;
+ int left, top, right, bottom;
+ }
}
\ No newline at end of file
From 348c143d644da8c970f2200fd7c5754b2e65471f Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Thu, 9 Jun 2016 10:43:08 +0700
Subject: [PATCH 05/41] Add Tag Gravity
---
library/src/main/java/me/gujun/android/taggroup/TagGroup.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java
index fd41168..863f49b 100644
--- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java
+++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java
@@ -1161,7 +1161,7 @@ public boolean deleteSurroundingText(int beforeLength, int afterLength) {
}
/**
- * A class holder a Tag (TagGravity)
+ * A class holder of a Tag (TagGravity)
*/
class ChildHolder {
View child;
From 7c7b7aebaa4b0e8089570cab9dcd9f268c77f09d Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Thu, 9 Jun 2016 10:44:42 +0700
Subject: [PATCH 06/41] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index ab8b685..c9a4e94 100644
--- a/README.md
+++ b/README.md
@@ -102,6 +102,7 @@ There are several attributes you can set:
# Developed By
Jun Gu - <2dxgujun@gmail.com>
+
Tuan Dinh - (Tag Gravity)
From 1bd915e916e8f46f9ba3c5b6f86bd74a554fb217 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Thu, 9 Jun 2016 10:59:54 +0700
Subject: [PATCH 07/41] Update README.md
---
README.md | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index c9a4e94..6f9b4be 100644
--- a/README.md
+++ b/README.md
@@ -28,7 +28,23 @@ New update supported Tag Gravity
# Usage
## Step 1
-Clone the project and import library to your project.
+
+#### Gradle
+```groovy
+dependencies {
+ compile 'me.gujun.android.taggroup:library:1.4@aar'
+}
+```
+
+#### Maven
+```xml
+
+ me.gujun.android.taggroup
+ library
+ 1.4
+ apklib
+
+```
## Step 2
@@ -63,6 +79,8 @@ Implement a callback interface: `TagGroup.OnTagClickListener`, and set the liste
To set gravity for TagGroup: use `setGravity(...)` supported `TagGroup.Gravity.LEFT`, `TagGroup.Gravity.MIDDLE` and `TagGroup.Gravity.RIGHT`
+(Wait for merge to origin-project and make Gradle. If you need, you can clone this project and import to your project)
+
# Build
run `./gradlew assembleDebug` (Mac/Linux)
From bd532601a0ddceca29dc95ffc8a6dd98097ab230 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Thu, 9 Jun 2016 11:23:31 +0700
Subject: [PATCH 08/41] fix build.gradle
---
build.gradle | 2 +-
demo/build.gradle | 6 +++---
gradle/wrapper/gradle-wrapper.properties | 4 ++--
library/build.gradle | 6 +++---
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/build.gradle b/build.gradle
index da5e0da..cd74ded 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.1.2'
+ classpath 'com.android.tools.build:gradle:1.2.3'
}
}
diff --git a/demo/build.gradle b/demo/build.gradle
index fe98fb6..8b3ed8d 100644
--- a/demo/build.gradle
+++ b/demo/build.gradle
@@ -1,8 +1,8 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 22
- buildToolsVersion '22.0.1'
+ compileSdkVersion 21
+ buildToolsVersion '21.1.1'
defaultConfig {
applicationId 'me.gujun.android.taggroup.demo'
minSdkVersion 8
@@ -22,5 +22,5 @@ android {
dependencies {
compile project(':library')
- compile 'com.android.support:appcompat-v7:22.2.1'
+ compile 'com.android.support:appcompat-v7:21.0.3'
}
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 59120a3..206b8eb 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Thu Jun 09 09:55:18 ICT 2016
+#Thu Jun 09 11:23:14 ICT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
diff --git a/library/build.gradle b/library/build.gradle
index 0312e36..87bfd43 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,10 +1,10 @@
apply plugin: 'com.android.library'
android {
- compileSdkVersion 22
- buildToolsVersion '22.0.1'
+ compileSdkVersion 21
+ buildToolsVersion '21.1.1'
defaultConfig {
minSdkVersion 8
- targetSdkVersion 22
+ targetSdkVersion 21
}
lintOptions {
abortOnError false
From a5b6ab25d2a56e258b3d770c2aa257933bdea4f4 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Thu, 9 Jun 2016 11:30:50 +0700
Subject: [PATCH 09/41] fix buidl gradle
---
library/build.gradle | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/library/build.gradle b/library/build.gradle
index 87bfd43..d18550d 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -7,7 +7,7 @@ android {
targetSdkVersion 21
}
lintOptions {
- abortOnError false
+ abortOnError true
}
productFlavors {
}
From 695c414b19cb87a17e1e14d565200253d25e20b7 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Thu, 9 Jun 2016 11:36:52 +0700
Subject: [PATCH 10/41] fix build.gradle
---
demo/build.gradle | 3 +++
library/build.gradle | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/demo/build.gradle b/demo/build.gradle
index 8b3ed8d..2b84637 100644
--- a/demo/build.gradle
+++ b/demo/build.gradle
@@ -18,6 +18,9 @@ android {
}
productFlavors {
}
+ lintOptions {
+ abortOnError false
+ }
}
dependencies {
diff --git a/library/build.gradle b/library/build.gradle
index d18550d..87bfd43 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -7,7 +7,7 @@ android {
targetSdkVersion 21
}
lintOptions {
- abortOnError true
+ abortOnError false
}
productFlavors {
}
From b47434bb35eb023170aa1c4ca5bc9a37f9d3f118 Mon Sep 17 00:00:00 2001
From: The Gitter Badger
Date: Fri, 8 Jul 2016 04:35:13 +0000
Subject: [PATCH 11/41] Add Gitter badge
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index 6f9b4be..48d9cd2 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
# `AndroidTagGroup`
+[![Join the chat at https://gitter.im/leonacky/AndroidTagGroup](https://badges.gitter.im/leonacky/AndroidTagGroup.svg)](https://gitter.im/leonacky/AndroidTagGroup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
[![Release 1.4](https://img.shields.io/badge/Release-1.4.1-green.svg)](https://github.com/2dxgujun/AndroidTagGroup/releases)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.gujun.android.taggroup/library/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/me.gujun.android.taggroup/library)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AndroidTagGroup-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1539)
From 6abc65eaaab7422da68a4897099e0957b00378ed Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Wed, 5 Oct 2016 17:47:51 +0700
Subject: [PATCH 12/41] update selected tag
---
build.gradle | 2 +-
.../android/taggroup/demo/MainActivity.java | 5 +-
demo/src/main/res/layout/activity_main.xml | 2 +
gradle/wrapper/gradle-wrapper.properties | 4 +-
.../me/gujun/android/taggroup/TagGroup.java | 47 +++++++++++++++----
5 files changed, 46 insertions(+), 14 deletions(-)
diff --git a/build.gradle b/build.gradle
index cd74ded..da4d23b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.2.3'
+ classpath 'com.android.tools.build:gradle:2.2.0'
}
}
diff --git a/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java b/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java
index 41e7b3d..7d46ba9 100644
--- a/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java
+++ b/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java
@@ -28,8 +28,9 @@ public class MainActivity extends ActionBarActivity {
private TagGroup.OnTagClickListener mTagClickListener = new TagGroup.OnTagClickListener() {
@Override
- public void onTagClick(String tag) {
- Toast.makeText(MainActivity.this, tag, Toast.LENGTH_SHORT).show();
+ public void onTagClick(TagGroup.TagView tag) {
+ Toast.makeText(MainActivity.this, tag.getText().toString(), Toast.LENGTH_SHORT).show();
+ tag.setSelectedTag(!tag.isSelectedTag());
}
};
diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml
index a96fd01..29c5344 100644
--- a/demo/src/main/res/layout/activity_main.xml
+++ b/demo/src/main/res/layout/activity_main.xml
@@ -1,5 +1,6 @@
@@ -44,6 +45,7 @@
Date: Wed, 5 Oct 2016 18:01:55 +0700
Subject: [PATCH 13/41] add TagItem
---
demo/src/main/res/layout/activity_main.xml | 1 -
.../java/me/gujun/android/taggroup/TagItem.java | 17 +++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
create mode 100644 library/src/main/java/me/gujun/android/taggroup/TagItem.java
diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml
index 29c5344..4f983c3 100644
--- a/demo/src/main/res/layout/activity_main.xml
+++ b/demo/src/main/res/layout/activity_main.xml
@@ -45,7 +45,6 @@
Date: Wed, 5 Oct 2016 18:30:08 +0700
Subject: [PATCH 14/41] update click tag return tag text and tag position
---
.../android/taggroup/demo/MainActivity.java | 8 +--
.../me/gujun/android/taggroup/TagGroup.java | 49 ++++++++++++++++---
.../me/gujun/android/taggroup/TagItem.java | 17 -------
3 files changed, 48 insertions(+), 26 deletions(-)
delete mode 100644 library/src/main/java/me/gujun/android/taggroup/TagItem.java
diff --git a/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java b/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java
index 7d46ba9..5c03354 100644
--- a/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java
+++ b/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java
@@ -9,6 +9,8 @@
import android.widget.TextView;
import android.widget.Toast;
+import java.util.List;
+
import me.gujun.android.taggroup.TagGroup;
import me.gujun.android.taggroup.demo.db.TagsManager;
@@ -28,9 +30,9 @@ public class MainActivity extends ActionBarActivity {
private TagGroup.OnTagClickListener mTagClickListener = new TagGroup.OnTagClickListener() {
@Override
- public void onTagClick(TagGroup.TagView tag) {
- Toast.makeText(MainActivity.this, tag.getText().toString(), Toast.LENGTH_SHORT).show();
- tag.setSelectedTag(!tag.isSelectedTag());
+ public void onTagClick(TagGroup tagGroup, String tag, int position) {
+ Toast.makeText(MainActivity.this, tag, Toast.LENGTH_SHORT).show();
+ tagGroup.setSelectedTag(position, !tagGroup.isSelectedTag(position));
}
};
diff --git a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java
index df80277..977210f 100644
--- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java
+++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java
@@ -403,6 +403,28 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
}
}
+ public List getSelectedTags() {
+ List selected = new ArrayList<>();
+ final int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ final TagView child = (TagView) getChildAt(i);
+ if (child.isSelectedTag()) {
+ selected.add(i);
+ }
+ }
+ return selected;
+ }
+
+ public boolean isSelectedTag(int position) {
+ TagView child = (TagView) getChildAt(position);
+ return child.isSelectedTag();
+ }
+
+ public void setSelectedTag(int position, boolean selected) {
+ TagView child = (TagView) getChildAt(position);
+ child.setSelectedTag(selected);
+ }
+
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
@@ -510,8 +532,10 @@ public void setTags(List tagList) {
*/
public void setTags(String... tags) {
removeAllViews();
+ int i = 0;
for (final String tag : tags) {
- appendTag(tag);
+ appendTag(tag, i);
+ i++;
}
if (isAppendMode) {
@@ -588,6 +612,7 @@ protected void appendInputTag(String tag) {
final TagView newInputTag = new TagView(getContext(), TagView.STATE_INPUT, tag);
newInputTag.setOnClickListener(mInternalTagClickListener);
+ newInputTag.setPosition(-1);
addView(newInputTag);
}
@@ -596,8 +621,9 @@ protected void appendInputTag(String tag) {
*
* @param tag the tag to append.
*/
- protected void appendTag(CharSequence tag) {
+ protected void appendTag(CharSequence tag, int position) {
final TagView newTag = new TagView(getContext(), TagView.STATE_NORMAL, tag);
+ newTag.setPosition(position);
newTag.setOnClickListener(mInternalTagClickListener);
addView(newTag);
}
@@ -659,9 +685,10 @@ public interface OnTagClickListener {
/**
* Called when a tag has been clicked.
*
- * @param tag The tag that was clicked.
+ * @param tag The text of tag that was clicked.
+ * @param position The position of tag that was clicked.
*/
- void onTagClick(TagView tag);
+ void onTagClick(TagGroup tagGroup, String tag, int position);
}
/**
@@ -750,7 +777,7 @@ public void onClick(View v) {
}
} else {
if (mOnTagClickListener != null) {
- mOnTagClickListener.onTagClick(tag);
+ mOnTagClickListener.onTagClick(TagGroup.this, tag.getText().toString(), tag.getPosition());
}
}
}
@@ -759,10 +786,12 @@ public void onClick(View v) {
/**
* The tag view which has two states can be either NORMAL or INPUT.
*/
- public class TagView extends TextView {
+ private class TagView extends TextView {
public static final int STATE_NORMAL = 1;
public static final int STATE_INPUT = 2;
+ private int position = 0;
+
/**
* The offset to the text.
*/
@@ -984,6 +1013,14 @@ public boolean isSelectedTag() {
return isSelectedTag;
}
+ public int getPosition() {
+ return position;
+ }
+
+ public void setPosition(int position) {
+ this.position = position;
+ }
+
/**
* Call this method to end this tag's INPUT state.
*/
diff --git a/library/src/main/java/me/gujun/android/taggroup/TagItem.java b/library/src/main/java/me/gujun/android/taggroup/TagItem.java
deleted file mode 100644
index 7c2e39f..0000000
--- a/library/src/main/java/me/gujun/android/taggroup/TagItem.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package me.gujun.android.taggroup;
-
-/**
- * Created by leonacky on 10/5/16.
- */
-
-public class TagItem {
- private String title;
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-}
From 179d901b5e991c83847344bdf65bb0d03237c5d0 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Fri, 7 Oct 2016 12:31:59 +0700
Subject: [PATCH 15/41] modified project upload to maven
---
CHANGELOG | 14 +++++++++++
build.gradle | 1 +
demo/build.gradle | 3 ++-
demo/src/main/AndroidManifest.xml | 10 ++++----
.../aotasoft}/taggroup/demo/MainActivity.java | 8 +++----
.../taggroup/demo/TagEditorActivity.java | 6 ++---
.../taggroup/demo/db/DatabaseHelper.java | 2 +-
.../taggroup/demo/db/TagsManager.java | 2 +-
.../aotasoft}/taggroup/demo/db/TagsTable.java | 2 +-
demo/src/main/res/layout/activity_main.xml | 16 ++++++-------
.../main/res/layout/activity_tag_editor.xml | 4 ++--
gradle.properties | 18 +++++++--------
gradlew | 0
library/build.gradle | 1 +
library/src/main/AndroidManifest.xml | 2 +-
.../aotasoft}/taggroup/TagGroup.java | 23 ++++++++++---------
maven-push.gradle | 2 +-
17 files changed, 65 insertions(+), 49 deletions(-)
rename demo/src/main/java/{me/gujun/android => com/aotasoft}/taggroup/demo/MainActivity.java (96%)
rename demo/src/main/java/{me/gujun/android => com/aotasoft}/taggroup/demo/TagEditorActivity.java (91%)
rename demo/src/main/java/{me/gujun/android => com/aotasoft}/taggroup/demo/db/DatabaseHelper.java (94%)
rename demo/src/main/java/{me/gujun/android => com/aotasoft}/taggroup/demo/db/TagsManager.java (97%)
rename demo/src/main/java/{me/gujun/android => com/aotasoft}/taggroup/demo/db/TagsTable.java (87%)
mode change 100644 => 100755 gradlew
rename library/src/main/java/{me/gujun/android => com/aotasoft}/taggroup/TagGroup.java (99%)
diff --git a/CHANGELOG b/CHANGELOG
index 5e48513..2689df5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,19 @@
Change Log
==========
+*** From leonacky/AndroidTagGroup forked from 2dxgujun/AndroidTagGroup
+
+Version 1.5 *(2016-10-07)*
+----------------------------
+
+- Add TagGravity
+- Change listener for detect tag click event
+- Add get/setSelectedTag
+- Add get all selected tags
+
+
+
+
+*** From 2dxgujun/AndroidTagGroup
Version 1.4 *(2015-05-23)*
----------------------------
diff --git a/build.gradle b/build.gradle
index da4d23b..2832ed3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -15,5 +15,6 @@ allprojects {
repositories {
jcenter()
+ maven { url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' }
}
}
\ No newline at end of file
diff --git a/demo/build.gradle b/demo/build.gradle
index 2b84637..5e20533 100644
--- a/demo/build.gradle
+++ b/demo/build.gradle
@@ -4,7 +4,7 @@ android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
defaultConfig {
- applicationId 'me.gujun.android.taggroup.demo'
+ applicationId 'com.aotasoft.taggroup.demo'
minSdkVersion 8
targetSdkVersion 21
versionName project.VERSION_NAME
@@ -25,5 +25,6 @@ android {
dependencies {
compile project(':library')
+// compile 'com.aotasoft.taggroup:library:1.6'
compile 'com.android.support:appcompat-v7:21.0.3'
}
\ No newline at end of file
diff --git a/demo/src/main/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml
index 732aefd..c51ab28 100644
--- a/demo/src/main/AndroidManifest.xml
+++ b/demo/src/main/AndroidManifest.xml
@@ -1,13 +1,13 @@
+ package="com.aotasoft.taggroup.demo" >
-
+
@@ -15,12 +15,12 @@
+ android:parentActivityName="com.aotasoft.taggroup.demo.MainActivity" >
+ android:value="com.aotasoft.taggroup.demo.MainActivity" />
diff --git a/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java b/demo/src/main/java/com/aotasoft/taggroup/demo/MainActivity.java
similarity index 96%
rename from demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java
rename to demo/src/main/java/com/aotasoft/taggroup/demo/MainActivity.java
index 5c03354..019abfd 100644
--- a/demo/src/main/java/me/gujun/android/taggroup/demo/MainActivity.java
+++ b/demo/src/main/java/com/aotasoft/taggroup/demo/MainActivity.java
@@ -1,4 +1,4 @@
-package me.gujun.android.taggroup.demo;
+package com.aotasoft.taggroup.demo;
import android.content.Intent;
import android.os.Bundle;
@@ -9,10 +9,8 @@
import android.widget.TextView;
import android.widget.Toast;
-import java.util.List;
-
-import me.gujun.android.taggroup.TagGroup;
-import me.gujun.android.taggroup.demo.db.TagsManager;
+import com.aotasoft.taggroup.TagGroup;
+import com.aotasoft.taggroup.demo.db.TagsManager;
public class MainActivity extends ActionBarActivity {
diff --git a/demo/src/main/java/me/gujun/android/taggroup/demo/TagEditorActivity.java b/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
similarity index 91%
rename from demo/src/main/java/me/gujun/android/taggroup/demo/TagEditorActivity.java
rename to demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
index 9dd5770..887118a 100644
--- a/demo/src/main/java/me/gujun/android/taggroup/demo/TagEditorActivity.java
+++ b/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
@@ -1,12 +1,12 @@
-package me.gujun.android.taggroup.demo;
+package com.aotasoft.taggroup.demo;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
-import me.gujun.android.taggroup.TagGroup;
-import me.gujun.android.taggroup.demo.db.TagsManager;
+import com.aotasoft.taggroup.TagGroup;
+import com.aotasoft.taggroup.demo.db.TagsManager;
public class TagEditorActivity extends ActionBarActivity {
diff --git a/demo/src/main/java/me/gujun/android/taggroup/demo/db/DatabaseHelper.java b/demo/src/main/java/com/aotasoft/taggroup/demo/db/DatabaseHelper.java
similarity index 94%
rename from demo/src/main/java/me/gujun/android/taggroup/demo/db/DatabaseHelper.java
rename to demo/src/main/java/com/aotasoft/taggroup/demo/db/DatabaseHelper.java
index ba10f8d..a3b161c 100644
--- a/demo/src/main/java/me/gujun/android/taggroup/demo/db/DatabaseHelper.java
+++ b/demo/src/main/java/com/aotasoft/taggroup/demo/db/DatabaseHelper.java
@@ -1,4 +1,4 @@
-package me.gujun.android.taggroup.demo.db;
+package com.aotasoft.taggroup.demo.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
diff --git a/demo/src/main/java/me/gujun/android/taggroup/demo/db/TagsManager.java b/demo/src/main/java/com/aotasoft/taggroup/demo/db/TagsManager.java
similarity index 97%
rename from demo/src/main/java/me/gujun/android/taggroup/demo/db/TagsManager.java
rename to demo/src/main/java/com/aotasoft/taggroup/demo/db/TagsManager.java
index 841fc28..fcee7f7 100644
--- a/demo/src/main/java/me/gujun/android/taggroup/demo/db/TagsManager.java
+++ b/demo/src/main/java/com/aotasoft/taggroup/demo/db/TagsManager.java
@@ -1,4 +1,4 @@
-package me.gujun.android.taggroup.demo.db;
+package com.aotasoft.taggroup.demo.db;
import android.content.ContentValues;
import android.content.Context;
diff --git a/demo/src/main/java/me/gujun/android/taggroup/demo/db/TagsTable.java b/demo/src/main/java/com/aotasoft/taggroup/demo/db/TagsTable.java
similarity index 87%
rename from demo/src/main/java/me/gujun/android/taggroup/demo/db/TagsTable.java
rename to demo/src/main/java/com/aotasoft/taggroup/demo/db/TagsTable.java
index b05a5c1..2c4109d 100644
--- a/demo/src/main/java/me/gujun/android/taggroup/demo/db/TagsTable.java
+++ b/demo/src/main/java/com/aotasoft/taggroup/demo/db/TagsTable.java
@@ -1,4 +1,4 @@
-package me.gujun.android.taggroup.demo.db;
+package com.aotasoft.taggroup.demo.db;
import android.provider.BaseColumns;
diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml
index 4f983c3..9598991 100644
--- a/demo/src/main/res/layout/activity_main.xml
+++ b/demo/src/main/res/layout/activity_main.xml
@@ -12,7 +12,7 @@
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
- tools:context=".MainActivity">
+ tools:context="com.aotasoft.taggroup.demo.MainActivity">
-
@@ -42,7 +42,7 @@
android:layout_marginTop="5dp"
android:background="#DDD" />
-
@@ -55,7 +55,7 @@
android:layout_marginTop="5dp"
android:background="#DDD" />
-
@@ -67,7 +67,7 @@
android:text="@string/tags_small"
android:textSize="14sp" />
-
@@ -79,7 +79,7 @@
android:text="@string/tags_large"
android:textSize="18sp" />
-
@@ -91,7 +91,7 @@
android:text="@string/tags_large_middle"
android:textSize="18sp" />
-
@@ -104,7 +104,7 @@
android:text="@string/tags_large_right"
android:textSize="18sp" />
-
diff --git a/demo/src/main/res/layout/activity_tag_editor.xml b/demo/src/main/res/layout/activity_tag_editor.xml
index 6749944..ee5690a 100644
--- a/demo/src/main/res/layout/activity_tag_editor.xml
+++ b/demo/src/main/res/layout/activity_tag_editor.xml
@@ -9,9 +9,9 @@
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
- tools:context=".TagEditorActivity">
+ tools:context="com.aotasoft.taggroup.demo.TagEditorActivity">
-
diff --git a/gradle.properties b/gradle.properties
index e61bff9..c4c7c88 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -17,20 +17,20 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
-VERSION_NAME=1.4
-VERSION_CODE=14
-GROUP=me.gujun.android.taggroup
+VERSION_NAME=1.6
+VERSION_CODE=16
+GROUP=com.aotasoft.taggroup
POM_DESCRIPTION=Android Library to display a set of tags
-POM_URL=https://github.com/2dxgujun/AndroidTagGroup
-POM_SCM_URL=https://github.com/2dxgujun/AndroidTagGroup
-POM_SCM_CONNECTION=scm:https://github.com/2dxgujun/AndroidTagGroup.git
-POM_SCM_DEV_CONNECTION=scm:https://github.com/2dxgujun/AndroidTagGroup.git
+POM_URL=https://github.com/leonacky/AndroidTagGroup
+POM_SCM_URL=https://github.com/leonacky/AndroidTagGroup
+POM_SCM_CONNECTION=scm:https://github.com/leonacky/AndroidTagGroup.git
+POM_SCM_DEV_CONNECTION=scm:https://github.com/leonacky/AndroidTagGroup.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
-POM_DEVELOPER_ID=2dxgujun
-POM_DEVELOPER_NAME=Jun Gu
+POM_DEVELOPER_ID=leonacky
+POM_DEVELOPER_NAME=Tuan Dinh
SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots
RELEASE_REPOSITORY_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2
\ No newline at end of file
diff --git a/gradlew b/gradlew
old mode 100644
new mode 100755
diff --git a/library/build.gradle b/library/build.gradle
index 87bfd43..1e9aed2 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,4 +1,5 @@
apply plugin: 'com.android.library'
+
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
index 5fe5d86..4be2190 100644
--- a/library/src/main/AndroidManifest.xml
+++ b/library/src/main/AndroidManifest.xml
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java b/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
similarity index 99%
rename from library/src/main/java/me/gujun/android/taggroup/TagGroup.java
rename to library/src/main/java/com/aotasoft/taggroup/TagGroup.java
index 977210f..c476820 100644
--- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java
+++ b/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
@@ -1,4 +1,4 @@
-package me.gujun.android.taggroup;
+package com.aotasoft.taggroup;
import android.content.Context;
import android.content.res.TypedArray;
@@ -17,7 +17,6 @@
import android.text.TextWatcher;
import android.text.method.ArrowKeyMovementMethod;
import android.util.AttributeSet;
-import android.util.Log;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -44,14 +43,15 @@
* When in DISPLAY mode, the group is only contain NORMAL state tags, and the tags in group
* is not focusable.
*
- *
- * * Add TagGravity for TagGroup
- * * @modified Tuan Dinh (http://aotasoft.com)
- * * @updated 2016-6-9 09:32:20
+ *
*
* @author Jun Gu (http://2dxgujun.com)
- * @version 2.0
* @since 2015-2-3 14:16:32
+ *
+ * Development by
+ * @author Tuan Dinh (http://aotasoft.com)
+ * @version 1.5
+ * @since 2016-6-9 09:32:20
*/
public class TagGroup extends ViewGroup {
private final int default_border_color = Color.rgb(0x49, 0xC1, 0x20);
@@ -519,7 +519,7 @@ public String[] getTags() {
}
/**
- * @see #setTags(String...)
+ * @param tagList The list string of Tag
*/
public void setTags(List tagList) {
setTags(tagList.toArray(new String[tagList.size()]));
@@ -620,6 +620,7 @@ protected void appendInputTag(String tag) {
* Append tag to this group.
*
* @param tag the tag to append.
+ * @param position the position of tag in TagGroup.
*/
protected void appendTag(CharSequence tag, int position) {
final TagView newTag = new TagView(getContext(), TagView.STATE_NORMAL, tag);
@@ -665,14 +666,14 @@ protected void deleteTag(TagView tagView) {
public interface OnTagChangeListener {
/**
* Called when a tag has been appended to the group.
- *
+ * @param tagGroup the TagGroup object.
* @param tag the appended tag.
*/
void onAppend(TagGroup tagGroup, String tag);
/**
* Called when a tag has been deleted from the the group.
- *
+ * @param tagGroup the TagGroup object.
* @param tag the deleted tag.
*/
void onDelete(TagGroup tagGroup, String tag);
@@ -684,7 +685,7 @@ public interface OnTagChangeListener {
public interface OnTagClickListener {
/**
* Called when a tag has been clicked.
- *
+ * @param tagGroup The TagGroup object
* @param tag The text of tag that was clicked.
* @param position The position of tag that was clicked.
*/
diff --git a/maven-push.gradle b/maven-push.gradle
index 2291817..27faf37 100644
--- a/maven-push.gradle
+++ b/maven-push.gradle
@@ -28,7 +28,7 @@ def getReleaseRepositoryUrl() {
def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
- : "https://oss.sonatype.org/content/repositories/snapshots/"
+ : "https://oss.sonatype.org/content/repositories:w!/snapshots/"
}
def getRepositoryUsername() {
From 4173af2a482f4950d8709b5bf771ccc8b501a60f Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 08:04:20 +0700
Subject: [PATCH 16/41] published to jCenter
---
library/build.gradle | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/library/build.gradle b/library/build.gradle
index 1e9aed2..088eb62 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,5 +1,11 @@
apply plugin: 'com.android.library'
+ext {
+ PUBLISH_GROUP_ID = 'com.aotasoft.taggroup'
+ PUBLISH_ARTIFACT_ID = 'library'
+ PUBLISH_VERSION = '1.6'
+}
+
android {
compileSdkVersion 21
buildToolsVersion '21.1.1'
@@ -14,6 +20,7 @@ android {
}
}
// Used to push in maven
-apply from: '../maven-push.gradle'
+//apply from: '../maven-push.gradle'
+apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
dependencies {
}
\ No newline at end of file
From 6404c6a0e9c9db5645b56e111184b8197d4de45d Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 08:36:36 +0700
Subject: [PATCH 17/41] Update README.md
---
README.md | 47 ++++++++++-------------------------------------
1 file changed, 10 insertions(+), 37 deletions(-)
diff --git a/README.md b/README.md
index 48d9cd2..70b9793 100644
--- a/README.md
+++ b/README.md
@@ -2,16 +2,11 @@
[![Join the chat at https://gitter.im/leonacky/AndroidTagGroup](https://badges.gitter.im/leonacky/AndroidTagGroup.svg)](https://gitter.im/leonacky/AndroidTagGroup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-[![Release 1.4](https://img.shields.io/badge/Release-1.4.1-green.svg)](https://github.com/2dxgujun/AndroidTagGroup/releases)
-[![Maven Central](https://maven-badges.herokuapp.com/maven-central/me.gujun.android.taggroup/library/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/me.gujun.android.taggroup/library)
-[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-AndroidTagGroup-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1539)
-[![Build Status](https://travis-ci.org/2dxgujun/AndroidTagGroup.png?branch=master)](https://travis-ci.org/2dxgujun/AndroidTagGroup)
-
-The TagGroup is a special layout with a set of tags. You can use it to tag people, books or anything you want.
-
-Also you can contribute new idea to me.
-
-New update supported Tag Gravity
+The TagGroup is a special layout with a set of tags forked from 2dxgujun/AndroidTagGroup
+. I have implemented:
+1. TagGravity
+2. Get/Set SelectedTag
+3. Get all tags is selected
# Demo
@@ -34,25 +29,15 @@ New update supported Tag Gravity
#### Gradle
```groovy
dependencies {
- compile 'me.gujun.android.taggroup:library:1.4@aar'
+ compile 'com.aotasoft.taggroup:library:1.6'
}
```
-#### Maven
-```xml
-
- me.gujun.android.taggroup
- library
- 1.4
- apklib
-
-```
-
## Step 2
Use it in your own code:
```xml
-
```
@@ -81,8 +66,6 @@ Implement a callback interface: `TagGroup.OnTagClickListener`, and set the liste
To set gravity for TagGroup: use `setGravity(...)` supported `TagGroup.Gravity.LEFT`, `TagGroup.Gravity.MIDDLE` and `TagGroup.Gravity.RIGHT`
-(Wait for merge to origin-project and make Gradle. If you need, you can clone this project and import to your project)
-
# Build
run `./gradlew assembleDebug` (Mac/Linux)
@@ -100,7 +83,7 @@ There are several attributes you can set:
| attr | default | mean |
|:------------------------- |:---------------- |:------------------------------------------------------- |
| atg_isAppendMode | false | Determine the TagGroup mode, APPEND or single DISPLAY. |
-| atg_inputHint | Add Tag/添加标签 | The hint of the INPUT tag. |
+| atg_inputHint | Add Tag | The hint of the INPUT tag. |
| atg_borderColor | #49C120 | The tag outline border color. |
| atg_textColor | #49C120 | The tag text color. |
| atg_backgroundColor | #FFFFFF | The tag background color. |
@@ -120,21 +103,11 @@ There are several attributes you can set:
| atg_verticalPadding | 3dp | The vertical tag padding.(Mark4) |
# Developed By
-
-Jun Gu - <2dxgujun@gmail.com>
-
-Tuan Dinh - (Tag Gravity)
-
-
-
-
-
-
-
+Tuan Dinh - from 2dxgujun/AndroidTagGroup
# License
- Copyright 2015 Jun Gu
+ Copyright 2015 Tuan Dinh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
From ff905dc4d9c6d61522d7accfa735b45d8bbf3a82 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 08:37:18 +0700
Subject: [PATCH 18/41] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 70b9793..d5bf36b 100644
--- a/README.md
+++ b/README.md
@@ -103,7 +103,7 @@ There are several attributes you can set:
| atg_verticalPadding | 3dp | The vertical tag padding.(Mark4) |
# Developed By
-Tuan Dinh - from 2dxgujun/AndroidTagGroup
+Tuan Dinh - from origin project 2dxgujun/AndroidTagGroup
# License
From 16790400033a932e5c83270c1a0a6d95dbe88fe3 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 08:41:33 +0700
Subject: [PATCH 19/41] Update README.md
---
README.md | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index d5bf36b..434f572 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
The TagGroup is a special layout with a set of tags forked from 2dxgujun/AndroidTagGroup
. I have implemented:
1. TagGravity
-2. Get/Set SelectedTag
+2. Tag Selected
3. Get all tags is selected
# Demo
@@ -62,6 +62,14 @@ To delete a tag as user press "Backspace" key or double-tap the tag which you wa
Implement a callback interface: `TagGroup.OnTagClickListener`, and set the listener via `setOnTagClickListener()`.
+#### How to set a tag is selected?
+
+To set tag is sellected for TagGroup: use `tagroup.setSelectedTag(...)`
+
+#### How to get all tags is selected?
+
+To get all tags is sellected for TagGroup: use `tagroup.getSelectedTags(...)` will return all position of tag is selected
+
#### Gravity for TagGroup
To set gravity for TagGroup: use `setGravity(...)` supported `TagGroup.Gravity.LEFT`, `TagGroup.Gravity.MIDDLE` and `TagGroup.Gravity.RIGHT`
From c7111290c3543a425ad721446e554e8bb6abbb0f Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 08:45:35 +0700
Subject: [PATCH 20/41] Update README.md
---
README.md | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 434f572..0dd5443 100644
--- a/README.md
+++ b/README.md
@@ -2,11 +2,12 @@
[![Join the chat at https://gitter.im/leonacky/AndroidTagGroup](https://badges.gitter.im/leonacky/AndroidTagGroup.svg)](https://gitter.im/leonacky/AndroidTagGroup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-The TagGroup is a special layout with a set of tags forked from 2dxgujun/AndroidTagGroup
-. I have implemented:
+The TagGroup is a special layout with a set of tags. I have developed from 2dxgujun/AndroidTagGroup
+with new features:
1. TagGravity
2. Tag Selected
3. Get all tags is selected
+4. New implement for detect tag click event
# Demo
From f248bb7c6553560460f9a1efaa895d8aca7f748a Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 08:49:30 +0700
Subject: [PATCH 21/41] Update README.md
---
README.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/README.md b/README.md
index 0dd5443..69fcf25 100644
--- a/README.md
+++ b/README.md
@@ -2,11 +2,17 @@
[![Join the chat at https://gitter.im/leonacky/AndroidTagGroup](https://badges.gitter.im/leonacky/AndroidTagGroup.svg)](https://gitter.im/leonacky/AndroidTagGroup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![Build Status](https://travis-ci.org/leonacky/AndroidTagGroup.svg?branch=master)](https://travis-ci.org/leonacky/AndroidTagGroup)
+
The TagGroup is a special layout with a set of tags. I have developed from 2dxgujun/AndroidTagGroup
with new features:
+
1. TagGravity
+
2. Tag Selected
+
3. Get all tags is selected
+
4. New implement for detect tag click event
# Demo
From 88ed7dcfcce31d3a8c791e08c2f3555a1d5bbcbb Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 08:55:56 +0700
Subject: [PATCH 22/41] Update README.md
---
README.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 69fcf25..d46c2fb 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,8 @@
[![Join the chat at https://gitter.im/leonacky/AndroidTagGroup](https://badges.gitter.im/leonacky/AndroidTagGroup.svg)](https://gitter.im/leonacky/AndroidTagGroup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-[![Build Status](https://travis-ci.org/leonacky/AndroidTagGroup.svg?branch=master)](https://travis-ci.org/leonacky/AndroidTagGroup)
+[![Release 1.6](https://img.shields.io/badge/Release-1.6-green.svg)](https://github.com/leonacky/AndroidTagGroup/releases)
+ [![Build Status](https://travis-ci.org/leonacky/AndroidTagGroup.svg?branch=master)](https://travis-ci.org/leonacky/AndroidTagGroup)
The TagGroup is a special layout with a set of tags. I have developed from 2dxgujun/AndroidTagGroup
with new features:
From bdfdcaf8b3e3888ec68e5a7e521d06322c3c9234 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 09:04:04 +0700
Subject: [PATCH 23/41] update new build tools
---
build.gradle | 1 -
demo/build.gradle | 11 +++++------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/build.gradle b/build.gradle
index 2832ed3..da4d23b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -15,6 +15,5 @@ allprojects {
repositories {
jcenter()
- maven { url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' }
}
}
\ No newline at end of file
diff --git a/demo/build.gradle b/demo/build.gradle
index 5e20533..f76226d 100644
--- a/demo/build.gradle
+++ b/demo/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 21
- buildToolsVersion '21.1.1'
+ compileSdkVersion 24
+ buildToolsVersion '24.0.0'
defaultConfig {
applicationId 'com.aotasoft.taggroup.demo'
- minSdkVersion 8
- targetSdkVersion 21
+ minSdkVersion 9
+ targetSdkVersion 24
versionName project.VERSION_NAME
versionCode Integer.parseInt(project.VERSION_CODE)
}
@@ -25,6 +25,5 @@ android {
dependencies {
compile project(':library')
-// compile 'com.aotasoft.taggroup:library:1.6'
- compile 'com.android.support:appcompat-v7:21.0.3'
+ compile 'com.android.support:appcompat-v7:24.2.1'
}
\ No newline at end of file
From 261f82437d6b367c60e3244aaa54852a532fb058 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 12:08:03 +0700
Subject: [PATCH 24/41] Update README.md
---
README.md | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index d46c2fb..4c8fcd3 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,8 @@
[![Join the chat at https://gitter.im/leonacky/AndroidTagGroup](https://badges.gitter.im/leonacky/AndroidTagGroup.svg)](https://gitter.im/leonacky/AndroidTagGroup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Release 1.6](https://img.shields.io/badge/Release-1.6-green.svg)](https://github.com/leonacky/AndroidTagGroup/releases)
- [![Build Status](https://travis-ci.org/leonacky/AndroidTagGroup.svg?branch=master)](https://travis-ci.org/leonacky/AndroidTagGroup)
+[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.aotasoft.taggroup/library/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/com.aotasoft.taggroup/library)
+[![Build Status](https://travis-ci.org/leonacky/AndroidTagGroup.svg?branch=master)](https://travis-ci.org/leonacky/AndroidTagGroup)
The TagGroup is a special layout with a set of tags. I have developed from 2dxgujun/AndroidTagGroup
with new features:
@@ -34,6 +35,16 @@ with new features:
## Step 1
+#### Maven
+```xml
+
+ com.aotasoft.taggroup
+ library
+ 1.6
+ aar
+
+```
+
#### Gradle
```groovy
dependencies {
From 9a2d4a6e32edd11b51333cdf057d778894e7a8c1 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 12:11:28 +0700
Subject: [PATCH 25/41] Update README.md
---
README.md | 1 -
1 file changed, 1 deletion(-)
diff --git a/README.md b/README.md
index 4c8fcd3..2e2fb25 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,6 @@
[![Join the chat at https://gitter.im/leonacky/AndroidTagGroup](https://badges.gitter.im/leonacky/AndroidTagGroup.svg)](https://gitter.im/leonacky/AndroidTagGroup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Release 1.6](https://img.shields.io/badge/Release-1.6-green.svg)](https://github.com/leonacky/AndroidTagGroup/releases)
-[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.aotasoft.taggroup/library/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/com.aotasoft.taggroup/library)
[![Build Status](https://travis-ci.org/leonacky/AndroidTagGroup.svg?branch=master)](https://travis-ci.org/leonacky/AndroidTagGroup)
The TagGroup is a special layout with a set of tags. I have developed from 2dxgujun/AndroidTagGroup
From 400746b76c8783a13e7337edbac72bae2606d016 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 12:12:21 +0700
Subject: [PATCH 26/41] release v1.6
---
.gitignore | 5 ++++-
gradle.properties | 1 +
library/build.gradle | 4 ++--
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/.gitignore b/.gitignore
index 8b39a7d..2fb2288 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,7 +33,10 @@ build/
*.iml
*.ipr
*.iws
+*.asc
+*.gpg
.idea/
# Gradle files
-.gradle/
\ No newline at end of file
+.gradle/
+library/secring.gpg
diff --git a/gradle.properties b/gradle.properties
index c4c7c88..54a2e65 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -17,6 +17,7 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
+#VERSION_NAME=1.6-SNAPSHOT
VERSION_NAME=1.6
VERSION_CODE=16
GROUP=com.aotasoft.taggroup
diff --git a/library/build.gradle b/library/build.gradle
index 088eb62..f454690 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -20,7 +20,7 @@ android {
}
}
// Used to push in maven
-//apply from: '../maven-push.gradle'
-apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
+apply from: '../maven-push.gradle'
+//apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
dependencies {
}
\ No newline at end of file
From 182c1968782220b99390cb9af340c38bc82dd24a Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 12:15:55 +0700
Subject: [PATCH 27/41] update classpath "com.android.tools.build:gradle:2.1.0"
---
build.gradle | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.gradle b/build.gradle
index da4d23b..dcb5293 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath "com.android.tools.build:gradle:2.1.0"
}
}
From bfb5354a614955fbb082cbf20bedd88e5bed2206 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 12:20:40 +0700
Subject: [PATCH 28/41] small fix
---
build.gradle | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/build.gradle b/build.gradle
index dcb5293..62ca2b9 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,7 +5,9 @@ buildscript {
jcenter()
}
dependencies {
- classpath "com.android.tools.build:gradle:2.1.0"
+ classpath('com.android.tools.build:gradle:2.2.0') {
+ force = true
+ }
}
}
From 33be85f2a6a998b107746242c6658562bf165abb Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 12:28:56 +0700
Subject: [PATCH 29/41] remove travis
---
.travis.yml | 37 -------------------------------------
1 file changed, 37 deletions(-)
delete mode 100644 .travis.yml
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 3c8a6ed..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-language: java
-jdk: oraclejdk7
-branches:
- only:
- - master
-env:
- matrix:
- - ANDROID_TARGET=android-21 ANDROID_ABI=armeabi-v7a
-
-before_install:
- # Install base Android SDK
- - sudo apt-get update -qq
- - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi
- - wget http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
- - tar xzf android-sdk_r24.0.2-linux.tgz
- - export ANDROID_HOME=$PWD/android-sdk-linux
- - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
- - chmod +x gradlew
-
- # Gradle
- - wget http://services.gradle.org/distributions/gradle-1.12-bin.zip
- - unzip gradle-1.12-bin.zip
- - export GRADLE_HOME=$PWD/gradle-1.12
- - export PATH=$GRADLE_HOME/bin:$PATH
-
- # Install required components
- # For a full list, run `android list sdk -a --extended`
- # Note that sysimg-19 downloads only ARM, because only the first license query is accepted.
- - echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
- - echo yes | android update sdk --all --filter build-tools-21.1.1 --no-ui --force > /dev/null
- - echo yes | android update sdk --filter android-21 --no-ui --force > /dev/null
- - echo yes | android update sdk --filter sys-img-x86-android-19 --no-ui --force > /dev/null
- - echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- - echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
-
-install:
- - ./gradlew assemble
\ No newline at end of file
From 74a13fe5c8e8c0111c21afa1b7f8e92d863c22f0 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 12:35:03 +0700
Subject: [PATCH 30/41] edit travis.yml
---
.travis.yml | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 .travis.yml
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..f706d13
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,37 @@
+language: java
+jdk: oraclejdk8
+branches:
+ only:
+ - master
+env:
+ matrix:
+ - ANDROID_TARGET=android-24 ANDROID_ABI=armeabi-v7a
+
+before_install:
+ # Install base Android SDK
+ - sudo apt-get update -qq
+ - if [ `uname -m` = x86_64 ]; then sudo apt-get install -qq --force-yes libgd2-xpm ia32-libs ia32-libs-multiarch > /dev/null; fi
+ - wget http://dl.google.com/android/android-sdk_r24.0.2-linux.tgz
+ - tar xzf android-sdk_r24.0.2-linux.tgz
+ - export ANDROID_HOME=$PWD/android-sdk-linux
+ - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
+ - chmod +x gradlew
+
+ # Gradle
+ - wget http://services.gradle.org/distributions/gradle-2.14-bin.zip
+ - unzip gradle-2.14-bin.zip
+ - export GRADLE_HOME=$PWD/gradle-2.14
+ - export PATH=$GRADLE_HOME/bin:$PATH
+
+ # Install required components
+ # For a full list, run `android list sdk -a --extended`
+ # Note that sysimg-19 downloads only ARM, because only the first license query is accepted.
+ - echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
+ - echo yes | android update sdk --all --filter build-tools-24.0.0 --no-ui --force > /dev/null
+ - echo yes | android update sdk --filter android-24 --no-ui --force > /dev/null
+ - echo yes | android update sdk --filter sys-img-x86-android-19 --no-ui --force > /dev/null
+ - echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
+ - echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
+
+install:
+ - ./gradlew assemble
\ No newline at end of file
From 423ed013af191e705dd56d244da3aa8463af3c62 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 12:48:33 +0700
Subject: [PATCH 31/41] small fix
---
.travis.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index f706d13..5af407d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,6 +32,9 @@ before_install:
- echo yes | android update sdk --filter sys-img-x86-android-19 --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
+ - mkdir "$ANDROID_SDK/licenses" || true
+ - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_SDK/licenses/android-sdk-license"
+ - echo -e "\n79120722343a6f314e0719f863036c702b0e6b2a" > "$ANDROID_SDK/licenses/android-sdk-preview-license"
install:
- ./gradlew assemble
\ No newline at end of file
From 14dfa7bfcd739aec79332c91577e04a8ad71b944 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 12:52:48 +0700
Subject: [PATCH 32/41] small fix
---
.travis.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 5af407d..bd471da 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -33,8 +33,8 @@ before_install:
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
- mkdir "$ANDROID_SDK/licenses" || true
- - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_SDK/licenses/android-sdk-license"
- - echo -e "\n79120722343a6f314e0719f863036c702b0e6b2a" > "$ANDROID_SDK/licenses/android-sdk-preview-license"
+ - echo yes | "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_SDK/licenses/android-sdk-license"
+ - echo yes | "\n79120722343a6f314e0719f863036c702b0e6b2a" > "$ANDROID_SDK/licenses/android-sdk-preview-license"
install:
- ./gradlew assemble
\ No newline at end of file
From a7d03a3e1e5e2798cecc9190c01deb0b3af12d4d Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 12:55:58 +0700
Subject: [PATCH 33/41] small fix
---
.travis.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index bd471da..cc4d628 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -33,8 +33,8 @@ before_install:
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
- mkdir "$ANDROID_SDK/licenses" || true
- - echo yes | "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_SDK/licenses/android-sdk-license"
- - echo yes | "\n79120722343a6f314e0719f863036c702b0e6b2a" > "$ANDROID_SDK/licenses/android-sdk-preview-license"
+ - echo yes | echo -e "8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_SDK/licenses/android-sdk-license"
+ - echo yes | echo -e "79120722343a6f314e0719f863036c702b0e6b2a" > "$ANDROID_SDK/licenses/android-sdk-preview-license"
install:
- ./gradlew assemble
\ No newline at end of file
From 8330963a5230f9007a2c9066219723eec896a6ac Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Sat, 8 Oct 2016 13:01:21 +0700
Subject: [PATCH 34/41] small fix
---
.travis.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index cc4d628..9c12733 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,9 +32,9 @@ before_install:
- echo yes | android update sdk --filter sys-img-x86-android-19 --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
- - mkdir "$ANDROID_SDK/licenses" || true
- - echo yes | echo -e "8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_SDK/licenses/android-sdk-license"
- - echo yes | echo -e "79120722343a6f314e0719f863036c702b0e6b2a" > "$ANDROID_SDK/licenses/android-sdk-preview-license"
+ - mkdir ${ANDROID_HOME}/licenses || true
+ - echo yes | echo -e "8933bad161af4178b1185d1a37fbf41ea5269c55" > ${ANDROID_HOME}/licenses/android-sdk-license
+ - echo yes | echo -e "79120722343a6f314e0719f863036c702b0e6b2a" > ${ANDROID_HOME}/licenses/android-sdk-preview-license
install:
- ./gradlew assemble
\ No newline at end of file
From 05350586d8b827be16f88293b5a3b32357b97299 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Wed, 12 Oct 2016 13:11:22 +0700
Subject: [PATCH 35/41] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 2e2fb25..4c8fcd3 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,7 @@
[![Join the chat at https://gitter.im/leonacky/AndroidTagGroup](https://badges.gitter.im/leonacky/AndroidTagGroup.svg)](https://gitter.im/leonacky/AndroidTagGroup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Release 1.6](https://img.shields.io/badge/Release-1.6-green.svg)](https://github.com/leonacky/AndroidTagGroup/releases)
+[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.aotasoft.taggroup/library/badge.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/com.aotasoft.taggroup/library)
[![Build Status](https://travis-ci.org/leonacky/AndroidTagGroup.svg?branch=master)](https://travis-ci.org/leonacky/AndroidTagGroup)
The TagGroup is a special layout with a set of tags. I have developed from 2dxgujun/AndroidTagGroup
From 8061b2ba6f7cda725700890568ae3f5cc57b9a74 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Mon, 6 Mar 2017 10:47:22 +0700
Subject: [PATCH 36/41] Add text change listener
---
.../taggroup/demo/TagEditorActivity.java | 19 ++++++++++++
library/build.gradle | 2 +-
.../java/com/aotasoft/taggroup/TagGroup.java | 29 ++++++++++++++++++-
3 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java b/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
index 887118a..0c77eeb 100644
--- a/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
+++ b/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
@@ -2,6 +2,8 @@
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
+import android.text.Editable;
+import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
@@ -10,6 +12,7 @@
public class TagEditorActivity extends ActionBarActivity {
+ final String TAG = "TagEditorActivity";
private TagGroup mTagGroup;
private TagsManager mTagsManager;
@@ -24,6 +27,22 @@ protected void onCreate(Bundle savedInstanceState) {
mTagGroup = (TagGroup) findViewById(R.id.tag_group);
mTagGroup.setGravity(TagGroup.TagGravity.LEFT);
mTagGroup.setTags(tags);
+ mTagGroup.setOnTagInputTextListener(new TagGroup.OnTagInputTextListener() {
+ @Override
+ public void beforeTextChanged(TagGroup.TagView tv, CharSequence s, int start, int count, int after) {
+ Log.i(TAG, "beforeTextChanged="+s.toString());
+ }
+
+ @Override
+ public void onTextChanged(TagGroup.TagView tv, CharSequence s, int start, int before, int count) {
+ Log.i(TAG, "onTextChanged="+s.toString());
+ }
+
+ @Override
+ public void afterTextChanged(TagGroup.TagView tv, Editable s) {
+ Log.i(TAG, "afterTextChanged="+s.toString());
+ }
+ });
}
@Override
diff --git a/library/build.gradle b/library/build.gradle
index f454690..032a705 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'com.aotasoft.taggroup'
PUBLISH_ARTIFACT_ID = 'library'
- PUBLISH_VERSION = '1.6'
+ PUBLISH_VERSION = '1.7'
}
android {
diff --git a/library/src/main/java/com/aotasoft/taggroup/TagGroup.java b/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
index c476820..e351dde 100644
--- a/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
+++ b/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
@@ -177,6 +177,11 @@ public class TagGroup extends ViewGroup {
*/
private OnTagClickListener mOnTagClickListener;
+ /**
+ * Listener used to dispatch tag input event.
+ */
+ private OnTagInputTextListener mOnTagInputTextListener;
+
/**
* Listener used to handle tag click event.
*/
@@ -653,6 +658,10 @@ public void setOnTagClickListener(OnTagClickListener l) {
mOnTagClickListener = l;
}
+ public void setOnTagInputTextListener(OnTagInputTextListener l) {
+ mOnTagInputTextListener = l;
+ }
+
protected void deleteTag(TagView tagView) {
removeView(tagView);
if (mOnTagChangeListener != null) {
@@ -692,6 +701,15 @@ public interface OnTagClickListener {
void onTagClick(TagGroup tagGroup, String tag, int position);
}
+ /**
+ * Interface definition for a callback to be invoked when input text.
+ */
+ public interface OnTagInputTextListener {
+ void beforeTextChanged(TagView tv, CharSequence s, int start, int count, int after);
+ void onTextChanged(TagView tv, CharSequence s, int start, int before, int count);
+ void afterTextChanged(TagView tv, Editable s);
+ }
+
/**
* Per-child layout information for layouts.
*/
@@ -787,7 +805,7 @@ public void onClick(View v) {
/**
* The tag view which has two states can be either NORMAL or INPUT.
*/
- private class TagView extends TextView {
+ public class TagView extends TextView {
public static final int STATE_NORMAL = 1;
public static final int STATE_INPUT = 2;
@@ -969,14 +987,23 @@ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
if (checkedTagView != null) {
checkedTagView.setChecked(false);
}
+ if(mOnTagInputTextListener!=null) {
+ mOnTagInputTextListener.beforeTextChanged(TagView.this, s, start, count, after);
+ }
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
+ if(mOnTagInputTextListener!=null) {
+ mOnTagInputTextListener.onTextChanged(TagView.this, s, start, before, count);
+ }
}
@Override
public void afterTextChanged(Editable s) {
+ if(mOnTagInputTextListener!=null) {
+ mOnTagInputTextListener.afterTextChanged(TagView.this, s);
+ }
}
});
}
From e21b92bc36ba6c61aa88ea54d790f5496ea03aff Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Mon, 6 Mar 2017 11:08:30 +0700
Subject: [PATCH 37/41] Update listener
---
gradle.properties | 4 ++--
library/build.gradle | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gradle.properties b/gradle.properties
index 54a2e65..07048fe 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -18,8 +18,8 @@
# org.gradle.parallel=true
#VERSION_NAME=1.6-SNAPSHOT
-VERSION_NAME=1.6
-VERSION_CODE=16
+VERSION_NAME=1.8
+VERSION_CODE=18
GROUP=com.aotasoft.taggroup
POM_DESCRIPTION=Android Library to display a set of tags
diff --git a/library/build.gradle b/library/build.gradle
index 032a705..c70021d 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -3,7 +3,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'com.aotasoft.taggroup'
PUBLISH_ARTIFACT_ID = 'library'
- PUBLISH_VERSION = '1.7'
+ PUBLISH_VERSION = '1.8'
}
android {
From 35e69c95ffdba5626baffa8c5dbc482fabd41600 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Mon, 6 Mar 2017 14:45:35 +0700
Subject: [PATCH 38/41] Add ime action done
---
library/build.gradle | 1 +
library/src/main/java/com/aotasoft/taggroup/TagGroup.java | 4 ++++
maven-push.gradle | 4 ++--
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/library/build.gradle b/library/build.gradle
index c70021d..fab6280 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -21,6 +21,7 @@ android {
}
// Used to push in maven
apply from: '../maven-push.gradle'
+// Use for jCenter
//apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
dependencies {
}
\ No newline at end of file
diff --git a/library/src/main/java/com/aotasoft/taggroup/TagGroup.java b/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
index e351dde..701bee4 100644
--- a/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
+++ b/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
@@ -915,6 +915,10 @@ public TagView(Context context, final int state, CharSequence text) {
setFocusableInTouchMode(state == STATE_INPUT);
setHint(state == STATE_INPUT ? inputHint : null);
setMovementMethod(state == STATE_INPUT ? ArrowKeyMovementMethod.getInstance() : null);
+ if(state == STATE_INPUT)
+ setImeOptions(EditorInfo.IME_ACTION_DONE);
+
+ setSingleLine();
// Interrupted long click event to avoid PAUSE popup.
setOnLongClickListener(new OnLongClickListener() {
diff --git a/maven-push.gradle b/maven-push.gradle
index 27faf37..719bcdd 100644
--- a/maven-push.gradle
+++ b/maven-push.gradle
@@ -32,11 +32,11 @@ def getSnapshotRepositoryUrl() {
}
def getRepositoryUsername() {
- return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
+ return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "leonacky"
}
def getRepositoryPassword() {
- return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
+ return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "@dinhtuan1\$"
}
afterEvaluate { project ->
From 74abbb76909d23c0cbecfed1cb4d18a8bd22208d Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Mon, 6 Mar 2017 14:53:32 +0700
Subject: [PATCH 39/41] add on submit listener
---
.../taggroup/demo/TagEditorActivity.java | 8 +++++++
.../java/com/aotasoft/taggroup/TagGroup.java | 24 ++++++++++++++++++-
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java b/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
index 0c77eeb..d354acd 100644
--- a/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
+++ b/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
@@ -43,6 +43,14 @@ public void afterTextChanged(TagGroup.TagView tv, Editable s) {
Log.i(TAG, "afterTextChanged="+s.toString());
}
});
+
+ mTagGroup.setOnSubmitActionListener(new TagGroup.OnSubmitActionListener() {
+ @Override
+ public boolean onSubmit(TagGroup.TagView tv) {
+ mTagGroup.submitTag();
+ return false;
+ }
+ });
}
@Override
diff --git a/library/src/main/java/com/aotasoft/taggroup/TagGroup.java b/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
index 701bee4..e3cf536 100644
--- a/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
+++ b/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
@@ -25,6 +25,7 @@
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputConnectionWrapper;
+import android.widget.EditText;
import android.widget.TextView;
import java.util.ArrayList;
@@ -182,6 +183,8 @@ public class TagGroup extends ViewGroup {
*/
private OnTagInputTextListener mOnTagInputTextListener;
+ private OnSubmitActionListener mOnSubmitAction;
+
/**
* Listener used to handle tag click event.
*/
@@ -662,6 +665,10 @@ public void setOnTagInputTextListener(OnTagInputTextListener l) {
mOnTagInputTextListener = l;
}
+ public void setOnSubmitActionListener(OnSubmitActionListener l) {
+ mOnSubmitAction = l;
+ }
+
protected void deleteTag(TagView tagView) {
removeView(tagView);
if (mOnTagChangeListener != null) {
@@ -710,6 +717,10 @@ public interface OnTagInputTextListener {
void afterTextChanged(TagView tv, Editable s);
}
+ public interface OnSubmitActionListener {
+ boolean onSubmit(TagView tv);
+ }
+
/**
* Per-child layout information for layouts.
*/
@@ -915,8 +926,19 @@ public TagView(Context context, final int state, CharSequence text) {
setFocusableInTouchMode(state == STATE_INPUT);
setHint(state == STATE_INPUT ? inputHint : null);
setMovementMethod(state == STATE_INPUT ? ArrowKeyMovementMethod.getInstance() : null);
- if(state == STATE_INPUT)
+ if(state == STATE_INPUT) {
setImeOptions(EditorInfo.IME_ACTION_DONE);
+ setOnEditorActionListener(new EditText.OnEditorActionListener() {
+ @Override
+ public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
+ if (i == EditorInfo.IME_ACTION_DONE && mOnSubmitAction!=null) {
+ //do here your stuff f
+ return mOnSubmitAction.onSubmit(TagView.this);
+ }
+ return false;
+ }
+ });
+ }
setSingleLine();
From aef24f1f967719d39d63972f1fe20abb4fb5e459 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Mon, 6 Mar 2017 14:59:32 +0700
Subject: [PATCH 40/41] small fix
---
.../taggroup/demo/TagEditorActivity.java | 2 ++
.../java/com/aotasoft/taggroup/TagGroup.java | 18 ++++++++----------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java b/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
index d354acd..87f4d81 100644
--- a/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
+++ b/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
@@ -6,6 +6,7 @@
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
+import android.widget.Toast;
import com.aotasoft.taggroup.TagGroup;
import com.aotasoft.taggroup.demo.db.TagsManager;
@@ -48,6 +49,7 @@ public void afterTextChanged(TagGroup.TagView tv, Editable s) {
@Override
public boolean onSubmit(TagGroup.TagView tv) {
mTagGroup.submitTag();
+ Toast.makeText(TagEditorActivity.this, "1", Toast.LENGTH_SHORT).show();
return false;
}
});
diff --git a/library/src/main/java/com/aotasoft/taggroup/TagGroup.java b/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
index e3cf536..b7d84eb 100644
--- a/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
+++ b/library/src/main/java/com/aotasoft/taggroup/TagGroup.java
@@ -17,6 +17,7 @@
import android.text.TextWatcher;
import android.text.method.ArrowKeyMovementMethod;
import android.util.AttributeSet;
+import android.util.Log;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -928,16 +929,6 @@ public TagView(Context context, final int state, CharSequence text) {
setMovementMethod(state == STATE_INPUT ? ArrowKeyMovementMethod.getInstance() : null);
if(state == STATE_INPUT) {
setImeOptions(EditorInfo.IME_ACTION_DONE);
- setOnEditorActionListener(new EditText.OnEditorActionListener() {
- @Override
- public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
- if (i == EditorInfo.IME_ACTION_DONE && mOnSubmitAction!=null) {
- //do here your stuff f
- return mOnSubmitAction.onSubmit(TagView.this);
- }
- return false;
- }
- });
}
setSingleLine();
@@ -971,6 +962,13 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
}
return true;
}
+ if (actionId == EditorInfo.IME_ACTION_DONE && mOnSubmitAction!=null) {
+ //do here your stuff f
+ if (isInputAvailable()) {
+ endInput();
+ return mOnSubmitAction.onSubmit(TagView.this);
+ }
+ }
return false;
}
});
From 633bea5338f0426b559cefa1aa37a910ebfdac93 Mon Sep 17 00:00:00 2001
From: Tuan Dinh
Date: Mon, 6 Mar 2017 15:00:51 +0700
Subject: [PATCH 41/41] small fix
---
.../main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java b/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
index 87f4d81..713b202 100644
--- a/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
+++ b/demo/src/main/java/com/aotasoft/taggroup/demo/TagEditorActivity.java
@@ -49,7 +49,6 @@ public void afterTextChanged(TagGroup.TagView tv, Editable s) {
@Override
public boolean onSubmit(TagGroup.TagView tv) {
mTagGroup.submitTag();
- Toast.makeText(TagEditorActivity.this, "1", Toast.LENGTH_SHORT).show();
return false;
}
});