From bdcb3c4e87b3df75ef57f62423bb6f159dba845d Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 25 Nov 2017 19:07:36 +0200 Subject: [PATCH 01/16] Update FilterableListView.java if (layoutParams != null) was added at line 135 as this was occasionally throwing a NPE when entering text into the ChipsInput. --- .../java/com/pchmn/materialchips/views/FilterableListView.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java b/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java index 8e94cd52..98e63584 100644 --- a/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java +++ b/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java @@ -132,6 +132,7 @@ public void fadeIn() { int[] coord = new int[2]; mChipsInput.getLocationInWindow(coord); ViewGroup.MarginLayoutParams layoutParams = (MarginLayoutParams) getLayoutParams(); + if (layoutParams != null) { layoutParams.topMargin = coord[1] + mChipsInput.getHeight(); // height of the keyboard layoutParams.bottomMargin = rootView.getHeight() - r.bottom; @@ -141,6 +142,7 @@ public void fadeIn() { anim.setDuration(200); startAnimation(anim); setVisibility(VISIBLE); + } } /** From 242ab9877bc9f8b8e224c1d78d8fe6fb34101f3c Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 2 Dec 2017 17:39:22 +0200 Subject: [PATCH 02/16] Update ChipsAdapter.java --- .../java/com/pchmn/materialchips/adapter/ChipsAdapter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java index 6e000411..b5097123 100644 --- a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java +++ b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java @@ -311,7 +311,8 @@ public void removeChip(int position) { if (mChipList.size() == 0) mEditText.setHint(mHintLabel); // refresh data - notifyDataSetChanged(); + //notifyDataSetChanged(); + notifyItemRangeChanged(1,mChipList.size()); } public void removeChipById(Object id) { From 5f619c2c8c814cd1089c2ce5e46c50e1dcf257fd Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 2 Dec 2017 17:43:18 +0200 Subject: [PATCH 03/16] Update ChipsAdapter.java --- .../java/com/pchmn/materialchips/adapter/ChipsAdapter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java index b5097123..ba36d221 100644 --- a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java +++ b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java @@ -311,8 +311,8 @@ public void removeChip(int position) { if (mChipList.size() == 0) mEditText.setHint(mHintLabel); // refresh data - //notifyDataSetChanged(); - notifyItemRangeChanged(1,mChipList.size()); + notifyDataSetChanged(); + //notifyItemRangeChanged(1,mChipList.size()); } public void removeChipById(Object id) { From 580004803461165570049b3298b845c1e93c9120 Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 2 Dec 2017 18:59:53 +0200 Subject: [PATCH 04/16] Update ChipsAdapter.java --- .../java/com/pchmn/materialchips/adapter/ChipsAdapter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java index ba36d221..d7886a4b 100644 --- a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java +++ b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java @@ -299,6 +299,7 @@ public void removeChip(ChipInterface chip) { mEditText.setHint(mHintLabel); // refresh data notifyDataSetChanged(); + notifyItemRangeChanged(1,mChipList.size()); } public void removeChip(int position) { @@ -311,8 +312,8 @@ public void removeChip(int position) { if (mChipList.size() == 0) mEditText.setHint(mHintLabel); // refresh data - notifyDataSetChanged(); - //notifyItemRangeChanged(1,mChipList.size()); + //notifyDataSetChanged(); + notifyItemRangeChanged(1,mChipList.size()); } public void removeChipById(Object id) { From bf16945a5414e02d0bdbeeb4e5fa94ce388851e5 Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 2 Dec 2017 19:01:43 +0200 Subject: [PATCH 05/16] Update ChipsAdapter.java --- .../java/com/pchmn/materialchips/adapter/ChipsAdapter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java index d7886a4b..2987a855 100644 --- a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java +++ b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java @@ -298,8 +298,9 @@ public void removeChip(ChipInterface chip) { if (mChipList.size() == 0) mEditText.setHint(mHintLabel); // refresh data - notifyDataSetChanged(); + //notifyDataSetChanged(); notifyItemRangeChanged(1,mChipList.size()); + Log.d(TAG, "Hello from the other side 1"); } public void removeChip(int position) { @@ -314,6 +315,7 @@ public void removeChip(int position) { // refresh data //notifyDataSetChanged(); notifyItemRangeChanged(1,mChipList.size()); + Log.d(TAG, "Hello from the other side 2"); } public void removeChipById(Object id) { From a9bd347d189ce58843ecf19427c1b3a7e7ff04e5 Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 16 Dec 2017 13:12:29 +0200 Subject: [PATCH 06/16] Update ChipsInput.java --- library/src/main/java/com/pchmn/materialchips/ChipsInput.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/java/com/pchmn/materialchips/ChipsInput.java b/library/src/main/java/com/pchmn/materialchips/ChipsInput.java index ba3dbd56..fef0b639 100644 --- a/library/src/main/java/com/pchmn/materialchips/ChipsInput.java +++ b/library/src/main/java/com/pchmn/materialchips/ChipsInput.java @@ -39,7 +39,7 @@ public class ChipsInput extends ScrollViewMaxHeight { // xml element @BindView(R2.id.chips_recycler) RecyclerView mRecyclerView; // adapter - private ChipsAdapter mChipsAdapter; + public ChipsAdapter mChipsAdapter; // attributes private static final int NONE = -1; private String mHint; From b3aee9af6aad7856c8b4a42ccc81d38569af4a35 Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 16 Dec 2017 13:26:16 +0200 Subject: [PATCH 07/16] Update ChipsInput.java --- .../src/main/java/com/pchmn/materialchips/ChipsInput.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/pchmn/materialchips/ChipsInput.java b/library/src/main/java/com/pchmn/materialchips/ChipsInput.java index fef0b639..58d92131 100644 --- a/library/src/main/java/com/pchmn/materialchips/ChipsInput.java +++ b/library/src/main/java/com/pchmn/materialchips/ChipsInput.java @@ -39,7 +39,7 @@ public class ChipsInput extends ScrollViewMaxHeight { // xml element @BindView(R2.id.chips_recycler) RecyclerView mRecyclerView; // adapter - public ChipsAdapter mChipsAdapter; + private ChipsAdapter mChipsAdapter; // attributes private static final int NONE = -1; private String mHint; @@ -265,6 +265,10 @@ public void onTextChanged(CharSequence text) { public List getSelectedChipList() { return mChipsAdapter.getChipList(); } + + public ChipsAdapter getAdaptor() { + return mChipsAdapter; + } public String getHint() { return mHint; From c9924428df9f4ac24e32986e52d9b81ad8486327 Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 16 Dec 2017 13:28:06 +0200 Subject: [PATCH 08/16] Update ChipsAdapter.java --- .../java/com/pchmn/materialchips/adapter/ChipsAdapter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java index 2987a855..ee9ebb6e 100644 --- a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java +++ b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java @@ -119,7 +119,11 @@ public int getItemViewType(int position) { public long getItemId(int position) { return mChipList.get(position).hashCode(); } - + + public ChipsInputEditText getChipsInputEditText() { + return mEditText; + } + private void initEditText() { mEditText.setLayoutParams(new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, From 977a525757cde1a63586e118e602778820d4d611 Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 16 Dec 2017 15:11:39 +0200 Subject: [PATCH 09/16] Update ChipsAdapter.java --- .../java/com/pchmn/materialchips/adapter/ChipsAdapter.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java index ee9ebb6e..aabb999a 100644 --- a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java +++ b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java @@ -124,6 +124,11 @@ public ChipsInputEditText getChipsInputEditText() { return mEditText; } + public List getChipList() { + return mChipList; + } + + private void initEditText() { mEditText.setLayoutParams(new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, From 42993cee789e064b0a12e9f25252d2fb0066b60c Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 16 Dec 2017 18:09:14 +0200 Subject: [PATCH 10/16] Update FilterableAdapter.java --- .../com/pchmn/materialchips/adapter/FilterableAdapter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/pchmn/materialchips/adapter/FilterableAdapter.java b/library/src/main/java/com/pchmn/materialchips/adapter/FilterableAdapter.java index 5fd1273f..6d2a6327 100644 --- a/library/src/main/java/com/pchmn/materialchips/adapter/FilterableAdapter.java +++ b/library/src/main/java/com/pchmn/materialchips/adapter/FilterableAdapter.java @@ -91,11 +91,11 @@ public int compare(ChipInterface o1, ChipInterface o2) { public void onChipAdded(ChipInterface chip, int newSize) { removeChip(chip); } - +/** @Override public void onChipRemoved(ChipInterface chip, int newSize) { addChip(chip); - } + }*/ @Override public void onTextChanged(CharSequence text) { From 9e22336a34bf210eab6b718e8fc70e98662e1e2c Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 16 Dec 2017 18:45:51 +0200 Subject: [PATCH 11/16] Update FilterableAdapter.java --- .../com/pchmn/materialchips/adapter/FilterableAdapter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/pchmn/materialchips/adapter/FilterableAdapter.java b/library/src/main/java/com/pchmn/materialchips/adapter/FilterableAdapter.java index 6d2a6327..5fd1273f 100644 --- a/library/src/main/java/com/pchmn/materialchips/adapter/FilterableAdapter.java +++ b/library/src/main/java/com/pchmn/materialchips/adapter/FilterableAdapter.java @@ -91,11 +91,11 @@ public int compare(ChipInterface o1, ChipInterface o2) { public void onChipAdded(ChipInterface chip, int newSize) { removeChip(chip); } -/** + @Override public void onChipRemoved(ChipInterface chip, int newSize) { addChip(chip); - }*/ + } @Override public void onTextChanged(CharSequence text) { From 87269e93811ea94bb90a8b23c337d4457a9c7340 Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 16 Dec 2017 18:58:06 +0200 Subject: [PATCH 12/16] Update FilterableListView.java --- .../com/pchmn/materialchips/views/FilterableListView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java b/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java index 98e63584..61894f93 100644 --- a/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java +++ b/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java @@ -132,7 +132,7 @@ public void fadeIn() { int[] coord = new int[2]; mChipsInput.getLocationInWindow(coord); ViewGroup.MarginLayoutParams layoutParams = (MarginLayoutParams) getLayoutParams(); - if (layoutParams != null) { + //if (layoutParams != null) { layoutParams.topMargin = coord[1] + mChipsInput.getHeight(); // height of the keyboard layoutParams.bottomMargin = rootView.getHeight() - r.bottom; @@ -142,7 +142,7 @@ public void fadeIn() { anim.setDuration(200); startAnimation(anim); setVisibility(VISIBLE); - } + //} } /** From 15ed0dd1422600f1c4061a8938b26db1d266b399 Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 16 Dec 2017 19:00:22 +0200 Subject: [PATCH 13/16] Update FilterableListView.java --- .../com/pchmn/materialchips/views/FilterableListView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java b/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java index 61894f93..98e63584 100644 --- a/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java +++ b/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java @@ -132,7 +132,7 @@ public void fadeIn() { int[] coord = new int[2]; mChipsInput.getLocationInWindow(coord); ViewGroup.MarginLayoutParams layoutParams = (MarginLayoutParams) getLayoutParams(); - //if (layoutParams != null) { + if (layoutParams != null) { layoutParams.topMargin = coord[1] + mChipsInput.getHeight(); // height of the keyboard layoutParams.bottomMargin = rootView.getHeight() - r.bottom; @@ -142,7 +142,7 @@ public void fadeIn() { anim.setDuration(200); startAnimation(anim); setVisibility(VISIBLE); - //} + } } /** From 582aed06120a7292cd3cec8b69795c85d69c1cbb Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sat, 16 Dec 2017 19:44:31 +0200 Subject: [PATCH 14/16] Update ChipsAdapter.java --- .../java/com/pchmn/materialchips/adapter/ChipsAdapter.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java index aabb999a..bed7dcd4 100644 --- a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java +++ b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java @@ -123,12 +123,7 @@ public long getItemId(int position) { public ChipsInputEditText getChipsInputEditText() { return mEditText; } - - public List getChipList() { - return mChipList; - } - - + private void initEditText() { mEditText.setLayoutParams(new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, From 14aeabfc3a6004bd0c6564ff6bfac9e43c8f43a8 Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sun, 17 Dec 2017 08:34:03 +0200 Subject: [PATCH 15/16] Update ChipsAdapter.java --- .../main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java index bed7dcd4..23eef325 100644 --- a/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java +++ b/library/src/main/java/com/pchmn/materialchips/adapter/ChipsAdapter.java @@ -304,7 +304,6 @@ public void removeChip(ChipInterface chip) { // refresh data //notifyDataSetChanged(); notifyItemRangeChanged(1,mChipList.size()); - Log.d(TAG, "Hello from the other side 1"); } public void removeChip(int position) { @@ -319,7 +318,6 @@ public void removeChip(int position) { // refresh data //notifyDataSetChanged(); notifyItemRangeChanged(1,mChipList.size()); - Log.d(TAG, "Hello from the other side 2"); } public void removeChipById(Object id) { From e4f44c2e6e91fcb7913043724b05295f255aa73c Mon Sep 17 00:00:00 2001 From: ChrisLMills <31799634+ChrisLMills@users.noreply.github.com> Date: Sun, 17 Dec 2017 09:14:42 +0200 Subject: [PATCH 16/16] Update FilterableListView.java --- .../com/pchmn/materialchips/views/FilterableListView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java b/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java index 98e63584..61894f93 100644 --- a/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java +++ b/library/src/main/java/com/pchmn/materialchips/views/FilterableListView.java @@ -132,7 +132,7 @@ public void fadeIn() { int[] coord = new int[2]; mChipsInput.getLocationInWindow(coord); ViewGroup.MarginLayoutParams layoutParams = (MarginLayoutParams) getLayoutParams(); - if (layoutParams != null) { + //if (layoutParams != null) { layoutParams.topMargin = coord[1] + mChipsInput.getHeight(); // height of the keyboard layoutParams.bottomMargin = rootView.getHeight() - r.bottom; @@ -142,7 +142,7 @@ public void fadeIn() { anim.setDuration(200); startAnimation(anim); setVisibility(VISIBLE); - } + //} } /**