[android] Factor out image preview into its own view class

This commit is contained in:
Torsten Grote
2018-12-06 16:21:03 -02:00
parent 5fbacb4ee4
commit e6229a3a13
7 changed files with 199 additions and 120 deletions

View File

@@ -5,6 +5,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:orientation="vertical"
tools:context=".android.conversation.ConversationActivity">
@@ -48,7 +49,15 @@
android:id="@+id/conversationView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
android:layout_weight="2"/>
<org.briarproject.briar.android.view.ImagePreview
android:id="@+id/imagePreview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="gone"
tools:visibility="visible"/>
<org.briarproject.briar.android.view.TextInputView
android:id="@+id/text_input_container"

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
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:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
tools:parentTag="android.support.constraint.ConstraintLayout"
tools:showIn="@layout/activity_conversation">
<View
android:id="@+id/divider"
style="@style/Divider.Horizontal"
android:layout_alignParentTop="true"
app:layout_constraintBottom_toTopOf="@+id/imageView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider"
tools:ignore="ContentDescription"
tools:srcCompat="@tools:sample/avatars"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/imageCancelButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:src="@drawable/ic_close"
app:backgroundTint="@color/briar_red"
app:fabCustomSize="26dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0"
app:maxImageSize="18dp"/>
</merge>

View File

@@ -12,37 +12,6 @@
style="@style/Divider.Horizontal"
android:layout_alignParentTop="true"/>
<FrameLayout
android:id="@+id/imageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="@dimen/text_input_image_height"
android:minHeight="@dimen/button_size"
tools:background="@color/msg_status_bubble_background"
tools:ignore="ContentDescription"
tools:srcCompat="@tools:sample/avatars"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/imageCancelButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:src="@drawable/ic_close"
app:backgroundTint="@color/briar_red"
app:fabCustomSize="26dp"
app:maxImageSize="18dp"/>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@@ -70,7 +70,6 @@
<!-- Emoji -->
<dimen name="text_input_height">42dp</dimen>
<dimen name="text_input_image_height">150dp</dimen>
<dimen name="conversation_item_body_text_size">16sp</dimen>
<dimen name="emoji_drawer_size">32sp</dimen>
<dimen name="emoji_drawer_indicator_height">2dp</dimen>