add a border for translations

This commit is contained in:
Kasun 2019-11-06 17:57:53 +05:30
parent 2a3ddcf0cd
commit 00fa8d2e50
7 changed files with 208 additions and 30 deletions

View File

@ -618,7 +618,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
Button status_spoiler_button;
CustomTextView status_content;
TextView status_content_translated;
LinearLayout status_content_translated_container;
ConstraintLayout status_content_translated_container;
TextView status_account_username;
TextView status_account_displayname, status_account_displayname_owner;
ImageView status_account_profile;

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
android:color="?attr/textColor" />
<corners android:radius="4dp" />
</shape>

View File

@ -402,28 +402,67 @@
android:textStyle="italic"
android:visibility="gone" />
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/status_content_translated_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="vertical"
android:visibility="gone">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/translation_border"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/translation_border_top" />
<androidx.constraintlayout.widget.Placeholder
android:id="@+id/translation_border_top"
android:layout_width="wrap_content"
android:layout_height="1dp"
app:layout_constraintBottom_toBottomOf="@id/translation_label"
app:layout_constraintEnd_toEndOf="@id/translation_label"
app:layout_constraintTop_toTopOf="@id/translation_label" />
<TextView
android:id="@+id/translation_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:background="?attr/statusBackgroundColor"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="Translation"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/status_content_translated"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="4dp"
app:layout_constraintBottom_toTopOf="@id/yandex_translate"
app:layout_constraintTop_toBottomOf="@id/translation_label"
app:layout_goneMarginBottom="8dp" />
<TextView
android:id="@+id/yandex_translate"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:padding="2dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="2dp"
android:text="Powered by Yandex.Translate"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/status_content_translated"
tools:ignore="HardcodedText" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout

View File

@ -353,27 +353,67 @@
android:textAllCaps="false"
android:visibility="gone" />
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/status_content_translated_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="vertical"
android:visibility="gone">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/translation_border"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/translation_border_top" />
<androidx.constraintlayout.widget.Placeholder
android:id="@+id/translation_border_top"
android:layout_width="wrap_content"
android:layout_height="1dp"
app:layout_constraintBottom_toBottomOf="@id/translation_label"
app:layout_constraintEnd_toEndOf="@id/translation_label"
app:layout_constraintTop_toTopOf="@id/translation_label" />
<TextView
android:id="@+id/translation_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:background="?attr/statusBackgroundColor"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="Translation"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/status_content_translated"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="4dp"
app:layout_constraintBottom_toTopOf="@id/yandex_translate"
app:layout_constraintTop_toBottomOf="@id/translation_label"
app:layout_goneMarginBottom="8dp" />
<TextView
android:id="@+id/yandex_translate"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:padding="2dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="2dp"
android:text="Powered by Yandex.Translate"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/status_content_translated"
tools:ignore="HardcodedText" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout

View File

@ -291,27 +291,67 @@
style="?attr/borderless"
android:text="@string/display_toot_truncate" />
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/status_content_translated_container"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="vertical"
android:visibility="gone">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/translation_border"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/translation_border_top" />
<androidx.constraintlayout.widget.Placeholder
android:id="@+id/translation_border_top"
android:layout_width="wrap_content"
android:layout_height="1dp"
app:layout_constraintBottom_toBottomOf="@id/translation_label"
app:layout_constraintEnd_toEndOf="@id/translation_label"
app:layout_constraintTop_toTopOf="@id/translation_label" />
<TextView
android:id="@+id/translation_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:background="?attr/statusBackgroundColor"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="Translation"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/status_content_translated"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="4dp"
app:layout_constraintBottom_toTopOf="@id/yandex_translate"
app:layout_constraintTop_toBottomOf="@id/translation_label"
app:layout_goneMarginBottom="8dp" />
<TextView
android:id="@+id/yandex_translate"
android:layout_width="match_parent"
android:padding="2dp"
android:gravity="end"
android:text="Powered by Yandex.Translate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4dp"
android:layout_marginBottom="2dp"
android:text="Powered by Yandex.Translate"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/status_content_translated"
tools:ignore="HardcodedText" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout

