use of com.lingtuan.firefly.listener.RequestListener in project SmartMesh_Android by SmartMeshFoundation.
the class ChatReportReasonUI method sendReportChatMsg.
private void sendReportChatMsg() {
if (TextUtils.isEmpty(buid)) {
return;
}
if (TextUtils.equals("-1", seven) && TextUtils.equals("-1", eight) && TextUtils.equals("-1", nine) && TextUtils.equals("-1", ten) && TextUtils.equals("-1", eleven)) {
showToast(getResources().getString(R.string.report_reason_choice));
return;
}
StringBuilder sb = new StringBuilder();
sb.append(seven);
sb.append(",");
sb.append(eight);
sb.append(",");
sb.append(nine);
sb.append(",");
sb.append(ten);
sb.append(",");
sb.append(eleven);
sb.append(",");
String replace0String = sb.toString().replace("-1,", "");
type = replace0String.substring(0, replace0String.length() - 1);
if (msgList == null) {
showToast(getResources().getString(R.string.chat_please_choice_msg));
return;
}
/**
* Chat logs together
*/
ChatMsg cmBuild = new ChatMsg();
String contentString = cmBuild.parseChatMsgListToJsonString(msgList);
if (TextUtils.isEmpty(contentString)) {
showToast(getResources().getString(R.string.chat_please_choice_msg));
return;
}
NetRequestImpl.getInstance().sendReportChatMsg(type, buid, contentString, new RequestListener() {
@Override
public void start() {
if (mProgressDialog == null) {
mProgressDialog = LoadingDialog.showDialog(ChatReportReasonUI.this, null, getString(R.string.chatting_sending_two));
}
}
@Override
public void success(JSONObject response) {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
}
showToast(response.optString("msg"));
setResult(RESULT_OK);
Utils.exitActivityAndBackAnim(ChatReportReasonUI.this, true);
}
@Override
public void error(int errorCode, String errorMsg) {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
}
showToast(errorMsg);
}
});
}
use of com.lingtuan.firefly.listener.RequestListener in project SmartMesh_Android by SmartMeshFoundation.
the class ChatAdapter method requestFavFile.
/**
* Collect cancel collect file interface
*/
private void requestFavFile(final ChatMsg msg) {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
mProgressDialog = LoadingDialog.showDialog(mContext, null, null);
mProgressDialog.setCancelable(false);
NetRequestImpl.getInstance().fileCollect(msg.getThirdId(), msg.getCreateTime(), msg.getContent(), msg.getDatingSOSId(), new RequestListener() {
@Override
public void start() {
}
@Override
public void success(JSONObject response) {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
if (msg.getDatingSOSId() == 1) {
MyToast.showToast(mContext, mContext.getString(R.string.chat_cancel_collection_failed));
msg.setDatingSOSId(0);
FinalUserDataBase.getInstance().updateChatMsgCollectState(msg.getMessageId(), 0);
} else {
MyToast.showToast(mContext, mContext.getString(R.string.chat_collection_failed));
msg.setDatingSOSId(1);
FinalUserDataBase.getInstance().updateChatMsgCollectState(msg.getMessageId(), 1);
}
if (// collection
msg.getDatingSOSId() == 1) {
if (// Upload successfully, or download successful collection, keep the path, so as to collect the list into the don't have to download
msg.getInviteType() == 2 || msg.getInviteType() == 7) {
JSONObject json = new JSONObject();
try {
json.put("state", msg.getInviteType());
json.put("localurl", msg.getLocalUrl());
} catch (JSONException e) {
e.printStackTrace();
}
MySharedPrefs.write(mContext, MySharedPrefs.KEY_FIREFLY_FILEPATH, msg.getThirdId(), json.toString());
}
}
}
@Override
public void error(int errorCode, String errorMsg) {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
MyToast.showToast(mContext, errorMsg);
}
});
}
use of com.lingtuan.firefly.listener.RequestListener in project SmartMesh_Android by SmartMeshFoundation.
the class DiscussGroupJoinUI method joinDiscussGroup.
private void joinDiscussGroup() {
if (TextUtils.isEmpty(cid)) {
return;
}
if (data.size() <= 0) {
return;
}
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
mProgressDialog = LoadingDialog.showDialog(this, null, null);
mProgressDialog.setCancelable(false);
NetRequestImpl.getInstance().joinDiscussGroup(cid, new RequestListener() {
@Override
public void start() {
}
@Override
public void success(JSONObject response) {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
Utils.gotoGroupChat(DiscussGroupJoinUI.this, false, groupName, cid, data);
}
}
@Override
public void error(int errorCode, String errorMsg) {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
showToast(errorMsg);
if (errorCode == 1240922) {
Utils.gotoGroupChat(DiscussGroupJoinUI.this, true, groupName, cid, data);
}
}
});
}
use of com.lingtuan.firefly.listener.RequestListener in project SmartMesh_Android by SmartMeshFoundation.
the class DiscussGroupSettingUI method addMembersRequest.
private void addMembersRequest(final ArrayList<UserBaseVo> continueList) {
if (continueList.size() <= 0) {
return;
}
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
mProgressDialog = LoadingDialog.showDialog(this, null, null);
mProgressDialog.setCancelable(false);
StringBuffer touids = new StringBuffer();
final StringBuffer tonames = new StringBuffer();
for (int i = 0; i < continueList.size(); i++) {
if (i == continueList.size() - 1) {
touids.append(continueList.get(i).getLocalId());
tonames.append(continueList.get(i).getShowName());
} else {
touids.append(continueList.get(i).getLocalId() + ",");
tonames.append(continueList.get(i).getShowName() + ",");
}
}
NetRequestImpl.getInstance().addDiscussMembers(touids.toString(), cid, new RequestListener() {
@Override
public void start() {
}
@Override
public void success(JSONObject response) {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
showToast(response.optString("msg"));
for (int m = 0; m < continueList.size(); m++) {
if (isAdmin) {
data.add(continueList.get(m));
showdata.add(showdata.size() - 2, continueList.get(m));
} else {
data.add(continueList.get(m));
showdata.add(showdata.size() - 1, continueList.get(m));
}
}
inviteOthersChatMsg(tonames.toString());
resetlist();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
adapter.notifyDataSetChanged();
}
}, 100);
}
@Override
public void error(int errorCode, String errorMsg) {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
showToast(errorMsg);
}
});
}
use of com.lingtuan.firefly.listener.RequestListener in project SmartMesh_Android by SmartMeshFoundation.
the class DiscussGroupSettingUI method renameDicsuss.
private void renameDicsuss(final String name) {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
mProgressDialog = LoadingDialog.showDialog(this, null, null);
mProgressDialog.setCancelable(false);
NetRequestImpl.getInstance().renameDicsuss(name, cid, new RequestListener() {
@Override
public void start() {
}
@Override
public void success(JSONObject response) {
nameEdit.setText(name);
showToast(response.optString("msg"));
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
reNameChatMsg(name);
}
@Override
public void error(int errorCode, String errorMsg) {
if (mProgressDialog != null) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
showToast(errorMsg);
}
});
}
Aggregations