Fix for old devices
They can't use vector drawables in notifications. Also, groups can not be used, see http://stackoverflow.com/a/34953411.
@ -184,6 +184,7 @@ android {
|
||||
versionCode 102050
|
||||
versionName getVersionName()
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
|
||||
testOptions {
|
||||
|
@ -37,6 +37,7 @@ import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.StrictMode;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
@ -78,6 +79,10 @@ import sun.net.www.protocol.bluetooth.Handler;
|
||||
)
|
||||
public class FDroidApp extends Application {
|
||||
|
||||
static {
|
||||
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
|
||||
}
|
||||
|
||||
private static final String TAG = "FDroidApp";
|
||||
|
||||
public static final String SYSTEM_DIR_NAME = Environment.getRootDirectory().getAbsolutePath();
|
||||
|
@ -15,6 +15,7 @@ import android.os.Build;
|
||||
import android.support.graphics.drawable.VectorDrawableCompat;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
@ -251,14 +252,14 @@ class NotificationHelper {
|
||||
if (entry.intent != null) {
|
||||
switch (entry.status) {
|
||||
case UpdateAvailable:
|
||||
return new NotificationCompat.Action(R.drawable.ic_notify_update_24dp, context.getString(R.string.notification_action_update), entry.intent);
|
||||
return new NotificationCompat.Action(R.drawable.ic_file_download, context.getString(R.string.notification_action_update), entry.intent);
|
||||
|
||||
case Downloading:
|
||||
case Installing:
|
||||
return new NotificationCompat.Action(R.drawable.ic_notify_cancel_24dp, context.getString(R.string.notification_action_cancel), entry.intent);
|
||||
return new NotificationCompat.Action(R.drawable.ic_cancel, context.getString(R.string.notification_action_cancel), entry.intent);
|
||||
|
||||
case ReadyToInstall:
|
||||
return new NotificationCompat.Action(R.drawable.ic_notify_install_24dp, context.getString(R.string.notification_action_install), entry.intent);
|
||||
return new NotificationCompat.Action(R.drawable.ic_file_install, context.getString(R.string.notification_action_install), entry.intent);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -333,9 +334,15 @@ class NotificationHelper {
|
||||
.setLargeIcon(iconLarge)
|
||||
.setLocalOnly(true)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET)
|
||||
.setGroup(GROUP_UPDATES)
|
||||
.setContentIntent(entry.intent);
|
||||
|
||||
/* If using stacked notifications, use groups. Note that this would not work prior to Lollipop,
|
||||
because of http://stackoverflow.com/a/34953411, but currently not an issue since stacked
|
||||
notifications are used only on >= Nougat.
|
||||
*/
|
||||
if (useStackedNotifications()) {
|
||||
builder.setGroup(GROUP_UPDATES);
|
||||
}
|
||||
|
||||
// Handle actions
|
||||
//
|
||||
@ -430,9 +437,12 @@ class NotificationHelper {
|
||||
.setContentText(context.getString(R.string.notification_content_single_installed))
|
||||
.setLocalOnly(true)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_SECRET)
|
||||
.setGroup(GROUP_INSTALLED)
|
||||
.setContentIntent(entry.intent);
|
||||
|
||||
if (useStackedNotifications()) {
|
||||
builder.setGroup(GROUP_INSTALLED);
|
||||
}
|
||||
|
||||
Intent intentDeleted = new Intent(BROADCAST_NOTIFICATIONS_INSTALLED_CLEARED);
|
||||
intentDeleted.putExtra(EXTRA_NOTIFICATION_KEY, entry.getUniqueKey());
|
||||
PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, 0);
|
||||
|
BIN
app/src/main/res/drawable-hdpi/ic_cancel.png
Normal file
After Width: | Height: | Size: 579 B |
BIN
app/src/main/res/drawable-hdpi/ic_file_download.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
app/src/main/res/drawable-hdpi/ic_file_install.png
Normal file
After Width: | Height: | Size: 690 B |
BIN
app/src/main/res/drawable-mdpi/ic_cancel.png
Normal file
After Width: | Height: | Size: 541 B |
BIN
app/src/main/res/drawable-mdpi/ic_file_download.png
Normal file
After Width: | Height: | Size: 263 B |
BIN
app/src/main/res/drawable-mdpi/ic_file_install.png
Normal file
After Width: | Height: | Size: 506 B |
BIN
app/src/main/res/drawable-xhdpi/ic_cancel.png
Normal file
After Width: | Height: | Size: 846 B |
BIN
app/src/main/res/drawable-xhdpi/ic_file_download.png
Normal file
After Width: | Height: | Size: 351 B |
BIN
app/src/main/res/drawable-xhdpi/ic_file_install.png
Normal file
After Width: | Height: | Size: 793 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_cancel.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_file_download.png
Normal file
After Width: | Height: | Size: 450 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_file_install.png
Normal file
After Width: | Height: | Size: 972 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_cancel.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/ic_file_download.png
Normal file
After Width: | Height: | Size: 548 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_file_install.png
Normal file
After Width: | Height: | Size: 1.2 KiB |