Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1334)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java

Issue 1589023003: [Contextual Search] Enable for fullscreen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move a couple of methods Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
index 243884de58259d7f0a608f68d3cc4114fc5395d6..2598e7c41019b04ac8ba30769c886f0f058048cf 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelBase.java
@@ -287,13 +287,16 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
* @param height The new width in dp.
* @param isToolbarShowing Whether the Toolbar is showing.
*/
- public final void onSizeChanged(float width, float height, boolean isToolbarShowing) {
+ public void onSizeChanged(float width, float height, boolean isToolbarShowing) {
mLayoutWidth = width;
mLayoutHeight = height;
mIsToolbarShowing = isToolbarShowing;
mMaximumWidth = calculateSearchPanelWidth();
mMaximumHeight = getPanelHeightFromState(PanelState.MAXIMIZED);
+ setPanelHeight(getPanelHeightFromState(getPanelState()));
+ mOffsetX = calculateSearchPanelX();
+ mOffsetY = calculateSearchPanelY();
}
/**
@@ -325,6 +328,21 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
}
/**
+ * @return The current X-position of the Contextual Search Panel.
+ */
+ protected float calculateSearchPanelX() {
+ return isFullscreenSizePanel() ? 0.f
+ : Math.round((getFullscreenWidth() - calculateSearchPanelWidth()) / 2.f);
+ }
+
+ /**
+ * @return The current Y-position of the Contextual Search Panel.
+ */
+ protected float calculateSearchPanelY() {
+ return getFullscreenHeight() - mHeight;
+ }
+
+ /**
* @return The current width of the Contextual Search Panel.
*/
protected float calculateSearchPanelWidth() {
@@ -380,7 +398,7 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
/**
* @return The fullscreen height.
*/
- private float getFullscreenHeight() {
+ public float getFullscreenHeight() {
// NOTE(mdjones): This value will always be the same for a particular orientation; it is
// the content height + visible toolbar height.
return mLayoutHeight + (getToolbarHeight() - getTopControlsOffsetDp());
@@ -978,9 +996,8 @@ abstract class ContextualSearchPanelBase implements ContextualSearchPromoHost {
*/
private void updatePanelSize(float height, PanelState endState, float percentage) {
mHeight = height;
- mOffsetX = isFullscreenSizePanel() ? 0.f
- : Math.round((getFullscreenWidth() - calculateSearchPanelWidth()) / 2.f);
- mOffsetY = getFullscreenHeight() - mHeight;
+ mOffsetX = calculateSearchPanelX();
+ mOffsetY = calculateSearchPanelY();
mIsMaximized = height == getPanelHeightFromState(PanelState.MAXIMIZED);
}

Powered by Google App Engine
This is Rietveld 408576698