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.Dialog; | 7 import android.app.Dialog; | 
| 8 import android.content.Context; | 8 import android.content.Context; | 
| 9 import android.content.DialogInterface; | 9 import android.content.DialogInterface; | 
| 10 import android.graphics.Color; | 10 import android.graphics.Color; | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 mKey = key; | 66 mKey = key; | 
| 67 mDescription = description; | 67 mDescription = description; | 
| 68 } | 68 } | 
| 69 } | 69 } | 
| 70 | 70 | 
| 71 /** | 71 /** | 
| 72 * The labels to show in the dialog. | 72 * The labels to show in the dialog. | 
| 73 */ | 73 */ | 
| 74 public static class ItemChooserLabels { | 74 public static class ItemChooserLabels { | 
| 75 // The title at the top of the dialog. | 75 // The title at the top of the dialog. | 
| 76 public final SpannableString mTitle; | 76 public final SpannableString mTitle; | 
| 
 
Ted C
2016/02/19 17:54:01
fwiw since these are all public, they shouldn't st
 
ortuno
2016/02/19 18:26:28
Thanks for pointing that out. I opened crbug.com/5
 
 | |
| 77 // The message to show while there are no results. | 77 // The message to show while there are no results. | 
| 78 public final String mSearching; | 78 public final SpannableString mSearching; | 
| 79 // The message to show when no results were produced. | 79 // The message to show when no results were produced. | 
| 80 public final SpannableString mNoneFound; | 80 public final SpannableString mNoneFound; | 
| 81 // A status message to show above the button row after an item has | 81 // A status message to show above the button row after an item has | 
| 82 // been added and discovery is still ongoing. | 82 // been added and discovery is still ongoing. | 
| 83 public final SpannableString mStatusActive; | 83 public final SpannableString mStatusActive; | 
| 84 // A status message to show above the button row after discovery has | |
| 85 // stopped and no devices have been found. | |
| 86 public final SpannableString mStatusIdleNoneFound; | |
| 84 // A status message to show above the button row after an item has | 87 // A status message to show above the button row after an item has | 
| 85 // been added and discovery has stopped. | 88 // been added and discovery has stopped. | 
| 86 public final SpannableString mStatusIdle; | 89 public final SpannableString mStatusIdleSomeFound; | 
| 87 // The label for the positive button (e.g. Select/Pair). | 90 // The label for the positive button (e.g. Select/Pair). | 
| 88 public final String mPositiveButton; | 91 public final String mPositiveButton; | 
| 89 | 92 | 
| 90 public ItemChooserLabels(SpannableString title, String searching, Spanna bleString noneFound, | 93 public ItemChooserLabels(SpannableString title, SpannableString searchin g, | 
| 91 SpannableString statusActive, SpannableString statusIdle, String positiveButton) { | 94 SpannableString noneFound, SpannableString statusActive, | 
| 95 SpannableString statusIdleNoneFound, SpannableString statusIdleS omeFound, | |
| 96 String positiveButton) { | |
| 92 mTitle = title; | 97 mTitle = title; | 
| 93 mSearching = searching; | 98 mSearching = searching; | 
| 94 mNoneFound = noneFound; | 99 mNoneFound = noneFound; | 
| 95 mStatusActive = statusActive; | 100 mStatusActive = statusActive; | 
| 96 mStatusIdle = statusIdle; | 101 mStatusIdleNoneFound = statusIdleNoneFound; | 
| 102 mStatusIdleSomeFound = statusIdleSomeFound; | |
| 97 mPositiveButton = positiveButton; | 103 mPositiveButton = positiveButton; | 
| 98 } | 104 } | 
| 99 } | 105 } | 
| 100 | 106 | 
| 101 /** | 107 /** | 
| 102 * The various states the dialog can represent. | 108 * The various states the dialog can represent. | 
| 103 */ | 109 */ | 
| 104 private enum State { STARTING, PROGRESS_UPDATE_AVAILABLE, DISCOVERY_IDLE } | 110 private enum State { STARTING, PROGRESS_UPDATE_AVAILABLE, DISCOVERY_IDLE } | 
| 105 | 111 | 
| 106 /** | 112 /** | 
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 404 mListView.setVisibility(View.GONE); | 410 mListView.setVisibility(View.GONE); | 
| 405 mProgressBar.setVisibility(View.VISIBLE); | 411 mProgressBar.setVisibility(View.VISIBLE); | 
| 406 mEmptyMessage.setVisibility(View.GONE); | 412 mEmptyMessage.setVisibility(View.GONE); | 
| 407 break; | 413 break; | 
| 408 case PROGRESS_UPDATE_AVAILABLE: | 414 case PROGRESS_UPDATE_AVAILABLE: | 
| 409 mStatus.setText(mLabels.mStatusActive); | 415 mStatus.setText(mLabels.mStatusActive); | 
| 410 mProgressBar.setVisibility(View.GONE); | 416 mProgressBar.setVisibility(View.GONE); | 
| 411 mListView.setVisibility(View.VISIBLE); | 417 mListView.setVisibility(View.VISIBLE); | 
| 412 break; | 418 break; | 
| 413 case DISCOVERY_IDLE: | 419 case DISCOVERY_IDLE: | 
| 414 mStatus.setText(mLabels.mStatusIdle); | |
| 415 boolean showEmptyMessage = mItemAdapter.isEmpty(); | 420 boolean showEmptyMessage = mItemAdapter.isEmpty(); | 
| 421 mStatus.setText(showEmptyMessage ? mLabels.mStatusIdleNoneFound | |
| 422 : mLabels.mStatusIdleSomeFound) ; | |
| 
 
Ted C
2016/02/19 17:54:01
should be 8 spaces from the start of the line.  Pr
 
ortuno
2016/02/19 18:26:28
Done. I think. Can you check I got it right?
 
Ted C
2016/02/19 18:39:30
looks good
 
 | |
| 416 mEmptyMessage.setText(mLabels.mNoneFound); | 423 mEmptyMessage.setText(mLabels.mNoneFound); | 
| 417 mEmptyMessage.setVisibility(showEmptyMessage ? View.VISIBLE : Vi ew.GONE); | 424 mEmptyMessage.setVisibility(showEmptyMessage ? View.VISIBLE : Vi ew.GONE); | 
| 418 break; | 425 break; | 
| 419 } | 426 } | 
| 420 } | 427 } | 
| 421 | 428 | 
| 422 /** | 429 /** | 
| 423 * Returns the dialog associated with this class. For use with tests only. | 430 * Returns the dialog associated with this class. For use with tests only. | 
| 424 */ | 431 */ | 
| 425 @VisibleForTesting | 432 @VisibleForTesting | 
| 426 public Dialog getDialogForTesting() { | 433 public Dialog getDialogForTesting() { | 
| 427 return mDialog; | 434 return mDialog; | 
| 428 } | 435 } | 
| 429 } | 436 } | 
| OLD | NEW |