Beispiel #1
0
  /**
   * 初始化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();
      }
    }
  }
Beispiel #2
0
 @Override
 protected void bindView(int position, ViewHolder viewholder) {
   // TODO Auto-generated method stub
   ShowItem item = (ShowItem) mList.get(position);
   viewholder.tvItemLeft.setBackgroundDrawable(item.getItemLeftDra());
   viewholder.tvItemRight.setVisibility(View.GONE);
   viewholder.tvItemMiddle.setText(item.getName());
   if (position == cur_position) {
     viewholder.rlLayout.setBackgroundResource(R.drawable.v1_base_item_btn_press);
   } else {
     viewholder.rlLayout.setBackgroundResource(R.drawable.v1_base_item_btn_unpress);
   }
 }
Beispiel #3
0
 /**
  * 发送时间设置命令
  *
  * @param time
  */
 private void sendShowTime(int time) {
   if (mSendDataListen != null) {
     DataConbine mConbine = new DataConbine(DataConfig.SHOW_TIME_SETTING);
     mConbine.addByte(DataUtils.getByte(curShowItem.getItemId()));
     mConbine.addByte(DataUtils.getByte(time));
     mSendDataListen.sendData(mConbine.getTotalData(), curShowItem);
   }
 }
Beispiel #4
0
 /**
  * 添加场景的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);
     }
   }
 }
Beispiel #5
0
  @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);
      }
    }
  }