OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.widget.findinpage; |
| 6 |
| 7 import android.content.Context; |
| 8 import android.content.res.ColorStateList; |
| 9 import android.graphics.Color; |
| 10 import android.util.AttributeSet; |
| 11 import android.view.View; |
| 12 |
| 13 import com.google.android.apps.chrome.R; |
| 14 |
| 15 /** |
| 16 * A phone specific version of the {@link FindToolbar}. |
| 17 */ |
| 18 public class FindToolbarPhone extends FindToolbar { |
| 19 /** |
| 20 * Creates an instance of a {@link FindToolbarPhone}. |
| 21 * @param context The Context to create the {@link FindToolbarPhone} under. |
| 22 * @param attrs The AttributeSet used to create the {@link FindToolbarPhone}
. |
| 23 */ |
| 24 public FindToolbarPhone(Context context, AttributeSet attrs) { |
| 25 super(context, attrs); |
| 26 } |
| 27 |
| 28 @Override |
| 29 public void activate() { |
| 30 if (!isViewAvailable()) return; |
| 31 setVisibility(View.VISIBLE); |
| 32 super.activate(); |
| 33 } |
| 34 |
| 35 @Override |
| 36 public void deactivate() { |
| 37 super.deactivate(); |
| 38 setVisibility(View.GONE); |
| 39 } |
| 40 |
| 41 @Override |
| 42 protected void updateVisualsForTabModel(boolean isIncognito) { |
| 43 int queryTextColorId; |
| 44 if (isIncognito) { |
| 45 setBackgroundResource(R.color.incognito_primary_color); |
| 46 ColorStateList white = getResources().getColorStateList(R.color.ligh
t_mode_tint); |
| 47 mFindNextButton.setTint(white); |
| 48 mFindPrevButton.setTint(white); |
| 49 mCloseFindButton.setTint(white); |
| 50 queryTextColorId = R.color.find_in_page_query_white_color; |
| 51 } else { |
| 52 setBackgroundColor(Color.WHITE); |
| 53 ColorStateList dark = getResources().getColorStateList(R.color.dark_
mode_tint); |
| 54 mFindNextButton.setTint(dark); |
| 55 mFindPrevButton.setTint(dark); |
| 56 mCloseFindButton.setTint(dark); |
| 57 queryTextColorId = R.color.find_in_page_query_color; |
| 58 } |
| 59 mFindQuery.setTextColor(getContext().getResources().getColor(queryTextCo
lorId)); |
| 60 } |
| 61 |
| 62 @Override |
| 63 protected int getStatusColor(boolean failed, boolean incognito) { |
| 64 if (!failed && incognito) { |
| 65 return getContext().getResources().getColor( |
| 66 R.color.find_in_page_results_status_white_color); |
| 67 } |
| 68 |
| 69 return super.getStatusColor(failed, incognito); |
| 70 } |
| 71 } |
OLD | NEW |