当前位置: 首页>>代码示例>>Java>>正文


Java AndroidSupportInjection类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:VivekNeel,项目名称:CricKotlin,代码行数:19,代码来源:AppInjector.java

示例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);
    }
}
 
开发者ID:hbmartin,项目名称:firebase-chat-android-architecture-components,代码行数:19,代码来源:AppInjector.java

示例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);
    }
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:19,代码来源:AppInjector.java

示例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);
    }
}
 
开发者ID:leinardi,项目名称:androidthings-kuman-sm9,代码行数:18,代码来源:AppInjector.java

示例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);
    }
}
 
开发者ID:n1rocket,项目名称:eggs-android,代码行数:19,代码来源:DaggerAndroidInjector.java

示例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);
    }
}
 
开发者ID:jakdor,项目名称:LabDayApp,代码行数:28,代码来源:AppInjector.java

示例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);
    }
}
 
开发者ID:drewhannay,项目名称:dagger-android-sample,代码行数:21,代码来源:ActivityAndFragmentAutoInjector.java

示例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();
}
 
开发者ID:googlesamples,项目名称:leanback-showcase,代码行数:27,代码来源:LiveDataFragment.java

示例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);
        }

    }
 
开发者ID:MLSDev,项目名称:RecipeFinderJavaVersion,代码行数:19,代码来源:ApplicationInjector.java

示例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);
    }
}
 
开发者ID:florent37,项目名称:Github,代码行数:18,代码来源:AppInjector.java

示例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);
                }
            });
        }
    });
}
 
开发者ID:tasomaniac,项目名称:OpenLinkWith,代码行数:26,代码来源:AddToHomeScreenDialogFragment.java

示例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);
}
 
开发者ID:NamTranDev,项目名称:CleanArchitechture,代码行数:11,代码来源:BaseFragment.java

示例13: onAttach

import dagger.android.support.AndroidSupportInjection; //导入依赖的package包/类
@Override
public void onAttach(Context context)
{
    AndroidSupportInjection.inject(this);

    super.onAttach(context);
}
 
开发者ID:benoitletondor,项目名称:mvp-core,代码行数:8,代码来源:DialogFragment.java

示例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);
    }
}
 
开发者ID:goutham106,项目名称:GmArchMvvm,代码行数:13,代码来源:FragmentDelegateImpl.java

示例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);
    }
}
 
开发者ID:xiaobailong24,项目名称:MVVMArms,代码行数:13,代码来源:FragmentDelegateImpl.java


注:本文中的dagger.android.support.AndroidSupportInjection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。