mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Make checkmark widgets work again
This commit is contained in:
@@ -173,10 +173,11 @@ public class HabitBroadcastReceiver extends BroadcastReceiver
|
|||||||
contentIntent.setData(data);
|
contentIntent.setData(data);
|
||||||
PendingIntent contentPendingIntent =
|
PendingIntent contentPendingIntent =
|
||||||
PendingIntent.getActivity(context, 0, contentIntent,
|
PendingIntent.getActivity(context, 0, contentIntent,
|
||||||
PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
PendingIntent dismissPendingIntent = buildDismissIntent(context);
|
PendingIntent dismissPendingIntent = buildDismissIntent(context);
|
||||||
PendingIntent checkIntentPending = buildCheckIntent(context, habit, timestamp);
|
PendingIntent checkIntentPending = buildCheckIntent(context,
|
||||||
|
habit, timestamp, 1);
|
||||||
PendingIntent snoozeIntentPending = buildSnoozeIntent(context, habit);
|
PendingIntent snoozeIntentPending = buildSnoozeIntent(context, habit);
|
||||||
|
|
||||||
Uri ringtoneUri = ReminderHelper.getRingtoneUri(context);
|
Uri ringtoneUri = ReminderHelper.getRingtoneUri(context);
|
||||||
@@ -223,18 +224,20 @@ public class HabitBroadcastReceiver extends BroadcastReceiver
|
|||||||
Intent snoozeIntent = new Intent(context, HabitBroadcastReceiver.class);
|
Intent snoozeIntent = new Intent(context, HabitBroadcastReceiver.class);
|
||||||
snoozeIntent.setData(data);
|
snoozeIntent.setData(data);
|
||||||
snoozeIntent.setAction(ACTION_SNOOZE);
|
snoozeIntent.setAction(ACTION_SNOOZE);
|
||||||
return PendingIntent.getBroadcast(context, 0, snoozeIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
return PendingIntent.getBroadcast(context, 0, snoozeIntent,
|
||||||
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PendingIntent buildCheckIntent(Context context, Habit habit, Long timestamp)
|
public static PendingIntent buildCheckIntent(Context context, Habit
|
||||||
|
habit, Long timestamp, int requestCode)
|
||||||
{
|
{
|
||||||
Uri data = habit.getUri();
|
Uri data = habit.getUri();
|
||||||
Intent checkIntent = new Intent(context, HabitBroadcastReceiver.class);
|
Intent checkIntent = new Intent(context, HabitBroadcastReceiver.class);
|
||||||
checkIntent.setData(data);
|
checkIntent.setData(data);
|
||||||
checkIntent.setAction(ACTION_CHECK);
|
checkIntent.setAction(ACTION_CHECK);
|
||||||
if(timestamp != null) checkIntent.putExtra("timestamp", timestamp);
|
if(timestamp != null) checkIntent.putExtra("timestamp", timestamp);
|
||||||
return PendingIntent.getBroadcast(context, 0, checkIntent,
|
return PendingIntent.getBroadcast(context, requestCode, checkIntent,
|
||||||
PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PendingIntent buildDismissIntent(Context context)
|
public static PendingIntent buildDismissIntent(Context context)
|
||||||
@@ -242,7 +245,7 @@ public class HabitBroadcastReceiver extends BroadcastReceiver
|
|||||||
Intent deleteIntent = new Intent(context, HabitBroadcastReceiver.class);
|
Intent deleteIntent = new Intent(context, HabitBroadcastReceiver.class);
|
||||||
deleteIntent.setAction(ACTION_DISMISS);
|
deleteIntent.setAction(ACTION_DISMISS);
|
||||||
return PendingIntent.getBroadcast(context, 0, deleteIntent,
|
return PendingIntent.getBroadcast(context, 0, deleteIntent,
|
||||||
PendingIntent.FLAG_CANCEL_CURRENT);
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PendingIntent buildViewHabitIntent(Context context, Habit habit)
|
public static PendingIntent buildViewHabitIntent(Context context, Habit habit)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class CheckmarkWidgetProvider extends BaseWidgetProvider
|
|||||||
@Override
|
@Override
|
||||||
protected PendingIntent getOnClickPendingIntent(Context context, Habit habit)
|
protected PendingIntent getOnClickPendingIntent(Context context, Habit habit)
|
||||||
{
|
{
|
||||||
return HabitBroadcastReceiver.buildCheckIntent(context, habit, null);
|
return HabitBroadcastReceiver.buildCheckIntent(context, habit, null, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user