[Quick search] fixes

This commit is contained in:
Alexey Kulish 2016-07-25 22:24:32 +03:00
parent af0dd482a1
commit c828bd116c
5 changed files with 28 additions and 14 deletions

View file

@ -367,11 +367,13 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageButton
android:id="@+id/search_icon" android:id="@+id/search_back_button"
style="@style/Widget.AppCompat.ActionButton"
android:layout_width="54dp" android:layout_width="54dp"
android:layout_height="wrap_content" android:layout_height="48dp"
android:src="@drawable/ic_action_search_dark"/> android:contentDescription="@string/back_to_search"
android:src="@drawable/abc_ic_ab_back_mtrl_am_alpha"/>
<TextView <TextView
android:id="@+id/search_title" android:id="@+id/search_title"

View file

@ -165,11 +165,13 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageButton
android:id="@+id/search_icon" android:id="@+id/search_back_button"
style="@style/Widget.AppCompat.ActionButton"
android:layout_width="54dp" android:layout_width="54dp"
android:layout_height="wrap_content" android:layout_height="48dp"
android:src="@drawable/ic_action_search_dark"/> android:contentDescription="@string/back_to_search"
android:src="@drawable/abc_ic_ab_back_mtrl_am_alpha"/>
<TextView <TextView
android:id="@+id/search_title" android:id="@+id/search_title"

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="back_to_search">Back to search</string>
<string name="confirmation_to_delete_history_items">Do you want to delete selected history items?</string> <string name="confirmation_to_delete_history_items">Do you want to delete selected history items?</string>
<string name="show_something_on_map">Show %1$s on the map</string> <string name="show_something_on_map">Show %1$s on the map</string>
<string name="release_2_4"> <string name="release_2_4">

View file

@ -484,8 +484,11 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
@Override @Override
public void onDismiss(DialogInterface dialog) { public void onDismiss(DialogInterface dialog) {
getMapActivity().setQuickSearchTopbarActive(false); MapActivity mapActivity = getMapActivity();
getChildFragmentManager().popBackStack(); if (mapActivity != null) {
getMapActivity().setQuickSearchTopbarActive(false);
getChildFragmentManager().popBackStack();
}
super.onDismiss(dialog); super.onDismiss(dialog);
} }
@ -570,7 +573,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
break; break;
case MAIN: case MAIN:
if (!Algorithms.isEmpty(searchQuery)) { if (!Algorithms.isEmpty(searchQuery) && !searchQuery.equals(searchEditText.getText().toString())) {
String txt = searchQuery; String txt = searchQuery;
searchQuery = ""; searchQuery = "";
searchEditText.setText(txt); searchEditText.setText(txt);

View file

@ -165,7 +165,7 @@ public class MapInfoWidgetsFactory {
private final MapActivity map; private final MapActivity map;
private View searchTopBar; private View searchTopBar;
private View searchTopBarLayout; private View searchTopBarLayout;
private ImageView searchIcon; private ImageButton searchBackButton;
private TextView searchTitle; private TextView searchTitle;
private ImageButton searchCloseButton; private ImageButton searchCloseButton;
@ -173,7 +173,13 @@ public class MapInfoWidgetsFactory {
this.map = map; this.map = map;
searchTopBar = map.findViewById(R.id.search_topbar); searchTopBar = map.findViewById(R.id.search_topbar);
searchTopBarLayout = map.findViewById(R.id.search_topbar_layout); searchTopBarLayout = map.findViewById(R.id.search_topbar_layout);
searchIcon = (ImageView) map.findViewById(R.id.search_icon); searchBackButton = (ImageButton) map.findViewById(R.id.search_back_button);
searchBackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
map.showQuickSearch();
}
});
searchTitle = (TextView) map.findViewById(R.id.search_title); searchTitle = (TextView) map.findViewById(R.id.search_title);
searchTitle.setOnClickListener(new View.OnClickListener() { searchTitle.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -222,7 +228,7 @@ public class MapInfoWidgetsFactory {
public void updateTextColor(boolean nightMode, int textColor) { public void updateTextColor(boolean nightMode, int textColor) {
OsmandApplication app = map.getMyApplication(); OsmandApplication app = map.getMyApplication();
searchTitle.setTextColor(textColor); searchTitle.setTextColor(textColor);
searchIcon.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_search_dark, !nightMode)); searchBackButton.setImageDrawable(app.getIconsCache().getIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha, !nightMode));
searchCloseButton.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_remove_dark, !nightMode)); searchCloseButton.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_action_remove_dark, !nightMode));
} }