use of com.eros.framework.manager.impl.dispatcher.DispatchEventManager in project WeexErosFramework by bmfe.
the class AbstractWeexActivity method readContractResult.
private void readContractResult(Intent data) {
String username, usernumber = "";
ContentResolver reContentResolverol = getContentResolver();
// URI,每个ContentProvider定义一个唯一的公开的URI,用于指定到它的数据集
Uri contactData = data.getData();
// 查询就是输入URI等参数,其中URI是必须的,其他是可选的,如果系统能找到URI对应的ContentProvider将返回一个Cursor对象.
Cursor cursor = managedQuery(contactData, null, null, null, null);
cursor.moveToFirst();
// 获得DATA表中的名字
username = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
// 条件为联系人ID
String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
// 获得DATA表中的电话号码,条件为联系人ID,因为手机号码可能会有多个
Cursor phone = reContentResolverol.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId, null, null);
while (phone.moveToNext()) {
usernumber = phone.getString(phone.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
}
String json = joinContractJson(username, usernumber);
AxiosResultBean resultBean = new AxiosResultBean();
resultBean.status = 0;
resultBean.data = json;
DispatchEventManager dispatchEventManager = ManagerFactory.getManagerService(DispatchEventManager.class);
dispatchEventManager.getBus().post(resultBean);
}
use of com.eros.framework.manager.impl.dispatcher.DispatchEventManager in project WeexErosFramework by bmfe.
the class AbstractWeexActivity method debugLayerClick.
private void debugLayerClick() {
android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(mAct);
builder.setItems(mDebugOptions, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == 0) {
Intent intent = new Intent(mAct, DebugActivity.class);
startActivity(intent);
} else if (which == 1) {
refresh();
} else if (which == 2) {
DispatchEventManager dispatchEventManager = ManagerFactory.getManagerService(DispatchEventManager.class);
WeexEventBean eventBean = new WeexEventBean();
eventBean.setContext(mAct);
eventBean.setKey(WXEventCenter.EVENT_CAMERA);
dispatchEventManager.getBus().post(eventBean);
// connectionDebugService(BMWXEnvironment.mPlatformConfig.getUrl()
// .getDebugServer());
}
}
});
builder.create().show();
}
use of com.eros.framework.manager.impl.dispatcher.DispatchEventManager in project WeexErosFramework by bmfe.
the class ConnectivityManager method unregisterNetworkListener.
public void unregisterNetworkListener(Context context) {
if (mNetworkReceiver != null) {
context.unregisterReceiver(mNetworkReceiver);
mNetworkReceiver = null;
}
if (mCallbacks != null) {
mCallbacks.clear();
mCallbacks = null;
}
DispatchEventManager dispatchEventManager = ManagerFactory.getManagerService(DispatchEventManager.class);
dispatchEventManager.getBus().unregister(this);
}
use of com.eros.framework.manager.impl.dispatcher.DispatchEventManager in project WeexErosFramework by bmfe.
the class ConnectivityManager method registerNetworkListener.
public void registerNetworkListener(Context context, JSCallback callback) {
if (mCallbacks == null) {
mCallbacks = new ArrayList<>();
}
mCallbacks.add(callback);
if (mNetworkReceiver == null) {
mNetworkReceiver = new NetworkReceiver();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(android.net.ConnectivityManager.CONNECTIVITY_ACTION);
intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
context.registerReceiver(mNetworkReceiver, intentFilter);
}
DispatchEventManager dispatchEventManager = ManagerFactory.getManagerService(DispatchEventManager.class);
dispatchEventManager.getBus().register(this);
}
use of com.eros.framework.manager.impl.dispatcher.DispatchEventManager in project WeexErosFramework by bmfe.
the class SplashActivityProxy method toHome.
private void toHome(Activity activity) {
String homePage = BMWXEnvironment.mPlatformConfig.getPage().getHomePage(activity);
String NavigationColor = BMWXEnvironment.mPlatformConfig.getPage().getNavBarColor();
RouterModel router = new RouterModel(homePage, Constant.ACTIVITIES_ANIMATION.ANIMATION_PUSH, null, null, false, null);
DispatchEventManager dispatchEventManager = ManagerFactory.getManagerService(DispatchEventManager.class);
WeexEventBean eventBean = new WeexEventBean();
eventBean.setKey(WXEventCenter.EVENT_OPEN);
eventBean.setJsParams(ManagerFactory.getManagerService(ParseManager.class).toJsonString(router));
eventBean.setContext(activity);
dispatchEventManager.getBus().post(eventBean);
activity.finish();
}
Aggregations