Some tries
This commit is contained in:
parent
2b3eb1a67d
commit
37e0c9dbc4
|
@ -36,7 +36,6 @@ import android.text.TextPaint;
|
|||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.ImageSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
@ -513,11 +512,10 @@ public class Status implements Parcelable{
|
|||
spannableStringTranslated = new SpannableString(Html.fromHtml(status.getContentTranslated()));
|
||||
|
||||
status.setContentSpanTranslated(treatment(context, spannableStringTranslated, status));
|
||||
makeEmojisTranslation(context, listener, status);
|
||||
}
|
||||
|
||||
|
||||
private static void makeEmojis(final Context context, final OnRetrieveEmojiInterface listener, Status status){
|
||||
public static void makeEmojis(final Context context, final OnRetrieveEmojiInterface listener, Status status){
|
||||
|
||||
if( ((Activity)context).isFinishing() )
|
||||
return;
|
||||
|
@ -607,6 +605,7 @@ public class Status implements Parcelable{
|
|||
if( i[0] == (emojis.size())) {
|
||||
status.setContentSpan(contentSpan);
|
||||
status.setContentSpanCW(contentSpanCW);
|
||||
status.setEmojiFound(true);
|
||||
listener.onRetrieveEmoji(status, false);
|
||||
}
|
||||
}
|
||||
|
@ -617,7 +616,7 @@ public class Status implements Parcelable{
|
|||
}
|
||||
|
||||
|
||||
private static void makeEmojisTranslation(final Context context, final OnRetrieveEmojiInterface listener, Status status){
|
||||
public static void makeEmojisTranslation(final Context context, final OnRetrieveEmojiInterface listener, Status status){
|
||||
|
||||
if( ((Activity)context).isFinishing() )
|
||||
return;
|
||||
|
@ -677,6 +676,7 @@ public class Status implements Parcelable{
|
|||
if( i[0] == (emojis.size())) {
|
||||
if( finalSpannableStringTranslated != null)
|
||||
status.setContentSpanTranslated(finalSpannableStringTranslated);
|
||||
status.setEmojiTranslateFound(true);
|
||||
listener.onRetrieveEmoji(status, true);
|
||||
}
|
||||
}
|
||||
|
@ -695,8 +695,6 @@ public class Status implements Parcelable{
|
|||
spannableString.removeSpan(span);
|
||||
List<Mention> mentions = status.getReblog() != null ? status.getReblog().getMentions() : status.getMentions();
|
||||
|
||||
Log.v(Helper.TAG,"spannableString: " + spannableString);
|
||||
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
|
||||
|
||||
|
@ -786,7 +784,7 @@ public class Status implements Parcelable{
|
|||
else
|
||||
//noinspection deprecation
|
||||
spannableStringT = new SpannableString(Html.fromHtml(spannableString.toString().replaceAll("^<p>","").replaceAll("<p>","<br/><br/>").replaceAll("</p>","")));
|
||||
Log.v(Helper.TAG,"spannableStringT: " + spannableStringT);
|
||||
|
||||
URLSpan[] spans = spannableStringT.getSpans(0, spannableStringT.length(), URLSpan.class);
|
||||
for (URLSpan span : spans) {
|
||||
spannableStringT.removeSpan(span);
|
||||
|
|
|
@ -310,6 +310,8 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
|||
holder.status_reply.setText("");
|
||||
if( !status.isClickable())
|
||||
Status.transform(context, status, NotificationsListAdapter.this);
|
||||
if( !status.isEmojiFound())
|
||||
Status.makeEmojis(context, NotificationsListAdapter.this, status);
|
||||
holder.notification_status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
|
||||
holder.status_spoiler.setText(status.getContentSpanCW(), TextView.BufferType.SPANNABLE);
|
||||
holder.status_spoiler.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
|
|
@ -639,7 +639,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
holder.left_buttons.setLayoutParams(paramsB);
|
||||
if( !status.isClickable())
|
||||
Status.transform(context, status, this);
|
||||
|
||||
if( !status.isEmojiFound())
|
||||
Status.makeEmojis(context, this, status);
|
||||
holder.status_content.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
|
@ -2261,7 +2262,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
|||
status.setTranslated(true);
|
||||
status.setTranslationShown(true);
|
||||
status.setContentTranslated(translate.getTranslatedContent());
|
||||
status.transformTranslation(context, StatusListAdapter.this, status);
|
||||
Status.transformTranslation(context, StatusListAdapter.this, status);
|
||||
Status.makeEmojisTranslation(context, StatusListAdapter.this, status);
|
||||
notifyStatusChanged(status);
|
||||
}else {
|
||||
Toast.makeText(context, R.string.toast_error_translate, Toast.LENGTH_LONG).show();
|
||||
|
|
Loading…
Reference in New Issue