本文整理汇总了Java中com.hyphenate.EMCallBack类的典型用法代码示例。如果您正苦于以下问题:Java EMCallBack类的具体用法?Java EMCallBack怎么用?Java EMCallBack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EMCallBack类属于com.hyphenate包,在下文中一共展示了EMCallBack类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: login
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* 登陆操作
*/
private void login() {
String str_user = etUser.getText().toString();
String str_pswd = etPswd.getText().toString();
EMClient.getInstance().login(str_user, str_pswd, new EMCallBack() {//回调
@Override
public void onSuccess() {
EMClient.getInstance().groupManager().loadAllGroups();
EMClient.getInstance().chatManager().loadAllConversations();
Log.d("main", "登录聊天服务器成功!");
handler.sendEmptyMessage(0);
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
handler.sendEmptyMessage(1);
Log.d("main", "登录聊天服务器失败!");
}
});
}
开发者ID:jiangzehui,项目名称:HX,代码行数:29,代码来源:LoginActivity.java
示例2: onActivityCreated
import com.hyphenate.EMCallBack; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Button logoutButton = (Button) getView().findViewById(R.id.btn_logout);
logoutButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
EMClient.getInstance().logout(false, new EMCallBack() {
@Override
public void onSuccess() {
getActivity().finish();
startActivity(new Intent(getActivity(), LoginActivity.class));
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String error) {
}
});
}
});
}
开发者ID:turoDog,项目名称:KTalk,代码行数:31,代码来源:SettingsFragment.java
示例3: downloadVideo
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* download video file
*/
private void downloadVideo(EMMessage message) {
message.setMessageStatusCallback(new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
@Override
public void run() {
loadingLayout.setVisibility(View.GONE);
progressBar.setProgress(0);
showLocalVideo(localFilePath);
}
});
}
@Override
public void onProgress(final int progress,String status) {
Log.d("ease", "video progress:" + progress);
runOnUiThread(new Runnable() {
@Override
public void run() {
progressBar.setProgress(progress);
}
});
}
@Override
public void onError(int error, String msg) {
Log.e("###", "offline file transfer error:" + msg);
File file = new File(localFilePath);
if (file.exists()) {
file.delete();
}
}
});
EMClient.getInstance().chatManager().downloadAttachment(message);
}
开发者ID:turoDog,项目名称:KTalk,代码行数:43,代码来源:EaseShowVideoActivity.java
示例4: loginEase
import com.hyphenate.EMCallBack; //导入依赖的package包/类
private void loginEase(String email) {
//参数二是密码,环信这边所有用户统一密码就好
EMClient.getInstance().login(email, "666666", new EMCallBack() {
@Override
public void onSuccess() {
//为了保证进入主页面后本地会话和群组都 load 完毕。
EMClient.getInstance().groupManager().loadAllGroups();
EMClient.getInstance().chatManager().loadAllConversations();
mPresemter.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("---","环信登录成功");
//通知p层
mPresemter.registerUserSuccess();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(final int code, final String error) {
mPresemter.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("---","环信登录失败"+error+" "+code);
mPresemter.registerUserFailue();
}
});
}
});
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:38,代码来源:CompleteModel.java
示例5: loginEase
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* 环信登录
*/
private void loginEase(String email) {
//参数二是密码,环信这边所有用户统一密码就好
EMClient.getInstance().login(email, "666666", new EMCallBack() {
@Override
public void onSuccess() {
//为了保证进入主页面后本地会话和群组都 load 完毕。
EMClient.getInstance().groupManager().loadAllGroups();
EMClient.getInstance().chatManager().loadAllConversations();
mPresenter.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("---","环信登录成功");
mPresenter.onLoginSuccess();
getCountryIsOpenData();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(final int code, final String error) {
mPresenter.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("---","环信登录失败"+error+" "+code);
mPresenter.onLoginFailue(error);
}
});
}
});
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:42,代码来源:LoginModel.java
示例6: loginEase
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* 环信登录
*/
private void loginEase(String email) {
//参数二是密码,环信这边所有用户统一密码就好
EMClient.getInstance().login(email, "666666", new EMCallBack() {
@Override
public void onSuccess() {
//为了保证进入主页面后本地会话和群组都 load 完毕。
EMClient.getInstance().groupManager().loadAllGroups();
EMClient.getInstance().chatManager().loadAllConversations();
mPresenter.getCurrentActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("---","环信登录成功");
mPresenter.onSilentLoginSuccess();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(final int code, final String error) {
mPresenter.getCurrentActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("---","环信登录失败"+error+" "+code);
mPresenter.onSlientLoginFailure();
}
});
}
});
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:41,代码来源:MineModel.java
示例7: updateAnnouncement
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* update with the passed announcement
*
* @param announcement
*/
private void updateAnnouncement(final String announcement) {
createProgressDialog();
progressDialog.setMessage("Updating ...");
progressDialog.show();
EMClient.getInstance().groupManager().asyncUpdateGroupAnnouncement(groupId, announcement,
new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.dismiss();
announcementText.setText(announcement);
}
});
}
@Override
public void onError(int code, final String error) {
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.dismiss();
Toast.makeText(GroupDetailsActivity.this, "update fail," + error, Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
});
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:41,代码来源:GroupDetailsActivity.java
示例8: updateAnnouncement
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* update with the passed announcement
* @param announcement
*/
private void updateAnnouncement(final String announcement) {
createProgressDialog();
progressDialog.setMessage("Updating ...");
progressDialog.show();
EMClient.getInstance().groupManager().asyncUpdateGroupAnnouncement(roomId, announcement,
new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.dismiss();
announcementText.setText(announcement);
}
});
}
@Override
public void onError(int code, final String error) {
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.dismiss();
Toast.makeText(ChatRoomDetailsActivity.this, "update fail," + error, Toast.LENGTH_LONG).show();
}
});
}
@Override
public void onProgress(int progress, String status) {
}
});
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:40,代码来源:ChatRoomDetailsActivity.java
示例9: logout
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* logout
*
* @param unbindDeviceToken whether you need unbind your device token
* @param callback callback
*/
public void logout(boolean unbindDeviceToken, final EMCallBack callback) {
endCall();
Log.d(TAG, "logout: " + unbindDeviceToken);
EMClient.getInstance().logout(unbindDeviceToken, new EMCallBack() {
@Override
public void onSuccess() {
Log.d(TAG, "logout: onSuccess");
reset();
if (callback != null) {
callback.onSuccess();
}
}
@Override
public void onProgress(int progress, String status) {
if (callback != null) {
callback.onProgress(progress, status);
}
}
@Override
public void onError(int code, String error) {
Log.d(TAG, "logout: onSuccess");
reset();
if (callback != null) {
callback.onError(code, error);
}
}
});
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:39,代码来源:DemoHelper.java
示例10: logOut
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* 环信登出
*/
public static void logOut(final IHuanxing huanxing){
SLog.d("<><><><><><>", "退出登录开始");
EMClient.getInstance().logout(true, new EMCallBack() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
SLog.d("<><><><><><>", "退出登录成功");
if(huanxing!=null){
huanxing.success();
}
}
@Override
public void onProgress(int progress, String status) {
// TODO Auto-generated method stub
}
@Override
public void onError(int code, String message) {
// TODO Auto-generated method stub
SLog.d("<><><><><><>", "退出登录失败");
if(huanxing!=null){
huanxing.falue();
}
}
});
}
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:34,代码来源:HuanXinUtil.java
示例11: logout
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* logout
*
* @param unbindDeviceToken
* whether you need unbind your device token
* @param callback
* callback
*/
public void logout(boolean unbindDeviceToken, final EMCallBack callback) {
endCall();
Log.d(TAG, "logout: " + unbindDeviceToken);
EMClient.getInstance().logout(unbindDeviceToken, new EMCallBack() {
@Override
public void onSuccess() {
Log.d(TAG, "logout: onSuccess");
reset();
if (callback != null) {
callback.onSuccess();
}
}
@Override
public void onProgress(int progress, String status) {
if (callback != null) {
callback.onProgress(progress, status);
}
}
@Override
public void onError(int code, String error) {
Log.d(TAG, "logout: onSuccess");
reset();
if (callback != null) {
callback.onError(code, error);
}
}
});
}
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:41,代码来源:DemoHelper.java
示例12: logout
import com.hyphenate.EMCallBack; //导入依赖的package包/类
void logout() {
final ProgressDialog pd = new ProgressDialog(getActivity());
String st = getResources().getString(R.string.Are_logged_out);
pd.setMessage(st);
pd.setCanceledOnTouchOutside(false);
pd.show();
DemoHelper.getInstance().logout(false,new EMCallBack() {
@Override
public void onSuccess() {
getActivity().runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
// show login screen
((MainActivity) getActivity()).finish();
startActivity(new Intent(getActivity(), LoginActivity.class));
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
pd.dismiss();
Toast.makeText(getActivity(), "unbind devicetokens failed", Toast.LENGTH_SHORT).show();
}
});
}
});
}
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:41,代码来源:SettingsFragment.java
示例13: registerInternalDebugReceiver
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* debug purpose only, you can ignore this
*/
private void registerInternalDebugReceiver() {
internalDebugReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
DemoHelper.getInstance().logout(false,new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
finish();
startActivity(new Intent(MainActivity.this, LoginActivity.class));
}
});
}
@Override
public void onProgress(int progress, String status) {}
@Override
public void onError(int code, String message) {}
});
}
};
IntentFilter filter = new IntentFilter(getPackageName() + ".em_internal_debug");
registerReceiver(internalDebugReceiver, filter);
}
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:33,代码来源:MainActivity.java
示例14: logout
import com.hyphenate.EMCallBack; //导入依赖的package包/类
/**
* 退出登录
*
* @param unbindDeviceToken
* 是否解绑设备token(使用GCM才有)
* @param callback
* callback
*/
public void logout(boolean unbindDeviceToken, final EMCallBack callback) {
Log.d(TAG, "logout: " + unbindDeviceToken);
EMClient.getInstance().logout(unbindDeviceToken, new EMCallBack() {
@Override
public void onSuccess() {
Log.d(TAG, "logout: onSuccess");
reset();
if (callback != null) {
callback.onSuccess();
}
}
@Override
public void onProgress(int progress, String status) {
if (callback != null) {
callback.onProgress(progress, status);
}
}
@Override
public void onError(int code, String error) {
Log.d(TAG, "logout: onSuccess");
reset();
if (callback != null) {
callback.onError(code, error);
}
}
});
}
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:40,代码来源:HuanXinHelper.java
示例15: rightAfterLogOn
import com.hyphenate.EMCallBack; //导入依赖的package包/类
private static void rightAfterLogOn(){
SeriesLogOnInfo.putInfo(MyApp.getInstance().getApplicationContext(), MyApp.userInfo.username, MyApp.userInfo.userpassword);
EMClient.getInstance().login(MyApp.userInfo.userId,SHA1(MyApp.userInfo.userpassword) ,new EMCallBack() {//回调
@Override
public void onSuccess() {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
EMClient.getInstance().groupManager().loadAllGroups();
EMClient.getInstance().chatManager().loadAllConversations();
Log.d("main", "登陆聊天服务器成功!");
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
Log.d("main", "登陆聊天服务器失败!");
}
});
MobclickAgent.onProfileSignIn(MyApp.userInfo.userId);
NoteController.iniCloudSyncTask();
ServiceFactory.getAccountService().getAllNote(AuthBody.getAuthBodyMap())
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<AuthorBean>() {
@Override
public void call(AuthorBean authorBean) {
MyApp.getInstance().authorBean.author = authorBean.author;
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
}
});
}
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:39,代码来源:AccountController.java
示例16: onCreate
import com.hyphenate.EMCallBack; //导入依赖的package包/类
@Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
if(EMClient.getInstance().isLoggedInBefore()){
//enter to main activity directly if you logged in before.
startActivity(new Intent(this, MainActivity.class));
finish();
}
setContentView(R.layout.activity_login);
usernameView = (EditText) findViewById(R.id.et_username);
pwdView = (EditText) findViewById(R.id.et_password);
Button loginBtn = (Button) findViewById(R.id.btn_login);
loginBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//login
EMClient.getInstance().login(usernameView.getText().toString(), pwdView.getText().toString(), new EMCallBack() {
@Override
public void onSuccess() {
startActivity(new Intent(LoginActivity.this, MainActivity.class));
finish();
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String error) {
runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(getApplicationContext(), "login failed", 0).show();
}
});
}
});
}
});
}
开发者ID:turoDog,项目名称:KTalk,代码行数:46,代码来源:LoginActivity.java
示例17: onCreate
import com.hyphenate.EMCallBack; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ease_activity_show_file);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
final EMMessage message = getIntent().getParcelableExtra("msg");
if (!(message.getBody() instanceof EMFileMessageBody)) {
Toast.makeText(EaseShowNormalFileActivity.this, "Unsupported message body", Toast.LENGTH_SHORT).show();
finish();
return;
}
final File file = new File(((EMFileMessageBody)message.getBody()).getLocalUrl());
message.setMessageStatusCallback(new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
FileUtils.openFile(file, EaseShowNormalFileActivity.this);
finish();
}
});
}
@Override
public void onError(int code, String error) {
runOnUiThread(new Runnable() {
public void run() {
if(file != null && file.exists()&&file.isFile())
file.delete();
String str4 = getResources().getString(R.string.Failed_to_download_file);
Toast.makeText(EaseShowNormalFileActivity.this, str4+message, Toast.LENGTH_SHORT).show();
finish();
}
});
}
@Override
public void onProgress(final int progress, String status) {
runOnUiThread(new Runnable() {
public void run() {
progressBar.setProgress(progress);
}
});
}
});
EMClient.getInstance().chatManager().downloadAttachment(message);
}
开发者ID:turoDog,项目名称:KTalk,代码行数:51,代码来源:EaseShowNormalFileActivity.java
示例18: onCreate
import com.hyphenate.EMCallBack; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ease_activity_show_file);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
final EMMessage message = getIntent().getParcelableExtra("msg");
if (!(message.getBody() instanceof EMFileMessageBody)) {
Toast.makeText(EaseShowNormalFileActivity.this, "Unsupported message body", Toast.LENGTH_SHORT).show();
finish();
return;
}
final File file = new File(((EMFileMessageBody)message.getBody()).getLocalUrl());
message.setMessageStatusCallback(new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
FileUtils.openFile(file,EaseShowNormalFileActivity.this);
finish();
}
});
}
@Override
public void onError(int code, String error) {
runOnUiThread(new Runnable() {
public void run() {
if(file != null && file.exists()&&file.isFile())
file.delete();
String str4 = getResources().getString(R.string.Failed_to_download_file);
Toast.makeText(EaseShowNormalFileActivity.this, str4+message, Toast.LENGTH_SHORT).show();
finish();
}
});
}
@Override
public void onProgress(final int progress, String status) {
runOnUiThread(new Runnable() {
public void run() {
progressBar.setProgress(progress);
}
});
}
});
EMClient.getInstance().chatManager().downloadAttachment(message);
}
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:51,代码来源:EaseShowNormalFileActivity.java
示例19: logout
import com.hyphenate.EMCallBack; //导入依赖的package包/类
public void logout() {
final ProgressDialog pd = new ProgressDialog(this);
String st = getResources().getString(R.string.Are_logged_out);
pd.setMessage(st);
pd.setCanceledOnTouchOutside(false);
pd.show();
DemoHelper.getInstance().logout(false, new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
String phone = ACache.get(SettingActivity.this).getAsString(ACacheKey.CURRENT_ACCOUNT_PHONE);
ACache.get(SettingActivity.this).clear();
ACache.get(SettingActivity.this).put(ACacheKey.CURRENT_ACCOUNT_PHONE,phone);
ACache.get(SettingActivity.this).put(ACacheKey.FIRST_USE, "111");
// show login screen
ActivityManagerUtil.getInstance().finishAllActivity();
startActivity(new Intent(SettingActivity.this, LoginActivity.class));
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
pd.dismiss();
Toast.makeText(SettingActivity.this, "unbind devicetokens failed", Toast.LENGTH_SHORT).show();
}
});
}
});
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:45,代码来源:SettingActivity.java
示例20: logout
import com.hyphenate.EMCallBack; //导入依赖的package包/类
public void logout() {
final ProgressDialog pd = new ProgressDialog(this);
String st = getResources().getString(R.string.Are_logged_out);
pd.setMessage(st);
pd.setCanceledOnTouchOutside(false);
pd.show();
DemoHelper.getInstance().logout(false, new EMCallBack() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
ACache.get(MainActivity.this).clear();
ACache.get(MainActivity.this).put(ACacheKey.FIRST_USE, "111");
// show login screen
ActivityManagerUtil.getInstance().finishAllActivity();
startActivity(new Intent(MainActivity.this, LoginActivity.class));
}
});
}
@Override
public void onProgress(int progress, String status) {
}
@Override
public void onError(int code, String message) {
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
pd.dismiss();
Toast.makeText(MainActivity.this, "unbind devicetokens failed", Toast.LENGTH_SHORT).show();
}
});
}
});
}
开发者ID:mangestudio,项目名称:GCSApp,代码行数:43,代码来源:MainActivity.java
注:本文中的com.hyphenate.EMCallBack类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论