Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Unified Diff: ui/app_list/views/speech_view.cc

Issue 342053003: Use OnPaint() to paint the content of IndicatorView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/speech_view.cc
diff --git a/ui/app_list/views/speech_view.cc b/ui/app_list/views/speech_view.cc
index 926bec24ac9452040171afd0698abb3c897abd2d..c42897ef9400fe9fd579d132dc99f1267a00d87a 100644
--- a/ui/app_list/views/speech_view.cc
+++ b/ui/app_list/views/speech_view.cc
@@ -163,8 +163,6 @@ SpeechView::SpeechView(AppListViewDelegate* delegate)
}
indicator_ = new SoundLevelIndicator();
- indicator_->SetVisible(false);
- container->AddChildView(indicator_);
mic_button_ = new MicButton(this);
container->AddChildView(mic_button_);
@@ -246,10 +244,11 @@ void SpeechView::OnSpeechSoundLevelChanged(uint8 level) {
origin.Offset(-radius, -radius + kIndicatorCenterOffsetY);
gfx::Rect indicator_bounds =
gfx::Rect(origin, gfx::Size(radius * 2, radius * 2));
- if (indicator_->visible()) {
+ if (indicator_->parent()) {
indicator_animator_->AnimateViewTo(indicator_, indicator_bounds);
} else {
- indicator_->SetVisible(true);
+ views::View* container = child_at(0);
+ container->AddChildViewAt(indicator_, container->GetIndexOf(mic_button_));
indicator_->SetBoundsRect(indicator_bounds);
}
}
@@ -272,7 +271,7 @@ void SpeechView::OnSpeechRecognitionStateChanged(
if (new_state == SPEECH_RECOGNITION_NETWORK_ERROR) {
text_resource_id = IDS_APP_LIST_SPEECH_NETWORK_ERROR_HINT_TEXT;
- indicator_->SetVisible(false);
xiyuan 2014/06/18 23:13:05 Would a "indicator_->SchedulePaint()" here help?
Jun Mukai 2014/06/18 23:13:51 I tried SchedulePaint but it didn't help.
xiyuan 2014/06/18 23:16:02 Try put it before "indicator_->SetVisible(false);"
Jun Mukai 2014/06/19 00:58:14 Tried all pattern of SchedulePaint(), child_at(0)-
Jun Mukai 2014/06/19 01:00:57 Ah, I think I've found why. indicator_animator_ m
Jun Mukai 2014/06/19 02:20:15 Turns out I was totally pointless :( Everything wa
+ child_at(0)->RemoveChildView(indicator_);
}
speech_result_->SetText(l10n_util::GetStringUTF16(text_resource_id));
speech_result_->SetEnabledColor(kHintTextColor);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698