Improve compose activity

This commit is contained in:
Eugen Rochko 2017-03-10 18:38:49 +01:00
commit f34237ce7a
15 changed files with 200 additions and 145 deletions

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:id="@+id/activity_compose"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -9,85 +10,129 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_marginBottom="8dp"
android:background="@android:color/transparent"
android:elevation="4dp"
android:layout_marginBottom="16dp"
android:theme="@style/AppTheme.Account.AppBarLayout"
app:popupTheme="@style/AppTheme.Account.ToolbarPopupTheme.Dark"
android:background="?attr/toolbar_background_color" />
app:popupTheme="@style/AppTheme.Account.ToolbarPopupTheme.Dark" />
<LinearLayout
android:id="@+id/compose_content_warning_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/compose_content_warning_bar"
android:paddingTop="0dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_marginBottom="4dp">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/field_content_warning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/hint_content_warning"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
android:orientation="vertical"
android:layout_marginBottom="8dp">
<EditText
android:id="@+id/field_content_warning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:ems="10"
android:maxLines="1"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:hint="@string/hint_content_warning"
android:inputType="text|textCapSentences" />
<View
android:layout_marginTop="8dp"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/compose_edit_area"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingBottom="4dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingBottom="16dp"
android:id="@+id/compose_edit_area">
android:paddingRight="16dp">
<!--An special EditText is created at runtime here, because it has to be a modified
* anonymous class to support image/GIF picking from the soft keyboard.-->
<LinearLayout
<HorizontalScrollView
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/compose_media_preview_bar"
android:layout_alignParentBottom="true">
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/compose_media_preview_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!--This is filled at runtime with ImageView's for each preview in the upload queue.-->
<!--This is filled at runtime with ImageView's for each preview in the upload queue.-->
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:paddingTop="4dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingBottom="8dp"
android:paddingLeft="16dp"
android:paddingBottom="16dp"
android:layout_height="wrap_content">
android:paddingRight="16dp"
android:paddingTop="4dp">
<ImageButton
android:id="@+id/compose_photo_pick"
style="?attr/image_button_style"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginRight="8dp"
app:srcCompat="@drawable/ic_attach_file_24dp" />
<ImageButton
android:id="@+id/action_toggle_visibility"
style="?attr/image_button_style"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginRight="8dp"
app:srcCompat="@drawable/ic_public_24dp" />
<Button
android:id="@+id/action_toggle_nsfw"
style="?attr/image_button_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:visibility="gone"
android:textColor="@color/image_button_dark"
android:text="@string/toggle_nsfw" />
<android.support.v4.widget.Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/characters_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:textColorPrimary"
android:text="500" />
android:text="500"
android:textColor="?android:textColorPrimary" />
<Button
android:id="@+id/floating_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="@string/action_send" />
</LinearLayout>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/floating_btn"
android:layout_width="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_send_24dp"/>
</android.support.design.widget.CoordinatorLayout>

View file

@ -83,7 +83,9 @@
<android.support.design.widget.FloatingActionButton
android:id="@+id/floating_btn"
android:layout_width="wrap_content"
android:layout_gravity="bottom|end"
app:layout_anchor="@id/pager"
app:layout_anchorGravity="bottom|end"
android:clickable="true"
android:layout_margin="16dp"
android:layout_height="wrap_content"
app:srcCompat="@drawable/ic_create_24dp"/>

View file

@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:padding="16dp"
android:layout_height="match_parent">
<RadioGroup
@ -35,13 +36,6 @@
</RadioGroup>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="@dimen/compose_options_margin"
android:id="@+id/compose_mark_sensitive"
android:text="@string/action_mark_sensitive" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="match_parent"