Java Code Examples for android.widget.ImageView#getX()

The following examples show how to use android.widget.ImageView#getX() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TeamLogoBehavior.java    From Nimbus with GNU General Public License v3.0 6 votes vote down vote up
private void maybeInitProperties(ImageView child, View dependency) {
    if (mStartYPosition == 0)
        mStartYPosition = (int) (dependency.getY());

    if (mFinalYPosition == 0)
        mFinalYPosition = (dependency.getHeight() /2);

    if (mStartHeight == 0)
        mStartHeight = child.getHeight();

    if (mStartXPosition == 0)
        mStartXPosition = (int) (child.getX() + (child.getWidth() / 2));

    if (mFinalXPosition == 0)
        mFinalXPosition = mContext.getResources().getDimensionPixelOffset(R.dimen.abc_action_bar_content_inset_material) + ((int) mCustomFinalHeight / 2);

    if (mStartToolbarPosition == 0)
        mStartToolbarPosition = dependency.getY();

    if (mChangeBehaviorPoint == 0) {
        mChangeBehaviorPoint = (child.getHeight() - mCustomFinalHeight) / (2f * (mStartYPosition - mFinalYPosition));
    }
}
 
Example 2
Source File: MapActivity.java    From WiFi-RTT-Trilateration with MIT License 5 votes vote down vote up
private void movePin(double x, double y, double z) {
    //  todo this is currently hard coded for 2D setups

    final ImageView ImageView_BitmapView = findViewById(R.id.map);
    final ImageView ImageView_Pin = findViewById(R.id.pin);
    ImageView_Pin.setVisibility(View.VISIBLE);

    //  0,0 point is 82.4427% down the image and 2.336% from the left of the image
    float x_image_offset = (ImageView_BitmapView.getWidth() * 0.02336f);
    float y_image_offset = (ImageView_BitmapView.getHeight() * 0.824427f);

    x_image_offset = ImageView_BitmapView.getX() + x_image_offset;
    y_image_offset = ImageView_BitmapView.getY() + y_image_offset;

    float pin_width = ImageView_Pin.getWidth();
    float pin_height = ImageView_Pin.getHeight();
    float x_pin_offset = (pin_width / 2.0f);
    float y_pin_offset = (pin_height) - (5.0f / 72.0f * pin_height); //  There are a few pixels at the bottom of the pin
    //  Account for the fact that the Pin is pointing to the lower middle of the image view
    float pinOriginX = x_image_offset - x_pin_offset;
    float pinOriginY = y_image_offset - y_pin_offset;
    //ImageView_Pin.setX(pinOriginX);
    //ImageView_Pin.setY(pinOriginY);

    float floorWidth = ImageView_BitmapView.getWidth() * (1772.0f / 3982.0f);
    float floorHeight = ImageView_BitmapView.getHeight() * (1488.0f / 2096.0f);

    float scaledX = (float) (x / 8370.0f * floorWidth);
    float scaledY = (float) (y / 7000.0f * floorHeight);
    ImageView_Pin.setX(pinOriginX + scaledX);
    ImageView_Pin.setY(pinOriginY - scaledY);
}
 
Example 3
Source File: CameraFragmentUtil.java    From polling-station-app with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Crop the bitmap to only the part of the scansegment. The bitmap should only contain the part
 * that displays the MRZ of a travel document.
 * @param bitmap - The bitmap created from the camerapreview
 * @param scanSegment - Scansegment, the segment that should be scanned with OCR
 * @return
 */
public static Bitmap cropBitmap(Bitmap bitmap, ImageView scanSegment) {
    int startX = (int) scanSegment.getX();
    int startY = (int) scanSegment.getY();
    int width = scanSegment.getWidth();
    int length = scanSegment.getHeight();
    return Bitmap.createBitmap(bitmap, startX, startY, width, length);
}
 
Example 4
Source File: CameraFragmentUtil.java    From polling-station-app with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Get the scan rectangle.
 * @return The rectangle.
 */
public static Rect getScanRect(ImageView scanSegment) {
    int startX = (int) scanSegment.getX();
    int startY = (int) scanSegment.getY();
    int width = scanSegment.getWidth();
    int length = scanSegment.getHeight();
    return new Rect(startX, startY, startX + width, startY + length);
}
 
Example 5
Source File: FloatService.java    From AppFloater with GNU General Public License v2.0 5 votes vote down vote up
public void saveIconsToPref() {
    for(ImageView view : viewList) {
        IconHolder holder = (IconHolder) view.getTag();
        addToPrefPackageList(holder.packageName);
        holder.x_pos = view.getX();
        holder.y_pos = view.getY();
    }
}