List of usage examples for android.widget FrameLayout getRight
@ViewDebug.CapturedViewProperty public final int getRight()
From source file:com.zainsoft.ramzantimetable.QiblaActivity.java
private double rotateImageView(double newAngle, double fromDegree, ImageView imageView) { newAngle = newAngle % 360;/*from w w w . j a va 2 s . c o m*/ double rotationDegree = fromDegree - newAngle; rotationDegree = rotationDegree % 360; long duration = new Double(Math.abs(rotationDegree) * 2000 / 360).longValue(); if (rotationDegree > 180) rotationDegree -= 360; FrameLayout frameLayout = (FrameLayout) findViewById(R.id.qiblaLayout); float toDegree = new Double(newAngle % 360).floatValue(); final int width = Math.abs(frameLayout.getRight() - frameLayout.getLeft()); final int height = Math.abs(frameLayout.getBottom() - frameLayout.getTop()); // LinearLayout main = (LinearLayout) findViewById(R.id.mainLayout); float pivotX = width / 2f; float pivotY = height / 2f; animation = new RotateAnimation(new Double(fromDegree).floatValue(), toDegree, pivotX, pivotY); animation.setRepeatCount(0); animation.setDuration(duration); animation.setInterpolator(new LinearInterpolator()); animation.setFillEnabled(true); animation.setFillAfter(true); animation.setAnimationListener(this); /*Log.d(NAMAZ_LOG_TAG, "rotating image from degree:" + fromDegree + " degree to rotate: " + rotationDegree + " ImageView: " + imageView.getId());*/ imageView.startAnimation(animation); return toDegree; }
From source file:br.ufrgs.ufrgsmapas.libs.SearchBox.java
private void revealFrom(float x, float y, Activity a, SearchBox s) { FrameLayout layout = (FrameLayout) a.getWindow().getDecorView().findViewById(android.R.id.content); RelativeLayout root = (RelativeLayout) s.findViewById(R.id.search_root); Resources r = getResources(); float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 96, r.getDisplayMetrics()); int cx = layout.getLeft() + layout.getRight(); int cy = layout.getTop(); int finalRadius = (int) Math.max(layout.getWidth(), px); SupportAnimator animator = ViewAnimationUtils.createCircularReveal(root, cx, cy, 0, finalRadius); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(500);/*from ww w. j a va2 s . co m*/ animator.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationCancel() { } @Override public void onAnimationEnd() { toggleSearch(); } @Override public void onAnimationRepeat() { } @Override public void onAnimationStart() { } }); animator.start(); }
From source file:br.ufrgs.ufrgsmapas.libs.SearchBox.java
/*** * Hide the searchbox using the circle animation. Can be called regardless of result list length * @param activity Activity//from www .ja v a 2 s.c om */ public void hideCircularly(Activity activity) { Display display = activity.getWindowManager().getDefaultDisplay(); Point size = new Point(); final FrameLayout layout = (FrameLayout) activity.getWindow().getDecorView() .findViewById(android.R.id.content); RelativeLayout root = (RelativeLayout) findViewById(R.id.search_root); display.getSize(size); Resources r = getResources(); float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 96, r.getDisplayMetrics()); int cx = layout.getLeft() + layout.getRight(); int cy = layout.getTop(); int finalRadius = (int) Math.max(layout.getWidth() * 1.5, px); SupportAnimator animator = ViewAnimationUtils.createCircularReveal(root, cx, cy, 0, finalRadius); animator.setInterpolator(new ReverseInterpolator()); animator.setDuration(500); animator.start(); animator.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { } @Override public void onAnimationEnd() { setVisibility(View.GONE); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); }