Move crop button (#197)

* Moved the crop button so that it doesn't take space in the activity

* Semi transparent in the middle, same position than the image

Co-authored-by: Joachim Dunant <joachim.dunant@epfl.ch>
This commit is contained in:
Sanimys 2020-05-21 21:40:27 +02:00 committed by GitHub
parent 66e6bd66dd
commit 4a79c862fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 66 additions and 36 deletions

View File

@ -1,46 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PhotoEditActivity"
tools:showIn="@layout/activity_photo_edit"
>
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:id="@+id/image_preview"
<LinearLayout
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".70"
android:scaleType="centerInside" />
android:layout_height="match_parent"
tools:context=".PhotoEditActivity"
tools:showIn="@layout/activity_photo_edit"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
>
<ImageView
android:id="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".70"
android:scaleType="centerInside" />
<com.h.pixeldroid.utils.NonSwipeableViewPager
android:id="@+id/viewPager"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".22" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
app:tabGravity="fill"
app:tabMode="fixed"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".08"/>
</LinearLayout>
<androidx.constraintlayout.widget.Guideline
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/left_guideline"
app:layout_constraintGuide_percent=".15"
android:orientation="vertical"/>
<androidx.constraintlayout.widget.Guideline
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/right_guideline"
app:layout_constraintGuide_percent=".85"
android:orientation="vertical"/>
<androidx.constraintlayout.widget.Guideline
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bottom_guideline"
app:layout_constraintGuide_percent=".7"
android:orientation="horizontal"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/cropImageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_crop_black_24dp" />
<com.h.pixeldroid.utils.NonSwipeableViewPager
android:id="@+id/viewPager"
android:layout_above="@+id/tabs"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_below="@+id/image_preview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".22" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
app:tabGravity="fill"
app:tabMode="fixed"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".08"/>
</LinearLayout>
android:layout_marginTop="411dp"
android:backgroundTint="#FFFFFFFF"
android:src="@drawable/ic_crop_black_24dp"
app:layout_constraintLeft_toLeftOf="@+id/left_guideline"
app:layout_constraintRight_toRightOf="@+id/right_guideline"
app:layout_constraintBottom_toBottomOf="@+id/bottom_guideline" />
</androidx.constraintlayout.widget.ConstraintLayout>