当前位置: 首页>>代码示例>>Java>>正文


Java EventHandler类代码示例

本文整理汇总了Java中cn.smssdk.EventHandler的典型用法代码示例。如果您正苦于以下问题:Java EventHandler类的具体用法?Java EventHandler怎么用?Java EventHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EventHandler类属于cn.smssdk包,在下文中一共展示了EventHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerSDK

import cn.smssdk.EventHandler; //导入依赖的package包/类
private void registerSDK() {
	// 在尝试读取通信录时以弹窗提示用户(可选功能)
	SMSSDK.setAskPermisionOnReadContact(true);
	if ("moba6b6c6d6".equalsIgnoreCase(MobSDK.getAppkey())) {
		Toast.makeText(this, R.string.smssdk_dont_use_demo_appkey, Toast.LENGTH_SHORT).show();
	}
	final Handler handler = new Handler(this);
	EventHandler eventHandler = new EventHandler() {
		public void afterEvent(int event, int result, Object data) {
			Message msg = new Message();
			msg.arg1 = event;
			msg.arg2 = result;
			msg.obj = data;
			handler.sendMessage(msg);
		}
	};
	// 注册回调监听接口
	SMSSDK.registerEventHandler(eventHandler);
	ready = true;

	// 获取新好友个数
	showDialog();
	SMSSDK.getNewFriendsCount();
	gettingFriends = true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:MainActivity.java

示例2: init

import cn.smssdk.EventHandler; //导入依赖的package包/类
private void init() {
    SMSSDK.initSDK(this, "1e82a8b66b9a6", "23a8ca89c645a13fdc7b27a37fcaafc5");
    EventHandler eventHandler = new EventHandler(){
        @Override
        public void afterEvent(int event, int result, Object data) {
            Message msg = new Message();
            msg.arg1 = event;
            msg.arg2 = result;
            msg.obj = data;
            handler.sendMessage(msg);
        }
    };
    //注册回调监听接口
    SMSSDK.registerEventHandler(eventHandler);



}
 
开发者ID:Shmilyz,项目名称:Swap,代码行数:19,代码来源:VerifyMobActivity.java

示例3: iniSMSSDK

import cn.smssdk.EventHandler; //导入依赖的package包/类
/**
 * 初始化短信sdk
 */
private void iniSMSSDK() {

    SMSSDK.initSDK(getActivity(), "add91b1ca379", "9c4250259e8bdabb1e52bf867ab17781", true);
    EventHandler eh = new EventHandler() {

        @Override
        public void afterEvent(int event, int result, Object data) {

            Message m = new Message();
            m.what = 2;
            m.arg1 = event;
            m.arg2 = result;
            m.obj = data;
            h.sendMessage(m);


        }
    };
    SMSSDK.registerEventHandler(eh); //注册短信回调
    SMSSDK.getSupportedCountries();
}
 
开发者ID:jiangzehui,项目名称:xmpp,代码行数:25,代码来源:PhoneRegsterFragment.java

示例4: sdkUI

import cn.smssdk.EventHandler; //导入依赖的package包/类
private void sdkUI() {
        //打开注册页面
        RegisterPage registerPage = new RegisterPage();
        registerPage.setRegisterCallback(new EventHandler() {
            public void afterEvent(int event, int result, Object data) {
// 解析注册结果
                if (result == SMSSDK.RESULT_COMPLETE) {
                    @SuppressWarnings("unchecked")
                    HashMap<String, Object> phoneMap = (HashMap<String, Object>) data;
                    String country = (String) phoneMap.get("country");
                    String phone = (String) phoneMap.get("phone");

// 提交用户信息(此方法可以不调用)
//                    registerUser(country, phone);
                }
            }
        });
//        registerPage.show(context);
        registerPage.show(this);
    }
 
开发者ID:CrazyDudo,项目名称:MobSMS,代码行数:21,代码来源:MainActivity.java

示例5: onCreate

import cn.smssdk.EventHandler; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.account_register);

    registerState();//判断是注册新账号或者修改密码

    EventHandler eh=new EventHandler(){

        @Override
        public void afterEvent(int event, int result, Object data) {
            Message msg = new Message();
            msg.arg1 = event;
            msg.arg2 = result;
            msg.obj = data;
            handler.sendMessage(msg);
            Log.v("SMSS", "注册回调函数");
        }
    };
    SMSSDK.registerEventHandler(eh); //注册短信回调

    intView();

}
 
