Fix #141 + crash fixes

This commit is contained in:
Grishka 2022-05-13 17:51:28 +03:00
parent 88504531d4
commit 63957250c5
3 changed files with 13 additions and 5 deletions

View File

@ -85,7 +85,7 @@ public class AccountSessionManager{
domains.add(session.domain.toLowerCase()); domains.add(session.domain.toLowerCase());
sessions.put(session.getID(), session); sessions.put(session.getID(), session);
} }
}catch(IOException|JsonParseException x){ }catch(Exception x){
Log.e(TAG, "Error loading accounts", x); Log.e(TAG, "Error loading accounts", x);
} }
lastActiveAccountID=prefs.getString("lastActiveAccount", null); lastActiveAccountID=prefs.getString("lastActiveAccount", null);
@ -358,7 +358,7 @@ public class AccountSessionManager{
customEmojis.put(domain, groupCustomEmojis(emojis)); customEmojis.put(domain, groupCustomEmojis(emojis));
instances.put(domain, emojis.instance); instances.put(domain, emojis.instance);
instancesLastUpdated.put(domain, emojis.lastUpdated); instancesLastUpdated.put(domain, emojis.lastUpdated);
}catch(IOException|JsonParseException x){ }catch(Exception x){
Log.w(TAG, "Error reading instance info file for "+domain, x); Log.w(TAG, "Error reading instance info file for "+domain, x);
} }
} }

View File

@ -113,10 +113,15 @@ public abstract class StatusListFragment extends BaseStatusListFragment<Status>{
return; return;
data.remove(status); data.remove(status);
preloadedData.remove(status); preloadedData.remove(status);
HeaderStatusDisplayItem item=findItemOfType(ev.id, HeaderStatusDisplayItem.class); int index=-1;
if(item==null) for(int i=0;i<displayItems.size();i++){
if(ev.id.equals(displayItems.get(i).parentID)){
index=i;
break;
}
}
if(index==-1)
return; return;
int index=displayItems.indexOf(item);
int lastIndex; int lastIndex;
for(lastIndex=index;lastIndex<displayItems.size();lastIndex++){ for(lastIndex=index;lastIndex<displayItems.size();lastIndex++){
if(!displayItems.get(lastIndex).parentID.equals(ev.id)) if(!displayItems.get(lastIndex).parentID.equals(ev.id))

View File

@ -162,6 +162,7 @@ public class ComposeAutocompleteViewController{
.map(WrappedEmoji::new) .map(WrappedEmoji::new)
.collect(Collectors.toList()); .collect(Collectors.toList());
UiUtils.updateList(oldList, emojis, list, emojisAdapter, (e1, e2)->e1.emoji.shortcode.equals(e2.emoji.shortcode)); UiUtils.updateList(oldList, emojis, list, emojisAdapter, (e1, e2)->e1.emoji.shortcode.equals(e2.emoji.shortcode));
imgLoader.updateImages();
} }
} }
@ -186,6 +187,7 @@ public class ComposeAutocompleteViewController{
List<WrappedAccount> oldList=users; List<WrappedAccount> oldList=users;
users=result.accounts.stream().map(WrappedAccount::new).collect(Collectors.toList()); users=result.accounts.stream().map(WrappedAccount::new).collect(Collectors.toList());
UiUtils.updateList(oldList, users, list, usersAdapter, (a1, a2)->a1.account.id.equals(a2.account.id)); UiUtils.updateList(oldList, users, list, usersAdapter, (a1, a2)->a1.account.id.equals(a2.account.id));
imgLoader.updateImages();
if(listIsHidden){ if(listIsHidden){
listIsHidden=false; listIsHidden=false;
V.setVisibilityAnimated(list, View.VISIBLE); V.setVisibilityAnimated(list, View.VISIBLE);
@ -210,6 +212,7 @@ public class ComposeAutocompleteViewController{
List<Hashtag> oldList=hashtags; List<Hashtag> oldList=hashtags;
hashtags=result.hashtags; hashtags=result.hashtags;
UiUtils.updateList(oldList, hashtags, list, hashtagsAdapter, (t1, t2)->t1.name.equals(t2.name)); UiUtils.updateList(oldList, hashtags, list, hashtagsAdapter, (t1, t2)->t1.name.equals(t2.name));
imgLoader.updateImages();
if(listIsHidden){ if(listIsHidden){
listIsHidden=false; listIsHidden=false;
V.setVisibilityAnimated(list, View.VISIBLE); V.setVisibilityAnimated(list, View.VISIBLE);