Crash fixes

This commit is contained in:
Grishka 2024-07-03 01:17:47 +03:00
parent f241d74e27
commit 3e26bd2f52
4 changed files with 13 additions and 10 deletions

View File

@ -13,8 +13,8 @@ android {
applicationId "org.joinmastodon.android"
minSdk 23
targetSdk 33
versionCode 107
versionName "2.5.5"
versionCode 108
versionName "2.5.6"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -691,7 +691,7 @@ public class InstanceCatalogSignupFragment extends InstanceCatalogFragment{
boolean found=false;
for(int i=0;i<list.getChildCount();i++){
RecyclerView.ViewHolder holder=list.getChildViewHolder(list.getChildAt(i));
if(holder.getAbsoluteAdapterPosition()==mergeAdapter.getPositionForAdapter(adapter)+idx && holder instanceof InstanceViewHolder ivh){
if(holder instanceof InstanceViewHolder ivh && holder.getAbsoluteAdapterPosition()==mergeAdapter.getPositionForAdapter(adapter)+idx){
ivh.radioButton.setChecked(false);
found=true;
break;

View File

@ -27,11 +27,7 @@ public class CardViewModel{
this.parentObject=parentObject;
this.imageRequest=TextUtils.isEmpty(card.image) ? null : new UrlImageLoaderRequest(card.image, V.dp(width), V.dp(height));
Account authorAccount;
if(card.authors!=null && !card.authors.isEmpty() && card.authors.get(0).account!=null)
authorAccount=card.authors.get(0).account;
else
authorAccount=card.authorAccount;
Account authorAccount=getAuthorAccount();
if(authorAccount!=null){
parsedAuthorName=new SpannableStringBuilder(authorAccount.displayName);
@ -46,7 +42,7 @@ public class CardViewModel{
}
public int getImageCount(){
return 1+(card.authorAccount!=null ? (1+authorNameEmojiHelper.getImageCount()) : 0);
return 1+(getAuthorAccount()!=null ? (1+authorNameEmojiHelper.getImageCount()) : 0);
}
public ImageLoaderRequest getImageRequest(int index){
@ -56,4 +52,11 @@ public class CardViewModel{
default -> authorNameEmojiHelper.getImageRequest(index-2);
};
}
public Account getAuthorAccount(){
if(card.authors!=null && !card.authors.isEmpty() && card.authors.get(0).account!=null)
return card.authors.get(0).account;
else
return card.authorAccount;
}
}

View File

@ -189,7 +189,7 @@ public class LinkCardHolder<T extends LinkCardHolder.LinkCardProvider> extends S
private void onAuthorChipClick(View v){
Bundle args=new Bundle();
args.putString("account", accountID);
args.putParcelable("profileAccount", Parcels.wrap(item.getCard().card.authorAccount));
args.putParcelable("profileAccount", Parcels.wrap(item.getCard().getAuthorAccount()));
Nav.go(activity, ProfileFragment.class, args);
}