Some fixes

This commit is contained in:
Thomas 2022-07-19 11:51:19 +02:00
parent 192c2c6469
commit f5bf2ad0b0
5 changed files with 21 additions and 4 deletions

View file

@ -287,7 +287,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
//We change order for mentions
//At first place the account that has been mentioned if it's not our
statusDraftList.get(0).mentions = new ArrayList<>();
if (!statusReply.account.acct.equalsIgnoreCase(currentAccount.mastodon_account.acct)) {
if (statusReply.account.acct != null && !statusReply.account.acct.equalsIgnoreCase(currentAccount.mastodon_account.acct)) {
Mention mention = new Mention();
mention.acct = "@" + statusReply.account.acct;
mention.url = statusReply.account.url;
@ -298,7 +298,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
//There are other mentions to
if (statusReply.mentions != null && statusReply.mentions.size() > 0) {
for (Mention mentionTmp : statusReply.mentions) {
if (!mentionTmp.acct.equalsIgnoreCase(statusReply.account.acct) && !mentionTmp.acct.equalsIgnoreCase(currentAccount.mastodon_account.acct)) {
if (statusReply.account.acct != null && !mentionTmp.acct.equalsIgnoreCase(statusReply.account.acct) && !mentionTmp.acct.equalsIgnoreCase(currentAccount.mastodon_account.acct)) {
statusDraftList.get(0).mentions.add(mentionTmp);
}
}

View file

@ -39,7 +39,7 @@ public class Field implements Serializable {
public Date verified_at;
//Some extra spannable element - They will be filled automatically when fetching the account
private ForegroundColorSpan value_span;
private transient ForegroundColorSpan value_span;
public synchronized Spannable getValueSpan(Context context, Account account, WeakReference<View> viewWeakReference) {

View file

@ -1038,6 +1038,12 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
@SuppressLint("ClickableViewAccessibility")
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
int theme_statuses_color = -1;
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
if (sharedpreferences.getBoolean("use_custom_theme", false)) {
theme_statuses_color = sharedpreferences.getInt("theme_statuses_color", -1);
}
if (getItemViewType(position) == TYPE_NORMAL) {
Status status = statusList.get(position);
StatusSimpleViewHolder holder = (StatusSimpleViewHolder) viewHolder;
@ -1061,6 +1067,11 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
holder.binding.spoiler.setVisibility(View.GONE);
holder.binding.spoiler.setText(null);
}
if (theme_statuses_color != -1) {
holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
} else {
holder.binding.cardviewContainer.setBackgroundColor(ContextCompat.getColor(context, R.color.cyanea_primary_dark_reference));
}
} else if (getItemViewType(position) == TYPE_COMPOSE) {
Status statusDraft = statusList.get(position);
@ -1072,7 +1083,11 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
int newInputTypeSpoiler = holder.binding.contentSpoiler.getInputType() & (holder.binding.contentSpoiler.getInputType() ^ InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
holder.binding.contentSpoiler.setInputType(newInputTypeSpoiler);
if (theme_statuses_color != -1) {
holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
} else {
holder.binding.cardviewContainer.setBackgroundColor(ContextCompat.getColor(context, R.color.cyanea_primary_dark_reference));
}
holder.binding.buttonAttach.setOnClickListener(v -> {
if (instanceInfo.configuration.media_attachments.supported_mime_types != null) {
if (instanceInfo.getMimeTypeAudio().size() == 0) {

View file

@ -19,6 +19,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/cardview_container"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="12dp"
android:clipChildren="false"

View file

@ -19,6 +19,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/cardview_container"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="12dp"
android:clipChildren="false"