Skip to content

Commit

Permalink
feat: add trending timeline
Browse files Browse the repository at this point in the history
FineFindus committed Apr 10, 2024
1 parent 4f3d711 commit 2b1685b
Showing 3 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
import org.joinmastodon.android.fragments.ListTimelineFragment;
import org.joinmastodon.android.fragments.NotificationsListFragment;
import org.joinmastodon.android.fragments.discover.BubbleTimelineFragment;
import org.joinmastodon.android.fragments.discover.DiscoverPostsFragment;
import org.joinmastodon.android.fragments.discover.FederatedTimelineFragment;
import org.joinmastodon.android.fragments.discover.LocalTimelineFragment;

@@ -150,6 +151,7 @@ public String getDefaultTitle(Context ctx) {
case BUBBLE -> ctx.getString(R.string.sk_timeline_bubble);
case BOOKMARKS -> ctx.getString(R.string.bookmarks);
case FAVORITES -> ctx.getString(R.string.your_favorites);
case DISCOVER_POSTS -> ctx.getString(R.string.mo_timeline_discover_posts);
case CUSTOM_LOCAL_TIMELINE -> domain;
};
}
@@ -166,6 +168,7 @@ public Icon getDefaultIcon() {
case BUBBLE -> Icon.BUBBLE;
case BOOKMARKS -> Icon.BOOKMARKS;
case FAVORITES -> Icon.FAVORITES;
case DISCOVER_POSTS -> Icon.TRENDING;
};
}

@@ -181,6 +184,7 @@ public Fragment getFragment() {
case CUSTOM_LOCAL_TIMELINE -> new CustomLocalTimelineFragment();
case BOOKMARKS -> new BookmarkedStatusListFragment();
case FAVORITES -> new FavoritedStatusListFragment();
case DISCOVER_POSTS -> new DiscoverPostsFragment();
};
}

@@ -263,7 +267,8 @@ public enum TimelineType {

// not really timelines, but some people want it, so,,
BOOKMARKS,
FAVORITES
FAVORITES,
DISCOVER_POSTS,
}

public enum Icon {
@@ -347,7 +352,8 @@ public enum Icon {
CUSTOM_LOCAL_TIMELINE(R.drawable.ic_fluent_people_community_24_regular, R.string.sk_timeline_local, true),
BUBBLE(R.drawable.ic_fluent_circle_24_regular, R.string.sk_timeline_bubble, true),
BOOKMARKS(R.drawable.ic_fluent_bookmark_multiple_24_regular, R.string.bookmarks, true),
FAVORITES(R.drawable.ic_fluent_star_24_regular, R.string.your_favorites, true);
FAVORITES(R.drawable.ic_fluent_star_24_regular, R.string.your_favorites, true),
TRENDING(R.drawable.ic_fluent_arrow_trending_24_filled, R.string.mo_timeline_discover_posts, true);

public final int iconRes, nameRes;
public final boolean hidden;
@@ -368,6 +374,7 @@ public enum Icon {
public static final TimelineDefinition FEDERATED_TIMELINE = new TimelineDefinition(TimelineType.FEDERATED);
public static final TimelineDefinition POSTS_TIMELINE = new TimelineDefinition(TimelineType.POST_NOTIFICATIONS);
public static final TimelineDefinition BOOKMARKS_TIMELINE = new TimelineDefinition(TimelineType.BOOKMARKS);
public static final TimelineDefinition DISCOVER_POSTS_TIMELINE = new TimelineDefinition(TimelineType.DISCOVER_POSTS);
public static final TimelineDefinition FAVORITES_TIMELINE = new TimelineDefinition(TimelineType.FAVORITES);
public static final TimelineDefinition BUBBLE_TIMELINE = new TimelineDefinition(TimelineType.BUBBLE) {
@Override
@@ -415,6 +422,7 @@ public static ArrayList<TimelineDefinition> getAllTimelines(String accountId) {
POSTS_TIMELINE,
BUBBLE_TIMELINE,
BOOKMARKS_TIMELINE,
FAVORITES_TIMELINE
FAVORITES_TIMELINE,
DISCOVER_POSTS_TIMELINE
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M14.003,5.5H21a1,1 0,0 1,0.993 0.883L22,6.5v7a1,1 0,0 1,-1.994 0.117L20,13.5l-0.001,-4.586 -7.292,7.293a1,1 0,0 1,-1.32 0.084l-0.094,-0.083 -2.296,-2.292 -5.288,5.29a1,1 0,0 1,-1.497 -1.32l0.083,-0.095 5.994,-5.996a1,1 0,0 1,1.32 -0.084l0.094,0.083 2.296,2.292L18.584,7.5h-4.581a1,1 0,0 1,-0.993 -0.883l-0.007,-0.117a1,1 0,0 1,0.883 -0.993l0.117,-0.007H21h-6.997Z"
android:fillColor="#212121"/>
</vector>
1 change: 1 addition & 0 deletions mastodon/src/main/res/values/strings_mo.xml
Original file line number Diff line number Diff line change
@@ -120,4 +120,5 @@
<string name="mo_blocked_accounts">Blocked accounts</string>
<!-- <string name="mo_blocks">Blocks</string>-->
<string name="mo_mute_notifications">Hide notifications from this user?</string>
<string name="mo_timeline_discover_posts">Trending Posts</string>
</resources>

0 comments on commit 2b1685b

Please sign in to comment.