Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.widget.bottomsheet; | 5 package org.chromium.chrome.browser.widget.bottomsheet; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.content.res.Resources; | 8 import android.content.res.Resources; |
| 9 import android.support.design.internal.BottomNavigationItemView; | 9 import android.support.design.internal.BottomNavigationItemView; |
| 10 import android.support.design.internal.BottomNavigationMenuView; | 10 import android.support.design.internal.BottomNavigationMenuView; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 | 116 |
| 117 showBottomSheetContent(R.id.action_home); | 117 showBottomSheetContent(R.id.action_home); |
| 118 } | 118 } |
| 119 | 119 |
| 120 @Override | 120 @Override |
| 121 public void onLoadUrl(String url) {} | 121 public void onLoadUrl(String url) {} |
| 122 | 122 |
| 123 @Override | 123 @Override |
| 124 public void onSheetOffsetChanged(float heightFraction) {} | 124 public void onSheetOffsetChanged(float heightFraction) {} |
| 125 | 125 |
| 126 @Override | |
| 127 public void onSheetStateChanged(int newState) {} | |
| 128 | |
| 129 @Override | |
| 130 public void onSheetContentChanged(BottomSheetContent newContent) {} | |
|
Theresa
2017/03/17 16:07:12
I'm considering making a new class variable for th
mdjones
2017/03/17 18:17:26
Yeah, I think that interface is sufficiently large
| |
| 131 | |
| 126 // TODO(twellington): remove this once the support library is updated to all ow disabling | 132 // TODO(twellington): remove this once the support library is updated to all ow disabling |
| 127 // shifting mode or determines shifting mode based on the width of the | 133 // shifting mode or determines shifting mode based on the width of the |
| 128 // child views. | 134 // child views. |
| 129 private void disableShiftingMode() { | 135 private void disableShiftingMode() { |
| 130 BottomNavigationMenuView menuView = (BottomNavigationMenuView) getChildA t(0); | 136 BottomNavigationMenuView menuView = (BottomNavigationMenuView) getChildA t(0); |
| 131 try { | 137 try { |
| 132 Field shiftingMode = menuView.getClass().getDeclaredField("mShifting Mode"); | 138 Field shiftingMode = menuView.getClass().getDeclaredField("mShifting Mode"); |
| 133 shiftingMode.setAccessible(true); | 139 shiftingMode.setAccessible(true); |
| 134 shiftingMode.setBoolean(menuView, false); | 140 shiftingMode.setBoolean(menuView, false); |
| 135 shiftingMode.setAccessible(false); | 141 shiftingMode.setAccessible(false); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 // There are some bugs related to programatically selecting menu items t hat are fixed in | 174 // There are some bugs related to programatically selecting menu items t hat are fixed in |
| 169 // newer support library versions. | 175 // newer support library versions. |
| 170 // TODO(twellington): remove this after the support library is rolled. | 176 // TODO(twellington): remove this after the support library is rolled. |
| 171 if (mSelectedItemId != 0) getMenu().findItem(mSelectedItemId).setChecked (false); | 177 if (mSelectedItemId != 0) getMenu().findItem(mSelectedItemId).setChecked (false); |
| 172 mSelectedItemId = navItemId; | 178 mSelectedItemId = navItemId; |
| 173 getMenu().findItem(mSelectedItemId).setChecked(true); | 179 getMenu().findItem(mSelectedItemId).setChecked(true); |
| 174 | 180 |
| 175 mBottomSheet.showContent(getSheetContentForId(mSelectedItemId)); | 181 mBottomSheet.showContent(getSheetContentForId(mSelectedItemId)); |
| 176 } | 182 } |
| 177 } | 183 } |
| OLD | NEW |