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


Java ScalpelFrameLayout类代码示例

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


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

示例1: setContentView

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
@Override
public void setContentView(@LayoutRes int layoutResID) {
    mScalpelLayout = new ScalpelFrameLayout(this);

    mScalpelLayout.setLayerInteractionEnabled(false);
    mScalpelLayout.setDrawViews(true);
    mScalpelLayout.setDrawIds(true);
    mScalpelLayout.setChromeColor(ContextCompat.getColor(this, R.color.white$1));
    mScalpelLayout.setChromeShadowColor(ContextCompat.getColor(this, R.color.red$1));

    LayoutInflater.from(this).inflate(layoutResID, mScalpelLayout, true);

    final ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);

    super.setContentView(mScalpelLayout, lp);
}
 
开发者ID:huazhouwang,项目名称:Synapse,代码行数:18,代码来源:WrapperActivity.java

示例2: testWrapsView

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
@Test
public void testWrapsView() throws Exception {
  Context context = getContext();

  RelativeLayout root = new RelativeLayout(context);
  LinearLayout linearLayout = new LinearLayout(context);
  root.addView(linearLayout);

  for (int i = 0; i < 3; i++) {
    linearLayout.addView(new TextView(context));
  }

  ScalpelFrameLayout scalpel = ScalpelUtil.wrapWithScalpel(linearLayout);

  assertThat(linearLayout).hasParent(scalpel);
  assertThat(scalpel).hasParent(root);
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:18,代码来源:ScalpelUtilTest.java

示例3: testKeepsLayoutParams

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
@Test
public void testKeepsLayoutParams() throws Exception {
  Context context = getContext();

  RelativeLayout root = new RelativeLayout(context);
  FrameLayout frameLayout = new FrameLayout(context);
  root.addView(frameLayout);

  ViewGroup.LayoutParams layoutParams = frameLayout.getLayoutParams();
  assertNotNull(layoutParams);

  ScalpelFrameLayout scalpel = ScalpelUtil.wrapWithScalpel(frameLayout);

  // Scalpel should adapt the previous layout params
  Assert.assertThat(scalpel.getLayoutParams(), equalTo(layoutParams));

  dispatchThreeDowns(scalpel);

  // parameters should be same
  Assert.assertThat(scalpel.getLayoutParams(), equalTo(layoutParams));
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:22,代码来源:ScalpelUtilTest.java

示例4: testWrapsActivity

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
@Test
public void testWrapsActivity() throws Exception {
  Activity activity = Robolectric.buildActivity(Activity.class).create().get();

  ScalpelFrameLayout scalpel = ScalpelUtil.wrapWithScalpel(activity);


  @IdRes
  int id = 0x11;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    id = View.generateViewId();
  }

  scalpel.setId(id);

  View viewFromActivity = activity.findViewById(id);

  Assert.assertThat(viewFromActivity, instanceOf(ScalpelFrameLayout.class));
  Assert.assertThat((ScalpelFrameLayout) viewFromActivity, equalTo(scalpel));
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:21,代码来源:ScalpelUtilTest.java

示例5: testUnwrapsActivityOnThreeTaps

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
@Test
public void testUnwrapsActivityOnThreeTaps() throws Exception {
  Activity activity = Robolectric.buildActivity(Activity.class).create().get();

  ScalpelFrameLayout scalpel = ScalpelUtil.wrapWithScalpel(activity);

  @IdRes
  int id = 0x11;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
    id = View.generateViewId();
  }

  scalpel.setId(id);

  dispatchThreeDowns(scalpel);

  View nextViewFromActivity = activity.findViewById(id);
  Assert.assertThat(nextViewFromActivity, is(CoreMatchers.<View>nullValue()));
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:20,代码来源:ScalpelUtilTest.java

示例6: attach

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
public void attach(Activity activity, ViewGroup content){
    scalpelFrameLayout = new ScalpelFrameLayout(activity);

    ViewGroup parent = (ViewGroup) content.getParent();
    parent.removeView(content);
    parent.addView(scalpelFrameLayout,0);
    scalpelFrameLayout.addView(content);

    boolean scalpel = scalpelEnabled.get();
    scalpelFrameLayout.setLayerInteractionEnabled(scalpel);
    uiScalpelElement.setChecked(scalpel);
    uiScalpelWireframeElement.setEnabled(scalpel);

    boolean wireframe = scalpelWireframeEnabled.get();
    scalpelFrameLayout.setDrawViews(!wireframe);
    uiScalpelWireframeElement.setChecked(wireframe);
}
 
开发者ID:williamwebb,项目名称:debugdrawer,代码行数:18,代码来源:ScalpelModule.java

示例7: wrapWithScalpel

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
/**
 * Wraps activity content with new {@link ScalpelFrameLayout instance}
 * and turns on all of its features.
 * <p/>
 * You can unwrap the Activity with three fast clicks on screen.
 *
 * @param activity Activity to wrap content of.
 * @return New created Scalpel frame layout wrapping the activity content.
 */
public static ScalpelFrameLayout wrapWithScalpel(Activity activity) {
  if (activity == null) {
    throw new IllegalArgumentException("Parameter activity cannot be null");
  }

  View view = (View) activity.findViewById(android.R.id.content).getParent();

  return wrapWithScalpelInternal(view);
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:19,代码来源:ScalpelUtil.java

示例8: createScalpelFrameLayout

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
private static ScalpelFrameLayout createScalpelFrameLayout(Context context) {
  if (context == null) {
    throw new IllegalArgumentException("Parameter context cannot be null");
  }

  ScalpelFrameLayout scalpelFrameLayout = new ScalpelFrameLayout(context);
  scalpelFrameLayout.setLayerInteractionEnabled(true);
  scalpelFrameLayout.setDrawViews(true);
  scalpelFrameLayout.setDrawIds(true);

  return scalpelFrameLayout;
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:13,代码来源:ScalpelUtil.java

示例9: onTouch

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
@Override
public boolean onTouch(View v, MotionEvent event) {
  if (event.getAction() == MotionEvent.ACTION_DOWN) {
    long diff = getNextDiff();
    if (diff < THREE_CLICKS_THRESHOLD) {
      unwrapView((ScalpelFrameLayout) v);
      return true;
    }
  }

  return false;
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:13,代码来源:ScalpelUtil.java

示例10: testUnwrapsViewOnThreeTaps

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
@Test
public void testUnwrapsViewOnThreeTaps() throws Exception {
  Context context = getContext();

  RelativeLayout root = new RelativeLayout(context);
  LinearLayout linearLayout = new LinearLayout(context);
  root.addView(linearLayout);

  ScalpelFrameLayout scalpel = ScalpelUtil.wrapWithScalpel(linearLayout);

  dispatchThreeDowns(scalpel);

  assertThat(linearLayout).hasParent(root);
  assertThat(scalpel).hasParent(null);
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:16,代码来源:ScalpelUtilTest.java

示例11: testWrapViewOnNullParent

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
@Test
public void testWrapViewOnNullParent() throws Exception {
  TextView textView = new TextView(getContext());

  ScalpelFrameLayout scalpel = ScalpelUtil.wrapWithScalpel(textView);

  assertThat(textView).hasParent(scalpel);
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:9,代码来源:ScalpelUtilTest.java

示例12: dispatchThreeDowns

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
private void dispatchThreeDowns(ScalpelFrameLayout scalpel) {
  long millis = SystemClock.uptimeMillis();
  MotionEvent downEvent = obtain(millis, millis, ACTION_DOWN, 0, 0, 0, 0, 0, 0, 0, 0, 0);

  for (int i = 0; i < 3; i++) {
    scalpel.dispatchTouchEvent(downEvent);
  }
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:9,代码来源:ScalpelUtilTest.java

示例13: wrapItemWithScalpel

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
@OnClick(R.id.item_container) void wrapItemWithScalpel(View view){
  ScalpelFrameLayout scalpel = ScalpelUtil.wrapWithScalpel(view);

  scalpel.setId(R.id.scalpel_layout);
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:6,代码来源:MainActivity.java

示例14: wrapWithScalpelInternal

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
private static ScalpelFrameLayout wrapWithScalpelInternal(View view) {
  ScalpelFrameLayout scalpelFrameLayout = createScalpelFrameLayout(view.getContext());
  wrapView(view, scalpelFrameLayout);

  view.setLayoutParams(new ScalpelFrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));

  scalpelFrameLayout.setOnTouchListener(new UnwrapListener());

  return scalpelFrameLayout;
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:11,代码来源:ScalpelUtil.java

示例15: testUnwrapViewOnNullParent

import com.jakewharton.scalpel.ScalpelFrameLayout; //导入依赖的package包/类
@Test
public void testUnwrapViewOnNullParent() throws Exception {
  TextView textView = new TextView(getContext());

  ScalpelFrameLayout scalpel = ScalpelUtil.wrapWithScalpel(textView);

  dispatchThreeDowns(scalpel);

  assertThat(textView).hasParent(null);
}
 
开发者ID:jraska,项目名称:Scalpel-Util,代码行数:11,代码来源:ScalpelUtilTest.java


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