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

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

Issue 2730703003: Change CBD layout and texts (Closed)
Patch Set: Remove padding Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.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 13 matching lines...) Expand all
24 */ 24 */
25 public ClearBrowsingDataCheckBoxPreference(Context context, AttributeSet att rs) { 25 public ClearBrowsingDataCheckBoxPreference(Context context, AttributeSet att rs) {
26 super(context, attrs); 26 super(context, attrs);
27 } 27 }
28 28
29 @Override 29 @Override
30 public View onCreateView(ViewGroup parent) { 30 public View onCreateView(ViewGroup parent) {
31 if (mView != null) return mView; 31 if (mView != null) return mView;
32 32
33 mView = (LinearLayout) super.onCreateView(parent); 33 mView = (LinearLayout) super.onCreateView(parent);
34 setupLayout(mView);
34 35
36 return mView;
37 }
38
39 /**
40 * This method modifies the default CheckBoxPreference layout.
41 * @param view The view of this preference.
42 */
43 protected void setupLayout(LinearLayout view) {
35 // Checkboxes in the Clear Browsing Data dialog will show and hide the r esults of 44 // Checkboxes in the Clear Browsing Data dialog will show and hide the r esults of
36 // BrowsingDataCounter. It is important that they will not change height when doing so. 45 // BrowsingDataCounter. It is important that they will not change height when doing so.
37 // We will therefore set a fixed height. 46 // We will therefore set a fixed height.
38 int height = getContext().getResources().getDimensionPixelSize( 47 int height = getContext().getResources().getDimensionPixelSize(
39 R.dimen.clear_browsing_data_checkbox_height); 48 R.dimen.clear_browsing_data_checkbox_height);
40 mView.setMinimumHeight(height); 49 view.setMinimumHeight(height);
41 50
42 // The title and summary are enclosed in a common RelativeLayout. We mus t remove 51 // The title and summary are enclosed in a common RelativeLayout. We mus t remove
43 // its vertical padding for it to be correctly vertically centered in th e fixed-height view. 52 // its vertical padding for it to be correctly vertically centered in th e fixed-height view.
44 View textLayout = (View) mView.findViewById(android.R.id.title).getParen t(); 53 View textLayout = (View) view.findViewById(android.R.id.title).getParent ();
45 ApiCompatibilityUtils.setPaddingRelative( 54 ApiCompatibilityUtils.setPaddingRelative(
46 textLayout, 55 textLayout,
47 ApiCompatibilityUtils.getPaddingStart(textLayout), 56 ApiCompatibilityUtils.getPaddingStart(textLayout),
48 0, 57 0,
49 ApiCompatibilityUtils.getPaddingEnd(textLayout), 58 ApiCompatibilityUtils.getPaddingEnd(textLayout),
50 0); 59 0);
51
52 return mView;
53 } 60 }
54 61
55 public void announceForAccessibility(CharSequence announcement) { 62 public void announceForAccessibility(CharSequence announcement) {
56 if (mView != null) mView.announceForAccessibility(announcement); 63 if (mView != null) mView.announceForAccessibility(announcement);
57 } 64 }
58 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698