Chromium Code Reviews| 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; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.app.Dialog; | 8 import android.app.Dialog; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.DialogInterface; | 10 import android.content.DialogInterface; |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 | 347 |
| 348 // If there is at least one item with an icon then we set mImageView 's | 348 // If there is at least one item with an icon then we set mImageView 's |
| 349 // visibility to INVISIBLE for all items with no icons. We do this | 349 // visibility to INVISIBLE for all items with no icons. We do this |
| 350 // so that all items' desriptions are aligned. | 350 // so that all items' desriptions are aligned. |
| 351 if (!mHasIcon) { | 351 if (!mHasIcon) { |
| 352 row.mImageView.setVisibility(View.GONE); | 352 row.mImageView.setVisibility(View.GONE); |
| 353 } else { | 353 } else { |
| 354 ItemChooserRow item = getItem(position); | 354 ItemChooserRow item = getItem(position); |
| 355 if (item.mIcon != null) { | 355 if (item.mIcon != null) { |
| 356 row.mImageView.setContentDescription(item.mIconDescription); | 356 row.mImageView.setContentDescription(item.mIconDescription); |
| 357 | |
| 358 // Save the icon's level since setImageLevel could | |
| 359 // replace the drawable's level. | |
| 360 int drawableLevel = item.mIcon.getLevel(); | |
|
ortuno
2017/04/18 06:57:07
This seems pretty leaky.
David Trainor- moved to gerrit
2017/04/19 21:32:07
Should mIconLevel or "mSignalLevel" or something b
ortuno
2017/04/19 23:48:02
Oh right, we can save it as part of ItemChooserRow
| |
| 361 | |
| 357 row.mImageView.setImageDrawable(item.mIcon); | 362 row.mImageView.setImageDrawable(item.mIcon); |
| 363 | |
| 364 row.mImageView.setImageLevel(drawableLevel); | |
| 358 row.mImageView.setVisibility(View.VISIBLE); | 365 row.mImageView.setVisibility(View.VISIBLE); |
| 359 } else { | 366 } else { |
| 360 row.mImageView.setVisibility(View.INVISIBLE); | 367 row.mImageView.setVisibility(View.INVISIBLE); |
| 361 row.mImageView.setImageDrawable(null); | 368 row.mImageView.setImageDrawable(null); |
| 362 row.mImageView.setContentDescription(null); | 369 row.mImageView.setContentDescription(null); |
| 363 } | 370 } |
| 364 row.mImageView.setSelected(position == mSelectedItem); | 371 row.mImageView.setSelected(position == mSelectedItem); |
| 365 } | 372 } |
| 366 return convertView; | 373 return convertView; |
| 367 } | 374 } |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 681 } | 688 } |
| 682 | 689 |
| 683 /** | 690 /** |
| 684 * Returns the ItemAdapter associated with this class. For use with tests on ly. | 691 * Returns the ItemAdapter associated with this class. For use with tests on ly. |
| 685 */ | 692 */ |
| 686 @VisibleForTesting | 693 @VisibleForTesting |
| 687 public ItemAdapter getItemAdapterForTesting() { | 694 public ItemAdapter getItemAdapterForTesting() { |
| 688 return mItemAdapter; | 695 return mItemAdapter; |
| 689 } | 696 } |
| 690 } | 697 } |
| OLD | NEW |