Skip to content

Commit a477b05

Browse files
authored
Merge pull request android#401 from GuoTianqi/dev-todo-mvp-kotlin
[Dev todo mvp kotlin] Use more extension functions
2 parents 010ea33 + 195190d commit a477b05

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

todoapp/app/src/androidTest/java/com/example/android/architecture/blueprints/todoapp/tasks/TasksScreenTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ import org.junit.runner.RunWith
9898
* @return Matcher that matches text in the given view
9999
*/
100100
private fun withItemText(itemText: String): Matcher<View> {
101-
checkArgument(!TextUtils.isEmpty(itemText), "itemText cannot be null or empty")
101+
checkArgument(itemText.isNotEmpty(), "itemText cannot be null or empty")
102102
return object : TypeSafeMatcher<View>() {
103103
public override fun matchesSafely(item: View): Boolean {
104104
return allOf(

todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/tasks/ScrollChildSwipeRefreshLayout.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ class ScrollChildSwipeRefreshLayout @JvmOverloads constructor(context: Context,
3535

3636
var scrollUpChild: View? = null
3737

38-
override fun canChildScrollUp(): Boolean {
39-
if (scrollUpChild != null) {
40-
return ViewCompat.canScrollVertically(scrollUpChild, -1)
41-
}
42-
return super.canChildScrollUp()
43-
}
38+
override fun canChildScrollUp() =
39+
scrollUpChild?.canScrollVertically(-1) ?: super.canChildScrollUp()
4440
}

0 commit comments

Comments
 (0)