Skip to content

Instantly share code, notes, and snippets.

@cuber5566
Last active August 29, 2015 14:18
Show Gist options
  • Save cuber5566/dde493e084151e401747 to your computer and use it in GitHub Desktop.
Save cuber5566/dde493e084151e401747 to your computer and use it in GitHub Desktop.
public class LoginActivity extends BaseActivity{
...
// sign key error
else if (memberLoginResponse.getRc().equals(ResponseUtil.SIGN_KEY_ERROR)
||memberLoginResponse.getRc().equals(ResponseUtil.SIGN_KEY_ERROR_1) ){
Message msgObj = uiHandler.obtainMessage();
msgObj.what = MSG_SEND_MD5_HASH_KEY;
msgObj.arg1 = MSG_GET_MEMBER_LOGIN_RESPONSE;
uiHandler.sendMessage(msgObj);
}
public class BaseActivity extends ActionBarActivity implements Handler.Callback {
...
@Override
public boolean handleMessage(Message msg) {
switch (msg.what) {
case MSG_SEND_MD5_HASH_KEY:
msgWhat = msg.arg1;
NetWorkDataProvider.getInstance().getMD5HashKey(new Callback() {
@Override
public void onFailure(Request request, IOException e) {
hideProgressDialog();
uiHandler.sendEmptyMessage(MSG_ERROR);
}
@Override
public void onResponse(Response response) throws IOException {
hideProgressDialog();
String responseString = response.body().string();
Log.e("NETWORK-getMD5HashKey", responseString);
getMD5HashkeyResponse = new Gson().fromJson(responseString, GetMD5HashKeyResponse.class);
uiHandler.sendEmptyMessage(MSG_GET_MD5_HASH_KEY);
}
});
break;
case MSG_GET_MD5_HASH_KEY:
if (getMD5HashkeyResponse.getRc().equals(ResponseUtil.DONE)) {
NetWorkDataProvider.getInstance().sign_key = getMD5HashkeyResponse.getHashkey();
localDataProvider.setSign_key(getMD5HashkeyResponse.getHashkey());
localDataProvider.save(this);
uiHandler.sendEmptyMessage(msgWhat);
} else {
showHintDialog(getMD5HashkeyResponse.getRm());
}
break;
case MSG_ERROR:
showHintDialog(getString(R.string.connect_error));
}
return false;
}
@cuber5566
Copy link
Author

rename

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment