• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java LithoView类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.facebook.litho.LithoView的典型用法代码示例。如果您正苦于以下问题:Java LithoView类的具体用法?Java LithoView怎么用?Java LithoView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

LithoView类属于com.facebook.litho包,在下文中一共展示了LithoView类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: putHierarchy

点赞 3

import com.facebook.litho.LithoView; //导入依赖的package包/类
@Override
public void putHierarchy(LayoutHierarchyDumper dumper, JSONObject root, Object obj, Point offset)
    throws JSONException {
  if (!accept(obj)) {
    return;
  }

  if (obj instanceof LithoView) {
    LithoView lithoView = (LithoView) obj;
    DebugComponent debugComponent = DebugComponent.getRootInstance(lithoView);
    if (debugComponent == null) {
      return;
    }
    final int offsetLeft = LayoutHierarchyDumper.getViewLeft(lithoView);
    final int offsetTop = LayoutHierarchyDumper.getViewTop(lithoView);
    offset.offset(offsetLeft, offsetTop);
    dumpHierarchy(dumper, root, debugComponent, offset);
    offset.offset(-offsetLeft, -offsetTop);
  } else {
    dumpHierarchy(dumper, root, (DebugComponent) obj, offset);
  }
}
 

开发者ID:facebook,
项目名称:screenshot-tests-for-android,
代码行数:23,
代码来源:LithoHierarchyPlugin.java

示例2: putAttributes

点赞 3

import com.facebook.litho.LithoView; //导入依赖的package包/类
@Override
public void putAttributes(JSONObject node, Object obj, Point offset) throws JSONException {
  final DebugComponent debugComponent;
  if (obj instanceof LithoView) {
    ((LithoView) obj).rebind();
    debugComponent = DebugComponent.getRootInstance((LithoView) obj);
    if (debugComponent == null) {
      return;
    }
  } else {
    debugComponent = (DebugComponent) obj;

    // Since we're dealing with a pure component, we cant rely on the default required
    // attributes to be added, so we add them here
    Rect bounds = debugComponent.getBoundsInLithoView();
    putRequired(
        node,
        debugComponent.getComponent().getClass().getName(),
        offset.x + bounds.left,
        offset.y + bounds.top,
        bounds.width(),
        bounds.height());
  }
}
 

开发者ID:facebook,
项目名称:screenshot-tests-for-android,
代码行数:25,
代码来源:LithoAttributePlugin.java

示例3: onCreate

点赞 2

import com.facebook.litho.LithoView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  Demos.initialize(this);

  final String demoName = (String) getIntent().getSerializableExtra("demoName");

  setContentView(
      LithoView.create(
          this,
          Demos.getComponent(demoName)));
}
 

开发者ID:pavlospt,
项目名称:litho-glide,
代码行数:13,
代码来源:DemoActivity.java

示例4: onCreate

点赞 2

import com.facebook.litho.LithoView; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  Demos.initialize(this);

  setContentView(
      LithoView.create(
          this,
          DemoListComponent.create(new ComponentContext(this))
              .build()));
}
 

开发者ID:pavlospt,
项目名称:litho-glide,
代码行数:13,
代码来源:DemoListActivity.java

示例5: initData

点赞 2

import com.facebook.litho.LithoView; //导入依赖的package包/类
@Override
public void initData() {
    final ComponentContext c = new ComponentContext(this);

    final LithoView lithoView = LithoView.create(
            this /* context */,
            Text.create(c)
                    .text("Hello, World!")
                    .textSizeDip(50)
                    .build());

    setContentView(lithoView);

}
 

开发者ID:JessYanCoding,
项目名称:WideEyes,
代码行数:15,
代码来源:SplashActivity.java

示例6: testDefault

点赞 2

import com.facebook.litho.LithoView; //导入依赖的package包/类
@Test
public void testDefault() {
  Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
  LayoutInflater inflater = LayoutInflater.from(targetContext);
  LithoView view = (LithoView) inflater.inflate(R.layout.litho_view, null, false);

  view.setComponent(Example.create(view.getComponentContext()).build());

  ViewHelpers.setupView(view).setExactWidthDp(300).layout();
  Screenshot.snap(view).record();
}
 

开发者ID:facebook,
项目名称:screenshot-tests-for-android,
代码行数:12,
代码来源:ExampleScreenshotTest.java

示例7: testDefault

点赞 2

import com.facebook.litho.LithoView; //导入依赖的package包/类
@Test
public void testDefault() {
  Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
  LayoutInflater inflater = LayoutInflater.from(targetContext);
  LithoView view = (LithoView) inflater.inflate(R.layout.litho_view, null, false);

  view.setComponent(ImageRow.create(view.getComponentContext()).build());

  ViewHelpers.setupView(view).setExactWidthDp(300).layout();
  Screenshot.snap(view).record();
}
 

开发者ID:facebook,
项目名称:screenshot-tests-for-android,
代码行数:12,
代码来源:ImageRowScreenshotTest.java

示例8: accept

点赞 2

import com.facebook.litho.LithoView; //导入依赖的package包/类
@Override
public boolean accept(Object obj) {
  return obj instanceof LithoView || obj instanceof DebugComponent;
}
 

开发者ID:facebook,
项目名称:screenshot-tests-for-android,
代码行数:5,
代码来源:LithoHierarchyPlugin.java

示例9: testAcceptsLithoView

点赞 2

import com.facebook.litho.LithoView; //导入依赖的package包/类
@Test
public void testAcceptsLithoView() throws Exception {
  LithoView lithoView = new LithoView(InstrumentationRegistry.getTargetContext());
  assertEquals(true, LithoHierarchyPlugin.getInstance().accept(lithoView));
}
 

开发者ID:facebook,
项目名称:screenshot-tests-for-android,
代码行数:6,
代码来源:LithoHierarchyPluginTest.java

示例10: testAcceptsLithoView

点赞 2

import com.facebook.litho.LithoView; //导入依赖的package包/类
@Test
public void testAcceptsLithoView() throws Exception {
  LithoView lithoView = new LithoView(InstrumentationRegistry.getTargetContext());
  assertEquals(true, LithoAttributePlugin.getInstance().accept(lithoView));
}
 

开发者ID:facebook,
项目名称:screenshot-tests-for-android,
代码行数:6,
代码来源:LithoAttributePluginTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)