RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.81k stars 405 forks source link

Why does Fotoapparat landscape CamewraView captures in portrait? #313

Closed MrSilverstein closed 5 years ago

MrSilverstein commented 5 years ago

I have implenented the Fotoapparat library to my app. To operate the whole app with obe hand, I am trying to make the CameraView in a portrait mode parents ConstraintLayout. As you can see in the following screenshot, the CameraView itself is landscape, but the parent ConstraintLayout of the whole Fragment is portrait mode, so that user can operate app with one hand.

screenshot_20181029-142050

Now I show the captured image as a preview in the next fragment.. As you can see, the captured image is portrait mode now: screenshot_20181029-142102

As you can see, the left and right borders are correct (same in both pictures). I enhances the top and bottom border of the image, so it looks like a portrait fotograph.

        fotoapparat = Fotoapparat
                .with(activity)
                .into(cameraView)
                .focusView(focusView)
                .sensorSensitivity(highestSensorSensitivity())
                .focusMode(firstAvailable(
                        FocusModeSelectorsKt.continuousFocusPicture(),
                        FocusModeSelectorsKt.autoFocus()))
                .lensPosition(back())
                .build();

Excerpts of my layouts:

<io.fotoapparat.view.CameraView
    android:id="@+id/myapp_camera_view"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_marginStart="@dimen/myapp_border_margin"
    android:layout_marginEnd="@dimen/myapp_border_margin"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintDimensionRatio="1.778"
    app:layout_constraintBottom_toTopOf="@+id/myapp_border"
    app:layout_constraintTop_toBottomOf="@id/myapp_holder"
    app:layout_constraintVertical_bias="0.5">

    <io.fotoapparat.view.FocusView
        android:id="@+id/myapp_focus_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
    />

</io.fotoapparat.view.CameraView>

Versions: Fotoapparat 2.4.0 Java SDK 8 Android Studio 3.2

What am I dong wrong?

MrSilverstein commented 5 years ago

Another way where I can take landscape photos while holding the smartphone portrait?

MrSilverstein commented 5 years ago

I cropped it manually from the original image