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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsExpandableListView.java

Issue 2847523002: Android: Remove GetApplicationContext part 4 (Closed)
Patch Set: Rebase and fix build Created 3 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.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.widget.ExpandableListView; 10 import android.widget.ExpandableListView;
(...skipping 20 matching lines...) Expand all
31 31
32 @Override 32 @Override
33 protected void onFinishInflate() { 33 protected void onFinishInflate() {
34 super.onFinishInflate(); 34 super.onFinishInflate();
35 float density = getResources().getDisplayMetrics().density; 35 float density = getResources().getDisplayMetrics().density;
36 mMaxListViewWidth = Math.round(MAX_LIST_VIEW_WIDTH_DP * density); 36 mMaxListViewWidth = Math.round(MAX_LIST_VIEW_WIDTH_DP * density);
37 } 37 }
38 38
39 @Override 39 @Override
40 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 40 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
41 if (!DeviceFormFactor.isTablet(getContext())) { 41 if (!DeviceFormFactor.isTablet()) {
42 super.onMeasure(widthMeasureSpec, heightMeasureSpec); 42 super.onMeasure(widthMeasureSpec, heightMeasureSpec);
43 return; 43 return;
44 } 44 }
45 45
46 // Increase padding if needed to ensure children are no wider than mMaxL istViewWidth. 46 // Increase padding if needed to ensure children are no wider than mMaxL istViewWidth.
47 int childWidth = MeasureSpec.getSize(widthMeasureSpec); 47 int childWidth = MeasureSpec.getSize(widthMeasureSpec);
48 int excessWidth = childWidth - mMaxListViewWidth; 48 int excessWidth = childWidth - mMaxListViewWidth;
49 int horizontalPadding = 0; 49 int horizontalPadding = 0;
50 if (excessWidth > 0) { 50 if (excessWidth > 0) {
51 horizontalPadding += excessWidth / 2; 51 horizontalPadding += excessWidth / 2;
(...skipping 11 matching lines...) Expand all
63 } 63 }
64 64
65 @Override 65 @Override
66 protected void onDetachedFromWindow() { 66 protected void onDetachedFromWindow() {
67 mSavedListPosition = getFirstVisiblePosition(); 67 mSavedListPosition = getFirstVisiblePosition();
68 View v = getChildAt(0); 68 View v = getChildAt(0);
69 mSavedListTop = (v == null) ? 0 : v.getTop(); 69 mSavedListTop = (v == null) ? 0 : v.getTop();
70 super.onDetachedFromWindow(); 70 super.onDetachedFromWindow();
71 } 71 }
72 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698