ExpandableLayout icon indicating copy to clipboard operation
ExpandableLayout copied to clipboard

Spinner icon color only changes one time programmatically

Open MohamedEmish opened this issue 3 years ago • 1 comments

Please complete the following information:

  • Library-Version: v1.0.7
  • Affected Device(s) Google Pixel3 with Android 12 and Huawei Android 8

Describe the Bug:

For the expansion spinner icon, I set its color from the XML file to be gray

<com.skydoves.expandablelayout.ExpandableLayout android:id="@+id/requestFailedExpandLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/_12sdp" android:layout_marginEnd="@dimen/_12sdp" app:expandable_duration="300" app:expandable_isExpanded="false" app:expandable_parentLayout="@layout/request_failed_header_layout" app:expandable_secondLayout="@layout/request_failed_body_layout" app:expandable_showSpinner="true" app:expandable_spinner_animate="true" app:expandable_spinner_color="@color/gray_8b8b8b" />

then I added a listener on the layout when it's expanded the icon should be blue else should be gray

setOnExpandListener { if (isExpanding) { parentLayout.backgroundTintList = ContextCompat.getColorStateList(requireContext(), R.color.blue_daebfd) spinnerColor = R.color.colorPrimary parentLayout.findViewById<MaterialTextView>(R.id.tvRecommendationExpandTitle).setTextColor(ContextCompat.getColor(requireContext(), R.color.colorPrimary)) } else { parentLayout.backgroundTintList = ContextCompat.getColorStateList(requireContext(), R.color.gray_c7c7c7) spinnerColor = R.color.gray_8b8b8b parentLayout.findViewById<MaterialTextView>(R.id.tvRecommendationExpandTitle).setTextColor(ContextCompat.getColor(requireContext(), R.color.gray_8b8b8b)) } }

but after one single change, the color never changes again.

Expected Behavior:

the spinner icon color to be always changeable

MohamedEmish avatar Feb 06 '22 05:02 MohamedEmish

I fixed that using this line to set the spinner icon color and it worked ((getChildAt(0) as FrameLayout)[1] as ImageView).imageTintList = ContextCompat.getColorStateList(requireContext(), R.color.gray_8b8b8b)

MohamedEmish avatar Feb 06 '22 05:02 MohamedEmish