本文整理汇总了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;
}
示例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);
//广播发送器
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
});
}
示例15: buildBroadcast
import android.support.v4.content.LocalBroadcastManager; //导入方法依赖的package包/类
private void buildBroadcast(){
if (!isSendBroadcast){
return;
}
localBroadcastManager = LocalBroadcastManager.getInstance(this);
localIntent = new Intent(ACTION);
}