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


Java RxAndroidPlugins.setInitMainThreadSchedulerHandler方法代码示例

本文整理汇总了Java中io.reactivex.android.plugins.RxAndroidPlugins.setInitMainThreadSchedulerHandler方法的典型用法代码示例。如果您正苦于以下问题:Java RxAndroidPlugins.setInitMainThreadSchedulerHandler方法的具体用法?Java RxAndroidPlugins.setInitMainThreadSchedulerHandler怎么用?Java RxAndroidPlugins.setInitMainThreadSchedulerHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.reactivex.android.plugins.RxAndroidPlugins的用法示例。


在下文中一共展示了RxAndroidPlugins.setInitMainThreadSchedulerHandler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@Override
public Statement apply(Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            RxAndroidPlugins.reset();
            RxAndroidPlugins.setInitMainThreadSchedulerHandler(scheduler -> Schedulers.trampoline());
            RxJavaPlugins.reset();
            RxJavaPlugins.setIoSchedulerHandler(schedulerCallable -> Schedulers.trampoline());

            base.evaluate();

            RxAndroidPlugins.reset();
            RxJavaPlugins.reset();
        }
    };
}
 
开发者ID:CoreFloDev,项目名称:OpenChat,代码行数:18,代码来源:RxPluginTestRule.java

示例2: apply

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@Override
public Statement apply(final Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {

            RxAndroidPlugins.setMainThreadSchedulerHandler(scheduler ->  Schedulers.trampoline());
            RxAndroidPlugins.setInitMainThreadSchedulerHandler(schedulerCallable ->  Schedulers.trampoline());

            try {
                base.evaluate();
            } finally {
                RxJavaPlugins.reset();
                RxAndroidPlugins.reset();
            }
        }
    };
}
 
开发者ID:listenzz,项目名称:RxCommand,代码行数:19,代码来源:ImmediateSchedulersRule.java

示例3: apply

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@Override
public Statement apply(final Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            RxAndroidPlugins.reset();
            RxAndroidPlugins.setInitMainThreadSchedulerHandler(mRxAndroidSchedulersHook);

            RxJavaPlugins.reset();
            RxJavaPlugins.setIoSchedulerHandler(mRxJavaImmediateScheduler);
            RxJavaPlugins.setNewThreadSchedulerHandler(mRxJavaImmediateScheduler);

            base.evaluate();

            RxAndroidPlugins.reset();
            RxJavaPlugins.reset();
        }
    };
}
 
开发者ID:sztomek,项目名称:cleanarchitecture-unidirectional,代码行数:20,代码来源:RxSchedulersOverrideRule.java

示例4: starting

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@Override
protected void starting(Description description) {
  if (restoreHandlers) {
    // https://github.com/ReactiveX/RxAndroid/pull/358
    //            originalInitMainThreadInitHandler =
    // RxAndroidPlugins.getInitMainThreadScheduler();
    //            originalMainThreadHandler = RxAndroidPlugins.getMainThreadScheduler();
  }
  RxAndroidPlugins.reset();
  RxAndroidPlugins.setInitMainThreadSchedulerHandler(
      new Function<Callable<Scheduler>, Scheduler>() {
        @Override
        public Scheduler apply(Callable<Scheduler> schedulerCallable) throws Exception {
          return delegatingMainThreadScheduler;
        }
      });
  RxAndroidPlugins.setMainThreadSchedulerHandler(
      new Function<Scheduler, Scheduler>() {
        @Override
        public Scheduler apply(Scheduler scheduler) throws Exception {
          return delegatingMainThreadScheduler;
        }
      });
}
 
开发者ID:uber,项目名称:RIBs,代码行数:25,代码来源:AndroidSchedulersRule.java

示例5: setupRxJavaPlugins

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@BeforeClass
public static void setupRxJavaPlugins() {
    RxJavaPlugins.setIoSchedulerHandler(new Function<Scheduler, Scheduler>() {
        @Override
        public Scheduler apply(Scheduler scheduler) throws Exception {
            return Schedulers.trampoline();
        }
    });

    RxAndroidPlugins.setInitMainThreadSchedulerHandler(new Function<Callable<Scheduler>, Scheduler>() {
        @Override
        public Scheduler apply(Callable<Scheduler> schedulerCallable) throws Exception {
            return Schedulers.trampoline();
        }
    });
}
 
开发者ID:segunfamisa,项目名称:android-mvvm-sample,代码行数:17,代码来源:MovieDetailsViewModelTest.java

示例6: setupClass

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@BeforeClass
public static void setupClass() {
    RxAndroidPlugins.setInitMainThreadSchedulerHandler(new Function<Callable<Scheduler>, Scheduler>() {
        @Override
        public Scheduler apply(Callable<Scheduler> schedulerCallable) throws Exception {
            return Schedulers.trampoline();
        }
    });

    RxJavaPlugins.setIoSchedulerHandler(new Function<Scheduler, Scheduler>() {
        @Override
        public Scheduler apply(Scheduler scheduler) throws Exception {
            return Schedulers.trampoline();
        }
    });
}
 
开发者ID:segunfamisa,项目名称:android-mvvm-sample,代码行数:17,代码来源:MoviesViewModelTest.java

