|
|
@ -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 org.isoron.uhabits.widgets.activities.*;
|
|
|
|
import org.isoron.uhabits.widgets.activities.*;
|
|
|
|
|
|
|
|
|
|
|
|
import dagger.*;
|
|
|
|
import dagger.*;
|
|
|
@ -52,6 +53,9 @@ public class WidgetReceiver extends BroadcastReceiver
|
|
|
|
public static final String ACTION_SET_NUMERICAL_VALUE =
|
|
|
|
public static final String ACTION_SET_NUMERICAL_VALUE =
|
|
|
|
"org.isoron.uhabits.ACTION_SET_NUMERICAL_VALUE";
|
|
|
|
"org.isoron.uhabits.ACTION_SET_NUMERICAL_VALUE";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
@ -68,13 +72,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())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -112,6 +120,10 @@ public class WidgetReceiver extends BroadcastReceiver
|
|
|
|
parser.copyIntentData(intent,numberSelectorIntent);
|
|
|
|
parser.copyIntentData(intent,numberSelectorIntent);
|
|
|
|
context.startActivity(numberSelectorIntent);
|
|
|
|
context.startActivity(numberSelectorIntent);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACTION_UPDATE_WIDGETS_VALUE:
|
|
|
|
|
|
|
|
widgetUpdater.updateWidgets();
|
|
|
|
|
|
|
|
widgetUpdater.scheduleStartDayWidgetUpdate();
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (RuntimeException e)
|
|
|
|
catch (RuntimeException e)
|
|
|
|