Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
cb879688
Commit
cb879688
authored
13 years ago
by
Amith Yamasani
Committed by
Android (Google) Code Review
13 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Don't force measurement when SearchView is in iconified mode."
parents
24b35224
a95e488b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/java/android/widget/SearchView.java
+33
-4
33 additions, 4 deletions
core/java/android/widget/SearchView.java
core/res/res/layout/search_view.xml
+2
-3
2 additions, 3 deletions
core/res/res/layout/search_view.xml
with
35 additions
and
7 deletions
core/java/android/widget/SearchView.java
+
33
−
4
View file @
cb879688
...
...
@@ -35,6 +35,7 @@ import android.graphics.Rect;
import
android.graphics.drawable.Drawable
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.speech.RecognizerIntent
;
import
android.text.Editable
;
import
android.text.InputType
;
...
...
@@ -138,6 +139,12 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
}
};
private
Runnable
mUpdateDrawableStateRunnable
=
new
Runnable
()
{
public
void
run
()
{
updateFocusedState
();
}
};
// For voice searching
private
final
Intent
mVoiceWebSearchIntent
;
private
final
Intent
mVoiceAppSearchIntent
;
...
...
@@ -624,6 +631,12 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
@Override
protected
void
onMeasure
(
int
widthMeasureSpec
,
int
heightMeasureSpec
)
{
// Let the standard measurements take effect in iconified state.
if
(
isIconified
())
{
super
.
onMeasure
(
widthMeasureSpec
,
heightMeasureSpec
);
return
;
}
int
widthMode
=
MeasureSpec
.
getMode
(
widthMeasureSpec
);
int
width
=
MeasureSpec
.
getSize
(
widthMeasureSpec
);
...
...
@@ -720,9 +733,21 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
mCloseButton
.
getDrawable
().
setState
(
hasText
?
ENABLED_STATE_SET
:
EMPTY_STATE_SET
);
}
private
void
updateFocusedState
(
boolean
focused
)
{
private
void
postUpdateFocusedState
()
{
post
(
mUpdateDrawableStateRunnable
);
}
private
void
updateFocusedState
()
{
boolean
focused
=
mQueryTextView
.
hasFocus
();
mSearchPlate
.
getBackground
().
setState
(
focused
?
FOCUSED_STATE_SET
:
EMPTY_STATE_SET
);
mSubmitArea
.
getBackground
().
setState
(
focused
?
FOCUSED_STATE_SET
:
EMPTY_STATE_SET
);
invalidate
();
}
@Override
public
void
onDetachedFromWindow
()
{
removeCallbacks
(
mUpdateDrawableStateRunnable
);
super
.
onDetachedFromWindow
();
}
private
void
setImeVisibility
(
final
boolean
visible
)
{
...
...
@@ -1118,15 +1143,19 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
void
onTextFocusChanged
()
{
updateViewsVisibility
(
isIconified
());
updateFocusedState
(
mQueryTextView
.
hasFocus
());
// Delayed update to make sure that the focus has settled down and window focus changes
// don't affect it. A synchronous update was not working.
postUpdateFocusedState
();
if
(
mQueryTextView
.
hasFocus
())
{
forceSuggestionQuery
();
}
}
@Override
protected
void
onAttachedToWindow
()
{
super
.
onAttachedToWindow
();
public
void
onWindowFocusChanged
(
boolean
hasWindowFocus
)
{
super
.
onWindowFocusChanged
(
hasWindowFocus
);
postUpdateFocusedState
();
}
/**
...
...
This diff is collapsed.
Click to expand it.
core/res/res/layout/search_view.xml
+
2
−
3
View file @
cb879688
...
...
@@ -40,12 +40,11 @@
<ImageView
android:id=
"@+id/search_button"
android:layout_height=
"wrap_content
"
style=
"?android:attr/actionButtonStyle
"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"center_vertical"
android:background=
"?android:attr/selectableItemBackground"
android:src=
"?android:attr/searchViewSearchIcon"
style=
"?android:attr/actionButtonStyle"
android:contentDescription=
"@string/searchview_description_search"
/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment