Skip to content

Commit 77e8ab4

Browse files
committed
fix a bug that data re-input when setAdapter.
1 parent 6ae9186 commit 77e8ab4

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

XhsEmoticonsKeyboard/library/src/main/java/sj/keyboard/XhsEmoticonsKeyBoard.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ public void setAdapter(PageSetAdapter pageSetAdapter) {
141141
ArrayList<PageSetEntity> pageSetEntities = pageSetAdapter.getPageSetEntityList();
142142
if (pageSetEntities != null) {
143143
for (PageSetEntity pageSetEntity : pageSetEntities) {
144+
if(mEmoticonsToolBarView.containsKey(pageSetEntity)) {
145+
continue;
146+
}
144147
mEmoticonsToolBarView.addToolItemView(pageSetEntity);
145148
}
146149
}

XhsEmoticonsKeyboard/library/src/main/java/sj/keyboard/widget/EmoticonsToolBarView.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,23 @@ public View addToolItemView(int rec, final PageSetEntity pageSetEntity, OnClickL
107107
return toolBtnView;
108108
}
109109

110+
public boolean containsKey(PageSetEntity pageSetEntity) {
111+
if(pageSetEntity == null) {
112+
return false;
113+
}
114+
String uuid = pageSetEntity.getUuid();
115+
if(TextUtils.isEmpty(uuid)) {
116+
return false;
117+
}
118+
119+
for(int i = 0 ; i < ly_tool.getChildCount(); i++) {
120+
if(uuid.equals(ly_tool.getChildAt(i).getTag(R.id.id_toolbar_uuid))){
121+
return true;
122+
}
123+
}
124+
return false;
125+
}
126+
110127
public void clear() {
111128
mToolBtnList.clear();
112129
hsv_toolbar.removeAllViews();

0 commit comments

Comments
 (0)