roboguice.fragment.provided.RoboPreferenceFragment Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of roboguice Show documentation
Show all versions of roboguice Show documentation
A framework for using Google Guice dependency injection in Android.
package roboguice.fragment.provided;
import roboguice.RoboGuice;
import android.annotation.TargetApi;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.view.View;
/**
* Provides an injected {@link PreferenceFragment} based on the native HONEY_COMB+ fragments.
* A RoboPreferenceFragment will see all its members and views injected after {@link #onViewCreated(View, Bundle)}.
* @author SNI
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public abstract class RoboPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RoboGuice.getInjector(getActivity()).injectMembersWithoutViews(this);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
RoboGuice.getInjector(getActivity()).injectViewMembers(this);
}
}