Make first box active on start and fix keyboard

This commit is contained in:
PavelRatushny 2017-10-30 15:32:02 +02:00
parent ee0664034f
commit 91be41417c

View file

@ -128,9 +128,10 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
super.onBackPressed(); super.onBackPressed();
} }
}; };
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = dialog.getWindow();
Window window = dialog.getWindow(); if (window != null) {
if (window != null) { window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(ContextCompat.getColor(getContext(), R.color.coordinate_input_status_bar_color)); window.setStatusBarColor(ContextCompat.getColor(getContext(), R.color.coordinate_input_status_bar_color));
@ -212,6 +213,10 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
registerEditTexts(); registerEditTexts();
if (savedInstanceState == null) {
latitudeBox.select();
}
final View mapMarkersLayout = mainView.findViewById(R.id.map_markers_layout); final View mapMarkersLayout = mainView.findViewById(R.id.map_markers_layout);
RecyclerView recyclerView = (RecyclerView) mainView.findViewById(R.id.markers_recycler_view); RecyclerView recyclerView = (RecyclerView) mainView.findViewById(R.id.markers_recycler_view);
@ -321,10 +326,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
stopLocationUpdate(); stopLocationUpdate();
} }
@Override
public void onSaveInstanceState(Bundle outState) {
}
@Override @Override
public void onDestroyView() { public void onDestroyView() {
Dialog dialog = getDialog(); Dialog dialog = getDialog();
@ -529,7 +530,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
} else { } else {
if (useOsmandKeyboard) { if (useOsmandKeyboard) {
AndroidUtils.hideSoftKeyboard(getActivity(), view); AndroidUtils.hideSoftKeyboard(getActivity(), view);
} else if (isOsmandKeyboardCurrentlyVisible()) { } else if (orientationPortrait && isOsmandKeyboardCurrentlyVisible()) {
changeOsmandKeyboardVisibility(false); changeOsmandKeyboardVisibility(false);
} }
textFieldBox.setHasFocus(false); textFieldBox.setHasFocus(false);