Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
* Fixed "empty" RSS notification
Browse files Browse the repository at this point in the history
  • Loading branch information
lgallard committed Jun 26, 2015
1 parent cc9da7d commit a6b369a
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ protected ArrayList<RSSFeed> doInBackground(String... params) {
@Override
protected void onPostExecute(ArrayList<RSSFeed> result) {

boolean gotItems= false;

if (result != null && result.size() > 0) {

String info = "";
Expand All @@ -366,7 +368,7 @@ protected void onPostExecute(ArrayList<RSSFeed> result) {

NotificationManager notificationManager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);

Notification notification;
Notification notification = null;

if (android.os.Build.VERSION.SDK_INT >= 16) {

Expand All @@ -382,6 +384,10 @@ protected void onPostExecute(ArrayList<RSSFeed> result) {

ArrayList<RSSFeedItem> items = rssFeed.getItems();

if(items.size() > 0){
gotItems = true;
}


for (int j = 0; j < items.size(); j++) {

Expand Down Expand Up @@ -441,9 +447,10 @@ protected void onPostExecute(ArrayList<RSSFeed> result) {
}


inbox.setSummaryText(result.get(0).getChannelTitle());

notification = inbox.build();
if(gotItems) {
inbox.setSummaryText(result.get(0).getChannelTitle());
notification = inbox.build();
}

} else {
notification = builder.getNotification();
Expand Down Expand Up @@ -471,8 +478,9 @@ protected void onPostExecute(ArrayList<RSSFeed> result) {
}
}


notificationManager.notify(0, notification);
if(gotItems && notification != null) {
notificationManager.notify(0, notification);
}

}

Expand Down

0 comments on commit a6b369a

Please sign in to comment.