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,14 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:orientation="vertical" android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".PhotoEditActivity" tools:context=".PhotoEditActivity"
tools:showIn="@layout/activity_photo_edit" tools:showIn="@layout/activity_photo_edit"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
> >
<ImageView <ImageView
@ -18,18 +25,9 @@
android:layout_weight=".70" android:layout_weight=".70"
android:scaleType="centerInside" /> android:scaleType="centerInside" />
<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 <com.h.pixeldroid.utils.NonSwipeableViewPager
android:id="@+id/viewPager" android:id="@+id/viewPager"
android:layout_above="@+id/tabs"
app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_below="@+id/image_preview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight=".22" /> android:layout_weight=".22" />
@ -38,9 +36,41 @@
android:id="@+id/tabs" android:id="@+id/tabs"
app:tabGravity="fill" app:tabGravity="fill"
app:tabMode="fixed" app:tabMode="fixed"
android:layout_alignParentBottom="true"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight=".08"/> android:layout_weight=".08"/>
</LinearLayout> </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_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>