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


Java LocalBroadcastManager.getInstance方法代码示例

本文整理汇总了Java中android.support.v4.content.LocalBroadcastManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java LocalBroadcastManager.getInstance方法的具体用法?Java LocalBroadcastManager.getInstance怎么用?Java LocalBroadcastManager.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.content.LocalBroadcastManager的用法示例。


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

示例1: onCreateView

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    getActivity().setTitle(getString(R.string.frag_notif_title));
    if (mListener != null) {
        mListener.checkNavigationDrawerItem(R.id.nav_notif);
    }
    FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
    fab.hide();
    SwipeRefreshLayout srl = (SwipeRefreshLayout) getActivity().findViewById(R.id.swipe_container);
    srl.setEnabled(false);

    IntentFilter filter = new IntentFilter();
    filter.addAction(MainActivity.ACTION_MAIN_SERVICE_BOUND);
    filter.addAction(MainService.ACTION_UPDATE_TOPOLOGY_FINISHED);
    LocalBroadcastManager bm = LocalBroadcastManager.getInstance(view.getContext());
    bm.registerReceiver(mBroadcastReceiver, filter);
    return view;
}
 
开发者ID:gbl08ma,项目名称:underlx,代码行数:20,代码来源:NotifPreferenceFragment.java

示例2: onCreate

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_music_player);
    mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
    localBroadcastManager = LocalBroadcastManager.getInstance(this);

    musicApplication = (GlobalVariable) getApplication();
    music = (MusicList) musicApplication.getTheList().get(musicApplication.getMusicPosition());

    //初始化组件
    getView();
    initView();
    setMusicPlayerService();
    mMusicPlayerService.setMusicPlayerActivity(this);
    mMusicPlayerService.transPleyerToMain();
    circleSeekBar.setmActivity(this);

    //填充歌词
    httpConn = new HttpConn(music.getSinger(), music.getMusicName(), handler);

    //广播发送器

}
 
开发者ID:fikyair,项目名称:musicplayer,代码行数:25,代码来源:MusicPlayerActivity.java

示例3: intiData

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
private void intiData() {
    // 创建一个会话的fragment
    easeChatFragment = new EaseChatFragment();

    mHxid = getIntent().getStringExtra(EaseConstant.EXTRA_USER_ID);

    // 获取聊天类型
    mChatType = getIntent().getExtras().getInt(EaseConstant.EXTRA_CHAT_TYPE);

    easeChatFragment.setArguments(getIntent().getExtras());

    // 替换fragment
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.replace(R.id.fl_chat, easeChatFragment).commit();

    // 获取发送广播的管理者
    mLocalBroadcastManager = LocalBroadcastManager.getInstance(ChatActivity.this);
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:19,代码来源:ChatActivity.java

示例4: cleanup

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
/**
 * Cleanup the object
 * Should be called when the object is not used anymore
 */
public void cleanup() {
    stopDiscovering();
    //close discovery service
    Log.d(TAG, "closeServices ...");

    if (mArdiscoveryService != null) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                mArdiscoveryService.stop();

                mCtx.unbindService(mArdiscoveryServiceConnection);
                mArdiscoveryService = null;
            }
        }).start();
    }

    // unregister receivers
    LocalBroadcastManager localBroadcastMgr = LocalBroadcastManager.getInstance(mCtx);
    localBroadcastMgr.unregisterReceiver(mArdiscoveryServicesDevicesListUpdatedReceiver);
}
 
开发者ID:pkargupta,项目名称:gyrodrone,代码行数:26,代码来源:DroneDiscoverer.java

