本文整理汇总了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;
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}
示例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);
}
示例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;
}
}
示例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;
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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();
}
});
}
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}