[go: nahoru, domu]

Add Experimental annotation to material and mark RippleTheme with it.

During API scrub we realised that RippleTheme and API around it might change and it should be experimental.

I've added @ExperimentalMaterialApi annotation and accordingly marked few APIs

Relnote: Added ExperimentalMaterialApi annotation. RippleTheme marked as Experimental
Bug: 161784800
Test: compiles
Change-Id: Ic5fa0382a2f4453e46e0793034d865e9182ec6ba
diff --git a/ui/ui-material/api/0.1.0-dev16.txt b/ui/ui-material/api/0.1.0-dev16.txt
index c07ad46..a017899 100644
--- a/ui/ui-material/api/0.1.0-dev16.txt
+++ b/ui/ui-material/api/0.1.0-dev16.txt
@@ -141,6 +141,9 @@
     property public abstract androidx.ui.material.Emphasis medium;
   }
 
+  @kotlin.RequiresOptIn(message="This material API is experimental and is likely to change or to be removed in" + " the future.") public @interface ExperimentalMaterialApi {
+  }
+
   public final class FloatingActionButtonKt {
     method @androidx.compose.Composable public static void ExtendedFloatingActionButton-r9QhOOE(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), long backgroundColor = MaterialTheme.colors.secondary, long contentColor = contentColorFor(backgroundColor), float elevation = 6.dp);
     method @androidx.compose.Composable public static void FloatingActionButton-rf6Y9PE(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), long backgroundColor = MaterialTheme.colors.secondary, long contentColor = contentColorFor(backgroundColor), float elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> icon);
@@ -375,11 +378,11 @@
     method @androidx.compose.Composable public static androidx.ui.material.ripple.RippleIndication RippleIndication-XC6LiZk(boolean bounded = true, androidx.ui.unit.Dp? radius = null, long color = Color.Unset);
   }
 
-  public interface RippleOpacity {
+  @androidx.ui.material.ExperimentalMaterialApi public interface RippleOpacity {
     method public float opacityForInteraction(androidx.compose.foundation.Interaction interaction);
   }
 
-  public interface RippleTheme {
+  @androidx.ui.material.ExperimentalMaterialApi public interface RippleTheme {
     method @androidx.compose.Composable public long defaultColor();
     method @androidx.compose.Composable public androidx.ui.material.ripple.RippleOpacity rippleOpacity();
   }
diff --git a/ui/ui-material/api/current.txt b/ui/ui-material/api/current.txt
index c07ad46..a017899 100644
--- a/ui/ui-material/api/current.txt
+++ b/ui/ui-material/api/current.txt
@@ -141,6 +141,9 @@
     property public abstract androidx.ui.material.Emphasis medium;
   }
 
+  @kotlin.RequiresOptIn(message="This material API is experimental and is likely to change or to be removed in" + " the future.") public @interface ExperimentalMaterialApi {
+  }
+
   public final class FloatingActionButtonKt {
     method @androidx.compose.Composable public static void ExtendedFloatingActionButton-r9QhOOE(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), long backgroundColor = MaterialTheme.colors.secondary, long contentColor = contentColorFor(backgroundColor), float elevation = 6.dp);
     method @androidx.compose.Composable public static void FloatingActionButton-rf6Y9PE(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), long backgroundColor = MaterialTheme.colors.secondary, long contentColor = contentColorFor(backgroundColor), float elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> icon);
@@ -375,11 +378,11 @@
     method @androidx.compose.Composable public static androidx.ui.material.ripple.RippleIndication RippleIndication-XC6LiZk(boolean bounded = true, androidx.ui.unit.Dp? radius = null, long color = Color.Unset);
   }
 
