Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(642)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/ExpandablePreferenceGroup.java

Issue 1968503002: Revert of Site Settings Android: A few polish items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.preferences; 5 package org.chromium.chrome.browser.preferences;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.graphics.drawable.Drawable; 8 import android.graphics.drawable.Drawable;
9 import android.os.Build; 9 import android.os.Build;
10 import android.preference.PreferenceGroup; 10 import android.preference.PreferenceGroup;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 0, 53 0,
54 spannable.length() - prefCount.length(), 54 spannable.length() - prefCount.length(),
55 Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 55 Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
56 } else { 56 } else {
57 spannable.setSpan(new TypefaceSpan("sans-serif-medium"), 57 spannable.setSpan(new TypefaceSpan("sans-serif-medium"),
58 0, 58 0,
59 spannable.length() - prefCount.length(), 59 spannable.length() - prefCount.length(),
60 Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 60 Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
61 } 61 }
62 62
63 // Color the first part of the title blue.
64 ForegroundColorSpan blueSpan = new ForegroundColorSpan(
65 ApiCompatibilityUtils.getColor(getContext().getResources(),
66 R.color.pref_accent_color));
67 spannable.setSpan(blueSpan, 0, spannable.length() - prefCount.length(),
68 Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
69
70 // Gray out the total count of items.
71 int gray = ApiCompatibilityUtils.getColor(getContext().getResources(), 63 int gray = ApiCompatibilityUtils.getColor(getContext().getResources(),
72 R.color.expandable_group_dark_gray); 64 R.color.expandable_group_dark_gray);
73 spannable.setSpan(new ForegroundColorSpan(gray), 65 spannable.setSpan(new ForegroundColorSpan(gray),
74 spannable.length() - prefCount.length(), 66 spannable.length() - prefCount.length(),
75 spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 67 spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
76 setTitle(spannable); 68 setTitle(spannable);
77 } 69 }
78 70
79 public void setExpanded(boolean expanded) { 71 public void setExpanded(boolean expanded) {
80 mExpanded = expanded; 72 mExpanded = expanded;
(...skipping 11 matching lines...) Expand all
92 mImageView = (ImageView) view.findViewById(R.id.expando); 84 mImageView = (ImageView) view.findViewById(R.id.expando);
93 if (mDrawable != null) mImageView.setImageDrawable(mDrawable); 85 if (mDrawable != null) mImageView.setImageDrawable(mDrawable);
94 86
95 // For accessibility, read out the whole title and whether the group is collapsed/expanded. 87 // For accessibility, read out the whole title and whether the group is collapsed/expanded.
96 String description = getTitle() + getContext().getResources().getString( mExpanded 88 String description = getTitle() + getContext().getResources().getString( mExpanded
97 ? R.string.accessibility_expanded_group 89 ? R.string.accessibility_expanded_group
98 : R.string.accessibility_collapsed_group); 90 : R.string.accessibility_collapsed_group);
99 view.setContentDescription(description); 91 view.setContentDescription(description);
100 } 92 }
101 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698