From c4f11c453594b6679f1e401f09d33c4945094f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 23 Nov 2015 23:39:56 +0100 Subject: Fix strings, thanks to Alain-Olivier --- .../service/ContactSyncAdapterService.java | 2 ++ .../keychain/service/PassphraseCacheService.java | 34 ++-------------------- 2 files changed, 5 insertions(+), 31 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java index 94742fe18..f1b4befe6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/ContactSyncAdapterService.java @@ -40,6 +40,7 @@ import android.widget.Toast; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.ui.SettingsActivity; +import org.sufficientlysecure.keychain.ui.util.NotificationUtils; import org.sufficientlysecure.keychain.util.ContactHelper; import org.sufficientlysecure.keychain.util.Log; @@ -86,6 +87,7 @@ public class ContactSyncAdapterService extends Service { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(ContactSyncAdapterService.this) .setSmallIcon(R.drawable.ic_stat_notify_24dp) + .setLargeIcon(NotificationUtils.getBitmap(R.mipmap.ic_launcher, getBaseContext())) .setContentTitle(getString(R.string.sync_notification_permission_required_title)) .setContentText(getString(R.string.sync_notification_permission_required_text)) .setContentIntent(resultPendingIntent); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java index df29a388f..67c295b6d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java @@ -28,13 +28,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.drawable.Drawable; import android.os.Binder; -import android.os.Build; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; @@ -50,6 +44,7 @@ import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType; import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing; import org.sufficientlysecure.keychain.provider.ProviderHelper; +import org.sufficientlysecure.keychain.ui.util.NotificationUtils; import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Passphrase; import org.sufficientlysecure.keychain.util.Preferences; @@ -475,36 +470,13 @@ 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 context) { - int mLargeIconWidth = (int) context.getResources().getDimension( - android.R.dimen.notification_large_icon_width); - int mLargeIconHeight = (int) context.getResources().getDimension( - android.R.dimen.notification_large_icon_height); - Drawable d; - if (VERSION.SDK_INT < VERSION_CODES.LOLLIPOP) { - // noinspection deprecation (can't help it at this api level) - d = context.getResources().getDrawable(resId); - } else { - d = context.getDrawable(resId); - } - if (d == null) { - return null; - } - Bitmap b = Bitmap.createBitmap(mLargeIconWidth, mLargeIconHeight, Bitmap.Config.ARGB_8888); - 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); builder.setSmallIcon(R.drawable.ic_stat_notify_24dp) - .setLargeIcon(getBitmap(R.mipmap.ic_launcher, getBaseContext())) + .setLargeIcon(NotificationUtils.getBitmap(R.mipmap.ic_launcher, getBaseContext())) .setContentTitle(getResources().getQuantityString(R.plurals.passp_cache_notif_n_keys, mPassphraseCache.size(), mPassphraseCache.size())) - .setContentText(getString(R.string.passp_cache_notif_click_to_clear)); + .setContentText(getString(R.string.passp_cache_notif_touch_to_clear)); NotificationCompat.InboxStyle inboxStyle = new NotificationCompat.InboxStyle(); -- cgit v1.2.3