本文整理汇总了Java中dagger.android.support.AndroidSupportInjection类的典型用法代码示例。如果您正苦于以下问题:Java AndroidSupportInjection类的具体用法?Java AndroidSupportInjection怎么用?Java AndroidSupportInjection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AndroidSupportInjection类属于dagger.android.support包,在下文中一共展示了AndroidSupportInjection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleActivity
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
private static void handleActivity(Activity activity) {
if (activity instanceof HasSupportFragmentInjector) {
AndroidInjection.inject(activity);
}
if (activity instanceof FragmentActivity) {
((FragmentActivity) activity).getSupportFragmentManager()
.registerFragmentLifecycleCallbacks(
new FragmentManager.FragmentLifecycleCallbacks() {
@Override
public void onFragmentCreated(FragmentManager fm, Fragment f,
Bundle savedInstanceState) {
if (f instanceof Injectable) {
AndroidSupportInjection.inject(f);
}
}
}, true);
}
}
示例2: handleActivity
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
private static void handleActivity(Activity activity) {
if (activity instanceof HasSupportFragmentInjector) {
AndroidInjection.inject(activity);
}
if (activity instanceof FragmentActivity) {
((FragmentActivity) activity).getSupportFragmentManager()
.registerFragmentLifecycleCallbacks(
new FragmentManager.FragmentLifecycleCallbacks() {
@Override
public void onFragmentCreated(FragmentManager fm, Fragment f,
Bundle savedInstanceState) {
if (f instanceof Injectable) {
AndroidSupportInjection.inject(f);
}
}
}, true);
}
}
示例3: handleActivity
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
private static void handleActivity(Activity activity) {
if (activity instanceof HasSupportFragmentInjector || activity instanceof Injectable) {
AndroidInjection.inject(activity);
}
if (activity instanceof FragmentActivity) {
((FragmentActivity) activity).getSupportFragmentManager()
.registerFragmentLifecycleCallbacks(
new FragmentManager.FragmentLifecycleCallbacks() {
@Override
public void onFragmentCreated(FragmentManager fm, Fragment f,
Bundle savedInstanceState) {
if (f instanceof Injectable) {
AndroidSupportInjection.inject(f);
}
}
}, true);
}
}
示例4: handleActivity
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
private static void handleActivity(Activity activity) {
if (activity instanceof Injectable) {
AndroidInjection.inject(activity);
}
if (activity instanceof FragmentActivity) {
((FragmentActivity) activity).getSupportFragmentManager().registerFragmentLifecycleCallbacks(
new FragmentManager.FragmentLifecycleCallbacks() {
@Override
public void onFragmentCreated(FragmentManager fm, Fragment f,
Bundle savedInstanceState) {
if (f instanceof Injectable) {
AndroidSupportInjection.inject(f);
}
}
}, true);
}
}
示例5: handleActivity
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
private static void handleActivity(Activity activity) {
if (activity instanceof DaggerInjectable) {
AndroidInjection.inject(activity);
}
if (activity instanceof FragmentActivity) {
((FragmentActivity) activity).getSupportFragmentManager()
.registerFragmentLifecycleCallbacks(
new FragmentManager.FragmentLifecycleCallbacks() {
@Override
public void onFragmentCreated(FragmentManager fm, Fragment f,
Bundle savedInstanceState) {
if (f instanceof DaggerInjectable) {
AndroidSupportInjection.inject(f);
}
}
}, true);
}
}
示例6: handleActivity
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
/**
* Automated fragment injector
* @param activity provided by ActivityLifecycleCallbacks()
*/
private static void handleActivity(Activity activity){
if(activity instanceof HasSupportFragmentInjector){
AndroidInjection.inject(activity);
}
if(activity instanceof FragmentActivity){
((FragmentActivity) activity).getSupportFragmentManager()
.registerFragmentLifecycleCallbacks(
new FragmentManager.FragmentLifecycleCallbacks() {
@Override
public void onFragmentCreated(
FragmentManager fm, Fragment f, Bundle savedInstanceState) {
if(f instanceof InjectableFragment){
AndroidSupportInjection.inject(f);
}
}
}, true);
}
}
示例7: handleActivity
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
private void handleActivity(Activity activity) {
if (activity instanceof HasSupportFragmentInjector) {
// this works because we're using support fragments, so it's okay to setup after Activity.super.onCreate()
// See https://github.com/googlesamples/android-architecture-components/issues/99
AndroidInjection.inject(activity);
}
if (activity instanceof FragmentActivity) {
FragmentActivity fragmentActivity = (FragmentActivity) activity;
fragmentActivity.getSupportFragmentManager().registerFragmentLifecycleCallbacks(new FragmentManager
.FragmentLifecycleCallbacks() {
@Override
public void onFragmentPreAttached(FragmentManager fm, Fragment f, Context context) {
if (f instanceof Injectable) {
AndroidSupportInjection.inject(f);
}
}
}, true);
}
}
示例8: onCreate
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
AndroidSupportInjection.inject(this);
super.onCreate(savedInstanceState);
Log.e(TAG, "onCreate: " + " the map is: " + viewOnSelectListenerMap.get(this.getClass()));
// set top level adapter
setAdapter(mRowsAdapter);
// retrive appropriate listener from listener map and set on it
setOnItemViewClickedListener(viewOnClickListenerMap.get(this.getClass()));
setOnItemViewSelectedListener(viewOnSelectListenerMap.get(this.getClass()));
setOnSearchClickedListener(onClickListener.get(this.getClass()));
// register broadcast receiver
DownloadCompleteBroadcastReceiver.getInstance().registerListener(this);
// tweak the ui
setHeadersState(HEADERS_ENABLED);
setHeadersTransitionOnBackEnabled(true);
setTitle(getString(R.string.livedata));
// enable transition
prepareEntranceTransition();
}
示例9: handleActivity
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
private static void handleActivity(Activity activity) {
if (activity instanceof HasSupportFragmentInjector) {
AndroidInjection.inject(activity);
}
if (activity instanceof FragmentActivity) {
((FragmentActivity) activity).getSupportFragmentManager()
.registerFragmentLifecycleCallbacks(new FragmentManager.FragmentLifecycleCallbacks() {
@Override
public void onFragmentCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState) {
if (f instanceof Injectable)
AndroidSupportInjection.inject(f);
}
}, true);
}
}
示例10: handleActivity
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
private static void handleActivity(Activity activity) {
if (activity instanceof HasSupportFragmentInjector) {
AndroidInjection.inject(activity);
}
if (activity instanceof FragmentActivity) {
((FragmentActivity) activity).getSupportFragmentManager()
.registerFragmentLifecycleCallbacks(
new FragmentManager.FragmentLifecycleCallbacks() {
@Override
public void onFragmentCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState) {
if (f instanceof Injectable) {
AndroidSupportInjection.inject(f);
}
}
}, true);
}
}
示例11: onCreate
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidSupportInjection.inject(this);
dri = getArguments().getParcelable(KEY_DRI);
intent = getArguments().getParcelable(KEY_INTENT);
titleFetcher.setListener(new TitleFetcher.Listener() {
@Override
public void onFinished() {
hideProgressBar();
}
@Override
public void onSuccess(final String title) {
if (!TextUtils.isEmpty(titleView.getText())) {
return;
}
titleView.post(() -> {
if (title != null) {
titleView.append(title);
}
});
}
});
}
示例12: onAttach
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void onAttach(Activity activity) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
// Perform injection here before M, L (API 22) and below because onAttach(Context)
// is not yet available at L.
AndroidSupportInjection.inject(this);
}
super.onAttach(activity);
}
示例13: onAttach
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
@Override
public void onAttach(Context context)
{
AndroidSupportInjection.inject(this);
super.onAttach(context);
}
示例14: onAttach
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
@Override
public void onAttach(Context context) {
//If you want to use eventbus please return this method to true
if (iFragment.useEventBus()) {
//Register to the event main line
EventBus.getDefault().register(mFragment);
}
if (iFragment.injectable()) {
//Dagger.Android Dependent injection
AndroidSupportInjection.inject(mFragment);
}
}
示例15: onAttach
import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
@Override
public void onAttach(Context context) {
//如果要使用eventbus请将此方法返回true
if (iFragment.useEventBus()) {
//注册到事件主线
EventBus.getDefault().register(mFragment);
}
if (iFragment.injectable()) {
//Dagger.Android 依赖注入
AndroidSupportInjection.inject(mFragment);
}
}