Commit 19da8cbf authored by Pedro Amaral's avatar Pedro Amaral Committed by Commit Bot

Making Android View Visibility a boolean

The model properties should be agnostic to the view implementation.
ANDROID_VIEW_VISIBILITY was an int but that was view specific and really
all the mediator needs to interact with is whether or not the
Android View is visible.

Change-Id: I0daa79cc0d5a4a2a1a5c7b2443eee731525baa66
Reviewed-on: https://chromium-review.googlesource.com/1103545
Commit-Queue: Pedro Amaral <amaralp@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568111}
parent 627fd97a
......@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.toolbar;
import android.content.res.Resources;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
......@@ -65,9 +64,9 @@ class BottomToolbarMediator implements FullscreenListener, OverviewModeObserver
public void onControlsOffsetChanged(float topOffset, float bottomOffset, boolean needsAnimate) {
mModel.setValue(BottomToolbarModel.Y_OFFSET, (int) bottomOffset);
if (bottomOffset > 0) {
mModel.setValue(BottomToolbarModel.ANDROID_VIEW_VISIBILITY, View.INVISIBLE);
mModel.setValue(BottomToolbarModel.ANDROID_VIEW_VISIBLE, false);
} else {
mModel.setValue(BottomToolbarModel.ANDROID_VIEW_VISIBILITY, View.VISIBLE);
mModel.setValue(BottomToolbarModel.ANDROID_VIEW_VISIBLE, true);
}
}
......
......@@ -17,8 +17,8 @@ public class BottomToolbarModel extends PropertyModel {
/** The Y offset of the view in px. */
public static final IntPropertyKey Y_OFFSET = new IntPropertyKey();
/** The visibility of the Android view version of the toolbar. */
public static final IntPropertyKey ANDROID_VIEW_VISIBILITY = new IntPropertyKey();
/** Whether the Android view version of the toolbar is visible. */
public static final BooleanPropertyKey ANDROID_VIEW_VISIBLE = new BooleanPropertyKey();
/** The click listener for the search accelerator. */
public static final ObjectPropertyKey<OnClickListener> SEARCH_ACCELERATOR_LISTENER =
......@@ -40,7 +40,7 @@ public class BottomToolbarModel extends PropertyModel {
/** Default constructor. */
public BottomToolbarModel() {
super(Y_OFFSET, ANDROID_VIEW_VISIBILITY, SEARCH_ACCELERATOR_LISTENER, HOME_BUTTON_LISTENER,
super(Y_OFFSET, ANDROID_VIEW_VISIBLE, SEARCH_ACCELERATOR_LISTENER, HOME_BUTTON_LISTENER,
MENU_BUTTON_LISTENER, LAYOUT_MANAGER, SEARCH_ACCELERATOR_VISIBLE);
}
}
......@@ -50,9 +50,10 @@ public class BottomToolbarViewBinder
if (BottomToolbarModel.Y_OFFSET == propertyKey) {
assert view.sceneLayer != null;
view.sceneLayer.setYOffset(model.getValue(BottomToolbarModel.Y_OFFSET));
} else if (BottomToolbarModel.ANDROID_VIEW_VISIBILITY == propertyKey) {
view.toolbarRoot.setVisibility(
model.getValue(BottomToolbarModel.ANDROID_VIEW_VISIBILITY));
} else if (BottomToolbarModel.ANDROID_VIEW_VISIBLE == propertyKey) {
view.toolbarRoot.setVisibility(model.getValue(BottomToolbarModel.ANDROID_VIEW_VISIBLE)
? View.VISIBLE
: View.INVISIBLE);
} else if (BottomToolbarModel.SEARCH_ACCELERATOR_LISTENER == propertyKey) {
view.toolbarRoot.findViewById(R.id.search_button)
.setOnClickListener(
......
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