@@ -95,7 +95,6 @@
import me.ccrama.redditslide.Views.ToggleSwipeViewPager;
import me.ccrama.redditslide.Visuals.Palette;
import me.ccrama.redditslide.util.LogUtil;

import me.ccrama.redditslide.util.NetworkUtil;


@@ -1262,7 +1261,7 @@ public JsonNode getSubmission(SubmissionRequest request) throws NetworkException
@Override
public void onResume() {
super.onResume();
if (Authentication.isLoggedIn && Authentication.didOnline && NetworkUtil.isConnected(MainActivity.this)) {
if (Authentication.isLoggedIn && Authentication.didOnline && NetworkUtil.isConnected(MainActivity.this)) {
new AsyncNotificationBadge().execute();
}
}
@@ -1399,13 +1398,15 @@ protected Void doInBackground(Void... params) {

@Override
protected void onPostExecute(Void aVoid) {

View badge = headerMain.findViewById(R.id.count);
if (count == 0) {
headerMain.findViewById(R.id.count).setVisibility(View.GONE);
if (badge != null)
badge.setVisibility(View.GONE);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll();
} else {
headerMain.findViewById(R.id.count).setVisibility(View.VISIBLE);
if (badge != null)
badge.setVisibility(View.VISIBLE);
((TextView) headerMain.findViewById(R.id.count)).setText(count + "");
}
}
@@ -46,35 +46,39 @@ public void onReceive(Context context, Intent intent) {

private class AsyncGetMail extends AsyncTask<Void, Void, List<Message>> {

ArrayList<Message> modMessages = new ArrayList<>();

@Override
public void onPostExecute(List<Message> messages) {
Resources res = c.getResources();
if (messages != null && messages.size() > 0) {

//create arraylist of the messages fullName for markasread action
String[] messageNames = new String[messages.size()];
int counter = 0;
for (Message x : messages) {
messageNames[counter] = x.getFullName();
counter++;
}
//create arraylist of the messages fullName for markasread action
String[] messageNames = new String[messages.size()];
int counter = 0;
for (Message x : messages) {
messageNames[counter] = x.getFullName();
counter++;
}

if (messages != null && messages.size() > 0) {
if (messages.size() == 1) {
NotificationManager notificationManager = (NotificationManager) c.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationManager notificationManager = (NotificationManager) c.getSystemService(Context.NOTIFICATION_SERVICE);


Intent notificationIntent = new Intent(c, Inbox.class);
Intent notificationIntent = new Intent(c, Inbox.class);

notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_SINGLE_TOP);

PendingIntent intent = PendingIntent.getActivity(c, 0,
notificationIntent, 0);
PendingIntent intent = PendingIntent.getActivity(c, 0,
notificationIntent, 0);

//Intent for mark as read notification action
Intent readIntent = new Intent(c, MarkAsReadService.class);
readIntent.putExtra(MESSAGE_EXTRA, messageNames);
PendingIntent readPI = PendingIntent.getService(c, 2, readIntent, PendingIntent.FLAG_UPDATE_CURRENT);
//Intent for mark as read notification action
Intent readIntent = new Intent(c, MarkAsReadService.class);
readIntent.putExtra(MESSAGE_EXTRA, messageNames);
PendingIntent readPI = PendingIntent.getService(c, 2, readIntent, PendingIntent.FLAG_UPDATE_CURRENT);


if (messages.size() == 1) {

NotificationCompat.BigTextStyle notiStyle = new
NotificationCompat.BigTextStyle();
@@ -95,7 +99,6 @@ public void onPostExecute(List<Message> messages) {
notificationManager.notify(0, notification);
} else {
int amount = messages.size();
NotificationManager notificationManager = (NotificationManager) c.getSystemService(Context.NOTIFICATION_SERVICE);

NotificationCompat.InboxStyle notiStyle = new
NotificationCompat.InboxStyle();
@@ -105,20 +108,6 @@ public void onPostExecute(List<Message> messages) {
notiStyle.addLine(c.getString(R.string.mail_notification_msg, m.getAuthor()));
}

Intent notificationIntent = new Intent(c, Inbox.class);

notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_SINGLE_TOP);

PendingIntent intent = PendingIntent.getActivity(c, 0,
notificationIntent, 0);

//Intent for mark as read notification action
Intent readIntent = new Intent(c, MarkAsReadService.class);
readIntent.putExtra(MESSAGE_EXTRA, messageNames);
PendingIntent readPI = PendingIntent.getService(c, 2, readIntent, PendingIntent.FLAG_UPDATE_CURRENT);


Notification notification = new NotificationCompat.Builder(c)
.setContentIntent(intent)
.setSmallIcon(R.drawable.notif)
@@ -209,8 +198,6 @@ public void onPostExecute(List<Message> messages) {
}*/
}

ArrayList<Message> modMessages = new ArrayList<>();

@Override
protected List<Message> doInBackground(Void... params) {
try {
@@ -466,6 +466,7 @@
<string name="settings_general_no_header">Hide header on drawer</string>
<string name="settings_general_scroll_read">Mark posts as seen when scrolled past</string>
<string name="settings_link_chrome">Use Chrome Custom Tabs</string>
<string name="settings_link_horizontal_album">Horizontal album style</string>


<!-- Settings titles displayed in settings activity-->