Revert "Make notification text readable (fixes #1233)"

This reverts commit 40aefe05a60fa8bfbe71c518e838dd12d1b87c49.
This commit is contained in:
no.reply 2015-10-02 18:25:46 -04:00
parent 40aefe05a6
commit 4ce407c485

View File

@ -130,6 +130,7 @@ public class DownloadService extends Service {
private NotificationCompat.Builder notificationCompatBuilder;
private Notification.BigTextStyle notificationBuilder;
private int NOTIFICATION_ID = 2;
private int REPORT_ID = 3;
@ -321,16 +322,23 @@ public class DownloadService extends Service {
DBTasks.autodownloadUndownloadedItems(getApplicationContext());
}
@SuppressLint("NewApi")
private void setupNotificationBuilders() {
Bitmap icon = BitmapFactory.decodeResource(getResources(),
R.drawable.stat_notify_sync);
if (android.os.Build.VERSION.SDK_INT >= 16) {
notificationBuilder = new Notification.BigTextStyle(
new Notification.Builder(this).setOngoing(true)
.setContentIntent(ClientConfig.downloadServiceCallbacks.getNotificationContentIntent(this)).setLargeIcon(icon)
.setSmallIcon(R.drawable.stat_notify_sync)
);
} else {
notificationCompatBuilder = new NotificationCompat.Builder(this)
.setOngoing(true)
.setContentIntent(ClientConfig.downloadServiceCallbacks.getNotificationContentIntent(this))
.setOngoing(true).setContentIntent(ClientConfig.downloadServiceCallbacks.getNotificationContentIntent(this))
.setLargeIcon(icon)
.setSmallIcon(R.drawable.stat_notify_sync);
}
Log.d(TAG, "Notification set up");
}
@ -338,16 +346,20 @@ public class DownloadService extends Service {
* Updates the contents of the service's notifications. Should be called
* before setupNotificationBuilders.
*/
@SuppressLint("NewApi")
private Notification updateNotifications() {
String contentTitle = getString(R.string.download_notification_title);
int numDownloads = requester.getNumberOfDownloads();
String downloadsLeft;
if (numDownloads > 0) {
downloadsLeft = requester.getNumberOfDownloads() + getString(R.string.downloads_left);
downloadsLeft = requester.getNumberOfDownloads()
+ getString(R.string.downloads_left);
} else {
downloadsLeft = getString(R.string.downloads_processing);
}
if (notificationCompatBuilder != null) {
if (android.os.Build.VERSION.SDK_INT >= 16) {
if (notificationBuilder != null) {
StringBuilder bigText = new StringBuilder("");
for (int i = 0; i < downloads.size(); i++) {
@ -373,14 +385,20 @@ public class DownloadService extends Service {
}
}
notificationBuilder.setSummaryText(downloadsLeft);
notificationBuilder.setBigContentTitle(contentTitle);
if (bigText != null) {
notificationBuilder.bigText(bigText.toString());
}
return notificationBuilder.build();
}
} else {
if (notificationCompatBuilder != null) {
notificationCompatBuilder.setContentTitle(contentTitle);
notificationCompatBuilder.setContentText(downloadsLeft);
if (bigText != null) {
notificationCompatBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(bigText.toString()));
}
notificationCompatBuilder.setColor(0xff424242);
return notificationCompatBuilder.build();
}
}
return null;
}