Пример #1
0
 @Override
 protected void onDestroy() {
   if (null != completeReceiver) {
     unregisterReceiver(completeReceiver);
     completeReceiver = null;
   }
   super.onDestroy();
 }
Пример #2
0
  @SuppressWarnings("unchecked")
  public void handleMsg(Message msg) {
    super.handleMsg(msg);
    listView.onRefreshComplete();
    listView.showLoadFinish();
    isLoadingMore = false;
    switch (msg.what) {
      case StoreConstant.NEAR_TYPE:
        if (mPopupWindow != null) {
          mPopupWindow.dismiss();
        }
        if (msg.obj != null) {
          distanceType = (Integer) msg.obj;
          //                    waresType = 0;
          nearTextView.setText(nearList.get(distanceType));
          findGoods();
        }
        break;
      case StoreConstant.ALL_TYPE:
        if (mPopupWindow != null) {
          mPopupWindow.dismiss();
        }
        if (msg.obj != null) {
          waresType = (Integer) msg.obj;
          //                    distanceType = 0;
          allTextView.setText(allList.get(waresType));
          findGoods();
        }
        break;
      case StoreConstant.GET_FINDGOODS_SUCCESS:
        if (msg.obj != null) {
          List<GoodsDetailInfo> temp = (List<GoodsDetailInfo>) msg.obj;
          goodsDetailInfos.clear();
          if (temp.size() > 0) {

            goodsDetailInfos.addAll(temp);
            adapter.notifyDataSetChanged();
          } else {
            hasMore = false;
          }
        }
        break;
      case StoreConstant.GET_FINDGOODS_FAILED:
        showToast(getResources().getString(R.string.error_1));
        break;
      case StoreConstant.GET_FINDGOODS_GET_MORE_SUCCESS:
        if (msg.obj != null) {
          List<GoodsDetailInfo> temp = (List<GoodsDetailInfo>) msg.obj;
          if (temp.size() > 0) {
            goodsDetailInfos.addAll(temp);
            adapter.notifyDataSetChanged();
          } else {
            hasMore = false;
          }
        }
        break;
      case StoreConstant.GET_FINDGOODS_GET_MORE_FAILED:
        showToast(getResources().getString(R.string.error_1));
        break;
        //            case StoreConstant.GET_FINDGOODSCOLUMN_SUCCESS:
        //                if (msg.obj != null)
        //                {
        ////                    List<GoodsColumnGroup> temp = (List<GoodsColumnGroup>) msg.obj;
        ////                    goodsColumnGroups.addAll(temp);
        ////                    expandadapter.notifyDataSetChanged();
        //                    List<String> temp = new ArrayList<String>();
        //                    goodsColumnGroups.add("离我最近");
        //                    goodsColumnGroups.add("1km以内");
        //                    goodsColumnGroups.add("3km以内");
        //                    goodsColumnGroups.add("更远");
        //                    goodsColumnGroups.addAll(temp);
        //                    expandadapter.notifyDataSetChanged();
        //                }
        //                break;
        //            case StoreConstant.GET_FINDGOODSCOLUMN_FAILED:
        //                showToast(getResources().getString(R.string.error_1));
        //                break;
        //            case StoreConstant.GET_FINDGOODSCOLUMN_NO_DATA:
        //                showToast(getResources().getString(R.string.store_error_1));
        //                break;
    }
  };