add button for hiding osmand keyboard

This commit is contained in:
Chumva 2018-06-15 19:02:18 +03:00
parent 493b8c35de
commit 57b220bdee
2 changed files with 34 additions and 9 deletions

View file

@ -98,7 +98,7 @@
android:layout_height="match_parent"/>
<include
android:id="@+id/keyboard_item_next_field"
android:id="@+id/keyboard_item_backspace"
layout="@layout/coordinate_input_keyboard_item"
android:layout_width="0dp"
android:layout_height="match_parent"
@ -190,12 +190,29 @@
android:layout_width="1dp"
android:layout_height="match_parent"/>
<include
android:id="@+id/keyboard_item_backspace"
layout="@layout/coordinate_input_keyboard_item"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<include
android:id="@+id/keyboard_item_next_field"
layout="@layout/coordinate_input_keyboard_item"
android:layout_width="match_parent"
android:layout_height="@dimen/coords_input_keyboard_item_height"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"/>
<include
android:id="@+id/keyboard_item_hide"
layout="@layout/coordinate_input_keyboard_item"
android:layout_width="match_parent"
android:layout_height="@dimen/coords_input_keyboard_item_height"/>
</LinearLayout>
</LinearLayout>

View file

@ -369,6 +369,9 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
case R.id.keyboard_item_next_field:
switchEditText(focusedEditText.getId(), true);
break;
case R.id.keyboard_item_hide:
changeOsmandKeyboardVisibility(false);
break;
default:
focusedEditText.setText(focusedEditText.getText().toString() + getItemObjectById(id));
focusedEditText.setSelection(focusedEditText.getText().length());
@ -391,7 +394,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
R.id.keyboard_item_9,
R.id.keyboard_item_clear,
R.id.keyboard_item_next_field,
R.id.keyboard_item_backspace);
R.id.keyboard_item_backspace,
R.id.keyboard_item_hide);
if (!isOsmandKeyboardOn() && isOsmandKeyboardCurrentlyVisible()) {
changeOsmandKeyboardVisibility(false);
@ -458,7 +462,9 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
for (@IdRes int id : itemsIds) {
View itemView = keyboardView.findViewById(id);
Object item = getItemObjectById(id);
final boolean controlItem = id == R.id.keyboard_item_next_field || id == R.id.keyboard_item_backspace;
final boolean controlItem = id == R.id.keyboard_item_next_field
|| id == R.id.keyboard_item_backspace
|| id == R.id.keyboard_item_hide;
itemView.setBackgroundResource(controlItem ? controlItemBg : itemBg);
itemView.setOnClickListener(listener);
@ -531,6 +537,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
return R.drawable.ic_keyboard_next_field;
case R.id.keyboard_item_backspace:
return R.drawable.ic_keyboard_backspace;
case R.id.keyboard_item_hide:
return R.drawable.ic_action_keyboard_hide;
}
return -1;
}