| 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.ntp; | 5 package org.chromium.chrome.browser.ntp; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.graphics.Canvas; | 9 import android.graphics.Canvas; |
| 10 import android.graphics.Point; | 10 import android.graphics.Point; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 import org.chromium.chrome.R; | 31 import org.chromium.chrome.R; |
| 32 import org.chromium.chrome.browser.ChromeActivity; | 32 import org.chromium.chrome.browser.ChromeActivity; |
| 33 import org.chromium.chrome.browser.ChromeFeatureList; | 33 import org.chromium.chrome.browser.ChromeFeatureList; |
| 34 import org.chromium.chrome.browser.ntp.ContextMenuManager.TouchEnabledDelegate; | 34 import org.chromium.chrome.browser.ntp.ContextMenuManager.TouchEnabledDelegate; |
| 35 import org.chromium.chrome.browser.ntp.LogoBridge.Logo; | 35 import org.chromium.chrome.browser.ntp.LogoBridge.Logo; |
| 36 import org.chromium.chrome.browser.ntp.LogoBridge.LogoObserver; | 36 import org.chromium.chrome.browser.ntp.LogoBridge.LogoObserver; |
| 37 import org.chromium.chrome.browser.ntp.NewTabPage.OnSearchBoxScrollListener; | 37 import org.chromium.chrome.browser.ntp.NewTabPage.OnSearchBoxScrollListener; |
| 38 import org.chromium.chrome.browser.ntp.cards.NewTabPageAdapter; | 38 import org.chromium.chrome.browser.ntp.cards.NewTabPageAdapter; |
| 39 import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView; | 39 import org.chromium.chrome.browser.ntp.cards.NewTabPageRecyclerView; |
| 40 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; | 40 import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; |
| 41 import org.chromium.chrome.browser.omnibox.OmniboxPlaceholderFieldTrial; |
| 41 import org.chromium.chrome.browser.profiles.Profile; | 42 import org.chromium.chrome.browser.profiles.Profile; |
| 42 import org.chromium.chrome.browser.suggestions.DestructionObserver; | 43 import org.chromium.chrome.browser.suggestions.DestructionObserver; |
| 43 import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate; | 44 import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate; |
| 44 import org.chromium.chrome.browser.suggestions.Tile; | 45 import org.chromium.chrome.browser.suggestions.Tile; |
| 45 import org.chromium.chrome.browser.suggestions.TileGridLayout; | 46 import org.chromium.chrome.browser.suggestions.TileGridLayout; |
| 46 import org.chromium.chrome.browser.suggestions.TileGroup; | 47 import org.chromium.chrome.browser.suggestions.TileGroup; |
| 47 import org.chromium.chrome.browser.tab.Tab; | 48 import org.chromium.chrome.browser.tab.Tab; |
| 48 import org.chromium.chrome.browser.util.FeatureUtilities; | 49 import org.chromium.chrome.browser.util.FeatureUtilities; |
| 49 import org.chromium.chrome.browser.util.MathUtils; | 50 import org.chromium.chrome.browser.util.MathUtils; |
| 50 import org.chromium.chrome.browser.util.ViewUtils; | 51 import org.chromium.chrome.browser.util.ViewUtils; |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 .findViewById(R.id.search_box_text); | 331 .findViewById(R.id.search_box_text); |
| 331 | 332 |
| 332 if (!ChromeFeatureList.isEnabled(ChromeFeatureList.NTP_SHOW_GOOGLE_G_IN_
OMNIBOX)) { | 333 if (!ChromeFeatureList.isEnabled(ChromeFeatureList.NTP_SHOW_GOOGLE_G_IN_
OMNIBOX)) { |
| 333 searchBoxTextView.setCompoundDrawablePadding(0); | 334 searchBoxTextView.setCompoundDrawablePadding(0); |
| 334 | 335 |
| 335 // Not using the relative version of this call because we only want
to clear | 336 // Not using the relative version of this call because we only want
to clear |
| 336 // the drawables. | 337 // the drawables. |
| 337 searchBoxTextView.setCompoundDrawables(null, null, null, null); | 338 searchBoxTextView.setCompoundDrawables(null, null, null, null); |
| 338 } | 339 } |
| 339 | 340 |
| 340 String hintText = getResources().getString(R.string.search_or_type_url); | 341 String hintText = OmniboxPlaceholderFieldTrial.getOmniboxPlaceholder(); |
| 341 if (!DeviceFormFactor.isTablet()) { | 342 if (!DeviceFormFactor.isTablet()) { |
| 342 searchBoxTextView.setHint(hintText); | 343 searchBoxTextView.setHint(hintText); |
| 343 } else { | 344 } else { |
| 344 searchBoxTextView.setContentDescription(hintText); | 345 searchBoxTextView.setContentDescription(hintText); |
| 345 } | 346 } |
| 346 searchBoxTextView.setOnClickListener(new View.OnClickListener() { | 347 searchBoxTextView.setOnClickListener(new View.OnClickListener() { |
| 347 @Override | 348 @Override |
| 348 public void onClick(View v) { | 349 public void onClick(View v) { |
| 349 mManager.focusSearchBox(false, null); | 350 mManager.focusSearchBox(false, null); |
| 350 } | 351 } |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 } | 958 } |
| 958 | 959 |
| 959 /** | 960 /** |
| 960 * Converts a dp value to a px value. | 961 * Converts a dp value to a px value. |
| 961 */ | 962 */ |
| 962 private int dpToPx(int value) { | 963 private int dpToPx(int value) { |
| 963 return Math.round(TypedValue.applyDimension( | 964 return Math.round(TypedValue.applyDimension( |
| 964 TypedValue.COMPLEX_UNIT_DIP, value, getResources().getDisplayMet
rics())); | 965 TypedValue.COMPLEX_UNIT_DIP, value, getResources().getDisplayMet
rics())); |
| 965 } | 966 } |
| 966 } | 967 } |
| OLD | NEW |