diff --git a/OsmAnd/res/layout/fragment_marker_coordinate_input_options_bottom_sheet_helper.xml b/OsmAnd/res/layout/fragment_marker_coordinate_input_options_bottom_sheet_helper.xml index d093e40a06..f261d69782 100644 --- a/OsmAnd/res/layout/fragment_marker_coordinate_input_options_bottom_sheet_helper.xml +++ b/OsmAnd/res/layout/fragment_marker_coordinate_input_options_bottom_sheet_helper.xml @@ -71,6 +71,47 @@ android:focusableInTouchMode="false"/> + + + + + + + + + + Right + Left + Show number pad Paste Automatically switch to the next field after entering %1$d digits after the decimal point %1$d digits diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java index 431b97370f..c2ad3de87f 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputBottomSheetDialogFragment.java @@ -11,11 +11,14 @@ import android.widget.ImageView; import android.widget.RadioButton; import android.widget.TextView; +import net.osmand.AndroidUtils; import net.osmand.plus.R; import net.osmand.plus.base.MenuBottomSheetDialogFragment; +import net.osmand.plus.helpers.AndroidUiHelper; import static net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.ACCURACY; import static net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.GO_TO_NEXT_FIELD; +import static net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.RIGHT_HAND; import static net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.USE_OSMAND_KEYBOARD; public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDialogFragment { @@ -23,9 +26,10 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia public final static String TAG = "CoordinateInputBottomSheetDialogFragment"; private View mainView; - private boolean useOsmandKeyboard = true; + private boolean useOsmandKeyboard; + private boolean rightHand; private boolean goToNextField; - private int accuracy = -1; + private int accuracy; private CoordinateInputFormatChangeListener listener; public void setListener(CoordinateInputFormatChangeListener listener) { @@ -39,11 +43,13 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia Bundle args = getArguments(); if (args != null) { useOsmandKeyboard = args.getBoolean(USE_OSMAND_KEYBOARD); + rightHand = args.getBoolean(RIGHT_HAND); goToNextField = args.getBoolean(GO_TO_NEXT_FIELD); accuracy = args.getInt(ACCURACY); } } else { useOsmandKeyboard = savedInstanceState.getBoolean(USE_OSMAND_KEYBOARD); + rightHand = savedInstanceState.getBoolean(RIGHT_HAND); goToNextField = savedInstanceState.getBoolean(GO_TO_NEXT_FIELD); accuracy = savedInstanceState.getInt(ACCURACY); } @@ -53,6 +59,7 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; + boolean portrait = AndroidUiHelper.isOrientationPortrait(getActivity()); mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_coordinate_input_options_bottom_sheet_helper, container); @@ -62,6 +69,10 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia ((TextView) mainView.findViewById(R.id.coordinate_input_accuracy_descr)).setText(getString(R.string.coordinate_input_accuracy_description, accuracy)); + if (portrait) { + mainView.findViewById(R.id.hand_row).setVisibility(View.GONE); + } + ((CompoundButton) mainView.findViewById(R.id.go_to_next_field_switch)).setChecked(goToNextField); ((ImageView) mainView.findViewById(R.id.go_to_next_field_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_keyboard)); mainView.findViewById(R.id.go_to_next_field_row).setOnClickListener(new View.OnClickListener() { @@ -150,6 +161,7 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia @Override public void onSaveInstanceState(Bundle outState) { outState.putBoolean(USE_OSMAND_KEYBOARD, useOsmandKeyboard); + outState.putBoolean(RIGHT_HAND, rightHand); outState.putBoolean(GO_TO_NEXT_FIELD, goToNextField); outState.putInt(ACCURACY, accuracy); super.onSaveInstanceState(outState); @@ -173,6 +185,8 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia void onKeyboardChanged(boolean useOsmandKeyboard); + void onHandChanged(boolean rightHand); + void onGoToNextFieldChanged(boolean goToNextField); void onAccuracyChanged(int accuracy); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index a5f92890da..27fb4b2a58 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -70,6 +70,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm public static final String TAG = "CoordinateInputDialogFragment"; public static final String USE_OSMAND_KEYBOARD = "use_osmand_keyboard"; + public static final String RIGHT_HAND = "right_hand"; public static final String GO_TO_NEXT_FIELD = "go_to_next_field"; public static final String ACCURACY = "accuracy"; @@ -86,6 +87,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm private CoordinateInputAdapter adapter; private boolean lightTheme; private boolean useOsmandKeyboard = true; + private boolean rightHand = true; private boolean goToNextField; private int accuracy = 4; private List textFieldBoxes; @@ -168,6 +170,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm fragment.setUsedOnMap(false); Bundle args = new Bundle(); args.putBoolean(USE_OSMAND_KEYBOARD, useOsmandKeyboard); + args.putBoolean(RIGHT_HAND, rightHand); args.putBoolean(GO_TO_NEXT_FIELD, goToNextField); args.putInt(ACCURACY, accuracy); fragment.setArguments(args); @@ -555,6 +558,12 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm changeEditTextSelections(); } + @Override + public void onHandChanged(boolean rightHand) { + CoordinateInputDialogFragment.this.rightHand = rightHand; + changeHand(); + } + @Override public void onGoToNextFieldChanged(boolean goToNextField) { CoordinateInputDialogFragment.this.goToNextField = goToNextField; @@ -569,6 +578,10 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm }; } + private void changeHand() { + + } + private void changeEditTextSelections() { for (EditText inputEditText : inputEditTexts) { inputEditText.setSelection(inputEditText.getText().length());