Commit 656cb984 authored by Christopher Grant's avatar Christopher Grant Committed by Commit Bot

VR: Move platform toast toward the bottom of the content

This change puts the toast over content, near the bottom, in a position
just above where a downloading snackbar appears.  It also removes the
linear layout that previously held more than one toast.

BUG=828515

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_vr;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Iab15c457261e9887940c69140c9af607eb18f1cd
Reviewed-on: https://chromium-review.googlesource.com/998404Reviewed-by: default avatarBiao She <bshe@chromium.org>
Commit-Queue: Christopher Grant <cjgrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548776}
parent 8f0f9ceb
...@@ -82,6 +82,7 @@ static constexpr float kToastYPaddingDMM = 0.02f; ...@@ -82,6 +82,7 @@ static constexpr float kToastYPaddingDMM = 0.02f;
static constexpr float kToastCornerRadiusDMM = 0.004f; static constexpr float kToastCornerRadiusDMM = 0.004f;
static constexpr float kToastTextFontHeightDMM = 0.023f; static constexpr float kToastTextFontHeightDMM = 0.023f;
static constexpr int kToastTimeoutSeconds = 6; static constexpr int kToastTimeoutSeconds = 6;
static constexpr float kPlatformToastVerticalOffset = 0.5f;
static constexpr float kSplashScreenTextDistance = 2.5f; static constexpr float kSplashScreenTextDistance = 2.5f;
static constexpr float kSplashScreenTextFontHeightDMM = 0.05f; static constexpr float kSplashScreenTextFontHeightDMM = 0.05f;
......
...@@ -2952,25 +2952,25 @@ void UiSceneCreator::CreateWebVrOverlayElements() { ...@@ -2952,25 +2952,25 @@ void UiSceneCreator::CreateWebVrOverlayElements() {
} }
void UiSceneCreator::CreateToasts() { void UiSceneCreator::CreateToasts() {
auto layout = Create<LinearLayout>(kNone, kPhaseNone, LinearLayout::kLeft);
layout->set_contributes_to_parent_bounds(false);
layout->set_y_anchoring(TOP);
layout->SetTranslate(0, kIndicatorVerticalOffset, kIndicatorDistanceOffset);
layout->set_margin(kWebVrPermissionMargin);
auto platform_toast = CreateTextToast( auto platform_toast = CreateTextToast(
kPlatformToastTransientParent, kPlatformToast, model_, base::string16()); kPlatformToastTransientParent, kPlatformToast, model_, base::string16());
platform_toast->set_contributes_to_parent_bounds(false);
platform_toast->set_y_anchoring(BOTTOM);
platform_toast->set_y_centering(TOP);
platform_toast->SetTranslate(0, kPlatformToastVerticalOffset,
kIndicatorDistanceOffset);
platform_toast->AddBinding(std::make_unique<Binding<const PlatformToast*>>( platform_toast->AddBinding(std::make_unique<Binding<const PlatformToast*>>(
VR_BIND_LAMBDA([](Model* m) { return m->platform_toast.get(); }, VR_BIND_LAMBDA([](Model* m) { return m->platform_toast.get(); },
base::Unretained(model_)), base::Unretained(model_)),
VR_BIND_LAMBDA( VR_BIND_LAMBDA(
[](TransientElement* t, const PlatformToast* const& value) { [](TransientElement* t, const PlatformToast* const& value) {
SetVisibleInLayout(t, value); t->SetVisible(value);
if (value) { if (value) {
t->RefreshVisible(); t->RefreshVisible();
} }
}, },
base::Unretained(platform_toast.get())))); base::Unretained(platform_toast.get()))));
Text* text_element = Text* text_element =
static_cast<Text*>(platform_toast->GetDescendantByType(kTypeToastText)); static_cast<Text*>(platform_toast->GetDescendantByType(kTypeToastText));
DCHECK(text_element); DCHECK(text_element);
...@@ -2984,9 +2984,8 @@ void UiSceneCreator::CreateToasts() { ...@@ -2984,9 +2984,8 @@ void UiSceneCreator::CreateToasts() {
} }
}, },
base::Unretained(text_element)))); base::Unretained(text_element))));
layout->AddChild(std::move(platform_toast));
scene_->AddUiElement(k2dBrowsingContentGroup, std::move(layout)); scene_->AddUiElement(k2dBrowsingContentGroup, std::move(platform_toast));
} }
} // namespace vr } // namespace vr
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