diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v1/MessageV1.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v1/MessageV1.java index f32554be..f5089899 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v1/MessageV1.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v1/MessageV1.java @@ -29,7 +29,6 @@ public class MessageV1 implements Message { /** * @param json JSON object containing directmessage information - * @throws JSONException if some values are missing */ public MessageV1(JSONObject json) throws JSONException { JSONObject message = json.getJSONObject("message_create"); diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v1/RelationV1.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v1/RelationV1.java index e406b8e9..ef8ea45d 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v1/RelationV1.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v1/RelationV1.java @@ -24,7 +24,6 @@ public class RelationV1 implements Relation { /** * @param json JSON object containing relationship information - * @throws JSONException if values are missing */ public RelationV1(JSONObject json) throws JSONException { JSONObject relationship = json.getJSONObject("relationship"); diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v1/TrendV1.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v1/TrendV1.java index 1e8f2f91..f1db9251 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v1/TrendV1.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v1/TrendV1.java @@ -21,13 +21,14 @@ public class TrendV1 implements Trend { /** * @param json JSON object containing trend information + * @param index array index of this item * @param locationId Id of the trend location */ public TrendV1(JSONObject json, int index, int locationId) { name = json.optString("name", ""); popularity = json.optInt("tweet_volume", -1); this.locationId = locationId; - rank = index + 1; + this.rank = index + 1; } diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/LocationV2.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/LocationV2.java index 70323461..ddd85cff 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/LocationV2.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/LocationV2.java @@ -1,5 +1,7 @@ package org.nuclearfog.twidda.backend.api.twitter.impl.v2; +import androidx.annotation.NonNull; + import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -96,4 +98,11 @@ public class LocationV2 implements Location { public String getFullName() { return fullName; } + + + @NonNull + @Override + public String toString() { + return "id=\"" + id + " full_name=" + fullName + " country=\"" + country + "\""; + } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/TweetV2.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/TweetV2.java index 02934f3c..e1caf79f 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/TweetV2.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/TweetV2.java @@ -49,7 +49,6 @@ public class TweetV2 implements Status { */ public static final String FIELDS_TWEET_PRIVATE = FIELDS_TWEET + "%2Cnon_public_metrics"; - private long id; private long timestamp; private long replyUserId; @@ -77,14 +76,20 @@ public class TweetV2 implements Status { private Card[] cards = {}; /** + * @param json tweet json format + * @param userMap map containing user instances */ public TweetV2(JSONObject json, UserV2Map userMap) throws JSONException { this(json, userMap, null, null, null, null); } /** - * @param json Tweet v2 json - * @param tweetCompat Tweet containing base informations + * @param json tweet json format + * @param userMap map containing user instances + * @param mediaMap map containing media instances + * @param pollMap map containing poll instances + * @param locationMap map containing location instances + * @param tweetCompat tweet v1.1 object */ public TweetV2(JSONObject json, @NonNull UserV2Map userMap, @Nullable MediaV2Map mediaMap, @Nullable PollV2Map pollMap, @Nullable LocationV2Map locationMap, @Nullable Status tweetCompat) throws JSONException { JSONObject publicMetrics = json.getJSONObject("public_metrics"); diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/TwitterCard.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/TwitterCard.java index 75ff2053..c4f686c6 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/TwitterCard.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/TwitterCard.java @@ -2,6 +2,8 @@ package org.nuclearfog.twidda.backend.api.twitter.impl.v2; import android.util.Patterns; +import androidx.annotation.NonNull; + import org.json.JSONArray; import org.json.JSONObject; import org.nuclearfog.twidda.model.Card; @@ -20,7 +22,9 @@ public class TwitterCard implements Card { private String description; private String imageUrl = ""; - + /** + * @param json twitter card json + */ public TwitterCard(JSONObject json) { JSONArray images = json.optJSONArray("images"); url = json.optString("expanded_url", ""); @@ -61,4 +65,11 @@ public class TwitterCard implements Card { public String getImageUrl() { return imageUrl; } + + + @NonNull + @Override + public String toString() { + return "url=\"" + url + "\" description=\"" + description + "\""; + } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/LocationV2Map.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/LocationV2Map.java index 9e00846c..f4a5e68a 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/LocationV2Map.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/LocationV2Map.java @@ -1,5 +1,7 @@ package org.nuclearfog.twidda.backend.api.twitter.impl.v2.maps; +import androidx.annotation.NonNull; + import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -31,4 +33,11 @@ public class LocationV2Map extends TreeMap { } } } + + + @NonNull + @Override + public String toString() { + return "size=" + size(); + } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/MediaV2Map.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/MediaV2Map.java index 8bf257d9..488ff552 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/MediaV2Map.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/MediaV2Map.java @@ -1,5 +1,7 @@ package org.nuclearfog.twidda.backend.api.twitter.impl.v2.maps; +import androidx.annotation.NonNull; + import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -31,4 +33,11 @@ public class MediaV2Map extends TreeMap { } } } + + + @NonNull + @Override + public String toString() { + return "size=" + size(); + } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/PollV2Map.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/PollV2Map.java index 2d228068..a41ee957 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/PollV2Map.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/PollV2Map.java @@ -1,5 +1,7 @@ package org.nuclearfog.twidda.backend.api.twitter.impl.v2.maps; +import androidx.annotation.NonNull; + import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -31,4 +33,11 @@ public class PollV2Map extends TreeMap { } } } + + + @NonNull + @Override + public String toString() { + return "size=" + size(); + } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/UserV2Map.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/UserV2Map.java index bd809f6c..75bad3ec 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/UserV2Map.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/impl/v2/maps/UserV2Map.java @@ -1,5 +1,7 @@ package org.nuclearfog.twidda.backend.api.twitter.impl.v2.maps; +import androidx.annotation.NonNull; + import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -18,16 +20,23 @@ public class UserV2Map extends TreeMap { private static final long serialVersionUID = 3107064180725473583L; /** - * @param json json object from a tweet - * @param twitterId current user's ID + * @param json json object from a tweet + * @param twitterId current user's ID */ public UserV2Map(JSONObject json, long twitterId) throws JSONException { JSONObject includesJson = json.getJSONObject("includes"); JSONArray userArray = includesJson.getJSONArray("users"); - for (int i = 0 ; i < userArray.length() ; i++) { + for (int i = 0; i < userArray.length(); i++) { JSONObject item = userArray.getJSONObject(i); User user = new UserV2(item, twitterId); put(user.getId(), user); } } + + + @NonNull + @Override + public String toString() { + return "size=" + size(); + } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/model/Media.java b/app/src/main/java/org/nuclearfog/twidda/model/Media.java index dc77440f..e5447513 100644 --- a/app/src/main/java/org/nuclearfog/twidda/model/Media.java +++ b/app/src/main/java/org/nuclearfog/twidda/model/Media.java @@ -30,7 +30,6 @@ public interface Media extends Serializable { int GIF = 802; /** - * * @return media key */ String getKey(); diff --git a/app/src/main/res/layout/item_preview.xml b/app/src/main/res/layout/item_preview.xml index 8080fed5..812c48e3 100644 --- a/app/src/main/res/layout/item_preview.xml +++ b/app/src/main/res/layout/item_preview.xml @@ -10,13 +10,15 @@ android:id="@+id/item_preview_image" android:layout_width="wrap_content" android:layout_height="match_parent" - android:scaleType="centerCrop" /> + android:scaleType="centerCrop" + android:contentDescription="@string/status_media_preview" /> + android:layout_gravity="center" + android:contentDescription="@string/status_media_preview_button" /> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ec0b776f..11ec4749 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -57,6 +57,11 @@ Location coordinates copied Media link copied %1$s selected + %1$s favorited your status + %1$s followed you + %1$s request to follow you + %1$s mentioned you + %1$s reposted your status Error @@ -276,12 +281,9 @@ User liking this status now open in browser - %1$s favorited your status - %1$s followed you - %1$s request to follow you - %1$s mentioned you - %1$s reposted your status Reply Status metrics + Media preview + Video preview button \ No newline at end of file