Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Show tray buttons tooltip at the bottom (#3770)
Browse files Browse the repository at this point in the history
* Show tray buttons tooltip at the bottom

* Fix tray notifications margin
  • Loading branch information
keianhzo authored Aug 10, 2020
1 parent 661c2b5 commit cc3eab0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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);
}
}
Expand Down
17 changes: 8 additions & 9 deletions app/src/main/res/layout/tray.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
<RelativeLayout
android:layout_width="@dimen/tray_width"
android:layout_height="@dimen/tray_height"
android:gravity="center">
android:gravity="top|center_horizontal">

<RelativeLayout
android:id="@+id/status_bar"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignStart="@+id/tray_buttons"
android:layout_alignEnd="@+id/tray_buttons"
android:layout_above="@+id/tray_buttons"
android:background="@drawable/tray_background_top"
android:paddingStart="10dp"
android:paddingEnd="10dp">
Expand Down Expand Up @@ -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">

Expand All @@ -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}"/>
Expand All @@ -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}"
Expand All @@ -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}"/>
Expand All @@ -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"
Expand Down Expand Up @@ -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"/>
</LinearLayout>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/dimen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<item name="tray_world_z" format="float" type="dimen">-2.5</item>
<item name="tray_world_width" format="float" type="dimen">1.2</item>
<dimen name="tray_width">204dp</dimen>
<dimen name="tray_height">64dp</dimen>
<dimen name="tray_height">66dp</dimen>
<item name="tray_tooltip_density" format="float" type="dimen">4.0</item>
<dimen name="tray_tooltip_padding_h">20dp</dimen>
<dimen name="tray_tooltip_padding_v">10dp</dimen>
Expand Down

0 comments on commit cc3eab0

Please sign in to comment.