fixed crash on user list, added better tweet removing from tweet list, comment update

This commit is contained in:
nuclearfog 2021-02-28 20:02:29 +01:00
parent cb5cf885ac
commit f1bfaff589
No known key found for this signature in database
GPG Key ID: D5490E4A81F97B14
3 changed files with 12 additions and 10 deletions

View File

@ -141,12 +141,15 @@ public class TweetAdapter extends Adapter<ViewHolder> {
*/
@MainThread
public void remove(long id) {
for (int pos = 0; pos < tweets.size(); pos++) {
for (int pos = tweets.size() - 1; pos >= 0; pos--) {
Tweet tweet = tweets.get(pos);
if (tweet != null && tweet.getId() == id) {
tweets.remove(pos);
notifyItemRemoved(pos);
break;
if (tweet != null) {
Tweet embedded = tweet.getEmbeddedTweet();
// remove tweet and any retweet of it
if (tweet.getId() == id || (embedded != null && embedded.getId() == id)) {
tweets.remove(pos);
notifyItemRemoved(pos);
}
}
}
}

View File

@ -120,13 +120,12 @@ public class UserAdapter extends Adapter<ViewHolder> {
/**
* remove user from adapter
*
* @param screenname User to remove
* @param name screen name of the user to remove
*/
@MainThread
public void removeUser(String screenname) {
int pos = data.removeItem(screenname);
public void removeUser(String name) {
int pos = data.removeItem(name);
if (pos >= 0) {
data.remove(pos);
notifyItemRemoved(pos);
}
}

View File

@ -46,7 +46,7 @@ import static jp.wasabeef.picasso.transformations.CropTransformation.GravityHori
import static jp.wasabeef.picasso.transformations.CropTransformation.GravityVertical.TOP;
/**
* Class to set up all TetView preferences
* Theme class to set all view styles such as text or drawable color
*
* @author nuclearfog
*/