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);
}
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();
}
}
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();
}
}
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]));
}
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);
}
Aggregations