Search in sources :

Example 96 with Point

use of android.graphics.Point in project LuaViewSDK by alibaba.

the class AndroidUtil method getAppUsableScreenSize.

public static Point getAppUsableScreenSize(Context context) {
    WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = windowManager.getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    return size;
}
Also used : Point(android.graphics.Point) WindowManager(android.view.WindowManager) Display(android.view.Display)

Example 97 with Point

use of android.graphics.Point in project LuaViewSDK by alibaba.

the class AndroidUtil method getRealScreenSize.

public static Point getRealScreenSize(Context context) {
    WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = windowManager.getDefaultDisplay();
    Point size = new Point();
    if (Build.VERSION.SDK_INT >= 17) {
        display.getRealSize(size);
    } else if (Build.VERSION.SDK_INT >= 14) {
        try {
            size.x = (Integer) Display.class.getMethod("getRawWidth").invoke(display);
            size.y = (Integer) Display.class.getMethod("getRawHeight").invoke(display);
        } catch (IllegalAccessException e) {
        } catch (InvocationTargetException e) {
        } catch (NoSuchMethodException e) {
        }
    }
    return size;
}
Also used : Point(android.graphics.Point) InvocationTargetException(java.lang.reflect.InvocationTargetException) WindowManager(android.view.WindowManager) Display(android.view.Display)

Example 98 with Point

use of android.graphics.Point in project SmartAndroidSource by jaychou2012.

the class DragGridView method animateGap.

protected void animateGap(int target) {
    for (int i = 0; i < getChildCount(); i++) {
        View v = getChildAt(i);
        if (i == dragged)
            continue;
        int newPos = i;
        if (dragged < target && i >= dragged + 1 && i <= target)
            newPos--;
        else if (target < dragged && i >= target && i < dragged)
            newPos++;
        // animate
        int oldPos = i;
        if (newPositions.get(i) != -1)
            oldPos = newPositions.get(i);
        if (oldPos == newPos)
            continue;
        Point oldXY = getCoorFromIndex(oldPos);
        Point newXY = getCoorFromIndex(newPos);
        Point oldOffset = new Point(oldXY.x - v.getLeft(), oldXY.y - v.getTop());
        Point newOffset = new Point(newXY.x - v.getLeft(), newXY.y - v.getTop());
        TranslateAnimation translate = new TranslateAnimation(Animation.ABSOLUTE, oldOffset.x, Animation.ABSOLUTE, newOffset.x, Animation.ABSOLUTE, oldOffset.y, Animation.ABSOLUTE, newOffset.y);
        translate.setDuration(animT);
        translate.setFillEnabled(true);
        translate.setFillAfter(true);
        v.clearAnimation();
        v.startAnimation(translate);
        newPositions.set(i, newPos);
    }
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) Point(android.graphics.Point) ImageView(android.widget.ImageView) View(android.view.View) Point(android.graphics.Point)

Example 99 with Point

use of android.graphics.Point in project SmartAndroidSource by jaychou2012.

the class DragGridView method getCoorFromIndex.

protected Point getCoorFromIndex(int index) {
    int col = index % colCount;
    int row = index / colCount;
    return new Point(padding + (childSize + padding) * col, padding + (childSize + padding) * row - scroll);
}
Also used : Point(android.graphics.Point) Point(android.graphics.Point)

Example 100 with Point

use of android.graphics.Point in project Android-Developers-Samples by johnjohndoe.

the class DefaultCardStreamAnimator method getAppearingAnimator.

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
@Override
public ObjectAnimator getAppearingAnimator(Context context) {
    final Point outPoint = new Point();
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    wm.getDefaultDisplay().getSize(outPoint);
    ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(new Object(), PropertyValuesHolder.ofFloat("alpha", 0.f, 1.f), PropertyValuesHolder.ofFloat("translationY", outPoint.y / 2.f, 0.f), PropertyValuesHolder.ofFloat("rotation", -45.f, 0.f));
    animator.setDuration((long) (200 * mSpeedFactor));
    return animator;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Point(android.graphics.Point) WindowManager(android.view.WindowManager) TargetApi(android.annotation.TargetApi)

Aggregations

Point (android.graphics.Point)1121 Display (android.view.Display)211 Rect (android.graphics.Rect)194 Paint (android.graphics.Paint)164 WindowManager (android.view.WindowManager)131 RemoteException (android.os.RemoteException)76 RectF (android.graphics.RectF)55 Bitmap (android.graphics.Bitmap)54 Resources (android.content.res.Resources)41 View (android.view.View)40 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)26 Configuration (android.content.res.Configuration)26 IOException (java.io.IOException)24 Message (android.os.Message)22