| 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
())); | |
| 56 } | 54 } |
| 57 | 55 |
| 58 private ViewGroup initButton(int buttonId, int drawableId) { | 56 private ViewGroup initButton(int buttonId, int drawableId) { |
| 59 ViewGroup button = (ViewGroup) findViewById(buttonId); | 57 ViewGroup button = (ViewGroup) findViewById(buttonId); |
| 60 TextView textView = (TextView) button.getChildAt(0); | 58 TextView textView = (TextView) button.getChildAt(0); |
| 61 | 59 |
| 62 TintedDrawable icon = TintedDrawable.constructTintedDrawable(getResource
s(), drawableId); | 60 TintedDrawable icon = TintedDrawable.constructTintedDrawable(getResource
s(), drawableId); |
| 63 ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds( | 61 ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds( |
| 64 textView, icon, null, null, null); | 62 textView, icon, null, null, null); |
| 65 | 63 |
| 66 return button; | 64 return button; |
| 67 } | 65 } |
| 68 } | 66 } |
| OLD | NEW |