bug fix
This commit is contained in:
parent
b82702e4d1
commit
d2f40f21f7
|
@ -5,6 +5,7 @@ import androidx.annotation.Nullable;
|
|||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.nuclearfog.twidda.backend.utils.StringTools;
|
||||
import org.nuclearfog.twidda.model.User;
|
||||
|
||||
|
@ -42,18 +43,22 @@ public class MastodonUser implements User {
|
|||
*/
|
||||
public MastodonUser(JSONObject json) throws JSONException {
|
||||
String idStr = json.getString("id");
|
||||
String description = json.optString("note", "");
|
||||
screenname = '@' + json.optString("acct", "");
|
||||
username = json.optString("display_name");
|
||||
username = json.optString("display_name", "");
|
||||
createdAt = StringTools.getTime(json.optString("created_at", ""), StringTools.TIME_MASTODON);
|
||||
profileUrl = json.optString("avatar");
|
||||
bannerUrl = json.optString("banner");
|
||||
description = json.optString("note");
|
||||
url = json.optString("url");
|
||||
profileUrl = json.optString("avatar", "");
|
||||
bannerUrl = json.optString("banner", "");
|
||||
url = json.optString("url", "");
|
||||
following = json.optInt("following_count");
|
||||
follower = json.optInt("followers_count");
|
||||
statusCount = json.optInt("statuses_count");
|
||||
locked = json.optBoolean("locked");
|
||||
|
||||
if (!description.isEmpty()) {
|
||||
this.description = Jsoup.parse(description).text();
|
||||
} else {
|
||||
this.description = "";
|
||||
}
|
||||
try {
|
||||
id = Long.parseLong(idStr);
|
||||
} catch (NumberFormatException e) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package org.nuclearfog.twidda.backend.api.twitter.impl;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.nuclearfog.twidda.model.Notification;
|
||||
import org.nuclearfog.twidda.model.Status;
|
||||
import org.nuclearfog.twidda.model.User;
|
||||
|
@ -50,4 +53,20 @@ public class TwitterNotification implements Notification {
|
|||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "id=" + status.getId() + " " + status.getAuthor();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (!(obj instanceof Notification))
|
||||
return false;
|
||||
Notification notification = ((Notification) obj);
|
||||
return status.equals(notification.getStatus());
|
||||
}
|
||||
}
|
|
@ -142,7 +142,7 @@ public class AccountImpl implements Account {
|
|||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "date=" + loginDate + " host=" + host + " user=" + user;
|
||||
return "date=" + loginDate + " host=\"" + host + "\" user=" + user;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.nuclearfog.twidda.database.impl;
|
|||
|
||||
import android.database.Cursor;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.nuclearfog.twidda.database.DatabaseAdapter.NotificationTable;
|
||||
|
@ -85,4 +86,19 @@ public class NotificationImpl implements Notification {
|
|||
public long getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (!(obj instanceof Notification))
|
||||
return false;
|
||||
return ((Notification) obj).getId() == id;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return "id=" + id + " " + user;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue