Bug 1241810 - Review follow-up: Rename CheckAction.notify() to CheckAction.showNotification(). r=me
MozReview-Commit-ID: EIRYnna6yf9
--- a/mobile/android/base/java/org/mozilla/gecko/feeds/action/CheckAction.java
+++ b/mobile/android/base/java/org/mozilla/gecko/feeds/action/CheckAction.java
@@ -79,17 +79,17 @@ public class CheckAction extends BaseAct
}
}
} catch (JSONException e) {
log("Could not deserialize subscription", e);
} finally {
cursor.close();
}
- notify(updatedFeeds);
+ showNotification(updatedFeeds);
}
private FeedFetcher.FeedResponse checkFeedForUpdates(FeedSubscription subscription) {
log("Checking feed: " + subscription.getFeedTitle());
FeedFetcher.FeedResponse response = fetchFeed(subscription);
if (response == null) {
return null;
@@ -102,32 +102,32 @@ public class CheckAction extends BaseAct
return response;
}
return null;
}
- private void notify(List<Feed> updatedFeeds) {
+ private void showNotification(List<Feed> updatedFeeds) {
final int feedCount = updatedFeeds.size();
if (feedCount == 0) {
return;
}
if (feedCount == 1) {
- notifySingle(updatedFeeds.get(0));
+ showNotificationForSingleUpdate(updatedFeeds.get(0));
} else {
- notifyMultiple(updatedFeeds);
+ showNotificationForMultipleUpdates(updatedFeeds);
}
Telemetry.sendUIEvent(TelemetryContract.Event.SHOW, TelemetryContract.Method.NOTIFICATION, "content_update");
}
- private void notifySingle(Feed feed) {
+ private void showNotificationForSingleUpdate(Feed feed) {
final String date = DateFormat.getMediumDateFormat(context).format(new Date(feed.getLastItem().getTimestamp()));
NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle()
.bigText(feed.getLastItem().getTitle())
.setBigContentTitle(feed.getTitle())
.setSummaryText(context.getString(R.string.content_notification_updated_on, date));
Intent intent = new Intent(Intent.ACTION_VIEW);
@@ -146,17 +146,17 @@ public class CheckAction extends BaseAct
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.addAction(createNotificationSettingsAction())
.build();
NotificationManagerCompat.from(context).notify(R.id.websiteContentNotification, notification);
}
- private void notifyMultiple(List<Feed> feeds) {
+ private void showNotificationForMultipleUpdates(List<Feed> feeds) {
final ArrayList<String> urls = new ArrayList<>();
final NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle();
for (Feed feed : feeds) {
final String url = feed.getLastItem().getURL();
inboxStyle.addLine(StringUtils.stripScheme(url, StringUtils.UrlFlags.STRIP_HTTPS));
urls.add(url);