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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java

Issue 2438093002: Update enabled state of the NTP search box whenever its alpha changes. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.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.content.res.Configuration; 9 import android.content.res.Configuration;
10 import android.content.res.Resources; 10 import android.content.res.Resources;
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 518
519 private void updateSearchBoxOnScroll() { 519 private void updateSearchBoxOnScroll() {
520 if (mDisableUrlFocusChangeAnimations) return; 520 if (mDisableUrlFocusChangeAnimations) return;
521 521
522 // When the page changes (tab switching or new page loading), it is poss ible that events 522 // When the page changes (tab switching or new page loading), it is poss ible that events
523 // (e.g. delayed RecyclerView change notifications) trigger calls to the se methods after 523 // (e.g. delayed RecyclerView change notifications) trigger calls to the se methods after
524 // the current page changes. We check it again to make sure we don't att empt to update the 524 // the current page changes. We check it again to make sure we don't att empt to update the
525 // wrong page. 525 // wrong page.
526 if (!mManager.isCurrentPage()) return; 526 if (!mManager.isCurrentPage()) return;
527 527
528 // Disable the search box contents if it is the process of being animate d away.
529 ViewUtils.setEnabledRecursive(mSearchBoxView, mSearchBoxView.getAlpha() == 1.0f);
530
531 if (mSearchBoxScrollListener != null) { 528 if (mSearchBoxScrollListener != null) {
532 mSearchBoxScrollListener.onNtpScrollChanged(getToolbarTransitionPerc entage()); 529 mSearchBoxScrollListener.onNtpScrollChanged(getToolbarTransitionPerc entage());
533 } 530 }
534 } 531 }
535 532
536 /** 533 /**
537 * Calculates the percentage (between 0 and 1) of the transition from the se arch box to the 534 * Calculates the percentage (between 0 and 1) of the transition from the se arch box to the
538 * omnibox at the top of the New Tab Page, which is determined by the amount of scrolling and 535 * omnibox at the top of the New Tab Page, which is determined by the amount of scrolling and
539 * the position of the search box. 536 * the position of the search box.
540 * 537 *
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 mNewTabPageLayout.setTranslationY(percent * (basePosition - target)); 800 mNewTabPageLayout.setTranslationY(percent * (basePosition - target));
804 } 801 }
805 802
806 /** 803 /**
807 * Updates the opacity of the search box when scrolling. 804 * Updates the opacity of the search box when scrolling.
808 * 805 *
809 * @param alpha opacity (alpha) value to use. 806 * @param alpha opacity (alpha) value to use.
810 */ 807 */
811 public void setSearchBoxAlpha(float alpha) { 808 public void setSearchBoxAlpha(float alpha) {
812 mSearchBoxView.setAlpha(alpha); 809 mSearchBoxView.setAlpha(alpha);
810
811 // Disable the search box contents if it is the process of being animate d away.
812 ViewUtils.setEnabledRecursive(mSearchBoxView, mSearchBoxView.getAlpha() == 1.0f);
813 } 813 }
814 814
815 /** 815 /**
816 * Updates the opacity of the search provider logo when scrolling. 816 * Updates the opacity of the search provider logo when scrolling.
817 * 817 *
818 * @param alpha opacity (alpha) value to use. 818 * @param alpha opacity (alpha) value to use.
819 */ 819 */
820 public void setSearchProviderLogoAlpha(float alpha) { 820 public void setSearchProviderLogoAlpha(float alpha) {
821 mSearchProviderLogoView.setAlpha(alpha); 821 mSearchProviderLogoView.setAlpha(alpha);
822 } 822 }
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 } 1258 }
1259 1259
1260 /** 1260 /**
1261 * @return The adapter position the user has scrolled to. 1261 * @return The adapter position the user has scrolled to.
1262 */ 1262 */
1263 public int getScrollPosition() { 1263 public int getScrollPosition() {
1264 if (mUseCardsUi) return mRecyclerView.getScrollPosition(); 1264 if (mUseCardsUi) return mRecyclerView.getScrollPosition();
1265 return RecyclerView.NO_POSITION; 1265 return RecyclerView.NO_POSITION;
1266 } 1266 }
1267 } 1267 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698