Ejemplo n.º 1
0
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case REFLASH_LISTVIEW:
              if (mixtureAdapter != null) mixtureAdapter.notifyDataSetChanged(); // 刷新UI
              break;

            case REFLASH_LISTVIEW_FAIL:
              Toast.makeText(
                      getApplication(),
                      MixGridActivity.this.getResources().getString(R.string.package_net_error),
                      Toast.LENGTH_SHORT)
                  .show();
              Log.e("合成列表", "合成道具图片下载失败,错误码为:" + msg.arg1);
              break;

            case CardZoneProtocolListener.HANDLER_PACK_QUERY_SUCCESS: // 获取背包列表数据成功
              flag = true;
              break;

            case CardZoneProtocolListener.HANDLER_PACK_QUERY_SUCCESS_NODATA:
              flag = true;
              break;
            case START_ANIM:
              if (btnFreeBean != null) {
                AnimationDrawable ad = (AnimationDrawable) btnFreeBean.getBackground();
                ad.stop();
                ad.start();
              }
              break;
            default:
              break;
          }
        }
Ejemplo n.º 2
0
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case HANDLER_MIX_SUCCESS:
              // 合成成功
              BackPackActivity.needRefreshBackpack = true;
              String successed = UtilHelper.parseStatusXml(msg.obj.toString(), "successed");
              CardZoneProtocolListener.getInstance(MixActivity.this)
                  .requestBackPackList(userID, mMixHandler);
              if (mContext != null) {
                SysPopDialog dialog =
                    new SysPopDialog(
                        MixActivity.this,
                        "",
                        mResource.getString(R.string.Ensure),
                        mResource.getString(R.string.package_synthetic_success)
                            + mixInfo.name
                            + successed
                            + mResource.getString(R.string.package_input_you_package),
                        null);

                dialog.show();
              }

              break;

            case HANDLER_MIX_RATE_FAIL:
              // 合成概率失败
              int num_ = msg.arg1;
              int bean_ = HallDataManager.getInstance().getUserMe().bean;
              bean_ = bean_ - mixInfo.beanCost * num_;
              HallDataManager.getInstance().getUserMe().setBean(bean_);
              // 合成失败 HANDLER_MIX_FAIL
              String _toolinfo = UtilHelper.parseStatusXml(msg.obj.toString(), "toolinfo");
              if (mContext != null) {
                SysPopDialog dialog =
                    new SysPopDialog(
                        MixActivity.this,
                        "",
                        mResource.getString(R.string.Ensure),
                        _toolinfo,
                        null);

                dialog.show();
              }
              break;

            case HANDLER_MIX_FAIL:
              // 合成失败 HANDLER_MIX_FAIL
              String toolinfo = UtilHelper.parseStatusXml(msg.obj.toString(), "toolinfo");
              if (mContext != null) {
                SysPopDialog dialog =
                    new SysPopDialog(
                        MixActivity.this, "", mResource.getString(R.string.Ensure), toolinfo, null);

                dialog.show();
              }
              break;

            case CardZoneProtocolListener.HANDLER_PACK_QUERY_SUCCESS: // 获取背包列表数据成功
              for (int i = 0; i < consumeList.size(); i++) {
                String handCount = "";
                Consume mConsume = consumeList.get(i);
                mItemNum = (TextView) cousumeItems.getChildAt(i).findViewById(R.id.mix_list_num);
                int count = BackPackItemProvider.getInstance().getPorpCount(mConsume.id);
                if (count != 0) {
                  handCount = String.valueOf(count);
                  mItemNum.setText(handCount + "/" + String.valueOf(mConsume.num));
                } else if (mConsume.t == 0) {
                  mItemNum.setText(String.valueOf(mConsume.num));
                } else {
                  handCount = "0";
                  mItemNum.setText(handCount + "/" + String.valueOf(mConsume.num));
                }
              }
              mMixNum.setText("1");
              mMixCost.setText(String.valueOf(mixInfo.beanCost));

              break;

            case CardZoneProtocolListener.HANDLER_PACK_QUERY_SUCCESS_NODATA:
              Log.e("mix", "我的物品没有数据!");
              break;

            default:
              break;
          }
        }