Skip to content

Commit

Permalink
Notfication checkbox functional
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRolfFR committed Dec 4, 2019
1 parent 6180761 commit f997a1c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,13 @@ protected void onPostExecute(String page) {
Utility.setListViewHeightBasedOnChildren(tc.listView);
});
}

@Override
protected void onCancelled() {
super.onCancelled();

// gone visibility
tc.context.runOnUiThread(() -> tc.progressBar.setVisibility(View.GONE));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void run(Context context) {
.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))
.setCustomBigContentView(notificationLayoutExpanded)
.setOngoing(true)
.setPriority(Notification.PRIORITY_LOW)
.setPriority(Notification.PRIORITY_MIN)
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC) //to show content in lock screen
.setContentTitle(context.getString(R.string.update_never))
.setContentIntent(resultPendingIntent)
Expand Down Expand Up @@ -264,8 +264,11 @@ void setUpdatedAtTitle(Context context) {
updateTitle(context.getString(R.string.update_last, dateFormatted));
}

void cancelAll() {
void cancelAll(Context context) {
if(notificationManager == null)
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

if(notificationManager != null)
notificationManager.cancelAll();
notificationManager.cancel(NOTIFICATION_ID);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ private void handleAction(String action) {
OptymoDirection[] fav = ((GlobalApplication) getApplication()).getFavoritesController().getFavorites();
// Log.d("optymo", "" + fav.length);

// if action is cancel we cancel
if(action.equals(CANCEL_ACTION)) {
notificationController.cancelAll(this);
return;
}

// reset index if refresh
if(action.equals(REFRESH_ACTION))
OnBoot.setIndex(0);
else if(action.equals(CANCEL_ACTION))
notificationController.cancelAll();
else { // else its next
// increase index of 6
OnBoot.increaseIndex(6);
Expand Down

0 comments on commit f997a1c

Please sign in to comment.