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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarControlContainer.java

Issue 2744763005: 🏠 Add pull-handle to bottom toolbar (Closed)
Patch Set: address comments Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.toolbar; 5 package org.chromium.chrome.browser.toolbar;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.graphics.Canvas; 8 import android.graphics.Canvas;
9 import android.graphics.PorterDuff; 9 import android.graphics.PorterDuff;
10 import android.graphics.Rect; 10 import android.graphics.Rect;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 protected boolean isReadyForCapture() { 156 protected boolean isReadyForCapture() {
157 return mReadyForBitmapCapture; 157 return mReadyForBitmapCapture;
158 } 158 }
159 } 159 }
160 160
161 private static class ToolbarViewResourceAdapter extends ViewResourceAdapter { 161 private static class ToolbarViewResourceAdapter extends ViewResourceAdapter {
162 private final int[] mTempPosition = new int[2]; 162 private final int[] mTempPosition = new int[2];
163 private final View mToolbarContainer; 163 private final View mToolbarContainer;
164 164
165 private Toolbar mToolbar; 165 private Toolbar mToolbar;
166 private int mToolbarActualHeightPx;
167 private int mTabStripHeightPx; 166 private int mTabStripHeightPx;
168 167
169 /** Builds the resource adapter for the toolbar. */ 168 /** Builds the resource adapter for the toolbar. */
170 public ToolbarViewResourceAdapter(View toolbarContainer) { 169 public ToolbarViewResourceAdapter(View toolbarContainer) {
171 super(toolbarContainer); 170 super(toolbarContainer);
172 mToolbarContainer = toolbarContainer; 171 mToolbarContainer = toolbarContainer;
173 } 172 }
174 173
175 /** 174 /**
176 * Set the toolbar after it has been dynamically inflated. 175 * Set the toolbar after it has been dynamically inflated.
177 * @param toolbar The browser's toolbar. 176 * @param toolbar The browser's toolbar.
178 */ 177 */
179 public void setToolbar(Toolbar toolbar) { 178 public void setToolbar(Toolbar toolbar) {
180 mToolbar = toolbar; 179 mToolbar = toolbar;
181 int containerHeightResId = R.dimen.control_container_height;
182 if (mToolbar instanceof CustomTabToolbar) {
183 containerHeightResId = R.dimen.custom_tabs_control_container_hei ght;
184 }
185 mToolbarActualHeightPx = mToolbarContainer.getResources().getDimensi onPixelSize(
186 containerHeightResId);
187 mTabStripHeightPx = mToolbarContainer.getResources().getDimensionPix elSize( 180 mTabStripHeightPx = mToolbarContainer.getResources().getDimensionPix elSize(
188 R.dimen.tab_strip_height); 181 R.dimen.tab_strip_height);
189 } 182 }
190 183
191 /** 184 /**
192 * Force this resource to be recaptured in full, ignoring the checks 185 * Force this resource to be recaptured in full, ignoring the checks
193 * {@link #invalidate(Rect)} does. 186 * {@link #invalidate(Rect)} does.
194 */ 187 */
195 public void forceInvalidate() { 188 public void forceInvalidate() {
196 super.invalidate(null); 189 super.invalidate(null);
(...skipping 24 matching lines...) Expand all
221 @Override 214 @Override
222 protected void onCaptureEnd() { 215 protected void onCaptureEnd() {
223 mToolbar.setTextureCaptureMode(false); 216 mToolbar.setTextureCaptureMode(false);
224 // Forcing a texture capture should only be done for one draw. Turn off forced 217 // Forcing a texture capture should only be done for one draw. Turn off forced
225 // texture capture. 218 // texture capture.
226 mToolbar.setForceTextureCapture(false); 219 mToolbar.setForceTextureCapture(false);
227 } 220 }
228 221
229 @Override 222 @Override
230 protected void computeContentPadding(Rect outContentPadding) { 223 protected void computeContentPadding(Rect outContentPadding) {
231 outContentPadding.set(0, mTabStripHeightPx, mToolbarContainer.getWid th(), 224 outContentPadding.set(
232 mToolbarActualHeightPx); 225 0, mTabStripHeightPx, mToolbarContainer.getWidth(), mToolbar .getHeight());
233 } 226 }
234 227
235 @Override 228 @Override
236 protected void computeContentAperture(Rect outContentAperture) { 229 protected void computeContentAperture(Rect outContentAperture) {
237 mToolbar.getLocationBarContentRect(outContentAperture); 230 mToolbar.getLocationBarContentRect(outContentAperture);
238 mToolbar.getPositionRelativeToContainer(mToolbarContainer, mTempPosi tion); 231 mToolbar.getPositionRelativeToContainer(mToolbarContainer, mTempPosi tion);
239 outContentAperture.offset(mTempPosition[0], mTempPosition[1]); 232 outContentAperture.offset(mTempPosition[0], mTempPosition[1]);
240 } 233 }
241 } 234 }
242 235
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 268
276 @Override 269 @Override
277 public boolean shouldRecognizeSwipe(MotionEvent e1, MotionEvent e2) { 270 public boolean shouldRecognizeSwipe(MotionEvent e1, MotionEvent e2) {
278 if (isOnTabStrip(e1)) return false; 271 if (isOnTabStrip(e1)) return false;
279 if (mToolbar.shouldIgnoreSwipeGesture()) return false; 272 if (mToolbar.shouldIgnoreSwipeGesture()) return false;
280 if (UiUtils.isKeyboardShowing(getContext(), ToolbarControlContainer. this)) return false; 273 if (UiUtils.isKeyboardShowing(getContext(), ToolbarControlContainer. this)) return false;
281 return true; 274 return true;
282 } 275 }
283 } 276 }
284 } 277 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698