Skip to content

Commit 972d2e9

Browse files
committed
Fixed AppBarLayoutBackgroundColorMatcher
1 parent d2d3dcb commit 972d2e9

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

FlowCrypt/src/androidTest/java/com/flowcrypt/email/matchers/AppBarLayoutBackgroundColorMatcher.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*
22
* © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com
3-
* Contributors: DenBond7
3+
* Contributors: denbond7
44
*/
55

66
package com.flowcrypt.email.matchers
77

8-
import android.graphics.drawable.ColorDrawable
98
import android.view.View
109
import androidx.test.espresso.matcher.BoundedMatcher
1110
import com.google.android.material.appbar.AppBarLayout
11+
import com.google.android.material.shape.MaterialShapeDrawable
1212
import org.hamcrest.Description
1313

1414
/**
@@ -17,9 +17,11 @@ import org.hamcrest.Description
1717
class AppBarLayoutBackgroundColorMatcher(val color: Int) :
1818
BoundedMatcher<View, AppBarLayout>(AppBarLayout::class.java) {
1919
public override fun matchesSafely(appBarLayout: AppBarLayout): Boolean {
20-
return if (appBarLayout.background is ColorDrawable) {
21-
color == (appBarLayout.background as ColorDrawable).color
22-
} else false
20+
return if (appBarLayout.background is MaterialShapeDrawable) {
21+
(appBarLayout.background as MaterialShapeDrawable).fillColor?.defaultColor == color
22+
} else {
23+
false
24+
}
2325
}
2426

2527
override fun describeTo(description: Description) {

0 commit comments

Comments
 (0)