List of usage examples for android.view View getPaddingRight
public int getPaddingRight()
From source file:com.android.mail.browse.ConversationItemViewCoordinates.java
@SuppressLint("NewApi") private static void setFramePadding(Context context, ViewGroup view, boolean useFullPadding) { final Resources res = context.getResources(); final int padding = res.getDimensionPixelSize( useFullPadding ? R.dimen.conv_list_card_border_padding : R.dimen.conv_list_no_border_padding); final View frame = view.findViewById(R.id.conversation_item_frame); if (Utils.isRunningJBMR1OrLater()) { // start, top, end, bottom frame.setPaddingRelative(frame.getPaddingStart(), padding, frame.getPaddingEnd(), padding); } else {// w ww. j a v a2 s. com frame.setPadding(frame.getPaddingLeft(), padding, frame.getPaddingRight(), padding); } }
From source file:com.animedetour.android.view.animator.SlideInLeftAnimator.java
public int getWidth(View itemView) { return itemView.getMeasuredWidth() + itemView.getPaddingRight() + ((RecyclerView.LayoutParams) itemView.getLayoutParams()).rightMargin; }
From source file:android.tumb.com.tumb.Misc.DividerItemDecoration.java
@Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), 0); }
From source file:com.tomeokin.lspush.biz.collect.ImageDialogFragment.java
private float optimumRadio(View content, View container, float width, float height) { final int maxWidth = content.getWidth() - container.getPaddingLeft() - container.getPaddingRight() - 50; final int maxHeight = content.getHeight() / 2 - container.getPaddingTop() - container.getPaddingBottom(); //Timber.i("maxWidth: %d, maxHeight: %d", maxWidth, maxHeight); return ImageUtils.optimumRadio(maxWidth, maxHeight, width, height); }
From source file:pl.motyczko.scrollheadersample.ColorFragment.java
/** * {@inheritDoc}//from w w w.j av a 2 s. c o m */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final int color = getArguments().getInt("color"); View v = inflater.inflate(R.layout.fragment_color, container, false); v.setBackgroundColor(color); int paddingTop = getActivity().findViewById(R.id.view_pager_header).getMeasuredHeight(); v.setPadding(v.getPaddingLeft(), paddingTop, v.getPaddingRight(), v.getPaddingBottom()); return v; }
From source file:pl.kodujdlapolski.na4lapy.ui.drawer.DrawerActivityHandler.java
private void setDrawerHeader() { View headerView = navigationView.getHeaderView(0); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { headerView.setPadding(headerView.getPaddingLeft(), (int) (headerView.getPaddingTop() + activity.getResources().getDimension(R.dimen.status_bar)), headerView.getPaddingRight(), headerView.getPaddingBottom()); }/*from ww w . j a v a2 s . c o m*/ }
From source file:com.waz.zclient.pages.main.conversation.views.row.message.views.TextMessageWithTimestamp.java
private void expandTimestamp() { if (messageViewContainer.getShownTimestampView() != null && messageViewContainer.getShownTimestampView() != this) { messageViewContainer.getShownTimestampView().collapseTimestamp(); }/* www . j a va2 s. c om*/ messageViewContainer.getTimestampShownSet().add(messageId); messageViewContainer.setShownTimestampView(this); timestampTextView.setVisibility(VISIBLE); View parent = (View) timestampTextView.getParent(); final int widthSpec = MeasureSpec.makeMeasureSpec( parent.getMeasuredWidth() - parent.getPaddingLeft() - parent.getPaddingRight(), MeasureSpec.AT_MOST); final int heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); timestampTextView.measure(widthSpec, heightSpec); ValueAnimator animator = createHeightAnimator(timestampTextView, 0, timestampTextView.getMeasuredHeight()); animator.start(); }
From source file:com.tmall.wireless.tangram.view.BannerViewPager.java
protected void onMeasurePage(int widthMeasureSpec, int heightMeasureSpec) { View child = pagerAdapter.getViewAtPosition(getCurrentItem()); if (child == null) { child = getChildAt(0);//from w w w . j ava2s . co m } if (child == null) { return; } int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View view = getChildAt(i); if ((view.getPaddingLeft() != itemMarginLeft || view.getPaddingTop() != itemMarginTop || view.getPaddingRight() != itemMarginRight || view.getPaddingBottom() != itemMarginBottom)) { view.setPadding(itemMarginLeft, itemMarginTop, itemMarginRight, itemMarginBottom); } } ViewGroup.LayoutParams lp = child.getLayoutParams(); final int childWidthSpec = getChildMeasureSpec(widthMeasureSpec, 0, lp.width); final int childHeightSpec = getChildMeasureSpec(heightMeasureSpec, 0, lp.height); int childWidth = (int) ((MeasureSpec.getSize(childWidthSpec) - getPaddingLeft() - getPaddingRight()) * pagerAdapter.getPageWidth(getCurrentItem())); int childHeight = 0; if (!Double.isNaN(itemRatio)) { int itemHeight = (int) (childWidth / itemRatio); for (int i = 0; i < childCount; i++) { View view = getChildAt(i); view.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(itemHeight, MeasureSpec.EXACTLY)); } } else { for (int i = 0; i < childCount; i++) { View view = getChildAt(i); if (pagerAdapter.getPageWidth(getCurrentItem()) != 1) { view.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); } else { view.measure(childWidthSpec, childHeightSpec); } } } childWidth = itemMarginLeft + child.getMeasuredWidth() + itemMarginRight; childHeight = itemMarginTop + child.getMeasuredHeight() + itemMarginBottom; if (!Float.isNaN(ratio)) { heightMeasureSpec = MeasureSpec.makeMeasureSpec((int) (getMeasuredWidth() / ratio), MeasureSpec.EXACTLY); setMeasuredDimension(widthMeasureSpec, heightMeasureSpec); for (int i = 0; i < childCount; i++) { View view = getChildAt(i); view.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), heightMeasureSpec); } } else { if (autoMeasureHeight) { constrainLength = MeasureSpec.makeMeasureSpec(childHeight, MeasureSpec.EXACTLY); setMeasuredDimension(getMeasuredWidth(), childHeight); } } if (!pagerAdapter.isEnableMultiScr()) { return; } int pageLength = getMeasuredWidth(); final int childLength = child.getMeasuredWidth(); // Check that the measurement was successful if (childLength > 0) { int difference = pageLength - childLength; if (getPageMargin() == 0) { setPageMargin(-difference); } int offscreen = (int) Math.ceil((float) pageLength / (float) childLength) + 1; setOffscreenPageLimit(offscreen); requestLayout(); } }
From source file:com.tmall.wireless.tangram3.view.BannerViewPager.java
protected void onMeasurePage(int widthMeasureSpec, int heightMeasureSpec) { if (pagerAdapter == null) { return;//from w ww . j a va2 s. c o m } View child = pagerAdapter.getViewAtPosition(getCurrentItem()); if (child == null) { child = getChildAt(0); } if (child == null) { return; } int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View view = getChildAt(i); if ((view.getPaddingLeft() != itemMarginLeft || view.getPaddingTop() != itemMarginTop || view.getPaddingRight() != itemMarginRight || view.getPaddingBottom() != itemMarginBottom)) { view.setPadding(itemMarginLeft, itemMarginTop, itemMarginRight, itemMarginBottom); } } ViewGroup.LayoutParams lp = child.getLayoutParams(); final int childWidthSpec = getChildMeasureSpec(widthMeasureSpec, 0, lp.width); final int childHeightSpec = getChildMeasureSpec(heightMeasureSpec, 0, lp.height); int childWidth = (int) ((MeasureSpec.getSize(childWidthSpec) - getPaddingLeft() - getPaddingRight()) * pagerAdapter.getPageWidth(getCurrentItem())); int childHeight = 0; if (!Double.isNaN(itemRatio) || itemRatio != 0) { int itemHeight = (int) (childWidth / itemRatio); for (int i = 0; i < childCount; i++) { View view = getChildAt(i); view.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(itemHeight, MeasureSpec.EXACTLY)); } } else { for (int i = 0; i < childCount; i++) { View view = getChildAt(i); if (pagerAdapter.getPageWidth(getCurrentItem()) != 1) { view.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); } else { view.measure(childWidthSpec, childHeightSpec); } } } childWidth = itemMarginLeft + child.getMeasuredWidth() + itemMarginRight; childHeight = itemMarginTop + child.getMeasuredHeight() + itemMarginBottom; if (!Float.isNaN(ratio)) { heightMeasureSpec = MeasureSpec.makeMeasureSpec((int) (getMeasuredWidth() / ratio), MeasureSpec.EXACTLY); setMeasuredDimension(widthMeasureSpec, heightMeasureSpec); for (int i = 0; i < childCount; i++) { View view = getChildAt(i); view.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), heightMeasureSpec); } } else { if (autoMeasureHeight) { constrainLength = MeasureSpec.makeMeasureSpec(childHeight, MeasureSpec.EXACTLY); setMeasuredDimension(getMeasuredWidth(), childHeight); } } if (!pagerAdapter.isEnableMultiScr()) { return; } int pageLength = getMeasuredWidth(); final int childLength = child.getMeasuredWidth(); // Check that the measurement was successful if (childLength > 0) { int difference = pageLength - childLength; if (getPageMargin() == 0) { setPageMargin(-difference); } int offscreen = (int) Math.ceil((float) pageLength / (float) childLength) + 1; setOffscreenPageLimit(offscreen); requestLayout(); } }
From source file:com.android.contacts.list.MultiSelectContactsListFragment.java
private void setListViewPaddingTop(View listView, int paddingTop) { listView.setPadding(listView.getPaddingLeft(), paddingTop, listView.getPaddingRight(), listView.getPaddingBottom()); }