Merge pull request #124 from FineFindus/feat/tab-double-tab
Feat: Add tab triple click action
This commit is contained in:
commit
14665c9a24
|
@ -631,6 +631,11 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
|||
smoothScrollRecyclerViewToTop(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
protected int getListWidthForMediaLayout(){
|
||||
return list.getWidth();
|
||||
}
|
||||
|
|
|
@ -237,6 +237,11 @@ public class EditTimelinesFragment extends BaseRecyclerFragment<TimelineDefiniti
|
|||
smoothScrollRecyclerViewToTop(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
|
|
@ -149,6 +149,11 @@ public class FollowRequestsListFragment extends BaseRecyclerFragment<FollowReque
|
|||
smoothScrollRecyclerViewToTop(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
private class AccountsAdapter extends UsableRecyclerView.Adapter<AccountViewHolder> implements ImageLoaderRecyclerAdapter{
|
||||
|
||||
public AccountsAdapter(){
|
||||
|
|
|
@ -76,6 +76,11 @@ public class FollowedHashtagsFragment extends BaseRecyclerFragment<Hashtag> impl
|
|||
smoothScrollRecyclerViewToTop(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
private class HashtagsAdapter extends RecyclerView.Adapter<HashtagViewHolder>{
|
||||
@NonNull
|
||||
@Override
|
||||
|
|
|
@ -477,9 +477,19 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
|||
|
||||
@Override
|
||||
public void scrollToTop(){
|
||||
if (((ScrollableToTop) fragments[pager.getCurrentItem()]).isScrolledToTop()) {
|
||||
int nextPage = (pager.getCurrentItem() + 1) % count;
|
||||
navigateTo(nextPage);
|
||||
return;
|
||||
}
|
||||
((ScrollableToTop) fragments[pager.getCurrentItem()]).scrollToTop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return ((ScrollableToTop) fragments[pager.getCurrentItem()]).isScrolledToTop();
|
||||
}
|
||||
|
||||
public void hideNewPostsButton(){
|
||||
if(!newPostsBtnShown)
|
||||
return;
|
||||
|
|
|
@ -200,6 +200,11 @@ public class ListTimelinesFragment extends BaseRecyclerFragment<ListTimeline> im
|
|||
smoothScrollRecyclerViewToTop(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
private class ListsAdapter extends RecyclerView.Adapter<ListViewHolder>{
|
||||
@NonNull
|
||||
@Override
|
||||
|
|
|
@ -202,9 +202,19 @@ public class NotificationsFragment extends MastodonToolbarFragment implements Sc
|
|||
|
||||
@Override
|
||||
public void scrollToTop(){
|
||||
if (getFragmentForPage(pager.getCurrentItem()).isScrolledToTop()) {
|
||||
int nextPage = (pager.getCurrentItem() + 1) % tabViews.length;
|
||||
pager.setCurrentItem(nextPage, true);
|
||||
return;
|
||||
}
|
||||
getFragmentForPage(pager.getCurrentItem()).scrollToTop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return getFragmentForPage(pager.getCurrentItem()).isScrolledToTop();
|
||||
}
|
||||
|
||||
public void loadData(){
|
||||
refreshFollowRequestsBadge();
|
||||
if(allNotificationsFragment!=null && !allNotificationsFragment.loaded && !allNotificationsFragment.dataLoading)
|
||||
|
|
|
@ -1229,6 +1229,11 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
|||
scrollView.smoothScrollTo(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
private void onFollowersOrFollowingClick(View v){
|
||||
Bundle args=new Bundle();
|
||||
args.putString("account", accountID);
|
||||
|
|
|
@ -6,6 +6,8 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import me.grishka.appkit.utils.V;
|
||||
|
||||
public interface ScrollableToTop{
|
||||
boolean isScrolledToTop();
|
||||
|
||||
void scrollToTop();
|
||||
|
||||
/**
|
||||
|
|
|
@ -146,6 +146,11 @@ public class DiscoverAccountsFragment extends BaseRecyclerFragment<DiscoverAccou
|
|||
smoothScrollRecyclerViewToTop(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnTop() {
|
||||
return isRecyclerViewOnTop(list);
|
||||
|
|
|
@ -302,6 +302,15 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop,
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
if(!searchActive){
|
||||
return ((ScrollableToTop)getFragmentForPage(pager.getCurrentItem())).isScrolledToTop();
|
||||
}else{
|
||||
return searchFragment.isScrolledToTop();
|
||||
}
|
||||
}
|
||||
|
||||
public void loadData(){
|
||||
if(hashtagsFragment!=null && !hashtagsFragment.loaded && !hashtagsFragment.dataLoading)
|
||||
hashtagsFragment.loadData();
|
||||
|
|
|
@ -89,6 +89,11 @@ public class DiscoverNewsFragment extends BaseRecyclerFragment<Card> implements
|
|||
smoothScrollRecyclerViewToTop(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnTop() {
|
||||
return isRecyclerViewOnTop(list);
|
||||
|
|
|
@ -74,6 +74,11 @@ public class TrendingHashtagsFragment extends BaseRecyclerFragment<Hashtag> impl
|
|||
smoothScrollRecyclerViewToTop(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isScrolledToTop() {
|
||||
return list.getChildAt(0).getTop() == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOnTop() {
|
||||
return isRecyclerViewOnTop(list);
|
||||
|
|
Loading…
Reference in New Issue