示例5: onCreateView

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_home_stats, container, false);

    Context context = view.getContext();

    lineStatsLayout = (TableLayout) view.findViewById(R.id.line_stats_layout);
    progressBar = (ProgressBar) view.findViewById(R.id.loading_indicator);
    lastDisturbanceView = (HtmlTextView) view.findViewById(R.id.last_disturbance_view);
    progressBar.setVisibility(View.VISIBLE);
    updateInformationView = (TextView) view.findViewById(R.id.update_information);

    IntentFilter filter = new IntentFilter();
    filter.addAction(MainActivity.ACTION_MAIN_SERVICE_BOUND);
    filter.addAction(MainService.ACTION_UPDATE_TOPOLOGY_FINISHED);
    filter.addAction(StatsCache.ACTION_STATS_UPDATE_STARTED);
    filter.addAction(StatsCache.ACTION_STATS_UPDATE_SUCCESS);
    filter.addAction(StatsCache.ACTION_STATS_UPDATE_FAILED);
    LocalBroadcastManager bm = LocalBroadcastManager.getInstance(context);
    bm.registerReceiver(mBroadcastReceiver, filter);
    redraw(context);
    return view;
}
 
开发者ID:gbl08ma,项目名称:underlx,代码行数:25,代码来源:HomeStatsFragment.java

示例6: bindModel

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
public void bindModel(@NonNull App app) {
    currentApp = app;

    ImageLoader.getInstance().displayImage(app.iconUrl, icon, displayImageOptions);

    // Figures out the current install/update/download/etc status for the app we are viewing.
    // Then, asks the view to update itself to reflect this status.
    Iterator<AppUpdateStatus> statuses =
            AppUpdateStatusManager.getInstance(activity).getByPackageName(app.packageName).iterator();
    if (statuses.hasNext()) {
        AppUpdateStatus status = statuses.next();
        updateAppStatus(app, status);
    } else {
        updateAppStatus(app, null);
    }

    final LocalBroadcastManager broadcastManager =
            LocalBroadcastManager.getInstance(activity.getApplicationContext());
    broadcastManager.unregisterReceiver(onStatusChanged);

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(AppUpdateStatusManager.BROADCAST_APPSTATUS_ADDED);
    intentFilter.addAction(AppUpdateStatusManager.BROADCAST_APPSTATUS_REMOVED);
    intentFilter.addAction(AppUpdateStatusManager.BROADCAST_APPSTATUS_CHANGED);
    broadcastManager.registerReceiver(onStatusChanged, intentFilter);
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:27,代码来源:AppListItemController.java

示例7: onResumeFragments

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
@Override
protected void onResumeFragments() {
    if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG);
    super.onResumeFragments();

    /* Showing dialog in onResume() fails with:
     *   Can not perform this action after onSaveInstanceState
     */
    if (mImportChosenBook != null) {
        importChosenBook(mImportChosenBook);
        mImportChosenBook = null;
    }

    LocalBroadcastManager bm = LocalBroadcastManager.getInstance(this);
    bm.registerReceiver(receiver, new IntentFilter(AppIntent.ACTION_OPEN_NOTE));
    bm.registerReceiver(receiver, new IntentFilter(AppIntent.ACTION_OPEN_BOOK));
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:18,代码来源:MainActivity.java

示例8: initBroadcastReceiver

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
private void initBroadcastReceiver() {
    // 注册广播接收者
    mBroadcastManager = LocalBroadcastManager.getInstance(this);
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(AppDelegate.ACTION_T_REFRESH_APPLY_PAYMENT_LIST);
    mReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            reLoad();
        }
    };
    mBroadcastManager.registerReceiver(mReceiver, intentFilter);
}
 
开发者ID:jpaijh,项目名称:TYT,代码行数:14,代码来源:T_ApplyPaymentActivity.java

示例9: bindReceiver

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
private void bindReceiver(final T view) {
  receiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {

      handleIntent(view, intent);
    }
  };

  manager = LocalBroadcastManager.getInstance(context);

  final IntentFilter filter = new IntentFilter();
  filter.addAction(Intent.ACTION_VIEW);
  filter.addCategory(Intent.CATEGORY_DEFAULT);

  final Uri[] uris = new Uri[kolibriUris().length];

  for (int i = 0; i < uris.length; ++i) {
    uris[i] = Uri.parse(kolibriUris()[i]);

    final Uri uri = uris[i];

    filter.addDataScheme(uri.getScheme());
    filter.addDataAuthority(uri.getHost(), null);
  }

  manager.registerReceiver(receiver, filter);
}
 
