avito-tech / krop

Small widget for image cropping in Instagram-like style
MIT License
126 stars 18 forks source link

How to make the image fullscreen? #17

Closed agustinsivoplas closed 5 years ago

agustinsivoplas commented 5 years ago

Is possible to make the image fullscreen? Screenshot_20190517-192456

My layout is:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/overlay_color">

    <com.avito.android.krop.KropView
        android:id="@+id/cropView"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:krop_offset="@dimen/default_offset"
        app:krop_overlayColor="@color/overlay_color"
        app:krop_shape="oval"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/buttonsLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:padding="@dimen/control_button_margin">

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/closeImageView"
            android:layout_width="@dimen/control_icon_size"
            android:layout_height="@dimen/control_icon_size"
            android:src="@drawable/ic_close"
            android:layout_margin="@dimen/control_button_margin"
            android:tint="@color/white"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <androidx.appcompat.widget.AppCompatImageView
            android:id="@+id/confirmImageView"
            android:layout_width="@dimen/control_icon_size"
            android:layout_height="@dimen/control_icon_size"
            android:layout_margin="@dimen/control_button_margin"
            android:src="@drawable/ic_confirm"
            android:tint="@color/white"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
solkin commented 5 years ago

The picture is not full screen to fit in the cropping area. If you use minimal paddings of crop area it will be shown in fullscreen mode. Also, you can calculate necessary image zoom to fit screen and set it directly.