prolificinteractive / material-calendarview

A Material design back port of Android's CalendarView
https://prolificinteractive.github.io/material-calendarview/
MIT License
5.92k stars 1.32k forks source link

Implement collapsing behaviour && How to hide DAY View #945

Open naina17591 opened 5 years ago

naina17591 commented 5 years ago

I want to implement collapsing feature. As far as i have tried it in so many ways:

-- Add MaterialCalendarView inside CollapsingToolbarLayout, setting its collapseMode "pin", and convert calendarMode form MONTH to WEEK according to the offset.

<android.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        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.support.design.widget.CollapsingToolbarLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layout_scrollFlags="scroll|exitUntilCollapsed">

                <android.support.v7.widget.Toolbar
                    android:layout_width="match_parent"
                    android:layout_height="72dp"
                    android:background="@android:color/transparent"
                    app:contentInsetStart="0dp"
                    app:layout_collapseMode="pin">

                    <View
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="@android:color/transparent" />

                </android.support.v7.widget.Toolbar>

                <com.prolificinteractive.materialcalendarview.MaterialCalendarView
                    android:id="@+id/calendarView"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_collapseMode="pin"
                    app:mcv_allowClickDaysOutsideCurrentMonth="false"
                    app:mcv_tileHeight="36dp" />

            </android.support.design.widget.CollapsingToolbarLayout>

        </android.support.design.widget.AppBarLayout>

        <android.support.v4.widget.NestedScrollView
            android:id="@+id/nested_scroll_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbars="none"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:orientation="vertical">

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/recycler_occasions"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:focusable="false" />

                <TextView
                    android:id="@+id/txt_login"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginStart="@dimen/dp_50"
                    android:layout_marginTop="@dimen/dp_30"
                    android:layout_marginEnd="@dimen/dp_50"
                    android:layout_marginBottom="@dimen/dp_20"
                    android:background="@drawable/btn_gradient_bg"
                    android:fontFamily="@font/poppins_semibold"
                    android:gravity="center"
                    android:padding="@dimen/dp_16"
                    android:text="@string/next"
                    android:textAllCaps="true"
                    android:textColor="@color/white"
                    android:textSize="@dimen/btn_text_size" />
            </LinearLayout>

        </android.support.v4.widget.NestedScrollView>
    </android.support.design.widget.CoordinatorLayout>

But while scrolling it starts hiding from top and then converts to WEEK. I want the DAY view to be fixed.

For that, i want to add this library as a module in my project so that i can hide the DAY view (Sun, Mon, etc..) and implement custom view and make it fixed. But that gives me error : unable to find some plugins.

NOTE: I have toolbar and custom topBar above the CoordinatorLayout. So, i have used MaterialCalendarView - setTobBarVisible(false).

Or any other way, please suggest.

Please help me out with this.

Cadark commented 5 years ago

I also have the same problem with you, MaterialCalendarView innvisible when i change mode between MONTHS, WEEKS in MotionLayout

tejaschavan21 commented 5 years ago

Hi @naina17591 even I'm trying to achieve collapsing feature, were you able to achieve the same? If so can you help me sharing the details how to achieve the same.