New all-white status bar icon to fix issue #1356
This commit is contained in:
@@ -36,6 +36,9 @@ import android.os.Messenger;
|
||||
import android.os.RemoteException;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
@@ -474,11 +477,26 @@ public class PassphraseCacheService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
// from de.azapps.mirakel.helper.Helpers from https://github.com/MirakelX/mirakel-android
|
||||
private static Bitmap getBitmap(int resId, Context ctx) {
|
||||
final int mLargeIconWidth = (int) ctx.getResources().getDimension(
|
||||
android.R.dimen.notification_large_icon_width);
|
||||
final int mLargeIconHeight = (int) ctx.getResources().getDimension(
|
||||
android.R.dimen.notification_large_icon_height);
|
||||
final Drawable d = ctx.getResources().getDrawable(resId);
|
||||
final Bitmap b = Bitmap.createBitmap(mLargeIconWidth, mLargeIconHeight, Bitmap.Config.ARGB_8888);
|
||||
final Canvas c = new Canvas(b);
|
||||
d.setBounds(0, 0, mLargeIconWidth, mLargeIconHeight);
|
||||
d.draw(c);
|
||||
return b;
|
||||
}
|
||||
|
||||
private Notification getNotification() {
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
builder.setSmallIcon(R.drawable.ic_launcher)
|
||||
builder.setSmallIcon(R.drawable.ic_stat_notify)
|
||||
.setLargeIcon(getBitmap(R.drawable.ic_launcher, getBaseContext()))
|
||||
.setContentTitle(getString(R.string.app_name))
|
||||
.setContentText(String.format(getString(R.string.passp_cache_notif_n_keys),
|
||||
mPassphraseCache.size()));
|
||||
@@ -510,7 +528,8 @@ public class PassphraseCacheService extends Service {
|
||||
);
|
||||
} else {
|
||||
// Fallback, since expandable notifications weren't available back then
|
||||
builder.setSmallIcon(R.drawable.ic_launcher)
|
||||
builder.setSmallIcon(R.drawable.ic_stat_notify)
|
||||
.setLargeIcon(getBitmap(R.drawable.ic_launcher, getBaseContext()))
|
||||
.setContentTitle(String.format(getString(R.string.passp_cache_notif_n_keys),
|
||||
mPassphraseCache.size()))
|
||||
.setContentText(getString(R.string.passp_cache_notif_click_to_clear));
|
||||
|
||||
BIN
OpenKeychain/src/main/res/drawable-hdpi/ic_stat_notify.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-hdpi/ic_stat_notify.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
OpenKeychain/src/main/res/drawable-mdpi/ic_stat_notify.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-mdpi/ic_stat_notify.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
OpenKeychain/src/main/res/drawable-xhdpi/ic_stat_notify.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-xhdpi/ic_stat_notify.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
BIN
OpenKeychain/src/main/res/drawable-xxhdpi/ic_stat_notify.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-xxhdpi/ic_stat_notify.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
BIN
OpenKeychain/src/main/res/drawable-xxxhdpi/ic_stat_notify.png
Normal file
BIN
OpenKeychain/src/main/res/drawable-xxxhdpi/ic_stat_notify.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
Reference in New Issue
Block a user