Merge pull request #586 from sk22/fix/hashtags-crash-akkoma

Fix crash when searching for Hashtags on Akkoma servers
This commit is contained in:
Gregory K 2023-05-28 20:55:04 +03:00 committed by GitHub
commit 47edc3180b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -98,6 +98,12 @@ public class TrendingHashtagsFragment extends BaseRecyclerFragment<Hashtag> impl
@Override @Override
public void onBind(Hashtag item){ public void onBind(Hashtag item){
title.setText('#'+item.name); title.setText('#'+item.name);
if (item.history == null || item.history.isEmpty()) {
subtitle.setText(null);
chart.setVisibility(View.GONE);
return;
}
chart.setVisibility(View.VISIBLE);
int numPeople=item.history.get(0).accounts; int numPeople=item.history.get(0).accounts;
if(item.history.size()>1) if(item.history.size()>1)
numPeople+=item.history.get(1).accounts; numPeople+=item.history.get(1).accounts;

View File

@ -1,6 +1,7 @@
package org.joinmastodon.android.ui.displayitems; package org.joinmastodon.android.ui.displayitems;
import android.content.Context; import android.content.Context;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
@ -37,6 +38,12 @@ public class HashtagStatusDisplayItem extends StatusDisplayItem{
public void onBind(HashtagStatusDisplayItem _item){ public void onBind(HashtagStatusDisplayItem _item){
Hashtag item=_item.tag; Hashtag item=_item.tag;
title.setText('#'+item.name); title.setText('#'+item.name);
if (item.history == null || item.history.isEmpty()) {
subtitle.setText(null);
chart.setVisibility(View.GONE);
return;
}
chart.setVisibility(View.VISIBLE);
int numPeople=item.history.get(0).accounts; int numPeople=item.history.get(0).accounts;
if(item.history.size()>1) if(item.history.size()>1)
numPeople+=item.history.get(1).accounts; numPeople+=item.history.get(1).accounts;