Skip to content

Commit

Permalink
[Adaptive] [Side Sheet] Restrict SheetDialog methods from the public …
Browse files Browse the repository at this point in the history
…API surface and rename getDismissWithAnimation.

PiperOrigin-RevId: 493644328
(cherry picked from commit c64f572)
  • Loading branch information
afohrman authored and dsn5ft committed Dec 9, 2022
1 parent fafee33 commit 9c8ea58
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions lib/java/com/google/android/material/sidesheet/SheetDialog.java
Expand Up @@ -18,7 +18,6 @@

import com.google.android.material.R;


import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build.VERSION;
Expand Down Expand Up @@ -134,8 +133,8 @@ protected void onStart() {
* or calling `dismiss()` from a `SideSheetDialogFragment`, tapping outside a dialog, etc...
*
* <p>The default animation to dismiss this dialog is a fade-out transition through a
* windowAnimation. Set {@link #setDismissWithAnimation(boolean)} to true if you want to utilize
* the sheet animation instead.
* windowAnimation. Set {@link #setDismissWithSheetAnimationEnabled(boolean)} to true if you want
* to utilize the sheet animation instead.
*
* <p>If this function is called from a swipe interaction, or dismissWithAnimation is false, then
* keep the default behavior.
Expand All @@ -162,20 +161,20 @@ public void setCanceledOnTouchOutside(boolean cancel) {
}

/**
* Set to perform the swipe away animation when dismissing instead of the window animation for the
* dialog.
* Set whether to perform the swipe away animation on the sheet when dismissing, rather than the
* window animation for the dialog.
*
* @param dismissWithAnimation True if swipe away animation should be used when dismissing.
*/
public void setDismissWithAnimation(boolean dismissWithAnimation) {
public void setDismissWithSheetAnimationEnabled(boolean dismissWithAnimation) {
this.dismissWithAnimation = dismissWithAnimation;
}

/**
* Returns if dismissing will perform the swipe away animation on the sheet, rather than the
* Returns whether dismissing will perform the swipe away animation on the sheet, rather than the
* window animation for the dialog.
*/
public boolean getDismissWithAnimation() {
public boolean isDismissWithSheetAnimationEnabled() {
return dismissWithAnimation;
}

Expand Down Expand Up @@ -267,7 +266,7 @@ public boolean performAccessibilityAction(View host, int action, Bundle args) {
return container;
}

boolean shouldWindowCloseOnTouchOutside() {
private boolean shouldWindowCloseOnTouchOutside() {
if (!canceledOnTouchOutsideSet) {
TypedArray a =
getContext().obtainStyledAttributes(new int[] {android.R.attr.windowCloseOnTouchOutside});
Expand Down Expand Up @@ -297,14 +296,14 @@ private static int getThemeResId(
}

@LayoutRes
protected abstract int getLayoutResId();
abstract int getLayoutResId();

@IdRes
protected abstract int getDialogId();
abstract int getDialogId();

@NonNull
protected abstract Sheet getBehaviorFromSheet(@NonNull FrameLayout sheet);
abstract Sheet getBehaviorFromSheet(@NonNull FrameLayout sheet);

@StableSheetState
protected abstract int getStateOnStart();
abstract int getStateOnStart();
}

0 comments on commit 9c8ea58

Please sign in to comment.