This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
forked from mastodon/mastodon-android
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add federation tab and change tab order
- Loading branch information
Showing
5 changed files
with
74 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
.../src/main/java/org/joinmastodon/android/fragments/discover/FederatedTimelineFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.joinmastodon.android.fragments.discover; | ||
|
||
import android.os.Bundle; | ||
import android.view.View; | ||
|
||
import org.joinmastodon.android.api.requests.timelines.GetPublicTimeline; | ||
import org.joinmastodon.android.fragments.StatusListFragment; | ||
import org.joinmastodon.android.model.Filter; | ||
import org.joinmastodon.android.model.Status; | ||
import org.joinmastodon.android.ui.utils.DiscoverInfoBannerHelper; | ||
import org.joinmastodon.android.utils.StatusFilterPredicate; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import me.grishka.appkit.api.SimpleCallback; | ||
|
||
public class FederatedTimelineFragment extends StatusListFragment{ | ||
private DiscoverInfoBannerHelper bannerHelper=new DiscoverInfoBannerHelper(DiscoverInfoBannerHelper.BannerType.FEDERATED_TIMELINE); | ||
private String maxID; | ||
|
||
@Override | ||
protected void doLoadData(int offset, int count){ | ||
currentRequest=new GetPublicTimeline(false, false, refreshing ? null : maxID, count) | ||
.setCallback(new SimpleCallback<>(this){ | ||
@Override | ||
public void onSuccess(List<Status> result){ | ||
if(!result.isEmpty()) | ||
maxID=result.get(result.size()-1).id; | ||
onDataLoaded(result.stream().filter(new StatusFilterPredicate(accountID, Filter.FilterContext.PUBLIC)).collect(Collectors.toList()), !result.isEmpty()); | ||
} | ||
}) | ||
.exec(accountID); | ||
} | ||
|
||
@Override | ||
public void onViewCreated(View view, Bundle savedInstanceState){ | ||
super.onViewCreated(view, savedInstanceState); | ||
bannerHelper.maybeAddBanner(contentWrap); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters