Merge "Remove old fashioned expand/collapse techniques in SearchView examples."
This commit is contained in:
committed by
Android (Google) Code Review
commit
d9e0c41a75
@@ -19,22 +19,6 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/open_button"
|
|
||||||
android:text="@string/open_search"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/close_button"
|
|
||||||
android:text="@string/close_search"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/status_text"
|
android:id="@+id/status_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -39,12 +39,9 @@ import java.util.List;
|
|||||||
* This demonstrates the usage of SearchView in an ActionBar as a menu item.
|
* This demonstrates the usage of SearchView in an ActionBar as a menu item.
|
||||||
* It sets a SearchableInfo on the SearchView for suggestions and submitting queries to.
|
* It sets a SearchableInfo on the SearchView for suggestions and submitting queries to.
|
||||||
*/
|
*/
|
||||||
public class SearchViewActionBar extends Activity implements SearchView.OnQueryTextListener,
|
public class SearchViewActionBar extends Activity implements SearchView.OnQueryTextListener {
|
||||||
SearchView.OnCloseListener, Button.OnClickListener {
|
|
||||||
|
|
||||||
private SearchView mSearchView;
|
private SearchView mSearchView;
|
||||||
private Button mOpenButton;
|
|
||||||
private Button mCloseButton;
|
|
||||||
private TextView mStatusView;
|
private TextView mStatusView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -55,10 +52,6 @@ public class SearchViewActionBar extends Activity implements SearchView.OnQueryT
|
|||||||
setContentView(R.layout.searchview_actionbar);
|
setContentView(R.layout.searchview_actionbar);
|
||||||
|
|
||||||
mStatusView = (TextView) findViewById(R.id.status_text);
|
mStatusView = (TextView) findViewById(R.id.status_text);
|
||||||
mOpenButton = (Button) findViewById(R.id.open_button);
|
|
||||||
mCloseButton = (Button) findViewById(R.id.close_button);
|
|
||||||
mOpenButton.setOnClickListener(this);
|
|
||||||
mCloseButton.setOnClickListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -99,7 +92,6 @@ public class SearchViewActionBar extends Activity implements SearchView.OnQueryT
|
|||||||
}
|
}
|
||||||
|
|
||||||
mSearchView.setOnQueryTextListener(this);
|
mSearchView.setOnQueryTextListener(this);
|
||||||
mSearchView.setOnCloseListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onQueryTextChange(String newText) {
|
public boolean onQueryTextChange(String newText) {
|
||||||
@@ -117,14 +109,6 @@ public class SearchViewActionBar extends Activity implements SearchView.OnQueryT
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick(View view) {
|
|
||||||
if (view == mCloseButton) {
|
|
||||||
mSearchView.setIconified(true);
|
|
||||||
} else if (view == mOpenButton) {
|
|
||||||
mSearchView.setIconified(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isAlwaysExpanded() {
|
protected boolean isAlwaysExpanded() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user