bug fix, cleanup
This commit is contained in:
parent
819f414ed9
commit
c38ccc9e8d
|
@ -38,8 +38,6 @@ android {
|
|||
excludes += ['/META-INF/CHANGES', '/META-INF/DEPENDENCIES', '/META-INF/README.md', '/META-INF/androidx.*', '/META-INF/kotlin*', '/META-INF/com.*', '/META-INF/services/**', '/META-INF/com/**', '/kotlin/**', '/Debug*']
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -551,7 +551,7 @@ public class Mastodon implements Connection {
|
|||
Statuses result = new Statuses();
|
||||
for (Status status : statusThreads) {
|
||||
// Mastodon doesn't support min/max ID.
|
||||
if (status.getRepliedStatusId() == id && (minId == 0 || status.getId() > minId) && (maxId == 0 || status.getId() < maxId)) {
|
||||
if (status.getRepliedStatusId() == id && (minId == 0L || status.getId() > minId) && (maxId == 0L || status.getId() < maxId)) {
|
||||
result.add(status);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.nuclearfog.twidda.backend.api.mastodon.impl;
|
|||
import android.util.Patterns;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
@ -62,6 +63,15 @@ public class MastodonCard implements Card {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (!(obj instanceof Card))
|
||||
return false;
|
||||
Card card = (Card) obj;
|
||||
return card.getTitle().equals(getTitle()) && card.getUrl().equals(getUrl()) && card.getImageUrl().equals(getImageUrl());
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -920,7 +920,7 @@ public class TwitterV1 implements Connection {
|
|||
root.put("event", event);
|
||||
if (!message.isEmpty())
|
||||
data.put("text", message);
|
||||
if (mediaId != 0) {
|
||||
if (mediaId != 0L) {
|
||||
JSONObject attachment = new JSONObject();
|
||||
JSONObject media = new JSONObject();
|
||||
attachment.put("type", "media");
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.nuclearfog.twidda.backend.api.twitter.v2.impl;
|
|||
import android.util.Patterns;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
@ -67,6 +68,15 @@ public class TwitterCard implements Card {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (!(obj instanceof Card))
|
||||
return false;
|
||||
Card card = (Card) obj;
|
||||
return card.getTitle().equals(getTitle()) && card.getUrl().equals(getUrl()) && card.getImageUrl().equals(getImageUrl());
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
|
@ -410,7 +410,7 @@ public class StatusUpdate implements Serializable, Closeable {
|
|||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
if (replyId != 0)
|
||||
if (replyId != 0L)
|
||||
return "to=" + replyId + " status=\"" + text + "\"";
|
||||
return "status=\"" + text + "\"";
|
||||
}
|
||||
|
|
|
@ -1078,7 +1078,7 @@ public class GlobalSettings {
|
|||
String bearerToken = settings.getString(BEARER_TOKEN, "");
|
||||
String hostname = settings.getString(HOSTNAME, TWITTER_HOST);
|
||||
int apiId = settings.getInt(CURRENT_API, 0);
|
||||
long userId = settings.getLong(CURRENT_ID, 0);
|
||||
long userId = settings.getLong(CURRENT_ID, 0L);
|
||||
if ((apiId == Account.API_TWITTER_1 || apiId == Account.API_TWITTER_2) && twitterAlt)
|
||||
hostname = TWITTER_ALT_HOST;
|
||||
login = new ConfigAccount(userId, oauthToken, oauthSecret, consumerToken, consumerSecret, bearerToken, hostname, apiId);
|
||||
|
|
|
@ -54,6 +54,8 @@ public class CardHolder extends ViewHolder implements OnClickListener {
|
|||
private GlobalSettings settings;
|
||||
private OnHolderClickListener listener;
|
||||
|
||||
private Card card;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -93,6 +95,7 @@ public class CardHolder extends ViewHolder implements OnClickListener {
|
|||
* @param card card content
|
||||
*/
|
||||
public void setContent(Card card) {
|
||||
if (!card.equals(this.card)) {
|
||||
SpannableStringBuilder urlDescription = new SpannableStringBuilder();
|
||||
Drawable placeholder = new ColorDrawable(EMPTY_COLOR);
|
||||
// set url preview image
|
||||
|
@ -120,5 +123,7 @@ public class CardHolder extends ViewHolder implements OnClickListener {
|
|||
}
|
||||
// apply description
|
||||
linkText.setText(urlDescription);
|
||||
this.card = card;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -133,7 +133,7 @@ public class StatusFragment extends ListFragment implements StatusSelectListener
|
|||
Bundle param = getArguments();
|
||||
if (param != null) {
|
||||
mode = param.getInt(KEY_MODE, 0);
|
||||
id = param.getLong(KEY_ID, 0);
|
||||
id = param.getLong(KEY_ID, 0L);
|
||||
search = param.getString(KEY_SEARCH, "");
|
||||
}
|
||||
if (savedInstanceState != null) {
|
||||
|
|
|
@ -175,7 +175,7 @@ public class UserFragment extends ListFragment implements UserClickListener, OnC
|
|||
Bundle param = getArguments();
|
||||
if (param != null) {
|
||||
mode = param.getInt(KEY_MODE, 0);
|
||||
id = param.getLong(KEY_ID, 0);
|
||||
id = param.getLong(KEY_ID, 0L);
|
||||
search = param.getString(KEY_SEARCH, "");
|
||||
boolean delUser = param.getBoolean(KEY_DELETE, false);
|
||||
adapter.enableDeleteButton(delUser);
|
||||
|
|
Loading…
Reference in New Issue