diff --git a/res/drawable-hdpi/icon_cached.png b/res/drawable-hdpi/icon_cached.png index 48edf531d3..50f56b7a52 100644 Binary files a/res/drawable-hdpi/icon_cached.png and b/res/drawable-hdpi/icon_cached.png differ diff --git a/res/drawable-hdpi/icon_lock.png b/res/drawable-hdpi/icon_lock.png new file mode 100644 index 0000000000..48edf531d3 Binary files /dev/null and b/res/drawable-hdpi/icon_lock.png differ diff --git a/res/drawable-hdpi/notify_panel_notification_icon_bg.png b/res/drawable-hdpi/notify_panel_notification_icon_bg.png new file mode 100644 index 0000000000..6f37a22d55 Binary files /dev/null and b/res/drawable-hdpi/notify_panel_notification_icon_bg.png differ diff --git a/res/drawable-mdpi/icon_cached.png b/res/drawable-mdpi/icon_cached.png index 4e3653e77f..a79e595e62 100644 Binary files a/res/drawable-mdpi/icon_cached.png and b/res/drawable-mdpi/icon_cached.png differ diff --git a/res/drawable-mdpi/icon_lock.png b/res/drawable-mdpi/icon_lock.png new file mode 100644 index 0000000000..4e3653e77f Binary files /dev/null and b/res/drawable-mdpi/icon_lock.png differ diff --git a/res/drawable-mdpi/notify_panel_notification_icon_bg.png b/res/drawable-mdpi/notify_panel_notification_icon_bg.png new file mode 100644 index 0000000000..c286875aa7 Binary files /dev/null and b/res/drawable-mdpi/notify_panel_notification_icon_bg.png differ diff --git a/res/drawable-xhdpi/icon_cached.png b/res/drawable-xhdpi/icon_cached.png index 5236455f98..f635ea8157 100644 Binary files a/res/drawable-xhdpi/icon_cached.png and b/res/drawable-xhdpi/icon_cached.png differ diff --git a/res/drawable-xhdpi/icon_lock.png b/res/drawable-xhdpi/icon_lock.png new file mode 100644 index 0000000000..5236455f98 Binary files /dev/null and b/res/drawable-xhdpi/icon_lock.png differ diff --git a/res/drawable-xhdpi/notify_panel_notification_icon_bg.png b/res/drawable-xhdpi/notify_panel_notification_icon_bg.png new file mode 100644 index 0000000000..9128e62bbc Binary files /dev/null and b/res/drawable-xhdpi/notify_panel_notification_icon_bg.png differ diff --git a/res/drawable/notify_panel_notification_icon_bg_tile.xml b/res/drawable/notify_panel_notification_icon_bg_tile.xml new file mode 100644 index 0000000000..57c4b085b3 --- /dev/null +++ b/res/drawable/notify_panel_notification_icon_bg_tile.xml @@ -0,0 +1,21 @@ + + + + diff --git a/res/layout/key_caching_notification.xml b/res/layout/key_caching_notification.xml new file mode 100644 index 0000000000..ba63ede6a8 --- /dev/null +++ b/res/layout/key_caching_notification.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/res/values-v9/styles.xml b/res/values-v9/styles.xml new file mode 100644 index 0000000000..736e77a5d6 --- /dev/null +++ b/res/values-v9/styles.xml @@ -0,0 +1,5 @@ + + + - \ No newline at end of file + + + + + + + diff --git a/src/org/thoughtcrime/securesms/service/KeyCachingService.java b/src/org/thoughtcrime/securesms/service/KeyCachingService.java index d7f42a7711..1ca2cc23ea 100644 --- a/src/org/thoughtcrime/securesms/service/KeyCachingService.java +++ b/src/org/thoughtcrime/securesms/service/KeyCachingService.java @@ -23,10 +23,12 @@ import android.app.Service; import android.content.Intent; import android.content.SharedPreferences; import android.os.Binder; +import android.os.Build; import android.os.IBinder; import android.os.SystemClock; import android.preference.PreferenceManager; import android.util.Log; +import android.widget.RemoteViews; import org.thoughtcrime.securesms.ApplicationPreferencesActivity; import org.thoughtcrime.securesms.ConversationListActivity; @@ -141,19 +143,39 @@ public class KeyCachingService extends Service { } } - private void foregroundService() { + private void foregroundServiceModern() { + Notification notification = new Notification(R.drawable.icon_cached, null, System.currentTimeMillis()); + RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.key_caching_notification); + + Intent intent = new Intent(this, KeyCachingService.class); + intent.setAction(PASSPHRASE_EXPIRED_EVENT); + PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 0, intent, 0); + remoteViews.setOnClickPendingIntent(R.id.lock_cache_icon, pendingIntent); + + notification.contentView = remoteViews; + + stopForeground(true); + startForeground(SERVICE_RUNNING_ID, notification); + } + + private void foregroundServiceLegacy() { Notification notification = new Notification(R.drawable.icon_cached, getString(R.string.textsecure_passphrase_cached), System.currentTimeMillis()); Intent intent = new Intent(this, ConversationListActivity.class); PendingIntent launchIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0); - notification.setLatestEventInfo(getApplicationContext(), getString(R.string.textsecure_cached), + notification.setLatestEventInfo(getApplicationContext(), getString(R.string.passphrase_cached), getString(R.string.textsecure_passphrase_cached), launchIntent); stopForeground(true); startForeground(SERVICE_RUNNING_ID, notification); } + private void foregroundService() { + if (Build.VERSION.SDK_INT >= 11) foregroundServiceModern(); + else foregroundServiceLegacy(); + } + private void broadcastNewSecret() { Log.w("service", "Broadcasting new secret..."); Intent intent = new Intent(NEW_KEY_EVENT);