From cc3eab033783edaece13dcb3b6ce88f7a823066a Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Mon, 10 Aug 2020 21:14:51 +0200 Subject: [PATCH] Show tray buttons tooltip at the bottom (#3770) * Show tray buttons tooltip at the bottom * Fix tray notifications margin --- .../vrbrowser/ui/widgets/TrayWidget.java | 13 +++++++------ app/src/main/res/layout/tray.xml | 17 ++++++++--------- app/src/main/res/values/dimen.xml | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TrayWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TrayWidget.java index 3822cd091..abc6fc66c 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TrayWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TrayWidget.java @@ -223,7 +223,7 @@ public void updateUI() { .withLayout(R.layout.tooltip) .withString(mWifiSSID) .withAutoHide(false) - .withMargin(-20.0f) + .withMargin(-15.0f) .withPosition(NotificationManager.Notification.TOP).build(); NotificationManager.show(WIFI_NOTIFICATION_ID, notification); @@ -242,7 +242,7 @@ public void updateUI() { .withLayout(R.layout.tooltip) .withString(String.format(Locale.getDefault(), "%d%%", mLeftControllerBatteryLevel)) .withAutoHide(false) - .withMargin(-20.0f) + .withMargin(-15.0f) .withPosition(NotificationManager.Notification.TOP).build(); NotificationManager.show(LEFT_CONTROLLER_NOTIFICATION_ID, notification); @@ -261,7 +261,7 @@ public void updateUI() { .withLayout(R.layout.tooltip) .withString(String.format(Locale.getDefault(), "%d%%", mRightControllerBatteryLevel)) .withAutoHide(false) - .withMargin(-20.0f) + .withMargin(-15.0f) .withPosition(NotificationManager.Notification.TOP).build(); NotificationManager.show(RIGHT_CONTROLLER_NOTIFICATION_ID, notification); @@ -280,7 +280,7 @@ public void updateUI() { .withLayout(R.layout.tooltip) .withString(String.format(Locale.getDefault(), "%d%%", mHeadsetBatteryLevel)) .withAutoHide(false) - .withMargin(-20.0f) + .withMargin(-15.0f) .withPosition(NotificationManager.Notification.TOP).build(); NotificationManager.show(HEADSET_NOTIFICATION_ID, notification); @@ -299,7 +299,7 @@ public void updateUI() { .withLayout(R.layout.tooltip) .withString(getFormattedDate()) .withAutoHide(false) - .withMargin(-20.0f) + .withMargin(-15.0f) .withPosition(NotificationManager.Notification.TOP).build(); NotificationManager.show(TIME_NOTIFICATION_ID, notification); @@ -644,7 +644,8 @@ private void showNotification(int notificationId, UIButton button, String string .withDensity(R.dimen.tray_tooltip_density) .withString(string) .withPosition(NotificationManager.Notification.TOP) - .withZTranslation(25.0f).build(); + .withMargin(-75.0f) + .withZTranslation(20.0f).build(); NotificationManager.show(notificationId, notification); } } diff --git a/app/src/main/res/layout/tray.xml b/app/src/main/res/layout/tray.xml index 43f0c779c..01aaacbe5 100644 --- a/app/src/main/res/layout/tray.xml +++ b/app/src/main/res/layout/tray.xml @@ -14,14 +14,14 @@ + android:gravity="top|center_horizontal"> @@ -145,8 +145,7 @@ android:id="@+id/tray_buttons" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_centerHorizontal="true" + android:layout_below="@id/status_bar" android:background="@drawable/tray_background_bottom" android:orientation="horizontal"> @@ -155,7 +154,7 @@ style="@style/trayButtonStartTheme" android:tooltipText="@string/new_window_tooltip" app:tooltipDensity="@dimen/tray_tooltip_density" - app:tooltipPosition="top" + app:tooltipPosition="bottom" app:tooltipLayout="@layout/tooltip_tray" android:src="@drawable/ic_icon_tray_newwindow" app:visibleGone="@{!traymodel.isMaxWindows}"/> @@ -165,7 +164,7 @@ style="@style/trayButtonMiddleTheme" android:tooltipText="@string/tabs_tray_tooltip" app:tooltipDensity="@dimen/tray_tooltip_density" - app:tooltipPosition="top" + app:tooltipPosition="bottom" app:tooltipLayout="@layout/tooltip_tray" android:src="@drawable/ic_icon_tray_tabs" app:regularModeBackground="@{traymodel.isMaxWindows ? @drawable/tray_background_unchecked_start : @drawable/tray_background_unchecked_middle}" @@ -177,7 +176,7 @@ style="@style/trayButtonMiddleTheme" android:tooltipText="@{viewmodel.isPrivateSession? @string/private_browsing_exit_tooltip : @string/private_browsing_enter_tooltip}" app:tooltipDensity="@dimen/tray_tooltip_density" - app:tooltipPosition="top" + app:tooltipPosition="bottom" app:tooltipLayout="@layout/tooltip_tray" android:src="@{viewmodel.isPrivateSession ? @drawable/ic_icon_tray_private_browsing_on_v2 : @drawable/ic_icon_tray_private_browsing_v2}" app:privateMode="@{viewmodel.isPrivateSession}"/> @@ -190,7 +189,7 @@ style="@style/trayButtonMiddleTheme" android:tooltipText="@{viewmodel.isLibraryVisible ? @string/close_library_tooltip : @string/open_library_tooltip}" app:tooltipDensity="@dimen/tray_tooltip_density" - app:tooltipPosition="top" + app:tooltipPosition="bottom" app:tooltipLayout="@layout/tooltip_tray" android:src="@drawable/ic_icon_library" app:clipDrawable="@drawable/ic_icon_library_clip" @@ -219,7 +218,7 @@ style="@style/trayButtonEndTheme" android:tooltipText="@string/settings_tooltip" app:tooltipDensity="@dimen/tray_tooltip_density" - app:tooltipPosition="top" + app:tooltipPosition="bottom" app:tooltipLayout="@layout/tooltip_tray" android:src="@drawable/ic_icon_tray_settings_v3"/> diff --git a/app/src/main/res/values/dimen.xml b/app/src/main/res/values/dimen.xml index 062e5aee1..8ea5001a2 100644 --- a/app/src/main/res/values/dimen.xml +++ b/app/src/main/res/values/dimen.xml @@ -127,7 +127,7 @@ -2.5 1.2 204dp - 64dp + 66dp 4.0 20dp 10dp