コード例 #1
0
 /** 将item从底部bar中删除 */
 protected void removeItemFromBottomPopWindow(int groupId, int itemId) {
   if (bottomItems.containsKey(groupId)) {
     ArrayList<ItemHolder> temp = bottomItems.get(groupId);
     for (ItemHolder holder : temp) {
       if (holder.itemId == itemId) {
         temp.remove(holder);
         buildBottomPopWindow();
         return;
       }
     }
     throw new IllegalArgumentException("can't find this itemId in this groupId");
   } else {
     throw new IllegalArgumentException("can't find this groupId");
   }
 }
コード例 #2
0
 /**
  * 通过添加item到底部bar来创建一系列的选项
  *
  * @param groupId 该item的组id,不同的组id在不同的区域内,请使用大于0的数字来表示
  * @param itemId 该item的item id,用来标示该item,组内的两个item不能有相同的item id,要不然回调无法识别
  * @param name 用来显示该item的名字
  */
 protected void addItemToBottomPopWindow(int groupId, int itemId, String name) {
   ArrayList<ItemHolder> temp;
   if (bottomItems.containsKey(groupId)) {
     if (itemId < 0) {
       throw new IllegalArgumentException(
           "groupId can be found,so itemId must bigger than 0 or equal 0");
     }
     temp = bottomItems.get(groupId);
     ItemHolder holder = new ItemHolder();
     holder.itemId = itemId;
     holder.name = name;
     temp.add(holder);
   } else {
     temp = new ArrayList<>();
     if (itemId >= 0) {
       ItemHolder holder = new ItemHolder();
       holder.itemId = itemId;
       holder.name = name;
       temp.add(holder);
     }
     bottomItems.put(groupId, temp);
   }
   buildBottomPopWindow();
 }