| 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 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 @Override | 41 @Override |
| 42 protected void onFinishInflate() { | 42 protected void onFinishInflate() { |
| 43 super.onFinishInflate(); | 43 super.onFinishInflate(); |
| 44 mBookmarksButton = initButton(R.id.bookmarks_button, R.drawable.btn_star
); | 44 mBookmarksButton = initButton(R.id.bookmarks_button, R.drawable.btn_star
); |
| 45 mRecentTabsButton = initButton(R.id.recent_tabs_button, R.drawable.btn_r
ecents); | 45 mRecentTabsButton = initButton(R.id.recent_tabs_button, R.drawable.btn_r
ecents); |
| 46 ((TextView) mBookmarksButton.getChildAt(0)).setText(R.string.ntp_bookmar
ks); | 46 ((TextView) mBookmarksButton.getChildAt(0)).setText(R.string.ntp_bookmar
ks); |
| 47 ((TextView) mBookmarksButton.getChildAt(0)).setContentDescription(getRes
ources().getString( | 47 ((TextView) mBookmarksButton.getChildAt(0)).setContentDescription(getRes
ources().getString( |
| 48 R.string.accessibility_ntp_toolbar_btn_bookmarks)); | 48 R.string.accessibility_ntp_toolbar_btn_bookmarks)); |
| 49 | 49 |
| 50 setBackgroundColor(NtpStyleUtils.getToolbarBackgroundColorResource(getRe
sources())); | 50 setBackgroundColor(ApiCompatibilityUtils.getColor(getResources(), R.colo
r.ntp_bg)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 private ViewGroup initButton(int buttonId, int drawableId) { | 53 private ViewGroup initButton(int buttonId, int drawableId) { |
| 54 ViewGroup button = (ViewGroup) findViewById(buttonId); | 54 ViewGroup button = (ViewGroup) findViewById(buttonId); |
| 55 TextView textView = (TextView) button.getChildAt(0); | 55 TextView textView = (TextView) button.getChildAt(0); |
| 56 | 56 |
| 57 TintedDrawable icon = TintedDrawable.constructTintedDrawable(getResource
s(), drawableId); | 57 TintedDrawable icon = TintedDrawable.constructTintedDrawable(getResource
s(), drawableId); |
| 58 ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds( | 58 ApiCompatibilityUtils.setCompoundDrawablesRelativeWithIntrinsicBounds( |
| 59 textView, icon, null, null, null); | 59 textView, icon, null, null, null); |
| 60 | 60 |
| 61 return button; | 61 return button; |
| 62 } | 62 } |
| 63 } | 63 } |
| OLD | NEW |