Example usage for android.widget FrameLayout getBottom

List of usage examples for android.widget FrameLayout getBottom

Introduction

In this page you can find the example usage for android.widget FrameLayout getBottom.

Prototype

@ViewDebug.CapturedViewProperty
public final int getBottom() 

Source Link

Document

Bottom position of this view relative to its parent.

Usage

From source file:com.zainsoft.ramzantimetable.QiblaActivity.java

private double rotateImageView(double newAngle, double fromDegree, ImageView imageView) {

    newAngle = newAngle % 360;/* w  w w . j a v a 2s . com*/
    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;

}