Make toolbar scroll away in home timeline (AND-208)
This commit is contained in:
parent
6a18d8ef03
commit
f80e3771d1
|
@ -61,6 +61,7 @@ import org.joinmastodon.android.ui.utils.DiscoverInfoBannerHelper;
|
|||
import org.joinmastodon.android.ui.viewcontrollers.HomeTimelineMenuController;
|
||||
import org.joinmastodon.android.ui.viewcontrollers.ToolbarDropdownMenuController;
|
||||
import org.joinmastodon.android.ui.views.FixedAspectRatioImageView;
|
||||
import org.joinmastodon.android.ui.views.NestedRecyclerScrollView;
|
||||
import org.joinmastodon.android.ui.views.NewPostsButtonContainer;
|
||||
import org.joinmastodon.android.updater.GithubSelfUpdater;
|
||||
import org.parceler.Parcels;
|
||||
|
@ -109,6 +110,7 @@ public class HomeTimelineFragment extends StatusListFragment implements ToolbarD
|
|||
private BottomSheet donationSheet;
|
||||
|
||||
public HomeTimelineFragment(){
|
||||
setLayout(R.layout.fragment_loader_hiding_toolbar);
|
||||
setListLayoutId(R.layout.fragment_timeline);
|
||||
}
|
||||
|
||||
|
@ -279,6 +281,21 @@ public class HomeTimelineFragment extends StatusListFragment implements ToolbarD
|
|||
}
|
||||
}
|
||||
});
|
||||
View bottomOverlays=view.findViewById(R.id.bottom_overlays);
|
||||
NestedRecyclerScrollView scroller=view.findViewById(R.id.scroller);
|
||||
scroller.setScrollableChildSupplier(()->list);
|
||||
scroller.setTakePriorityOverChildViews(true);
|
||||
scroller.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY)->{
|
||||
bottomOverlays.setTranslationY(scrollY-getToolbar().getHeight());
|
||||
});
|
||||
scroller.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener(){
|
||||
@Override
|
||||
public boolean onPreDraw(){
|
||||
scroller.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
bottomOverlays.setTranslationY(scroller.getScrollY()-getToolbar().getHeight());
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if(GithubSelfUpdater.needSelfUpdating()){
|
||||
updateUpdateState(GithubSelfUpdater.getInstance().getState());
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<me.grishka.appkit.views.FragmentRootLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/appkit_loader_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:windowBackground"
|
||||
android:orientation="vertical">
|
||||
|
||||
<org.joinmastodon.android.ui.views.NestedRecyclerScrollView
|
||||
android:id="@+id/scroller"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<org.joinmastodon.android.ui.views.TopBarsScrollAwayLinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/appkit_toolbar" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/appkit_loader_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include
|
||||
android:id="@+id/loading"
|
||||
layout="@layout/loading" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/error"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout="?errorViewLayout"
|
||||
android:visibility="gone" />
|
||||
|
||||
<View
|
||||
android:id="@+id/content_stub"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</FrameLayout>
|
||||
</org.joinmastodon.android.ui.views.TopBarsScrollAwayLinearLayout>
|
||||
</org.joinmastodon.android.ui.views.NestedRecyclerScrollView>
|
||||
</me.grishka.appkit.views.FragmentRootLinearLayout>
|
|
@ -20,19 +20,31 @@
|
|||
android:layout_height="match_parent"
|
||||
android:id="@+id/empty"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@drawable/bg_fab"
|
||||
android:tint="?colorM3Primary"
|
||||
android:scaleType="center"
|
||||
android:stateListAnimator="@animator/fab_shadow"
|
||||
android:contentDescription="@string/new_post"
|
||||
android:src="@drawable/ic_edit_24px"/>
|
||||
<FrameLayout
|
||||
android:id="@+id/bottom_overlays"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ImageButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@drawable/bg_fab"
|
||||
android:tint="?colorM3Primary"
|
||||
android:scaleType="center"
|
||||
android:stateListAnimator="@animator/fab_shadow"
|
||||
android:contentDescription="@string/new_post"
|
||||
android:src="@drawable/ic_edit_24px"/>
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/donation_banner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout="@layout/donation_banner"/>
|
||||
</FrameLayout>
|
||||
|
||||
<org.joinmastodon.android.ui.views.NewPostsButtonContainer
|
||||
android:id="@+id/new_posts_btn_wrap"
|
||||
|
@ -58,12 +70,5 @@
|
|||
android:text="@string/see_new_posts"/>
|
||||
</org.joinmastodon.android.ui.views.NewPostsButtonContainer>
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/donation_banner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout="@layout/donation_banner"/>
|
||||
|
||||
</FrameLayout>
|
||||
</me.grishka.appkit.views.RecursiveSwipeRefreshLayout>
|
Loading…
Reference in New Issue