-  public interface RippleOpacity {
+  @androidx.ui.material.ExperimentalMaterialApi public interface RippleOpacity {
     method public float opacityForInteraction(androidx.compose.foundation.Interaction interaction);
   }
 
-  public interface RippleTheme {
+  @androidx.ui.material.ExperimentalMaterialApi public interface RippleTheme {
     method @androidx.compose.Composable public long defaultColor();
     method @androidx.compose.Composable public androidx.ui.material.ripple.RippleOpacity rippleOpacity();
   }
diff --git a/ui/ui-material/api/public_plus_experimental_0.1.0-dev16.txt b/ui/ui-material/api/public_plus_experimental_0.1.0-dev16.txt
index c07ad46..a017899 100644
--- a/ui/ui-material/api/public_plus_experimental_0.1.0-dev16.txt
+++ b/ui/ui-material/api/public_plus_experimental_0.1.0-dev16.txt
@@ -141,6 +141,9 @@
     property public abstract androidx.ui.material.Emphasis medium;
   }
 
+  @kotlin.RequiresOptIn(message="This material API is experimental and is likely to change or to be removed in" + " the future.") public @interface ExperimentalMaterialApi {
+  }
+
   public final class FloatingActionButtonKt {
     method @androidx.compose.Composable public static void ExtendedFloatingActionButton-r9QhOOE(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), long backgroundColor = MaterialTheme.colors.secondary, long contentColor = contentColorFor(backgroundColor), float elevation = 6.dp);
     method @androidx.compose.Composable public static void FloatingActionButton-rf6Y9PE(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), long backgroundColor = MaterialTheme.colors.secondary, long contentColor = contentColorFor(backgroundColor), float elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> icon);
@@ -375,11 +378,11 @@
     method @androidx.compose.Composable public static androidx.ui.material.ripple.RippleIndication RippleIndication-XC6LiZk(boolean bounded = true, androidx.ui.unit.Dp? radius = null, long color = Color.Unset);
   }
 
-  public interface RippleOpacity {
+  @androidx.ui.material.ExperimentalMaterialApi public interface RippleOpacity {
     method public float opacityForInteraction(androidx.compose.foundation.Interaction interaction);
   }
 
-  public interface RippleTheme {
+  @androidx.ui.material.ExperimentalMaterialApi public interface RippleTheme {
     method @androidx.compose.Composable public long defaultColor();
     method @androidx.compose.Composable public androidx.ui.material.ripple.RippleOpacity rippleOpacity();
   }
diff --git a/ui/ui-material/api/public_plus_experimental_current.txt b/ui/ui-material/api/public_plus_experimental_current.txt
index c07ad46..a017899 100644
--- a/ui/ui-material/api/public_plus_experimental_current.txt
+++ b/ui/ui-material/api/public_plus_experimental_current.txt
@@ -141,6 +141,9 @@
     property public abstract androidx.ui.material.Emphasis medium;
   }
 
+  @kotlin.RequiresOptIn(message="This material API is experimental and is likely to change or to be removed in" + " the future.") public @interface ExperimentalMaterialApi {
+  }
+
   public final class FloatingActionButtonKt {
     method @androidx.compose.Composable public static void ExtendedFloatingActionButton-r9QhOOE(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), long backgroundColor = MaterialTheme.colors.secondary, long contentColor = contentColorFor(backgroundColor), float elevation = 6.dp);
     method @androidx.compose.Composable public static void FloatingActionButton-rf6Y9PE(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), long backgroundColor = MaterialTheme.colors.secondary, long contentColor = contentColorFor(backgroundColor), float elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> icon);
@@ -375,11 +378,11 @@
     method @androidx.compose.Composable public static androidx.ui.material.ripple.RippleIndication RippleIndication-XC6LiZk(boolean bounded = true, androidx.ui.unit.Dp? radius = null, long color = Color.Unset);
   }
 
