summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/com/android/internal/widget/FloatingToolbar.java10
-rw-r--r--core/res/res/values-land/dimens.xml3
-rw-r--r--core/res/res/values/dimens.xml2
-rwxr-xr-xcore/res/res/values/symbols.xml2
4 files changed, 12 insertions, 5 deletions
diff --git a/core/java/com/android/internal/widget/FloatingToolbar.java b/core/java/com/android/internal/widget/FloatingToolbar.java
index 3f7696f..f98fbfc 100644
--- a/core/java/com/android/internal/widget/FloatingToolbar.java
+++ b/core/java/com/android/internal/widget/FloatingToolbar.java
@@ -1247,9 +1247,13 @@ public final class FloatingToolbar {
}
private static int getAdjustedToolbarWidth(Context context, int width) {
- if (width <= 0 || width > getScreenWidth(context)) {
- width = context.getResources()
- .getDimensionPixelSize(R.dimen.floating_toolbar_default_width);
+ int maximumWidth = getScreenWidth(context) - 2 * context.getResources()
+ .getDimensionPixelSize(R.dimen.floating_toolbar_horizontal_margin);
+
+ if (width <= 0 || width > maximumWidth) {
+ int defaultWidth = context.getResources()
+ .getDimensionPixelSize(R.dimen.floating_toolbar_preferred_width);
+ width = Math.min(defaultWidth, maximumWidth);
}
return width;
}
diff --git a/core/res/res/values-land/dimens.xml b/core/res/res/values-land/dimens.xml
index 640ca1e..4f0c0fb 100644
--- a/core/res/res/values-land/dimens.xml
+++ b/core/res/res/values-land/dimens.xml
@@ -67,4 +67,7 @@
<!-- width of ImmersiveModeConfirmation (-1 for match_parent) -->
<dimen name="immersive_mode_cling_width">380dp</dimen>
+ <!-- Floating toolbar dimensions -->
+ <dimen name="floating_toolbar_preferred_width">544dp</dimen>
+
</resources>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index bbba712..84747f1 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -391,7 +391,7 @@
<dimen name="floating_toolbar_overflow_side_padding">18dp</dimen>
<dimen name="floating_toolbar_text_size">14sp</dimen>
<dimen name="floating_toolbar_menu_button_minimum_width">48dp</dimen>
- <dimen name="floating_toolbar_default_width">264dp</dimen>
+ <dimen name="floating_toolbar_preferred_width">328dp</dimen>
<dimen name="floating_toolbar_minimum_overflow_height">144dp</dimen>
<dimen name="floating_toolbar_horizontal_margin">16dp</dimen>
<dimen name="floating_toolbar_vertical_margin">8dp</dimen>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 801a98a..11583b3 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2241,7 +2241,7 @@
<java-symbol type="dimen" name="floating_toolbar_overflow_side_padding" />
<java-symbol type="dimen" name="floating_toolbar_text_size" />
<java-symbol type="dimen" name="floating_toolbar_menu_button_minimum_width" />
- <java-symbol type="dimen" name="floating_toolbar_default_width" />
+ <java-symbol type="dimen" name="floating_toolbar_preferred_width" />
<java-symbol type="dimen" name="floating_toolbar_minimum_overflow_height" />
<java-symbol type="dimen" name="floating_toolbar_horizontal_margin" />
<java-symbol type="dimen" name="floating_toolbar_vertical_margin" />