Compose things

This commit is contained in:
Grishka
2022-03-15 21:40:52 +03:00
parent b2588fbb6e
commit 8c5d6cd4a6
11 changed files with 532 additions and 33 deletions

View File

@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="20dp" android:height="20dp" android:viewportWidth="20" android:viewportHeight="20">
<path android:pathData="M11.5 4c0-0.828-0.672-1.5-1.5-1.5S8.5 3.172 8.5 4h-1c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5H17c0.276 0 0.5 0.224 0.5 0.5S17.276 5 17 5h-0.554L15.15 16.23C15.033 17.237 14.179 18 13.163 18H6.837c-1.016 0-1.87-0.762-1.987-1.77L3.553 5H3C2.755 5 2.55 4.823 2.508 4.59L2.5 4.5C2.5 4.224 2.724 4 3 4h8.5zm3.938 1H4.561l1.282 11.115C5.902 16.619 6.33 17 6.837 17h6.326c0.508 0 0.935-0.38 0.993-0.885L15.438 5zM8.5 7.5c0.245 0 0.45 0.155 0.492 0.359L9 7.938v6.125c0 0.24-0.224 0.437-0.5 0.437-0.245 0-0.45-0.155-0.492-0.359L8 14.062V7.939C8 7.696 8.224 7.5 8.5 7.5zm3 0c0.245 0 0.45 0.155 0.492 0.359L12 7.938v6.125c0 0.241-0.224 0.437-0.5 0.437-0.245 0-0.45-0.155-0.492-0.359L11 14.062V7.939C11 7.696 11.224 7.5 11.5 7.5z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" android:viewportWidth="28" android:viewportHeight="28">
<path android:pathData="M14 2.25c2.004 0 3.641 1.572 3.745 3.55L17.75 6h5.5C23.664 6 24 6.336 24 6.75c0 0.38-0.282 0.694-0.648 0.743L23.25 7.5h-1.059l-1.22 15.053C20.813 24.5 19.187 26 17.233 26h-6.466c-1.954 0-3.58-1.5-3.738-3.447L5.808 7.5H4.75c-0.38 0-0.694-0.282-0.743-0.648L4 6.75c0-0.38 0.282-0.694 0.648-0.743L4.75 6h5.5c0-2.071 1.679-3.75 3.75-3.75zm6.687 5.25H7.313l1.211 14.932C8.619 23.6 9.594 24.5 10.767 24.5h6.466c1.172 0 2.148-0.9 2.243-2.068L20.686 7.5zm-8.937 3.75c0.38 0 0.694 0.282 0.743 0.648L12.5 12v8c0 0.414-0.336 0.75-0.75 0.75-0.38 0-0.694-0.282-0.743-0.648L11 20v-8c0-0.414 0.336-0.75 0.75-0.75zm4.5 0c0.38 0 0.694 0.282 0.743 0.648L17 12v8c0 0.414-0.336 0.75-0.75 0.75-0.38 0-0.694-0.282-0.743-0.648L15.5 20v-8c0-0.414 0.336-0.75 0.75-0.75zM14 3.75c-1.19 0-2.166 0.925-2.245 2.096L11.75 6h4.5l-0.005-0.154C16.165 4.676 15.19 3.75 14 3.75z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="250dp"
android:layout_height="150dp">
@@ -7,20 +8,93 @@
android:id="@+id/thumb"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
<Button
android:id="@+id/remove_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:text="X"/>
android:scaleType="centerCrop"
tools:src="#0f0"/>
<ProgressBar
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_gravity="top"
style="?android:progressBarStyleHorizontal"/>
<RelativeLayout
android:id="@+id/info_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#f2000000"
android:backgroundTint="?colorWindowBackground">
<ImageButton
android:id="@+id/remove_btn"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="2dp"
android:layout_marginStart="2dp"
android:background="?android:selectableItemBackgroundBorderless"
android:tint="#D92C2C"
android:src="@drawable/ic_fluent_delete_20_regular"/>
<TextView
android:id="@+id/file_name"
android:layout_width="match_parent"
android:layout_height="24dp"
android:textAppearance="@style/m3_body_large"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_toStartOf="@id/remove_btn"
android:gravity="center_vertical"
android:singleLine="true"
android:ellipsize="middle"
tools:text="asdf.jpg"/>
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/file_name"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:maxLines="2"
android:ellipsize="end"
android:textAppearance="@style/m3_body_medium"
android:textColor="?android:textColorSecondary"
android:text="@string/add_image_description"/>
</RelativeLayout>
<FrameLayout
android:id="@+id/error_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#cc000000"
android:backgroundTint="?colorWindowBackground"
android:padding="8dp"
android:clipToPadding="false"
android:visibility="gone">
<Button
android:id="@+id/retry_upload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|bottom"
style="?secondaryButtonStyle"
android:text="@string/retry_upload"/>
<ImageButton
android:id="@+id/remove_btn2"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_marginBottom="4dp"
android:layout_gravity="end|bottom"
android:background="?android:selectableItemBackgroundBorderless"
android:tint="#D92C2C"
android:src="@drawable/ic_fluent_delete_20_regular"/>
</FrameLayout>
</FrameLayout>

View File

@@ -6,7 +6,7 @@
android:layout_height="match_parent">
<ScrollView
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
@@ -137,11 +137,12 @@
tools:text="Duration: 7 days"/>
</LinearLayout>
<LinearLayout
<org.joinmastodon.android.ui.views.ComposeMediaLayout
android:id="@+id/attachments"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"/>
android:layout_gravity="center_horizontal"
android:visibility="gone"/>
</LinearLayout>
</ScrollView>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<org.joinmastodon.android.ui.views.ComposeMediaLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<ImageView
android:id="@+id/photo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:importantForAccessibility="no"
tools:src="#0f0"/>
</org.joinmastodon.android.ui.views.ComposeMediaLayout>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:textAppearance="@style/m3_headline_medium"
android:minHeight="36dp"
android:gravity="center_vertical"
android:text="@string/add_alt_text"/>
<TextView
android:id="@+id/subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:textAppearance="@style/m3_title_medium"
android:textColor="?android:textColorSecondary"
android:text="@string/alt_text_subtitle"/>
<EditText
android:id="@+id/edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:minHeight="212dp"
android:gravity="top"
android:inputType="textCapSentences|textMultiLine"
android:hint="@string/alt_text_hint"/>
</LinearLayout>
</ScrollView>

View File

@@ -205,4 +205,13 @@
<string name="resent_email">Confirmation email sent</string>
<string name="compose_hint">Type or paste what\'s on your mind</string>
<string name="content_warning">Content warning</string>
<string name="add_image_description">Add image description…</string>
<string name="retry_upload">Retry upload</string>
<string name="image_upload_failed">Image failed to upload</string>
<string name="video_upload_failed">Video failed to upload</string>
<string name="edit_image">Edit image</string>
<string name="save">Save</string>
<string name="add_alt_text">Add alt text</string>
<string name="alt_text_subtitle">Alt text describes your photos for people with low or no vision. Try to only include enough detail to understand the context.</string>
<string name="alt_text_hint">e.g. A dog looking around suspiciously with narrowed eyes at the camera.</string>
</resources>