OLD | NEW |
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.ntp.cards; | 5 package org.chromium.chrome.browser.ntp.cards; |
6 | 6 |
7 import android.text.method.LinkMovementMethod; | 7 import android.text.method.LinkMovementMethod; |
8 import android.view.LayoutInflater; | 8 import android.view.LayoutInflater; |
9 import android.view.View; | 9 import android.view.View; |
10 import android.view.ViewGroup; | 10 import android.view.ViewGroup; |
(...skipping 13 matching lines...) Expand all Loading... |
24 @ItemViewType | 24 @ItemViewType |
25 protected int getItemViewType() { | 25 protected int getItemViewType() { |
26 return ItemViewType.FOOTER; | 26 return ItemViewType.FOOTER; |
27 } | 27 } |
28 | 28 |
29 @Override | 29 @Override |
30 protected void onBindViewHolder(NewTabPageViewHolder holder) { | 30 protected void onBindViewHolder(NewTabPageViewHolder holder) { |
31 // Nothing to do (the footer view is static). | 31 // Nothing to do (the footer view is static). |
32 } | 32 } |
33 | 33 |
| 34 @Override |
| 35 public void visitOptionalItem(NodeVisitor visitor) { |
| 36 visitor.visitFooter(); |
| 37 } |
| 38 |
34 /** | 39 /** |
35 * The {@code ViewHolder} for the {@link Footer}. | 40 * The {@code ViewHolder} for the {@link Footer}. |
36 */ | 41 */ |
37 public static class ViewHolder extends NewTabPageViewHolder { | 42 public static class ViewHolder extends NewTabPageViewHolder { |
38 public ViewHolder(ViewGroup root, final SuggestionsNavigationDelegate na
vigationDelegate) { | 43 public ViewHolder(ViewGroup root, final SuggestionsNavigationDelegate na
vigationDelegate) { |
39 super(LayoutInflater.from(root.getContext()) | 44 super(LayoutInflater.from(root.getContext()) |
40 .inflate(R.layout.new_tab_page_footer, root, false))
; | 45 .inflate(R.layout.new_tab_page_footer, root, false))
; |
41 | 46 |
42 NoUnderlineClickableSpan link = new NoUnderlineClickableSpan() { | 47 NoUnderlineClickableSpan link = new NoUnderlineClickableSpan() { |
43 @Override | 48 @Override |
44 public void onClick(View view) { | 49 public void onClick(View view) { |
45 // TODO(mvanouwerkerk): Ensure this can be activated when us
ing TalkBack. | 50 // TODO(mvanouwerkerk): Ensure this can be activated when us
ing TalkBack. |
46 navigationDelegate.navigateToHelpPage(); | 51 navigationDelegate.navigateToHelpPage(); |
47 } | 52 } |
48 }; | 53 }; |
49 | 54 |
50 TextView textView = (TextView) itemView.findViewById(R.id.text); | 55 TextView textView = (TextView) itemView.findViewById(R.id.text); |
51 textView.setText(SpanApplier.applySpans( | 56 textView.setText(SpanApplier.applySpans( |
52 root.getResources().getString(R.string.ntp_learn_more_about_
suggested_content), | 57 root.getResources().getString(R.string.ntp_learn_more_about_
suggested_content), |
53 new SpanApplier.SpanInfo("<link>", "</link>", link))); | 58 new SpanApplier.SpanInfo("<link>", "</link>", link))); |
54 textView.setMovementMethod(LinkMovementMethod.getInstance()); | 59 textView.setMovementMethod(LinkMovementMethod.getInstance()); |
55 } | 60 } |
56 } | 61 } |
57 } | 62 } |
OLD | NEW |