ݺߣ

ݺߣShare a Scribd company logo
Android Makers
1
Talks
● Offline UX
● Window
● Pull Requests
● Styles and Themes
● Puzzlers
● Navigation Component
● Koin
● UI Tests with Kotlin DSL
2
Offline UX
11
3
Offline UX
11
4
● Offline by default
● Online is the icing on the cake
Window
12
5
Window
12
6
Debug layout on device
View Zeplin-like measures
Pull Requests
13
7
Pull Requests
13
8
● Draft
● Template
Styles and themes
14
9
Styles and themes
14
View
Style
Default style
Theme
Text Appearance
10
Puzzlers
15
11
Lifecycle
15
12
Et si, dans le onCreate, on fait un finish() ?
Fragments lifecycle
15
13
Fragments lifecycle
Locale resolution
15
14
Default is always english
Locale resolution
Navigation Component
16
15
Navigation component
16
16
● Navigation Graph
● Pass data during navigation
● Manage animations
● Manage deeplinking
● Manage back-stack
Koin
17
17
Koin
17
18
simple DSL : module, single, factory, get
Modules declaration
utilisation: KoinComponent, get, inject
Koin class
UI Tests
Kotlin DSL
18
19
UI Tests with kotlin DSL
18
20
@RunWith(AndroidJUnit4::class)
class PaymentScreenTest {
@JvmField @Rule val runner =
ActivityTestRule<PaymentActivity>(
PaymentActivity::class.java, true, false
)
@Test fun test() {
// setup
stubFor(get(…)).willReturn(
aResponse()
.withStatus(200)
.withHeader("Content-Type", "application/json")
.withBody(…)
)
val activity = runner.launchActivity(
PaymentScreenFactory(appContext).makeLaunchIntent()
)
val list = activity.findViewById(R.id.breakdown)
IdlingRegistry.getInstance()
.register(RecyclerViewScrollingIdlingResource(list))
// run
onView(R.id.pay_now_button).click()
// verify
val container = isDescendantOfA(withId(R.id.confirmation))
onView(allOf(container, withId(R.id.destination)))
.check(matches(withText("Paris")))
val price = appResources.getString(R.string.price_format,
50.7)
onView(allOf(container, withId(R.id.total_price)))
.check(matches(withText(price)))
}
}
class PaymentScreenTest {
@Test fun test() = gwen {
given {
server stubs { get(…) with json(…) }
user launches { paymentScreen() }
}
whenever {
user selects { payNow() }
}
then {
user sees {
confirmation {
destination = "Paris"
totalPrice = 50.7
}
}
}
}
}
APPSTUD
Questions
21

More Related Content

Android makers