View File

@ -275,28 +275,67 @@
android:textAllCaps="false"
android:visibility="gone" />
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/status_content_translated_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="vertical"
android:visibility="gone">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/translation_border"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/translation_border_top" />
<androidx.constraintlayout.widget.Placeholder
android:id="@+id/translation_border_top"
android:layout_width="wrap_content"
android:layout_height="1dp"
app:layout_constraintBottom_toBottomOf="@id/translation_label"
app:layout_constraintEnd_toEndOf="@id/translation_label"
app:layout_constraintTop_toTopOf="@id/translation_label" />
<TextView
android:id="@+id/translation_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:background="?attr/statusBackgroundColor"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="Translation"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/status_content_translated"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="4dp"
app:layout_constraintBottom_toTopOf="@id/yandex_translate"
app:layout_constraintTop_toBottomOf="@id/translation_label"
app:layout_goneMarginBottom="8dp" />
<TextView
android:id="@+id/yandex_translate"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:padding="2dp"
android:layout_marginEnd="4dp"
android:layout_marginBottom="2dp"
android:text="Powered by Yandex.Translate"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/status_content_translated"
tools:ignore="HardcodedText" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout

View File

@ -13,6 +13,7 @@
<attr format="color" name="textColor" />
<attr format="color" name="cardBorder" />
<attr format="color" name="boostcolor" />
<attr name="statusBackgroundColor" format="color" />
<!-- Light theme -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
@ -45,6 +46,8 @@
<item name="colorBackgroundFloating">@color/white</item>
<item name="android:colorBackground">@color/white</item>
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
<item name="statusBackgroundColor">@color/white</item>
</style>
<style name="Widget.ActionButton.Overflow" parent="Base.Widget.AppCompat.ActionButton.Overflow">
@ -93,6 +96,8 @@
<item name="android:actionBarStyle">@style/LightActionBarTheme</item>
<item name="colorBackgroundFloating">@color/white</item>
<item name="android:colorBackground">@color/white</item>
<item name="statusBackgroundColor">@color/white</item>
</style>
<style name="CardViewStyle.Light" parent="CardView">
<item name="cardBackgroundColor">@color/white</item>
@ -225,6 +230,8 @@
<item name="color_in_account_header">@color/mastodonC3</item>
<item name="colorBackgroundFloating">@color/black_3</item>
<item name="android:colorBackground">@color/black</item>
<item name="statusBackgroundColor">@color/black</item>
</style>
<style name="AppThemeBlack_NoActionBar" parent="Theme.AppCompat.NoActionBar">
@ -259,6 +266,8 @@
<item name="android:actionBarStyle">@style/BlackActionBarTheme</item>
<item name="colorBackgroundFloating">@color/black_3</item>
<item name="android:colorBackground">@color/black</item>
<item name="statusBackgroundColor">@color/black</item>
</style>
<style name="CardViewStyle.Black" parent="CardView">
@ -354,6 +363,8 @@
<item name="color_in_account_header">@color/mastodonC3</item>
<item name="colorBackgroundFloating">@color/mastodonC1</item>
<item name="android:colorBackground">@color/mastodonC1</item>
<item name="statusBackgroundColor">@color/mastodonC1_</item>
</style>
<style name="AppThemeDark_NoActionBar" parent="Theme.AppCompat.NoActionBar">
@ -387,6 +398,8 @@
<item name="color_in_account_header">@color/mastodonC3</item>
<item name="colorBackgroundFloating">@color/mastodonC1</item>
<item name="android:colorBackground">@color/mastodonC1</item>
<item name="statusBackgroundColor">@color/mastodonC1_</item>
</style>
<style name="CardViewStyle.Dark" parent="CardView">