本文整理汇总了Java中mortar.bundler.BundleServiceRunner类的典型用法代码示例。如果您正苦于以下问题:Java BundleServiceRunner类的具体用法?Java BundleServiceRunner怎么用?Java BundleServiceRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BundleServiceRunner类属于mortar.bundler包,在下文中一共展示了BundleServiceRunner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateScope
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
public static MortarScope onCreateScope(Activity activity, Bundle savedInstanceState, Architected architected) {
String scopeName = activity.getLocalClassName() + "-task-" + activity.getTaskId();
MortarScope scope = MortarScope.findChild(activity.getApplicationContext(), scopeName);
if (scope == null) {
MortarScope parentScope = MortarScope.getScope(activity.getApplicationContext());
MortarScope.Builder builder = parentScope.buildChild()
.withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner());
architected.configureScope(builder, parentScope);
scope = builder.build(scopeName);
architected.createNavigator(scope);
}
BundleServiceRunner.getBundleServiceRunner(scope).onCreate(savedInstanceState);
return scope;
}
示例2: onCreate
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
mActivityScope = MortarScope.findChild(getApplicationContext(), getScopeName());
if (mActivityScope == null) {
MortarScope.Builder builder = MortarScope.buildChild(getApplicationContext())
.withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner());
onPreCreateScope(builder);
onCreateScope(builder);
mActivityScope = builder.build(getScopeName());
Timber.d("Created new scope %s", mActivityScope.getName());
} else {
Timber.d("Reusing old scope %s", mActivityScope.getName());
}
onScopeCreated(mActivityScope);
super.onCreate(savedInstanceState);
BundleServiceRunner.getBundleServiceRunner(this).onCreate(savedInstanceState);
}
示例3: childPresentersGetTheirOwnBundles
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
@Test public void childPresentersGetTheirOwnBundles() {
BundleServiceRunner bundleServiceRunner =
BundleServiceRunner.getBundleServiceRunner(activityScope);
bundleServiceRunner.onCreate(null);
ParentPresenter presenter = new ParentPresenter();
SomeView view = new SomeView();
presenter.takeView(view);
Bundle bundle = new Bundle();
bundleServiceRunner.onSaveInstanceState(bundle);
presenter.dropView(view);
bundleServiceRunner.onCreate(bundle);
presenter.takeView(view);
/**
* Assertions in {@link ChildPresenter#onLoad(android.os.Bundle)} are the real test,
* but let's check that the were run
*/
assertThat(presenter.childOne.loaded).isTrue();
assertThat(presenter.childTwo.loaded).isTrue();
}
示例4: onCreate
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setupUI();
setupDagger();
BundleServiceRunner.getBundleServiceRunner(this).onCreate(savedInstanceState);
}
示例5: setupMortar
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
private void setupMortar() {
mortarScope = MortarScope.findChild(getApplicationContext(), getClass().getName());
ActivityComponent component = setupDagger();
if(mortarScope == null) {
mortarScope = MortarScope
.buildChild(getApplicationContext())
.withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner())
.withService(DaggerService.SERVICE_NAME, component)
.build(getClass().getName());
}
component.inject(this);
}
示例6: getSystemService
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
@Override
public Object getSystemService(String name) {
MortarScope activityScope = findChild(getApplicationContext(), scopeName());
if (activityScope == null) {
activityScope = buildChild(getApplicationContext())
.withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner())
.withService(DaggerService.SERVICE_NAME, createComponent(componentClass()))
.build(scopeName());
}
return activityScope.hasService(name) ? activityScope.getService(name) : super.getSystemService(name);
}
示例7: onCreate
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mortarScope = MortarScope.findChild(getApplicationContext(), getClass().getName());
if (mortarScope == null) {
Component component = DaggerRootActivity_Component.builder()
.component(DaggerService.<App.Component>getDaggerComponent(getApplicationContext()))
.build();
mortarScope = MortarScope.buildChild(getApplicationContext())
.withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner())
.withService(DaggerService.SERVICE_NAME, component)
.build(getClass().getName());
}
DaggerService.<Component>getDaggerComponent(this).inject(this);
BundleServiceRunner.getBundleServiceRunner(this).onCreate(savedInstanceState);
setContentView(R.layout.activity_root);
ButterKnife.inject(this);
GsonParceler parceler = new GsonParceler(new Gson());
@SuppressWarnings("deprecation") FlowDelegate.NonConfigurationInstance nonConfig =
(FlowDelegate.NonConfigurationInstance) getLastNonConfigurationInstance();
flowDelegate = FlowDelegate.onCreate(nonConfig, getIntent(), savedInstanceState, parceler, History.single(new PostsScreen()), this);
}
示例8: onCreate
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mortarScope = MortarScope.findChild(getApplicationContext(), getClass().getName());
if (mortarScope == null) {
RootActivityComponent component = DaggerRootActivityComponent.builder()
.appComponent(DaggerService.<AppComponent>getDaggerComponent(getApplicationContext()))
.build();
mortarScope = MortarScope.buildChild(getApplicationContext())
.withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner())
.withService(DaggerService.SERVICE_NAME, component)
.build(getClass().getName());
}
DaggerService.<RootActivityComponent>getDaggerComponent(this).inject(this);
BundleServiceRunner.getBundleServiceRunner(this).onCreate(savedInstanceState);
setContentView(R.layout.activity_root);
ButterKnife.inject(this);
GsonParceler parceler = new GsonParceler(new Gson());
@SuppressWarnings("deprecation") FlowDelegate.NonConfigurationInstance nonConfig =
(FlowDelegate.NonConfigurationInstance) getLastNonConfigurationInstance();
flowDelegate = FlowDelegate.onCreate(nonConfig, getIntent(), savedInstanceState, parceler, History.single(new PostsScreen()), this);
}
示例9: onCreate
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mortarScope = MortarScope.findChild(getApplicationContext(), getClass().getName());
if (mortarScope == null) {
RootActivityComponent component = DaggerRootActivityComponent.builder()
.mortarDemoAppComponent(DaggerService.<MortarDemoAppComponent>getDaggerComponent(getApplicationContext()))
.build();
mortarScope = MortarScope.buildChild(getApplicationContext())
.withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner())
.withService(DaggerService.SERVICE_NAME, component)
.build(getClass().getName());
}
DaggerService.<RootActivityComponent>getDaggerComponent(this).inject(this);
BundleServiceRunner.getBundleServiceRunner(this).onCreate(savedInstanceState);
setContentView(R.layout.activity_root);
ButterKnife.inject(this);
GsonParceler parceler = new GsonParceler(new Gson());
@SuppressWarnings("deprecation") FlowDelegate.NonConfigurationInstance nonConfig =
(FlowDelegate.NonConfigurationInstance) getLastNonConfigurationInstance();
flowDelegate = FlowDelegate.onCreate(nonConfig, getIntent(), savedInstanceState, parceler, History.single(new PostsScreen()), this);
}
示例10: onCreate
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mortarScope = MortarScope.findChild(getApplicationContext(), getClass().getName());
if (mortarScope == null) {
Component component = DaggerRootActivity_Component.builder()
.component(DaggerService.<MortarDemoApp.Component>getDaggerComponent(getApplicationContext()))
.build();
mortarScope = MortarScope.buildChild(getApplicationContext())
.withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner())
.withService(DaggerService.SERVICE_NAME, component)
.build(getClass().getName());
}
DaggerService.<Component>getDaggerComponent(this).inject(this);
BundleServiceRunner.getBundleServiceRunner(this).onCreate(savedInstanceState);
setContentView(R.layout.activity_root);
ButterKnife.inject(this);
GsonParceler parceler = new GsonParceler(new Gson());
@SuppressWarnings("deprecation") FlowDelegate.NonConfigurationInstance nonConfig =
(FlowDelegate.NonConfigurationInstance) getLastNonConfigurationInstance();
flowDelegate = FlowDelegate.onCreate(nonConfig, getIntent(), savedInstanceState, parceler, History.single(new PostsScreen()), this);
}
示例11: onCreate
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GsonParceler parceler = new GsonParceler(new Gson());
@SuppressWarnings("deprecation") FlowDelegate.NonConfigurationInstance nonConfig =
(FlowDelegate.NonConfigurationInstance) getLastNonConfigurationInstance();
MortarScope parentScope = MortarScope.getScope(getApplication());
String scopeName = getLocalClassName() + "-task-" + getTaskId();
activityScope = parentScope.findChild(scopeName);
if (activityScope == null) {
activityScope = parentScope.buildChild()
.withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner())
.build(scopeName);
}
ObjectGraphService.inject(this, this);
getBundleServiceRunner(activityScope).onCreate(savedInstanceState);
actionBarOwner.takeView(this);
setContentView(R.layout.root_layout);
container = (PathContainerView) findViewById(R.id.container);
containerAsHandlesBack = (HandlesBack) container;
flowDelegate = FlowDelegate.onCreate(nonConfig, getIntent(), savedInstanceState, parceler,
History.single(new ChatListScreen()), this);
}
示例12: getSystemService
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
@Override public Object getSystemService(String name) {
MortarScope activityScope = findChild(getApplicationContext(), getScopeName());
if (activityScope == null) {
activityScope = buildChild(getApplicationContext()) //
.withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner())
.withService(DaggerService.SERVICE_NAME, createComponent(Main.Component.class))
.build(getScopeName());
}
return activityScope.hasService(name) ? activityScope.getService(name)
: super.getSystemService(name);
}
示例13: getSystemService
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
@Override public Object getSystemService(String name) {
MortarScope activityScope = findChild(getApplicationContext(), getScopeName());
if (activityScope == null) {
activityScope = buildChild(getApplicationContext()) //
.withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner())
.withService(HelloPresenter.class.getName(), new HelloPresenter())
.build(getScopeName());
}
return activityScope.hasService(name) ? activityScope.getService(name)
: super.getSystemService(name);
}
示例14: onLoadOnlyOncePerView
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
/** https://github.com/square/mortar/issues/59 */
@Test public void onLoadOnlyOncePerView() {
SimplePresenter presenter = new SimplePresenter();
SomeView view = new SomeView();
presenter.takeView(view);
assertThat(presenter.loaded).isTrue();
presenter.loaded = false;
BundleServiceRunner.getBundleServiceRunner(activityScope).onCreate(null);
assertThat(presenter.loaded).isFalse();
}
示例15: newProcess
import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
/** Simulate a new proecess by creating brand new scope instances. */
private void newProcess() {
root = MortarScope.buildRootScope().build("Root");
activityScope = root.buildChild()
.withService(BundleServiceRunner.SERVICE_NAME, new BundleServiceRunner())
.build("activity");
}