From 933b4a9aa094ccabc16437f6406ee49e89e0162e Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Wed, 23 Aug 2017 15:01:51 +0200 Subject: [PATCH 01/20] Fixed Enter Key Fixed Enter Key --- .../src/main/java/me/gujun/android/taggroup/TagGroup.java | 5 ++++- 1 file changed, 4 insertions(+), 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 5f2ae99..d3fd532 100644 --- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java +++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java @@ -736,6 +736,9 @@ public boolean onLongClick(View v) { if (state == STATE_INPUT) { requestFocus(); + //Replace Enter (new line) button with Action Go + setRawInputType(InputType.TYPE_CLASS_TEXT); + setImeOptions(EditorInfo.IME_ACTION_GO); // Handle the ENTER key down. setOnEditorActionListener(new OnEditorActionListener() { @@ -1022,4 +1025,4 @@ public boolean deleteSurroundingText(int beforeLength, int afterLength) { } } } -} \ No newline at end of file +} From c3567cfa9d99f6ee81dd4f4c3ce0705857b77cae Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Wed, 23 Aug 2017 15:25:07 +0200 Subject: [PATCH 02/20] Fixed Import Fixed input import --- library/src/main/java/me/gujun/android/taggroup/TagGroup.java | 1 + 1 file changed, 1 insertion(+) 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 d3fd532..25be040 100644 --- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java +++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java @@ -1,6 +1,7 @@ package me.gujun.android.taggroup; import android.content.Context; +import android.text.InputType; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; From 35028e96ef1dfca9bccce42401f1654c8d1acba9 Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Thu, 24 Aug 2017 19:47:26 +0200 Subject: [PATCH 03/20] Update TagGroup.java --- .../me/gujun/android/taggroup/TagGroup.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 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 25be040..3f10c90 100644 --- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java +++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java @@ -649,7 +649,7 @@ public void onClick(View v) { /** * The tag view which has two states can be either NORMAL or INPUT. */ - class TagView extends TextView { +class TagView extends AutoCompleteTextView { public static final int STATE_NORMAL = 1; public static final int STATE_INPUT = 2; @@ -762,7 +762,26 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { return false; } }); + //check changes + addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + tagView = TagView.this; + onTagCharEntryListener.onCharEntry(s.toString()); + } + }); + // Handle the BACKSPACE key down. setOnKeyListener(new OnKeyListener() { @Override From 5eecc9fb300c7dd8009ef0046d21d90617935295 Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Thu, 24 Aug 2017 19:56:05 +0200 Subject: [PATCH 04/20] Update TagGroup.java --- .../me/gujun/android/taggroup/TagGroup.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) 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 3f10c90..01356e1 100644 --- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java +++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java @@ -18,6 +18,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.Gravity; import android.view.KeyEvent; @@ -27,6 +28,8 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnectionWrapper; +import android.widget.ArrayAdapter; +import android.widget.AutoCompleteTextView; import android.widget.TextView; import java.util.ArrayList; @@ -128,13 +131,18 @@ public class TagGroup extends ViewGroup { /** Listener used to dispatch tag change event. */ private OnTagChangeListener mOnTagChangeListener; - + + /** Autocomplete */ + private AutoCompleteTextView tagView; + /** Listener used to dispatch tag click event. */ private OnTagClickListener mOnTagClickListener; /** Listener used to handle tag click event. */ private InternalTagClickListener mInternalTagClickListener = new InternalTagClickListener(); + public OnTagCharEntryListener onTagCharEntryListener; + public TagGroup(Context context) { this(context, null); } @@ -330,7 +338,7 @@ public void onRestoreInstanceState(Parcelable state) { * * @return the INPUT state tag view or null if not exists */ - protected TagView getInputTag() { + public TagView getInputTag() { if (isAppendMode) { final int inputTagIndex = getChildCount() - 1; final TagView inputTag = getTagAt(inputTagIndex); @@ -367,7 +375,9 @@ protected TagView getLastNormalTagView() { TagView lastNormalTagView = getTagAt(lastNormalTagIndex); return lastNormalTagView; } - + public AutoCompleteTextView getTagView() { + return tagView; + } /** * Returns the tag array in group, except the INPUT tag. * @@ -522,7 +532,9 @@ protected void deleteTag(TagView tagView) { mOnTagChangeListener.onDelete(TagGroup.this, tagView.getText().toString()); } } - + public void setOnTagCharEntryListener(OnTagCharEntryListener listener) { + this.onTagCharEntryListener = listener; + } /** * Interface definition for a callback to be invoked when a tag group is changed. */ @@ -553,7 +565,9 @@ public interface OnTagClickListener { */ void onTagClick(String tag); } - + public interface OnTagCharEntryListener { + void onCharEntry(String text); + } /** * Per-child layout information for layouts. */ From 13ec663d1e96fb64dad7d23ddc88ed101b830283 Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Fri, 25 Aug 2017 14:10:41 +0200 Subject: [PATCH 05/20] Update TagGroup.java --- library/src/main/java/me/gujun/android/taggroup/TagGroup.java | 3 ++- 1 file changed, 2 insertions(+), 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 01356e1..de8c8a5 100644 --- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java +++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java @@ -31,6 +31,7 @@ import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.TextView; +import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import java.util.ArrayList; import java.util.List; @@ -732,7 +733,7 @@ public TagView(Context context, final int state, CharSequence text) { setGravity(Gravity.CENTER); setText(text); setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); - + setDropDownWidth(MATCH_PARENT); mState = state; setClickable(isAppendMode); From ef6e8d1f7ab1a5e4d5f2921ca864358a60c2b1f9 Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Fri, 25 Aug 2017 14:30:32 +0200 Subject: [PATCH 06/20] Change anchor dropdown --- library/src/main/java/me/gujun/android/taggroup/TagGroup.java | 1 + 1 file changed, 1 insertion(+) 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 de8c8a5..8e9b3bc 100644 --- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java +++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java @@ -733,6 +733,7 @@ public TagView(Context context, final int state, CharSequence text) { setGravity(Gravity.CENTER); setText(text); setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); + setDropDownAnchor(android.R.id.content); setDropDownWidth(MATCH_PARENT); mState = state; From 7665ee2964d438c31b320acc0147b4bcf0fec96b Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Fri, 25 Aug 2017 14:37:25 +0200 Subject: [PATCH 07/20] Update TagGroup.java --- 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 8e9b3bc..8998faa 100644 --- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java +++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java @@ -733,7 +733,7 @@ public TagView(Context context, final int state, CharSequence text) { setGravity(Gravity.CENTER); setText(text); setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); - setDropDownAnchor(android.R.id.content); + setDropDownAnchor(R.id.TagAddContainer); setDropDownWidth(MATCH_PARENT); mState = state; From 930a47688f744b09c9bd74b7375c397417a44541 Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Fri, 25 Aug 2017 15:06:31 +0200 Subject: [PATCH 08/20] Update TagGroup.java --- library/src/main/java/me/gujun/android/taggroup/TagGroup.java | 3 ++- 1 file changed, 2 insertions(+), 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 8998faa..ef63dcb 100644 --- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java +++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java @@ -733,7 +733,8 @@ public TagView(Context context, final int state, CharSequence text) { setGravity(Gravity.CENTER); setText(text); setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); - setDropDownAnchor(R.id.TagAddContainer); + setDropDownAnchor(android.R.id.content); + setDropDownHeight(100); setDropDownWidth(MATCH_PARENT); mState = state; From b95c8b4d7047b2b33edc6bfca2f8ae301e6b269a Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Fri, 25 Aug 2017 20:18:28 +0200 Subject: [PATCH 09/20] Update ReadMe Fork --- README.md | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 2a6aa9f..d1957c4 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ -# `AndroidTagGroup` +# `Droid Tag Group 2107 version` + +[![](https://jitpack.io/v/LorenzoZaccagnini/AndroidTagGroup.svg)](https://jitpack.io/#LorenzoZaccagnini/AndroidTagGroup) -[![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. @@ -12,13 +10,13 @@ Also you can contribute new idea to me. # Demo ### Screenshot -![screenshot1](http://ww4.sinaimg.cn/large/bce2dea9jw1esbsby9v5fj20u00w8jxx.jpg) +![screenshot1](https://preview.ibb.co/bBobP5/normaltag_Crop.png) +![screenshot1](https://preview.ibb.co/jMKfHQ/autocomplete_Crop.png) ### Edit Tags ![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) # Usage @@ -27,18 +25,17 @@ Also you can contribute new idea to me. #### Gradle ```groovy dependencies { - compile 'me.gujun.android.taggroup:library:1.4@aar' + compile 'com.github.LorenzoZaccagnini:AndroidTagGroup:v1.5' } ``` #### Maven ```xml - - me.gujun.android.taggroup - library - 1.4 - apklib - + + com.github.LorenzoZaccagnini + AndroidTagGroup + v1.5 + ``` ## Step 2 @@ -60,12 +57,23 @@ Use `setTags(...)` to set the initial tags in the group. To "submit" a new tag as user press "Enter" or tap the blank area of the tag group, also you can "submit" a new tag via `submitTag()`. -**Note**: Google keyboard (a few soft keyboard not honour the key event) currently not supported "Enter" key to "submit" a new tag. - #### How to delete a tag? To delete a tag as user press "Backspace" key or double-tap the tag which you want to delete. + +#### How to add an autocomplete list? + +Just add a string array, this an example for a fragment + + mTagGroup.setOnTagCharEntryListener(new TagGroup.OnTagCharEntryListener() { + @Override + public void onCharEntry(String text) { + + mTagGroup.getTagView().setAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, autoCompleteTag)); + } + }); + #### How to detect tag click event? Implement a callback interface: `TagGroup.OnTagClickListener`, and set the listener via `setOnTagClickListener()`. From bc15aeb8aead6e19f56db1763e550683232a6310 Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Fri, 25 Aug 2017 20:28:57 +0200 Subject: [PATCH 10/20] Update README.md --- README.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d1957c4..6c2d51c 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,6 @@ Also you can contribute new idea to me. # Demo -### Screenshot -![screenshot1](https://preview.ibb.co/bBobP5/normaltag_Crop.png) -![screenshot1](https://preview.ibb.co/jMKfHQ/autocomplete_Crop.png) - ### Edit Tags ![screenshot2](http://ww4.sinaimg.cn/large/bce2dea9jw1esbsbngv8fj20u005w75v.jpg) ![screenshot3](http://ww4.sinaimg.cn/large/bce2dea9jw1esbsbmoagij20u005sabl.jpg) @@ -115,7 +111,18 @@ There are several attributes you can set: | atg_horizontalPadding | 12dp | The horizontal tag padding.(Mark3) | | atg_verticalPadding | 3dp | The vertical tag padding.(Mark4) | -# Developed By +# New version by + +Lorenzo Zaccagnini - + + + Follow me on Facebook + + + Follow me on LinkedIn + + +# Fork of Jun Gu - <2dxgujun@gmail.com> From bbbac634d5c3b723f78e4e96a895b51a2af06303 Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Fri, 25 Aug 2017 20:34:51 +0200 Subject: [PATCH 11/20] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6c2d51c..e267112 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Also you can contribute new idea to me. # Demo ### Edit Tags -![screenshot2](http://ww4.sinaimg.cn/large/bce2dea9jw1esbsbngv8fj20u005w75v.jpg) -![screenshot3](http://ww4.sinaimg.cn/large/bce2dea9jw1esbsbmoagij20u005sabl.jpg) +![screenshot1](https://preview.ibb.co/bBobP5/normaltag_Crop.png) +![screenshot1](https://preview.ibb.co/jMKfHQ/autocomplete_Crop.png) # Usage @@ -116,10 +116,10 @@ There are several attributes you can set: Lorenzo Zaccagnini - - Follow me on Facebook + Follow me on Facebook - Follow me on LinkedIn + https://smallbusinesslending.io/wp-content/uploads/2017/06/linkedin.png # Fork of From cdb3f76dda09fb4b5cd29eb8f545ebeb5c3bf2dd Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Fri, 25 Aug 2017 20:37:33 +0200 Subject: [PATCH 12/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e267112..3ddfec3 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Lorenzo Zaccagnini - Follow me on Facebook - https://smallbusinesslending.io/wp-content/uploads/2017/06/linkedin.png + Follow me on LinkedIn # Fork of From c771881e2627e42f1ea974df1c4ed642e83a1e0c Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Fri, 25 Aug 2017 20:39:57 +0200 Subject: [PATCH 13/20] Update README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3ddfec3..ec8db8b 100644 --- a/README.md +++ b/README.md @@ -61,12 +61,14 @@ To delete a tag as user press "Backspace" key or double-tap the tag which you wa #### How to add an autocomplete list? Just add a string array, this an example for a fragment - - mTagGroup.setOnTagCharEntryListener(new TagGroup.OnTagCharEntryListener() { + + private String[] suggestionsArray = { "Tag1", "Tag2", "Tag3", "Tag4", "Tag5"}; + + mTagGroup.setOnTagCharEntryListener(new TagGroup.OnTagCharEntryListener() { @Override public void onCharEntry(String text) { - - mTagGroup.getTagView().setAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, autoCompleteTag)); + + mTagGroup.getTagView().setAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, suggestionsArray)); } }); From 8715eaab15042d45a8ba830aff28215faf46cad6 Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Fri, 25 Aug 2017 20:42:44 +0200 Subject: [PATCH 14/20] Fixed anchor of autocomplete dropdown --- library/src/main/java/me/gujun/android/taggroup/TagGroup.java | 2 -- 1 file changed, 2 deletions(-) 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 ef63dcb..de8c8a5 100644 --- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java +++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java @@ -733,8 +733,6 @@ public TagView(Context context, final int state, CharSequence text) { setGravity(Gravity.CENTER); setText(text); setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); - setDropDownAnchor(android.R.id.content); - setDropDownHeight(100); setDropDownWidth(MATCH_PARENT); mState = state; From 9ab8f3dadeac06b4d76f874a68348bfd02825f9d Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Fri, 25 Aug 2017 20:56:48 +0200 Subject: [PATCH 15/20] Update README.md --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ec8db8b..599cca1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # `Droid Tag Group 2107 version` -[![](https://jitpack.io/v/LorenzoZaccagnini/AndroidTagGroup.svg)](https://jitpack.io/#LorenzoZaccagnini/AndroidTagGroup) - +[![](https://jitpack.io/v/LorenzoZaccagnini/DroidTag.svg)](https://jitpack.io/#LorenzoZaccagnini/DroidTag) The TagGroup is a special layout with a set of tags. You can use it to tag people, books or anything you want. @@ -21,16 +20,15 @@ Also you can contribute new idea to me. #### Gradle ```groovy dependencies { - compile 'com.github.LorenzoZaccagnini:AndroidTagGroup:v1.5' -} +compile 'com.github.LorenzoZaccagnini:DroidTag:1.6'} ``` #### Maven ```xml com.github.LorenzoZaccagnini - AndroidTagGroup - v1.5 + DroidTag + 1.6 ``` From cf2874a1a2e61f59cdd59ed00e23f75175f86b72 Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Fri, 25 Aug 2017 22:43:46 +0200 Subject: [PATCH 16/20] Demo --- build.gradle | 2 +- demo/build.gradle | 16 ++- demo/src/main/AndroidManifest.xml | 8 -- .../android/taggroup/demo/MainActivity.java | 113 +++--------------- .../taggroup/demo/TagEditorActivity.java | 52 -------- demo/src/main/res/layout/activity_main.xml | 95 ++++----------- .../main/res/layout/activity_tag_editor.xml | 18 --- demo/src/main/res/layout/taglist.xml | 8 ++ gradle/wrapper/gradle-wrapper.properties | 4 +- library/build.gradle | 2 +- 10 files changed, 59 insertions(+), 259 deletions(-) delete mode 100644 demo/src/main/java/me/gujun/android/taggroup/demo/TagEditorActivity.java delete mode 100644 demo/src/main/res/layout/activity_tag_editor.xml create mode 100644 demo/src/main/res/layout/taglist.xml diff --git a/build.gradle b/build.gradle index cd74ded..64afce7 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.3.3' } } diff --git a/demo/build.gradle b/demo/build.gradle index 8b3ed8d..3c16afa 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 26 + buildToolsVersion '26.0.1' defaultConfig { applicationId 'me.gujun.android.taggroup.demo' - minSdkVersion 8 - targetSdkVersion 21 + minSdkVersion 19 + targetSdkVersion 26 versionName project.VERSION_NAME versionCode Integer.parseInt(project.VERSION_CODE) } @@ -22,5 +22,11 @@ android { dependencies { compile project(':library') - compile 'com.android.support:appcompat-v7:21.0.3' + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:26.+' + compile 'com.android.support.constraint:constraint-layout:1.0.2' + testCompile 'junit:junit:4.12' } \ No newline at end of file diff --git a/demo/src/main/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml index 732aefd..000e8f3 100644 --- a/demo/src/main/AndroidManifest.xml +++ b/demo/src/main/AndroidManifest.xml @@ -14,14 +14,6 @@ - - - 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..12973b6 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 @@ -1,116 +1,31 @@ package me.gujun.android.taggroup.demo; -import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.ActionBarActivity; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.widget.TextView; -import android.widget.Toast; +import android.support.v7.app.AppCompatActivity; +import android.widget.ArrayAdapter; import me.gujun.android.taggroup.TagGroup; -import me.gujun.android.taggroup.demo.db.TagsManager; -public class MainActivity extends ActionBarActivity { - private TextView mPromptText; - - private TagGroup mDefaultTagGroup; - private TagGroup mSmallTagGroup; - private TagGroup mLargeTagGroup; - private TagGroup mBeautyTagGroup; - private TagGroup mBeautyInverseTagGroup; - - private TagsManager mTagsManager; - - private TagGroup.OnTagClickListener mTagClickListener = new TagGroup.OnTagClickListener() { - @Override - public void onTagClick(String tag) { - Toast.makeText(MainActivity.this, tag, Toast.LENGTH_SHORT).show(); - } - }; - +public class MainActivity extends AppCompatActivity { + private TagGroup mTagGroup; + //TODO REMOVE suggestion string when backend is ready + private String[] autoFakeServerCompleteTag = { "Tag1", "Tag2", "Tag3", "Tag4", "Tag5"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - mTagsManager = TagsManager.getInstance(getApplicationContext()); - String[] tags = mTagsManager.getTags(); - - mPromptText = (TextView) findViewById(R.id.tv_prompt); - mPromptText.setVisibility((tags == null || tags.length == 0) ? View.VISIBLE : View.GONE); - mPromptText.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - launchTagEditorActivity(); - } - }); - - mDefaultTagGroup = (TagGroup) findViewById(R.id.tag_group); - mSmallTagGroup = (TagGroup) findViewById(R.id.tag_group_small); - mLargeTagGroup = (TagGroup) findViewById(R.id.tag_group_large); - mBeautyTagGroup = (TagGroup) findViewById(R.id.tag_group_beauty); - mBeautyInverseTagGroup = (TagGroup) findViewById(R.id.tag_group_beauty_inverse); - if (tags != null && tags.length > 0) { - mDefaultTagGroup.setTags(tags); - mSmallTagGroup.setTags(tags); - mLargeTagGroup.setTags(tags); - mBeautyTagGroup.setTags(tags); - mBeautyInverseTagGroup.setTags(tags); - } - - MyTagGroupOnClickListener tgClickListener = new MyTagGroupOnClickListener(); - - mDefaultTagGroup.setOnClickListener(tgClickListener); - mSmallTagGroup.setOnClickListener(tgClickListener); - mLargeTagGroup.setOnClickListener(tgClickListener); - mBeautyTagGroup.setOnClickListener(tgClickListener); - mBeautyInverseTagGroup.setOnClickListener(tgClickListener); - - mDefaultTagGroup.setOnTagClickListener(mTagClickListener); - mSmallTagGroup.setOnTagClickListener(mTagClickListener); - mLargeTagGroup.setOnTagClickListener(mTagClickListener); - mBeautyTagGroup.setOnTagClickListener(mTagClickListener); - mBeautyInverseTagGroup.setOnTagClickListener(mTagClickListener); - } - - @Override - protected void onResume() { - super.onResume(); - String[] tags = mTagsManager.getTags(); - mPromptText.setVisibility((tags == null || tags.length == 0) ? View.VISIBLE : View.GONE); - mDefaultTagGroup.setTags(tags); - mSmallTagGroup.setTags(tags); - mLargeTagGroup.setTags(tags); - mBeautyTagGroup.setTags(tags); - mBeautyInverseTagGroup.setTags(tags); - } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.menu_main_activity, menu); - return true; - } + mTagGroup = (TagGroup) findViewById(R.id.tag_group); - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == R.id.action_edit) { - launchTagEditorActivity(); - return true; - } - return false; - } + //get Fake Autocomplete server string array - protected void launchTagEditorActivity() { - Intent intent = new Intent(MainActivity.this, TagEditorActivity.class); - startActivity(intent); - } + mTagGroup.setOnTagCharEntryListener(new TagGroup.OnTagCharEntryListener() { + @Override + public void onCharEntry(String text) { - class MyTagGroupOnClickListener implements View.OnClickListener { - @Override - public void onClick(View v) { - launchTagEditorActivity(); - } + mTagGroup.getTagView().setAdapter(new ArrayAdapter<>(MainActivity.this, R.layout.taglist, autoFakeServerCompleteTag)); + } + }); } } \ No newline at end of file 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 deleted file mode 100644 index 27d2ea1..0000000 --- a/demo/src/main/java/me/gujun/android/taggroup/demo/TagEditorActivity.java +++ /dev/null @@ -1,52 +0,0 @@ -package me.gujun.android.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; - - -public class TagEditorActivity extends ActionBarActivity { - private TagGroup mTagGroup; - private TagsManager mTagsManager; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_tag_editor); - - mTagsManager = TagsManager.getInstance(getApplicationContext()); - String[] tags = mTagsManager.getTags(); - - mTagGroup = (TagGroup) findViewById(R.id.tag_group); - mTagGroup.setTags(tags); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.menu_tag_editor_activity, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - mTagsManager.updateTags(mTagGroup.getTags()); - finish(); - return true; - } else if (item.getItemId() == R.id.action_submit) { - mTagGroup.submitTag(); - return true; - } - return false; - } - - @Override - public void onBackPressed() { - mTagsManager.updateTags(mTagGroup.getTags()); - super.onBackPressed(); - } -} \ No newline at end of file diff --git a/demo/src/main/res/layout/activity_main.xml b/demo/src/main/res/layout/activity_main.xml index db8f830..3467e6f 100644 --- a/demo/src/main/res/layout/activity_main.xml +++ b/demo/src/main/res/layout/activity_main.xml @@ -1,81 +1,30 @@ + - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + android:layout_height="match_parent"> + + + + + diff --git a/demo/src/main/res/layout/activity_tag_editor.xml b/demo/src/main/res/layout/activity_tag_editor.xml deleted file mode 100644 index 6749944..0000000 --- a/demo/src/main/res/layout/activity_tag_editor.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - \ No newline at end of file diff --git a/demo/src/main/res/layout/taglist.xml b/demo/src/main/res/layout/taglist.xml new file mode 100644 index 0000000..c3e55c0 --- /dev/null +++ b/demo/src/main/res/layout/taglist.xml @@ -0,0 +1,8 @@ + + \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c71e76..a605270 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 +#Fri Aug 25 22:31:57 CEST 2017 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-3.3-all.zip diff --git a/library/build.gradle b/library/build.gradle index 87bfd43..7d540d0 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion 21 - buildToolsVersion '21.1.1' + buildToolsVersion '25.0.0' defaultConfig { minSdkVersion 8 targetSdkVersion 21 From 52d883018213b16bf27dc2aa4e456f8bdeb924a3 Mon Sep 17 00:00:00 2001 From: lorenzozaccagnini Date: Sat, 26 Aug 2017 11:53:01 +0200 Subject: [PATCH 17/20] gradle fix hope --- demo/build.gradle | 17 ++++++----------- .../android/taggroup/demo/MainActivity.java | 4 ++-- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/demo/build.gradle b/demo/build.gradle index 3c16afa..8d94db8 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -1,12 +1,13 @@ + apply plugin: 'com.android.application' android { - compileSdkVersion 26 - buildToolsVersion '26.0.1' + compileSdkVersion 21 + buildToolsVersion '25.0.0' defaultConfig { applicationId 'me.gujun.android.taggroup.demo' - minSdkVersion 19 - targetSdkVersion 26 + minSdkVersion 8 + targetSdkVersion 21 versionName project.VERSION_NAME versionCode Integer.parseInt(project.VERSION_CODE) } @@ -22,11 +23,5 @@ android { dependencies { compile project(':library') - compile fileTree(dir: 'libs', include: ['*.jar']) - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { - exclude group: 'com.android.support', module: 'support-annotations' - }) - compile 'com.android.support:appcompat-v7:26.+' - compile 'com.android.support.constraint:constraint-layout:1.0.2' - testCompile 'junit:junit:4.12' + compile 'com.android.support:appcompat-v7:21.0.3' } \ 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 12973b6..1a698d3 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 @@ -1,13 +1,13 @@ package me.gujun.android.taggroup.demo; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; +import android.support.v7.app.ActionBarActivity; import android.widget.ArrayAdapter; import me.gujun.android.taggroup.TagGroup; -public class MainActivity extends AppCompatActivity { +public class MainActivity extends ActionBarActivity { private TagGroup mTagGroup; //TODO REMOVE suggestion string when backend is ready private String[] autoFakeServerCompleteTag = { "Tag1", "Tag2", "Tag3", "Tag4", "Tag5"}; From e1eacdd0fa72778677413349d3a0c538a0082be9 Mon Sep 17 00:00:00 2001 From: lorenzozaccagnini Date: Sat, 26 Aug 2017 12:00:04 +0200 Subject: [PATCH 18/20] gradle fix hope 2 --- build.gradle | 2 +- demo/build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- library/build.gradle | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 64afce7..cd74ded 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.3' + classpath 'com.android.tools.build:gradle:1.2.3' } } diff --git a/demo/build.gradle b/demo/build.gradle index 8d94db8..6bbf077 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 21 - buildToolsVersion '25.0.0' + buildToolsVersion '21.1.1' defaultConfig { applicationId 'me.gujun.android.taggroup.demo' minSdkVersion 8 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a605270..78c71d0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Aug 25 22:31:57 CEST 2017 +#Sat Aug 26 11:56:33 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip diff --git a/library/build.gradle b/library/build.gradle index 7d540d0..87bfd43 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.android.library' android { compileSdkVersion 21 - buildToolsVersion '25.0.0' + buildToolsVersion '21.1.1' defaultConfig { minSdkVersion 8 targetSdkVersion 21 From 88ed4ffe72ecf145c1ed3a897746fb55acfdef6f Mon Sep 17 00:00:00 2001 From: KrishneshG Date: Mon, 16 Apr 2018 14:31:44 +1000 Subject: [PATCH 19/20] Bug Fix For Null Interface Call There is an issue if the onTagCharEntryListener is not present for whatever reason coursing the library to crash internally if there is an internal error it should fail safely. --- library/src/main/java/me/gujun/android/taggroup/TagGroup.java | 2 ++ 1 file changed, 2 insertions(+) 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 de8c8a5..a739f94 100644 --- a/library/src/main/java/me/gujun/android/taggroup/TagGroup.java +++ b/library/src/main/java/me/gujun/android/taggroup/TagGroup.java @@ -792,7 +792,9 @@ public void onTextChanged(CharSequence s, int start, int before, int count) { @Override public void afterTextChanged(Editable s) { tagView = TagView.this; + if(onTagCharEntryListener!=null && s !=null){ onTagCharEntryListener.onCharEntry(s.toString()); + } } }); From a8ebc68214db351146e9e904300702be60c7b76a Mon Sep 17 00:00:00 2001 From: Lorenzo Zaccagnini Date: Thu, 20 Jun 2019 10:41:52 +0200 Subject: [PATCH 20/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 599cca1..6e3a2a8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# `Droid Tag Group 2107 version` +# `Droid Tag Group 2017 version` [![](https://jitpack.io/v/LorenzoZaccagnini/DroidTag.svg)](https://jitpack.io/#LorenzoZaccagnini/DroidTag)