Some tries

This commit is contained in:
Thomas 2022-07-13 12:56:07 +02:00
parent c17322c699
commit 2436c839dc
2 changed files with 8 additions and 6 deletions

View File

@ -21,6 +21,8 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.text.Spannable;
import android.text.SpannableString;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -213,14 +215,14 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
} }
} else { } else {
holderStatus.bindingNotification.containerTransparent.setVisibility(View.VISIBLE); holderStatus.bindingNotification.containerTransparent.setVisibility(View.VISIBLE);
String title = ""; Spannable title = new SpannableString("");
MastodonHelper.loadPPMastodon(holderStatus.binding.avatar, notification.account); MastodonHelper.loadPPMastodon(holderStatus.binding.avatar, notification.account);
if (getItemViewType(position) == TYPE_FAVOURITE) { if (getItemViewType(position) == TYPE_FAVOURITE) {
title = String.format(Locale.getDefault(), "%s %s", notification.account.display_name, context.getString(R.string.notif_favourite)); title = new SpannableString(String.format(Locale.getDefault(), "%s %s", notification.account.display_name, context.getString(R.string.notif_favourite)));
} else if (getItemViewType(position) == TYPE_REBLOG) { } else if (getItemViewType(position) == TYPE_REBLOG) {
title = String.format(Locale.getDefault(), "%s %s", notification.account.display_name, context.getString(R.string.notif_reblog)); title = new SpannableString(String.format(Locale.getDefault(), "%s %s", notification.account.display_name, context.getString(R.string.notif_reblog)));
} else if (getItemViewType(position) == TYPE_POLL) { } else if (getItemViewType(position) == TYPE_POLL) {
title = context.getString(R.string.notif_poll); title = new SpannableString(context.getString(R.string.notif_poll));
} }
if (notification.relatedNotifications != null && notification.relatedNotifications.size() > 0) { if (notification.relatedNotifications != null && notification.relatedNotifications.size() > 0) {
if (notification.type.equals("favourite")) { if (notification.type.equals("favourite")) {
@ -269,7 +271,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
// start the new activity // start the new activity
context.startActivity(intent, options.toBundle()); context.startActivity(intent, options.toBundle());
}); });
CustomEmoji.displayEmoji(context, notification.account.emojis, notification.account.span_display_name, holderStatus.binding.displayName, notification.id, id -> { CustomEmoji.displayEmoji(context, notification.account.emojis, title, holderStatus.binding.displayName, notification.id, id -> {
if (!notification.account.emojiFetched) { if (!notification.account.emojiFetched) {
notification.account.emojiFetched = true; notification.account.emojiFetched = true;
holderStatus.binding.displayName.post(() -> notifyItemChanged(position)); holderStatus.binding.displayName.post(() -> notifyItemChanged(position));

View File

@ -572,7 +572,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
context.startActivity(intent, options.toBundle()); context.startActivity(intent, options.toBundle());
} }
}); });
holder.binding.statusBoosterAvatar.setOnClickListener(v -> { holder.binding.statusBoosterInfo.setOnClickListener(v -> {
if (remote) { if (remote) {
Toasty.info(context, context.getString(R.string.retrieve_remote_status), Toasty.LENGTH_SHORT).show(); Toasty.info(context, context.getString(R.string.retrieve_remote_status), Toasty.LENGTH_SHORT).show();
searchVM.search(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.uri, null, "statuses", false, true, false, 0, null, null, 1) searchVM.search(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusToDeal.uri, null, "statuses", false, true, false, 0, null, null, 1)