[go: nahoru, domu]

Merge "Fold MotionEventUtil into the one file using it." into androidx-master-dev
diff --git a/ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/core/AndroidPointerInputTest.kt b/ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/core/AndroidPointerInputTest.kt
index 3bb68b2..b90cb86 100644
--- a/ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/core/AndroidPointerInputTest.kt
+++ b/ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/core/AndroidPointerInputTest.kt
@@ -33,8 +33,8 @@
 import androidx.test.filters.SmallTest
 import androidx.ui.core.pointerinput.PointerInputFilter
 import androidx.ui.core.pointerinput.PointerInputModifier
-import androidx.ui.testutils.down
 import androidx.ui.geometry.Offset
+import androidx.ui.testutils.down
 import androidx.ui.unit.IntSize
 import androidx.ui.unit.milliseconds
 import androidx.ui.viewinterop.AndroidView
@@ -347,6 +347,7 @@
     }
 }
 
+@Suppress("TestFunctionName")
 @Composable
 fun AndroidWithCompose(context: Context, androidPadding: Int, children: @Composable () -> Unit) {
     val anotherLayout = FrameLayout(context).also { view ->
@@ -431,17 +432,54 @@
     override fun onCancel() {}
 }
 
+@Suppress("TestFunctionName")
 @Composable
-fun FillLayout(modifier: Modifier = Modifier) {
+private fun FillLayout(modifier: Modifier = Modifier) {
     Layout(emptyContent(), modifier) { _, constraints ->
         layout(constraints.maxWidth, constraints.maxHeight) {}
     }
 }
 
-fun countDown(block: (CountDownLatch) -> Unit) {
+private fun countDown(block: (CountDownLatch) -> Unit) {
     val countDownLatch = CountDownLatch(1)
     block(countDownLatch)
     assertThat(countDownLatch.await(1, TimeUnit.SECONDS)).isTrue()
 }
 
 class AndroidPointerInputTestActivity : ComponentActivity()
+
+@Suppress("SameParameterValue", "TestFunctionName")
+private fun MotionEvent(
+    eventTime: Int,
+    action: Int,
+    numPointers: Int,
+    actionIndex: Int,
+    pointerProperties: Array<MotionEvent.PointerProperties>,
+    pointerCoords: Array<MotionEvent.PointerCoords>
+) = MotionEvent.obtain(
+    0,
+    eventTime.toLong(),
+    action + (actionIndex shl MotionEvent.ACTION_POINTER_INDEX_SHIFT),
+    numPointers,
+    pointerProperties,
+    pointerCoords,
+    0,
+    0,
+    0f,
+    0f,
+    0,
+    0,
+    0,
+    0
+)
+
+@Suppress("SameParameterValue", "TestFunctionName")
+private fun PointerProperties(id: Int) =
+    MotionEvent.PointerProperties().apply { this.id = id }
+
+@Suppress("SameParameterValue", "TestFunctionName")
+private fun PointerCoords(x: Float, y: Float) =
+    MotionEvent.PointerCoords().apply {
+        this.x = x
+        this.y = y
+    }
diff --git a/ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/core/MotionEventUtil.kt b/ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/core/MotionEventUtil.kt
deleted file mode 100644
index 66852ac..0000000
--- a/ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/core/MotionEventUtil.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.ui.core
-
-import android.view.MotionEvent
-
-internal fun MotionEvent(
-    eventTime: Int,
-    action: Int,
-    numPointers: Int,
-    actionIndex: Int,
-    pointerProperties: Array<MotionEvent.PointerProperties>,
-    pointerCoords: Array<MotionEvent.PointerCoords>
-) = MotionEvent.obtain(
-    0,
-    eventTime.toLong(),
-    action + (actionIndex shl MotionEvent.ACTION_POINTER_INDEX_SHIFT),
-    numPointers,
-    pointerProperties,
-    pointerCoords,
-    0,
-    0,
-    0f,
-    0f,
-    0,
-    0,
-    0,
-    0
-)
-
-internal fun PointerProperties(id: Int) =
-    MotionEvent.PointerProperties().apply { this.id = id }
-
-internal fun PointerCoords(x: Float, y: Float) =
-    MotionEvent.PointerCoords().apply {
-        this.x = x
-        this.y = y
-    }
\ No newline at end of file