mirror of https://github.com/tasks/tasks
Fix refresh broadcast injection
parent
80b484e2ad
commit
741f72d999
@ -0,0 +1,12 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import org.tasks.scheduling.RefreshBroadcastReceiver;
|
||||
|
||||
import dagger.Module;
|
||||
|
||||
@Module(library = true,
|
||||
injects = {
|
||||
RefreshBroadcastReceiver.class
|
||||
})
|
||||
public class BroadcastModule {
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package org.tasks.injection;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class InjectingBroadcastReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
((Injector) context.getApplicationContext()).inject(this, new BroadcastModule());
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package org.tasks.scheduling;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.todoroo.astrid.api.AstridApiConstants;
|
||||
|
||||
import org.tasks.Broadcaster;
|
||||
import org.tasks.injection.InjectingBroadcastReceiver;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class RefreshBroadcastReceiver extends InjectingBroadcastReceiver {
|
||||
|
||||
@Inject Broadcaster broadcaster;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
super.onReceive(context, intent);
|
||||
|
||||
broadcaster.sendOrderedBroadcast(context, new Intent(AstridApiConstants.BROADCAST_EVENT_TASK_LIST_UPDATED));
|
||||
broadcaster.sendOrderedBroadcast(context, new Intent(AstridApiConstants.BROADCAST_EVENT_FILTER_LIST_UPDATED));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue