com.nikedlab.android.inject.InjectedListFragment Maven / Gradle / Ivy
package com.nikedlab.android.inject;
import android.app.Activity;
import android.support.v4.app.ListFragment;
/**
* Created with Comodo Inc.
* User: Kuzmenko Victor
* Date: 2/6/14
* Time: 6:03 PM
*/
public class InjectedListFragment extends ListFragment {
/**
* InjectedApplication object
*/
private InjectedApplication application;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
InjectedApplication application = getInjectedApplication(activity);
application.injectInto(this);
}
/**
* @return {@link InjectedApplication}
*/
private InjectedApplication getInjectedApplication(Activity activity) {
if (application == null) {
application = (InjectedApplication) activity.getApplication();
}
return application;
}
}