List of usage examples for android.support.v4.content LocalBroadcastManager sendBroadcast
public boolean sendBroadcast(Intent intent)
From source file:com.linkbubble.ui.BubbleFlowDraggable.java
private void passUrlToActivity(OpenUrlSettings urlToOpen) { Intent intent = new Intent(BubbleFlowActivity.ACTIVITY_INTENT_NAME); intent.putExtra("command", BubbleFlowActivity.OPEN_URL); intent.putExtra("url", urlToOpen.mUrl); intent.putExtra("urlStartTime", urlToOpen.mUrlLoadStartTime); intent.putExtra("hasShownAppPicker", urlToOpen.mHasShownAppPicker); intent.putExtra("performEmptyClick", urlToOpen.mPerformEmptyClick); intent.putExtra("setAsCurrentTab", urlToOpen.mSetAsCurrentTab); intent.putExtra("openedFromItself", urlToOpen.mOpenedFromItself); LocalBroadcastManager bm = LocalBroadcastManager.getInstance(getContext()); bm.sendBroadcast(intent); }
From source file:com.linkbubble.ui.BubbleFlowDraggable.java
public void destroy() { Intent intent = new Intent(BubbleFlowActivity.ACTIVITY_INTENT_NAME); intent.putExtra("command", BubbleFlowActivity.DESTROY_ACTIVITY); LocalBroadcastManager bm = LocalBroadcastManager.getInstance(getContext()); bm.sendBroadcast(intent); mDestroyed = true;//from ww w . j av a 2 s . co m synchronized (MainApplication.mActivitySharedLock) { MainApplication.mActivitySharedLock.notify(); } mDraggableHelper.destroy(); }
From source file:net.sf.diningout.content.SyncAdapter.java
/** * Upload contact changes to the server. *//* w ww.j av a 2s. co m*/ private void uploadContacts(Context context, ContentProviderClient cp) throws RemoteException { String[] proj = { _ID, Contacts.GLOBAL_ID, Contacts.EMAIL_HASH, Contacts.FOLLOWING, Contacts.STATUS_ID, Contacts.DIRTY, Contacts.VERSION }; String sel = Contacts.DIRTY + " = 1"; List<User> users = Contacts.from(cp.query(CONTACTS_URI, proj, sel, null, null)); if (users != null) { LocalBroadcastManager bm = LocalBroadcastManager.getInstance(context); bm.sendBroadcast(new Intent(ACTION_CONTACTS_SYNCING)); response(Server.syncContacts(users), cp, CONTACTS_URI); bm.sendBroadcast(new Intent(ACTION_CONTACTS_SYNCED)); } }
From source file:com.linkbubble.ui.BubbleFlowDraggable.java
@Override public boolean expand(long time, final AnimationEventListener animationEventListener) { CrashTracking.log("BubbleFlowDraggable.expand(): time:" + time); if (isExpanded() == false && mCurrentTab != null) { // Ensure the centerIndex matches the current bubble. This should only *NOT* be the case when // restoring with N Bubbles from a previous session and the user clicks to expand the BubbleFlowView. int currentTabIndex = getIndexOfView(mCurrentTab); int centerIndex = getCenterIndex(); if (centerIndex > -1 && currentTabIndex != centerIndex && isAnimatingToCenterIndex() == false) { setCenterIndex(currentTabIndex, false); }// w ww. j av a 2 s .c o m } if (mViews.size() > 0) { Intent intent = new Intent(BubbleFlowActivity.ACTIVITY_INTENT_NAME); intent.putExtra("command", BubbleFlowActivity.EXPAND); LocalBroadcastManager bm = LocalBroadcastManager.getInstance(getContext()); bm.sendBroadcast(intent); } if (super.expand(time, animationEventListener)) { int centerIndex = getCenterIndex(); if (centerIndex > -1) { setCurrentTab((TabView) mViews.get(centerIndex), true); } return true; } return false; }
From source file:com.google.android.apps.dashclock.DashClockService.java
private void internalRequestUpdateData(final IDataConsumerHostCallback cb, List<ComponentName> extensions) { // Recover the updatable extensions for this caller List<ComponentName> updatableExtensions = new ArrayList<>(); List<ComponentName> registeredExtensions = mRegisteredCallbacks.get(cb.asBinder()).mExtensions; if (extensions == null) { updatableExtensions.addAll(registeredExtensions); } else {//from w w w.ja v a 2 s. co m for (ComponentName extension : extensions) { if (registeredExtensions.contains(extension)) { updatableExtensions.add(extension); } } } // Request an update of all the extensions in the list final LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(this); for (ComponentName updatableExtension : updatableExtensions) { Intent intent = new Intent(ACTION_EXTENSION_UPDATE_REQUESTED); intent.putExtra(EXTRA_COMPONENT_NAME, updatableExtension.flattenToString()); intent.putExtra(EXTRA_UPDATE_REASON, DashClockExtension.UPDATE_REASON_MANUAL); lbm.sendBroadcast(intent); } }
From source file:com.linkbubble.ui.BubbleFlowView.java
public void hideActivity() { Intent intent = new Intent(BubbleFlowActivity.ACTIVITY_INTENT_NAME); intent.putExtra("command", BubbleFlowActivity.COLLAPSE); LocalBroadcastManager bm = LocalBroadcastManager.getInstance(getContext()); bm.sendBroadcast(intent); }
From source file:no.nordicsemi.android.nrftoolbox.dfu.DfuActivity.java
private void showUploadCancelDialog() { final LocalBroadcastManager manager = LocalBroadcastManager.getInstance(this); final Intent pauseAction = new Intent(DfuService.BROADCAST_ACTION); pauseAction.putExtra(DfuService.EXTRA_ACTION, DfuService.ACTION_PAUSE); manager.sendBroadcast(pauseAction); UploadCancelFragment fragment = UploadCancelFragment.getInstance(); fragment.show(getFragmentManager(), TAG); }
From source file:com.buddi.client.dfu.DfuActivity.java
private void showUploadCancelDialog() { final LocalBroadcastManager manager = LocalBroadcastManager.getInstance(this); final Intent pauseAction = new Intent(DfuService.BROADCAST_ACTION); pauseAction.putExtra(DfuService.EXTRA_ACTION, DfuService.ACTION_PAUSE); manager.sendBroadcast(pauseAction); final UploadCancelFragment fragment = UploadCancelFragment.getInstance(); fragment.show(getFragmentManager(), TAG); }
From source file:com.mycheez.gcm.RegistrationIntentService.java
/** * Persist registration to third-party servers. * * Modify this method to associate the user's GCM registration token with any server-side account * maintained by your application.//from w w w . j a va2 s . co m * * @param token The new token. * @param sharedPreferences */ private void sendRegistrationToServer(String token, String userId, final SharedPreferences sharedPreferences) { Firebase myCheezRef = MyCheezApplication.getMyCheezFirebaseRef(); Firebase userPresenceNode = myCheezRef.child("presence").child(userId); final LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this); Map<String, Object> deviceToken = new HashMap<String, Object>(); deviceToken.put("gcmToken", token); userPresenceNode.updateChildren(deviceToken, new Firebase.CompletionListener() { @Override public void onComplete(FirebaseError firebaseError, Firebase firebase) { if (firebaseError == null) { // You should store a boolean that indicates whether the generated token has been // sent to your server. If the boolean is false, send the token to your server, // otherwise your server should have already received the token. sharedPreferences.edit().putBoolean(GcmPreferencesContants.SENT_TOKEN_TO_SERVER, true).apply(); } else { sharedPreferences.edit().putBoolean(GcmPreferencesContants.SENT_TOKEN_TO_SERVER, false).apply(); } // Notify UI that registration has completed, so the progress indicator can be hidden. Intent registrationComplete = new Intent(GcmPreferencesContants.REGISTRATION_COMPLETE); broadcastManager.sendBroadcast(registrationComplete); } }); }
From source file:com.folioreader.ui.folio.activity.FolioActivity.java
@Override protected void onDestroy() { super.onDestroy(); if (outState != null) outState.putParcelable(BUNDLE_READ_POSITION_CONFIG_CHANGE, lastReadPosition); LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(this); localBroadcastManager.unregisterReceiver(searchReceiver); localBroadcastManager.unregisterReceiver(closeBroadcastReceiver); if (r2StreamerServer != null) { r2StreamerServer.stop();// ww w . j a v a 2 s . c o m } if (isFinishing()) localBroadcastManager.sendBroadcast(new Intent(FolioReader.ACTION_FOLIOREADER_CLOSED)); }