From 48f00f905d89bc88cbb05b8e10ad90755a711a00 Mon Sep 17 00:00:00 2001 From: nuclearfog Date: Sat, 21 May 2022 11:36:50 +0200 Subject: [PATCH] Gradle update, settings page layout fix, toString fix --- app/build.gradle | 2 +- .../java/org/nuclearfog/twidda/backend/api/Twitter.java | 9 +++++---- .../twidda/backend/api/impl/DirectmessageV1.java | 2 +- .../nuclearfog/twidda/backend/api/impl/LocationV1.java | 2 +- .../nuclearfog/twidda/backend/api/impl/RelationV1.java | 4 ++-- .../org/nuclearfog/twidda/backend/api/impl/TrendV1.java | 2 +- .../org/nuclearfog/twidda/backend/api/impl/TweetV1.java | 2 +- .../nuclearfog/twidda/backend/api/impl/UserListV1.java | 2 +- .../org/nuclearfog/twidda/backend/api/impl/UserV1.java | 2 +- .../org/nuclearfog/twidda/backend/api/impl/UserV2.java | 2 +- .../org/nuclearfog/twidda/database/impl/AccountImpl.java | 4 ++-- .../twidda/database/impl/DirectMessageImpl.java | 2 +- .../nuclearfog/twidda/database/impl/LocationImpl.java | 2 +- .../org/nuclearfog/twidda/database/impl/TrendImpl.java | 2 +- .../org/nuclearfog/twidda/database/impl/TweetImpl.java | 2 +- .../org/nuclearfog/twidda/database/impl/UserImpl.java | 2 +- app/src/main/res/layout/page_settings.xml | 2 +- build.gradle | 2 +- 18 files changed, 24 insertions(+), 23 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d8ea60d9..ebdc941b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,7 +61,7 @@ dependencies { implementation 'androidx.vectordrawable:vectordrawable:1.1.0' implementation 'com.google.android.material:material:1.6.0' implementation 'androidx.recyclerview:recyclerview:1.2.1' - implementation 'androidx.constraintlayout:constraintlayout:2.1.3' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.cardview:cardview:1.0.0' //noinspection GradleDependency implementation 'com.squareup.okhttp3:okhttp:3.1.2' diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/Twitter.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/Twitter.java index 759ac0e2..abba1168 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/Twitter.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/Twitter.java @@ -108,7 +108,7 @@ public class Twitter implements GlobalSettings.SettingsListener { private static final String TWEET_UNRETWEET = API + "1.1/statuses/unretweet/"; private static final String TWEET_UPLOAD = API + "1.1/statuses/update.json"; private static final String TWEET_DELETE = API + "1.1/statuses/destroy/"; - private static final String TWEET_HIDE = API + "2/tweets/"; + private static final String TWEET_UNI = API + "2/tweets/"; private static final String TRENDS = API + "1.1/trends/place.json"; private static final String LOCATIONS = API + "1.1/trends/available.json"; private static final String USERLIST_SHOW = API + "1.1/lists/show.json"; @@ -178,6 +178,7 @@ public class Twitter implements GlobalSettings.SettingsListener { supportTls.add(new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS).allEnabledTlsVersions().allEnabledCipherSuites().build()); builder.connectionSpecs(supportTls); } catch (Exception e) { + e.printStackTrace(); // ignore, try with default setting } } @@ -511,7 +512,7 @@ public class Twitter implements GlobalSettings.SettingsListener { * @return user list */ public Users getRetweetingUsers(long tweetId) throws TwitterException { - String endpoint = API + "2/tweets/" + tweetId + "/retweeted_by"; + String endpoint = TWEET_UNI + tweetId + "/retweeted_by"; return getUsers2(endpoint); } @@ -522,7 +523,7 @@ public class Twitter implements GlobalSettings.SettingsListener { * @return user list */ public Users getLikingUsers(long tweetId) throws TwitterException { - String endpoint = API + "2/tweets/" + tweetId + "/liking_users"; + String endpoint = TWEET_UNI + tweetId + "/liking_users"; return getUsers2(endpoint); } @@ -857,7 +858,7 @@ public class Twitter implements GlobalSettings.SettingsListener { try { MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\"hidden\":" + hide + "}"); - Response response = put(TWEET_HIDE + tweetId + "/hidden", new ArrayList<>(2), body); + Response response = put(TWEET_UNI + tweetId + "/hidden", new ArrayList<>(2), body); if (response.body() != null && response.code() == 200) { JSONObject json = new JSONObject(response.body().string()); diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/DirectmessageV1.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/DirectmessageV1.java index 4a471736..132e355d 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/DirectmessageV1.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/DirectmessageV1.java @@ -95,7 +95,7 @@ public class DirectmessageV1 implements DirectMessage { @NonNull @Override public String toString() { - return "from:" + sender + " to:" + receiver + " message:\"" + text + "\""; + return "from=" + sender + " to=" + receiver + " message=\"" + text + "\""; } /** diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/LocationV1.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/LocationV1.java index 76c84d06..eaed540a 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/LocationV1.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/LocationV1.java @@ -51,6 +51,6 @@ public class LocationV1 implements Location { @NonNull @Override public String toString() { - return "id:" + id + " name:\"" + name + "\""; + return "id=" + id + " name=\"" + name + "\""; } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/RelationV1.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/RelationV1.java index bb649540..70024f46 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/RelationV1.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/RelationV1.java @@ -72,7 +72,7 @@ public class RelationV1 implements Relation { @NonNull @Override public String toString() { - return "following:" + isFollowing + " follower:" + isFollower + - " blocked:" + isBlocked + " muted:" + isMuted + " dm open:" + canDm; + return "following=" + isFollowing + " follower=" + isFollower + + " blocked=" + isBlocked + " muted=" + isMuted + " dm open=" + canDm; } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/TrendV1.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/TrendV1.java index d47b5164..b4de4cd9 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/TrendV1.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/TrendV1.java @@ -44,6 +44,6 @@ public class TrendV1 implements Trend { @NonNull @Override public String toString() { - return "rank:" + rank + " name:\"" + name + "\""; + return "rank=" + rank + " name=\"" + name + "\""; } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/TweetV1.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/TweetV1.java index bdcc7a16..dbded107 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/TweetV1.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/TweetV1.java @@ -255,7 +255,7 @@ public class TweetV1 implements Tweet { @NonNull @Override public String toString() { - return "from:\"" + author.getScreenname() + "\" text:\"" + text + "\""; + return "from=\"" + author.getScreenname() + "\" text=\"" + text + "\""; } /** diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/UserListV1.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/UserListV1.java index d6debd09..25e08eda 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/UserListV1.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/UserListV1.java @@ -109,7 +109,7 @@ public class UserListV1 implements UserList { @NonNull @Override public String toString() { - return "title:\"" + title + "\" description:\"" + description + "\""; + return "title=\"" + title + "\" description=\"" + description + "\""; } /** diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/UserV1.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/UserV1.java index ac65a094..162569b4 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/UserV1.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/UserV1.java @@ -180,7 +180,7 @@ public class UserV1 implements User { @NonNull @Override public String toString() { - return "name:\"" + screenName + "\""; + return "name=\"" + screenName + "\""; } /** diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/UserV2.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/UserV2.java index 5a703c67..a546ae2b 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/UserV2.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/impl/UserV2.java @@ -184,7 +184,7 @@ public class UserV2 implements User { @NonNull @Override public String toString() { - return "name:\"" + screenName + "\""; + return "name=\"" + screenName + "\""; } /** diff --git a/app/src/main/java/org/nuclearfog/twidda/database/impl/AccountImpl.java b/app/src/main/java/org/nuclearfog/twidda/database/impl/AccountImpl.java index 471937b3..fb068847 100644 --- a/app/src/main/java/org/nuclearfog/twidda/database/impl/AccountImpl.java +++ b/app/src/main/java/org/nuclearfog/twidda/database/impl/AccountImpl.java @@ -69,8 +69,8 @@ public class AccountImpl implements Account { @Override public String toString() { if (user != null) - return user + " date:" + loginDate; - return "id:" + userId + " date:" + loginDate; + return user + " date=" + loginDate; + return "id=" + userId + " date=" + loginDate; } /** diff --git a/app/src/main/java/org/nuclearfog/twidda/database/impl/DirectMessageImpl.java b/app/src/main/java/org/nuclearfog/twidda/database/impl/DirectMessageImpl.java index 050e5893..0df5561b 100644 --- a/app/src/main/java/org/nuclearfog/twidda/database/impl/DirectMessageImpl.java +++ b/app/src/main/java/org/nuclearfog/twidda/database/impl/DirectMessageImpl.java @@ -79,7 +79,7 @@ public class DirectMessageImpl implements DirectMessage { @NonNull @Override public String toString() { - return "from:" + sender + " to:" + receiver + " message:\"" + text + "\""; + return "from=" + sender + " to=" + receiver + " message=\"" + text + "\""; } public void setSender(User sender) { diff --git a/app/src/main/java/org/nuclearfog/twidda/database/impl/LocationImpl.java b/app/src/main/java/org/nuclearfog/twidda/database/impl/LocationImpl.java index 878697a7..d8b05136 100644 --- a/app/src/main/java/org/nuclearfog/twidda/database/impl/LocationImpl.java +++ b/app/src/main/java/org/nuclearfog/twidda/database/impl/LocationImpl.java @@ -47,6 +47,6 @@ public class LocationImpl implements Location { @NonNull @Override public String toString() { - return "id:" + id + " name:\"" + name + "\""; + return "id=" + id + " name=\"" + name + "\""; } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/database/impl/TrendImpl.java b/app/src/main/java/org/nuclearfog/twidda/database/impl/TrendImpl.java index 212820f7..82f6e1e2 100644 --- a/app/src/main/java/org/nuclearfog/twidda/database/impl/TrendImpl.java +++ b/app/src/main/java/org/nuclearfog/twidda/database/impl/TrendImpl.java @@ -43,6 +43,6 @@ public class TrendImpl implements Trend { @NonNull @Override public String toString() { - return "rank:" + rank + " name:\"" + name + "\""; + return "rank=" + rank + " name=\"" + name + "\""; } } \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/database/impl/TweetImpl.java b/app/src/main/java/org/nuclearfog/twidda/database/impl/TweetImpl.java index 352d0daa..39f7ed24 100644 --- a/app/src/main/java/org/nuclearfog/twidda/database/impl/TweetImpl.java +++ b/app/src/main/java/org/nuclearfog/twidda/database/impl/TweetImpl.java @@ -213,7 +213,7 @@ public class TweetImpl implements Tweet { @NonNull @Override public String toString() { - return "from:\"" + author.getScreenname() + "\" text:\"" + text + "\""; + return "from=\"" + author.getScreenname() + "\" text=\"" + text + "\""; } /** diff --git a/app/src/main/java/org/nuclearfog/twidda/database/impl/UserImpl.java b/app/src/main/java/org/nuclearfog/twidda/database/impl/UserImpl.java index dbd8f1d1..7bf79ba4 100644 --- a/app/src/main/java/org/nuclearfog/twidda/database/impl/UserImpl.java +++ b/app/src/main/java/org/nuclearfog/twidda/database/impl/UserImpl.java @@ -165,6 +165,6 @@ public class UserImpl implements User { @NonNull @Override public String toString() { - return "name:\"" + screenName + "\""; + return "name=\"" + screenName + "\""; } } diff --git a/app/src/main/res/layout/page_settings.xml b/app/src/main/res/layout/page_settings.xml index 8265dd14..4628d3fb 100644 --- a/app/src/main/res/layout/page_settings.xml +++ b/app/src/main/res/layout/page_settings.xml @@ -454,7 +454,7 @@ android:layout_marginBottom="@dimen/settings_column_margin" android:max="9" app:layout_constraintStart_toEndOf="@id/settings_list_seek_descr" - app:layout_constraintTop_toBottomOf="@id/settings_enable_prev" + app:layout_constraintTop_toBottomOf="@id/settings_enable_twitter_alt" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/settings_list_size" /> diff --git a/build.gradle b/build.gradle index 1dec3886..6044aa06 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.1.3' + classpath 'com.android.tools.build:gradle:7.2.0' classpath 'io.michaelrocks:paranoid-gradle-plugin:0.3.7' classpath 'gradle.plugin.ru.cleverpumpkin.proguard-dictionaries-generator:plugin:1.0.8' }