-  public interface RippleOpacity {
+  @androidx.ui.material.ExperimentalMaterialApi public interface RippleOpacity {
     method public float opacityForInteraction(androidx.compose.foundation.Interaction interaction);
   }
 
-  public interface RippleTheme {
+  @androidx.ui.material.ExperimentalMaterialApi public interface RippleTheme {
     method @androidx.compose.Composable public long defaultColor();
     method @androidx.compose.Composable public androidx.ui.material.ripple.RippleOpacity rippleOpacity();
   }
diff --git a/ui/ui-material/api/restricted_0.1.0-dev16.txt b/ui/ui-material/api/restricted_0.1.0-dev16.txt
index 038854a..1d5b4f0 100644
--- a/ui/ui-material/api/restricted_0.1.0-dev16.txt
+++ b/ui/ui-material/api/restricted_0.1.0-dev16.txt
@@ -142,6 +142,9 @@
     property public abstract androidx.ui.material.Emphasis medium;
   }
 
+  @kotlin.RequiresOptIn(message="This material API is experimental and is likely to change or to be removed in" + " the future.") public @interface ExperimentalMaterialApi {
+  }
+
   public final class FloatingActionButtonKt {
     method @androidx.compose.Composable public static void ExtendedFloatingActionButton-r9QhOOE(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), long backgroundColor = MaterialTheme.colors.secondary, long contentColor = contentColorFor(backgroundColor), float elevation = 6.dp);
     method @androidx.compose.Composable public static void FloatingActionButton-rf6Y9PE(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), long backgroundColor = MaterialTheme.colors.secondary, long contentColor = contentColorFor(backgroundColor), float elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> icon);
@@ -376,11 +379,11 @@
     method @androidx.compose.Composable public static androidx.ui.material.ripple.RippleIndication RippleIndication-XC6LiZk(boolean bounded = true, androidx.ui.unit.Dp? radius = null, long color = Color.Unset);
   }
 
-  public interface RippleOpacity {
+  @androidx.ui.material.ExperimentalMaterialApi public interface RippleOpacity {
     method public float opacityForInteraction(androidx.compose.foundation.Interaction interaction);
   }
 
-  public interface RippleTheme {
+  @androidx.ui.material.ExperimentalMaterialApi public interface RippleTheme {
     method @androidx.compose.Composable public long defaultColor();
     method @androidx.compose.Composable public androidx.ui.material.ripple.RippleOpacity rippleOpacity();
   }
diff --git a/ui/ui-material/api/restricted_current.txt b/ui/ui-material/api/restricted_current.txt
index 038854a..1d5b4f0 100644
--- a/ui/ui-material/api/restricted_current.txt
+++ b/ui/ui-material/api/restricted_current.txt
@@ -142,6 +142,9 @@
     property public abstract androidx.ui.material.Emphasis medium;
   }
 
+  @kotlin.RequiresOptIn(message="This material API is experimental and is likely to change or to be removed in" + " the future.") public @interface ExperimentalMaterialApi {
+  }
+
   public final class FloatingActionButtonKt {
     method @androidx.compose.Composable public static void ExtendedFloatingActionButton-r9QhOOE(kotlin.jvm.functions.Function0<kotlin.Unit> text, kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier, kotlin.jvm.functions.Function0<kotlin.Unit>? icon = null, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), long backgroundColor = MaterialTheme.colors.secondary, long contentColor = contentColorFor(backgroundColor), float elevation = 6.dp);
     method @androidx.compose.Composable public static void FloatingActionButton-rf6Y9PE(kotlin.jvm.functions.Function0<kotlin.Unit> onClick, androidx.ui.core.Modifier modifier = Modifier, androidx.ui.graphics.Shape shape = MaterialTheme.shapes.small.copy(CornerSize(50)), long backgroundColor = MaterialTheme.colors.secondary, long contentColor = contentColorFor(backgroundColor), float elevation = 6.dp, kotlin.jvm.functions.Function0<kotlin.Unit> icon);
@@ -376,11 +379,11 @@
     method @androidx.compose.Composable public static androidx.ui.material.ripple.RippleIndication RippleIndication-XC6LiZk(boolean bounded = true, androidx.ui.unit.Dp? radius = null, long color = Color.Unset);
   }
 
