bug fix
This commit is contained in:
parent
7b84a5b516
commit
9efb78c8fa
@ -12,8 +12,8 @@ android {
|
||||
applicationId 'org.nuclearfog.twidda'
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 33
|
||||
versionCode 67
|
||||
versionName '3.0b'
|
||||
versionCode 68
|
||||
versionName '3.0'
|
||||
resConfigs 'en', 'de-rDE', 'zh-rCN'
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class TweetV2 implements Status {
|
||||
/**
|
||||
* default tweet fields
|
||||
*/
|
||||
public static final String FIELDS_TWEET = "id%2Ctext%2Cattachments%2Cconversation_id%2Centities%2Cpublic_metrics%2Creply_settings%2Cgeo%2Csource%2Cpossibly_sensitive";
|
||||
public static final String FIELDS_TWEET = "id%2Ctext%2Cattachments%2Cconversation_id%2Centities%2Cpublic_metrics%2Creply_settings%2Cgeo%2Csource%2Cpossibly_sensitive%2Ccreated_at";
|
||||
|
||||
/**
|
||||
* default tweet fields with non public metrics
|
||||
@ -168,13 +168,21 @@ public class TweetV2 implements Status {
|
||||
for (int i = urls.length() - 1; i >= 0; i--) {
|
||||
// expand shortened links
|
||||
JSONObject entry = urls.getJSONObject(i);
|
||||
String link = entry.getString("expanded_url");
|
||||
String expandedUrl = entry.getString("expanded_url");
|
||||
String displayUrl = entry.getString("display_url");
|
||||
String mediaKey = entry.optString("media_key", "");
|
||||
int start = entry.optInt("start", -1);
|
||||
int end = entry.optInt("end", -1);
|
||||
if (start >= 0 && end > start) {
|
||||
int offset = StringTools.calculateIndexOffset(textStr, start);
|
||||
builder.replace(start + offset, end + offset, link);
|
||||
// replace shortened link
|
||||
if (!displayUrl.contains("pic.twitter.com")) {
|
||||
builder.replace(start + offset, end + offset, expandedUrl);
|
||||
}
|
||||
// remove shortened link if it is a media link
|
||||
else {
|
||||
builder.delete(start + offset, end + offset);
|
||||
}
|
||||
}
|
||||
// create Twitter card if link is not a media link
|
||||
if (mediaKey.isEmpty()) {
|
||||
|
@ -81,7 +81,7 @@ public class StatusImpl implements Status {
|
||||
reposted = (register & REPOST_MASK) != 0;
|
||||
sensitive = (register & MEDIA_SENS_MASK) != 0;
|
||||
isHidden = (register & HIDDEN_MASK) != 0;
|
||||
if (locationCoordinates != null || locationName != null)
|
||||
if ((locationCoordinates != null && !locationCoordinates.isEmpty()) || (locationName != null && !locationName.isEmpty()))
|
||||
location = new LocationImpl(locationName, locationCoordinates);
|
||||
apiType = account.getApiType();
|
||||
}
|
||||
|
@ -778,6 +778,7 @@ public class StatusActivity extends AppCompatActivity implements OnClickListener
|
||||
}
|
||||
if (settings.linkPreviewEnabled() && (status.getCards().length > 0 || status.getMedia().length > 0)) {
|
||||
cardList.setVisibility(VISIBLE);
|
||||
mediaButton.setVisibility(GONE);
|
||||
adapter.replaceAll(status.getCards(), status.getMedia());
|
||||
|
||||
} else if (status.getMedia().length > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user