Example usage for android.widget LinearLayout getPaddingLeft

List of usage examples for android.widget LinearLayout getPaddingLeft

Introduction

In this page you can find the example usage for android.widget LinearLayout getPaddingLeft.

Prototype

public int getPaddingLeft() 

Source Link

Document

Returns the left padding of this view.

Usage

From source file:com.nttec.everychan.ui.presentation.BoardFragment.java

/**
 * ? thumbnail view  ?  ?  ?.//from ww w .j a v  a  2s  .  c o m
 *  ??  thumbnail view   {@link #thumbnailWidth}
 */
private FloatingModel[] measureFloatingModels(LayoutInflater inflater) {
    Point displaySize = AppearanceUtils.getDisplaySize(activity.getWindowManager().getDefaultDisplay());

    LinearLayout view = (LinearLayout) inflater.inflate(R.layout.post_item_layout, (ViewGroup) rootView, false);

    TextView commentView = (TextView) view.findViewById(R.id.post_comment);
    TextPaint textPaint = commentView.getPaint();
    int textLineHeight = Math.max(1, commentView.getLineHeight());
    int rootWidth = (int) (displaySize.x * settings.getRootViewWeight());
    postItemPadding = view.getPaddingLeft() + view.getPaddingRight();
    int textWidth = postItemWidth = rootWidth - postItemPadding;

    View thumbnailView = view.findViewById(R.id.post_thumbnail);
    ViewGroup.MarginLayoutParams thumbnailLayoutParams = (ViewGroup.MarginLayoutParams) thumbnailView
            .getLayoutParams();
    thumbnailMargin = thumbnailLayoutParams.leftMargin + thumbnailLayoutParams.rightMargin;

    View attachmentTypeView = thumbnailView.findViewById(R.id.post_thumbnail_attachment_type);
    FloatingModel[] floatingModels = new FloatingModel[2];

    attachmentTypeView.setVisibility(View.GONE);
    thumbnailView.measure(displaySize.x, displaySize.y);
    Point thumbnailSize = new Point(thumbnailMargin + thumbnailView.getMeasuredWidth(),
            thumbnailView.getMeasuredHeight());
    floatingModels[0] = new FloatingModel(thumbnailSize, textWidth, textPaint);

    attachmentTypeView.setVisibility(View.VISIBLE);
    thumbnailView.measure(displaySize.x, displaySize.y);
    thumbnailSize = new Point(thumbnailMargin + thumbnailView.getMeasuredWidth(),
            thumbnailView.getMeasuredHeight());
    floatingModels[1] = new FloatingModel(thumbnailSize, textWidth, textPaint);

    thumbnailWidth = thumbnailSize.x;
    maxItemLines = divcell(thumbnailSize.y, textLineHeight);

    return floatingModels;
}