Improve translation view

This commit is contained in:
tom79 2019-11-11 18:50:51 +01:00
parent b361d01eeb
commit fb5ab86b84
7 changed files with 23 additions and 8 deletions

View File

@ -712,6 +712,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
View status_reply_indicator_top, reply_indicator_dot, status_reply_indicator_bottom, status_reply_indicator_diag_top, status_reply_indicator_diag_bottom;
CardView main_card_container;
LinearLayout main_linear_container;
View translation_border_view;
public View getView() {
return itemView;
}
@ -839,6 +840,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
main_card_container = itemView.findViewById(R.id.main_card_container);
main_linear_container = itemView.findViewById(R.id.main_linear_container);
translation_border_view = itemView.findViewById(R.id.translation_border_view);
}
void updateAnimatedEmoji() {
@ -2291,6 +2293,12 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
if (status.isTranslationShown() && status.getContentSpanTranslated() != null) {
holder.status_content_translated.setText(status.getContentSpanTranslated(), TextView.BufferType.SPANNABLE);
holder.status_content_translated_container.setVisibility(View.VISIBLE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
holder.translation_border_view.setBackgroundResource(R.drawable.translation_border_android4);
}else{
holder.translation_border_view.setBackgroundResource(R.drawable.translation_border);
}
} else { //Toot is not translated
holder.status_content_translated_container.setVisibility(View.GONE);
}

View File

@ -2,6 +2,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
android:color="@color/colorAccent" />
android:color="?colorAccent" />
<corners android:radius="4dp" />
</shape>

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="@color/mastodonC4" />
<corners android:radius="4dp" />
</shape>

View File

@ -403,9 +403,9 @@
android:visibility="gone">
<View
android:id="@+id/translation_border_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" />

View File

@ -343,9 +343,9 @@
android:visibility="gone">
<View
android:id="@+id/translation_border_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" />
@ -365,7 +365,7 @@
android:background="?attr/cardviewColor"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="Translation"
android:text="@string/translation"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@ -299,9 +299,9 @@
android:visibility="gone">
<View
android:id="@+id/translation_border_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" />
@ -321,7 +321,7 @@
android:background="?attr/backgroundColor"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="Translation"
android:text="@string/translation"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@ -277,9 +277,9 @@
android:visibility="gone">
<View
android:id="@+id/translation_border_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" />
@ -299,7 +299,7 @@
android:background="?attr/backgroundColor"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="Translation"
android:text="@string/translation"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />