This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. (IMHO lepszy, brak odniesienia do View.VISIBLE/GONE w presenterze) | |
<layout xmlns:android="http://schemas.android.com/apk/res/android"> | |
<data> | |
<import type="android.view.View"/> | |
<variable name="user" type="com.example.UserModel"/> | |
<variable name="presenter" type="com.example.UserPresenter"/> | |
</data> | |
<TextView | |
android:layout_width="match_parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun withDrawable(@DrawableRes id: Int) = object : TypeSafeMatcher<View>() { | |
override fun describeTo(description: Description) { | |
description.appendText("ImageView with drawable same as drawable with id $id") | |
} | |
override fun matchesSafely(view: View): Boolean { | |
val context = view.context | |
val expectedDrawable = context.getDrawable(id) | |
return view is ImageView && ??? // what now? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun withDrawable(@DrawableRes id: Int) = object : TypeSafeMatcher<View>() { | |
override fun describeTo(description: Description) { | |
description.appendText("ImageView with drawable same as drawable with id $id") | |
} | |
override fun matchesSafely(view: View): Boolean { | |
val context = view.context | |
val expectedBitmap = context.getDrawable(id).toBitmap() | |
return view is ImageView && view.drawable.toBitmap().sameAs(expectedBitmap) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun withDrawable(@DrawableRes id: Int, @ColorRes tint: Int? = null, tintMode: PorterDuff.Mode = SRC_IN) = object : TypeSafeMatcher<View>() { | |
override fun describeTo(description: Description) { | |
description.appendText("ImageView with drawable same as drawable with id $id") | |
tint?.let { description.appendText(", tint color id: $tint, mode: $tintMode") } | |
} | |
override fun matchesSafely(view: View): Boolean { | |
val context = view.context | |
val tintColor = tint?.toColor(context) | |
val expectedBitmap = context.getDrawable(id).tinted(tintColor, tintMode).toBitmap() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun Int.toColor(context: Context) = ContextCompat.getColor(context, this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun Drawable.tinted(@ColorInt tintColor: Int? = null, tintMode: PorterDuff.Mode = SRC_IN) = | |
apply { | |
setTintList(tintColor?.toColorStateList()) | |
setTintMode(tintMode) | |
} | |
private fun Int.toColorStateList() = ColorStateList.valueOf(this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onView(icon) | |
.check(matches(isDisplayed())) | |
.check(matches(withDrawable(R.drawable.ic_message_black_48dp, tint = R.color.black_54))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun NavController.distinctNavigate(@IdRes resId: Int, args: Bundle? = null, navOptions: NavOptions? = null) { | |
if (currentDestination?.id != resId) { | |
navigate(resId, args, navOptions) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* com.google.firebase:firebase-core:16.0.6 | |
\-- com.google.firebase:firebase-measurement-connector-impl:17.0.4 | |
\-- com.google.firebase:firebase-analytics:16.0.6 | |
\-- com.google.android.gms:play-services-measurement-api:16.0.4 | |
\-- com.google.firebase:firebase-analytics-impl:16.2.4 | |
\-- com.google.firebase:firebase-iid:17.0.4 | |
\-- com.google.firebase:firebase-iid-interop:16.0.1 | |
\-- com.google.android.gms:play-services-base:16.0.1 | |
\-- com.google.android.gms:play-services-tasks:16.0.1 | |
\-- com.google.android.gms:play-services-basement:16.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyActivity : AppCompatActivity(R.layout.my_activity) | |
class MyFragmentActivity: FragmentActivity(R.layout.my_fragment_activity) | |
class MyFragment : Fragment(R.layout.my_fragment) |
OlderNewer