Search in sources :

Example 1 with BaseJsonRes

use of com.juns.wechat.net.BaseJsonRes 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() {
        }
    });
}
Also used : ChatActivity(com.juns.wechat.chat.ChatActivity) Intent(android.content.Intent) RequestParams(com.juns.health.net.loopj.android.http.RequestParams) BaseJsonRes(com.juns.wechat.net.BaseJsonRes)

Example 2 with BaseJsonRes

use of com.juns.wechat.net.BaseJsonRes 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();
        }
    });
}
Also used : Intent(android.content.Intent) MainActivity(com.juns.wechat.MainActivity) RequestParams(com.juns.health.net.loopj.android.http.RequestParams) BaseJsonRes(com.juns.wechat.net.BaseJsonRes)

Example 3 with BaseJsonRes

use of com.juns.wechat.net.BaseJsonRes in project wechat by motianhuo.

the class UpdateService method initGroupList.

// 获取群组列表
private void initGroupList() {
    GloableParams.ListGroupInfos = db.findAll(GroupInfo.class);
    netClient.post(Constants.getGroupListURL, null, new BaseJsonRes() {

        @Override
        public void onMySuccess(String data) {
            GloableParams.ListGroupInfos = JSON.parseArray(data, GroupInfo.class);
            for (GroupInfo group : GloableParams.ListGroupInfos) {
                if (db.findById(group.getId(), GroupInfo.class) != null)
                    db.deleteById(GroupInfo.class, group.getId());
                db.save(group);
                GloableParams.GroupInfos.put(group.getGroup_id(), group);
            }
            sendBrodcast("GroupList");
        }

        @Override
        public void onMyFailure() {
        // initGroupList();
        }
    });
}
Also used : GroupInfo(com.juns.wechat.bean.GroupInfo) BaseJsonRes(com.juns.wechat.net.BaseJsonRes)

Example 4 with BaseJsonRes

use of com.juns.wechat.net.BaseJsonRes 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, "请填写账号或密码!");
    }
}
Also used : RequestParams(com.juns.health.net.loopj.android.http.RequestParams) BaseJsonRes(com.juns.wechat.net.BaseJsonRes)

Example 5 with BaseJsonRes

use of com.juns.wechat.net.BaseJsonRes in project wechat by motianhuo.

the class ChatActivity method initGroupInfo.

private void initGroupInfo() {
    RequestParams params = new RequestParams();
    String userid = UserUtils.getUserID(this);
    params.put("user_id", userid);
    params.put("group_id", toChatUsername);
    netClient.post(Constants.getUserInfoURL, params, new BaseJsonRes() {

        @Override
        public void onMySuccess(String data) {
            GroupInfo group = JSON.parseObject(data, GroupInfo.class);
            // NetClient.getIconBitmap(img_avar, group.getGroup_name());
            if (group != null && group.getGroup_name() != null)
                txt_title.setText(group.getGroup_name());
        }

        @Override
        public void onMyFailure() {
        }
    });
}
Also used : GroupInfo(com.juns.wechat.bean.GroupInfo) RequestParams(com.juns.health.net.loopj.android.http.RequestParams) BaseJsonRes(com.juns.wechat.net.BaseJsonRes)

Aggregations

BaseJsonRes (com.juns.wechat.net.BaseJsonRes)9 RequestParams (com.juns.health.net.loopj.android.http.RequestParams)7 User (com.juns.wechat.bean.User)3 Intent (android.content.Intent)2 GroupInfo (com.juns.wechat.bean.GroupInfo)2 List (java.util.List)2 MainActivity (com.juns.wechat.MainActivity)1 FromContactAdapter (com.juns.wechat.adpter.FromContactAdapter)1 ChatActivity (com.juns.wechat.chat.ChatActivity)1 NetClient (com.juns.wechat.net.NetClient)1 FinalDb (net.tsz.afinal.FinalDb)1