use of com.juns.health.net.loopj.android.http.RequestParams in project wechat by motianhuo.
the class AddGroupChatActivity method addServieGroup.
private void addServieGroup(final String groupId, final String groupName, String manber, String owner_id) {
RequestParams params = new RequestParams();
params.put("group_id", groupId);
params.put("group_name", groupName);
params.put("owner_id", owner_id);
params.put("members", manber);
params.put("description", "");
params.put("image_path", "");
netClient.post(Constants.newGroupURL, params, new BaseJsonRes() {
@Override
public void onMySuccess(String data) {
Intent intent = new Intent(AddGroupChatActivity.this, ChatActivity.class);
intent.putExtra(Constants.NAME, groupName);
intent.putExtra(Constants.TYPE, ChatActivity.CHATTYPE_GROUP);
intent.putExtra(Constants.GROUP_ID, groupId);
startActivity(intent);
getLoadingDialog("正在创建群聊...").dismiss();
finish();
}
@Override
public void onMyFailure() {
}
});
}
use of com.juns.health.net.loopj.android.http.RequestParams in project wechat by motianhuo.
the class EditUserNameActivity method setUserMsg.
private void setUserMsg() {
String telphone = Utils.getValue(EditUserNameActivity.this, Constants.NAME);
String name = edit_name.getText().toString();
if (TextUtils.isEmpty(name)) {
Utils.showLongToast(EditUserNameActivity.this, "请填写您的昵称! ");
return;
}
RequestParams params = new RequestParams();
params.put("username", name);
params.put("telphone", telphone);
getLoadingDialog("正在加载... ").show();
netClient.post(Constants.UpdateInfoURL, params, new BaseJsonRes() {
@Override
public void onMySuccess(String data) {
Utils.putValue(EditUserNameActivity.this, Constants.UserInfo, data);
getLoadingDialog("正在加载").dismiss();
Intent intent = new Intent(EditUserNameActivity.this, MainActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.push_up_in, R.anim.push_up_out);
finish();
}
@Override
public void onMyFailure() {
getLoadingDialog("正在登录").dismiss();
}
});
}
use of com.juns.health.net.loopj.android.http.RequestParams in project wechat by motianhuo.
the class LoginActivity method getLogin.
private void getLogin(final String userName, final String password) {
if (!TextUtils.isEmpty(userName) && !TextUtils.isEmpty(password)) {
RequestParams params = new RequestParams();
params.put("username", userName);
params.put("password", DES.md5Pwd(password));
getLoadingDialog("正在登录... ").show();
netClient.post(Constants.Login_URL, params, new BaseJsonRes() {
@Override
public void onMySuccess(String data) {
Utils.putValue(LoginActivity.this, Constants.UserInfo, data);
Utils.putBooleanValue(LoginActivity.this, Constants.LoginState, true);
Utils.putValue(LoginActivity.this, Constants.NAME, userName);
Utils.putValue(LoginActivity.this, Constants.PWD, DES.md5Pwd(password));
getChatserive(userName, DES.md5Pwd(password));
}
@Override
public void onMyFailure() {
getLoadingDialog("正在登录").dismiss();
}
});
} else {
Utils.showLongToast(LoginActivity.this, "请填写账号或密码!");
}
}
use of com.juns.health.net.loopj.android.http.RequestParams in project wechat by motianhuo.
the class RegisterActivity method getRegister.
private void getRegister() {
final String name = et_usertel.getText().toString();
final String pwd = et_password.getText().toString();
String code = et_code.getText().toString();
if (!Utils.isMobileNO(name)) {
Utils.showLongToast(RegisterActivity.this, "请使用手机号码注册账户! ");
return;
}
if (TextUtils.isEmpty(code)) {
Utils.showLongToast(RegisterActivity.this, "请填写手机号码,并获取验证码!");
return;
}
if (TextUtils.isEmpty(name) || TextUtils.isEmpty(pwd) || TextUtils.isEmpty(code)) {
Utils.showLongToast(RegisterActivity.this, "请填写核心信息!");
return;
}
getLoadingDialog("正在注册... ").show();
btn_register.setEnabled(false);
btn_send.setEnabled(false);
RequestParams params = new RequestParams();
params.put("username", name);
params.put("password", DES.md5Pwd(pwd));
// params.put("checkCode", code);
netClient.post(Constants.RegistURL, params, new BaseJsonRes() {
@Override
public void onMySuccess(String data) {
Utils.putValue(RegisterActivity.this, Constants.UserInfo, data);
Utils.putValue(RegisterActivity.this, Constants.NAME, name);
Utils.putValue(RegisterActivity.this, Constants.PWD, DES.md5Pwd(pwd));
Utils.putBooleanValue(RegisterActivity.this, Constants.LoginState, true);
getChatserive(name, DES.md5Pwd(pwd));
}
@Override
public void onMyFailure() {
getLoadingDialog("").dismiss();
btn_register.setEnabled(true);
btn_send.setEnabled(true);
}
});
}
use of com.juns.health.net.loopj.android.http.RequestParams in project wechat by motianhuo.
the class RegisterActivity method getCode.
private void getCode() {
String phone = et_usertel.getText().toString();
RequestParams params = new RequestParams();
params.put("telephone", phone);
params.put("codeType", "1");
netClient.post(Constants.SendCodeURL, params, new JsonHttpResponseHandler() {
@Override
public void onSuccess(JSONObject response) {
super.onSuccess(response);
try {
String result = response.getString("result");
System.out.println("返回的值" + response);
if (result == null) {
Utils.showLongToast(App.getInstance(), Constants.NET_ERROR);
} else if (result.equals("Y")) {
String str = response.getString("value");
Utils.showLongToast(App.getInstance(), str);
} else {
String str = response.getString("value");
Utils.showLongToast(App.getInstance(), str);
mc.cancel();
btn_send.setEnabled(true);
btn_send.setText("发送验证码");
}
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
Aggregations