Fixed a crash for in-app reminders

pull/14/head
Sam Bosley 13 years ago
parent 668a23ad45
commit 19c26c1539

@ -194,6 +194,7 @@ public class Notifications extends BroadcastReceiver {
notifyIntent.setAction("NOTIFY" + id); //$NON-NLS-1$ notifyIntent.setAction("NOTIFY" + id); //$NON-NLS-1$
notifyIntent.putExtra(TaskListFragment.TOKEN_FILTER, itemFilter); notifyIntent.putExtra(TaskListFragment.TOKEN_FILTER, itemFilter);
notifyIntent.putExtra(NotificationFragment.TOKEN_ID, id);
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
notifyIntent.putExtra(TaskListActivity.TOKEN_SOURCE, Constants.SOURCE_NOTIFICATION); notifyIntent.putExtra(TaskListActivity.TOKEN_SOURCE, Constants.SOURCE_NOTIFICATION);
@ -201,10 +202,11 @@ public class Notifications extends BroadcastReceiver {
return true; return true;
} }
private static void requestNotification(int notificationId, Intent intent, int type, String title, String text, int ringTimes) { private static void requestNotification(long taskId, Intent intent, int type, String title, String text, int ringTimes) {
Context context = ContextManager.getContext(); Context context = ContextManager.getContext();
Intent inAppNotify = new Intent(BROADCAST_IN_APP_NOTIFY); Intent inAppNotify = new Intent(BROADCAST_IN_APP_NOTIFY);
inAppNotify.putExtra(EXTRAS_NOTIF_ID, notificationId); inAppNotify.putExtra(EXTRAS_NOTIF_ID, (int)taskId);
inAppNotify.putExtra(NotificationFragment.TOKEN_ID, taskId);
inAppNotify.putExtra(EXTRAS_CUSTOM_INTENT, intent); inAppNotify.putExtra(EXTRAS_CUSTOM_INTENT, intent);
inAppNotify.putExtra(EXTRAS_TYPE, type); inAppNotify.putExtra(EXTRAS_TYPE, type);
inAppNotify.putExtra(EXTRAS_TITLE, title); inAppNotify.putExtra(EXTRAS_TITLE, title);

@ -332,8 +332,7 @@ public class AstridActivity extends FragmentActivity
@Override @Override
public void onReceive(Context context, final Intent intent) { public void onReceive(Context context, final Intent intent) {
// Process in app notification // Process in app notification
Intent customIntent = intent.getExtras().getParcelable(Notifications.EXTRAS_CUSTOM_INTENT); long taskId = intent.getLongExtra(NotificationFragment.TOKEN_ID, 0);
long taskId = customIntent.getLongExtra(NotificationFragment.TOKEN_ID, 0);
if (taskId > 0) { if (taskId > 0) {
String text = intent.getStringExtra(Notifications.EXTRAS_TEXT); String text = intent.getStringExtra(Notifications.EXTRAS_TEXT);
try { try {

Loading…
Cancel
Save