Skip to content

Commit

Permalink
Merge pull request #98 from natura-cosmeticos/DSY-1051-create-expanda…
Browse files Browse the repository at this point in the history
…ble-card-view

[DSY-1051] fix expansion panel collapsed size error happening on andr…
  • Loading branch information
mlcsouza authored Jul 7, 2020
2 parents d6eecbe + 0751d6f commit 9a2e41f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import android.util.AttributeSet
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.constraintlayout.widget.ConstraintLayout
import com.google.android.material.card.MaterialCardView
import com.natura.android.R

@SuppressLint("CustomViewStyleable")
Expand All @@ -17,7 +17,7 @@ class ExpansionPanel @JvmOverloads constructor(
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {

private val container by lazy { findViewById<MaterialCardView>(R.id.ds_expansion_panel_container) }
private val container by lazy { findViewById<CardView>(R.id.ds_expansion_panel_container) }
private val icon by lazy { findViewById<ImageView>(R.id.ds_expansion_panel_icon) }
private val contentArea by lazy { findViewById<ConstraintLayout>(R.id.ds_expansion_panel_content_area) }
private val title by lazy { findViewById<TextView>(R.id.ds_expansion_panel_title) }
Expand Down
6 changes: 3 additions & 3 deletions designsystem/src/main/res/layout/ds_expansion_panel.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
<androidx.cardview.widget.CardView
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"
Expand All @@ -8,7 +8,7 @@
android:layout_height="wrap_content"
android:background="@drawable/ds_expansion_panel_border_collapsed"
android:animateLayoutChanges="true"
android:layout_margin="?elevation02"
android:layout_margin="?spacingMicro"
app:cardElevation="?elevation01"
app:rippleColor="@android:color/transparent"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down Expand Up @@ -83,5 +83,5 @@

</LinearLayout>

</com.google.android.material.card.MaterialCardView>
</androidx.cardview.widget.CardView>

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.android.material.card.MaterialCardView
import com.google.common.truth.Truth
import com.natura.android.R
import org.junit.Before
Expand Down Expand Up @@ -48,7 +47,7 @@ class ExpansionPanelTest {
fun borderlessWhenCollapsed() {
val expectedBackground = ContextCompat.getDrawable(activityController.get(), R.drawable.ds_expansion_panel_border_collapsed)

val container = expansionPanel.findViewById(R.id.ds_expansion_panel_container) as MaterialCardView
val container = expansionPanel.findViewById(R.id.ds_expansion_panel_container) as View

container.callOnClick()
container.callOnClick()
Expand Down

0 comments on commit 9a2e41f

Please sign in to comment.