diff --git a/app/build.gradle b/app/build.gradle index dcfeb35c..16879331 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { applicationId 'org.nuclearfog.twidda' minSdkVersion 21 targetSdkVersion 33 - versionCode 85 - versionName '3.1.5' + versionCode 86 + versionName '3.1.6' resConfigs 'en', 'de-rDE', 'zh-rCN' } diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/Connection.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/Connection.java index 1e684f68..07e470a2 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/Connection.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/Connection.java @@ -281,6 +281,13 @@ public interface Connection { */ Trends showHashtagFollowing(long cursor) throws ConnectionException; + /** + * show information of a single hashtag + * @param name hashtag name + * @return hashtag information + */ + Trend showHashtag(String name) throws ConnectionException; + /** * follow hashtag by name * diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/mastodon/Mastodon.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/mastodon/Mastodon.java index 905be79f..a0aa6464 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/mastodon/Mastodon.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/mastodon/Mastodon.java @@ -456,6 +456,18 @@ public class Mastodon implements Connection { } + @Override + public Trend showHashtag(String name) throws ConnectionException { + try { + if (name.startsWith("#")) + name = name.substring(1); + return createTrend(get(ENDPOINT_HASHTAG_GET + StringUtils.encode(name), new ArrayList<>())); + } catch (IOException e) { + throw new MastodonException(e); + } + } + + @Override public Trend followHashtag(String name) throws ConnectionException { try { diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/v1/TwitterV1.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/v1/TwitterV1.java index 4195fc2b..7dd18d9d 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/v1/TwitterV1.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/twitter/v1/TwitterV1.java @@ -574,6 +574,12 @@ public class TwitterV1 implements Connection { } + @Override + public Trend showHashtag(String name) throws ConnectionException { + throw new TwitterException("not supported!"); + } + + @Override public Trend followHashtag(String name) throws ConnectionException { throw new TwitterException("not supported!"); diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/async/HashtagAction.java b/app/src/main/java/org/nuclearfog/twidda/backend/async/HashtagAction.java index b97d4fb2..73ef1705 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/async/HashtagAction.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/async/HashtagAction.java @@ -31,8 +31,12 @@ public class HashtagAction extends AsyncExecutor