add button for hiding osmand keyboard
This commit is contained in:
parent
493b8c35de
commit
57b220bdee
2 changed files with 34 additions and 9 deletions
|
@ -98,7 +98,7 @@
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/keyboard_item_next_field"
|
android:id="@+id/keyboard_item_backspace"
|
||||||
layout="@layout/coordinate_input_keyboard_item"
|
layout="@layout/coordinate_input_keyboard_item"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -190,12 +190,29 @@
|
||||||
android:layout_width="1dp"
|
android:layout_width="1dp"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
<include
|
<LinearLayout
|
||||||
android:id="@+id/keyboard_item_backspace"
|
android:layout_width="0dp"
|
||||||
layout="@layout/coordinate_input_keyboard_item"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="0dp"
|
android:layout_weight="1"
|
||||||
android:layout_height="match_parent"
|
android:orientation="vertical">
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
<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>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -369,6 +369,9 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
case R.id.keyboard_item_next_field:
|
case R.id.keyboard_item_next_field:
|
||||||
switchEditText(focusedEditText.getId(), true);
|
switchEditText(focusedEditText.getId(), true);
|
||||||
break;
|
break;
|
||||||
|
case R.id.keyboard_item_hide:
|
||||||
|
changeOsmandKeyboardVisibility(false);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
focusedEditText.setText(focusedEditText.getText().toString() + getItemObjectById(id));
|
focusedEditText.setText(focusedEditText.getText().toString() + getItemObjectById(id));
|
||||||
focusedEditText.setSelection(focusedEditText.getText().length());
|
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_9,
|
||||||
R.id.keyboard_item_clear,
|
R.id.keyboard_item_clear,
|
||||||
R.id.keyboard_item_next_field,
|
R.id.keyboard_item_next_field,
|
||||||
R.id.keyboard_item_backspace);
|
R.id.keyboard_item_backspace,
|
||||||
|
R.id.keyboard_item_hide);
|
||||||
|
|
||||||
if (!isOsmandKeyboardOn() && isOsmandKeyboardCurrentlyVisible()) {
|
if (!isOsmandKeyboardOn() && isOsmandKeyboardCurrentlyVisible()) {
|
||||||
changeOsmandKeyboardVisibility(false);
|
changeOsmandKeyboardVisibility(false);
|
||||||
|
@ -458,7 +462,9 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
for (@IdRes int id : itemsIds) {
|
for (@IdRes int id : itemsIds) {
|
||||||
View itemView = keyboardView.findViewById(id);
|
View itemView = keyboardView.findViewById(id);
|
||||||
Object item = getItemObjectById(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.setBackgroundResource(controlItem ? controlItemBg : itemBg);
|
||||||
itemView.setOnClickListener(listener);
|
itemView.setOnClickListener(listener);
|
||||||
|
@ -531,6 +537,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
return R.drawable.ic_keyboard_next_field;
|
return R.drawable.ic_keyboard_next_field;
|
||||||
case R.id.keyboard_item_backspace:
|
case R.id.keyboard_item_backspace:
|
||||||
return R.drawable.ic_keyboard_backspace;
|
return R.drawable.ic_keyboard_backspace;
|
||||||
|
case R.id.keyboard_item_hide:
|
||||||
|
return R.drawable.ic_action_keyboard_hide;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue