[go: nahoru, domu]

Create an interface for layouts that can be opened

Create a common interface that represents layouts
that have two states: open and closed. This allows
higher level libraries to rely on the interface,
rather than concrete implementations such as
DrawerLayout, making them more resilient to
changes in the current recommended implementation.

Fixes: 129979320
Test: ./gradlew checkApi
Change-Id: I0f2a1414977825aa053c6555261f2b7d4417bd19
diff --git a/customview/customview/api/1.1.0-alpha02.txt b/customview/customview/api/1.1.0-alpha02.txt
index c7614cd..82c4509 100644
--- a/customview/customview/api/1.1.0-alpha02.txt
+++ b/customview/customview/api/1.1.0-alpha02.txt
@@ -42,6 +42,12 @@
     field public static final int INVALID_ID = -2147483648; // 0x80000000
   }
 
+  public interface Openable {
+    method public void close();
+    method public boolean isOpen();
+    method public void open();
+  }
+
   public class ViewDragHelper {
     method public void abort();
     method protected boolean canScroll(android.view.View, boolean, int, int, int, int);
diff --git a/customview/customview/api/current.txt b/customview/customview/api/current.txt
index c7614cd..82c4509 100644
--- a/customview/customview/api/current.txt
+++ b/customview/customview/api/current.txt
@@ -42,6 +42,12 @@
     field public static final int INVALID_ID = -2147483648; // 0x80000000
   }
 
+  public interface Openable {
+    method public void close();
+    method public boolean isOpen();
+    method public void open();
+  }
+
   public class ViewDragHelper {
     method public void abort();
     method protected boolean canScroll(android.view.View, boolean, int, int, int, int);
diff --git a/customview/customview/api/public_plus_experimental_1.1.0-alpha02.txt b/customview/customview/api/public_plus_experimental_1.1.0-alpha02.txt
index c7614cd..82c4509 100644
--- a/customview/customview/api/public_plus_experimental_1.1.0-alpha02.txt
+++ b/customview/customview/api/public_plus_experimental_1.1.0-alpha02.txt
@@ -42,6 +42,12 @@
     field public static final int INVALID_ID = -2147483648; // 0x80000000
   }
 
+  public interface Openable {
+    method public void close();
+    method public boolean isOpen();
+    method public void open();
+  }
+
   public class ViewDragHelper {
     method public void abort();
     method protected boolean canScroll(android.view.View, boolean, int, int, int, int);
diff --git a/customview/customview/api/public_plus_experimental_current.txt b/customview/customview/api/public_plus_experimental_current.txt
index c7614cd..82c4509 100644
--- a/customview/customview/api/public_plus_experimental_current.txt
+++ b/customview/customview/api/public_plus_experimental_current.txt
@@ -42,6 +42,12 @@
     field public static final int INVALID_ID = -2147483648; // 0x80000000
   }
 
+  public interface Openable {
+    method public void close();
+    method public boolean isOpen();
+    method public void open();
+  }
+
   public class ViewDragHelper {
     method public void abort();
     method protected boolean canScroll(android.view.View, boolean, int, int, int, int);
diff --git a/customview/customview/api/restricted_1.1.0-alpha02.txt b/customview/customview/api/restricted_1.1.0-alpha02.txt
index c7614cd..82c4509 100644
--- a/customview/customview/api/restricted_1.1.0-alpha02.txt
+++ b/customview/customview/api/restricted_1.1.0-alpha02.txt
@@ -42,6 +42,12 @@
     field public static final int INVALID_ID = -2147483648; // 0x80000000
   }
 
+  public interface Openable {
+    method public void close();
+    method public boolean isOpen();
+    method public void open();
+  }
+
   public class ViewDragHelper {
     method public void abort();
     method protected boolean canScroll(android.view.View, boolean, int, int, int, int);
diff --git a/customview/customview/api/restricted_current.txt b/customview/customview/api/restricted_current.txt
index c7614cd..82c4509 100644
--- a/customview/customview/api/restricted_current.txt
+++ b/customview/customview/api/restricted_current.txt
@@ -42,6 +42,12 @@
     field public static final int INVALID_ID = -2147483648; // 0x80000000
   }
 
