|
|
@ -26,6 +26,7 @@ import org.isoron.uhabits.*;
|
|
|
|
import org.isoron.uhabits.core.preferences.*;
|
|
|
|
import org.isoron.uhabits.core.preferences.*;
|
|
|
|
import org.isoron.uhabits.core.ui.widgets.*;
|
|
|
|
import org.isoron.uhabits.core.ui.widgets.*;
|
|
|
|
import org.isoron.uhabits.intents.*;
|
|
|
|
import org.isoron.uhabits.intents.*;
|
|
|
|
|
|
|
|
import org.isoron.uhabits.widgets.*;
|
|
|
|
|
|
|
|
|
|
|
|
import dagger.*;
|
|
|
|
import dagger.*;
|
|
|
|
|
|
|
|
|
|
|
@ -48,6 +49,9 @@ public class WidgetReceiver extends BroadcastReceiver
|
|
|
|
public static final String ACTION_TOGGLE_REPETITION =
|
|
|
|
public static final String ACTION_TOGGLE_REPETITION =
|
|
|
|
"org.isoron.uhabits.ACTION_TOGGLE_REPETITION";
|
|
|
|
"org.isoron.uhabits.ACTION_TOGGLE_REPETITION";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final String ACTION_UPDATE_WIDGETS_VALUE =
|
|
|
|
|
|
|
|
"org.isoron.uhabits.ACTION_UPDATE_WIDGETS_VALUE";
|
|
|
|
|
|
|
|
|
|
|
|
private static final String TAG = "WidgetReceiver";
|
|
|
|
private static final String TAG = "WidgetReceiver";
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -64,13 +68,17 @@ public class WidgetReceiver extends BroadcastReceiver
|
|
|
|
IntentParser parser = app.getComponent().getIntentParser();
|
|
|
|
IntentParser parser = app.getComponent().getIntentParser();
|
|
|
|
WidgetBehavior controller = component.getWidgetController();
|
|
|
|
WidgetBehavior controller = component.getWidgetController();
|
|
|
|
Preferences prefs = app.getComponent().getPreferences();
|
|
|
|
Preferences prefs = app.getComponent().getPreferences();
|
|
|
|
|
|
|
|
WidgetUpdater widgetUpdater = app.getComponent().getWidgetUpdater();
|
|
|
|
|
|
|
|
|
|
|
|
Log.i(TAG, String.format("Received intent: %s", intent.toString()));
|
|
|
|
Log.i(TAG, String.format("Received intent: %s", intent.toString()));
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
IntentParser.CheckmarkIntentData data;
|
|
|
|
IntentParser.CheckmarkIntentData data = null;
|
|
|
|
data = parser.parseCheckmarkIntent(intent);
|
|
|
|
if (intent.getAction() != ACTION_UPDATE_WIDGETS_VALUE)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
data = parser.parseCheckmarkIntent(intent);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (intent.getAction())
|
|
|
|
switch (intent.getAction())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -100,6 +108,11 @@ public class WidgetReceiver extends BroadcastReceiver
|
|
|
|
controller.onRemoveRepetition(data.getHabit(),
|
|
|
|
controller.onRemoveRepetition(data.getHabit(),
|
|
|
|
data.getTimestamp());
|
|
|
|
data.getTimestamp());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case ACTION_UPDATE_WIDGETS_VALUE:
|
|
|
|
|
|
|
|
widgetUpdater.updateWidgets();
|
|
|
|
|
|
|
|
widgetUpdater.scheduleStartDayWidgetUpdate();
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (RuntimeException e)
|
|
|
|
catch (RuntimeException e)
|
|
|
|