| OLD | NEW |
| 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.animation.Animator; | 7 import android.animation.Animator; |
| 8 import android.animation.AnimatorListenerAdapter; | 8 import android.animation.AnimatorListenerAdapter; |
| 9 import android.animation.AnimatorSet; | 9 import android.animation.AnimatorSet; |
| 10 import android.animation.ObjectAnimator; | 10 import android.animation.ObjectAnimator; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 import android.view.MotionEvent; | 31 import android.view.MotionEvent; |
| 32 import android.view.View; | 32 import android.view.View; |
| 33 import android.view.View.OnClickListener; | 33 import android.view.View.OnClickListener; |
| 34 import android.view.View.OnLongClickListener; | 34 import android.view.View.OnLongClickListener; |
| 35 import android.view.ViewGroup; | 35 import android.view.ViewGroup; |
| 36 import android.view.WindowManager; | 36 import android.view.WindowManager; |
| 37 import android.view.animation.LinearInterpolator; | 37 import android.view.animation.LinearInterpolator; |
| 38 import android.widget.FrameLayout; | 38 import android.widget.FrameLayout; |
| 39 import android.widget.ImageView; | 39 import android.widget.ImageView; |
| 40 import android.widget.TextView; | 40 import android.widget.TextView; |
| 41 import android.widget.Toast; | |
| 42 | 41 |
| 43 import org.chromium.base.ApiCompatibilityUtils; | 42 import org.chromium.base.ApiCompatibilityUtils; |
| 44 import org.chromium.base.SysUtils; | 43 import org.chromium.base.SysUtils; |
| 45 import org.chromium.base.VisibleForTesting; | 44 import org.chromium.base.VisibleForTesting; |
| 46 import org.chromium.base.metrics.RecordUserAction; | 45 import org.chromium.base.metrics.RecordUserAction; |
| 47 import org.chromium.chrome.R; | 46 import org.chromium.chrome.R; |
| 48 import org.chromium.chrome.browser.Tab; | 47 import org.chromium.chrome.browser.Tab; |
| 49 import org.chromium.chrome.browser.compositor.Invalidator; | 48 import org.chromium.chrome.browser.compositor.Invalidator; |
| 50 import org.chromium.chrome.browser.document.BrandColorUtils; | 49 import org.chromium.chrome.browser.document.BrandColorUtils; |
| 51 import org.chromium.chrome.browser.ntp.NewTabPage; | 50 import org.chromium.chrome.browser.ntp.NewTabPage; |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 RecordUserAction.record("MobileNewTabOpened"); | 392 RecordUserAction.record("MobileNewTabOpened"); |
| 394 // TODO(kkimlabs): Record UMA action for homepage button. | 393 // TODO(kkimlabs): Record UMA action for homepage button. |
| 395 } | 394 } |
| 396 } else if (mHomeButton == v) { | 395 } else if (mHomeButton == v) { |
| 397 openHomepage(); | 396 openHomepage(); |
| 398 } | 397 } |
| 399 } | 398 } |
| 400 | 399 |
| 401 @Override | 400 @Override |
| 402 public boolean onLongClick(View v) { | 401 public boolean onLongClick(View v) { |
| 403 int stringResourceId = -1; | 402 int stringResourceId = 0; |
| 404 if (v == mToggleTabStackButton) { | 403 if (v == mToggleTabStackButton) { |
| 405 stringResourceId = R.string.open_tabs; | 404 stringResourceId = R.string.open_tabs; |
| 405 } else { |
| 406 return false; |
| 406 } | 407 } |
| 407 if (stringResourceId != -1) { | 408 return showAccessibilityToast(v, stringResourceId); |
| 408 Context ctx = getContext(); | |
| 409 // Display the tooltip for the view being long clicked. | |
| 410 final int screenWidth = getResources().getDisplayMetrics().widthPixe
ls; | |
| 411 final int[] screenPos = new int[2]; | |
| 412 v.getLocationOnScreen(screenPos); | |
| 413 final int width = v.getWidth(); | |
| 414 | |
| 415 Toast toast = Toast.makeText( | |
| 416 ctx, getResources().getString(stringResourceId), Toast.LENGT
H_SHORT); | |
| 417 toast.setGravity( | |
| 418 Gravity.TOP | Gravity.END, | |
| 419 screenWidth - screenPos[0] - width / 2, | |
| 420 getHeight()); | |
| 421 toast.show(); | |
| 422 return true; | |
| 423 } | |
| 424 return false; | |
| 425 } | 409 } |
| 426 | 410 |
| 427 @Override | 411 @Override |
| 428 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | 412 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
| 429 if (!mDisableLocationBarRelayout) { | 413 if (!mDisableLocationBarRelayout) { |
| 430 super.onMeasure(widthMeasureSpec, heightMeasureSpec); | 414 super.onMeasure(widthMeasureSpec, heightMeasureSpec); |
| 431 | 415 |
| 432 boolean changed = layoutLocationBar(MeasureSpec.getSize(widthMeasure
Spec)); | 416 boolean changed = layoutLocationBar(MeasureSpec.getSize(widthMeasure
Spec)); |
| 433 if (!mInTabSwitcherMode) setUrlFocusChangePercent(mUrlFocusChangePer
cent); | 417 if (!mInTabSwitcherMode) setUrlFocusChangePercent(mUrlFocusChangePer
cent); |
| 434 if (!changed) return; | 418 if (!changed) return; |
| (...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1894 | 1878 |
| 1895 getMenuButton().setVisibility(shouldShowMenuButton() ? View.VISIBLE : Vi
ew.GONE); | 1879 getMenuButton().setVisibility(shouldShowMenuButton() ? View.VISIBLE : Vi
ew.GONE); |
| 1896 } | 1880 } |
| 1897 | 1881 |
| 1898 @Override | 1882 @Override |
| 1899 public LocationBar getLocationBar() { | 1883 public LocationBar getLocationBar() { |
| 1900 return mPhoneLocationBar; | 1884 return mPhoneLocationBar; |
| 1901 } | 1885 } |
| 1902 } | 1886 } |
| 1903 | 1887 |
| OLD | NEW |