Loading QKSMS/src/main/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -348,7 +348,7 @@ <activity android:name=".ui.mms.SlideshowActivity" /> <receiver android:name=".receiver.WearableIntentReceiver" android:name=".receiver.RemoteMessagingReceiver" android:exported="false"> <intent-filter> <action android:name="com.moez.QKSMS.receiver.WearableIntentReceiver.REPLY" /> Loading QKSMS/src/main/java/com/moez/QKSMS/enums/QKPreference.java +2 −1 Original line number Diff line number Diff line package com.moez.QKSMS.enums; import android.os.Build; import com.moez.QKSMS.ui.ThemeManager; import java.util.Arrays; Loading Loading @@ -85,7 +86,7 @@ public enum QKPreference { MMS_PROXY("mms_proxy", true), // QK Reply QK_REPLY("pref_key_quickreply_enabled", true), QK_REPLY("pref_key_quickreply_enabled", Build.VERSION.SDK_INT < 23), TAP_DISMISS("pref_key_quickreply_dismiss", true), // QK Compose Loading QKSMS/src/main/java/com/moez/QKSMS/receiver/WearableIntentReceiver.java→QKSMS/src/main/java/com/moez/QKSMS/receiver/RemoteMessagingReceiver.java +46 −48 Original line number Diff line number Diff line Loading @@ -13,11 +13,10 @@ import android.preference.PreferenceManager; import android.support.v4.app.NotificationCompat; import android.support.v4.app.RemoteInput; import android.view.Gravity; import com.moez.QKSMS.mmssms.Message; import com.moez.QKSMS.mmssms.Transaction; import com.moez.QKSMS.R; import com.moez.QKSMS.data.ContactHelper; import com.moez.QKSMS.mmssms.Message; import com.moez.QKSMS.mmssms.Transaction; import com.moez.QKSMS.service.MarkReadService; import com.moez.QKSMS.transaction.NotificationManager; import com.moez.QKSMS.transaction.SmsHelper; Loading @@ -33,7 +32,7 @@ import java.util.Set; import static android.support.v4.app.NotificationCompat.BigTextStyle; import static android.support.v4.app.NotificationCompat.WearableExtender; public class WearableIntentReceiver extends BroadcastReceiver { public class RemoteMessagingReceiver extends BroadcastReceiver { public static final String ACTION_REPLY = "com.moez.QKSMS.receiver.WearableIntentReceiver.REPLY"; Loading @@ -41,8 +40,29 @@ public class WearableIntentReceiver extends BroadcastReceiver { public static final String EXTRA_THREAD_ID = "thread_id"; public static final String EXTRA_VOICE_REPLY = "voice_reply"; public static WearableExtender getSingleConversationExtender(Context context, String name, String address, long threadId) { @Override public void onReceive(Context context, Intent intent) { Bundle remoteInput = RemoteInput.getResultsFromIntent(intent); Bundle bundle = intent.getExtras(); if (remoteInput != null && bundle != null) { if (intent.getAction().equals(ACTION_REPLY)) { Message message = new Message( remoteInput.getCharSequence(EXTRA_VOICE_REPLY).toString(), new String[]{bundle.getString(EXTRA_ADDRESS)} ); Transaction sendTransaction = new Transaction(context, SmsHelper.getSendSettings(context)); sendTransaction.sendNewMessage(message, bundle.getLong(EXTRA_THREAD_ID)); Intent i = new Intent(context, MarkReadService.class); i.putExtra(EXTRA_THREAD_ID, bundle.getLong(EXTRA_THREAD_ID)); context.startService(i); } } } public static WearableExtender getConversationExtender(Context context, String name, String address, long threadId) { WearableExtender wearableExtender = new WearableExtender(); wearableExtender.setGravity(Gravity.BOTTOM); wearableExtender.setStartScrollBottom(true); Loading Loading @@ -77,32 +97,7 @@ public class WearableIntentReceiver extends BroadcastReceiver { wearableExtender.addPage(chatPage); } Intent replyIntent = new Intent(ACTION_REPLY).setClass(context, WearableIntentReceiver.class); replyIntent.putExtra(EXTRA_ADDRESS, address); replyIntent.putExtra(EXTRA_THREAD_ID, threadId); Set<String> defaultResponses = new HashSet<>(Arrays.asList(context.getResources().getStringArray(R.array.qk_responses))); Set<String> responseSet = prefs.getStringSet(SettingsFragment.QK_RESPONSES, defaultResponses); ArrayList<String> responses = new ArrayList<String>(); responses.addAll(responseSet); Collections.sort(responses); PendingIntent replyPI = PendingIntent.getBroadcast(context, 0, replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY) .setLabel(context.getString(R.string.reply)) .setChoices(responses.toArray(new String[responses.size()])) .build(); NotificationCompat.Action replyAction = new NotificationCompat.Action.Builder( R.drawable.ic_reply, context.getString(R.string.reply_qksms), replyPI) .addRemoteInput(remoteInput) .build(); wearableExtender.addAction(replyAction); wearableExtender.addAction(getReplyAction(context, address, threadId)); Intent readIntent = new Intent(NotificationManager.ACTION_MARK_READ); readIntent.putExtra(EXTRA_THREAD_ID, threadId); Loading @@ -119,26 +114,29 @@ public class WearableIntentReceiver extends BroadcastReceiver { return wearableExtender; } @Override public void onReceive(Context context, Intent intent) { public static NotificationCompat.Action getReplyAction(Context context, String address, long threadId) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Bundle remoteInput = RemoteInput.getResultsFromIntent(intent); Bundle bundle = intent.getExtras(); if (remoteInput != null && bundle != null) { if (intent.getAction().equals(ACTION_REPLY)) { Intent replyIntent = new Intent(ACTION_REPLY).setClass(context, RemoteMessagingReceiver.class); replyIntent.putExtra(EXTRA_ADDRESS, address); replyIntent.putExtra(EXTRA_THREAD_ID, threadId); Message message = new Message( remoteInput.getCharSequence(EXTRA_VOICE_REPLY).toString(), new String[]{bundle.getString(EXTRA_ADDRESS)} ); Set<String> defaultResponses = new HashSet<>(Arrays.asList(context.getResources().getStringArray(R.array.qk_responses))); Set<String> responseSet = prefs.getStringSet(SettingsFragment.QK_RESPONSES, defaultResponses); ArrayList<String> responses = new ArrayList<>(); responses.addAll(responseSet); Collections.sort(responses); Transaction sendTransaction = new Transaction(context, SmsHelper.getSendSettings(context)); sendTransaction.sendNewMessage(message, bundle.getLong(EXTRA_THREAD_ID)); PendingIntent replyPI = PendingIntent.getBroadcast(context, 0, replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY) .setLabel(context.getString(R.string.reply)) .setChoices(responses.toArray(new String[responses.size()])) .build(); Intent i = new Intent(context, MarkReadService.class); i.putExtra(EXTRA_THREAD_ID, bundle.getLong(EXTRA_THREAD_ID)); context.startService(i); } } return new NotificationCompat.Action.Builder( R.drawable.ic_reply, context.getString(R.string.reply), replyPI) .addRemoteInput(remoteInput) .build(); } } QKSMS/src/main/java/com/moez/QKSMS/service/NotificationService.java +2 −1 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import android.content.SharedPreferences; import android.database.Cursor; import android.graphics.Bitmap; import android.net.Uri; import android.os.Build; import android.os.IBinder; import android.preference.PreferenceManager; import com.moez.QKSMS.common.ConversationPrefsHelper; Loading Loading @@ -53,7 +54,7 @@ public class NotificationService extends Service { if (conversationPrefs.getNotificationsEnabled()) { // Only show QuickReply if we're outside of the app, and they have popups and QuickReply enabled. if (!LifecycleHandler.isApplicationVisible() && intent.getBooleanExtra(EXTRA_POPUP, false) && prefs.getBoolean(SettingsFragment.QUICKREPLY, true)) { intent.getBooleanExtra(EXTRA_POPUP, false) && prefs.getBoolean(SettingsFragment.QUICKREPLY, Build.VERSION.SDK_INT < 23)) { popupIntent = new Intent(context, QKReplyActivity.class); popupIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Loading QKSMS/src/main/java/com/moez/QKSMS/transaction/NotificationManager.java +31 −22 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.provider.Telephony; import android.support.v4.app.NotificationCompat; import android.text.Html; import android.util.Log; import com.android.mms.transaction.TransactionService; import com.android.mms.transaction.TransactionState; import com.google.android.mms.pdu_alt.PduHeaders; Loading @@ -35,7 +34,7 @@ import com.moez.QKSMS.data.ContactHelper; import com.moez.QKSMS.data.Message; import com.moez.QKSMS.model.ImageModel; import com.moez.QKSMS.model.SlideshowModel; import com.moez.QKSMS.receiver.WearableIntentReceiver; import com.moez.QKSMS.receiver.RemoteMessagingReceiver; import com.moez.QKSMS.ui.MainActivity; import com.moez.QKSMS.ui.ThemeManager; import com.moez.QKSMS.ui.messagelist.MessageItem; Loading Loading @@ -469,12 +468,6 @@ public class NotificationManager { MessageItem message = messages.get(0); Intent replyIntent = new Intent(context, QKReplyActivity.class); replyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); replyIntent.putExtra(QKReplyActivity.EXTRA_THREAD_ID, threadId); replyIntent.putExtra(QKReplyActivity.EXTRA_SHOW_KEYBOARD, true); final PendingIntent replyPI = PendingIntent.getActivity(context, buildRequestCode(threadId, 0), replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); Intent threadIntent = new Intent(context, MainActivity.class); threadIntent.putExtra(MessageListActivity.ARG_THREAD_ID, threadId); final PendingIntent threadPI = PendingIntent.getActivity(context, buildRequestCode(threadId, 1), threadIntent, PendingIntent.FLAG_UPDATE_CURRENT); Loading Loading @@ -517,10 +510,21 @@ public class NotificationManager { .setNumber(unreadMessageCount) .setStyle(nstyle) .setColor(ThemeManager.getColor()) .addAction(R.drawable.ic_reply, sRes.getString(R.string.reply), replyPI) .addAction(R.drawable.ic_accept, sRes.getString(R.string.read), readPI) .extend(WearableIntentReceiver.getSingleConversationExtender(context, message.mContact, message.mAddress, threadId)) .extend(RemoteMessagingReceiver.getConversationExtender(context, message.mContact, message.mAddress, threadId)) .setDeleteIntent(seenPI); if (Build.VERSION.SDK_INT < 23) { Intent replyIntent = new Intent(context, QKReplyActivity.class); replyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); replyIntent.putExtra(QKReplyActivity.EXTRA_THREAD_ID, threadId); replyIntent.putExtra(QKReplyActivity.EXTRA_SHOW_KEYBOARD, true); PendingIntent replyPI = PendingIntent.getActivity(context, buildRequestCode(threadId, 0), replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(R.drawable.ic_reply, sRes.getString(R.string.reply), replyPI); } else { builder.addAction(RemoteMessagingReceiver.getReplyAction(context, message.mAddress, threadId)); } if (conversationPrefs.getDimissedReadEnabled()) { builder.setDeleteIntent(readPI); } Loading Loading @@ -570,12 +574,6 @@ public class NotificationManager { MessageItem message = messages.get(0); Intent replyIntent = new Intent(context, QKReplyActivity.class); replyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); replyIntent.putExtra(QKReplyActivity.EXTRA_THREAD_ID, threadId); replyIntent.putExtra(QKReplyActivity.EXTRA_SHOW_KEYBOARD, true); PendingIntent replyPI = PendingIntent.getActivity(context, buildRequestCode(threadId, 0), replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); Intent threadIntent = new Intent(context, MainActivity.class); threadIntent.putExtra(MessageListActivity.ARG_THREAD_ID, threadId); PendingIntent threadPI = PendingIntent.getActivity(context, buildRequestCode(threadId, 1), threadIntent, PendingIntent.FLAG_UPDATE_CURRENT); Loading Loading @@ -605,11 +603,21 @@ public class NotificationManager { .setNumber(unreadMessageCount) .setStyle(inboxStyle) .setColor(ThemeManager.getColor()) .addAction(R.drawable.ic_reply, sRes.getString(R.string.reply), replyPI) .addAction(R.drawable.ic_accept, sRes.getString(R.string.read), readPI) .extend(WearableIntentReceiver.getSingleConversationExtender(context, message.mContact, message.mAddress, threadId)) .extend(RemoteMessagingReceiver.getConversationExtender(context, message.mContact, message.mAddress, threadId)) .setDeleteIntent(seenPI); if (Build.VERSION.SDK_INT < 23) { Intent replyIntent = new Intent(context, QKReplyActivity.class); replyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); replyIntent.putExtra(QKReplyActivity.EXTRA_THREAD_ID, threadId); replyIntent.putExtra(QKReplyActivity.EXTRA_SHOW_KEYBOARD, true); PendingIntent replyPI = PendingIntent.getActivity(context, buildRequestCode(threadId, 0), replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(R.drawable.ic_reply, sRes.getString(R.string.reply), replyPI); } else { builder.addAction(RemoteMessagingReceiver.getReplyAction(context, message.mAddress, threadId)); } if (conversationPrefs.getCallButtonEnabled()) { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + message.mAddress)); Loading @@ -624,6 +632,7 @@ public class NotificationManager { * Creates a unique action ID for notification actions (Open, Mark read, Call, etc) */ private static int buildRequestCode(long threadId, int action) { action++; // Fixes issue on some 4.3 phones | http://stackoverflow.com/questions/19031861/pendingintent-not-opening-activity-in-android-4-3 return (int) (action * 100000 + threadId); } Loading Loading @@ -740,7 +749,7 @@ public class NotificationManager { */ private static int getNotificationPriority(Context context) { boolean qkreplyEnabled = PreferenceManager.getDefaultSharedPreferences(context) .getBoolean(SettingsFragment.QUICKREPLY, true); .getBoolean(SettingsFragment.QUICKREPLY, Build.VERSION.SDK_INT < 23); if (qkreplyEnabled) { return NotificationCompat.PRIORITY_DEFAULT; } else { Loading Loading
QKSMS/src/main/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -348,7 +348,7 @@ <activity android:name=".ui.mms.SlideshowActivity" /> <receiver android:name=".receiver.WearableIntentReceiver" android:name=".receiver.RemoteMessagingReceiver" android:exported="false"> <intent-filter> <action android:name="com.moez.QKSMS.receiver.WearableIntentReceiver.REPLY" /> Loading
QKSMS/src/main/java/com/moez/QKSMS/enums/QKPreference.java +2 −1 Original line number Diff line number Diff line package com.moez.QKSMS.enums; import android.os.Build; import com.moez.QKSMS.ui.ThemeManager; import java.util.Arrays; Loading Loading @@ -85,7 +86,7 @@ public enum QKPreference { MMS_PROXY("mms_proxy", true), // QK Reply QK_REPLY("pref_key_quickreply_enabled", true), QK_REPLY("pref_key_quickreply_enabled", Build.VERSION.SDK_INT < 23), TAP_DISMISS("pref_key_quickreply_dismiss", true), // QK Compose Loading
QKSMS/src/main/java/com/moez/QKSMS/receiver/WearableIntentReceiver.java→QKSMS/src/main/java/com/moez/QKSMS/receiver/RemoteMessagingReceiver.java +46 −48 Original line number Diff line number Diff line Loading @@ -13,11 +13,10 @@ import android.preference.PreferenceManager; import android.support.v4.app.NotificationCompat; import android.support.v4.app.RemoteInput; import android.view.Gravity; import com.moez.QKSMS.mmssms.Message; import com.moez.QKSMS.mmssms.Transaction; import com.moez.QKSMS.R; import com.moez.QKSMS.data.ContactHelper; import com.moez.QKSMS.mmssms.Message; import com.moez.QKSMS.mmssms.Transaction; import com.moez.QKSMS.service.MarkReadService; import com.moez.QKSMS.transaction.NotificationManager; import com.moez.QKSMS.transaction.SmsHelper; Loading @@ -33,7 +32,7 @@ import java.util.Set; import static android.support.v4.app.NotificationCompat.BigTextStyle; import static android.support.v4.app.NotificationCompat.WearableExtender; public class WearableIntentReceiver extends BroadcastReceiver { public class RemoteMessagingReceiver extends BroadcastReceiver { public static final String ACTION_REPLY = "com.moez.QKSMS.receiver.WearableIntentReceiver.REPLY"; Loading @@ -41,8 +40,29 @@ public class WearableIntentReceiver extends BroadcastReceiver { public static final String EXTRA_THREAD_ID = "thread_id"; public static final String EXTRA_VOICE_REPLY = "voice_reply"; public static WearableExtender getSingleConversationExtender(Context context, String name, String address, long threadId) { @Override public void onReceive(Context context, Intent intent) { Bundle remoteInput = RemoteInput.getResultsFromIntent(intent); Bundle bundle = intent.getExtras(); if (remoteInput != null && bundle != null) { if (intent.getAction().equals(ACTION_REPLY)) { Message message = new Message( remoteInput.getCharSequence(EXTRA_VOICE_REPLY).toString(), new String[]{bundle.getString(EXTRA_ADDRESS)} ); Transaction sendTransaction = new Transaction(context, SmsHelper.getSendSettings(context)); sendTransaction.sendNewMessage(message, bundle.getLong(EXTRA_THREAD_ID)); Intent i = new Intent(context, MarkReadService.class); i.putExtra(EXTRA_THREAD_ID, bundle.getLong(EXTRA_THREAD_ID)); context.startService(i); } } } public static WearableExtender getConversationExtender(Context context, String name, String address, long threadId) { WearableExtender wearableExtender = new WearableExtender(); wearableExtender.setGravity(Gravity.BOTTOM); wearableExtender.setStartScrollBottom(true); Loading Loading @@ -77,32 +97,7 @@ public class WearableIntentReceiver extends BroadcastReceiver { wearableExtender.addPage(chatPage); } Intent replyIntent = new Intent(ACTION_REPLY).setClass(context, WearableIntentReceiver.class); replyIntent.putExtra(EXTRA_ADDRESS, address); replyIntent.putExtra(EXTRA_THREAD_ID, threadId); Set<String> defaultResponses = new HashSet<>(Arrays.asList(context.getResources().getStringArray(R.array.qk_responses))); Set<String> responseSet = prefs.getStringSet(SettingsFragment.QK_RESPONSES, defaultResponses); ArrayList<String> responses = new ArrayList<String>(); responses.addAll(responseSet); Collections.sort(responses); PendingIntent replyPI = PendingIntent.getBroadcast(context, 0, replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY) .setLabel(context.getString(R.string.reply)) .setChoices(responses.toArray(new String[responses.size()])) .build(); NotificationCompat.Action replyAction = new NotificationCompat.Action.Builder( R.drawable.ic_reply, context.getString(R.string.reply_qksms), replyPI) .addRemoteInput(remoteInput) .build(); wearableExtender.addAction(replyAction); wearableExtender.addAction(getReplyAction(context, address, threadId)); Intent readIntent = new Intent(NotificationManager.ACTION_MARK_READ); readIntent.putExtra(EXTRA_THREAD_ID, threadId); Loading @@ -119,26 +114,29 @@ public class WearableIntentReceiver extends BroadcastReceiver { return wearableExtender; } @Override public void onReceive(Context context, Intent intent) { public static NotificationCompat.Action getReplyAction(Context context, String address, long threadId) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Bundle remoteInput = RemoteInput.getResultsFromIntent(intent); Bundle bundle = intent.getExtras(); if (remoteInput != null && bundle != null) { if (intent.getAction().equals(ACTION_REPLY)) { Intent replyIntent = new Intent(ACTION_REPLY).setClass(context, RemoteMessagingReceiver.class); replyIntent.putExtra(EXTRA_ADDRESS, address); replyIntent.putExtra(EXTRA_THREAD_ID, threadId); Message message = new Message( remoteInput.getCharSequence(EXTRA_VOICE_REPLY).toString(), new String[]{bundle.getString(EXTRA_ADDRESS)} ); Set<String> defaultResponses = new HashSet<>(Arrays.asList(context.getResources().getStringArray(R.array.qk_responses))); Set<String> responseSet = prefs.getStringSet(SettingsFragment.QK_RESPONSES, defaultResponses); ArrayList<String> responses = new ArrayList<>(); responses.addAll(responseSet); Collections.sort(responses); Transaction sendTransaction = new Transaction(context, SmsHelper.getSendSettings(context)); sendTransaction.sendNewMessage(message, bundle.getLong(EXTRA_THREAD_ID)); PendingIntent replyPI = PendingIntent.getBroadcast(context, 0, replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY) .setLabel(context.getString(R.string.reply)) .setChoices(responses.toArray(new String[responses.size()])) .build(); Intent i = new Intent(context, MarkReadService.class); i.putExtra(EXTRA_THREAD_ID, bundle.getLong(EXTRA_THREAD_ID)); context.startService(i); } } return new NotificationCompat.Action.Builder( R.drawable.ic_reply, context.getString(R.string.reply), replyPI) .addRemoteInput(remoteInput) .build(); } }
QKSMS/src/main/java/com/moez/QKSMS/service/NotificationService.java +2 −1 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ import android.content.SharedPreferences; import android.database.Cursor; import android.graphics.Bitmap; import android.net.Uri; import android.os.Build; import android.os.IBinder; import android.preference.PreferenceManager; import com.moez.QKSMS.common.ConversationPrefsHelper; Loading Loading @@ -53,7 +54,7 @@ public class NotificationService extends Service { if (conversationPrefs.getNotificationsEnabled()) { // Only show QuickReply if we're outside of the app, and they have popups and QuickReply enabled. if (!LifecycleHandler.isApplicationVisible() && intent.getBooleanExtra(EXTRA_POPUP, false) && prefs.getBoolean(SettingsFragment.QUICKREPLY, true)) { intent.getBooleanExtra(EXTRA_POPUP, false) && prefs.getBoolean(SettingsFragment.QUICKREPLY, Build.VERSION.SDK_INT < 23)) { popupIntent = new Intent(context, QKReplyActivity.class); popupIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Loading
QKSMS/src/main/java/com/moez/QKSMS/transaction/NotificationManager.java +31 −22 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.provider.Telephony; import android.support.v4.app.NotificationCompat; import android.text.Html; import android.util.Log; import com.android.mms.transaction.TransactionService; import com.android.mms.transaction.TransactionState; import com.google.android.mms.pdu_alt.PduHeaders; Loading @@ -35,7 +34,7 @@ import com.moez.QKSMS.data.ContactHelper; import com.moez.QKSMS.data.Message; import com.moez.QKSMS.model.ImageModel; import com.moez.QKSMS.model.SlideshowModel; import com.moez.QKSMS.receiver.WearableIntentReceiver; import com.moez.QKSMS.receiver.RemoteMessagingReceiver; import com.moez.QKSMS.ui.MainActivity; import com.moez.QKSMS.ui.ThemeManager; import com.moez.QKSMS.ui.messagelist.MessageItem; Loading Loading @@ -469,12 +468,6 @@ public class NotificationManager { MessageItem message = messages.get(0); Intent replyIntent = new Intent(context, QKReplyActivity.class); replyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); replyIntent.putExtra(QKReplyActivity.EXTRA_THREAD_ID, threadId); replyIntent.putExtra(QKReplyActivity.EXTRA_SHOW_KEYBOARD, true); final PendingIntent replyPI = PendingIntent.getActivity(context, buildRequestCode(threadId, 0), replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); Intent threadIntent = new Intent(context, MainActivity.class); threadIntent.putExtra(MessageListActivity.ARG_THREAD_ID, threadId); final PendingIntent threadPI = PendingIntent.getActivity(context, buildRequestCode(threadId, 1), threadIntent, PendingIntent.FLAG_UPDATE_CURRENT); Loading Loading @@ -517,10 +510,21 @@ public class NotificationManager { .setNumber(unreadMessageCount) .setStyle(nstyle) .setColor(ThemeManager.getColor()) .addAction(R.drawable.ic_reply, sRes.getString(R.string.reply), replyPI) .addAction(R.drawable.ic_accept, sRes.getString(R.string.read), readPI) .extend(WearableIntentReceiver.getSingleConversationExtender(context, message.mContact, message.mAddress, threadId)) .extend(RemoteMessagingReceiver.getConversationExtender(context, message.mContact, message.mAddress, threadId)) .setDeleteIntent(seenPI); if (Build.VERSION.SDK_INT < 23) { Intent replyIntent = new Intent(context, QKReplyActivity.class); replyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); replyIntent.putExtra(QKReplyActivity.EXTRA_THREAD_ID, threadId); replyIntent.putExtra(QKReplyActivity.EXTRA_SHOW_KEYBOARD, true); PendingIntent replyPI = PendingIntent.getActivity(context, buildRequestCode(threadId, 0), replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(R.drawable.ic_reply, sRes.getString(R.string.reply), replyPI); } else { builder.addAction(RemoteMessagingReceiver.getReplyAction(context, message.mAddress, threadId)); } if (conversationPrefs.getDimissedReadEnabled()) { builder.setDeleteIntent(readPI); } Loading Loading @@ -570,12 +574,6 @@ public class NotificationManager { MessageItem message = messages.get(0); Intent replyIntent = new Intent(context, QKReplyActivity.class); replyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); replyIntent.putExtra(QKReplyActivity.EXTRA_THREAD_ID, threadId); replyIntent.putExtra(QKReplyActivity.EXTRA_SHOW_KEYBOARD, true); PendingIntent replyPI = PendingIntent.getActivity(context, buildRequestCode(threadId, 0), replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); Intent threadIntent = new Intent(context, MainActivity.class); threadIntent.putExtra(MessageListActivity.ARG_THREAD_ID, threadId); PendingIntent threadPI = PendingIntent.getActivity(context, buildRequestCode(threadId, 1), threadIntent, PendingIntent.FLAG_UPDATE_CURRENT); Loading Loading @@ -605,11 +603,21 @@ public class NotificationManager { .setNumber(unreadMessageCount) .setStyle(inboxStyle) .setColor(ThemeManager.getColor()) .addAction(R.drawable.ic_reply, sRes.getString(R.string.reply), replyPI) .addAction(R.drawable.ic_accept, sRes.getString(R.string.read), readPI) .extend(WearableIntentReceiver.getSingleConversationExtender(context, message.mContact, message.mAddress, threadId)) .extend(RemoteMessagingReceiver.getConversationExtender(context, message.mContact, message.mAddress, threadId)) .setDeleteIntent(seenPI); if (Build.VERSION.SDK_INT < 23) { Intent replyIntent = new Intent(context, QKReplyActivity.class); replyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); replyIntent.putExtra(QKReplyActivity.EXTRA_THREAD_ID, threadId); replyIntent.putExtra(QKReplyActivity.EXTRA_SHOW_KEYBOARD, true); PendingIntent replyPI = PendingIntent.getActivity(context, buildRequestCode(threadId, 0), replyIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.addAction(R.drawable.ic_reply, sRes.getString(R.string.reply), replyPI); } else { builder.addAction(RemoteMessagingReceiver.getReplyAction(context, message.mAddress, threadId)); } if (conversationPrefs.getCallButtonEnabled()) { Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:" + message.mAddress)); Loading @@ -624,6 +632,7 @@ public class NotificationManager { * Creates a unique action ID for notification actions (Open, Mark read, Call, etc) */ private static int buildRequestCode(long threadId, int action) { action++; // Fixes issue on some 4.3 phones | http://stackoverflow.com/questions/19031861/pendingintent-not-opening-activity-in-android-4-3 return (int) (action * 100000 + threadId); } Loading Loading @@ -740,7 +749,7 @@ public class NotificationManager { */ private static int getNotificationPriority(Context context) { boolean qkreplyEnabled = PreferenceManager.getDefaultSharedPreferences(context) .getBoolean(SettingsFragment.QUICKREPLY, true); .getBoolean(SettingsFragment.QUICKREPLY, Build.VERSION.SDK_INT < 23); if (qkreplyEnabled) { return NotificationCompat.PRIORITY_DEFAULT; } else { Loading