List of usage examples for android.net Uri getBooleanQueryParameter
public boolean getBooleanQueryParameter(String key, boolean defaultValue)
From source file:Main.java
public static boolean shouldNotify(Uri uri) { return uri.getBooleanQueryParameter(NOTIFY, true); }
From source file:Main.java
public static boolean isUriCalledFromSyncAdapter(Uri uri) { return uri.getBooleanQueryParameter(QUERY_PARAMETER_CALLER_IS_SYNC_ADAPTER, false); }
From source file:com.microsoft.azure.engagement.engagement.AzmeNotifier.java
@Override protected boolean onNotificationPrepared(Notification notification, EngagementReachInteractiveContent content) throws RuntimeException { if (content.isSystemNotification() == true) { // Read http://developer.android.com/guide/topics/ui/notifiers/notifications.html final NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(mContext); // "Large Icon" : the left icon if (content.getNotificationImage() != null) { notificationBuilder.setLargeIcon(content.getNotificationImage()); }//from w ww.ja v a 2s . co m // "Small Icon": the small icon on the bottom right notificationBuilder.setSmallIcon(R.drawable.ic_notification_default); // "Content Title": the legacy notification title, i.e. the text on the top notificationBuilder.setContentTitle(content.getNotificationTitle()); // "Content Text": the legacy notification text, i.e. the text on the bottom notificationBuilder.setContentText(content.getNotificationMessage()); // The ticker text notificationBuilder.setTicker(notification.tickerText); // The notification settings notificationBuilder.setDefaults(notification.defaults); if (content.isNotificationCloseable() == false) { notificationBuilder.setAutoCancel(false); } notificationBuilder.setContent(notification.contentView); notificationBuilder.setContentIntent(notification.contentIntent); notificationBuilder.setDeleteIntent(notification.deleteIntent); notificationBuilder.setWhen(notification.when); if (content.getNotificationBigText() != null) { final BigTextStyle bigTextStyle = new BigTextStyle(); bigTextStyle.setBigContentTitle(content.getNotificationTitle()); bigTextStyle.setSummaryText(content.getNotificationMessage()); bigTextStyle.bigText(content.getNotificationBigText()); notificationBuilder.setStyle(bigTextStyle); } else if (content.getNotificationBigPicture() != null) { final BigPictureStyle bigPictureStyle = new BigPictureStyle(); final Bitmap bitmap = EngagementNotificationUtilsV11.getBigPicture(this.mContext, content.getDownloadId().longValue()); bigPictureStyle.bigPicture(bitmap); bigPictureStyle.setSummaryText(content.getNotificationMessage()); notificationBuilder.setStyle(bigPictureStyle); } // Retrieves the actionURL from the content final String actionURL; if (content instanceof EngagementAbstractAnnouncement == true) { actionURL = ((EngagementAbstractAnnouncement) content).getActionURL(); } else { // We are receiving a poll notification actionURL = null; } if (actionURL != null) { final Uri actionUri = Uri.parse(actionURL); // Retrieves the specify parameters from the actionURL final boolean displayShareButton = actionUri.getBooleanQueryParameter("displayShareButton", false); final boolean displayFeedbackButton = actionUri.getBooleanQueryParameter("displayFeedbackButton", false); if (displayFeedbackButton == true) { final Intent feedbackIntent = new Intent(); feedbackIntent.setAction(Intent.ACTION_VIEW); final Uri data = Uri.parse("mailto:"); feedbackIntent.putExtra(Intent.EXTRA_SUBJECT, mContext.getString(R.string.notification_feedback_email_subject)); feedbackIntent.setData(data); final PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, feedbackIntent, 0); notificationBuilder.addAction(R.drawable.ic_out_of_app_send_feedback, mContext.getString(R.string.notification_feedback_button_title), pendingIntent); } if (displayShareButton == true) { final Intent sharingIntent = new Intent(); sharingIntent.setAction(Intent.ACTION_SEND); sharingIntent.putExtra(Intent.EXTRA_TEXT, mContext.getString(R.string.notification_share_message)); sharingIntent.setType("text/plain"); final PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, sharingIntent, 0); notificationBuilder.addAction(R.drawable.ic_out_of_app_share, mContext.getString(R.string.notification_share_button_title), pendingIntent); } } /* Dismiss option can be managed only after build */ final Notification finalNotification = notificationBuilder.build(); if (content.isNotificationCloseable() == false) { finalNotification.flags |= Notification.FLAG_NO_CLEAR; } /* Notify here instead of super class */ final NotificationManager manager = (NotificationManager) mContext .getSystemService(Context.NOTIFICATION_SERVICE); manager.notify(getNotificationId(content), finalNotification); // notice the call to get the right identifier /* Return false, we notify ourselves */ return false; } else { return super.onNotificationPrepared(notification, content); } }
From source file:org.chromium.chrome.browser.bookmark.ManageBookmarkActivity.java
/** * Creates the base add/edit bookmark fragment based on the intent passed to this activity. * * @return The appropriate fragment based on the intent parameters. *///w w w . j av a 2 s .co m @SuppressFBWarnings("NP_NULL_ON_SOME_PATH") private AddEditBookmarkFragment generateBaseFragment() { if (getIntent() == null) { throw new IllegalArgumentException("intent can not be null"); } Intent intent = getIntent(); Uri intentUri = intent.getData(); Long bookmarkId = null; boolean isFolder = false; AddEditBookmarkFragment addEditFragment; if (intentUri != null && intentUri.getHost().equals("editbookmark")) { isFolder = intentUri.getBooleanQueryParameter(BOOKMARK_IS_FOLDER_URI_PARAM, false); String bookmarkIdParam = intentUri.getQueryParameter(BOOKMARK_ID_URI_PARAM); if (bookmarkIdParam != null) bookmarkId = Long.parseLong(bookmarkIdParam); addEditFragment = AddEditBookmarkFragment.newEditInstance(isFolder, bookmarkId); } else { Bundle extras = intent.getExtras(); String url = null; String name = null; if (extras != null) { isFolder = extras.getBoolean(BOOKMARK_INTENT_IS_FOLDER, false); if (extras.containsKey(BOOKMARK_INTENT_TITLE)) { name = extras.getString(BOOKMARK_INTENT_TITLE); } if (extras.containsKey(BOOKMARK_INTENT_URL)) { url = extras.getString(BOOKMARK_INTENT_URL); url = DomDistillerUrlUtils.getOriginalUrlFromDistillerUrl(url); } if (extras.containsKey(BOOKMARK_INTENT_ID)) { bookmarkId = extras.getLong(BOOKMARK_INTENT_ID); } } addEditFragment = AddEditBookmarkFragment.newInstance(isFolder, bookmarkId, name, url); } setActionListenerOnAddEdit(addEditFragment); return addEditFragment; }
From source file:de.vanita5.twittnuker.provider.TwidereDataProvider.java
private void onNewItemsInserted(final Uri uri, final int tableId, final ContentValues[] valuesArray, final long[] newIds) { if (uri == null || valuesArray == null || valuesArray.length == 0) return;/* w ww .j a v a 2s . c o m*/ preloadImages(valuesArray); if (!uri.getBooleanQueryParameter(QUERY_PARAM_NOTIFY, true)) return; switch (tableId) { case TABLE_ID_STATUSES: { notifyStatusesInserted(valuesArray); final List<ParcelableStatus> items = new ArrayList<ParcelableStatus>(mNewStatuses); Collections.sort(items); //TODO Notifications for new tweets in timeline notifyUnreadCountChanged(NOTIFICATION_ID_HOME_TIMELINE); break; } case TABLE_ID_MENTIONS: { final AccountPreferences[] prefs = AccountPreferences.getNotificationEnabledPreferences(getContext(), getAccountIds(getContext())); notifyMentionsInserted(prefs, valuesArray); notifyUnreadCountChanged(NOTIFICATION_ID_MENTIONS_TIMELINE); break; } case TABLE_ID_DIRECT_MESSAGES_INBOX: { notifyIncomingMessagesInserted(valuesArray); notifyUnreadCountChanged(NOTIFICATION_ID_DIRECT_MESSAGES); break; } case TABLE_ID_DRAFTS: { break; } } }
From source file:org.getlantern.firetweet.provider.FiretweetDataProvider.java
private void onNewItemsInserted(final Uri uri, final int tableId, final ContentValues[] valuesArray, final long[] newIds) { if (uri == null || valuesArray == null || valuesArray.length == 0) return;/* w w w. j a v a 2 s. c om*/ preloadImages(valuesArray); if (!uri.getBooleanQueryParameter(QUERY_PARAM_NOTIFY, true)) return; switch (tableId) { case TABLE_ID_STATUSES: { final AccountPreferences[] prefs = AccountPreferences.getNotificationEnabledPreferences(getContext(), getAccountIds(getContext())); for (final AccountPreferences pref : prefs) { if (!pref.isHomeTimelineNotificationEnabled()) continue; showTimelineNotification(pref, getPositionTag(TAB_TYPE_HOME_TIMELINE, pref.getAccountId())); } notifyUnreadCountChanged(NOTIFICATION_ID_HOME_TIMELINE); break; } case TABLE_ID_MENTIONS: { final AccountPreferences[] prefs = AccountPreferences.getNotificationEnabledPreferences(getContext(), getAccountIds(getContext())); for (final AccountPreferences pref : prefs) { if (!pref.isMentionsNotificationEnabled()) continue; showMentionsNotification(pref, getPositionTag(TAB_TYPE_MENTIONS_TIMELINE, pref.getAccountId())); } notifyUnreadCountChanged(NOTIFICATION_ID_MENTIONS_TIMELINE); break; } case TABLE_ID_DIRECT_MESSAGES_INBOX: { final AccountPreferences[] prefs = AccountPreferences.getNotificationEnabledPreferences(getContext(), getAccountIds(getContext())); for (final AccountPreferences pref : prefs) { if (!pref.isDirectMessagesNotificationEnabled()) continue; final StringLongPair[] pairs = mReadStateManager.getPositionPairs(TAB_TYPE_DIRECT_MESSAGES); showMessagesNotification(pref, pairs, valuesArray); } notifyUnreadCountChanged(NOTIFICATION_ID_DIRECT_MESSAGES); break; } case TABLE_ID_DRAFTS: { break; } } }