Improve link preview cards (#1330)
* improve card frame * add placeholder for empty image * improve layout, Pleroma compatibility, show author name as description fallback * reset okhttp logging level * remove unneeded statement
This commit is contained in:
parent
e6d91c1cf3
commit
b825f42c7a
13 changed files with 69 additions and 31 deletions
5
app/src/main/res/drawable/card_frame.xml
Normal file
5
app/src/main/res/drawable/card_frame.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="6dp" />
|
||||
<stroke android:color="?attr/card_background_color" android:width="1dp" />
|
||||
</shape>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="5dp" />
|
||||
<stroke android:color="@color/text_color_tertiary_dark" android:width="1px" />
|
||||
<padding android:bottom="1px" android:top="1px" android:left="1px" android:right="1px"/>
|
||||
</shape>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="5dp" />
|
||||
<stroke android:color="@color/text_color_tertiary_light" android:width="1px" />
|
||||
<padding android:bottom="1px" android:top="1px" android:left="1px" android:right="1px"/>
|
||||
</shape>
|
10
app/src/main/res/drawable/card_image_placeholder.xml
Normal file
10
app/src/main/res/drawable/card_image_placeholder.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="?android:attr/textColorTertiary"
|
||||
android:pathData="M6,2A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2H6M6,4H13V9H18V20H6V4M8,12V14H16V12H8M8,16V18H13V16H8Z" />
|
||||
</vector>
|
|
@ -134,8 +134,10 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="?attr/card_background"
|
||||
android:background="@drawable/card_frame"
|
||||
android:clipChildren="true"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
android:minHeight="80dp"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintTop_toBottomOf="@+id/status_content"
|
||||
tools:visibility="gone">
|
||||
|
@ -144,7 +146,10 @@
|
|||
android:id="@+id/card_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:background="?attr/card_image_background" />
|
||||
android:layout_margin="1dp"
|
||||
android:background="?attr/card_background_color"
|
||||
android:importantForAccessibility="no"
|
||||
android:scaleType="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/card_info"
|
||||
|
@ -164,7 +169,7 @@
|
|||
android:ellipsize="end"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:lines="1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="?attr/status_text_medium" />
|
||||
|
||||
<androidx.emoji.widget.EmojiTextView
|
||||
|
|
|
@ -65,8 +65,7 @@
|
|||
<item name="material_drawer_header_selection_text">@color/text_color_primary_dark</item>
|
||||
<item name="material_drawer_header_selection_subtext">@color/text_color_secondary_dark</item>
|
||||
|
||||
<item name="card_background">@drawable/card_frame_dark</item>
|
||||
<item name="card_image_background">@color/text_color_tertiary_dark</item>
|
||||
<item name="card_background_color">@color/color_primary_dark</item>
|
||||
|
||||
<item name="play_indicator_drawable">@drawable/ic_play_indicator_dark</item>
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@
|
|||
<attr name="compose_content_warning_bar_background" format="reference" />
|
||||
<attr name="compose_reply_content_background" format="reference|color" />
|
||||
<attr name="report_status_background_color" format="reference|color" />
|
||||
<attr name="card_background" format="reference|color" />
|
||||
<attr name="card_image_background" format="reference|color" />
|
||||
<attr name="card_background_color" format="reference|color" />
|
||||
<attr name="compound_button_color" format="reference" />
|
||||
<attr name="autocomplete_divider_drawable" format="reference" />
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<dimen name="text_content_margin">16dp</dimen>
|
||||
<dimen name="status_sensitive_media_button_padding">5dp</dimen>
|
||||
|
||||
<dimen name="card_image_vertical_height">160dp</dimen>
|
||||
<dimen name="card_image_vertical_height">210dp</dimen>
|
||||
<dimen name="card_image_horizontal_width">100dp</dimen>
|
||||
|
||||
<dimen name="compose_activity_snackbar_elevation">16dp</dimen>
|
||||
|
@ -40,4 +40,6 @@
|
|||
<dimen name="avatar_radius_36dp">4.5dp</dimen> <!-- 1/8 of 36dp -->
|
||||
<dimen name="avatar_radius_24dp">3dp</dimen> <!-- 1/8 of 24dp -->
|
||||
<dimen name="min_report_button_width">160dp</dimen>
|
||||
|
||||
<dimen name="card_radius">5dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -125,8 +125,7 @@
|
|||
<item name="material_drawer_header_selection_subtext">@color/text_color_secondary_dark
|
||||
</item> <!--Intentionally dark so it can be overlayed over the account's header image.-->
|
||||
|
||||
<item name="card_background">@drawable/card_frame_light</item>
|
||||
<item name="card_image_background">@color/text_color_tertiary_light</item>
|
||||
<item name="card_background_color">@color/color_primary_light</item>
|
||||
|
||||
<item name="play_indicator_drawable">@drawable/ic_play_indicator_light</item>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue