本文整理汇总了Java中dagger.android.support.HasSupportFragmentInjector类的典型用法代码示例。如果您正苦于以下问题:Java HasSupportFragmentInjector类的具体用法?Java HasSupportFragmentInjector怎么用?Java HasSupportFragmentInjector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HasSupportFragmentInjector类属于dagger.android.support包,在下文中一共展示了HasSupportFragmentInjector类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handleActivity
import dagger.android.support.HasSupportFragmentInjector; //导入依赖的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.HasSupportFragmentInjector; //导入依赖的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.HasSupportFragmentInjector; //导入依赖的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.HasSupportFragmentInjector; //导入依赖的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
示例5: handleActivity
import dagger.android.support.HasSupportFragmentInjector; //导入依赖的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
示例6: handleActivity
import dagger.android.support.HasSupportFragmentInjector; //导入依赖的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
示例7: handleActivity
import dagger.android.support.HasSupportFragmentInjector; //导入依赖的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
示例8: handleActivity
import dagger.android.support.HasSupportFragmentInjector; //导入依赖的package包/类
/**
* The strategy for automated dependency injection is:
*
* If this activity has implemented HasSupportFragmentInjector interfacea which means it has
* to return the DispatchInjector through overriding public AndroidInjector<Fragment>
* fragmentInjector() method to return the @Inject DispatchInjector. Then this activity must
* be processed with the AndroidInjection by calling the AndroidInjection.inject method.
*
* If the activity is extended from the FragmentActivity, then we will set up the dependency
* injection for all the fragments by instrumenting the AndroidInjection.inject method at
* the beginning of fragment's creation. Since the fragment takes the main responsibility on
* UI rendering.
*
* @param activity activity to be processed.
*/
private static void handleActivity(Activity activity) {
// TODO: an injectable for activity separately
if (activity instanceof HasSupportFragmentInjector) {
// When the activity has implemented the HasSupportFragmentInjector interface, android
// injector will inject into it, so the activity can be injected with the dispatch
// injector specific for fragment. Then this dispatch injector will be returned through
// the override method and contribute to android injector factory for fragment
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) {
// The injector only contains the provision method for the
// field in the fragment.
// But for activity, there will be a module providing the
// binding method which will be bound to the fragment's
// subcomponent's builder (Android injector builder) and
// then be cast to AndroidInjector.Factory
AndroidSupportInjection.inject(f);
}
}
}, true);
}
}
开发者ID:googlesamples,项目名称:leanback-showcase,代码行数:48,代码来源:AppInjector.java
注:本文中的dagger.android.support.HasSupportFragmentInjector类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论