diff --git a/app/src/dev/AndroidManifest.xml b/app/src/dev/AndroidManifest.xml
index 7c364d0..d0b1ed4 100644
--- a/app/src/dev/AndroidManifest.xml
+++ b/app/src/dev/AndroidManifest.xml
@@ -20,7 +20,7 @@
android:name="io.forsta.relay.receivers.NotificationReplyReceiver"
android:exported="false">
-
+
diff --git a/app/src/main/java/io/forsta/relay/MediaPreviewActivity.java b/app/src/main/java/io/forsta/relay/MediaPreviewActivity.java
index 6020274..dbca9a8 100644
--- a/app/src/main/java/io/forsta/relay/MediaPreviewActivity.java
+++ b/app/src/main/java/io/forsta/relay/MediaPreviewActivity.java
@@ -65,14 +65,12 @@ public class MediaPreviewActivity extends AuthenticationRequiredActionBarActivit
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
- this.setTheme(R.style.Application_LightNoActionBar);
dynamicLanguage.onCreate(this);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.media_preview_activity);
initializeViews();
@@ -97,6 +95,7 @@ private void initializeActionBar() {
getSupportActionBar().setTitle(recipient == null ? getString(R.string.MediaPreviewActivity_you)
: recipient.toShortString());
getSupportActionBar().setSubtitle(relativeTimeSpan);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
diff --git a/app/src/main/java/io/forsta/relay/receivers/NotificationReplyReceiver.java b/app/src/main/java/io/forsta/relay/receivers/NotificationReplyReceiver.java
index f1cb2da..694b45b 100644
--- a/app/src/main/java/io/forsta/relay/receivers/NotificationReplyReceiver.java
+++ b/app/src/main/java/io/forsta/relay/receivers/NotificationReplyReceiver.java
@@ -5,11 +5,25 @@
import android.content.Intent;
import android.util.Log;
-public class NotificationReplyReceiver extends BroadcastReceiver {
+import io.forsta.librelay.notifications.ReplyReceiver;
+import io.forsta.relay.ConversationActivity;
+import io.forsta.relay.ConversationListActivity;
+
+public class NotificationReplyReceiver extends ReplyReceiver {
private static final String TAG = NotificationReplyReceiver.class.getSimpleName();
@Override
public void onReceive(Context context, Intent intent) {
- Log.d(TAG, "notification reply intent received for threadId: " + intent.getLongExtra("thread_id", -1));
+ long threadId = intent.getLongExtra(ReplyReceiver.THREAD_ID, -1);
+ Log.d(TAG, "notification reply intent received for threadId: " + threadId);
+ Intent replyIntent = new Intent();
+ if (threadId == -1) {
+ replyIntent.setClassName(context.getPackageName(), ConversationListActivity.class.getName());
+ } else {
+ replyIntent.setClassName(context.getPackageName(), ConversationActivity.class.getName());
+ replyIntent.putExtra(ConversationActivity.THREAD_ID_EXTRA, threadId);
+ }
+ replyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(replyIntent);
}
}
diff --git a/app/src/prod/AndroidManifest.xml b/app/src/prod/AndroidManifest.xml
index c7fd945..61a0be4 100644
--- a/app/src/prod/AndroidManifest.xml
+++ b/app/src/prod/AndroidManifest.xml
@@ -21,7 +21,7 @@
android:name="io.forsta.relay.receivers.NotificationReplyReceiver"
android:exported="false">
-
+
diff --git a/librelay/dev/AndroidManifest.xml b/librelay/dev/AndroidManifest.xml
index c41a753..94106a3 100644
--- a/librelay/dev/AndroidManifest.xml
+++ b/librelay/dev/AndroidManifest.xml
@@ -42,7 +42,11 @@
-
+
+
+
+
+
@@ -56,7 +60,5 @@
-
-
diff --git a/librelay/prod/AndroidManifest.xml b/librelay/prod/AndroidManifest.xml
index c38f05b..e8c3138 100644
--- a/librelay/prod/AndroidManifest.xml
+++ b/librelay/prod/AndroidManifest.xml
@@ -42,7 +42,11 @@
-
+
+
+
+
+
@@ -56,7 +60,5 @@
-
-
diff --git a/librelay/src/io/forsta/librelay/notifications/AbstractNotificationBuilder.java b/librelay/src/io/forsta/librelay/notifications/AbstractNotificationBuilder.java
index 828a8b1..ad10a95 100644
--- a/librelay/src/io/forsta/librelay/notifications/AbstractNotificationBuilder.java
+++ b/librelay/src/io/forsta/librelay/notifications/AbstractNotificationBuilder.java
@@ -28,6 +28,8 @@ public AbstractNotificationBuilder(Context context, NotificationPrivacyPreferenc
this.context = context;
this.privacy = privacy;
+ setColor(context.getResources().getColor(R.color.textsecure_primary));
+ setSmallIcon(R.drawable.icon_notification);
setChannelId(NotificationChannels.getMessagesChannel(context));
setLed();
}
diff --git a/librelay/src/io/forsta/librelay/notifications/MarkReadReceiver.java b/librelay/src/io/forsta/librelay/notifications/MarkReadReceiver.java
index 344d1f3..1001cbc 100644
--- a/librelay/src/io/forsta/librelay/notifications/MarkReadReceiver.java
+++ b/librelay/src/io/forsta/librelay/notifications/MarkReadReceiver.java
@@ -29,14 +29,13 @@ public class MarkReadReceiver extends BroadcastReceiver {
@Override
public void onReceive(final Context context, Intent intent)
{
+ Log.w(TAG, "Received CLEAR_ACTION");
if (!CLEAR_ACTION.equals(intent.getAction()))
return;
final long[] threadIds = intent.getLongArrayExtra(THREAD_IDS_EXTRA);
if (threadIds != null) {
- Log.w("TAG", "threadIds length: " + threadIds.length);
-
((NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE))
.cancel(MessageNotifier.NOTIFICATION_ID);
diff --git a/librelay/src/io/forsta/librelay/notifications/MessageNotifier.java b/librelay/src/io/forsta/librelay/notifications/MessageNotifier.java
index bbf2c90..4f83290 100644
--- a/librelay/src/io/forsta/librelay/notifications/MessageNotifier.java
+++ b/librelay/src/io/forsta/librelay/notifications/MessageNotifier.java
@@ -159,7 +159,7 @@ private static void sendSingleThreadNotification(@NonNull Context context,
if (timestamp != 0) builder.setWhen(timestamp);
builder.addActions(notificationState.getMarkAsReadIntent(context),
- notificationState.getQuickReplyIntent(context, notifications.get(0).getThreadId()));
+ notificationState.getReplyIntent(context, notifications.get(0).getThreadId()));
ListIterator iterator = notifications.listIterator(notifications.size());
@@ -299,14 +299,6 @@ private static void updateBadge(Context context, int count) {
}
}
- public static class DeleteReceiver extends BroadcastReceiver {
-
- @Override
- public void onReceive(Context context, Intent intent) {
-
- }
- }
-
private static boolean showThreadNotification(Context context, long threadId) {
ThreadPreferenceDatabase.ThreadPreference threadPreference = DbFactory.getThreadPreferenceDatabase(context).getThreadPreferences(threadId);
diff --git a/librelay/src/io/forsta/librelay/notifications/MultipleRecipientNotificationBuilder.java b/librelay/src/io/forsta/librelay/notifications/MultipleRecipientNotificationBuilder.java
index 3d3f408..42c51e2 100644
--- a/librelay/src/io/forsta/librelay/notifications/MultipleRecipientNotificationBuilder.java
+++ b/librelay/src/io/forsta/librelay/notifications/MultipleRecipientNotificationBuilder.java
@@ -23,14 +23,10 @@ public class MultipleRecipientNotificationBuilder extends AbstractNotificationBu
public MultipleRecipientNotificationBuilder(Context context, NotificationPrivacyPreference privacy) {
super(context, privacy);
- setColor(context.getResources().getColor(R.color.textsecure_primary));
- setSmallIcon(R.drawable.icon_notification);
setContentTitle(context.getString(R.string.app_name));
- // TODO Reference to ConversationListActivity needs to be removed
-// setContentIntent(PendingIntent.getActivity(context, 0, new Intent(context, ConversationListActivity.class), 0));
setCategory(NotificationCompat.CATEGORY_MESSAGE);
setPriority(NotificationCompat.PRIORITY_HIGH);
- setDeleteIntent(PendingIntent.getBroadcast(context, 0, new Intent(context, MessageNotifier.DeleteReceiver.class), 0));
+ setContentIntent(PendingIntent.getBroadcast(context, 0, new Intent(context, ReplyReceiver.class), 0));
}
public void setMessageCount(int messageCount, int threadCount) {
diff --git a/librelay/src/io/forsta/librelay/notifications/NotificationState.java b/librelay/src/io/forsta/librelay/notifications/NotificationState.java
index 9f8a23f..44bf419 100644
--- a/librelay/src/io/forsta/librelay/notifications/NotificationState.java
+++ b/librelay/src/io/forsta/librelay/notifications/NotificationState.java
@@ -20,9 +20,6 @@
import io.forsta.librelay.database.RecipientPreferenceDatabase;
public class NotificationState {
-
- private static final String REPLY_EVENT = BuildConfig.APPLICATION_ID + "." + BuildConfig.FLAVOR + ".notifications.REPLY_EVENT";
-
private final LinkedList notifications = new LinkedList<>();
private final LinkedHashSet threads = new LinkedHashSet<>();
private boolean notify = false;
@@ -119,13 +116,12 @@ public PendingIntent getMarkAsReadIntent(Context context) {
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
- public PendingIntent getQuickReplyIntent(Context context, long threadId) {
+ public PendingIntent getReplyIntent(Context context, long threadId) {
if (threads.size() != 1) return null;
- Intent intent = new Intent(REPLY_EVENT);
- intent.putExtra("thread_id", threadId);
+ Intent intent = new Intent(ReplyReceiver.REPLY_ACTION);
+ intent.putExtra(ReplyReceiver.THREAD_ID, threadId);
intent.setPackage(context.getPackageName());
-
return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
}
diff --git a/librelay/src/io/forsta/librelay/notifications/ReplyReceiver.java b/librelay/src/io/forsta/librelay/notifications/ReplyReceiver.java
new file mode 100644
index 0000000..c9f827b
--- /dev/null
+++ b/librelay/src/io/forsta/librelay/notifications/ReplyReceiver.java
@@ -0,0 +1,20 @@
+package io.forsta.librelay.notifications;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+import io.forsta.librelay.BuildConfig;
+
+public class ReplyReceiver extends BroadcastReceiver {
+ private static final String TAG = ReplyReceiver.class.getSimpleName();
+
+ public static final String REPLY_ACTION = BuildConfig.APPLICATION_ID + "." + BuildConfig.FLAVOR + ".notifications.REPLY";
+ public static final String THREAD_ID = "thread_id";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.w(TAG, "onReceive");
+ }
+}
diff --git a/librelay/src/io/forsta/librelay/notifications/SingleRecipientNotificationBuilder.java b/librelay/src/io/forsta/librelay/notifications/SingleRecipientNotificationBuilder.java
index 0c3b141..bc24ca0 100644
--- a/librelay/src/io/forsta/librelay/notifications/SingleRecipientNotificationBuilder.java
+++ b/librelay/src/io/forsta/librelay/notifications/SingleRecipientNotificationBuilder.java
@@ -47,9 +47,6 @@ public SingleRecipientNotificationBuilder(@NonNull Context context,
@NonNull NotificationPrivacyPreference privacy)
{
super(context, privacy);
-
- setSmallIcon(R.drawable.icon_notification);
- setColor(context.getResources().getColor(R.color.textsecure_primary));
setCategory(NotificationCompat.CATEGORY_MESSAGE);
if (!NotificationChannels.supported()) {