com.nikedlab.android.inject.extenders.BroadcastReceiverInjector Maven / Gradle / Ivy
The newest version!
package com.nikedlab.android.inject.extenders;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
/**
* Created with Comodo Inc.
* User: Kuzmenko Victor
* Date: 8/7/13
* Time: 1:38 PM
*/
public abstract class BroadcastReceiverInjector extends BroadcastReceiver {
private InjectedApplication application;
@Override
public void onReceive(Context context, Intent intent) {
if ("Dalvik".equals(System.getProperty("java.vm.name"))) {
InjectedApplication application = getInjectedApplication();
application.injectInto(this);
}
}
private InjectedApplication getInjectedApplication() {
if (application == null) {
application = (InjectedApplication) InjectedApplication.application;
}
return application;
}
}