+  public interface Openable {
+    method public void close();
+    method public boolean isOpen();
+    method public void open();
+  }
+
   public class ViewDragHelper {
     method public void abort();
     method protected boolean canScroll(android.view.View, boolean, int, int, int, int);
diff --git a/customview/customview/src/main/java/androidx/customview/widget/Openable.java b/customview/customview/src/main/java/androidx/customview/widget/Openable.java
new file mode 100644
index 0000000..067b8cc
--- /dev/null
+++ b/customview/customview/src/main/java/androidx/customview/widget/Openable.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2019 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.customview.widget;
+
+/**
+ * A layout that has two states: opened and closed.
+ */
+public interface Openable {
+
+    /**
+     * Check if the layout is currently in the opened state.
+     *
+     * @return true if the layout's state is considered opened.
+     */
+    boolean isOpen();
+
+    /**
+     * Move the layout to the opened state.
+     */
+    void open();
+
+    /**
+     * Move the layout to the closed state.
+     */
+    void close();
+}
diff --git a/drawerlayout/drawerlayout/api/1.1.0-alpha03.txt b/drawerlayout/drawerlayout/api/1.1.0-alpha03.txt
index a293794..5b202b5 100644
--- a/drawerlayout/drawerlayout/api/1.1.0-alpha03.txt
+++ b/drawerlayout/drawerlayout/api/1.1.0-alpha03.txt
@@ -1,11 +1,12 @@
 // Signature format: 3.0
 package androidx.drawerlayout.widget {
 
-  public class DrawerLayout extends android.view.ViewGroup {
+  public class DrawerLayout extends android.view.ViewGroup implements androidx.customview.widget.Openable {
     ctor public DrawerLayout(android.content.Context);
     ctor public DrawerLayout(android.content.Context, android.util.AttributeSet?);
     ctor public DrawerLayout(android.content.Context, android.util.AttributeSet?, int);
     method public void addDrawerListener(androidx.drawerlayout.widget.DrawerLayout.DrawerListener);
+    method public void close();
     method public void closeDrawer(android.view.View);
     method public void closeDrawer(android.view.View, boolean);
     method public void closeDrawer(int);
@@ -20,7 +21,9 @@
     method public boolean isDrawerOpen(int);
     method public boolean isDrawerVisible(android.view.View);
     method public boolean isDrawerVisible(int);
+    method public boolean isOpen();
     method public void onDraw(android.graphics.Canvas!);
+    method public void open();
     method public void openDrawer(android.view.View);
     method public void openDrawer(android.view.View, boolean);
     method public void openDrawer(int);
diff --git a/drawerlayout/drawerlayout/api/current.txt b/drawerlayout/drawerlayout/api/current.txt
index a293794..5b202b5 100644
--- a/drawerlayout/drawerlayout/api/current.txt
+++ b/drawerlayout/drawerlayout/api/current.txt
@@ -1,11 +1,12 @@
 // Signature format: 3.0
 package androidx.drawerlayout.widget {
 
-  public class DrawerLayout extends android.view.ViewGroup {
+  public class DrawerLayout extends android.view.ViewGroup implements androidx.customview.widget.Openable {
     ctor public DrawerLayout(android.content.Context);
     ctor public DrawerLayout(android.content.Context, android.util.AttributeSet?);
     ctor public DrawerLayout(android.content.Context, android.util.AttributeSet?, int);
     method public void addDrawerListener(androidx.drawerlayout.widget.DrawerLayout.DrawerListener);
+    method public void close();
     method public void closeDrawer(android.view.View);
     method public void closeDrawer(android.view.View, boolean);
     method public void closeDrawer(int);
@@ -20,7 +21,9 @@
     method public boolean isDrawerOpen(int);
     method public boolean isDrawerVisible(android.view.View);
     method public boolean isDrawerVisible(int);
+    method public boolean isOpen();
     method public void onDraw(android.graphics.Canvas!);
+    method public void open();
     method public void openDrawer(android.view.View);
     method public void openDrawer(android.view.View, boolean);
     method public void openDrawer(int);
diff --git a/drawerlayout/drawerlayout/api/public_plus_experimental_1.1.0-alpha03.txt b/drawerlayout/drawerlayout/api/public_plus_experimental_1.1.0-alpha03.txt
index a293794..5b202b5 100644
--- a/drawerlayout/drawerlayout/api/public_plus_experimental_1.1.0-alpha03.txt
+++ b/drawerlayout/drawerlayout/api/public_plus_experimental_1.1.0-alpha03.txt
@@ -1,11 +1,12 @@
 // Signature format: 3.0
 package androidx.drawerlayout.widget {
 
-  public class DrawerLayout extends android.view.ViewGroup {
+  public class DrawerLayout extends android.view.ViewGroup implements androidx.customview.widget.Openable {
     ctor public DrawerLayout(android.content.Context);
     ctor public DrawerLayout(android.content.Context, android.util.AttributeSet?);
     ctor public DrawerLayout(android.content.Context, android.util.AttributeSet?, int);
     method public void addDrawerListener(androidx.drawerlayout.widget.DrawerLayout.DrawerListener);
+    method public void close();
     method public void closeDrawer(android.view.View);
     method public void closeDrawer(android.view.View, boolean);
     method public void closeDrawer(int);
@@ -20,7 +21,9 @@
     method public boolean isDrawerOpen(int);
     method public boolean isDrawerVisible(android.view.View);
     method public boolean isDrawerVisible(int);
+    method public boolean isOpen();
     method public void onDraw(android.graphics.Canvas!);
+    method public void open();
     method public void openDrawer(android.view.View);
     method public void openDrawer(android.view.View, boolean);
     method public void openDrawer(int);
diff --git a/drawerlayout/drawerlayout/api/public_plus_experimental_current.txt b/drawerlayout/drawerlayout/api/public_plus_experimental_current.txt
index a293794..5b202b5 100644
--- a/drawerlayout/drawerlayout/api/public_plus_experimental_current.txt
+++ b/drawerlayout/drawerlayout/api/public_plus_experimental_current.txt
@@ -1,11 +1,12 @@
 // Signature format: 3.0
 package androidx.drawerlayout.widget {
 
-  public class DrawerLayout extends android.view.ViewGroup {
+  public class DrawerLayout extends android.view.ViewGroup implements androidx.customview.widget.Openable {
     ctor public DrawerLayout(android.content.Context);
     ctor public DrawerLayout(android.content.Context, android.util.AttributeSet?);
     ctor public DrawerLayout(android.content.Context, android.util.AttributeSet?, int);
     method public void addDrawerListener(androidx.drawerlayout.widget.DrawerLayout.DrawerListener);
+    method public void close();
     method public void closeDrawer(android.view.View);
     method public void closeDrawer(android.view.View, boolean);
     method public void closeDrawer(int);
@@ -20,7 +21,9 @@
     method public boolean isDrawerOpen(int);
     method public boolean isDrawerVisible(android.view.View);
     method public boolean isDrawerVisible(int);
+    method public boolean isOpen();
     method public void onDraw(android.graphics.Canvas!);
+    method public void open();
     method public void openDrawer(android.view.View);
     method public void openDrawer(android.view.View, boolean);
     method public void openDrawer(int);
diff --git a/drawerlayout/drawerlayout/api/restricted_1.1.0-alpha03.txt b/drawerlayout/drawerlayout/api/restricted_1.1.0-alpha03.txt
index f6fef7e..e6d4605 100644
--- a/drawerlayout/drawerlayout/api/restricted_1.1.0-alpha03.txt
+++ b/drawerlayout/drawerlayout/api/restricted_1.1.0-alpha03.txt
@@ -1,11 +1,12 @@
 // Signature format: 3.0
 package androidx.drawerlayout.widget {
 
-  public class DrawerLayout extends android.view.ViewGroup {
+  public class DrawerLayout extends android.view.ViewGroup implements androidx.customview.widget.Openable {
     ctor public DrawerLayout(android.content.Context);
     ctor public DrawerLayout(android.content.Context, android.util.AttributeSet?);
     ctor public DrawerLayout(android.content.Context, android.util.AttributeSet?, int);
     method public void addDrawerListener(androidx.drawerlayout.widget.DrawerLayout.DrawerListener);
+    method public void close();
     method public void closeDrawer(android.view.View);
     method public void closeDrawer(android.view.View, boolean);
     method public void closeDrawer(int);
@@ -20,7 +21,9 @@
     method public boolean isDrawerOpen(int);
     method public boolean isDrawerVisible(android.view.View);
     method public boolean isDrawerVisible(int);
+    method public boolean isOpen();
     method public void onDraw(android.graphics.Canvas!);
+    method public void open();
     method public void openDrawer(android.view.View);
     method public void openDrawer(android.view.View, boolean);
     method public void openDrawer(int);
diff --git a/drawerlayout/drawerlayout/api/restricted_current.txt b/drawerlayout/drawerlayout/api/restricted_current.txt
index f6fef7e..e6d4605 100644
--- a/drawerlayout/drawerlayout/api/restricted_current.txt
+++ b/drawerlayout/drawerlayout/api/restricted_current.txt
@@ -1,11 +1,12 @@
 // Signature format: 3.0
 package androidx.drawerlayout.widget {
 
-  public class DrawerLayout extends android.view.ViewGroup {
+  public class DrawerLayout extends android.view.ViewGroup implements androidx.customview.widget.Openable {
     ctor public DrawerLayout(android.content.Context);
     ctor public DrawerLayout(android.content.Context, android.util.AttributeSet?);
     ctor public DrawerLayout(android.content.Context, android.util.AttributeSet?, int);
     method public void addDrawerListener(androidx.drawerlayout.widget.DrawerLayout.DrawerListener);
+    method public void close();
     method public void closeDrawer(android.view.View);
     method public void closeDrawer(android.view.View, boolean);
     method public void closeDrawer(int);
@@ -20,7 +21,9 @@
     method public boolean isDrawerOpen(int);
     method public boolean isDrawerVisible(android.view.View);
     method public boolean isDrawerVisible(int);
+    method public boolean isOpen();
     method public void onDraw(android.graphics.Canvas!);
+    method public void open();
     method public void openDrawer(android.view.View);
     method public void openDrawer(android.view.View, boolean);
     method public void openDrawer(int);
diff --git a/drawerlayout/drawerlayout/build.gradle b/drawerlayout/drawerlayout/build.gradle
index 06215de..cbec63b 100644
--- a/drawerlayout/drawerlayout/build.gradle
+++ b/drawerlayout/drawerlayout/build.gradle
@@ -12,7 +12,7 @@
 dependencies {
     api("androidx.annotation:annotation:1.1.0")
     api("androidx.core:core:1.2.0")
-    api("androidx.customview:customview:1.1.0-alpha01")
+    api(project(":customview:customview"))
 
     androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
     androidTestImplementation(ANDROIDX_TEST_CORE)
diff --git a/drawerlayout/drawerlayout/src/main/java/androidx/drawerlayout/widget/DrawerLayout.java b/drawerlayout/drawerlayout/src/main/java/androidx/drawerlayout/widget/DrawerLayout.java
index 443b177..20330d6 100644
--- a/drawerlayout/drawerlayout/src/main/java/androidx/drawerlayout/widget/DrawerLayout.java
+++ b/drawerlayout/drawerlayout/src/main/java/androidx/drawerlayout/widget/DrawerLayout.java
@@ -62,6 +62,7 @@
 import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.AccessibilityActionCompat;
 import androidx.core.view.accessibility.AccessibilityViewCommand;
 import androidx.customview.view.AbsSavedState;
+import androidx.customview.widget.Openable;
 import androidx.customview.widget.ViewDragHelper;
 import androidx.drawerlayout.R;
 
@@ -103,7 +104,7 @@
  * href="{@docRoot}training/implementing-navigation/nav-drawer.html">Creating a Navigation
  * Drawer</a>.</p>
  */
-public class DrawerLayout extends ViewGroup {
+public class DrawerLayout extends ViewGroup implements Openable {
     private static final String TAG = "DrawerLayout";
 
     private static final int[] THEME_ATTRS = {
@@ -1714,6 +1715,19 @@
     }
 
     /**
+     * Open the {@link GravityCompat#START} drawer by animating it into view.
+     * <p>
+     * This has no effect if the {@link #getDrawerLockMode(int) drawer lock mode} is
+     * {@link #LOCK_MODE_LOCKED_CLOSED}.
+     */
+    @Override
+    public void open() {
+        if (getDrawerLockMode(GravityCompat.START) != LOCK_MODE_LOCKED_CLOSED) {
+            openDrawer(GravityCompat.START);
+        }
+    }
+
+    /**
      * Open the specified drawer view by animating it into view.
      *
      * @param drawerView Drawer view to open
@@ -1784,6 +1798,19 @@
     }
 
     /**
+     * Close the {@link GravityCompat#START} drawer by animating it out of view.
+     * <p>
+     * This has no effect if the {@link #getDrawerLockMode(int) drawer lock mode} is
+     * {@link #LOCK_MODE_LOCKED_OPEN}.
+     */
+    @Override
+    public void close() {
+        if (getDrawerLockMode(GravityCompat.START) != LOCK_MODE_LOCKED_OPEN) {
+            closeDrawer(GravityCompat.START);
+        }
+    }
+
+    /**
      * Close the specified drawer view by animating it into view.
      *
      * @param drawerView Drawer view to close
@@ -1869,6 +1896,19 @@
     }
 
     /**
+     * Check if the {@link GravityCompat#START} drawer is currently in an open state.
+     * To be considered "open" the drawer must have settled into its fully
+     * visible state. If there is no drawer with the given gravity this method
+     * will return false.
+     *
+     * @return true if the {@link GravityCompat#START} drawer is in an open state
+     */
+    @Override
+    public boolean isOpen() {
+        return isDrawerOpen(GravityCompat.START);
+    }
+
+    /**
      * Check if the given drawer view is currently in an open state.
      * To be considered "open" the drawer must have settled into its fully
      * visible state. If there is no drawer with the given gravity this method
diff --git a/jetifier/jetifier/migration.config b/jetifier/jetifier/migration.config
index ab0726e..b472573 100644
--- a/jetifier/jetifier/migration.config
+++ b/jetifier/jetifier/migration.config
@@ -307,6 +307,10 @@
       "to": "androidx/customview/widget/FocusStrategy{0}"
     },
     {
+      "from": "androidx/customview/widget/Openable(.*)",
+      "to": "androidx/customview/widget/Openable{0}"
+    },
+    {
       "from": "android/support/v4/widget/ViewDragHelper(.*)",
       "to": "androidx/customview/widget/ViewDragHelper{0}"
     },
diff --git a/slidingpanelayout/slidingpanelayout/api/1.1.0-alpha01.txt b/slidingpanelayout/slidingpanelayout/api/1.1.0-alpha01.txt
index fc3aa2f..1c970ae 100644
--- a/slidingpanelayout/slidingpanelayout/api/1.1.0-alpha01.txt
+++ b/slidingpanelayout/slidingpanelayout/api/1.1.0-alpha01.txt
@@ -1,18 +1,20 @@
 // Signature format: 3.0
 package androidx.slidingpanelayout.widget {
 
-  public class SlidingPaneLayout extends android.view.ViewGroup {
+  public class SlidingPaneLayout extends android.view.ViewGroup implements androidx.customview.widget.Openable {
     ctor public SlidingPaneLayout(android.content.Context);
     ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet?);
     ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet?, int);
     method protected boolean canScroll(android.view.View!, boolean, int, int, int);
     method @Deprecated public boolean canSlide();
+    method public void close();
     method public boolean closePane();
     method @ColorInt public int getCoveredFadeColor();
     method @Px public int getParallaxDistance();
     method @ColorInt public int getSliderFadeColor();
     method public boolean isOpen();
     method public boolean isSlideable();
+    method public void open();
     method public boolean openPane();
     method public void setCoveredFadeColor(@ColorInt int);
     method public void setPanelSlideListener(androidx.slidingpanelayout.widget.SlidingPaneLayout.PanelSlideListener?);
diff --git a/slidingpanelayout/slidingpanelayout/api/current.txt b/slidingpanelayout/slidingpanelayout/api/current.txt
index fc3aa2f..1c970ae 100644
--- a/slidingpanelayout/slidingpanelayout/api/current.txt
+++ b/slidingpanelayout/slidingpanelayout/api/current.txt
@@ -1,18 +1,20 @@
 // Signature format: 3.0
 package androidx.slidingpanelayout.widget {
 
-  public class SlidingPaneLayout extends android.view.ViewGroup {
+  public class SlidingPaneLayout extends android.view.ViewGroup implements androidx.customview.widget.Openable {
     ctor public SlidingPaneLayout(android.content.Context);
     ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet?);
     ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet?, int);
     method protected boolean canScroll(android.view.View!, boolean, int, int, int);
     method @Deprecated public boolean canSlide();
+    method public void close();
     method public boolean closePane();
     method @ColorInt public int getCoveredFadeColor();
     method @Px public int getParallaxDistance();
     method @ColorInt public int getSliderFadeColor();
     method public boolean isOpen();
     method public boolean isSlideable();
+    method public void open();
     method public boolean openPane();
     method public void setCoveredFadeColor(@ColorInt int);
     method public void setPanelSlideListener(androidx.slidingpanelayout.widget.SlidingPaneLayout.PanelSlideListener?);
diff --git a/slidingpanelayout/slidingpanelayout/api/public_plus_experimental_1.1.0-alpha01.txt b/slidingpanelayout/slidingpanelayout/api/public_plus_experimental_1.1.0-alpha01.txt
index fc3aa2f..1c970ae 100644
--- a/slidingpanelayout/slidingpanelayout/api/public_plus_experimental_1.1.0-alpha01.txt
+++ b/slidingpanelayout/slidingpanelayout/api/public_plus_experimental_1.1.0-alpha01.txt
@@ -1,18 +1,20 @@
 // Signature format: 3.0
 package androidx.slidingpanelayout.widget {
 
-  public class SlidingPaneLayout extends android.view.ViewGroup {
+  public class SlidingPaneLayout extends android.view.ViewGroup implements androidx.customview.widget.Openable {
     ctor public SlidingPaneLayout(android.content.Context);
     ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet?);
     ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet?, int);
     method protected boolean canScroll(android.view.View!, boolean, int, int, int);
     method @Deprecated public boolean canSlide();
+    method public void close();
     method public boolean closePane();
     method @ColorInt public int getCoveredFadeColor();
     method @Px public int getParallaxDistance();
     method @ColorInt public int getSliderFadeColor();
     method public boolean isOpen();
     method public boolean isSlideable();
+    method public void open();
     method public boolean openPane();
     method public void setCoveredFadeColor(@ColorInt int);
     method public void setPanelSlideListener(androidx.slidingpanelayout.widget.SlidingPaneLayout.PanelSlideListener?);
diff --git a/slidingpanelayout/slidingpanelayout/api/public_plus_experimental_current.txt b/slidingpanelayout/slidingpanelayout/api/public_plus_experimental_current.txt
index fc3aa2f..1c970ae 100644
--- a/slidingpanelayout/slidingpanelayout/api/public_plus_experimental_current.txt
+++ b/slidingpanelayout/slidingpanelayout/api/public_plus_experimental_current.txt
@@ -1,18 +1,20 @@
 // Signature format: 3.0
 package androidx.slidingpanelayout.widget {
 
-  public class SlidingPaneLayout extends android.view.ViewGroup {
+  public class SlidingPaneLayout extends android.view.ViewGroup implements androidx.customview.widget.Openable {
     ctor public SlidingPaneLayout(android.content.Context);
     ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet?);
     ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet?, int);
     method protected boolean canScroll(android.view.View!, boolean, int, int, int);
     method @Deprecated public boolean canSlide();
+    method public void close();
     method public boolean closePane();
     method @ColorInt public int getCoveredFadeColor();
     method @Px public int getParallaxDistance();
     method @ColorInt public int getSliderFadeColor();
     method public boolean isOpen();
     method public boolean isSlideable();
+    method public void open();
     method public boolean openPane();
     method public void setCoveredFadeColor(@ColorInt int);
     method public void setPanelSlideListener(androidx.slidingpanelayout.widget.SlidingPaneLayout.PanelSlideListener?);
diff --git a/slidingpanelayout/slidingpanelayout/api/restricted_1.1.0-alpha01.txt b/slidingpanelayout/slidingpanelayout/api/restricted_1.1.0-alpha01.txt
index fc3aa2f..1c970ae 100644
--- a/slidingpanelayout/slidingpanelayout/api/restricted_1.1.0-alpha01.txt
+++ b/slidingpanelayout/slidingpanelayout/api/restricted_1.1.0-alpha01.txt
@@ -1,18 +1,20 @@
 // Signature format: 3.0
 package androidx.slidingpanelayout.widget {
 
-  public class SlidingPaneLayout extends android.view.ViewGroup {
+  public class SlidingPaneLayout extends android.view.ViewGroup implements androidx.customview.widget.Openable {
     ctor public SlidingPaneLayout(android.content.Context);
     ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet?);
     ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet?, int);
     method protected boolean canScroll(android.view.View!, boolean, int, int, int);
     method @Deprecated public boolean canSlide();
+    method public void close();
     method public boolean closePane();
     method @ColorInt public int getCoveredFadeColor();
     method @Px public int getParallaxDistance();
     method @ColorInt public int getSliderFadeColor();
     method public boolean isOpen();
     method public boolean isSlideable();
+    method public void open();
     method public boolean openPane();
     method public void setCoveredFadeColor(@ColorInt int);
     method public void setPanelSlideListener(androidx.slidingpanelayout.widget.SlidingPaneLayout.PanelSlideListener?);
diff --git a/slidingpanelayout/slidingpanelayout/api/restricted_current.txt b/slidingpanelayout/slidingpanelayout/api/restricted_current.txt
index fc3aa2f..1c970ae 100644
--- a/slidingpanelayout/slidingpanelayout/api/restricted_current.txt
+++ b/slidingpanelayout/slidingpanelayout/api/restricted_current.txt
@@ -1,18 +1,20 @@
 // Signature format: 3.0
 package androidx.slidingpanelayout.widget {
 
-  public class SlidingPaneLayout extends android.view.ViewGroup {
+  public class SlidingPaneLayout extends android.view.ViewGroup implements androidx.customview.widget.Openable {
     ctor public SlidingPaneLayout(android.content.Context);
     ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet?);
     ctor public SlidingPaneLayout(android.content.Context, android.util.AttributeSet?, int);
     method protected boolean canScroll(android.view.View!, boolean, int, int, int);
     method @Deprecated public boolean canSlide();
+    method public void close();
     method public boolean closePane();
     method @ColorInt public int getCoveredFadeColor();
     method @Px public int getParallaxDistance();
     method @ColorInt public int getSliderFadeColor();
     method public boolean isOpen();
     method public boolean isSlideable();
+    method public void open();
     method public boolean openPane();
     method public void setCoveredFadeColor(@ColorInt int);
     method public void setPanelSlideListener(androidx.slidingpanelayout.widget.SlidingPaneLayout.PanelSlideListener?);
diff --git a/slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java b/slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java
index 0a0c856..41a10ec 100644
--- a/slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java
+++ b/slidingpanelayout/slidingpanelayout/src/main/java/androidx/slidingpanelayout/widget/SlidingPaneLayout.java
@@ -45,6 +45,7 @@
 import androidx.core.view.ViewCompat;
 import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
 import androidx.customview.view.AbsSavedState;
+import androidx.customview.widget.Openable;
 import androidx.customview.widget.ViewDragHelper;
 
 import java.lang.reflect.Field;
@@ -90,7 +91,7 @@
  * indicates that the pane should be sized to fill all available space except a small minimum strip
  * that the user may use to grab the slideable view and pull it back over into a closed state.</p>
  */
-public class SlidingPaneLayout extends ViewGroup {
+public class SlidingPaneLayout extends ViewGroup implements Openable {
     private static final String TAG = "SlidingPaneLayout";
 
     /**
@@ -881,6 +882,15 @@
     /**
      * Open the sliding pane if it is currently slideable. If first layout
      * has already completed this will animate.
+     */
+    @Override
+    public void open() {
+        openPane();
+    }
+
+    /**
+     * Open the sliding pane if it is currently slideable. If first layout
+     * has already completed this will animate.
      *
      * @return true if the pane was slideable and is now open/in the process of opening
      */
@@ -899,6 +909,15 @@
     /**
      * Close the sliding pane if it is currently slideable. If first layout
      * has already completed this will animate.
+     */
+    @Override
+    public void close() {
+        closePane();
+    }
+
+    /**
+     * Close the sliding pane if it is currently slideable. If first layout
+     * has already completed this will animate.
      *
      * @return true if the pane was slideable and is now closed/in the process of closing
      */
@@ -912,6 +931,7 @@
      *
      * @return true if sliding panels are completely open
      */
+    @Override
     public boolean isOpen() {
         return !mCanSlide || mSlideOffset == 1;
     }