@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mix_operate_activity); instance = this; Bundle bundle = getIntent().getExtras(); if (bundle != null && "menu".equals(bundle.getString("entry"))) { flag = false; int userID = HallDataManager.getInstance().getUserMe().userID; CardZoneProtocolListener.getInstance(instance).requestBackPackList(userID, handler); } init(); }
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; } }