/** * 初始化pane容器的数据 * * @param item */ @SuppressWarnings("unchecked") private void initPaneData(ShowItem item) { tvName.setText(item.getItemName()); List<SenceItem> msencedata = item.getChildData(); mChildPaneData1.clear(); mChildPaneData2.clear(); mChildPaneData3.clear(); mChildPaneAdaper1.notifyDataSetChanged(); mChildPaneAdaper2.notifyDataSetChanged(); mChildPaneAdaper3.notifyDataSetChanged(); if (msencedata != null) { if (msencedata.size() > 0 && msencedata.get(0) != null) { mChildPaneData1.add(msencedata.get(0)); mChildPaneAdaper1.notifyDataSetChanged(); } if (msencedata.size() > 1 && msencedata.get(1) != null) { mChildPaneData2.add(msencedata.get(1)); mChildPaneAdaper2.notifyDataSetChanged(); } if (msencedata.size() > 2 && msencedata.get(2) != null) { mChildPaneData3.add(msencedata.get(2)); mChildPaneAdaper3.notifyDataSetChanged(); } } }
@SuppressWarnings("unchecked") private void deleteItem(int pannerPos, int itemPos) { switch (pannerPos) { case 0: mChildPaneData1.remove(itemPos); mChildPaneAdaper1.notifyDataSetChanged(); curShowItem.getItemChildData().set(0, null); break; case 1: mChildPaneData2.remove(itemPos); mChildPaneAdaper2.notifyDataSetChanged(); curShowItem.getItemChildData().set(1, null); break; case 2: mChildPaneData3.remove(itemPos); mChildPaneAdaper3.notifyDataSetChanged(); curShowItem.getItemChildData().set(2, null); break; default: break; } if (mSendDataListen != null) { if (mSendDataListen != null) { DataConbine mConbine = new DataConbine(DataConfig.SHOW_PANE_ADD_SENCE); mConbine.addByte(DataUtils.getByte(curShowItem.getItemId())); for (int i = 0; i < pannerPos; i++) { if (i < curShowItem.getChildData().size()) { mConbine.addByte( DataUtils.getByte(((SenceItem) curShowItem.getChildData().get(i)).getItemId())); } } mSendDataListen.sendData(mConbine.getTotalData(), curShowItem); } } }
/** * 添加场景的item进指定容器 * * @param item * @param adapter * @param pannerNum */ @SuppressWarnings("unchecked") private void addSenceItemToPanner( SenceItem item, List<SenceItem> data, ShowPannerAdapter adapter, int pannerNum) { if (data.size() > 0) { mSenceView.notifyItemToNoSelect(data.get(0)); data.clear(); } data.add(item); adapter.notifyDataSetChanged(); setPannerToFoces(pannerNum); mSenceView.showTargetToFocus(getPanAllSenceItem(), true); curShowItem.changeChildData(getPanAllSenceItem()); if (mSendDataListen != null) { if (mSendDataListen != null) { DataConbine mConbine = new DataConbine(DataConfig.SHOW_PANE_ADD_SENCE); mConbine.addByte(DataUtils.getByte(curShowItem.getItemId())); for (SenceItem mItem : (List<SenceItem>) curShowItem.getChildData()) { mConbine.addByte(DataUtils.getByte(mItem.getItemId())); } mSendDataListen.sendData(mConbine.getTotalData(), curShowItem); } } }