-  public interface RippleOpacity {
+  @androidx.ui.material.ExperimentalMaterialApi public interface RippleOpacity {
     method public float opacityForInteraction(androidx.compose.foundation.Interaction interaction);
   }
 
-  public interface RippleTheme {
+  @androidx.ui.material.ExperimentalMaterialApi public interface RippleTheme {
     method @androidx.compose.Composable public long defaultColor();
     method @androidx.compose.Composable public androidx.ui.material.ripple.RippleOpacity rippleOpacity();
   }
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
index 093aa7c..90b4b94 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
@@ -43,6 +43,7 @@
 import androidx.compose.foundation.layout.padding
 import androidx.compose.foundation.layout.preferredHeight
 import androidx.compose.foundation.layout.preferredWidth
+import androidx.ui.material.ExperimentalMaterialApi
 import androidx.ui.material.GOLDEN_MATERIAL
 import androidx.ui.material.MaterialTheme
 import androidx.ui.material.Surface
@@ -64,6 +65,7 @@
 @LargeTest
 @RunWith(JUnit4::class)
 @SdkSuppress(minSdkVersion = Build.VERSION_CODES.O)
+@OptIn(ExperimentalMaterialApi::class)
 class RippleIndicationTest {
 
     @get:Rule
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ExperimentalMaterialApi.kt b/ui/ui-material/src/main/java/androidx/ui/material/ExperimentalMaterialApi.kt
new file mode 100644
index 0000000..c15a347
--- /dev/null
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ExperimentalMaterialApi.kt
@@ -0,0 +1,21 @@
+/*
+ * 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.material
+
+@RequiresOptIn("This material API is experimental and is likely to change or to be removed in" +
+        " the future.")
+annotation class ExperimentalMaterialApi
\ No newline at end of file
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleIndication.kt b/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleIndication.kt
index 3a96575..0ed6acd 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleIndication.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleIndication.kt
@@ -41,6 +41,7 @@
 import androidx.ui.graphics.drawscope.DrawScope
 import androidx.ui.graphics.drawscope.clipRect
 import androidx.ui.graphics.useOrElse
+import androidx.ui.material.ExperimentalMaterialApi
 import androidx.ui.material.MaterialTheme
 import androidx.ui.unit.Dp
 import androidx.ui.util.fastForEach
@@ -69,6 +70,7 @@
  * [RippleTheme.defaultColor]. This color will then have [RippleTheme.rippleOpacity] applied
  */
 @Composable
+@OptIn(ExperimentalMaterialApi::class)
 fun RippleIndication(
     bounded: Boolean = true,
     radius: Dp? = null,
@@ -100,6 +102,7 @@
  * customize its appearance.
  */
 @Stable
+@OptIn(ExperimentalMaterialApi::class)
 class RippleIndication internal constructor(
     private val bounded: Boolean,
     private val radius: Dp? = null,
@@ -138,6 +141,7 @@
     }
 }
 
+@OptIn(ExperimentalMaterialApi::class)
 private class RippleIndicationInstance internal constructor(
     private val bounded: Boolean,
     private val radius: Dp? = null,
@@ -211,6 +215,7 @@
     }
 }
 
+@OptIn(ExperimentalMaterialApi::class)
 private class StateLayer(
     clock: AnimationClockObservable,
     private val bounded: Boolean,
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleTheme.kt b/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleTheme.kt
index bd0e730..ceae984 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleTheme.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleTheme.kt
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+@file:OptIn(ExperimentalMaterialApi::class)
 
 package androidx.ui.material.ripple
 
@@ -22,6 +23,7 @@
 import androidx.compose.foundation.contentColor
 import androidx.ui.graphics.Color
 import androidx.ui.graphics.luminance
+import androidx.ui.material.ExperimentalMaterialApi
 import androidx.ui.material.MaterialTheme
 
 /**
@@ -29,6 +31,7 @@
  *
  * You can define a new theme and apply it via [RippleThemeAmbient].
  */
+@ExperimentalMaterialApi
 interface RippleTheme {
     /**
      * @return the default [RippleIndication] color at the call site's position in the hierarchy.
@@ -50,6 +53,7 @@
 /**
  * RippleOpacity defines the opacity of the ripple / state layer for a given [Interaction].
  */
+@ExperimentalMaterialApi
 interface RippleOpacity {
     /**
      * @return the opacity of the ripple for the given [interaction]. Return `0f` if this
@@ -61,6 +65,7 @@
 /**
  * Ambient used for providing [RippleTheme] down the tree.
  */
+@ExperimentalMaterialApi
 val RippleThemeAmbient = staticAmbientOf<RippleTheme> { DefaultRippleTheme }
 
 private object DefaultRippleTheme : RippleTheme {