feat(status/translation): support translating spoiler
This commit is contained in:
parent
77b9efa7d1
commit
47b13384a8
|
@ -10,6 +10,7 @@ public class Translation extends BaseModel{
|
||||||
public String detectedSourceLanguage;
|
public String detectedSourceLanguage;
|
||||||
@RequiredField
|
@RequiredField
|
||||||
public String provider;
|
public String provider;
|
||||||
|
public String spoilerText;
|
||||||
public MediaAttachment[] mediaAttachments;
|
public MediaAttachment[] mediaAttachments;
|
||||||
public PollTranslation poll;
|
public PollTranslation poll;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class SpoilerStatusDisplayItem extends StatusDisplayItem{
|
||||||
public final Status status;
|
public final Status status;
|
||||||
public final ArrayList<StatusDisplayItem> contentItems=new ArrayList<>();
|
public final ArrayList<StatusDisplayItem> contentItems=new ArrayList<>();
|
||||||
private final CharSequence parsedTitle;
|
private final CharSequence parsedTitle;
|
||||||
|
private CharSequence translatedTitle;
|
||||||
private final CustomEmojiHelper emojiHelper;
|
private final CustomEmojiHelper emojiHelper;
|
||||||
private final Type type;
|
private final Type type;
|
||||||
|
|
||||||
|
@ -85,7 +86,14 @@ public class SpoilerStatusDisplayItem extends StatusDisplayItem{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBind(SpoilerStatusDisplayItem item){
|
public void onBind(SpoilerStatusDisplayItem item){
|
||||||
title.setText(item.parsedTitle);
|
if(item.status.translationState==Status.TranslationState.SHOWN){
|
||||||
|
if(item.translatedTitle==null){
|
||||||
|
item.translatedTitle=item.status.translation.spoilerText;
|
||||||
|
}
|
||||||
|
title.setText(item.translatedTitle);
|
||||||
|
}else{
|
||||||
|
title.setText(item.parsedTitle);
|
||||||
|
}
|
||||||
action.setText(item.status.spoilerRevealed ? R.string.spoiler_hide : R.string.spoiler_show);
|
action.setText(item.status.spoilerRevealed ? R.string.spoiler_hide : R.string.spoiler_show);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue