Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

onSaveInstanceState don't save the state of ExpansionLayout #67

Open
yura-f opened this issue Jul 4, 2020 · 1 comment
Open

onSaveInstanceState don't save the state of ExpansionLayout #67

yura-f opened this issue Jul 4, 2020 · 1 comment

Comments

@yura-f
Copy link

yura-f commented Jul 4, 2020

I've set "id" for the ExpansionHeader and ExpansionLayout and expanded(opened) my item, but after return on fragment I get closed item with right state of "headerIndicator".

Why and how fix it?

The right behavior is the item should be open after return.
Thx

@florent37
After debugging, I've caught a break point into setHeight (ExpansionLayout) and height always equals 0!

My XML is:

<androidx.constraintlayout.widget.ConstraintLayout
    android:id="@+id/mainContainer"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <androidx.core.widget.NestedScrollView
        android:id="@+id/nestedScrollView"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:orientation="vertical"
        android:windowSoftInputMode="adjustResize"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintBottom_toTopOf="@+id/applyBtn">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <com.github.florent37.expansionpanel.viewgroup.ExpansionsViewGroupLinearLayout
                android:id="@+id/expansionsViewGroupLinearLayout"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_marginTop="24dp"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent">

                <com.github.florent37.expansionpanel.ExpansionHeader
                    android:id="@+id/priceExpansionHeader"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:expansion_layout="@id/rangePriceExpansion"
                    app:expansion_headerIndicator="@id/arrow"
                    app:expansion_headerIndicatorRotationExpanded="0"
                    app:expansion_headerIndicatorRotationCollapsed="-90"
                    app:expansion_toggleOnClick="true">

                    <com.app.ui.widgets.RangeHeaderLayout
                        android:id="@+id/priceRangeHeader"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        app:title="@string/price"
                        app:subtitle="@string/from_num_to_num"/>

                </com.github.florent37.expansionpanel.ExpansionHeader>

                <com.github.florent37.expansionpanel.ExpansionLayout
                    android:id="@+id/rangePriceExpansion"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/white">

                    <com.jaygoo.widget.RangeSeekBar
                        android:id="@+id/rangePrice"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:padding="16dp"
                        app:rsb_gravity="center"
                        app:rsb_mode="range"
                        app:rsb_indicator_show_mode="alwaysHide"
                        app:rsb_progress_color="@color/black50"
                        app:rsb_progress_default_color="@color/divider"
                        app:rsb_progress_height="2dp" />

                </com.github.florent37.expansionpanel.ExpansionLayout>
@yura-f
Copy link
Author

yura-f commented Jul 5, 2020

@florent37
Also, if U expanded anyone item then the method:
private void setHeight(float height) {...} (ExpansionLayout)
is calling on the infinity loop.

I think it's a strange behavior.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant