Link cards

This commit is contained in:
Grishka
2022-02-22 07:17:16 +03:00
parent d25b7e67b8
commit 658415fd89
10 changed files with 223 additions and 3 deletions

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?colorWindowBackground" android:alpha="0.95"/>
</selector>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/window_bg_alpha95"/>
</shape>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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="wrap_content">
<org.joinmastodon.android.ui.views.MaxWidthFrameLayout
android:id="@+id/inner"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_gravity="center_horizontal"
android:foreground="?android:selectableItemBackground"
android:maxWidth="400dp">
<ImageView
android:id="@+id/photo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
tools:src="#0f0"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:padding="8dp"
android:orientation="vertical"
android:background="@drawable/window_bg_alpha95">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/m3_body_large"
android:singleLine="true"
android:ellipsize="end"
tools:text="Link title"/>
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="2"
android:ellipsize="end"
android:textAppearance="@style/m3_body_medium"
tools:text="Link description"/>
<TextView
android:id="@+id/domain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/m3_body_medium"
android:textColor="?android:textColorSecondary"
tools:text="example.com"/>
</LinearLayout>
</org.joinmastodon.android.ui.views.MaxWidthFrameLayout>
</FrameLayout>

View File

@@ -7,5 +7,10 @@
<attr name="colorDarkIcon" format="color"/>
<attr name="colorPollMostVoted" format="color"/>
<attr name="colorPollVoted" format="color"/>
<attr name="colorWindowBackground" format="color"/>
<attr name="secondaryButtonStyle" format="reference"/>
<declare-styleable name="MaxWidthFrameLayout">
<attr name="android:maxWidth" format="dimension"/>
</declare-styleable>
</resources>

View File

@@ -6,6 +6,7 @@
<item name="android:enforceStatusBarContrast" tools:ignore="NewApi">false</item>
<item name="appkitBackDrawable">@drawable/ic_fluent_arrow_left_24_regular</item>
<item name="android:splitMotionEvents">false</item>
<item name="android:windowBackground">?colorWindowBackground</item>
<item name="android:buttonStyle">@style/Widget.Mastodon.Button.Primary_DarkOnLight</item>
<item name="secondaryButtonStyle">@style/Widget.Mastodon.Button.Secondary_DarkOnLight</item>
@@ -19,7 +20,7 @@
<item name="colorBackgroundLight">@color/gray_50</item>
<item name="colorBackgroundLightest">@color/gray_25</item>
<item name="colorDarkIcon">@color/gray_900</item>
<item name="android:windowBackground">@color/white</item>
<item name="colorWindowBackground">@color/white</item>
<item name="android:statusBarColor">@color/actionbar_bg</item>
<item name="android:navigationBarColor">@color/navigation_bar_bg</item>
<item name="android:actionBarTheme">@style/Theme.Mastodon.Toolbar</item>
@@ -37,6 +38,7 @@
<item name="android:enforceStatusBarContrast" tools:ignore="NewApi">false</item>
<item name="appkitBackDrawable">@drawable/ic_fluent_arrow_left_24_regular</item>
<item name="android:splitMotionEvents">false</item>
<item name="android:windowBackground">?colorWindowBackground</item>
<item name="android:buttonStyle">@style/Widget.Mastodon.Button.Primary_LightOnDark</item>
<item name="secondaryButtonStyle">@style/Widget.Mastodon.Button.Secondary_LightOnDark</item>
@@ -50,7 +52,7 @@
<item name="colorBackgroundLight">@color/gray_700</item>
<item name="colorBackgroundLightest">@color/gray_700</item>
<item name="colorDarkIcon">@color/gray_25</item>
<item name="android:windowBackground">@color/gray_800</item>
<item name="colorWindowBackground">@color/gray_800</item>
<item name="android:statusBarColor">@color/actionbar_bg_dark</item>
<item name="android:navigationBarColor">@color/actionbar_bg_dark</item>
<item name="android:actionBarTheme">@style/Theme.Mastodon.Toolbar.Dark</item>