开发者ID:azmedien,项目名称:kolibri-android,代码行数:29,代码来源:KolibriCoordinator.java

示例10: register

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
private void register() {
    musicService = RairApp.getApp().getService();
    receiver = new OptionReceiver();
    IntentFilter intentFilter = new IntentFilter(Constants.ACTION_SEND);
    broadcastManager = LocalBroadcastManager.getInstance(getContext());
    broadcastManager.registerReceiver(receiver, intentFilter);
}
 
开发者ID:Rairmmd,项目名称:-Pod,代码行数:8,代码来源:OptionFragment.java

示例11: MusicFromSingerAndAlbum

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
public MusicFromSingerAndAlbum(Context context,int num,String name){
    this.listContainer = LayoutInflater.from(context);
    this.mcontext = context;
    this.global = (GlobalVariable) context.getApplicationContext();
    if (name.equals("singer")){
        this.musiclist = global.getSingerListList().get(num).getMusicListBelongSinger();
    }
    if (name.equals("album")){
        this.musiclist = global.getAlbumListList().get(num).getMusicListBelongAlbum();
    }
    this.localBroadcastManager = LocalBroadcastManager.getInstance(context);
}
 
开发者ID:fikyair,项目名称:musicplayer,代码行数:13,代码来源:MusicFromSingerAndAlbum.java

示例12: associateWithLikeActionController

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
private void associateWithLikeActionController(LikeActionController likeActionController) {
    this.likeActionController = likeActionController;

    this.broadcastReceiver = new LikeControllerBroadcastReceiver();
    LocalBroadcastManager localBroadcastManager =
            LocalBroadcastManager.getInstance(getContext());

    // add the broadcast receiver
    IntentFilter filter = new IntentFilter();
    filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_UPDATED);
    filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_ERROR);
    filter.addAction(LikeActionController.ACTION_LIKE_ACTION_CONTROLLER_DID_RESET);

    localBroadcastManager.registerReceiver(broadcastReceiver, filter);
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:16,代码来源:LikeView.java

示例13: emitEventContext

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
/**
 * Post an event to all event subscriber for the given name
 * Example: MSREventBridgeModule.emitEventContext(getApplicationContext(), "eventName", data);
 */
static public void emitEventContext(Context context, final String name, @Nullable WritableMap info) {
  Bundle bundle = new Bundle();
  bundle.putString(EventBridgeModuleEventNameKey, name);
  if (info != null) {
    bundle.putBundle(EventBridgeModuleEventInfoKey, Arguments.toBundle(info));
  }

  LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(context);
  Intent customEvent= new Intent(EventBridgeModuleIntentEventName);
  customEvent.putExtra(EventBridgeModuleIntentEventDataKey, bundle);
  localBroadcastManager.sendBroadcast(customEvent);
}
 
开发者ID:maicki,项目名称:react-native-event-bridge,代码行数:17,代码来源:MSREventBridgeModule.java

示例14: LoriAuthController

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
@Inject
public LoriAuthController(LoriApp app, TokenStore tokenStore, final LoriApiService service, AppExecutors executors) {
    this.service = service;
    this.executors = executors;
    this.broadcastManager = LocalBroadcastManager.getInstance(app);
    this.service.setListener(this);
    this.tokenStore = tokenStore;
    executors.background().execute(new Runnable() {
        @Override
        public void run() {
            String token = tokenStore.loadToken();
            service.setToken(token);
        }
    });
}
 
开发者ID:zmeiko,项目名称:LoriApp,代码行数:16,代码来源:LoriAuthController.java

示例15: buildBroadcast

import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
private void buildBroadcast(){
    if (!isSendBroadcast){
        return;
    }
    localBroadcastManager = LocalBroadcastManager.getInstance(this);
    localIntent = new Intent(ACTION);
}
 
开发者ID:androidstarjack,项目名称:ServiceDownLoadApp-master,代码行数:8,代码来源:UpdateService.java


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