public S hasBaseline(int baseline) { isNotNull(); int actualBaseline = actual.getBaseline(); assertThat(actualBaseline) // .overridingErrorMessage("Expected baseline <%s> but was <%s>", baseline, actualBaseline) // .isEqualTo(baseline); return myself; }
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { final int count = getChildCount(); final int parentLeft = getPaddingLeft(); final int parentRight = right - left - getPaddingRight(); final int parentContentWidth = parentRight - parentLeft; final int parentTop = getPaddingTop(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); if (child.getVisibility() == GONE) { continue; } final int width = child.getMeasuredWidth(); final int height = child.getMeasuredHeight(); final int childLeft = parentLeft + (parentContentWidth - width) / 2; final int childTop; if (mBaseline != -1 && child.getBaseline() != -1) { childTop = parentTop + mBaseline - child.getBaseline(); } else { childTop = parentTop; } child.layout(childLeft, childTop, childLeft + width, childTop + height); } }
@Override public int getBaseline() { if (child == null) return super.getBaseline(); return (labelTextView.getVisibility() != GONE ? labelTextView.getMeasuredHeight() + 1 : 0) + child.getBaseline(); }
final int baseline = child.getBaseline(); if (baseline != -1) { maxChildBaseline = Math.max(maxChildBaseline, baseline);
@Override public int getBaseline() { View child = getSelectedView(); if (child != null) { final int childBaseline = child.getBaseline(); if(childBaseline < 0) return -1; int paddingTop = getPaddingTop(); if(mLabelView != null) paddingTop += mLabelView.getMeasuredHeight(); int remainHeight = getMeasuredHeight() - paddingTop - getPaddingBottom() - getDividerDrawableHeight(); int verticalGravity = mGravity & Gravity.VERTICAL_GRAVITY_MASK; switch (verticalGravity) { case Gravity.TOP: return paddingTop + childBaseline; case Gravity.BOTTOM: return paddingTop + remainHeight - child.getMeasuredHeight() + childBaseline; default: return (remainHeight - child.getMeasuredHeight()) / 2 + paddingTop + childBaseline; } } return -1; }
attributes.add(new ViewAttribute<>("Width", value)); attributes.add(new ViewAttribute<>("Baseline", view.getBaseline()));
@Override public void OnDisplay(View currentview, KeyboardView currentKeyboard) { ScrollView mScroll = (ScrollView) findViewById(R.id.scroll_content); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.ABOVE, currentKeyboard.getId()); mScroll.setLayoutParams(params); mScroll.scrollTo(0, currentview.getBaseline()); //Scrolls to focused EditText } @Override public void OnHide(KeyboardView currentKeyboard) { ScrollView mScroll = (ScrollView) findViewById(R.id.scroll_content); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); mScroll.setLayoutParams(params); }
public static void applyExistingBotMarginFromBaseline(View view) { final int baseline = view.getBaseline(); final int height = view.getHeight(); final ViewGroup.MarginLayoutParams marginLayoutParams; try { marginLayoutParams = ((ViewGroup.MarginLayoutParams) view.getLayoutParams()); } catch (ClassCastException e) { throw new IllegalArgumentException("Applying margins on a view with wrong layout params."); } final int baselineMarginValue = baseline + marginLayoutParams.bottomMargin; marginLayoutParams.bottomMargin = baselineMarginValue - height; view.setLayoutParams(marginLayoutParams); }
public S hasBaseline(int baseline) { isNotNull(); int actualBaseline = actual.getBaseline(); assertThat(actualBaseline) // .overridingErrorMessage("Expected baseline <%s> but was <%s>", baseline, actualBaseline) // .isEqualTo(baseline); return myself; }
case ALIGN_ITEMS_BASELINE: if (flexWrap != FLEX_WRAP_WRAP_REVERSE) { int marginTop = flexLine.maxBaseline - view.getBaseline(); marginTop = Math.max(marginTop, lp.topMargin); view.layout(left, top + marginTop, right, bottom + marginTop); } else { int marginBottom = flexLine.maxBaseline - view.getMeasuredHeight() + view .getBaseline(); marginBottom = Math.max(marginBottom, lp.bottomMargin); view.layout(left, top - marginBottom, right, bottom - marginBottom);
int titleViewBaseline = mTitleView.getBaseline(); int mBreadcrumbViewHeight = mBreadcrumbView == null ? 0 : mBreadcrumbView.getMeasuredHeight(); int guidanceTextContainerTop = mTitleKeylinePixels
final int currBaseLine = child.getBaseline(); if (spAl == SpecialAllignment.TOP_OF_PREVIOUS) if (nextChild.getVisibility() != GONE) final int nextBaseLine = nextChild.getBaseline(); final int tmpBaseLine = nextBaseLine + topOfPreviousBaseLine(currBaseLine, child.getMeasuredHeight(), nextBaseLine);
if (lp.height != LayoutParams.MATCH_PARENT) final int currBaseLine = child.getBaseline(); if (spAl == SpecialAllignment.TOP_OF_PREVIOUS) && nextChild.getLayoutParams().height == ViewGroup.LayoutParams.WRAP_CONTENT) final int tmpBaseLine = topOfPreviousBaseLine(child.getBaseline(), child.getMeasuredHeight(), nextChild.getBaseline()); final int width = child.getMeasuredWidth(); final int height = child.getMeasuredHeight();
.max(flexLine.maxBaseline, child.getBaseline() + lp.topMargin); } else { child.getMeasuredHeight() - child.getBaseline() + lp.bottomMargin); LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (mFlexWrap != FLEX_WRAP_WRAP_REVERSE) { int marginTop = flexLine.maxBaseline - child.getBaseline(); marginTop = Math.max(marginTop, lp.topMargin); largestHeightInLine = Math.max(largestHeightInLine, } else { int marginBottom = flexLine.maxBaseline - child.getMeasuredHeight() + child.getBaseline(); marginBottom = Math.max(marginBottom, lp.bottomMargin); largestHeightInLine = Math.max(largestHeightInLine,
@Override public int getBaseline() { View child = null; if (getChildCount() > 0) { child = getChildAt(0); } else if (mAdapter != null && mAdapter.getCount() > 0) { child = makeAndAddView(0); mRecycler.put(0, child); removeAllViewsInLayout(); } if (child != null) { final int childBaseline = child.getBaseline(); return childBaseline >= 0 ? child.getTop() + childBaseline : -1; } else { return -1; } }
@Override public int getBaseline() { View child = null; if (getChildCount() > 0) { child = getChildAt(0); } else if (mAdapter != null && mAdapter.getCount() > 0) { child = makeAndAddView(0); mRecycler.put(0, child); removeAllViewsInLayout(); } if (child != null) { final int childBaseline = child.getBaseline(); return childBaseline >= 0 ? child.getTop() + childBaseline : -1; } else { return -1; } }
final int currBaseLine = child.getBaseline(); final int currHeight = child.getMeasuredHeight(); if (spAl == SpecialAllignment.TOP_OF_PREVIOUS) && nextChild.getLayoutParams().height == ViewGroup.LayoutParams.WRAP_CONTENT) final int nextBaseLine = nextChild.getBaseline(); final int tmpBaseLine = nextBaseLine + topOfPreviousBaseLine(currBaseLine, currHeight, nextBaseLine);
fillMandatoryFields(v, data, parentData); try { data.put("Baseline", v.getBaseline()); } catch (Exception e) { data.put("Baseline", e.getClass().getSimpleName());