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.content.Context; | 7 import android.content.Context; |
8 import android.util.AttributeSet; | 8 import android.util.AttributeSet; |
9 import android.view.View; | 9 import android.view.View; |
10 import android.view.ViewGroup; | 10 import android.view.ViewGroup; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 @Override | 45 @Override |
46 protected void onFinishInflate() { | 46 protected void onFinishInflate() { |
47 super.onFinishInflate(); | 47 super.onFinishInflate(); |
48 mBookmarksButton = initButton(R.id.bookmarks_button, R.drawable.btn_star
); | 48 mBookmarksButton = initButton(R.id.bookmarks_button, R.drawable.btn_star
); |
49 mRecentTabsButton = initButton(R.id.recent_tabs_button, R.drawable.btn_r
ecents); | 49 mRecentTabsButton = initButton(R.id.recent_tabs_button, R.drawable.btn_r
ecents); |
50 ((TextView) mBookmarksButton.getChildAt(0)).setText(R.string.ntp_bookmar
ks); | 50 ((TextView) mBookmarksButton.getChildAt(0)).setText(R.string.ntp_bookmar
ks); |
51 ((TextView) mBookmarksButton.getChildAt(0)).setContentDescription(getRes
ources().getString( | 51 ((TextView) mBookmarksButton.getChildAt(0)).setContentDescription(getRes
ources().getString( |
52 R.string.accessibility_ntp_toolbar_btn_bookmarks)); | 52 R.string.accessibility_ntp_toolbar_btn_bookmarks)); |
53 mInterestsButton = initButton(R.id.interests_button, R.drawable.btn_sta
r_filled); | 53 mInterestsButton = initButton(R.id.interests_button, R.drawable.btn_sta
r_filled); |
| 54 |
| 55 setBackgroundColor(NtpColorUtils.getBackgroundColorResource(getResources
())); |
54 } | 56 } |
55 | 57 |
56 private ViewGroup initButton(int buttonId, int drawableId) { | 58 private ViewGroup initButton(int buttonId, int drawableId) { |
57 ViewGroup button = (ViewGroup) findViewById(buttonId); | 59 ViewGroup button = (ViewGroup) findViewById(buttonId); |
58 TextView textView = (TextView) button.getChildAt(0); | 60 TextView textView = (TextView) button.getChildAt(0); |
59 | 61 |
60 TintedDrawable icon = TintedDrawable.constructTintedDrawable(getResource
s(), drawableId); | 62 TintedDrawable icon = TintedDrawable.constructTintedDrawable(getResource
s(), drawableId); |
61 ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds( | 63 ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds( |
62 textView, icon, null, null, null); | 64 textView, icon, null, null, null); |
63 | 65 |
64 return button; | 66 return button; |
65 } | 67 } |
66 } | 68 } |
OLD | NEW |