hide fab in notifications
This commit is contained in:
parent
addf7de316
commit
a683c2cb11
|
@ -45,7 +45,6 @@ import org.joinmastodon.android.ui.photoviewer.PhotoViewer;
|
|||
import org.joinmastodon.android.ui.photoviewer.PhotoViewerHost;
|
||||
import org.joinmastodon.android.ui.utils.MediaAttachmentViewController;
|
||||
import org.joinmastodon.android.ui.utils.UiUtils;
|
||||
import org.joinmastodon.android.ui.views.MediaGridLayout;
|
||||
import org.joinmastodon.android.utils.TypedObjectPool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -80,14 +79,13 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
|||
protected HashMap<String, Relationship> relationships=new HashMap<>();
|
||||
protected Rect tmpRect=new Rect();
|
||||
protected TypedObjectPool<MediaGridStatusDisplayItem.GridItemType, MediaAttachmentViewController> attachmentViewsPool=new TypedObjectPool<>(this::makeNewMediaAttachmentView);
|
||||
protected boolean fabDisabled;
|
||||
|
||||
public BaseStatusListFragment(){
|
||||
super(20);
|
||||
if (withComposeButton()) setListLayoutId(R.layout.recycler_fragment_with_fab);
|
||||
if (wantsComposeButton()) setListLayoutId(R.layout.recycler_fragment_with_fab);
|
||||
}
|
||||
|
||||
protected boolean withComposeButton() {
|
||||
protected boolean wantsComposeButton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -271,7 +269,7 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
|||
}
|
||||
|
||||
public @Nullable View getFab() {
|
||||
if (getParentFragment() instanceof HomeTabFragment home) return home.getFab();
|
||||
if (getParentFragment() instanceof HasFab l) return l.getFab();
|
||||
else return fab;
|
||||
}
|
||||
|
||||
|
@ -304,7 +302,6 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
|||
public void onViewCreated(View view, Bundle savedInstanceState){
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
fab=view.findViewById(R.id.fab);
|
||||
fabDisabled = getArguments().getBoolean("__is_tab", false);
|
||||
|
||||
list.addOnScrollListener(new RecyclerView.OnScrollListener(){
|
||||
@Override
|
||||
|
@ -361,7 +358,7 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
|||
((UsableRecyclerView) list).setIncludeMarginsInItemHitbox(true);
|
||||
updateToolbar();
|
||||
|
||||
if (withComposeButton() && !fabDisabled) {
|
||||
if (wantsComposeButton() && !getArguments().getBoolean("__disable_fab", false)) {
|
||||
fab.setVisibility(View.VISIBLE);
|
||||
fab.setOnClickListener(this::onFabClick);
|
||||
fab.setOnLongClickListener(this::onFabLongClick);
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package org.joinmastodon.android.fragments;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public interface HasFab {
|
||||
View getFab();
|
||||
}
|
|
@ -39,7 +39,7 @@ public class HashtagTimelineFragment extends PinnableStatusListFragment {
|
|||
private MenuItem followButton;
|
||||
|
||||
@Override
|
||||
protected boolean withComposeButton() {
|
||||
protected boolean wantsComposeButton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ import me.grishka.appkit.fragments.OnBackPressedListener;
|
|||
import me.grishka.appkit.utils.CubicBezierInterpolator;
|
||||
import me.grishka.appkit.utils.V;
|
||||
|
||||
public class HomeTabFragment extends MastodonToolbarFragment implements ScrollableToTop, OnBackPressedListener {
|
||||
public class HomeTabFragment extends MastodonToolbarFragment implements ScrollableToTop, OnBackPressedListener, HasFab {
|
||||
private static final int ANNOUNCEMENTS_RESULT = 654;
|
||||
|
||||
private String accountID;
|
||||
|
@ -135,6 +135,7 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
|||
Bundle args = new Bundle();
|
||||
args.putString("account", accountID);
|
||||
args.putBoolean("__is_tab", true);
|
||||
args.putBoolean("__disable_fab", true);
|
||||
args.putBoolean("onlyPosts", true);
|
||||
|
||||
for (int i = 0; i < timelineDefinitions.size(); i++) {
|
||||
|
|
|
@ -38,7 +38,7 @@ public class HomeTimelineFragment extends StatusListFragment {
|
|||
private String lastSavedMarkerID;
|
||||
|
||||
@Override
|
||||
protected boolean withComposeButton() {
|
||||
protected boolean wantsComposeButton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ListTimelineFragment extends PinnableStatusListFragment {
|
|||
private ListTimeline.RepliesPolicy repliesPolicy;
|
||||
|
||||
@Override
|
||||
protected boolean withComposeButton() {
|
||||
protected boolean wantsComposeButton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ public class NotificationsListFragment extends BaseStatusListFragment<Notificati
|
|||
private final DiscoverInfoBannerHelper bannerHelper = new DiscoverInfoBannerHelper(DiscoverInfoBannerHelper.BannerType.POST_NOTIFICATIONS);
|
||||
|
||||
@Override
|
||||
protected boolean withComposeButton() {
|
||||
return true;
|
||||
protected boolean wantsComposeButton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -206,7 +206,6 @@ public class NotificationsListFragment extends BaseStatusListFragment<Notificati
|
|||
public void onViewCreated(View view, Bundle savedInstanceState){
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
list.addItemDecoration(new InsetStatusItemDecoration(this));
|
||||
if (getParentFragment() instanceof NotificationsFragment) fab.setVisibility(View.GONE);
|
||||
if (onlyPosts) bannerHelper.maybeAddBanner(contentWrap);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public class ScheduledStatusListFragment extends BaseStatusListFragment<Schedule
|
|||
private static final int SCHEDULED_STATUS_LIST_OPENED = 161;
|
||||
|
||||
@Override
|
||||
protected boolean withComposeButton() {
|
||||
protected boolean wantsComposeButton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public class FederatedTimelineFragment extends StatusListFragment {
|
|||
private String maxID;
|
||||
|
||||
@Override
|
||||
protected boolean withComposeButton() {
|
||||
protected boolean wantsComposeButton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class LocalTimelineFragment extends StatusListFragment {
|
|||
private String maxID;
|
||||
|
||||
@Override
|
||||
protected boolean withComposeButton() {
|
||||
protected boolean wantsComposeButton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue