Example usage for android.widget FrameLayout getPaddingRight

List of usage examples for android.widget FrameLayout getPaddingRight

Introduction

In this page you can find the example usage for android.widget FrameLayout getPaddingRight.

Prototype

public int getPaddingRight() 

Source Link

Document

Returns the right padding of this view.

Usage

From source file:com.tomeokin.lspush.biz.collect.ImageDialogFragment.java

@SuppressLint("InflateParams")
@NonNull/*from   w ww  .  ja  v a2 s . c  o m*/
@Override
protected BaseDialogFragment.Builder config(@NonNull BaseDialogFragment.Builder builder) {
    ImageView imageView = (ImageView) LayoutInflater.from(getContext()).inflate(R.layout.dialog_image, null);
    builder.setTitle(R.string.use_current_image).addCustomMessageView(imageView)
            .addPositiveButton(R.string.dialog_ok, this).addNegativeButton(R.string.dialog_cancel, this);

    final String url = getArguments().getString(ARG_IMAGE_URL);
    final Uri uri = Uri.parse(url);
    int width = getArguments().getInt(ARG_IMAGE_WIDTH);
    int height = getArguments().getInt(ARG_IMAGE_HEIGHT);

    final View content = getActivity().getWindow().findViewById(Window.ID_ANDROID_CONTENT);
    final FrameLayout container = builder.getCustomViewHolder();
    final float radio = optimumRadio(content, container, width, height);
    width = (int) (width * radio);
    height = (int) (height * radio);

    ViewGroup.LayoutParams lp = container.getLayoutParams();
    lp.width = width + container.getPaddingLeft() + container.getPaddingRight();
    lp.height = height + container.getPaddingTop() + container.getPaddingBottom();

    Glide.with(this).load(uri).diskCacheStrategy(DiskCacheStrategy.ALL).override(width, height).fitCenter()
            .into(imageView);

    return builder;
}