Increase logging for ReminderReceiver and WidgetReceiver

pull/542/head
Alinson S. Xavier 6 years ago
parent 58ed759224
commit b21d77514a

@ -77,7 +77,6 @@ public class ReminderReceiver extends BroadcastReceiver
case ACTION_SHOW_REMINDER:
if (habit == null) return;
Log.d("ReminderReceiver", String.format(
Locale.US,
"onShowReminder habit=%d timestamp=%d reminderTime=%d",
habit.id,
timestamp,
@ -88,15 +87,18 @@ public class ReminderReceiver extends BroadcastReceiver
case ACTION_DISMISS_REMINDER:
if (habit == null) return;
Log.d("ReminderReceiver", String.format("onDismiss habit=%d", habit.id));
reminderController.onDismiss(habit);
break;
case ACTION_SNOOZE_REMINDER:
if (habit == null) return;
Log.d("ReminderReceiver", String.format("onSnoozePressed habit=%d", habit.id));
reminderController.onSnoozePressed(habit, context);
break;
case Intent.ACTION_BOOT_COMPLETED:
Log.d("ReminderReceiver", "onBootCompleted");
reminderController.onBootCompleted();
break;
}

@ -38,33 +38,37 @@ import dagger.*;
public class WidgetReceiver extends BroadcastReceiver
{
public static final String ACTION_ADD_REPETITION =
"org.isoron.uhabits.ACTION_ADD_REPETITION";
"org.isoron.uhabits.ACTION_ADD_REPETITION";
public static final String ACTION_DISMISS_REMINDER =
"org.isoron.uhabits.ACTION_DISMISS_REMINDER";
"org.isoron.uhabits.ACTION_DISMISS_REMINDER";
public static final String ACTION_REMOVE_REPETITION =
"org.isoron.uhabits.ACTION_REMOVE_REPETITION";
"org.isoron.uhabits.ACTION_REMOVE_REPETITION";
public static final String ACTION_TOGGLE_REPETITION =
"org.isoron.uhabits.ACTION_TOGGLE_REPETITION";
"org.isoron.uhabits.ACTION_TOGGLE_REPETITION";
private static final String TAG = "WidgetReceiver";
@Override
public void onReceive(final Context context, Intent intent)
{
HabitsApplication app =
(HabitsApplication) context.getApplicationContext();
(HabitsApplication) context.getApplicationContext();
WidgetComponent component = DaggerWidgetReceiver_WidgetComponent
.builder()
.habitsApplicationComponent(app.getComponent())
.build();
.builder()
.habitsApplicationComponent(app.getComponent())
.build();
IntentParser parser = app.getComponent().getIntentParser();
WidgetBehavior controller = component.getWidgetController();
Preferences prefs = app.getComponent().getPreferences();
if(prefs.isSyncEnabled())
Log.i(TAG, String.format("Received intent: %s", intent.toString()));
if (prefs.isSyncEnabled())
context.startService(new Intent(context, SyncService.class));
try
@ -75,18 +79,30 @@ public class WidgetReceiver extends BroadcastReceiver
switch (intent.getAction())
{
case ACTION_ADD_REPETITION:
Log.d(TAG, String.format(
"onAddRepetition habit=%d timestamp=%d",
data.getHabit().getId(),
data.getTimestamp().getUnixTime()));
controller.onAddRepetition(data.getHabit(),
data.getTimestamp());
data.getTimestamp());
break;
case ACTION_TOGGLE_REPETITION:
Log.d(TAG, String.format(
"onToggleRepetition habit=%d timestamp=%d",
data.getHabit().getId(),
data.getTimestamp().getUnixTime()));
controller.onToggleRepetition(data.getHabit(),
data.getTimestamp());
data.getTimestamp());
break;
case ACTION_REMOVE_REPETITION:
Log.d(TAG, String.format(
"onRemoveRepetition habit=%d timestamp=%d",
data.getHabit().getId(),
data.getTimestamp().getUnixTime()));
controller.onRemoveRepetition(data.getHabit(),
data.getTimestamp());
data.getTimestamp());
break;
}
}

Loading…
Cancel
Save