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


Java BundleServiceRunner类代码示例

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

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

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

示例4: onCreate

import mortar.bundler.BundleServiceRunner; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setupUI();
    setupDagger();
    BundleServiceRunner.getBundleServiceRunner(this).onCreate(savedInstanceState);
}
 
开发者ID:leonardo2204,项目名称:Flow1.0.0-alphaExample,代码行数:8,代码来源:RootActivity.java

示例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);
}
 
开发者ID:leonardo2204,项目名称:Flow1.0.0-alphaExample,代码行数:15,代码来源:RootActivity.java

示例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);
}
 
开发者ID:gotokatsuya,项目名称:Easy,代码行数:12,代码来源:BaseActivity.java

示例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);
}
 
开发者ID:lukaspili,项目名称:flow-navigation,代码行数:30,代码来源:RootActivity.java

示例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);
}
 
开发者ID:lukaspili,项目名称:Auto-Mortar,代码行数:30,代码来源:RootActivity.java

示例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);
}
 
开发者ID:lukaspili,项目名称:Power-Mortar-Flow-Dagger2-demo,代码行数:30,代码来源:RootActivity.java

示例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);
}
 
开发者ID:lukaspili,项目名称:Mortar-Flow-Dagger2-demo,代码行数:30,代码来源:RootActivity.java

示例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);
}
 
开发者ID:square,项目名称:mortar,代码行数:30,代码来源:MortarDemoActivity.java

示例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);
}
 
开发者ID:square,项目名称:mortar,代码行数:14,代码来源:HelloDagger2Activity.java

示例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);
}
 
开发者ID:square,项目名称:mortar,代码行数:14,代码来源:HelloActivity.java

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

示例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");
}
 
开发者ID:square,项目名称:mortar,代码行数:8,代码来源:PopupPresenterTest.java


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