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.selection; | 5 package org.chromium.chrome.browser.widget.selection; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.graphics.Color; | 9 import android.graphics.Color; |
10 import android.support.annotation.CallSuper; | 10 import android.support.annotation.CallSuper; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 protected static final int NAVIGATION_BUTTON_NONE = 0; | 71 protected static final int NAVIGATION_BUTTON_NONE = 0; |
72 /** Button to open the DrawerLayout. Only valid if mDrawerLayout is set. **/ | 72 /** Button to open the DrawerLayout. Only valid if mDrawerLayout is set. **/ |
73 protected static final int NAVIGATION_BUTTON_MENU = 1; | 73 protected static final int NAVIGATION_BUTTON_MENU = 1; |
74 /** Button to navigate back. This calls {@link #onNavigationBack()}. **/ | 74 /** Button to navigate back. This calls {@link #onNavigationBack()}. **/ |
75 protected static final int NAVIGATION_BUTTON_BACK = 2; | 75 protected static final int NAVIGATION_BUTTON_BACK = 2; |
76 /** Button to clear the selection. **/ | 76 /** Button to clear the selection. **/ |
77 protected static final int NAVIGATION_BUTTON_SELECTION_BACK = 3; | 77 protected static final int NAVIGATION_BUTTON_SELECTION_BACK = 3; |
78 | 78 |
79 protected boolean mIsSelectionEnabled; | 79 protected boolean mIsSelectionEnabled; |
80 protected SelectionDelegate<E> mSelectionDelegate; | 80 protected SelectionDelegate<E> mSelectionDelegate; |
| 81 protected boolean mIsSearching; |
81 | 82 |
82 private boolean mHasSearchView; | 83 private boolean mHasSearchView; |
83 private boolean mIsSearching; | |
84 private LinearLayout mSearchView; | 84 private LinearLayout mSearchView; |
85 private EditText mSearchEditText; | 85 private EditText mSearchEditText; |
86 private TintedImageButton mClearTextButton; | 86 private TintedImageButton mClearTextButton; |
87 private SearchDelegate mSearchDelegate; | 87 private SearchDelegate mSearchDelegate; |
88 | 88 |
89 protected NumberRollView mNumberRollView; | 89 protected NumberRollView mNumberRollView; |
90 private DrawerLayout mDrawerLayout; | 90 private DrawerLayout mDrawerLayout; |
91 private ActionBarDrawerToggle mActionBarDrawerToggle; | 91 private ActionBarDrawerToggle mActionBarDrawerToggle; |
92 private TintedDrawable mNormalMenuButton; | 92 private TintedDrawable mNormalMenuButton; |
93 private TintedDrawable mSelectionMenuButton; | 93 private TintedDrawable mSelectionMenuButton; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 306 } |
307 | 307 |
308 if (mNavigationButton == NAVIGATION_BUTTON_MENU) { | 308 if (mNavigationButton == NAVIGATION_BUTTON_MENU) { |
309 initActionBarDrawerToggle(); | 309 initActionBarDrawerToggle(); |
310 // ActionBarDrawerToggle will take care of icon and content descript
ion, so just return. | 310 // ActionBarDrawerToggle will take care of icon and content descript
ion, so just return. |
311 return; | 311 return; |
312 } | 312 } |
313 | 313 |
314 if (mActionBarDrawerToggle != null) { | 314 if (mActionBarDrawerToggle != null) { |
315 mActionBarDrawerToggle.setDrawerIndicatorEnabled(false); | 315 mActionBarDrawerToggle.setDrawerIndicatorEnabled(false); |
316 mDrawerLayout.addDrawerListener(null); | 316 mDrawerLayout.removeDrawerListener(mActionBarDrawerToggle); |
| 317 mActionBarDrawerToggle = null; |
317 } | 318 } |
318 | 319 |
319 setNavigationOnClickListener(this); | 320 setNavigationOnClickListener(this); |
320 | 321 |
321 switch (mNavigationButton) { | 322 switch (mNavigationButton) { |
322 case NAVIGATION_BUTTON_NONE: | 323 case NAVIGATION_BUTTON_NONE: |
323 break; | 324 break; |
324 case NAVIGATION_BUTTON_BACK: | 325 case NAVIGATION_BUTTON_BACK: |
325 // TODO(twellington): use ic_arrow_back_white_24dp and tint it. | 326 // TODO(twellington): use ic_arrow_back_white_24dp and tint it. |
326 iconResId = R.drawable.back_normal; | 327 iconResId = R.drawable.back_normal; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 | 525 |
525 private void updateDisplayStyleIfNecessary() { | 526 private void updateDisplayStyleIfNecessary() { |
526 if (mUiConfig != null) onDisplayStyleChanged(mUiConfig.getCurrentDisplay
Style()); | 527 if (mUiConfig != null) onDisplayStyleChanged(mUiConfig.getCurrentDisplay
Style()); |
527 } | 528 } |
528 | 529 |
529 @VisibleForTesting | 530 @VisibleForTesting |
530 public View getSearchViewForTests() { | 531 public View getSearchViewForTests() { |
531 return mSearchView; | 532 return mSearchView; |
532 } | 533 } |
533 } | 534 } |
OLD | NEW |