Loading app/src/main/AndroidManifest.xml +4 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,10 @@ android:configChanges="keyboardHidden|orientation|screenSize" android:label="@string/action_about" android:theme="@style/AppThemeBar" /> <activity android:name=".mastodon.activities.TimelineActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@style/AppThemeBar" /> <activity android:name=".mastodon.activities.CheckHomeCacheActivity" android:configChanges="keyboardHidden|orientation|screenSize" Loading app/src/main/java/app/fedilab/android/mastodon/activities/TimelineActivity.java 0 → 100644 +77 −0 Original line number Diff line number Diff line package app.fedilab.android.mastodon.activities; /* Copyright 2023 Thomas Schneider * * This file is a part of Fedilab * * This program is free software; you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation; either version 3 of the * License, or (at your option) any later version. * * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ import android.os.Bundle; import android.view.MenuItem; import org.jetbrains.annotations.NotNull; import app.fedilab.android.R; import app.fedilab.android.databinding.ActivityTimelineBinding; import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline; import app.fedilab.android.mastodon.client.entities.app.Timeline; import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonTimeline; public class TimelineActivity extends BaseBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app.fedilab.android.databinding.ActivityTimelineBinding binding = ActivityTimelineBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } Bundle b = getIntent().getExtras(); Timeline.TimeLineEnum timelineType = null; String lemmy_post_id = null; PinnedTimeline pinnedTimeline = null; if (b != null) { timelineType = (Timeline.TimeLineEnum) b.get(Helper.ARG_TIMELINE_TYPE); lemmy_post_id = b.getString(Helper.ARG_LEMMY_POST_ID, null); pinnedTimeline = (PinnedTimeline) b.getSerializable(Helper.ARG_REMOTE_INSTANCE); } if (pinnedTimeline != null && pinnedTimeline.remoteInstance != null) { setTitle(pinnedTimeline.remoteInstance.displayName); } FragmentMastodonTimeline fragmentMastodonTimeline = new FragmentMastodonTimeline(); Bundle bundle = new Bundle(); bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, timelineType); bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinnedTimeline); bundle.putSerializable(Helper.ARG_LEMMY_POST_ID, lemmy_post_id); fragmentMastodonTimeline.setArguments(bundle); getSupportFragmentManager().beginTransaction() .add(R.id.fragment_container_view, fragmentMastodonTimeline).commit(); } @Override public boolean onOptionsItemSelected(@NotNull MenuItem item) { if (item.getItemId() == android.R.id.home) { finish(); return true; } return super.onOptionsItemSelected(item); } } app/src/main/java/app/fedilab/android/mastodon/client/endpoints/MastodonTimelinesService.java +10 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import app.fedilab.android.mastodon.client.entities.api.Marker; import app.fedilab.android.mastodon.client.entities.api.MastodonList; import app.fedilab.android.mastodon.client.entities.api.Status; import app.fedilab.android.mastodon.client.entities.api.Tag; import app.fedilab.android.mastodon.client.entities.lemmy.LemmyPost; import app.fedilab.android.mastodon.client.entities.misskey.MisskeyNote; import app.fedilab.android.mastodon.client.entities.nitter.Nitter; import app.fedilab.android.mastodon.client.entities.peertube.PeertubeVideo; Loading Loading @@ -230,6 +231,15 @@ public interface MastodonTimelinesService { Call<List<MisskeyNote>> getMisskey(@Body MisskeyNote.MisskeyParams params); @GET("api/v3/post/list") Call<List<LemmyPost>> getLemmyMain(@Query("limit") Integer limit, @Query("page") String page); @GET("api/v3/comment/list") Call<List<LemmyPost>> getLemmyThread(@Query("post_id") String post_id, @Query("limit") Integer limit, @Query("page") String page); //Public timelines for Misskey @FormUrlEncoded @POST("api/notes") Loading app/src/main/java/app/fedilab/android/mastodon/helper/Helper.java +2 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,8 @@ public class Helper { public static final String ARG_STATUS_ID = "ARG_STATUS_ID"; public static final String ARG_WORK_ID = "ARG_WORK_ID"; public static final String ARG_LIST_ID = "ARG_LIST_ID"; public static final String ARG_LEMMY_POST_ID = "ARG_LEMMY_POST_ID"; public static final String ARG_SEARCH_KEYWORD = "ARG_SEARCH_KEYWORD"; public static final String ARG_DIRECTORY_ORDER = "ARG_DIRECTORY_ORDER"; public static final String ARG_DIRECTORY_LOCAL = "ARG_DIRECTORY_LOCAL"; Loading app/src/main/java/app/fedilab/android/mastodon/helper/PinnedTimelineHelper.java +6 −1 Original line number Diff line number Diff line Loading @@ -370,7 +370,9 @@ public class PinnedTimelineHelper { case MASTODON: tabCustomViewBinding.icon.setImageResource(R.drawable.mastodon_icon_item); break; case LEMMY: tabCustomViewBinding.icon.setImageResource(R.drawable.lemmy); break; case MISSKEY: tabCustomViewBinding.icon.setImageResource(R.drawable.misskey); break; Loading Loading @@ -461,6 +463,9 @@ public class PinnedTimelineHelper { case MISSKEY: item.setIcon(R.drawable.misskey); break; case LEMMY: item.setIcon(R.drawable.lemmy); break; case PIXELFED: item.setIcon(R.drawable.pixelfed); break; Loading Loading
app/src/main/AndroidManifest.xml +4 −0 Original line number Diff line number Diff line Loading @@ -265,6 +265,10 @@ android:configChanges="keyboardHidden|orientation|screenSize" android:label="@string/action_about" android:theme="@style/AppThemeBar" /> <activity android:name=".mastodon.activities.TimelineActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@style/AppThemeBar" /> <activity android:name=".mastodon.activities.CheckHomeCacheActivity" android:configChanges="keyboardHidden|orientation|screenSize" Loading
app/src/main/java/app/fedilab/android/mastodon/activities/TimelineActivity.java 0 → 100644 +77 −0 Original line number Diff line number Diff line package app.fedilab.android.mastodon.activities; /* Copyright 2023 Thomas Schneider * * This file is a part of Fedilab * * This program is free software; you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation; either version 3 of the * License, or (at your option) any later version. * * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ import android.os.Bundle; import android.view.MenuItem; import org.jetbrains.annotations.NotNull; import app.fedilab.android.R; import app.fedilab.android.databinding.ActivityTimelineBinding; import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline; import app.fedilab.android.mastodon.client.entities.app.Timeline; import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.ui.fragment.timeline.FragmentMastodonTimeline; public class TimelineActivity extends BaseBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app.fedilab.android.databinding.ActivityTimelineBinding binding = ActivityTimelineBinding.inflate(getLayoutInflater()); setContentView(binding.getRoot()); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } Bundle b = getIntent().getExtras(); Timeline.TimeLineEnum timelineType = null; String lemmy_post_id = null; PinnedTimeline pinnedTimeline = null; if (b != null) { timelineType = (Timeline.TimeLineEnum) b.get(Helper.ARG_TIMELINE_TYPE); lemmy_post_id = b.getString(Helper.ARG_LEMMY_POST_ID, null); pinnedTimeline = (PinnedTimeline) b.getSerializable(Helper.ARG_REMOTE_INSTANCE); } if (pinnedTimeline != null && pinnedTimeline.remoteInstance != null) { setTitle(pinnedTimeline.remoteInstance.displayName); } FragmentMastodonTimeline fragmentMastodonTimeline = new FragmentMastodonTimeline(); Bundle bundle = new Bundle(); bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, timelineType); bundle.putSerializable(Helper.ARG_REMOTE_INSTANCE, pinnedTimeline); bundle.putSerializable(Helper.ARG_LEMMY_POST_ID, lemmy_post_id); fragmentMastodonTimeline.setArguments(bundle); getSupportFragmentManager().beginTransaction() .add(R.id.fragment_container_view, fragmentMastodonTimeline).commit(); } @Override public boolean onOptionsItemSelected(@NotNull MenuItem item) { if (item.getItemId() == android.R.id.home) { finish(); return true; } return super.onOptionsItemSelected(item); } }
app/src/main/java/app/fedilab/android/mastodon/client/endpoints/MastodonTimelinesService.java +10 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import app.fedilab.android.mastodon.client.entities.api.Marker; import app.fedilab.android.mastodon.client.entities.api.MastodonList; import app.fedilab.android.mastodon.client.entities.api.Status; import app.fedilab.android.mastodon.client.entities.api.Tag; import app.fedilab.android.mastodon.client.entities.lemmy.LemmyPost; import app.fedilab.android.mastodon.client.entities.misskey.MisskeyNote; import app.fedilab.android.mastodon.client.entities.nitter.Nitter; import app.fedilab.android.mastodon.client.entities.peertube.PeertubeVideo; Loading Loading @@ -230,6 +231,15 @@ public interface MastodonTimelinesService { Call<List<MisskeyNote>> getMisskey(@Body MisskeyNote.MisskeyParams params); @GET("api/v3/post/list") Call<List<LemmyPost>> getLemmyMain(@Query("limit") Integer limit, @Query("page") String page); @GET("api/v3/comment/list") Call<List<LemmyPost>> getLemmyThread(@Query("post_id") String post_id, @Query("limit") Integer limit, @Query("page") String page); //Public timelines for Misskey @FormUrlEncoded @POST("api/notes") Loading
app/src/main/java/app/fedilab/android/mastodon/helper/Helper.java +2 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,8 @@ public class Helper { public static final String ARG_STATUS_ID = "ARG_STATUS_ID"; public static final String ARG_WORK_ID = "ARG_WORK_ID"; public static final String ARG_LIST_ID = "ARG_LIST_ID"; public static final String ARG_LEMMY_POST_ID = "ARG_LEMMY_POST_ID"; public static final String ARG_SEARCH_KEYWORD = "ARG_SEARCH_KEYWORD"; public static final String ARG_DIRECTORY_ORDER = "ARG_DIRECTORY_ORDER"; public static final String ARG_DIRECTORY_LOCAL = "ARG_DIRECTORY_LOCAL"; Loading
app/src/main/java/app/fedilab/android/mastodon/helper/PinnedTimelineHelper.java +6 −1 Original line number Diff line number Diff line Loading @@ -370,7 +370,9 @@ public class PinnedTimelineHelper { case MASTODON: tabCustomViewBinding.icon.setImageResource(R.drawable.mastodon_icon_item); break; case LEMMY: tabCustomViewBinding.icon.setImageResource(R.drawable.lemmy); break; case MISSKEY: tabCustomViewBinding.icon.setImageResource(R.drawable.misskey); break; Loading Loading @@ -461,6 +463,9 @@ public class PinnedTimelineHelper { case MISSKEY: item.setIcon(R.drawable.misskey); break; case LEMMY: item.setIcon(R.drawable.lemmy); break; case PIXELFED: item.setIcon(R.drawable.pixelfed); break; Loading