Java Code Examples for android.widget.ImageView#getPaddingBottom()

The following examples show how to use android.widget.ImageView#getPaddingBottom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TrashView.java    From dingo with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Window上での描画領域を取得します。
 * 当たり判定の矩形を表します。
 *
 * @param outRect 変更を加えるRect
 */
void getWindowDrawingRect(Rect outRect) {
    // Gravityが逆向きなので、矩形の当たり判定も上下逆転(top/bottom)
    // top(画面上で下方向)の判定を多めに設定
    final ImageView iconView = hasActionTrashIcon() ? mActionTrashIconView : mFixedTrashIconView;
    final float iconPaddingLeft = iconView.getPaddingLeft();
    final float iconPaddingTop = iconView.getPaddingTop();
    final float iconWidth = iconView.getWidth() - iconPaddingLeft - iconView.getPaddingRight();
    final float iconHeight = iconView.getHeight() - iconPaddingTop - iconView.getPaddingBottom();
    final float x = mTrashIconRootView.getX() + iconPaddingLeft;
    final float y = mRootView.getHeight() - mTrashIconRootView.getY() - iconPaddingTop - iconHeight;
    final int left = (int) (x - TARGET_CAPTURE_HORIZONTAL_REGION * mMetrics.density);
    final int top = -mRootView.getHeight();
    final int right = (int) (x + iconWidth + TARGET_CAPTURE_HORIZONTAL_REGION * mMetrics.density);
    final int bottom = (int) (y + iconHeight + TARGET_CAPTURE_VERTICAL_REGION * mMetrics.density);
    outRect.set(left, top, right, bottom);
}
 
Example 2
Source File: TrashView.java    From dingo with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 削除アイコンの中心Y座標を取得します。
 *
 * @return 削除アイコンの中心Y座標
 */
float getTrashIconCenterY() {
    final ImageView iconView = hasActionTrashIcon() ? mActionTrashIconView : mFixedTrashIconView;
    final float iconViewHeight = iconView.getHeight();
    final float iconViewPaddingBottom = iconView.getPaddingBottom();
    final float iconHeight = iconViewHeight - iconView.getPaddingTop() - iconViewPaddingBottom;
    final float y = mRootView.getHeight() - mTrashIconRootView.getY() - iconViewHeight + iconViewPaddingBottom;
    return y + iconHeight / 2;
}
 
Example 3
Source File: Sizes.java    From sketch with Apache License 2.0 5 votes vote down vote up
void resetSizes(@NonNull ImageView imageView) {
    final int imageViewWidth = imageView.getWidth() - imageView.getPaddingLeft() - imageView.getPaddingRight();
    final int imageViewHeight = imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
    if (imageViewWidth == 0 || imageViewHeight == 0) {
        return;
    }

    Drawable drawable = SketchUtils.getLastDrawable(imageView.getDrawable());
    if (drawable == null) {
        return;
    }

    final int drawableWidth = drawable.getIntrinsicWidth();
    final int drawableHeight = drawable.getIntrinsicHeight();
    if (drawableWidth == 0 || drawableHeight == 0) {
        return;
    }

    viewSize.set(imageViewWidth, imageViewHeight);
    drawableSize.set(drawableWidth, drawableHeight);
    if (drawable instanceof SketchDrawable && !(drawable instanceof SketchLoadingDrawable)) {
        SketchDrawable sketchDrawable = (SketchDrawable) drawable;
        imageSize.set(sketchDrawable.getOriginWidth(), sketchDrawable.getOriginHeight());
    } else {
        imageSize.set(drawableWidth, drawableHeight);
    }
}
 
Example 4
Source File: PhotoViewAttacher.java    From RotatePhotoView with Apache License 2.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 5
Source File: PhotoViewAttacher.java    From android-project-wo2b with Apache License 2.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 6
Source File: PhotoViewAttacher.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 7
Source File: PhotoViewAttacher.java    From Favorite-Android-Client with Apache License 2.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 8
Source File: PhotoViewAttacher.java    From BigApp_Discuz_Android with Apache License 2.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 9
Source File: ImageViewScaler.java    From MultiView with Apache License 2.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 10
Source File: PhotoViewAttacher.java    From Dashboard with MIT License 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 11
Source File: PhotoViewAttacher.java    From MNImageBrowser with GNU General Public License v3.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 12
Source File: PhotoViewAttacher.java    From ZoomPreviewPicture with Apache License 2.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 13
Source File: PhotoViewAttacher.java    From GalleryFinal with Apache License 2.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 14
Source File: AnimationUtility.java    From iBeebo with GNU General Public License v3.0 4 votes vote down vote up
public static Rect getBitmapRectFromImageView(ImageView imageView) {
    Drawable drawable = imageView.getDrawable();
    Bitmap bitmap = null;
    if (drawable instanceof BitmapDrawable) {
        bitmap = ((BitmapDrawable) drawable).getBitmap();
    }

    Rect rect = new Rect();
    boolean isVisible = imageView.getGlobalVisibleRect(rect);
    if (!isVisible) {
        int[] location = new int[2];
        imageView.getLocationOnScreen(location);

        rect.left = location[0];
        rect.top = location[1];
        rect.right = rect.left + imageView.getWidth();
        rect.bottom = rect.top + imageView.getHeight();
    }

    if (bitmap != null) {

        int bitmapWidth = bitmap.getWidth();
        int bitmapHeight = bitmap.getHeight();

        int imageViewWidth = imageView.getWidth() - imageView.getPaddingLeft() - imageView.getPaddingRight();
        int imageviewHeight = imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();

        float startScale;
        if ((float) imageViewWidth / bitmapWidth > (float) imageviewHeight / bitmapHeight) {
            // Extend start bounds horizontally
            startScale = (float) imageviewHeight / bitmapHeight;

        } else {
            startScale = (float) imageViewWidth / bitmapWidth;

        }

        bitmapHeight = (int) (bitmapHeight * startScale);
        bitmapWidth = (int) (bitmapWidth * startScale);

        int deltaX = (imageViewWidth - bitmapWidth) / 2;
        int deltaY = (imageviewHeight - bitmapHeight) / 2;

        rect.set(rect.left + deltaX, rect.top + deltaY, rect.right - deltaX, rect.bottom - deltaY);

        return rect;
    } else {
        return null;
    }

}
 
Example 15
Source File: PhotoViewAttacher.java    From zen4android with MIT License 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 16
Source File: PhotoViewAttacher.java    From Matisse-Kotlin with Apache License 2.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 17
Source File: PhotoViewAttacher.java    From OmniList with GNU Affero General Public License v3.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 18
Source File: PhotoViewAttacher.java    From imsdk-android with MIT License 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 19
Source File: PhotoViewAttacher.java    From BlackLight with GNU General Public License v3.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    if (null == imageView)
        return 0;
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
 
Example 20
Source File: PhotoViewAttacher.java    From giffun with Apache License 2.0 4 votes vote down vote up
private int getImageViewHeight(ImageView imageView) {
    return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}