Search in sources :

Example 11 with RequestListener

use of com.lingtuan.firefly.listener.RequestListener in project SmartMesh_Android by SmartMeshFoundation.

the class DiscussGroupSettingUI method removeMember.

public void removeMember(final int arg2) {
    if (mProgressDialog != null) {
        mProgressDialog.dismiss();
        mProgressDialog = null;
    }
    mProgressDialog = LoadingDialog.showDialog(this, null, null);
    mProgressDialog.setCancelable(false);
    NetRequestImpl.getInstance().removeDiscussMember(showdata.get(arg2).getLocalId(), cid, new RequestListener() {

        @Override
        public void start() {
        }

        @Override
        public void success(JSONObject response) {
            if (mProgressDialog != null) {
                mProgressDialog.dismiss();
                mProgressDialog = null;
            }
            showToast(response.optString("msg"));
            UserBaseVo user = showdata.get(arg2);
            data.remove(user);
            showdata.remove(user);
            removeMemberChatMsg(user.getShowName());
            resetlist();
        }

        @Override
        public void error(int errorCode, String errorMsg) {
            if (mProgressDialog != null) {
                mProgressDialog.dismiss();
                mProgressDialog = null;
            }
            showToast(errorMsg);
        }
    });
}
Also used : RequestListener(com.lingtuan.firefly.listener.RequestListener) JSONObject(org.json.JSONObject) UserBaseVo(com.lingtuan.firefly.vo.UserBaseVo)

Example 12 with RequestListener

use of com.lingtuan.firefly.listener.RequestListener in project SmartMesh_Android by SmartMeshFoundation.

the class DiscussGroupSettingUI method dissmissDicusss.

private void dissmissDicusss() {
    if (mProgressDialog != null) {
        mProgressDialog.dismiss();
        mProgressDialog = null;
    }
    mProgressDialog = LoadingDialog.showDialog(this, null, null);
    mProgressDialog.setCancelable(false);
    NetRequestImpl.getInstance().removeDiscussMember(NextApplication.myInfo.getLocalId(), cid, new RequestListener() {

        @Override
        public void start() {
        }

        @Override
        public void success(JSONObject response) {
            if (mProgressDialog != null) {
                mProgressDialog.dismiss();
                mProgressDialog = null;
            }
            showToast(response.optString("msg"));
            ChattingManager.getInstance(DiscussGroupSettingUI.this).setFinish(true);
            Utils.exitActivityAndBackAnim(DiscussGroupSettingUI.this, true);
            FinalUserDataBase.getInstance().deleteChatMsgByChatId("group-" + cid);
        }

        @Override
        public void error(int errorCode, String errorMsg) {
            if (mProgressDialog != null) {
                mProgressDialog.dismiss();
                mProgressDialog = null;
            }
            showToast(errorMsg);
        }
    });
}
Also used : RequestListener(com.lingtuan.firefly.listener.RequestListener) JSONObject(org.json.JSONObject)

Example 13 with RequestListener

use of com.lingtuan.firefly.listener.RequestListener in project SmartMesh_Android by SmartMeshFoundation.

the class SelectGroupMemberListUI method loadData.

private void loadData() {
    int cid = getIntent().getIntExtra("cid", 0);
    NetRequestImpl.getInstance().getDiscussMumbers(cid + "", new RequestListener() {

        @Override
        public void start() {
        }

        @Override
        public void success(JSONObject response) {
            Utils.writeToFile(response, "conversation-get_conversation" + NextApplication.myInfo.getLocalId() + ".json");
            parserJson(response);
        }

        @Override
        public void error(int errorCode, String errorMsg) {
        }
    });
}
Also used : RequestListener(com.lingtuan.firefly.listener.RequestListener) JSONObject(org.json.JSONObject)

Example 14 with RequestListener

use of com.lingtuan.firefly.listener.RequestListener in project SmartMesh_Android by SmartMeshFoundation.

the class BindMobileCodeUI method verifySmsc.

/**
 * Verify the message
 */
private void verifySmsc() {
    String code = codeEt.getText().toString().trim();
    if (TextUtils.isEmpty(code)) {
        showToast(getString(R.string.code_number_not_empty));
        return;
    }
    NetRequestImpl.getInstance().verifySmsc(code, phoneNumber, new RequestListener() {

        @Override
        public void start() {
            LoadingDialog.show(BindMobileCodeUI.this, "");
        }

        @Override
        public void success(JSONObject response) {
            if (type == 0) {
                // Binding mobile phone number
                bindMobileMethod();
            } else {
                // Mobile phone number to retrieve password
                Intent intent = new Intent(BindMobileCodeUI.this, RegistUI.class);
                intent.putExtra("number", phoneNumber);
                intent.putExtra("type", type);
                startActivity(intent);
                Utils.openNewActivityAnim(BindMobileCodeUI.this, false);
            }
        }

        @Override
        public void error(int errorCode, String errorMsg) {
            LoadingDialog.close();
            showToast(errorMsg);
        }
    });
}
Also used : RequestListener(com.lingtuan.firefly.listener.RequestListener) JSONObject(org.json.JSONObject) Intent(android.content.Intent) RegistUI(com.lingtuan.firefly.login.RegistUI)

Example 15 with RequestListener

use of com.lingtuan.firefly.listener.RequestListener in project SmartMesh_Android by SmartMeshFoundation.

the class BindEmailUI method sendSmsc.

/**
 * Verify the signature for text messages
 */
private void sendSmsc() {
    this.aeskey = Utils.makeRandomKey(16);
    final String emailNumber = emailEt.getText().toString().trim();
    NetRequestImpl.getInstance().sendMail(aeskey, type == 1 ? 0 : 1, emailNumber, new RequestListener() {

        @Override
        public void start() {
            LoadingDialog.show(BindEmailUI.this, "");
        }

        @Override
        public void success(JSONObject response) {
            LoadingDialog.close();
            showToast(response.optString("msg"));
            Intent intent = new Intent(BindEmailUI.this, BindMobileCodeUI.class);
            intent.putExtra("email", emailNumber);
            intent.putExtra("type", type);
            startActivity(intent);
            Utils.openNewActivityAnim(BindEmailUI.this, false);
        }

        @Override
        public void error(int errorCode, String errorMsg) {
            LoadingDialog.close();
            showToast(errorMsg);
        }
    });
}
Also used : RequestListener(com.lingtuan.firefly.listener.RequestListener) JSONObject(org.json.JSONObject) Intent(android.content.Intent)

Aggregations

RequestListener (com.lingtuan.firefly.listener.RequestListener)32 JSONObject (org.json.JSONObject)32 SuppressLint (android.annotation.SuppressLint)7 Intent (android.content.Intent)6 JSONArray (org.json.JSONArray)5 UserBaseVo (com.lingtuan.firefly.vo.UserBaseVo)4 UserInfoVo (com.lingtuan.firefly.vo.UserInfoVo)4 JSONException (org.json.JSONException)4 TokenVo (com.lingtuan.firefly.wallet.vo.TokenVo)3 Handler (android.os.Handler)2 RegistUI (com.lingtuan.firefly.login.RegistUI)2 ActivityNotFoundException (android.content.ActivityNotFoundException)1 Bundle (android.os.Bundle)1 NewContactVO (com.lingtuan.firefly.contact.vo.NewContactVO)1 ContactItemComparator (com.lingtuan.firefly.custom.contact.ContactItemComparator)1 ChatMsg (com.lingtuan.firefly.vo.ChatMsg)1