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

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

Issue 1459593002: Added a UI for the Interests Prototype. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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.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.Resources; 9 import android.content.res.Resources;
10 import android.graphics.Bitmap; 10 import android.graphics.Bitmap;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 /** Opens the bookmarks page in the current tab. */ 128 /** Opens the bookmarks page in the current tab. */
129 void navigateToBookmarks(); 129 void navigateToBookmarks();
130 130
131 /** Opens the recent tabs page in the current tab. */ 131 /** Opens the recent tabs page in the current tab. */
132 void navigateToRecentTabs(); 132 void navigateToRecentTabs();
133 133
134 /** Opens a given URL in the current tab. */ 134 /** Opens a given URL in the current tab. */
135 void open(String url); 135 void open(String url);
136 136
137 /** Opens the recent tabs page in the current tab. */
138 void navigateToInterests();
139
137 /** 140 /**
138 * Animates the search box up into the omnibox and bring up the keyboard . 141 * Animates the search box up into the omnibox and bring up the keyboard .
139 * @param beginVoiceSearch Whether to begin a voice search. 142 * @param beginVoiceSearch Whether to begin a voice search.
140 * @param pastedText Text to paste in the omnibox after it's been focuse d. May be null. 143 * @param pastedText Text to paste in the omnibox after it's been focuse d. May be null.
141 */ 144 */
142 void focusSearchBox(boolean beginVoiceSearch, String pastedText); 145 void focusSearchBox(boolean beginVoiceSearch, String pastedText);
143 146
144 /** 147 /**
145 * Gets the list of most visited sites. 148 * Gets the list of most visited sites.
146 * @param observer The observer to be notified with the list of sites. 149 * @param observer The observer to be notified with the list of sites.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 public void onClick(View v) { 303 public void onClick(View v) {
301 mManager.navigateToRecentTabs(); 304 mManager.navigateToRecentTabs();
302 } 305 }
303 }); 306 });
304 toolbar.getBookmarksButton().setOnClickListener(new View.OnClickListener () { 307 toolbar.getBookmarksButton().setOnClickListener(new View.OnClickListener () {
305 @Override 308 @Override
306 public void onClick(View v) { 309 public void onClick(View v) {
307 mManager.navigateToBookmarks(); 310 mManager.navigateToBookmarks();
308 } 311 }
309 }); 312 });
313 toolbar.getInterestsButton().setOnClickListener(new View.OnClickListener () {
314 @Override
315 public void onClick(View v) {
316 mManager.navigateToInterests();
317 }
318 });
310 319
311 initializeSearchBoxScrollHandling(); 320 initializeSearchBoxScrollHandling();
312 addOnLayoutChangeListener(this); 321 addOnLayoutChangeListener(this);
313 setSearchProviderHasLogo(searchProviderHasLogo); 322 setSearchProviderHasLogo(searchProviderHasLogo);
314 323
315 mPendingLoadTasks++; 324 mPendingLoadTasks++;
316 mManager.setMostVisitedURLsObserver(this, 325 mManager.setMostVisitedURLsObserver(this,
317 mMostVisitedDesign.getNumberOfTiles(searchProviderHasLogo)); 326 mMostVisitedDesign.getNumberOfTiles(searchProviderHasLogo));
318 327
319 if (mManager.shouldShowOptOutPromo()) showOptOutPromo(); 328 if (mManager.shouldShowOptOutPromo()) showOptOutPromo();
320 329
321 // Set up snippets 330 // Set up snippets
322 if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_NTP_SNIPPE TS)) { 331 if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_NTP_SNIPPE TS)) {
323 mSnippetsView = (RecyclerView) findViewById(R.id.snippets_card_list) ; 332 mSnippetsView = (RecyclerView) findViewById(R.id.snippets_card_list) ;
324 mSnippetsView.setVisibility(View.VISIBLE); 333 mSnippetsView.setVisibility(View.VISIBLE);
325 mSnippetsView.setLayoutManager(new LinearLayoutManager(getContext()) ); 334 mSnippetsView.setLayoutManager(new LinearLayoutManager(getContext()) );
326 mSnippetsManager = new SnippetsManager(mManager, mSnippetsView); 335 mSnippetsManager = new SnippetsManager(mManager, mSnippetsView);
327 } 336 }
337
338 // Set up interests
339 if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_NTP_INTERE STS)) {
knn 2015/12/02 14:18:59 Can we check if user is signed in here?
PEConn 2015/12/08 17:27:50 Done.
340 toolbar.getInterestsButton().setVisibility(View.VISIBLE);
341 }
328 } 342 }
329 343
330 private int getTabsMovedIllustration() { 344 private int getTabsMovedIllustration() {
331 switch (Build.MANUFACTURER.toLowerCase(Locale.US)) { 345 switch (Build.MANUFACTURER.toLowerCase(Locale.US)) {
332 case "samsung": 346 case "samsung":
333 if (DocumentModeManager.isDeviceTabbedModeByDefault()) return 0; 347 if (DocumentModeManager.isDeviceTabbedModeByDefault()) return 0;
334 return R.drawable.tabs_moved_samsung; 348 return R.drawable.tabs_moved_samsung;
335 case "htc": 349 case "htc":
336 return R.drawable.tabs_moved_htc; 350 return R.drawable.tabs_moved_htc;
337 default: 351 default:
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 } 1112 }
1099 } 1113 }
1100 } 1114 }
1101 1115
1102 @Override 1116 @Override
1103 public boolean preferLargeIcons() { 1117 public boolean preferLargeIcons() {
1104 return true; 1118 return true;
1105 } 1119 }
1106 } 1120 }
1107 } 1121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698