Fix crashes

This commit is contained in:
Thomas 2022-12-09 11:34:14 +01:00
parent 52fa2b0815
commit e7dd2ac5d2
2 changed files with 1 additions and 19 deletions

View File

@ -278,17 +278,12 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
applyColorAccount(context, holderFollow); applyColorAccount(context, holderFollow);
} else if (getItemViewType(position) == TYPE_FILERED) { } else if (getItemViewType(position) == TYPE_FILERED) {
StatusAdapter.StatusViewHolder holder = (StatusAdapter.StatusViewHolder) viewHolder; StatusAdapter.StatusViewHolder holder = (StatusAdapter.StatusViewHolder) viewHolder;
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
if (sharedpreferences.getBoolean(context.getString(R.string.SET_CARDVIEW), false)) {
holder.binding.cardviewContainer.setCardElevation(Helper.convertDpToPixel(5, context));
holder.binding.dividerCard.setVisibility(View.GONE);
}
holder.bindingFiltered.filteredText.setText(context.getString(R.string.filtered_by, notification.filteredByApp.title)); holder.bindingFiltered.filteredText.setText(context.getString(R.string.filtered_by, notification.filteredByApp.title));
holder.bindingFiltered.displayButton.setOnClickListener(v -> { holder.bindingFiltered.displayButton.setOnClickListener(v -> {
notification.filteredByApp = null; notification.filteredByApp = null;
notifyItemChanged(position); notifyItemChanged(position);
}); });
StatusAdapter.applyColor(context, holder);
} else { } else {
StatusAdapter.StatusViewHolder holderStatus = (StatusAdapter.StatusViewHolder) viewHolder; StatusAdapter.StatusViewHolder holderStatus = (StatusAdapter.StatusViewHolder) viewHolder;
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);

View File

@ -2295,14 +2295,8 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} else { } else {
holder.bindingFilteredHide.layoutFetchMore.fetchMoreContainer.setVisibility(View.GONE); holder.bindingFilteredHide.layoutFetchMore.fetchMoreContainer.setVisibility(View.GONE);
} }
applyColor(context, holder);
} else if (viewHolder.getItemViewType() == STATUS_FILTERED) { } else if (viewHolder.getItemViewType() == STATUS_FILTERED) {
StatusViewHolder holder = (StatusViewHolder) viewHolder; StatusViewHolder holder = (StatusViewHolder) viewHolder;
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
if (sharedpreferences.getBoolean(context.getString(R.string.SET_CARDVIEW), false)) {
holder.binding.cardviewContainer.setCardElevation(Helper.convertDpToPixel(5, context));
holder.binding.dividerCard.setVisibility(View.GONE);
}
holder.bindingFiltered.filteredText.setText(context.getString(R.string.filtered_by, status.filteredByApp.title)); holder.bindingFiltered.filteredText.setText(context.getString(R.string.filtered_by, status.filteredByApp.title));
holder.bindingFiltered.displayButton.setOnClickListener(v -> { holder.bindingFiltered.displayButton.setOnClickListener(v -> {
status.filteredByApp = null; status.filteredByApp = null;
@ -2339,14 +2333,8 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
} else { } else {
holder.bindingFiltered.layoutFetchMore.fetchMoreContainer.setVisibility(View.GONE); holder.bindingFiltered.layoutFetchMore.fetchMoreContainer.setVisibility(View.GONE);
} }
applyColor(context, holder);
} else if (viewHolder.getItemViewType() == STATUS_ART) { } else if (viewHolder.getItemViewType() == STATUS_ART) {
StatusViewHolder holder = (StatusViewHolder) viewHolder; StatusViewHolder holder = (StatusViewHolder) viewHolder;
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
if (sharedpreferences.getBoolean(context.getString(R.string.SET_CARDVIEW), false)) {
holder.binding.cardviewContainer.setCardElevation(Helper.convertDpToPixel(5, context));
holder.binding.dividerCard.setVisibility(View.GONE);
}
MastodonHelper.loadPPMastodon(holder.bindingArt.artPp, status.account); MastodonHelper.loadPPMastodon(holder.bindingArt.artPp, status.account);
if (status.art_attachment != null) { if (status.art_attachment != null) {
@ -2419,7 +2407,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
intent.putExtra(Helper.ARG_STATUS, status); intent.putExtra(Helper.ARG_STATUS, status);
context.startActivity(intent); context.startActivity(intent);
}); });
applyColor(context, holder);
} }
} }