开发者ID:linkezhi,项目名称:Android-nRF-Toolbox-master,代码行数:26,代码来源:RegisterActivity.java

示例6: initSDK

import cn.smssdk.EventHandler; //导入依赖的package包/类
private void initSDK(Context context) {
	//初始化sharesdk,具体集成步骤请看文档:
	//http://wiki.mob.com/Android_%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E6%8C%87%E5%8D%97
	ShareSDK.initSDK(context);
	
	//短信验证初始化,具体集成步骤看集成文档:
	//http://wiki.mob.com/Android_%E7%9F%AD%E4%BF%A1SDK%E9%9B%86%E6%88%90%E6%96%87%E6%A1%A3
	SMSSDK.initSDK(context, smssdkAppkey, smssdkAppSecret);
	EventHandler eh = new EventHandler(){
		public void afterEvent(int event, int result, Object data) {
			Message msg = new Message();
			msg.arg1 = event;
			msg.arg2 = result;
			msg.obj = data;
			handler.sendMessage(msg);
		}
	};
	//注册短信验证的监听
	SMSSDK.registerEventHandler(eh);
}
 
开发者ID:MobClub,项目名称:ThirdPartyLoginDemo,代码行数:21,代码来源:ThirdPartyLogin.java

示例7: onClick

import cn.smssdk.EventHandler; //导入依赖的package包/类
public void onClick(View v) {
	switch (v.getId()) {
		case R.id.btn_bind_phone: {
			// 打开注册页面
			RegisterPage registerPage = new RegisterPage();
			registerPage.setRegisterCallback(new EventHandler() {
			public void afterEvent(int event, int result, Object data) {
				// 解析注册结果
				if (result == SMSSDK.RESULT_COMPLETE) {
					@SuppressWarnings("unchecked")
					HashMap<String,Object> phoneMap = (HashMap<String, Object>) data;
					String country = (String) phoneMap.get("country");
					String phone = (String) phoneMap.get("phone");
					// 提交用户信息
					registerUser(country, phone);
				}
			}
			});
			registerPage.show(this);
		} break;
		case R.id.rl_contact: {
			tvNum.setVisibility(View.GONE);
			// 打开通信录好友列表页面
			ContactsPage contactsPage = new ContactsPage();
			contactsPage.show(this);
		} break;
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:MainActivity.java

示例8: getUiThreadEventHandler

import cn.smssdk.EventHandler; //导入依赖的package包/类
private static EventHandler getUiThreadEventHandler(final EventHandler eventHandler) {
	UiEventHandler result = sEventHandler.get(eventHandler);
	if (result == null) {
		result = new UiEventHandler(eventHandler);
		sEventHandler.put(eventHandler, result);
	}
	return result;
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:9,代码来源:ShareSdk.java

示例9: beforeEvent

import cn.smssdk.EventHandler; //导入依赖的package包/类
@Override
public void beforeEvent(final int event, final Object data) {
	//super.beforeEvent(event, data);
	final EventHandler eventHandler = mEventHandlerRef.get();
	if (eventHandler != null) {
		AbsApp.get().getMainHandler().post(new Runnable() {
			@Override
			public void run() {
				eventHandler.beforeEvent(event, data);
			}
		});
	}
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:14,代码来源:ShareSdk.java

示例10: afterEvent

import cn.smssdk.EventHandler; //导入依赖的package包/类
@Override
public void afterEvent(final int event, final int result, final Object data) {
	//super.afterEvent(event, result, data);
	if (result == SMSSDK.RESULT_ERROR) L.e(ShareSdk.class, "event:" + parseEvent(event) + ", result:RESULT_ERROR", (Throwable)data);
	final EventHandler eventHandler = mEventHandlerRef.get();
	if (eventHandler != null) {
		AbsApp.get().getMainHandler().post(new Runnable() {
			@Override
			public void run() {
				eventHandler.afterEvent(event, result, data);
			}
		});
	}
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:15,代码来源:ShareSdk.java

示例11: onRegister

import cn.smssdk.EventHandler; //导入依赖的package包/类
@Override
public void onRegister() {
	//super.onRegister();
	final EventHandler eventHandler = mEventHandlerRef.get();
	if (eventHandler != null) {
		AbsApp.get().getMainHandler().post(new Runnable() {
			@Override
			public void run() {
				eventHandler.onRegister();
			}
		});
	}
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:14,代码来源:ShareSdk.java

示例12: onUnregister

import cn.smssdk.EventHandler; //导入依赖的package包/类
@Override
public void onUnregister() {
	final EventHandler eventHandler = mEventHandlerRef.get();
	if (eventHandler != null) {
		AbsApp.get().getMainHandler().post(new Runnable() {
			@Override
			public void run() {
				eventHandler.onUnregister();
			}
		});
	}
	//super.onUnregister();
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:14,代码来源:ShareSdk.java

示例13: initSms

import cn.smssdk.EventHandler; //导入依赖的package包/类
private void initSms() {

        // 创建EventHandler对象
        eventHandler = new EventHandler() {
            public void afterEvent(int event, int result, Object data) {

                if (result == SMSSDK.RESULT_COMPLETE) {
                    //回调完成
                    if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
                        //提交验证码成功
                    } else if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
                        //获取验证码成功
                        afterVerificationCodeRequested((Boolean) data);
                    } else if (event == SMSSDK.EVENT_GET_SUPPORTED_COUNTRIES) {
                        //返回支持发送验证码的国家列表
                    }
                } else if (data instanceof Throwable) {
                    Throwable throwable = (Throwable) data;
                    String msg = throwable.getMessage();
                    ToastUtils.setGravity(Gravity.CENTER, 0, 0);
                    ToastUtils.showShortSafe(msg);
                } else {
                    ((Throwable) data).printStackTrace();
                }
            }
        };

        // 注册监听器
        SMSSDK.registerEventHandler(eventHandler);
    }
 
开发者ID:gaolhjy,项目名称:cniao5,代码行数:31,代码来源:RegActivity.java

示例14: initSms

import cn.smssdk.EventHandler; //导入依赖的package包/类
private void initSms() {

        // 创建EventHandler对象
        eventHandler = new EventHandler() {
            public void afterEvent(int event, int result, Object data) {

                if (result == SMSSDK.RESULT_COMPLETE) {
                    //回调完成
                    if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
                        //提交验证码成功
                        doReg();
                        //                        dialog.setMessage("正在提交注册信息");
                        //                        dialog.show();
                    }
                } else if (data instanceof Throwable) {
                    Throwable throwable = (Throwable) data;
                    String msg = throwable.getMessage();
                    ToastUtils.setGravity(Gravity.CENTER, 0, 0);
                    ToastUtils.showShortSafe(msg);
                } else {
                    ((Throwable) data).printStackTrace();
                }
            }
        };

        // 注册监听器
        SMSSDK.registerEventHandler(eventHandler);
    }
 
开发者ID:gaolhjy,项目名称:cniao5,代码行数:29,代码来源:RegSecondActivity.java

示例15: onCreateView

import cn.smssdk.EventHandler; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.fragment_verifyphone, container, false);
    editDisCode = view.findViewById(R.id.findpwd_discode);
    editPhone = view.findViewById(R.id.findpwd_phonenum);
    editVerCode = view.findViewById(R.id.findpwd_vercode);
    getVerCode = view.findViewById(R.id.findpwd_get_vercode);
    nextStep = view.findViewById(R.id.findpwd_next);

    getVerCode.setOnClickListener(this);
    nextStep.setOnClickListener(this);

    editDisCode.clearFocus();
    editPhone.requestFocus();

    //初始化短信SDK
    MobSDK.init(getContext(), "228198a34c17d", "73b44581dcf3914180feb22fcdf3dbb9");

    // 创建EventHandler对象
    eventHandler = new EventHandler() {
        public void afterEvent(int event, int result, Object data) {
            Message msg = new Message();
            msg.arg1 = event;
            msg.arg2 = result;
            msg.obj = data;
            mHandler.handleMessage(msg);
        }
    };

    // 注册短信监听器
    SMSSDK.registerEventHandler(eventHandler);

    fragmentResetPassword = new FragmentResetPassword();

    return view;
}
 
开发者ID:838030195,项目名称:DaiGo,代码行数:38,代码来源:FragmentVerifyPhone.java


注:本文中的cn.smssdk.EventHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。