Commit 2e4423ab authored by Matthew Jones's avatar Matthew Jones Committed by Commit Bot

Add concept of priority to BottomSheetContent

This patch adds the concept of priority to content that can be shown
in the bottom sheet. Currently only two priorities are supported: HIGH
and LOW.

BUG=821568

Change-Id: Id2473a48618b5095ab9b1cca20831c7547c4d36d
Reviewed-on: https://chromium-review.googlesource.com/969063
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545193}
parent c76f7f26
...@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.contextual_suggestions; ...@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.contextual_suggestions;
import android.view.View; import android.view.View;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetContent; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.BottomSheetContent;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.ContentPriority;
/** A {@link BottomSheetContent} that displays contextual suggestions. */ /** A {@link BottomSheetContent} that displays contextual suggestions. */
public class ContextualSuggestionsBottomSheetContent implements BottomSheetContent { public class ContextualSuggestionsBottomSheetContent implements BottomSheetContent {
...@@ -48,4 +49,9 @@ public class ContextualSuggestionsBottomSheetContent implements BottomSheetConte ...@@ -48,4 +49,9 @@ public class ContextualSuggestionsBottomSheetContent implements BottomSheetConte
public boolean applyDefaultTopPadding() { public boolean applyDefaultTopPadding() {
return false; return false;
} }
@Override
public @ContentPriority int getPriority() {
return ContentPriority.LOW;
}
} }
...@@ -96,6 +96,14 @@ public class BottomSheet ...@@ -96,6 +96,14 @@ public class BottomSheet
int NAVIGATION = 4; int NAVIGATION = 4;
} }
/** The different priorities that the sheet's content can have. */
@IntDef({ContentPriority.HIGH, ContentPriority.LOW})
@Retention(RetentionPolicy.SOURCE)
public @interface ContentPriority {
int HIGH = 0;
int LOW = 1;
}
/** /**
* The base duration of the settling animation of the sheet. 218 ms is a spec for material * The base duration of the settling animation of the sheet. 218 ms is a spec for material
* design (this is the minimum time a user is guaranteed to pay attention to something). * design (this is the minimum time a user is guaranteed to pay attention to something).
...@@ -278,6 +286,12 @@ public class BottomSheet ...@@ -278,6 +286,12 @@ public class BottomSheet
* @return Whether the default top padding should be applied to the content view. * @return Whether the default top padding should be applied to the content view.
*/ */
boolean applyDefaultTopPadding(); boolean applyDefaultTopPadding();
/**
* @return The priority of this content.
*/
@ContentPriority
int getPriority();
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment