smooth-app-bar-layout
smooth-app-bar-layout copied to clipboard
Initiate vertical viewpager scroll using tabstrip as well
Using appbar layout user can initiate vertical scroll through tabstrip but in smooth-app-bar this might be overridden by some other functionality
can you please help to get that one also working
Can you post your sample code here using original AppBarLayout?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme"
app:layout_behavior="com.crewkarma.common.util.FlingBehavior">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="?attr/colorPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<include
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/test"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:id="@+id/header_view"/>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin"
android:background="#4b727272">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginRight="16dp"
android:layout_alignParentEnd="true"
android:layout_gravity="right"
android:gravity="center_vertical"
android:id="@+id/connection_status">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:src="@drawable/message_new"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/img_message_user"
android:visibility="gone"
android:paddingEnd="10dp"
android:paddingStart="10dp" />
<ImageView
android:src="@drawable/connect_new"
android:id="@+id/img_connect_user"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:paddingEnd="10dp"
android:paddingStart="10dp" />
<ImageView
android:layout_alignParentEnd="true"
android:src="@drawable/people_2"
android:id="@+id/img_connection_req_sent"
android:layout_width="65dp"
android:layout_height="65dp"
android:visibility="gone"
android:paddingStart="10dp"
android:paddingEnd="10dp" />
<ImageView
android:layout_alignParentEnd="true"
android:src="@drawable/connected_new"
android:id="@+id/img_connected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:paddingEnd="10dp"
android:paddingStart="10dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/img_reject"
android:src="@drawable/reject_new"
android:visibility="gone"
android:paddingEnd="10dp"
android:paddingStart="10dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/img_accept"
android:src="@drawable/accept_new"
android:visibility="gone"
android:paddingStart="10dp"
android:paddingEnd="10dp" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="right"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btn_share"
android:paddingEnd="16dp"
android:src="@drawable/ic_share_blue"
android:visibility="gone" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
<com.crewkarma.common.view.SlidingTabLayout
android:id="@+id/sliding_tabs"
android:theme="@style/ThemeOverlay.AppCompat.Light"
android:layout_height="wrap_content"
android:layout_width="match_parent"
app:tabIndicatorColor="@color/white"
app:tabGravity="fill"
android:background="@color/white" />
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
thanks for quick response you can use tabLayout instead of slidingTabLayout and you can remove app:layout_behavior from AppBarLayout
please tell me is it possible to fix this issue and also the issue with clickable item not being able to scrollable is not yet fixed , do you have any hack for this issue
thank you
Have you check this example? https://github.com/henrytao-me/smooth-app-bar-layout/blob/master/sample/src/main/res/layout/activity_smooth_view_pager_parallax_exit_util_collapsed.xml
yes i tried that example, in that If you try to initiate SmoothAppBarLayout vertical scroll starting from view inside TabLayout , your scroll well be neglected and absorbed by some other event
If you can send me a video or an apk to check, it's awesome.
I am sharing the drive like please check the videos
video with scrolling issue https://drive.google.com/open?id=0B50q6ZRb0iPaZ2ktTGpLZ3MyY0U
i am referring twitter for getting similar fill of profile page so the expected behavior is something as follows https://drive.google.com/open?id=0B50q6ZRb0iPabVpUVWFudUVIajg
thank you
I got what you mean. Looking into it now.
Hi @henrytao-me , did you get any solution for @nikhilreprime issue.. twitter like scrolling..?
Hi @anukools
I don't have any updates until now. Looking forward to Droidcon NYC next week. Chris Banes is going to have some cool stuffs there.
hi @henrytao-me , i am really in pinch because of this issue, can you give me some clue to pin point this issue No clickable element in collapsableToolBar initiates scroll action
i tried this solution on tabStrip in tabLayout but it is not complete and not initiating nested scroll
private class OnTouchListenerStrip implements OnTouchListener { int yOld = 0 , yNew = 0; boolean moved = false; @Override public boolean onTouch(View v, MotionEvent arg1) {
if (arg1.getAction() == MotionEvent.ACTION_DOWN) {
yOld = (int)arg1.getAxisValue(MotionEvent.AXIS_Y) ;
Log.d("Touch Action ",String.valueOf(arg1.getAction() + " scroll Old " + yOld));
moved = false ;
return true;
} else {
yNew = (int)arg1.getAxisValue(MotionEvent.AXIS_Y) ;
if(yOld !=yNew)
{
moved = true ;
}
if (arg1.getAction() == MotionEvent.ACTION_MOVE) {
int offset = yNew - yOld ;
Log.d("Touch Action ",String.valueOf(arg1.getAction() + "old "+yOld +" New "+yNew+" scroll new - old " + offset));
yOld = yNew ;
if(onViewScrollListener != null)
{
onViewScrollListener.onViewScrolled(offset);
}
return false;
}else if(arg1.getAction() == MotionEvent.ACTION_UP)
{
if(!moved) {
for (int i = 0; i < mTabStrip.getChildCount(); i++) {
if (v == mTabStrip.getChildAt(i)) {
mViewPager.setCurrentItem(i);
return false;
}
}
}
}
}
Log.d("Touch Action ","Something else");
return false;
}
}
and set the listener final OnTouchListener onTabTouchListener = new OnTouchListenerStrip(); tabView.setOnTouchListener(onTabTouchListener); thank you
implementation of onInterceptTouchEvent(CoordinatorLayout parent, V child, MotionEvent ev)
in HeaderBehavior is the place where action move action gets canceled
due to onInit() inside BaseBehavior is setting mDragCallbackListener
if (mDragCallbackListener == null) {
mDragCallbackListener = new DragCallback() {
@Override
public boolean canDrag(AppBarLayout appBarLayout) {
return false;
}
};
setDragCallback(mDragCallbackListener);
}
can you get this working
Hi @nikhilreprime
I understand your concern. I just back from Hollands. I will spend one day in weekend to investigate this issue. Try my best to come up with a solution.
I will keep you posted. Thanks.
Thank you very Much I really appreciate it On Oct 14, 2016 8:17 PM, "Henry Tao" [email protected] wrote:
Hi @nikhilreprime https://github.com/nikhilreprime
I understand your concern. I just back from Hollands. I will spend one day in weekend to investigate this issue. Try my best to come up with a solution.
I will keep you posted. Thanks.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/henrytao-me/smooth-app-bar-layout/issues/138#issuecomment-253821331, or mute the thread https://github.com/notifications/unsubscribe-auth/ANBvmOqShbFP1vVgUMBFfQmrSvRZAGfbks5qz5YKgaJpZM4J4sye .
Hi @nikhilreprime
I haven't had solution for this right now. It's tricky. Touching is still messed up. Sorry.
Thanks
I will also try to solve this one If you find the fix please let me know On Oct 18, 2016 6:15 PM, "Henry Tao" [email protected] wrote:
Hi @nikhilreprime https://github.com/nikhilreprime
I haven't had solution for this right now. It's tricky. Touching is still messed up. Sorry.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/henrytao-me/smooth-app-bar-layout/issues/138#issuecomment-254495792, or mute the thread https://github.com/notifications/unsubscribe-auth/ANBvmKF8gydOM3WAzNwu1wuNH-mYYARRks5q1L9SgaJpZM4J4sye .
hi @henrytao-me did you get time to look into this issue
Hi @nikhilreprime
Time is flying. I haven't had time for this issue yet. I am really sorry.