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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/history/HistoryAdapter.java

Issue 2888313003: Update strings for history description in CBD (Closed)
Patch Set: cbd history string Created 3 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.history; 5 package org.chromium.chrome.browser.history;
6 6
7 import android.content.res.Resources; 7 import android.content.res.Resources;
8 import android.support.v7.widget.RecyclerView; 8 import android.support.v7.widget.RecyclerView;
9 import android.support.v7.widget.RecyclerView.ViewHolder; 9 import android.support.v7.widget.RecyclerView.ViewHolder;
10 import android.text.SpannableString; 10 import android.text.SpannableString;
11 import android.text.method.LinkMovementMethod; 11 import android.text.method.LinkMovementMethod;
12 import android.view.LayoutInflater; 12 import android.view.LayoutInflater;
13 import android.view.View; 13 import android.view.View;
14 import android.view.View.OnClickListener; 14 import android.view.View.OnClickListener;
15 import android.view.ViewGroup; 15 import android.view.ViewGroup;
16 import android.widget.Button; 16 import android.widget.Button;
17 import android.widget.FrameLayout; 17 import android.widget.FrameLayout;
18 import android.widget.TextView; 18 import android.widget.TextView;
19 19
20 import org.chromium.base.VisibleForTesting; 20 import org.chromium.base.VisibleForTesting;
21 import org.chromium.chrome.R; 21 import org.chromium.chrome.R;
22 import org.chromium.chrome.browser.ChromeFeatureList;
22 import org.chromium.chrome.browser.history.HistoryProvider.BrowsingHistoryObserv er; 23 import org.chromium.chrome.browser.history.HistoryProvider.BrowsingHistoryObserv er;
23 import org.chromium.chrome.browser.preferences.PrefServiceBridge; 24 import org.chromium.chrome.browser.preferences.PrefServiceBridge;
24 import org.chromium.chrome.browser.widget.DateDividedAdapter; 25 import org.chromium.chrome.browser.widget.DateDividedAdapter;
25 import org.chromium.chrome.browser.widget.displaystyle.MarginResizer; 26 import org.chromium.chrome.browser.widget.displaystyle.MarginResizer;
26 import org.chromium.chrome.browser.widget.selection.SelectableItemViewHolder; 27 import org.chromium.chrome.browser.widget.selection.SelectableItemViewHolder;
27 import org.chromium.chrome.browser.widget.selection.SelectableListLayout; 28 import org.chromium.chrome.browser.widget.selection.SelectableListLayout;
28 import org.chromium.chrome.browser.widget.selection.SelectionDelegate; 29 import org.chromium.chrome.browser.widget.selection.SelectionDelegate;
29 import org.chromium.chrome.browser.widget.selection.SelectionDelegate.SelectionO bserver; 30 import org.chromium.chrome.browser.widget.selection.SelectionDelegate.SelectionO bserver;
30 import org.chromium.components.signin.ChromeSigninController; 31 import org.chromium.components.signin.ChromeSigninController;
31 import org.chromium.ui.text.NoUnderlineClickableSpan; 32 import org.chromium.ui.text.NoUnderlineClickableSpan;
32 import org.chromium.ui.text.SpanApplier; 33 import org.chromium.ui.text.SpanApplier;
33 34
34 import java.util.ArrayList; 35 import java.util.ArrayList;
35 import java.util.List; 36 import java.util.List;
36 import java.util.Locale; 37 import java.util.Locale;
37 38
38 /** 39 /**
39 * Bridges the user's browsing history and the UI used to display it. 40 * Bridges the user's browsing history and the UI used to display it.
40 */ 41 */
41 public class HistoryAdapter extends DateDividedAdapter implements BrowsingHistor yObserver { 42 public class HistoryAdapter extends DateDividedAdapter implements BrowsingHistor yObserver {
42 private static final String EMPTY_QUERY = ""; 43 private static final String EMPTY_QUERY = "";
43 private static final String LEARN_MORE_LINK = 44 private static final String LEARN_MORE_LINK =
44 "https://support.google.com/chrome/?p=sync_history&hl=" 45 "https://support.google.com/chrome/?p=sync_history&hl="
45 + Locale.getDefault().toString(); 46 + Locale.getDefault().toString();
46 private static final String GOOGLE_HISTORY_LINK = "history.google.com"; 47 private static final String GOOGLE_HISTORY_LINK = "history.google.com";
48 private static final String MY_ACTIVITY_LINK = "myactivity.google.com";
47 49
48 private final SelectionDelegate<HistoryItem> mSelectionDelegate; 50 private final SelectionDelegate<HistoryItem> mSelectionDelegate;
49 private final HistoryProvider mHistoryProvider; 51 private final HistoryProvider mHistoryProvider;
50 private final HistoryManager mHistoryManager; 52 private final HistoryManager mHistoryManager;
51 private final ArrayList<HistoryItemView> mItemViews; 53 private final ArrayList<HistoryItemView> mItemViews;
52 private RecyclerView mRecyclerView; 54 private RecyclerView mRecyclerView;
53 55
54 private ViewGroup mPrivacyDisclaimers; 56 private ViewGroup mPrivacyDisclaimers;
55 private TextView mSignedInNotSyncedTextView; 57 private TextView mSignedInNotSyncedTextView;
56 private TextView mSignedInSyncedTextView; 58 private TextView mSignedInSyncedTextView;
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 mSignedInSyncedTextView = (TextView) v.findViewById(R.id.signed_in_synce d); 329 mSignedInSyncedTextView = (TextView) v.findViewById(R.id.signed_in_synce d);
328 setPrivacyDisclaimerText(mSignedInSyncedTextView, 330 setPrivacyDisclaimerText(mSignedInSyncedTextView,
329 R.string.android_history_has_synced_results, LEARN_MORE_LINK); 331 R.string.android_history_has_synced_results, LEARN_MORE_LINK);
330 MarginResizer.createWithViewAdapter(mSignedInSyncedTextView, 332 MarginResizer.createWithViewAdapter(mSignedInSyncedTextView,
331 mHistoryManager.getSelectableListLayout().getUiConfig(), 333 mHistoryManager.getSelectableListLayout().getUiConfig(),
332 getDefaultTextMargin(resources), 334 getDefaultTextMargin(resources),
333 SelectableListLayout.getDefaultListItemLateralShadowSizePx(resou rces)); 335 SelectableListLayout.getDefaultListItemLateralShadowSizePx(resou rces));
334 336
335 mOtherFormsOfBrowsingHistoryTextView = (TextView) v.findViewById( 337 mOtherFormsOfBrowsingHistoryTextView = (TextView) v.findViewById(
336 R.id.other_forms_of_browsing_history); 338 R.id.other_forms_of_browsing_history);
337 setPrivacyDisclaimerText(mOtherFormsOfBrowsingHistoryTextView, 339 boolean flagEnabled = ChromeFeatureList.isEnabled(ChromeFeatureList.TABS _IN_CBD);
Yaron 2017/05/24 14:18:43 is native guaranteed to be loaded at this point? I
dullweber 2017/05/24 14:54:52 Thanks for pointing at this, I don't know how the
Yaron 2017/05/24 15:27:06 yep.
338 R.string.android_history_other_forms_of_history, GOOGLE_HISTORY_ LINK); 340 int disclaimerTextId = flagEnabled ? R.string.android_history_other_form s_of_history_new
341 : R.string.android_history_other_form s_of_history;
342 String disclaimerUrl = flagEnabled ? MY_ACTIVITY_LINK : GOOGLE_HISTORY_L INK;
343 setPrivacyDisclaimerText(
344 mOtherFormsOfBrowsingHistoryTextView, disclaimerTextId, disclaim erUrl);
339 MarginResizer.createWithViewAdapter(mOtherFormsOfBrowsingHistoryTextView , 345 MarginResizer.createWithViewAdapter(mOtherFormsOfBrowsingHistoryTextView ,
340 mHistoryManager.getSelectableListLayout().getUiConfig(), 346 mHistoryManager.getSelectableListLayout().getUiConfig(),
341 getDefaultTextMargin(resources), 347 getDefaultTextMargin(resources),
342 SelectableListLayout.getDefaultListItemLateralShadowSizePx(resou rces)); 348 SelectableListLayout.getDefaultListItemLateralShadowSizePx(resou rces));
343 349
344 setPrivacyDisclaimerVisibility(); 350 setPrivacyDisclaimerVisibility();
345 351
346 return new BasicViewHolder(v); 352 return new BasicViewHolder(v);
347 } 353 }
348 354
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 @VisibleForTesting 422 @VisibleForTesting
417 TextView getSignedInSyncedViewForTests() { 423 TextView getSignedInSyncedViewForTests() {
418 return mSignedInSyncedTextView; 424 return mSignedInSyncedTextView;
419 } 425 }
420 426
421 @VisibleForTesting 427 @VisibleForTesting
422 TextView getOtherFormsOfBrowsingHistoryViewForTests() { 428 TextView getOtherFormsOfBrowsingHistoryViewForTests() {
423 return mOtherFormsOfBrowsingHistoryTextView; 429 return mOtherFormsOfBrowsingHistoryTextView;
424 } 430 }
425 } 431 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698