示例7: apply

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@Override
public Statement apply(final Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            RxAndroidPlugins.reset();
            RxAndroidPlugins.setInitMainThreadSchedulerHandler(schedulerFunctionLazy);

            RxJavaPlugins.reset();
            RxJavaPlugins.setIoSchedulerHandler(schedulerFunction);
            RxJavaPlugins.setNewThreadSchedulerHandler(schedulerFunction);
            RxJavaPlugins.setComputationSchedulerHandler(schedulerFunction);

            base.evaluate();

            RxAndroidPlugins.reset();
            RxJavaPlugins.reset();
        }
    };
}
 
开发者ID:Plastix,项目名称:RxSchedulerRule,代码行数:21,代码来源:RxSchedulerRule.java

示例8: setUp

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@Before
public void setUp ()
{

    RxAndroidPlugins.setInitMainThreadSchedulerHandler( new Function<Callable<Scheduler>,
            Scheduler>( )
    {
        @Override
        public Scheduler apply (@NonNull Callable<Scheduler> schedulerCallable) throws Exception
        {
            return Schedulers.trampoline( );
        }
    } );

    when( mockCountryRepository.countries( getCountriesList.policy ) )
            .thenReturn( Observable.<List<Country>>empty( ) );

}
 
开发者ID:tecruz,项目名称:AndroidBaseApplication,代码行数:19,代码来源:GetCountriesUsecaseTest.java

示例9: apply

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
public Statement apply(Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            Scheduler scheduler = TrampolineScheduler.instance();
            Function<Callable<Scheduler>, Scheduler> schedulerFn = __ -> scheduler;
            RxJavaPlugins.reset();
            RxJavaPlugins.setInitIoSchedulerHandler(schedulerFn);
            RxJavaPlugins.setInitNewThreadSchedulerHandler(schedulerFn);
            RxAndroidPlugins.reset();
            RxAndroidPlugins.setInitMainThreadSchedulerHandler(schedulerFn);

            try {
                base.evaluate();
            } finally {
                RxJavaPlugins.reset();
                RxAndroidPlugins.reset();
            }
        }
    };
}
 
开发者ID:vickychijwani,项目名称:quill,代码行数:22,代码来源:RxSchedulersRule.java

示例10: init

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@BeforeClass public static void init() throws Exception {
  // Tell RxAndroid to not use android main ui thread scheduler
  RxAndroidPlugins.setInitMainThreadSchedulerHandler(
      new Function<Callable<Scheduler>, Scheduler>() {
        @Override public Scheduler apply(@NonNull Callable<Scheduler> schedulerCallable)
            throws Exception {
          return Schedulers.trampoline();
        }
      });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:HomePresenterTest.java

示例11: setupBaseTestBeforeClass

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@BeforeClass
public static void setupBaseTestBeforeClass() {
    RxJavaPlugins.onComputationScheduler(Schedulers.trampoline());

    RxAndroidPlugins.setInitMainThreadSchedulerHandler(new Function<Callable<Scheduler>, Scheduler>() {
        @Override
        public Scheduler apply(@NonNull Callable<Scheduler> schedulerCallable) throws Exception {
            return Schedulers.trampoline();
        }
    });
}
 
开发者ID:storix,项目名称:RxDiffUtil,代码行数:12,代码来源:BaseTest.java

示例12: onlyOnce

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@BeforeClass
public static void onlyOnce() throws Exception {
    RxAndroidPlugins.setInitMainThreadSchedulerHandler(
            new Function<Callable<Scheduler>, Scheduler>() {
                @Override
                public Scheduler apply(Callable<Scheduler> schedulerCallable)
                        throws Exception {
                    return Schedulers.trampoline();
                }
            });
}
 
开发者ID:iamBedant,项目名称:InstantAppStarter,代码行数:12,代码来源:NewsSourcePresenterTest.java

示例13: setup

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@BeforeClass
public static void setup() {
  RxAndroidPlugins.setInitMainThreadSchedulerHandler(schedulerCallable -> Schedulers.io());

  // sample recent pages
  long timestamp = System.currentTimeMillis();
  SAMPLE_RECENT_PAGES.add(new RecentPage(49, timestamp));
  SAMPLE_RECENT_PAGES.add(new RecentPage(100, timestamp - 10000));
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:10,代码来源:RecentPageModelTest.java

示例14: setup

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@Before
public void setup() {
  RxAndroidPlugins.setInitMainThreadSchedulerHandler(
        new Function<Callable<Scheduler>, Scheduler>() {
            @Override
            public Scheduler apply(Callable<Scheduler> schedulerCallable) throws Exception {
                return Schedulers.trampoline();
            }
        });
}
 
开发者ID:uber,项目名称:RIBs,代码行数:11,代码来源:WorkflowTest.java

示例15: init

import io.reactivex.android.plugins.RxAndroidPlugins; //导入方法依赖的package包/类
@Before
public void init() {
    loginPresenter = new LoginPresenter();
    // BoltsConfig.configureMocks();
    BundleFactoryConfig.setProvider(() -> Mockito.mock(Bundle.class));
    RxAndroidPlugins.setInitMainThreadSchedulerHandler(schedulerCallable -> Schedulers.trampoline());
}
 
开发者ID:Zhuinden,项目名称:flowless,代码行数:8,代码来源:LoginPresenterTest.java


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