diff --git a/blueprint-async-coroutines/build.gradle b/blueprint-async-coroutines/build.gradle index 9512d67c..788bd5a1 100644 --- a/blueprint-async-coroutines/build.gradle +++ b/blueprint-async-coroutines/build.gradle @@ -5,6 +5,16 @@ plugins { id 'org.jetbrains.dokka' } +kotlin.explicitApi = 'strict' + +compileKotlin { + kotlinOptions { + freeCompilerArgs += [ + '-Xexplicit-api=strict', + ] + } +} + afterEvaluate { project -> project.tasks.dokka { outputDirectory = "$rootDir/docs/api" diff --git a/blueprint-async-coroutines/src/main/kotlin/reactivecircus/blueprint/async/coroutines/CoroutineDispatcherProvider.kt b/blueprint-async-coroutines/src/main/kotlin/reactivecircus/blueprint/async/coroutines/CoroutineDispatcherProvider.kt index b8f4b287..5b2eee8a 100644 --- a/blueprint-async-coroutines/src/main/kotlin/reactivecircus/blueprint/async/coroutines/CoroutineDispatcherProvider.kt +++ b/blueprint-async-coroutines/src/main/kotlin/reactivecircus/blueprint/async/coroutines/CoroutineDispatcherProvider.kt @@ -8,17 +8,17 @@ import kotlinx.coroutines.CoroutineDispatcher * on different threads, but they don't need to know about the underlying implementation. * A single-threaded version for example can be injected for testing. */ -class CoroutineDispatcherProvider( +public class CoroutineDispatcherProvider( /** * Dispatcher for IO-bound work */ - val io: CoroutineDispatcher, + public val io: CoroutineDispatcher, /** * Dispatcher for computational work */ - val computation: CoroutineDispatcher, + public val computation: CoroutineDispatcher, /** * Dispatcher for UI work */ - val ui: CoroutineDispatcher + public val ui: CoroutineDispatcher ) diff --git a/blueprint-async-rx2/build.gradle b/blueprint-async-rx2/build.gradle index 6ca9fe8b..7e4fff1c 100644 --- a/blueprint-async-rx2/build.gradle +++ b/blueprint-async-rx2/build.gradle @@ -5,6 +5,16 @@ plugins { id 'org.jetbrains.dokka' } +kotlin.explicitApi = 'strict' + +compileKotlin { + kotlinOptions { + freeCompilerArgs += [ + '-Xexplicit-api=strict', + ] + } +} + afterEvaluate { project -> project.tasks.dokka { outputDirectory = "$rootDir/docs/api" diff --git a/blueprint-async-rx2/src/main/kotlin/reactivecircus/blueprint/async/rx2/SchedulerProvider.kt b/blueprint-async-rx2/src/main/kotlin/reactivecircus/blueprint/async/rx2/SchedulerProvider.kt index 041a81a5..84098a62 100644 --- a/blueprint-async-rx2/src/main/kotlin/reactivecircus/blueprint/async/rx2/SchedulerProvider.kt +++ b/blueprint-async-rx2/src/main/kotlin/reactivecircus/blueprint/async/rx2/SchedulerProvider.kt @@ -8,17 +8,17 @@ import io.reactivex.Scheduler * on different threads, but they don't need to know about the underlying implementation. * A single-threaded version for example can be injected for testing. */ -class SchedulerProvider( +public class SchedulerProvider( /** * Scheduler for IO-bound work */ - val io: Scheduler, + public val io: Scheduler, /** * Scheduler for computational work */ - val computation: Scheduler, + public val computation: Scheduler, /** * Scheduler for UI work */ - val ui: Scheduler + public val ui: Scheduler ) diff --git a/blueprint-async-rx3/build.gradle b/blueprint-async-rx3/build.gradle index 390b4b9d..aee2ab12 100644 --- a/blueprint-async-rx3/build.gradle +++ b/blueprint-async-rx3/build.gradle @@ -5,6 +5,16 @@ plugins { id 'org.jetbrains.dokka' } +kotlin.explicitApi = 'strict' + +compileKotlin { + kotlinOptions { + freeCompilerArgs += [ + '-Xexplicit-api=strict', + ] + } +} + afterEvaluate { project -> project.tasks.dokka { outputDirectory = "$rootDir/docs/api" diff --git a/blueprint-async-rx3/src/main/kotlin/reactivecircus/blueprint/async/rx3/SchedulerProvider.kt b/blueprint-async-rx3/src/main/kotlin/reactivecircus/blueprint/async/rx3/SchedulerProvider.kt index 57046036..ba10a787 100644 --- a/blueprint-async-rx3/src/main/kotlin/reactivecircus/blueprint/async/rx3/SchedulerProvider.kt +++ b/blueprint-async-rx3/src/main/kotlin/reactivecircus/blueprint/async/rx3/SchedulerProvider.kt @@ -8,17 +8,17 @@ import io.reactivex.rxjava3.core.Scheduler * on different threads, but they don't need to know about the underlying implementation. * A single-threaded version for example can be injected for testing. */ -class SchedulerProvider( +public class SchedulerProvider( /** * Scheduler for IO-bound work */ - val io: Scheduler, + public val io: Scheduler, /** * Scheduler for computational work */ - val computation: Scheduler, + public val computation: Scheduler, /** * Scheduler for UI work */ - val ui: Scheduler + public val ui: Scheduler ) diff --git a/blueprint-interactor-common/build.gradle b/blueprint-interactor-common/build.gradle index dafad9cb..480dcc5c 100644 --- a/blueprint-interactor-common/build.gradle +++ b/blueprint-interactor-common/build.gradle @@ -5,6 +5,16 @@ plugins { id 'org.jetbrains.dokka' } +kotlin.explicitApi = 'strict' + +compileKotlin { + kotlinOptions { + freeCompilerArgs += [ + '-Xexplicit-api=strict', + ] + } +} + afterEvaluate { project -> project.tasks.dokka { outputDirectory = "$rootDir/docs/api" diff --git a/blueprint-interactor-common/src/main/kotlin/reactivecircus/blueprint/interactor/InteractorParams.kt b/blueprint-interactor-common/src/main/kotlin/reactivecircus/blueprint/interactor/InteractorParams.kt index 6c787184..f9a95c07 100644 --- a/blueprint-interactor-common/src/main/kotlin/reactivecircus/blueprint/interactor/InteractorParams.kt +++ b/blueprint-interactor-common/src/main/kotlin/reactivecircus/blueprint/interactor/InteractorParams.kt @@ -4,10 +4,10 @@ package reactivecircus.blueprint.interactor * Interface representing params to be passed in for each interactor. * Implement this for each interactor that requires specific params. */ -interface InteractorParams +public interface InteractorParams /** * A special [InteractorParams] representing empty params. * Use this when the interactor requires no params. */ -object EmptyParams : InteractorParams +public object EmptyParams : InteractorParams diff --git a/blueprint-interactor-coroutines/build.gradle b/blueprint-interactor-coroutines/build.gradle index 9b855fca..9d56444d 100644 --- a/blueprint-interactor-coroutines/build.gradle +++ b/blueprint-interactor-coroutines/build.gradle @@ -5,6 +5,16 @@ plugins { id 'org.jetbrains.dokka' } +kotlin.explicitApi = 'strict' + +compileKotlin { + kotlinOptions { + freeCompilerArgs += [ + '-Xexplicit-api=strict', + ] + } +} + afterEvaluate { project -> project.tasks.dokka { outputDirectory = "$rootDir/docs/api" diff --git a/blueprint-interactor-coroutines/src/main/kotlin/reactivecircus/blueprint/interactor/coroutines/FlowInteractor.kt b/blueprint-interactor-coroutines/src/main/kotlin/reactivecircus/blueprint/interactor/coroutines/FlowInteractor.kt index 6e50cbca..0bdeacf7 100644 --- a/blueprint-interactor-coroutines/src/main/kotlin/reactivecircus/blueprint/interactor/coroutines/FlowInteractor.kt +++ b/blueprint-interactor-coroutines/src/main/kotlin/reactivecircus/blueprint/interactor/coroutines/FlowInteractor.kt @@ -11,12 +11,12 @@ import reactivecircus.blueprint.interactor.InteractorParams * * Work will be executed on thread as specified by the [dispatcher] of the interactor. */ -abstract class FlowInteractor { +public abstract class FlowInteractor { /** * The coroutine context this interactor should execute on. */ - abstract val dispatcher: CoroutineDispatcher + public abstract val dispatcher: CoroutineDispatcher /** * Create a [Flow] for this interactor. @@ -26,5 +26,5 @@ abstract class FlowInteractor { /** * Build a new [Flow] from this interactor. */ - fun buildFlow(params: P): Flow = createFlow(params).flowOn(dispatcher) + public fun buildFlow(params: P): Flow = createFlow(params).flowOn(dispatcher) } diff --git a/blueprint-interactor-coroutines/src/main/kotlin/reactivecircus/blueprint/interactor/coroutines/SuspendingInteractor.kt b/blueprint-interactor-coroutines/src/main/kotlin/reactivecircus/blueprint/interactor/coroutines/SuspendingInteractor.kt index 98cce28e..b1cdf291 100644 --- a/blueprint-interactor-coroutines/src/main/kotlin/reactivecircus/blueprint/interactor/coroutines/SuspendingInteractor.kt +++ b/blueprint-interactor-coroutines/src/main/kotlin/reactivecircus/blueprint/interactor/coroutines/SuspendingInteractor.kt @@ -10,12 +10,12 @@ import reactivecircus.blueprint.interactor.InteractorParams * * Work will be executed on thread as specified by the [dispatcher] of the interactor. */ -abstract class SuspendingInteractor { +public abstract class SuspendingInteractor { /** * The coroutine context this interactor should execute on. */ - abstract val dispatcher: CoroutineDispatcher + public abstract val dispatcher: CoroutineDispatcher /** * Define the work to be performed by this interactor. @@ -25,7 +25,7 @@ abstract class SuspendingInteractor { /** * Execute the the interactor. */ - suspend fun execute(params: P): R = withContext(context = dispatcher) { + public suspend fun execute(params: P): R = withContext(context = dispatcher) { doWork(params) } } diff --git a/blueprint-interactor-rx2/build.gradle b/blueprint-interactor-rx2/build.gradle index b9b8fb2c..343a6ee3 100644 --- a/blueprint-interactor-rx2/build.gradle +++ b/blueprint-interactor-rx2/build.gradle @@ -5,6 +5,16 @@ plugins { id 'org.jetbrains.dokka' } +kotlin.explicitApi = 'strict' + +compileKotlin { + kotlinOptions { + freeCompilerArgs += [ + '-Xexplicit-api=strict', + ] + } +} + afterEvaluate { project -> project.tasks.dokka { outputDirectory = "$rootDir/docs/api" diff --git a/blueprint-interactor-rx2/src/main/kotlin/reactivecircus/blueprint/interactor/rx2/CompletableInteractor.kt b/blueprint-interactor-rx2/src/main/kotlin/reactivecircus/blueprint/interactor/rx2/CompletableInteractor.kt index 74185c2d..dd4b3722 100644 --- a/blueprint-interactor-rx2/src/main/kotlin/reactivecircus/blueprint/interactor/rx2/CompletableInteractor.kt +++ b/blueprint-interactor-rx2/src/main/kotlin/reactivecircus/blueprint/interactor/rx2/CompletableInteractor.kt @@ -10,7 +10,7 @@ import reactivecircus.blueprint.interactor.InteractorParams * Upon subscription a use case will execute its job in the thread specified by the [ioScheduler]. * and will post the result to the thread specified by [uiScheduler]. */ -abstract class CompletableInteractor

( +public abstract class CompletableInteractor

( private val ioScheduler: Scheduler, private val uiScheduler: Scheduler ) { @@ -23,7 +23,7 @@ abstract class CompletableInteractor

( /** * Build a use case with the provided execution thread and post execution thread */ - fun buildCompletable(params: P): Completable { + public fun buildCompletable(params: P): Completable { return createInteractor(params) .subscribeOn(ioScheduler) .observeOn(uiScheduler) diff --git a/blueprint-interactor-rx2/src/main/kotlin/reactivecircus/blueprint/interactor/rx2/ObservableInteractor.kt b/blueprint-interactor-rx2/src/main/kotlin/reactivecircus/blueprint/interactor/rx2/ObservableInteractor.kt index 5fbcff29..21f860e2 100644 --- a/blueprint-interactor-rx2/src/main/kotlin/reactivecircus/blueprint/interactor/rx2/ObservableInteractor.kt +++ b/blueprint-interactor-rx2/src/main/kotlin/reactivecircus/blueprint/interactor/rx2/ObservableInteractor.kt @@ -10,7 +10,7 @@ import reactivecircus.blueprint.interactor.InteractorParams * Upon subscription a use case will execute its job in the thread specified by the [ioScheduler]. * and will post the result to the thread specified by [uiScheduler]. */ -abstract class ObservableInteractor

( +public abstract class ObservableInteractor

( private val ioScheduler: Scheduler, private val uiScheduler: Scheduler ) { @@ -23,7 +23,7 @@ abstract class ObservableInteractor

( /** * Build a use case with the provided execution thread and post execution thread */ - fun buildObservable(params: P): Observable { + public fun buildObservable(params: P): Observable { return createInteractor(params) .subscribeOn(ioScheduler) .observeOn(uiScheduler) diff --git a/blueprint-interactor-rx2/src/main/kotlin/reactivecircus/blueprint/interactor/rx2/SingleInteractor.kt b/blueprint-interactor-rx2/src/main/kotlin/reactivecircus/blueprint/interactor/rx2/SingleInteractor.kt index 6b687341..7913313d 100644 --- a/blueprint-interactor-rx2/src/main/kotlin/reactivecircus/blueprint/interactor/rx2/SingleInteractor.kt +++ b/blueprint-interactor-rx2/src/main/kotlin/reactivecircus/blueprint/interactor/rx2/SingleInteractor.kt @@ -10,7 +10,7 @@ import reactivecircus.blueprint.interactor.InteractorParams * Upon subscription a use case will execute its job in the thread specified by the [ioScheduler]. * and will post the result to the thread specified by [uiScheduler]. */ -abstract class SingleInteractor

( +public abstract class SingleInteractor

( private val ioScheduler: Scheduler, private val uiScheduler: Scheduler ) { @@ -25,7 +25,7 @@ abstract class SingleInteractor

( * @param params - parameters required for this interactor * @param blocking - when set to true the single will be subscribed and observed on the current thread */ - fun buildSingle(params: P, blocking: Boolean = false): Single { + public fun buildSingle(params: P, blocking: Boolean = false): Single { return if (blocking) { createInteractor(params) } else { diff --git a/blueprint-interactor-rx3/build.gradle b/blueprint-interactor-rx3/build.gradle index e86b1784..9f1703d0 100644 --- a/blueprint-interactor-rx3/build.gradle +++ b/blueprint-interactor-rx3/build.gradle @@ -5,6 +5,16 @@ plugins { id 'org.jetbrains.dokka' } +kotlin.explicitApi = 'strict' + +compileKotlin { + kotlinOptions { + freeCompilerArgs += [ + '-Xexplicit-api=strict', + ] + } +} + afterEvaluate { project -> project.tasks.dokka { outputDirectory = "$rootDir/docs/api" diff --git a/blueprint-interactor-rx3/src/main/kotlin/reactivecircus/blueprint/interactor/rx3/CompletableInteractor.kt b/blueprint-interactor-rx3/src/main/kotlin/reactivecircus/blueprint/interactor/rx3/CompletableInteractor.kt index ec155d38..bce36ffb 100644 --- a/blueprint-interactor-rx3/src/main/kotlin/reactivecircus/blueprint/interactor/rx3/CompletableInteractor.kt +++ b/blueprint-interactor-rx3/src/main/kotlin/reactivecircus/blueprint/interactor/rx3/CompletableInteractor.kt @@ -10,7 +10,7 @@ import reactivecircus.blueprint.interactor.InteractorParams * Upon subscription a use case will execute its job in the thread specified by the [ioScheduler]. * and will post the result to the thread specified by [uiScheduler]. */ -abstract class CompletableInteractor

( +public abstract class CompletableInteractor

( private val ioScheduler: Scheduler, private val uiScheduler: Scheduler ) { @@ -23,7 +23,7 @@ abstract class CompletableInteractor

( /** * Build a use case with the provided execution thread and post execution thread */ - fun buildCompletable(params: P): Completable { + public fun buildCompletable(params: P): Completable { return createInteractor(params) .subscribeOn(ioScheduler) .observeOn(uiScheduler) diff --git a/blueprint-interactor-rx3/src/main/kotlin/reactivecircus/blueprint/interactor/rx3/ObservableInteractor.kt b/blueprint-interactor-rx3/src/main/kotlin/reactivecircus/blueprint/interactor/rx3/ObservableInteractor.kt index 3347a83f..e027672f 100644 --- a/blueprint-interactor-rx3/src/main/kotlin/reactivecircus/blueprint/interactor/rx3/ObservableInteractor.kt +++ b/blueprint-interactor-rx3/src/main/kotlin/reactivecircus/blueprint/interactor/rx3/ObservableInteractor.kt @@ -10,7 +10,7 @@ import reactivecircus.blueprint.interactor.InteractorParams * Upon subscription a use case will execute its job in the thread specified by the [ioScheduler]. * and will post the result to the thread specified by [uiScheduler]. */ -abstract class ObservableInteractor

( +public abstract class ObservableInteractor

( private val ioScheduler: Scheduler, private val uiScheduler: Scheduler ) { @@ -23,7 +23,7 @@ abstract class ObservableInteractor

( /** * Build a use case with the provided execution thread and post execution thread */ - fun buildObservable(params: P): Observable { + public fun buildObservable(params: P): Observable { return createInteractor(params) .subscribeOn(ioScheduler) .observeOn(uiScheduler) diff --git a/blueprint-interactor-rx3/src/main/kotlin/reactivecircus/blueprint/interactor/rx3/SingleInteractor.kt b/blueprint-interactor-rx3/src/main/kotlin/reactivecircus/blueprint/interactor/rx3/SingleInteractor.kt index b3f997e9..7aed576e 100644 --- a/blueprint-interactor-rx3/src/main/kotlin/reactivecircus/blueprint/interactor/rx3/SingleInteractor.kt +++ b/blueprint-interactor-rx3/src/main/kotlin/reactivecircus/blueprint/interactor/rx3/SingleInteractor.kt @@ -10,7 +10,7 @@ import reactivecircus.blueprint.interactor.InteractorParams * Upon subscription a use case will execute its job in the thread specified by the [ioScheduler]. * and will post the result to the thread specified by [uiScheduler]. */ -abstract class SingleInteractor

( +public abstract class SingleInteractor

( private val ioScheduler: Scheduler, private val uiScheduler: Scheduler ) { @@ -25,7 +25,7 @@ abstract class SingleInteractor

( * @param params - parameters required for this interactor * @param blocking - when set to true the single will be subscribed and observed on the current thread */ - fun buildSingle(params: P, blocking: Boolean = false): Single { + public fun buildSingle(params: P, blocking: Boolean = false): Single { return if (blocking) { createInteractor(params) } else { diff --git a/blueprint-testing-robot/build.gradle b/blueprint-testing-robot/build.gradle index 2abd440a..da0f5fda 100644 --- a/blueprint-testing-robot/build.gradle +++ b/blueprint-testing-robot/build.gradle @@ -18,6 +18,13 @@ android { testApplicationId 'reactivecircus.blueprint.testing.testapp' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + + kotlin.explicitApi = 'strict' + kotlinOptions { + freeCompilerArgs += [ + '-Xexplicit-api=strict', + ] + } } dependencies { diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/Instrumentation.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/Instrumentation.kt index 10242260..60e7dfa7 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/Instrumentation.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/Instrumentation.kt @@ -9,7 +9,7 @@ import java.util.concurrent.atomic.AtomicReference /** * Finds the activity in the foreground (if any). */ -fun currentActivity(): Activity? { +public fun currentActivity(): Activity? { val currentActivityReference = AtomicReference() getInstrumentation().runOnMainSync { val resumedActivities = ActivityLifecycleMonitorRegistry.getInstance() diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/RepeatRule.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/RepeatRule.kt index 4af90269..4e047707 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/RepeatRule.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/RepeatRule.kt @@ -8,7 +8,7 @@ import org.junit.runners.model.Statement * TestRule to execute tests multiple times. * This can be used to debug flaky tests. */ -class RepeatRule(private val iterations: Int) : TestRule { +public class RepeatRule(private val iterations: Int) : TestRule { init { require(iterations > 0) { "iterations < 1: $iterations" } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/ScreenRobot.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/ScreenRobot.kt index 602f79da..676be183 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/ScreenRobot.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/ScreenRobot.kt @@ -3,21 +3,21 @@ package reactivecircus.blueprint.testing /** * Base class for implementing a robot DSL. */ -abstract class ScreenRobot( +public abstract class ScreenRobot( private val robotActions: A, private val robotAssertions: S ) { - fun given(block: () -> Unit) = block() - fun perform(block: A.() -> Unit) = robotActions.apply { block() } - fun check(block: S.() -> Unit) = robotAssertions.apply { block() } + public fun given(block: () -> Unit): Unit = block() + public fun perform(block: A.() -> Unit): A = robotActions.apply { block() } + public fun check(block: S.() -> Unit): S = robotAssertions.apply { block() } } /** * Robot actions for performing common view actions. */ -interface RobotActions +public interface RobotActions /** * Robot assertions for performing common view assertions. */ -interface RobotAssertions +public interface RobotAssertions diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/ViewActions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/ViewActions.kt index 49854106..380e3a40 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/ViewActions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/ViewActions.kt @@ -25,7 +25,7 @@ private const val MAX_SCROLL_ATTEMPTS = 100 /** * Scroll until the view associated with [viewId] is visible. */ -fun scrollTo(@IdRes viewId: Int) { +public fun scrollTo(@IdRes viewId: Int) { ViewActions.repeatedlyUntil( ViewActions.scrollTo(), Matchers.allOf(ViewMatchers.withId(viewId), isDisplayed()), @@ -36,7 +36,7 @@ fun scrollTo(@IdRes viewId: Int) { /** * Scroll until the [text]] is visible. */ -fun scrollTo(text: String) { +public fun scrollTo(text: String) { ViewActions.repeatedlyUntil( ViewActions.scrollTo(), Matchers.allOf(ViewMatchers.withText(text), isDisplayed()), @@ -47,7 +47,7 @@ fun scrollTo(text: String) { /** * Scroll to the item at [itemIndex] in the [RecyclerView] associated with [recyclerViewId]. */ -fun scrollToItemInRecyclerView(@IdRes recyclerViewId: Int, itemIndex: Int) { +public fun scrollToItemInRecyclerView(@IdRes recyclerViewId: Int, itemIndex: Int) { Espresso.onView(AllOf.allOf(ViewMatchers.withId(recyclerViewId), isDisplayed())) .perform(RecyclerViewActions.scrollToPosition(itemIndex)) } @@ -57,7 +57,7 @@ private const val RECYCLER_VIEW_PENDING_UPDATES_CHECK_INTERVAL_MILLIS = 10L /** * Wait until the [RecyclerView] has no more pending updates. */ -fun onRecyclerViewIdle(@IdRes recyclerViewId: Int) { +public fun onRecyclerViewIdle(@IdRes recyclerViewId: Int) { Espresso.onIdle() Espresso.onView(allOf(ViewMatchers.withId(recyclerViewId), isDisplayed())) .perform(object : ViewAction { @@ -82,7 +82,7 @@ fun onRecyclerViewIdle(@IdRes recyclerViewId: Int) { /** * Clear the scrollFlags on the [Toolbar] associated with [toolbarId]. */ -fun clearToolbarScrollFlags(@IdRes toolbarId: Int) { +public fun clearToolbarScrollFlags(@IdRes toolbarId: Int) { Espresso.onView(ViewMatchers.withId(toolbarId)) .perform(object : ViewAction { override fun getConstraints(): Matcher { @@ -114,7 +114,7 @@ private const val DEFAULT_VIEW_ACTION_DELAY_MILLIS = 200L * but needs to participate in Espresso's internal synchronisation mechanisms * to prevent the next [ViewAction] or [Matcher] from executing too early. */ -fun Any.asViewAction(delayMillis: Long = DEFAULT_VIEW_ACTION_DELAY_MILLIS) { +public fun Any.asViewAction(delayMillis: Long = DEFAULT_VIEW_ACTION_DELAY_MILLIS) { also { Espresso.onView(isRoot()) .perform(object : ViewAction { diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/CheckableRobotActions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/CheckableRobotActions.kt index d184f3b6..81fc5d6a 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/CheckableRobotActions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/CheckableRobotActions.kt @@ -12,7 +12,7 @@ import reactivecircus.blueprint.testing.scrollTo * Click on the radio button with [buttonText] * within the radio group associated with [radioGroupId]. */ -fun RobotActions.clickRadioButton(@IdRes radioGroupId: Int, buttonText: String) { +public fun RobotActions.clickRadioButton(@IdRes radioGroupId: Int, buttonText: String) { scrollTo(buttonText) Espresso.onView( AllOf.allOf( @@ -27,7 +27,7 @@ fun RobotActions.clickRadioButton(@IdRes radioGroupId: Int, buttonText: String) /** * Select the checkbox with [text] within the view group associated with [layoutId]. */ -fun RobotActions.selectCheckBox(@IdRes layoutId: Int, text: String) { +public fun RobotActions.selectCheckBox(@IdRes layoutId: Int, text: String) { scrollTo(text) Espresso.onView( AllOf.allOf( diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/DialogRobotActions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/DialogRobotActions.kt index 9ad271a4..898e63d9 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/DialogRobotActions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/DialogRobotActions.kt @@ -7,20 +7,20 @@ import androidx.test.espresso.matcher.ViewMatchers /** * Click on button 1 of the currently displayed dialog. */ -fun clickDialogButton1() { +public fun clickDialogButton1() { Espresso.onView(ViewMatchers.withId(android.R.id.button1)).perform(ViewActions.click()) } /** * Click on button 2 of the currently displayed dialog. */ -fun clickDialogButton2() { +public fun clickDialogButton2() { Espresso.onView(ViewMatchers.withId(android.R.id.button2)).perform(ViewActions.click()) } /** * Click on button 3 of the currently displayed dialog. */ -fun clickDialogButton3() { +public fun clickDialogButton3() { Espresso.onView(ViewMatchers.withId(android.R.id.button3)).perform(ViewActions.click()) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/DrawerRobotActions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/DrawerRobotActions.kt index 14bebbf2..1c7261ee 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/DrawerRobotActions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/DrawerRobotActions.kt @@ -9,13 +9,13 @@ import reactivecircus.blueprint.testing.RobotActions /** * Open the drawer associated with [drawerId]. */ -fun RobotActions.openDrawer(@IdRes drawerId: Int) { +public fun RobotActions.openDrawer(@IdRes drawerId: Int) { Espresso.onView(ViewMatchers.withId(drawerId)).perform(DrawerActions.open()) } /** * Close the drawer associated with [drawerId]. */ -fun RobotActions.closeDrawer(@IdRes drawerId: Int) { +public fun RobotActions.closeDrawer(@IdRes drawerId: Int) { Espresso.onView(ViewMatchers.withId(drawerId)).perform(DrawerActions.close()) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/GestureRobotActions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/GestureRobotActions.kt index 3d24138a..436246ed 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/GestureRobotActions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/GestureRobotActions.kt @@ -9,41 +9,41 @@ import reactivecircus.blueprint.testing.RobotActions /** * Click on the view associated with [viewId]. */ -fun RobotActions.clickView(@IdRes viewId: Int) { +public fun RobotActions.clickView(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)).perform(ViewActions.click()) } /** * Long-click on the view associated with [viewId]. */ -fun RobotActions.longClickView(@IdRes viewId: Int) { +public fun RobotActions.longClickView(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)).perform(ViewActions.longClick()) } /** * Swipe left on the view associated with [viewId]. */ -fun swipeLeftOnView(@IdRes viewId: Int) { +public fun swipeLeftOnView(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)).perform(ViewActions.swipeLeft()) } /** * Swipe right on the view associated with [viewId]. */ -fun swipeRightOnView(@IdRes viewId: Int) { +public fun swipeRightOnView(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)).perform(ViewActions.swipeRight()) } /** * Swipe up on the view associated with [viewId]. */ -fun swipeUpOnView(@IdRes viewId: Int) { +public fun swipeUpOnView(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)).perform(ViewActions.swipeUp()) } /** * Swipe up down the view associated with [viewId]. */ -fun swipeDownOnView(@IdRes viewId: Int) { +public fun swipeDownOnView(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)).perform(ViewActions.swipeDown()) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/KeyboardRobotActions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/KeyboardRobotActions.kt index 8e97ae80..c95c550e 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/KeyboardRobotActions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/KeyboardRobotActions.kt @@ -9,13 +9,13 @@ import reactivecircus.blueprint.testing.RobotActions /** * Close the soft keyboard. */ -fun RobotActions.closeKeyboard(@IdRes viewId: Int) { +public fun RobotActions.closeKeyboard(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)).perform(ViewActions.closeSoftKeyboard()) } /** * Press the action button on the keyboard. */ -fun RobotActions.pressKeyboardActionButton(@IdRes viewId: Int) { +public fun RobotActions.pressKeyboardActionButton(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)).perform(ViewActions.pressImeActionButton()) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/NavigationRobotActions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/NavigationRobotActions.kt index d1cc3d22..62a6001f 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/NavigationRobotActions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/NavigationRobotActions.kt @@ -23,7 +23,7 @@ import reactivecircus.blueprint.testing.RobotActions * Select the bottom navigation item with [navItemTitle] * from the bottom navigation view associated with [bottomNavigationViewResId]. */ -fun RobotActions.selectBottomNavigationItem(@IdRes bottomNavigationViewResId: Int, navItemTitle: String) { +public fun RobotActions.selectBottomNavigationItem(@IdRes bottomNavigationViewResId: Int, navItemTitle: String) { Espresso.onView( CoreMatchers.allOf( ViewMatchers.withId(R.id.icon), @@ -44,7 +44,7 @@ fun RobotActions.selectBottomNavigationItem(@IdRes bottomNavigationViewResId: In * Select the navigation item associated with [menuItemResId] * from the navigation view associated with [navigationViewResId]. */ -fun RobotActions.selectNavigationItem(@IdRes navigationViewResId: Int, @IdRes menuItemResId: Int) { +public fun RobotActions.selectNavigationItem(@IdRes navigationViewResId: Int, @IdRes menuItemResId: Int) { Espresso.onView(withId(navigationViewResId)) .perform(NavigationViewActions.navigateTo(menuItemResId)) } @@ -52,21 +52,21 @@ fun RobotActions.selectNavigationItem(@IdRes navigationViewResId: Int, @IdRes me /** * Press the Android back button. */ -fun RobotActions.pressBack() { +public fun RobotActions.pressBack() { Espresso.pressBackUnconditionally() } /** * Click the navigation up button in the current toolbar. */ -fun RobotActions.clickNavigateUpButton() { +public fun RobotActions.clickNavigateUpButton() { Espresso.onView(withToolbarNavigationButton()).perform(ViewActions.click()) } /** * Intercept the future intent and respond with [Activity.RESULT_OK]. */ -fun RobotActions.interceptIntents() { +public fun RobotActions.interceptIntents() { Intents.intending(CoreMatchers.not(IntentMatchers.isInternal())) .respondWith(Instrumentation.ActivityResult(Activity.RESULT_OK, null)) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/RecyclerViewRobotActions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/RecyclerViewRobotActions.kt index 52c97aca..98bf32ea 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/RecyclerViewRobotActions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/RecyclerViewRobotActions.kt @@ -12,7 +12,7 @@ import reactivecircus.blueprint.testing.scrollToItemInRecyclerView /** * Click on the item at [position] within the recycler view associated with [recyclerViewId]. */ -fun RobotActions.clickRecyclerViewItem(@IdRes recyclerViewId: Int, position: Int) { +public fun RobotActions.clickRecyclerViewItem(@IdRes recyclerViewId: Int, position: Int) { // scroll to the item to make sure it's visible scrollToItemInRecyclerView(recyclerViewId, position) diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/SnackbarRobotActions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/SnackbarRobotActions.kt index 7a3542b6..0df0a6d9 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/SnackbarRobotActions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/SnackbarRobotActions.kt @@ -9,6 +9,6 @@ import com.google.android.material.R as MaterialR /** * Click the action button on the currently displayed Snackbar. */ -fun RobotActions.clickSnackbarActionButton() { +public fun RobotActions.clickSnackbarActionButton() { Espresso.onView(ViewMatchers.withId(MaterialR.id.snackbar_action)).perform(ViewActions.click()) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/TextRobotActions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/TextRobotActions.kt index 78ce0e47..2fe9ea5e 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/TextRobotActions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/action/TextRobotActions.kt @@ -18,28 +18,28 @@ import com.google.android.material.R as MaterialR /** * Enter [text] into the edit text associated with [viewId]. */ -fun RobotActions.enterTextIntoView(@IdRes viewId: Int, text: String) { +public fun RobotActions.enterTextIntoView(@IdRes viewId: Int, text: String) { Espresso.onView(ViewMatchers.withId(viewId)).perform(ViewActions.typeText(text)) } /** * Replace the text in the edit text associated with [viewId] with [text]. */ -fun RobotActions.replaceTextInView(@IdRes viewId: Int, text: String) { +public fun RobotActions.replaceTextInView(@IdRes viewId: Int, text: String) { Espresso.onView(ViewMatchers.withId(viewId)).perform(ViewActions.replaceText(text)) } /** * Clear the text in the edit text associated with [viewId]. */ -fun RobotActions.clearTextInView(@IdRes viewId: Int) { +public fun RobotActions.clearTextInView(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)).perform(ViewActions.clearText()) } /** * Hide the password toggle button in the [TextInputLayout] associated with [viewId]. */ -fun RobotActions.hideTextInputPasswordToggleButton(@IdRes viewId: Int) { +public fun RobotActions.hideTextInputPasswordToggleButton(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .perform(object : ViewAction { override fun getConstraints(): Matcher { @@ -62,7 +62,7 @@ fun RobotActions.hideTextInputPasswordToggleButton(@IdRes viewId: Int) { /** * Click on the start icon on the [TextInputLayout] associated with [viewId]. */ -fun RobotActions.clickTextInputLayoutStartIcon(@IdRes viewId: Int) { +public fun RobotActions.clickTextInputLayoutStartIcon(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .perform(object : ViewAction { override fun getConstraints(): Matcher { @@ -84,7 +84,7 @@ fun RobotActions.clickTextInputLayoutStartIcon(@IdRes viewId: Int) { /** * Click on the end icon on the [TextInputLayout] associated with [viewId]. */ -fun RobotActions.clickTextInputLayoutEndIcon(@IdRes viewId: Int) { +public fun RobotActions.clickTextInputLayoutEndIcon(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .perform(object : ViewAction { override fun getConstraints(): Matcher { @@ -106,7 +106,7 @@ fun RobotActions.clickTextInputLayoutEndIcon(@IdRes viewId: Int) { /** * Click on the error icon on the [TextInputLayout] associated with [viewId]. */ -fun RobotActions.clickTextInputLayoutErrorIcon(@IdRes viewId: Int) { +public fun RobotActions.clickTextInputLayoutErrorIcon(@IdRes viewId: Int) { Espresso.onView( CoreMatchers.allOf( ViewMatchers.withId(MaterialR.id.text_input_end_icon), @@ -119,7 +119,7 @@ fun RobotActions.clickTextInputLayoutErrorIcon(@IdRes viewId: Int) { /** * Long click on the start icon on the [TextInputLayout] associated with [viewId]. */ -fun RobotActions.longClickTextInputLayoutStartIcon(@IdRes viewId: Int) { +public fun RobotActions.longClickTextInputLayoutStartIcon(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .perform(object : ViewAction { override fun getConstraints(): Matcher { @@ -141,7 +141,7 @@ fun RobotActions.longClickTextInputLayoutStartIcon(@IdRes viewId: Int) { /** * Long click on the end icon on the [TextInputLayout] associated with [viewId]. */ -fun RobotActions.longClickTextInputLayoutEndIcon(@IdRes viewId: Int) { +public fun RobotActions.longClickTextInputLayoutEndIcon(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .perform(object : ViewAction { override fun getConstraints(): Matcher { @@ -163,7 +163,7 @@ fun RobotActions.longClickTextInputLayoutEndIcon(@IdRes viewId: Int) { /** * Long click on the error icon on the [TextInputLayout] associated with [viewId]. */ -fun RobotActions.longClickTextInputLayoutErrorIcon(@IdRes viewId: Int) { +public fun RobotActions.longClickTextInputLayoutErrorIcon(@IdRes viewId: Int) { Espresso.onView( CoreMatchers.allOf( ViewMatchers.withId(MaterialR.id.text_input_end_icon), diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/CheckableRobotAssertions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/CheckableRobotAssertions.kt index 725c1ce1..699d9ed3 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/CheckableRobotAssertions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/CheckableRobotAssertions.kt @@ -19,7 +19,7 @@ import reactivecircus.blueprint.testing.scrollTo * Check if the radio group associated with [radioGroupId] * has [buttonTexts] as the labels of the radio buttons. */ -fun RobotAssertions.radioGroupHasText(@IdRes radioGroupId: Int, vararg buttonTexts: String) { +public fun RobotAssertions.radioGroupHasText(@IdRes radioGroupId: Int, vararg buttonTexts: String) { buttonTexts.forEach { buttonText -> scrollTo(buttonText) Espresso.onView( @@ -37,7 +37,7 @@ fun RobotAssertions.radioGroupHasText(@IdRes radioGroupId: Int, vararg buttonTex * Check if the radio group associated with [radioGroupId] * has the button with [buttonText] selected. */ -fun RobotAssertions.radioButtonSelected(@IdRes radioGroupId: Int, buttonText: String) { +public fun RobotAssertions.radioButtonSelected(@IdRes radioGroupId: Int, buttonText: String) { scrollTo(buttonText) Espresso.onView( AllOf.allOf( @@ -52,7 +52,7 @@ fun RobotAssertions.radioButtonSelected(@IdRes radioGroupId: Int, buttonText: St /** * Check if the radio group associated with [radioGroupId] has some selections. */ -fun RobotAssertions.radioGroupHasSelections(@IdRes radioGroupId: Int) { +public fun RobotAssertions.radioGroupHasSelections(@IdRes radioGroupId: Int) { Espresso.onView(AllOf.allOf(ViewMatchers.isDisplayed(), ViewMatchers.withId(radioGroupId))) .check(RadioGroupAssertion()) } @@ -60,7 +60,7 @@ fun RobotAssertions.radioGroupHasSelections(@IdRes radioGroupId: Int) { /** * Check if the radio group associated with [radioGroupId] has NO selection. */ -fun RobotAssertions.radioGroupHasNoSelections(@IdRes radioGroupId: Int) { +public fun RobotAssertions.radioGroupHasNoSelections(@IdRes radioGroupId: Int) { Espresso.onView(AllOf.allOf(ViewMatchers.isDisplayed(), ViewMatchers.withId(radioGroupId))) .check(ViewAssertions.matches(CoreMatchers.not(RadioGroupAssertion()))) } @@ -68,7 +68,7 @@ fun RobotAssertions.radioGroupHasNoSelections(@IdRes radioGroupId: Int) { /** * Check if the checkable view associated with [viewId] is checked. */ -fun RobotAssertions.viewChecked(@IdRes viewId: Int) { +public fun RobotAssertions.viewChecked(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(ViewMatchers.isChecked())) } @@ -76,7 +76,7 @@ fun RobotAssertions.viewChecked(@IdRes viewId: Int) { /** * Check if the checkable view associated with [viewId] is NOT checked. */ -fun RobotAssertions.viewNotChecked(@IdRes viewId: Int) { +public fun RobotAssertions.viewNotChecked(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(ViewMatchers.isNotChecked())) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/DialogRobotAssertions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/DialogRobotAssertions.kt index 3db3fdcf..51213855 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/DialogRobotAssertions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/DialogRobotAssertions.kt @@ -10,7 +10,7 @@ import reactivecircus.blueprint.testing.RobotAssertions /** * Check if a dialog with the title of a string associated with [titleResId] is displayed. */ -fun RobotAssertions.dialogWithTextDisplayed(@StringRes titleResId: Int) { +public fun RobotAssertions.dialogWithTextDisplayed(@StringRes titleResId: Int) { Espresso.onView(ViewMatchers.withText(titleResId)) .inRoot(RootMatchers.isDialog()) .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) @@ -19,7 +19,7 @@ fun RobotAssertions.dialogWithTextDisplayed(@StringRes titleResId: Int) { /** * Check if a dialog with the title [expected] is displayed. */ -fun RobotAssertions.dialogWithTextDisplayed(expected: String) { +public fun RobotAssertions.dialogWithTextDisplayed(expected: String) { Espresso.onView(ViewMatchers.withText(expected)) .inRoot(RootMatchers.isDialog()) .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) @@ -28,7 +28,7 @@ fun RobotAssertions.dialogWithTextDisplayed(expected: String) { /** * Check if a dialog with [buttonTextResId] as the button 1 label is displayed. */ -fun RobotAssertions.dialogWithButton1Displayed(@StringRes buttonTextResId: Int) { +public fun RobotAssertions.dialogWithButton1Displayed(@StringRes buttonTextResId: Int) { Espresso.onView(ViewMatchers.withId(android.R.id.button1)) .inRoot(RootMatchers.isDialog()) .check(ViewAssertions.matches(ViewMatchers.withText(buttonTextResId))) @@ -38,7 +38,7 @@ fun RobotAssertions.dialogWithButton1Displayed(@StringRes buttonTextResId: Int) /** * Check if a dialog with [buttonTextResId] as the button 2 label is displayed. */ -fun RobotAssertions.dialogWithButton2Displayed(@StringRes buttonTextResId: Int) { +public fun RobotAssertions.dialogWithButton2Displayed(@StringRes buttonTextResId: Int) { Espresso.onView(ViewMatchers.withId(android.R.id.button2)) .inRoot(RootMatchers.isDialog()) .check(ViewAssertions.matches(ViewMatchers.withText(buttonTextResId))) @@ -48,7 +48,7 @@ fun RobotAssertions.dialogWithButton2Displayed(@StringRes buttonTextResId: Int) /** * Check if a dialog with [buttonTextResId] as the button 3 label is displayed. */ -fun RobotAssertions.dialogWithButton3Displayed(@StringRes buttonTextResId: Int) { +public fun RobotAssertions.dialogWithButton3Displayed(@StringRes buttonTextResId: Int) { Espresso.onView(ViewMatchers.withId(android.R.id.button3)) .inRoot(RootMatchers.isDialog()) .check(ViewAssertions.matches(ViewMatchers.withText(buttonTextResId))) diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/DrawableRobotAssertions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/DrawableRobotAssertions.kt index 673d7549..a2e7b2b7 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/DrawableRobotAssertions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/DrawableRobotAssertions.kt @@ -20,7 +20,7 @@ import reactivecircus.blueprint.testing.RobotAssertions /** * Check if the drawable associated with [resourceId] is displayed. */ -fun RobotAssertions.drawableDisplayed(@IdRes resourceId: Int) { +public fun RobotAssertions.drawableDisplayed(@IdRes resourceId: Int) { Espresso.onView(withDrawable(resourceId)) .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) } @@ -28,7 +28,7 @@ fun RobotAssertions.drawableDisplayed(@IdRes resourceId: Int) { /** * Check if the background drawable associated with [resourceId] is displayed. */ -fun RobotAssertions.backgroundDrawableDisplayed(@IdRes resourceId: Int) { +public fun RobotAssertions.backgroundDrawableDisplayed(@IdRes resourceId: Int) { Espresso.onView(withBackgroundDrawable(resourceId)) .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) } @@ -36,7 +36,7 @@ fun RobotAssertions.backgroundDrawableDisplayed(@IdRes resourceId: Int) { /** * Check if the foreground drawable associated with [resourceId] is displayed. */ -fun RobotAssertions.foregroundDrawableDisplayed(@IdRes resourceId: Int) { +public fun RobotAssertions.foregroundDrawableDisplayed(@IdRes resourceId: Int) { Espresso.onView(withForegroundDrawable(resourceId)) .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/DrawerRobotAssertions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/DrawerRobotAssertions.kt index ea784d65..724daad5 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/DrawerRobotAssertions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/DrawerRobotAssertions.kt @@ -10,7 +10,7 @@ import reactivecircus.blueprint.testing.RobotAssertions /** * Check if the drawer associated with [drawerId] is opened. */ -fun RobotAssertions.drawerOpened(@IdRes drawerId: Int) { +public fun RobotAssertions.drawerOpened(@IdRes drawerId: Int) { Espresso.onView(ViewMatchers.withId(drawerId)) .check(ViewAssertions.matches(DrawerMatchers.isOpen())) } @@ -18,7 +18,7 @@ fun RobotAssertions.drawerOpened(@IdRes drawerId: Int) { /** * Check if the drawer associated with [drawerId] is closed. */ -fun RobotAssertions.drawerClosed(@IdRes drawerId: Int) { +public fun RobotAssertions.drawerClosed(@IdRes drawerId: Int) { Espresso.onView(ViewMatchers.withId(drawerId)) .check(ViewAssertions.matches(DrawerMatchers.isClosed())) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/KeyboardRobotAssertions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/KeyboardRobotAssertions.kt index dce02588..68e9ef22 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/KeyboardRobotAssertions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/KeyboardRobotAssertions.kt @@ -15,7 +15,7 @@ import reactivecircus.blueprint.testing.RobotAssertions /** * Check if the edit text associated with [viewId] has an email input type. */ -fun RobotAssertions.keyboardInputTypeIsEmail(@IdRes viewId: Int) { +public fun RobotAssertions.keyboardInputTypeIsEmail(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(withEmailInputType())) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/NavigationRobotAssertions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/NavigationRobotAssertions.kt index 1849050e..ea7c55b1 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/NavigationRobotAssertions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/NavigationRobotAssertions.kt @@ -26,7 +26,7 @@ import reactivecircus.blueprint.testing.currentActivity * Check if the bottom navigation view associated with [bottomNavigationViewResId] * has [selectedItemResId] as the selected item. */ -fun RobotAssertions.bottomNavigationViewItemSelected( +public fun RobotAssertions.bottomNavigationViewItemSelected( @IdRes bottomNavigationViewResId: Int, @IdRes selectedItemResId: Int ) { @@ -37,21 +37,21 @@ fun RobotAssertions.bottomNavigationViewItemSelected( /** * Check if no activity is currently displayed */ -fun RobotAssertions.noActivityDisplayed() { +public fun RobotAssertions.noActivityDisplayed() { ActivityNotDisplayedAssertion(currentActivity()) } /** * Check if the activity of type [A] has been launched. */ -inline fun RobotAssertions.activityLaunched() { +public inline fun RobotAssertions.activityLaunched() { Intents.intended(IntentMatchers.hasComponent(A::class.java.name)) } /** * Check if the fragment of type [F] with [tag] is displayed. */ -inline fun RobotAssertions.fragmentDisplayed(tag: String) { +public inline fun RobotAssertions.fragmentDisplayed(tag: String) { val fragment = (currentActivity() as FragmentActivity) .supportFragmentManager.findFragmentByTag(tag) assertThat(fragment != null && fragment.isVisible && fragment is F) @@ -62,7 +62,7 @@ inline fun RobotAssertions.fragmentDisplayed(tag: String) * Check if the fragment of type [F] * with a navigation host associated with [navHostViewId] is displayed. */ -inline fun RobotAssertions.fragmentDisplayed(@IdRes navHostViewId: Int) { +public inline fun RobotAssertions.fragmentDisplayed(@IdRes navHostViewId: Int) { val fragment = (currentActivity() as? FragmentActivity)?.supportFragmentManager ?.findFragmentById(navHostViewId)?.childFragmentManager?.primaryNavigationFragment diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/RecyclerViewRobotAssertions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/RecyclerViewRobotAssertions.kt index 9ac57303..a3123ef4 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/RecyclerViewRobotAssertions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/RecyclerViewRobotAssertions.kt @@ -15,7 +15,7 @@ import reactivecircus.blueprint.testing.RobotAssertions /** * Check if the recycler view associated with [recyclerViewId] has the size of [size]. */ -fun RobotAssertions.recyclerViewHasSize(@IdRes recyclerViewId: Int, size: Int) { +public fun RobotAssertions.recyclerViewHasSize(@IdRes recyclerViewId: Int, size: Int) { Espresso.onView( allOf( ViewMatchers.withId(recyclerViewId), diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/SnackbarRobotAssertions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/SnackbarRobotAssertions.kt index 3c7f4503..30866ba3 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/SnackbarRobotAssertions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/SnackbarRobotAssertions.kt @@ -10,7 +10,7 @@ import reactivecircus.blueprint.testing.RobotAssertions /** * Check if a snackbar with [text] as message is displayed. */ -fun RobotAssertions.snackBarDisplayed(text: String) { +public fun RobotAssertions.snackBarDisplayed(text: String) { Espresso.onView( CoreMatchers.allOf( ViewMatchers.withId(R.id.snackbar_text), diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/TextInputRobotAssertions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/TextInputRobotAssertions.kt index 6c0bf3fe..758823e8 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/TextInputRobotAssertions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/TextInputRobotAssertions.kt @@ -15,7 +15,7 @@ import reactivecircus.blueprint.testing.RobotAssertions /** * Check if text input layout associated with [viewId] has [errorMessage] as the error. */ -fun RobotAssertions.textInputLayoutHasError(@IdRes viewId: Int, errorMessage: String) { +public fun RobotAssertions.textInputLayoutHasError(@IdRes viewId: Int, errorMessage: String) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(hasTextInputLayoutErrorText(errorMessage))) } @@ -24,7 +24,7 @@ fun RobotAssertions.textInputLayoutHasError(@IdRes viewId: Int, errorMessage: St * Check if text input layout associated with [viewId] * has string associated with [errorMessageResId] as the error. */ -fun RobotAssertions.textInputLayoutHasError(@IdRes viewId: Int, @StringRes errorMessageResId: Int) { +public fun RobotAssertions.textInputLayoutHasError(@IdRes viewId: Int, @StringRes errorMessageResId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(hasTextInputLayoutErrorText(errorMessageResId))) } @@ -32,7 +32,7 @@ fun RobotAssertions.textInputLayoutHasError(@IdRes viewId: Int, @StringRes error /** * Check if the text input layout associated with [viewId] has NO error. */ -fun RobotAssertions.textInputLayoutHasNoError(@IdRes viewId: Int) { +public fun RobotAssertions.textInputLayoutHasNoError(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(noTextInputLayoutError())) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/TextRobotAssertions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/TextRobotAssertions.kt index d9504287..9017dd73 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/TextRobotAssertions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/TextRobotAssertions.kt @@ -13,7 +13,7 @@ import reactivecircus.blueprint.testing.RobotAssertions /** * Check if all texts associated with [textResIds] are displayed. */ -fun RobotAssertions.textDisplayed(@StringRes vararg textResIds: Int) { +public fun RobotAssertions.textDisplayed(@StringRes vararg textResIds: Int) { textResIds.forEach { textResId -> Espresso.onView(ViewMatchers.withText(textResId)) .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) @@ -23,7 +23,7 @@ fun RobotAssertions.textDisplayed(@StringRes vararg textResIds: Int) { /** * Check if all [texts] are displayed. */ -fun RobotAssertions.textDisplayed(vararg texts: String) { +public fun RobotAssertions.textDisplayed(vararg texts: String) { texts.forEach { text -> Espresso.onView(ViewMatchers.withText(text)) .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) @@ -33,7 +33,7 @@ fun RobotAssertions.textDisplayed(vararg texts: String) { /** * Check if no views associated with [textResIds] is displayed. */ -fun RobotAssertions.textNotDisplayed(@StringRes vararg textResIds: Int) { +public fun RobotAssertions.textNotDisplayed(@StringRes vararg textResIds: Int) { textResIds.forEach { textResId -> Espresso.onView(ViewMatchers.withText(textResId)) .check(ViewAssertions.doesNotExist()) @@ -43,7 +43,7 @@ fun RobotAssertions.textNotDisplayed(@StringRes vararg textResIds: Int) { /** * Check if none of [texts] is displayed. */ -fun RobotAssertions.textNotDisplayed(vararg texts: String) { +public fun RobotAssertions.textNotDisplayed(vararg texts: String) { texts.forEach { text -> Espresso.onView(ViewMatchers.withText(text)) .check(ViewAssertions.doesNotExist()) @@ -53,7 +53,7 @@ fun RobotAssertions.textNotDisplayed(vararg texts: String) { /** * Check if the view associated with [viewId] has [expected] text. */ -fun RobotAssertions.viewHasText(@IdRes viewId: Int, expected: String) { +public fun RobotAssertions.viewHasText(@IdRes viewId: Int, expected: String) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(ViewMatchers.withText(expected))) } @@ -61,7 +61,7 @@ fun RobotAssertions.viewHasText(@IdRes viewId: Int, expected: String) { /** * Check if the view associated with [viewId] has string associated with [messageResId] text. */ -fun RobotAssertions.viewHasText(@IdRes viewId: Int, @StringRes messageResId: Int) { +public fun RobotAssertions.viewHasText(@IdRes viewId: Int, @StringRes messageResId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(ViewMatchers.withText(messageResId))) } @@ -69,7 +69,7 @@ fun RobotAssertions.viewHasText(@IdRes viewId: Int, @StringRes messageResId: Int /** * Check if the view associated with [viewId] has text that contains the [expected] string. */ -fun RobotAssertions.viewContainsText(@IdRes viewId: Int, expected: String) { +public fun RobotAssertions.viewContainsText(@IdRes viewId: Int, expected: String) { Espresso.onView(ViewMatchers.withId(viewId)) .check( ViewAssertions.matches(ViewMatchers.withText(StringContains.containsString(expected))) @@ -79,7 +79,7 @@ fun RobotAssertions.viewContainsText(@IdRes viewId: Int, expected: String) { /** * Check if the view associated with [viewId] has text that starts with the [expected] string. */ -fun RobotAssertions.viewStartsWithText(@IdRes viewId: Int, expected: String) { +public fun RobotAssertions.viewStartsWithText(@IdRes viewId: Int, expected: String) { Espresso.onView(ViewMatchers.withId(viewId)) .check( ViewAssertions.matches(ViewMatchers.withText(StringStartsWith.startsWith(expected))) @@ -89,7 +89,7 @@ fun RobotAssertions.viewStartsWithText(@IdRes viewId: Int, expected: String) { /** * Check if the view associated with [viewId] has text that ends with the [expected] string. */ -fun RobotAssertions.viewEndsWithText(@IdRes viewId: Int, expected: String) { +public fun RobotAssertions.viewEndsWithText(@IdRes viewId: Int, expected: String) { Espresso.onView(ViewMatchers.withId(viewId)) .check( ViewAssertions.matches(ViewMatchers.withText(StringEndsWith.endsWith(expected))) @@ -100,7 +100,7 @@ fun RobotAssertions.viewEndsWithText(@IdRes viewId: Int, expected: String) { * Check if the view associated with [viewId] * has a hint that equals to the string associated with [messageResId]. */ -fun RobotAssertions.viewHasHint(@IdRes viewId: Int, @StringRes messageResId: Int) { +public fun RobotAssertions.viewHasHint(@IdRes viewId: Int, @StringRes messageResId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(ViewMatchers.withHint(messageResId))) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/ToolbarRobotAssertions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/ToolbarRobotAssertions.kt index 1e07fdf2..3deb8bb4 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/ToolbarRobotAssertions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/ToolbarRobotAssertions.kt @@ -16,7 +16,7 @@ import reactivecircus.blueprint.testing.RobotAssertions /** * Check if the current [Toolbar] has a title of [title]. */ -fun RobotAssertions.toolbarHasTitle(title: String) { +public fun RobotAssertions.toolbarHasTitle(title: String) { Espresso.onView(ViewMatchers.isAssignableFrom(Toolbar::class.java)) .check(ViewAssertions.matches(withToolbarTitle(Is.`is`(title)))) } @@ -24,7 +24,7 @@ fun RobotAssertions.toolbarHasTitle(title: String) { /** * Check if the current [Toolbar] has a title of a string associated with [titleTextResId]. */ -fun RobotAssertions.toolbarHasTitle(@StringRes titleTextResId: Int) { +public fun RobotAssertions.toolbarHasTitle(@StringRes titleTextResId: Int) { Espresso.onView(ViewMatchers.isAssignableFrom(Toolbar::class.java)) .check( ViewAssertions.matches( @@ -42,7 +42,7 @@ fun RobotAssertions.toolbarHasTitle(@StringRes titleTextResId: Int) { /** * Check if the current [Toolbar] has a subtitle of [subtitle]. */ -fun RobotAssertions.toolbarHasSubtitle(subtitle: String) { +public fun RobotAssertions.toolbarHasSubtitle(subtitle: String) { Espresso.onView(ViewMatchers.isAssignableFrom(Toolbar::class.java)) .check(ViewAssertions.matches(withToolbarSubtitle(Is.`is`(subtitle)))) } @@ -51,7 +51,7 @@ fun RobotAssertions.toolbarHasSubtitle(subtitle: String) { * Check if the current [Toolbar] * has a subtitle of a string associated with [subtitleTextResId]. */ -fun RobotAssertions.toolbarHasSubtitle(@StringRes subtitleTextResId: Int) { +public fun RobotAssertions.toolbarHasSubtitle(@StringRes subtitleTextResId: Int) { Espresso.onView(ViewMatchers.isAssignableFrom(Toolbar::class.java)) .check( ViewAssertions.matches( diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/ViewRobotAssertions.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/ViewRobotAssertions.kt index dbb16b88..0af16460 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/ViewRobotAssertions.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/assertion/ViewRobotAssertions.kt @@ -11,7 +11,7 @@ import reactivecircus.blueprint.testing.RobotAssertions /** * Check if all views associated with [viewIds] are displayed. */ -fun RobotAssertions.viewDisplayed(@IdRes vararg viewIds: Int) { +public fun RobotAssertions.viewDisplayed(@IdRes vararg viewIds: Int) { viewIds.forEach { viewId -> Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(ViewMatchers.isDisplayed())) @@ -21,7 +21,7 @@ fun RobotAssertions.viewDisplayed(@IdRes vararg viewIds: Int) { /** * Check if all views associated with [viewIds] are NOT displayed. */ -fun RobotAssertions.viewNotDisplayed(@IdRes vararg viewIds: Int) { +public fun RobotAssertions.viewNotDisplayed(@IdRes vararg viewIds: Int) { viewIds.forEach { viewId -> Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(CoreMatchers.not(ViewMatchers.isDisplayed()))) @@ -31,7 +31,7 @@ fun RobotAssertions.viewNotDisplayed(@IdRes vararg viewIds: Int) { /** * Check if the view associated with [viewId] is enabled. */ -fun RobotAssertions.viewEnabled(@IdRes viewId: Int) { +public fun RobotAssertions.viewEnabled(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(ViewMatchers.isEnabled())) } @@ -39,7 +39,7 @@ fun RobotAssertions.viewEnabled(@IdRes viewId: Int) { /** * Check if the view associated with [viewId] is disabled. */ -fun RobotAssertions.viewDisabled(@IdRes viewId: Int) { +public fun RobotAssertions.viewDisabled(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(CoreMatchers.not(ViewMatchers.isEnabled()))) } @@ -47,7 +47,7 @@ fun RobotAssertions.viewDisabled(@IdRes viewId: Int) { /** * Check if the view associated with [viewId] is clickable. */ -fun RobotAssertions.viewClickable(@IdRes viewId: Int) { +public fun RobotAssertions.viewClickable(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(ViewMatchers.isClickable())) } @@ -55,7 +55,7 @@ fun RobotAssertions.viewClickable(@IdRes viewId: Int) { /** * Check if the view associated with [viewId] is NOT clickable. */ -fun RobotAssertions.viewNotClickable(@IdRes viewId: Int) { +public fun RobotAssertions.viewNotClickable(@IdRes viewId: Int) { Espresso.onView(ViewMatchers.withId(viewId)) .check(ViewAssertions.matches(CoreMatchers.not(ViewMatchers.isClickable()))) } diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/matcher/RecyclerViewMatcher.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/matcher/RecyclerViewMatcher.kt index ef9de3b0..1f1e2619 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/matcher/RecyclerViewMatcher.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/matcher/RecyclerViewMatcher.kt @@ -14,17 +14,17 @@ import org.hamcrest.TypeSafeMatcher /** * Returns a matcher that matches a view in the [RecyclerView] at certain position. */ -fun withRecyclerView(@IdRes recyclerViewId: Int): RecyclerViewMatcher { +public fun withRecyclerView(@IdRes recyclerViewId: Int): RecyclerViewMatcher { return RecyclerViewMatcher(recyclerViewId) } -class RecyclerViewMatcher(private val recyclerViewId: Int) { +public class RecyclerViewMatcher(private val recyclerViewId: Int) { - fun atPosition(position: Int): Matcher { + public fun atPosition(position: Int): Matcher { return atPositionOnView(position, -1) } - fun atPositionOnView(position: Int, targetViewId: Int): Matcher { + public fun atPositionOnView(position: Int, targetViewId: Int): Matcher { return object : TypeSafeMatcher() { var resources: Resources? = null diff --git a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/matcher/StringMatchers.kt b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/matcher/StringMatchers.kt index 3df638bc..3db2716b 100644 --- a/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/matcher/StringMatchers.kt +++ b/blueprint-testing-robot/src/main/kotlin/reactivecircus/blueprint/testing/matcher/StringMatchers.kt @@ -8,7 +8,7 @@ import java.util.Locale /** * Returns a matcher that matches string containing a subString (case insensitive). */ -fun containsIgnoringCase(subString: String): Matcher { +public fun containsIgnoringCase(subString: String): Matcher { return object : TypeSafeMatcher() { override fun matchesSafely(actualString: String): Boolean { diff --git a/blueprint-ui/build.gradle b/blueprint-ui/build.gradle index 2955eb18..2f6a0854 100644 --- a/blueprint-ui/build.gradle +++ b/blueprint-ui/build.gradle @@ -13,6 +13,15 @@ afterEvaluate { project -> } } +android { + kotlin.explicitApi = 'strict' + kotlinOptions { + freeCompilerArgs += [ + '-Xexplicit-api=strict', + ] + } +} + dependencies { // AndroidX implementation "androidx.appcompat:appcompat:${versions.androidx.appCompat}" diff --git a/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Activity.kt b/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Activity.kt index f12ab27f..eb617a27 100644 --- a/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Activity.kt +++ b/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Activity.kt @@ -12,7 +12,7 @@ import androidx.core.content.ContextCompat /** * Programmatically close soft keyboard. */ -fun Activity.hideKeyboard(focusedView: View) { +public fun Activity.hideKeyboard(focusedView: View) { val inputManager = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager inputManager.hideSoftInputFromWindow(focusedView.windowToken, 0) } @@ -20,7 +20,7 @@ fun Activity.hideKeyboard(focusedView: View) { /** * Programmatically show soft keyboard. */ -fun Activity.showKeyboard() { +public fun Activity.showKeyboard() { val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0) } @@ -28,7 +28,7 @@ fun Activity.showKeyboard() { /** * Shows status bar on the activity. */ -fun Activity.showStatusBar() { +public fun Activity.showStatusBar() { val decorView = window.decorView val uiOptions = View.SYSTEM_UI_FLAG_VISIBLE decorView.systemUiVisibility = uiOptions @@ -37,7 +37,7 @@ fun Activity.showStatusBar() { /** * Hides status bar from the activity. */ -fun Activity.hideStatusBar() { +public fun Activity.hideStatusBar() { val decorView = window.decorView val uiOptions = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN @@ -52,7 +52,7 @@ fun Activity.hideStatusBar() { * @param lightBackground whether to draw the status bar such that. * it is compatible with a light status bar background. */ -fun Activity.setStatusBarColor( +public fun Activity.setStatusBarColor( @ColorRes colorRes: Int, lightBackground: Boolean = false ) { @@ -69,7 +69,7 @@ fun Activity.setStatusBarColor( /** * Returns screen size of the activity. */ -val Activity.screenSize: DisplayMetrics +public val Activity.screenSize: DisplayMetrics get() { val display = windowManager.defaultDisplay val metrics = DisplayMetrics() diff --git a/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/AppCompat.kt b/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/AppCompat.kt index c5e5f81e..dc3523d7 100644 --- a/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/AppCompat.kt +++ b/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/AppCompat.kt @@ -12,7 +12,7 @@ import java.util.concurrent.Executor * @param executor the executor to be used for processing the text layout. * Default single threaded pool will be used if null is passed in. */ -fun AppCompatTextView.setPrecomputedTextFuture( +public fun AppCompatTextView.setPrecomputedTextFuture( charSequence: CharSequence, executor: Executor? = null ) { diff --git a/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Context.kt b/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Context.kt index bc9331ae..5ba67336 100644 --- a/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Context.kt +++ b/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Context.kt @@ -15,7 +15,7 @@ import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat /** * Apply tinting to a vector drawable. */ -fun Context.tintVectorDrawable( +public fun Context.tintVectorDrawable( theme: Resources.Theme, @DrawableRes resId: Int, @ColorInt tint: Int @@ -31,7 +31,7 @@ fun Context.tintVectorDrawable( * Resolves the given color attribute and returns the resource ID associated with the color. */ @ColorInt -fun Context.resolveColorAttr(@AttrRes colorAttr: Int): Int { +public fun Context.resolveColorAttr(@AttrRes colorAttr: Int): Int { val resolvedAttr = TypedValue() theme.resolveAttribute(colorAttr, resolvedAttr, true) // resourceId is used if it's a ColorStateList, and data if it's a color reference or a hex color @@ -42,7 +42,7 @@ fun Context.resolveColorAttr(@AttrRes colorAttr: Int): Int { /** * Whether animation is turned on on the device. */ -val Context.isAnimationOn: Boolean +public val Context.isAnimationOn: Boolean get() = Settings.Global.getFloat( contentResolver, Settings.Global.ANIMATOR_DURATION_SCALE, diff --git a/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Intent.kt b/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Intent.kt index 822dd6e6..595b81b8 100644 --- a/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Intent.kt +++ b/blueprint-ui/src/main/kotlin/reactivecircus/blueprint/ui/extension/Intent.kt @@ -10,7 +10,7 @@ import android.os.Bundle * @param requestCode - the requestCode to be passed into [Activity.startActivityForResult] * @param options - the options bundle to be passed into [Activity.startActivityForResult] */ -inline fun Activity.launchActivity( +public inline fun Activity.launchActivity( requestCode: Int, options: Bundle? = null, noinline init: Intent.() -> Unit = {} @@ -24,7 +24,7 @@ inline fun Activity.launchActivity( * Launches an activity from a [Context] via [Activity.startActivity]. * @param options - the options bundle to be passed into [Activity.startActivity] */ -inline fun Context.launchActivity( +public inline fun Context.launchActivity( options: Bundle? = null, noinline init: Intent.() -> Unit = {} ) { @@ -36,5 +36,5 @@ inline fun Context.launchActivity( /** * Creates a new intent of type [T]. */ -inline fun newIntent(context: Context): Intent = +public inline fun newIntent(context: Context): Intent = Intent(context, T::class.java)