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.widget.ExpandableListView; | 10 import android.widget.ExpandableListView; |
11 | 11 |
12 import org.chromium.ui.base.DeviceFormFactor; | 12 import org.chromium.ui.base.DeviceFormFactor; |
13 | 13 |
14 /** | 14 /** |
15 * Customized ExpandableListView for the recent tabs page. This class handles ta
blet-specific | 15 * Customized ExpandableListView for the recent tabs page. This class handles ta
blet-specific |
16 * layout implementation. | 16 * layout implementation. |
17 */ | 17 */ |
18 public class RecentTabsExpandableListView extends ExpandableListView { | 18 public class RecentTabsExpandableListView extends ExpandableListView { |
19 private static final int MAX_LIST_VIEW_WIDTH_DP = 550; | 19 private static final int MAX_LIST_VIEW_WIDTH_DP = 550; |
20 | 20 |
21 private int mMaxListViewWidth; | 21 private int mMaxListViewWidth; |
22 private int mSavedListPosition = 0; | 22 private int mSavedListPosition; |
23 private int mSavedListTop = 0; | 23 private int mSavedListTop; |
24 | 24 |
25 /** | 25 /** |
26 * Constructor for inflating from XML. | 26 * Constructor for inflating from XML. |
27 */ | 27 */ |
28 public RecentTabsExpandableListView(Context context, AttributeSet attrs) { | 28 public RecentTabsExpandableListView(Context context, AttributeSet attrs) { |
29 super(context, attrs); | 29 super(context, attrs); |
30 } | 30 } |
31 | 31 |
32 @Override | 32 @Override |
33 protected void onFinishInflate() { | 33 protected void onFinishInflate() { |
(...skipping 29 matching lines...) Expand all Loading... |
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 } |
OLD | NEW |