@Override public void onClick(View v) { switch (v.getId()) { case R.id.login_btn: RequestEngine.getInstance(this).requestToken(this); break; case R.id.create_folder_btn: RequestEngine.getInstance(this).createFolder("/ccst", this); break; default: break; } }
@Override public void onHttpResult(BaseProtocolData data) { mProgressDialog.dismiss(); if (data.isSuccess) { if (data.getType() == ProtocolType.REQUEST_TOKEN_PROTOCOL) { OauthActivity.show( KuaipanActivity.this, LoginProtocol.AUTH_URL + RequestEngine.getInstance(KuaipanActivity.this).getSession().token.key); } else if (data.getType() == ProtocolType.CREATE_FOLDER_PROTOCOL) { CreateFolderProtocol p = (CreateFolderProtocol) data; if (p.isSuccess) { Toast.makeText(KuaipanActivity.this, "Create Folder Success!", Toast.LENGTH_LONG).show(); } } } else { Toast.makeText( this, KuaipanHTTPResponse.getHttpErrorCodeDescribtion( data.getHttpRequestInfo().getResultCode()), Toast.LENGTH_SHORT) .show(); } }