Skip to content

Commit

Permalink
fix a bug that data re-input when setAdapter.
Browse files Browse the repository at this point in the history
  • Loading branch information
w446108264 committed Jun 15, 2016
1 parent 6ae9186 commit 77e8ab4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ public void setAdapter(PageSetAdapter pageSetAdapter) {
ArrayList<PageSetEntity> pageSetEntities = pageSetAdapter.getPageSetEntityList();
if (pageSetEntities != null) {
for (PageSetEntity pageSetEntity : pageSetEntities) {
if(mEmoticonsToolBarView.containsKey(pageSetEntity)) {
continue;
}
mEmoticonsToolBarView.addToolItemView(pageSetEntity);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,23 @@ public View addToolItemView(int rec, final PageSetEntity pageSetEntity, OnClickL
return toolBtnView;
}

public boolean containsKey(PageSetEntity pageSetEntity) {
if(pageSetEntity == null) {
return false;
}
String uuid = pageSetEntity.getUuid();
if(TextUtils.isEmpty(uuid)) {
return false;
}

for(int i = 0 ; i < ly_tool.getChildCount(); i++) {
if(uuid.equals(ly_tool.getChildAt(i).getTag(R.id.id_toolbar_uuid))){
return true;
}
}
return false;
}

public void clear() {
mToolBtnList.clear();
hsv_toolbar.removeAllViews();
Expand Down

0 comments on commit 77e8ab4

Please sign in to comment.