Search in sources :

Example 1 with DispatchEventManager

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);
}
Also used : AxiosResultBean(com.eros.framework.model.AxiosResultBean) Cursor(android.database.Cursor) Uri(android.net.Uri) DispatchEventManager(com.eros.framework.manager.impl.dispatcher.DispatchEventManager) ContentResolver(android.content.ContentResolver)

Example 2 with DispatchEventManager

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();
}
Also used : DialogInterface(android.content.DialogInterface) WeexEventBean(com.eros.framework.model.WeexEventBean) Intent(android.content.Intent) DispatchEventManager(com.eros.framework.manager.impl.dispatcher.DispatchEventManager)

Example 3 with DispatchEventManager

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);
}
Also used : DispatchEventManager(com.eros.framework.manager.impl.dispatcher.DispatchEventManager)

Example 4 with DispatchEventManager

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);
}
Also used : NetworkReceiver(com.eros.framework.receiver.NetworkReceiver) IntentFilter(android.content.IntentFilter) DispatchEventManager(com.eros.framework.manager.impl.dispatcher.DispatchEventManager)

Example 5 with DispatchEventManager

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();
}
Also used : RouterModel(com.eros.framework.model.RouterModel) WeexEventBean(com.eros.framework.model.WeexEventBean) DispatchEventManager(com.eros.framework.manager.impl.dispatcher.DispatchEventManager)

Aggregations

DispatchEventManager (com.eros.framework.manager.impl.dispatcher.DispatchEventManager)5 WeexEventBean (com.eros.framework.model.WeexEventBean)2 ContentResolver (android.content.ContentResolver)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 Cursor (android.database.Cursor)1 Uri (android.net.Uri)1 AxiosResultBean (com.eros.framework.model.AxiosResultBean)1 RouterModel (com.eros.framework.model.RouterModel)1 NetworkReceiver (com.eros.framework.receiver.NetworkReceiver)1