Search in sources :

Example 81 with Point

use of android.graphics.Point in project XobotOS by xamarin.

the class View method setBottom.

/**
     * Sets the bottom position of this view relative to its parent. This method is meant to be
     * called by the layout system and should not generally be called otherwise, because the
     * property may be changed at any time by the layout.
     *
     * @param bottom The bottom of this view, in pixels.
     */
public final void setBottom(int bottom) {
    if (bottom != mBottom) {
        updateMatrix();
        final boolean matrixIsIdentity = mTransformationInfo == null || mTransformationInfo.mMatrixIsIdentity;
        if (matrixIsIdentity) {
            if (mAttachInfo != null) {
                int maxBottom;
                if (bottom < mBottom) {
                    maxBottom = mBottom;
                } else {
                    maxBottom = bottom;
                }
                invalidate(0, 0, mRight - mLeft, maxBottom - mTop);
            }
        } else {
            // Double-invalidation is necessary to capture view's old and new areas
            invalidate(true);
        }
        int width = mRight - mLeft;
        int oldHeight = mBottom - mTop;
        mBottom = bottom;
        onSizeChanged(width, mBottom - mTop, width, oldHeight);
        if (!matrixIsIdentity) {
            if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
                // A change in dimension means an auto-centered pivot point changes, too
                mTransformationInfo.mMatrixDirty = true;
            }
            // force another invalidation with the new orientation
            mPrivateFlags |= DRAWN;
            invalidate(true);
        }
        mBackgroundSizeChanged = true;
        invalidateParentIfNeeded();
    }
}
Also used : Paint(android.graphics.Paint) Point(android.graphics.Point)

Example 82 with Point

use of android.graphics.Point in project XobotOS by xamarin.

the class ViewRootImpl method updateConfiguration.

void updateConfiguration(Configuration config, boolean force) {
    if (DEBUG_CONFIGURATION)
        Log.v(TAG, "Applying new config to window " + mWindowAttributes.getTitle() + ": " + config);
    CompatibilityInfo ci = mCompatibilityInfo.getIfNeeded();
    if (ci != null) {
        config = new Configuration(config);
        ci.applyToConfiguration(config);
    }
    synchronized (sConfigCallbacks) {
        for (int i = sConfigCallbacks.size() - 1; i >= 0; i--) {
            sConfigCallbacks.get(i).onConfigurationChanged(config);
        }
    }
    if (mView != null) {
        // At this point the resources have been updated to
        // have the most recent config, whatever that is.  Use
        // the on in them which may be newer.
        config = mView.getResources().getConfiguration();
        if (force || mLastConfiguration.diff(config) != 0) {
            mLastConfiguration.setTo(config);
            mView.dispatchConfigurationChanged(config);
        }
    }
}
Also used : Configuration(android.content.res.Configuration) CompatibilityInfo(android.content.res.CompatibilityInfo) Paint(android.graphics.Paint) Point(android.graphics.Point)

Example 83 with Point

use of android.graphics.Point in project XobotOS by xamarin.

the class View method setTop.

/**
     * Sets the top position of this view relative to its parent. This method is meant to be called
     * by the layout system and should not generally be called otherwise, because the property
     * may be changed at any time by the layout.
     *
     * @param top The top of this view, in pixels.
     */
public final void setTop(int top) {
    if (top != mTop) {
        updateMatrix();
        final boolean matrixIsIdentity = mTransformationInfo == null || mTransformationInfo.mMatrixIsIdentity;
        if (matrixIsIdentity) {
            if (mAttachInfo != null) {
                int minTop;
                int yLoc;
                if (top < mTop) {
                    minTop = top;
                    yLoc = top - mTop;
                } else {
                    minTop = mTop;
                    yLoc = 0;
                }
                invalidate(0, yLoc, mRight - mLeft, mBottom - minTop);
            }
        } else {
            // Double-invalidation is necessary to capture view's old and new areas
            invalidate(true);
        }
        int width = mRight - mLeft;
        int oldHeight = mBottom - mTop;
        mTop = top;
        onSizeChanged(width, mBottom - mTop, width, oldHeight);
        if (!matrixIsIdentity) {
            if ((mPrivateFlags & PIVOT_EXPLICITLY_SET) == 0) {
                // A change in dimension means an auto-centered pivot point changes, too
                mTransformationInfo.mMatrixDirty = true;
            }
            // force another invalidation with the new orientation
            mPrivateFlags |= DRAWN;
            invalidate(true);
        }
        mBackgroundSizeChanged = true;
        invalidateParentIfNeeded();
    }
}
Also used : Paint(android.graphics.Paint) Point(android.graphics.Point)

Example 84 with Point

use of android.graphics.Point in project WordPress-Android by wordpress-mobile.

the class ImageUtils method getMaximumThumbnailWidthForEditor.

/**
     * Get the maximum size a thumbnail can be to fit in either portrait or landscape orientations.
     */
public static int getMaximumThumbnailWidthForEditor(Context context) {
    int maximumThumbnailWidthForEditor;
    Point size = DisplayUtils.getDisplayPixelSize(context);
    int screenWidth = size.x;
    int screenHeight = size.y;
    maximumThumbnailWidthForEditor = (screenWidth > screenHeight) ? screenHeight : screenWidth;
    // 48dp of padding on each side so you can still place the cursor next to the image.
    int padding = DisplayUtils.dpToPx(context, 48) * 2;
    maximumThumbnailWidthForEditor -= padding;
    return maximumThumbnailWidthForEditor;
}
Also used : Point(android.graphics.Point) Point(android.graphics.Point) Paint(android.graphics.Paint)

Example 85 with Point

use of android.graphics.Point in project TourGuide by worker8.

the class ToolTilMeasureTest method getScreenHeight.

public int getScreenHeight(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    return size.y;
}
Also used : Point(android.graphics.Point) Display(android.view.Display)

Aggregations

Point (android.graphics.Point)1151 Display (android.view.Display)217 Rect (android.graphics.Rect)194 Paint (android.graphics.Paint)170 WindowManager (android.view.WindowManager)138 RemoteException (android.os.RemoteException)76 RectF (android.graphics.RectF)62 Bitmap (android.graphics.Bitmap)54 Resources (android.content.res.Resources)41 View (android.view.View)41 ArrayList (java.util.ArrayList)40 ImageView (android.widget.ImageView)37 Camera (android.hardware.Camera)36 Canvas (android.graphics.Canvas)31 Matrix (android.graphics.Matrix)29 Animator (android.animation.Animator)27 SuppressLint (android.annotation.SuppressLint)27 Configuration (android.content.res.Configuration)26 IOException (java.io.IOException)24 Message (android.os.Message)22