From fdff40751438150ec7985155f5c9e17d41507390 Mon Sep 17 00:00:00 2001 From: sk Date: Fri, 6 Oct 2023 15:01:17 +0200 Subject: [PATCH] refactor code --- .../android/ui/displayitems/TextStatusDisplayItem.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/TextStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/TextStatusDisplayItem.java index 53fbe8e90..4801c8502 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/TextStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/TextStatusDisplayItem.java @@ -207,8 +207,10 @@ public class TextStatusDisplayItem extends StatusDisplayItem{ translationFooter.setVisibility(translateEnabled ? View.VISIBLE : View.GONE); translationProgress.setVisibility(View.GONE); Translation existingTrans=item.status.getContentStatus().translation; - String lang=existingTrans!=null ? existingTrans.detectedSourceLanguage : null; - String displayLang=Locale.forLanguageTag(lang!=null ? lang : (item.status.getContentStatus().language != null ? item.status.getContentStatus().language : AccountSessionManager.get(item.parentFragment.getAccountID()).preferences.postingDefaultLanguage)).getDisplayLanguage(); + String existingTransLang=existingTrans!=null ? existingTrans.detectedSourceLanguage : null; + String lang=existingTransLang!=null ? existingTransLang : item.status.getContentStatus().language; + String displayLang=Locale.forLanguageTag(lang != null ? lang + : AccountSessionManager.get(item.parentFragment.getAccountID()).preferences.postingDefaultLanguage).getDisplayLanguage(); translationButton.setText(item.parentFragment.getString(R.string.translate_post, !displayLang.isBlank() ? displayLang : lang)); translationButton.setEnabled(true); translationButton.setAlpha(1);