use of com.hyphenate.exceptions.HyphenateException in project SmartCampus by Vegen.
the class EaseChatFilePresenter method onBubbleClick.
@Override
public void onBubbleClick(EMMessage message) {
EMNormalFileMessageBody fileMessageBody = (EMNormalFileMessageBody) message.getBody();
String filePath = fileMessageBody.getLocalUrl();
File file = new File(filePath);
if (file.exists()) {
// open files if it exist
FileUtils.openFile(file, (Activity) getContext());
} else {
// download the file
getContext().startActivity(new Intent(getContext(), EaseShowNormalFileActivity.class).putExtra("msg", message));
}
if (message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == EMMessage.ChatType.Chat) {
try {
EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
} catch (HyphenateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
use of com.hyphenate.exceptions.HyphenateException in project SmartCampus by Vegen.
the class EaseContactListFragment method moveToBlacklist.
/**
* move user to blacklist
*/
protected void moveToBlacklist(final String username) {
final ProgressDialog pd = new ProgressDialog(getActivity());
String st1 = getResources().getString(R.string.Is_moved_into_blacklist);
final String st2 = getResources().getString(R.string.Move_into_blacklist_success);
final String st3 = getResources().getString(R.string.Move_into_blacklist_failure);
pd.setMessage(st1);
pd.setCanceledOnTouchOutside(false);
pd.show();
new Thread(new Runnable() {
public void run() {
try {
// move to blacklist
EMClient.getInstance().contactManager().addUserToBlackList(username, false);
getActivity().runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
Toast.makeText(getActivity(), st2, Toast.LENGTH_SHORT).show();
refresh();
}
});
} catch (HyphenateException e) {
e.printStackTrace();
getActivity().runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
Toast.makeText(getActivity(), st3, Toast.LENGTH_SHORT).show();
}
});
}
}
}).start();
}
Aggregations