mirror of https://github.com/tasks/tasks
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
Java
37 lines
1.1 KiB
Java
package org.tasks.receivers;
|
|
|
|
import android.content.ContentValues;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
|
|
import com.todoroo.astrid.api.AstridApiConstants;
|
|
import com.todoroo.astrid.data.Task;
|
|
|
|
import org.tasks.injection.BroadcastComponent;
|
|
import org.tasks.injection.InjectingBroadcastReceiver;
|
|
|
|
public class PushReceiver extends InjectingBroadcastReceiver {
|
|
|
|
public static void broadcast(Context context, Task task, ContentValues values) {
|
|
Intent intent = new Intent(context, PushReceiver.class);
|
|
intent.putExtra(AstridApiConstants.EXTRAS_TASK, task);
|
|
intent.putExtra(AstridApiConstants.EXTRAS_VALUES, values);
|
|
context.sendBroadcast(intent);
|
|
}
|
|
|
|
@Override
|
|
public void onReceive(Context context, Intent intent) {
|
|
super.onReceive(context, intent);
|
|
|
|
GoogleTaskPushReceiver.broadcast(
|
|
context,
|
|
intent.getParcelableExtra(AstridApiConstants.EXTRAS_TASK),
|
|
intent.getParcelableExtra(AstridApiConstants.EXTRAS_VALUES));
|
|
}
|
|
|
|
@Override
|
|
protected void inject(BroadcastComponent component) {
|
|
component.inject(this);
|
|
}
|
|
}
|