mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1038789 - Add clear button to search bar in search activity. r=eedens
This commit is contained in:
parent
1161a46c30
commit
67fee7bd84
@ -19,6 +19,7 @@ import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ListView;
|
||||
@ -30,7 +31,6 @@ import org.mozilla.search.R;
|
||||
* A fragment to handle autocomplete. Its interface with the outside
|
||||
* world should be very very limited.
|
||||
* <p/>
|
||||
* TODO: Add clear button to search input
|
||||
* TODO: Add more search providers (other than the dictionary)
|
||||
*/
|
||||
public class SearchFragment extends Fragment implements AdapterView.OnItemClickListener,
|
||||
@ -95,6 +95,14 @@ public class SearchFragment extends Fragment implements AdapterView.OnItemClickL
|
||||
}
|
||||
});
|
||||
|
||||
final Button clearButton = (Button) mainView.findViewById(R.id.clear_button);
|
||||
clearButton.setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
searchBar.setText("");
|
||||
}
|
||||
});
|
||||
|
||||
backdropFrame.setOnClickListener(new BackdropClickListener());
|
||||
|
||||
autoCompleteAdapter = new AutoCompleteAdapter(getActivity(), this);
|
||||
|
BIN
mobile/android/search/res/drawable-hdpi/search_clear.png
Normal file
BIN
mobile/android/search/res/drawable-hdpi/search_clear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 550 B |
BIN
mobile/android/search/res/drawable-mdpi/search_clear.png
Normal file
BIN
mobile/android/search/res/drawable-mdpi/search_clear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 473 B |
BIN
mobile/android/search/res/drawable-xhdpi/search_clear.png
Normal file
BIN
mobile/android/search/res/drawable-xhdpi/search_clear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 679 B |
@ -25,9 +25,23 @@
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/auto_complete_search_bar"
|
||||
style="@style/AutoCompleteEditText"/>
|
||||
<FrameLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/auto_complete_search_bar"
|
||||
style="@style/AutoCompleteEditText"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/clear_button"
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:layout_marginRight="3dp"
|
||||
android:background="@drawable/search_clear" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/auto_complete_dropdown"
|
||||
|
Loading…
Reference in New Issue
Block a user