Search in sources :

Example 61 with Point

use of android.graphics.Point in project ShowcaseView by amlcurran.

the class ViewTarget method getPoint.

@Override
public Point getPoint() {
    int[] location = new int[2];
    mView.getLocationInWindow(location);
    int x = location[0] + mView.getWidth() / 2;
    int y = location[1] + mView.getHeight() / 2;
    return new Point(x, y);
}
Also used : Point(android.graphics.Point) Point(android.graphics.Point)

Example 62 with Point

use of android.graphics.Point in project SearchView by lapism.

the class SearchAnimator method revealOpen.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
static void revealOpen(View view, int cx, int duration, Context context, final SearchEditText editText, final boolean shouldClearOnOpen, final SearchView.OnOpenCloseListener listener) {
    if (cx <= 0) {
        int padding = context.getResources().getDimensionPixelSize(R.dimen.search_reveal);
        if (SearchUtils.isRtlLayout(context))
            cx = padding;
        else
            cx = view.getWidth() - padding;
    }
    int cy = context.getResources().getDimensionPixelSize(R.dimen.search_height) / 2;
    if (cx != 0 && cy != 0) {
        Point displaySize = new Point();
        ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getSize(displaySize);
        float finalRadius = (float) Math.hypot(Math.max(cx, displaySize.x - cx), cy);
        Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0.0f, finalRadius);
        anim.setInterpolator(new AccelerateDecelerateInterpolator());
        anim.setDuration(duration);
        anim.addListener(new // new AnimatorListenerAdapter()
        Animator.AnimatorListener() {

            @Override
            public void onAnimationStart(Animator animation) {
                if (listener != null) {
                    listener.onOpen();
                }
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                if (shouldClearOnOpen && editText.length() > 0) {
                    editText.getText().clear();
                }
                editText.requestFocus();
            }

            @Override
            public void onAnimationCancel(Animator animation) {
            }

            @Override
            public void onAnimationRepeat(Animator animation) {
            }
        });
        view.setVisibility(View.VISIBLE);
        anim.start();
    }
}
Also used : Animator(android.animation.Animator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) Point(android.graphics.Point) Point(android.graphics.Point) TargetApi(android.annotation.TargetApi)

Example 63 with Point

use of android.graphics.Point in project SearchView by lapism.

the class SearchAnimator method revealClose.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
static void revealClose(final View view, int cx, int duration, Context context, final SearchEditText editText, final boolean shouldClearOnClose, final SearchView searchView, final SearchView.OnOpenCloseListener listener) {
    if (cx <= 0) {
        int padding = context.getResources().getDimensionPixelSize(R.dimen.search_reveal);
        if (SearchUtils.isRtlLayout(context))
            cx = padding;
        else
            cx = view.getWidth() - padding;
    }
    int cy = context.getResources().getDimensionPixelSize(R.dimen.search_height) / 2;
    if (cx != 0 && cy != 0) {
        Point displaySize = new Point();
        ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getSize(displaySize);
        float initialRadius = (float) Math.hypot(Math.max(cx, displaySize.x - cx), cy);
        Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0.0f);
        anim.setInterpolator(new AccelerateDecelerateInterpolator());
        anim.setDuration(duration);
        anim.addListener(new Animator.AnimatorListener() {

            @Override
            public void onAnimationStart(Animator animation) {
                if (shouldClearOnClose && editText.length() > 0) {
                    editText.getText().clear();
                }
                editText.clearFocus();
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                view.setVisibility(View.GONE);
                searchView.setVisibility(View.GONE);
                if (listener != null) {
                    listener.onClose();
                }
            }

            @Override
            public void onAnimationCancel(Animator animation) {
            }

            @Override
            public void onAnimationRepeat(Animator animation) {
            }
        });
        anim.start();
    }
}
Also used : Animator(android.animation.Animator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) Point(android.graphics.Point) Point(android.graphics.Point) TargetApi(android.annotation.TargetApi)

Example 64 with Point

use of android.graphics.Point in project AndroidTwitter by lorensiuswlt.

the class TwitterDialog method onCreate.

@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mSpinner = new ProgressDialog(getContext());
    mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mSpinner.setMessage("Loading...");
    mContent = new LinearLayout(getContext());
    mContent.setOrientation(LinearLayout.VERTICAL);
    setUpTitle();
    setUpWebView();
    Display display = getWindow().getWindowManager().getDefaultDisplay();
    Point outSize = new Point();
    int width = 0;
    int height = 0;
    double[] dimensions = new double[2];
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        display.getSize(outSize);
        width = outSize.x;
        height = outSize.y;
    } else {
        width = display.getWidth();
        height = display.getHeight();
    }
    if (width < height) {
        dimensions[0] = 0.87 * width;
        dimensions[1] = 0.82 * height;
    } else {
        dimensions[0] = 0.75 * width;
        dimensions[1] = 0.75 * height;
    }
    addContentView(mContent, new FrameLayout.LayoutParams((int) dimensions[0], (int) dimensions[1]));
}
Also used : FrameLayout(android.widget.FrameLayout) Point(android.graphics.Point) ProgressDialog(android.app.ProgressDialog) LinearLayout(android.widget.LinearLayout) Point(android.graphics.Point) SuppressLint(android.annotation.SuppressLint) Display(android.view.Display)

Example 65 with Point

use of android.graphics.Point in project AdvancedMaterialDrawer by madcyph3r.

the class MaterialRippleLayoutNineOld method performRipple.

public void performRipple() {
    currentCoords = new Point(getWidth() / 2, getHeight() / 2);
    startRipple(null);
}
Also used : Point(android.graphics.Point)

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