Fix options menu
This commit is contained in:
parent
0e247c3c79
commit
99a24260a6
6 changed files with 397 additions and 488 deletions
|
@ -1,73 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/marker_coordinate_input_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/coordinate_input_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:text="@string/fast_coordinates_input"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
osmand:typeface="@string/font_roboto_medium"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_descr_height"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:text="@string/fast_coordinates_input_descr"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"/>
|
||||
|
||||
<include layout="@layout/marker_coordinate_formats"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/cancel_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/shared_string_close"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textStyle="bold"/>
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,120 +1,289 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/marker_coordinate_input_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ScrollView
|
||||
android:id="@+id/marker_coordinate_input_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/bottom_sheet_content_padding_small">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/coordinate_input_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:text="@string/shared_string_options"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
osmand:typeface="@string/font_roboto_medium"/>
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/coordinate_input_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_title_height"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding"
|
||||
android:text="@string/shared_string_options"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
osmand:typeface="@string/font_roboto_medium"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/use_system_keyboard_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
<LinearLayout
|
||||
android:id="@+id/use_system_keyboard_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<ImageView
|
||||
android:layout_gravity="center_vertical"
|
||||
android:id="@+id/use_system_keyboard_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/ic_action_keyboard"/>
|
||||
<ImageView
|
||||
android:id="@+id/use_system_keyboard_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/ic_action_keyboard"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/use_system_keyboard"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/use_system_keyboard"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/use_system_keyboard_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"/>
|
||||
</LinearLayout>
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/use_system_keyboard_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<TextView
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAllCaps="true"
|
||||
android:paddingTop="@dimen/bottom_sheet_content_padding_small"
|
||||
android:paddingBottom="@dimen/bottom_sheet_content_padding_small"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/coordinates_format"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/go_to_next_field_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding">
|
||||
|
||||
<include layout="@layout/marker_coordinate_formats"/>
|
||||
<ImageView
|
||||
android:id="@+id/go_to_next_field_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/ic_action_keyboard"/>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/go_to_next_field"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
|
||||
|
||||
</ScrollView>
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/go_to_next_field_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
<TextView
|
||||
android:id="@+id/coordinate_input_accuracy_descr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_descr_height"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_divider_margin_start"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_divider_margin_start"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
tools:text="@string/coordinate_input_accuracy_description"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/cancel_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
<LinearLayout
|
||||
android:id="@+id/four_digits_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_divider_margin_start"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_divider_margin_start">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/shared_string_close"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textStyle="bold"/>
|
||||
</FrameLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/four_digits_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="4 digits"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/four_digits_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="00:00.0000"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/four_digits_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/three_digits_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_divider_margin_start"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_divider_margin_start">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/three_digits_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="3 digits"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/three_digits_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="00:00.000"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/three_digits_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/two_digits_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/bottom_sheet_divider_margin_start"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/bottom_sheet_divider_margin_start">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/two_digits_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="2 digits"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/two_digits_description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="00:00.00"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/two_digits_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/cancel_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_cancel_button_height"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/shared_string_close"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
android:textStyle="bold"/>
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,123 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/degrees_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/degrees_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/ic_action_coordinates_latitude"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/degrees_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="DDD.DD"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/degrees_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/minutes_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/minutes_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/ic_action_coordinates_latitude"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/minutes_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="DDD MM.MM"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/minutes_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/seconds_row"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_list_item_height"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/bottom_sheet_list_item_height"
|
||||
android:paddingEnd="@dimen/content_padding"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:paddingStart="@dimen/content_padding">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/seconds_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
|
||||
tools:src="@drawable/ic_action_coordinates_latitude"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/seconds_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="@style/TextAppearance.ListItemTitle"
|
||||
tools:text="DDD MM SS.SS"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/seconds_radio_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -9,6 +9,9 @@
|
|||
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
|
||||
-->
|
||||
<string name="coordinate_input_accuracy_description">Automatically switch to the next field after entering %1$d digits after the decimal point</string>
|
||||
<string name="coordinate_input_accuracy">%1$d digits</string>
|
||||
<string name="go_to_next_field">Go to next field</string>
|
||||
<string name="import_gpx_file_description">can be imported as Favorites points, or as track file.</string>
|
||||
<string name="import_as_gpx">Import as GPX file</string>
|
||||
<string name="import_as_favorites">Import as Favorites</string>
|
||||
|
|
|
@ -33,10 +33,10 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF
|
|||
private boolean portrait;
|
||||
private View mainView;
|
||||
private boolean night;
|
||||
private int coordinateFormat = -1;
|
||||
private boolean useOsmandKeyboard = true;
|
||||
private boolean goToNextField;
|
||||
private int accuracy = -1;
|
||||
private CoordinateInputFormatChangeListener listener;
|
||||
private boolean shouldClose;
|
||||
|
||||
public void setListener(CoordinateInputFormatChangeListener listener) {
|
||||
this.listener = listener;
|
||||
|
@ -47,10 +47,9 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF
|
|||
super.onCreate(savedInstanceState);
|
||||
Bundle args = getArguments();
|
||||
if (args != null) {
|
||||
coordinateFormat = args.getInt(CoordinateInputDialogFragment.COORDINATE_FORMAT);
|
||||
useOsmandKeyboard = args.getBoolean(CoordinateInputDialogFragment.USE_OSMAND_KEYBOARD);
|
||||
} else {
|
||||
shouldClose = true;
|
||||
goToNextField = args.getBoolean(CoordinateInputDialogFragment.GO_TO_NEXT_FIELD);
|
||||
accuracy = args.getInt(CoordinateInputDialogFragment.ACCURACY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,8 +61,7 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF
|
|||
night = !mapActivity.getMyApplication().getSettings().isLightContent();
|
||||
final int themeRes = night ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
|
||||
mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), coordinateFormat == -1 ?
|
||||
R.layout.fragment_marker_coordinate_input_bottom_sheet_dialog : R.layout.fragment_marker_coordinate_input_options_bottom_sheet_helper, container);
|
||||
mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_coordinate_input_options_bottom_sheet_helper, container);
|
||||
if (portrait) {
|
||||
AndroidUtils.setBackground(getActivity(), mainView, night, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||
}
|
||||
|
@ -72,93 +70,85 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF
|
|||
((TextView) mainView.findViewById(R.id.coordinate_input_title)).setTextColor(getResources().getColor(R.color.ctx_menu_info_text_dark));
|
||||
}
|
||||
|
||||
ImageView degreesIcon = (ImageView) mainView.findViewById(R.id.degrees_icon);
|
||||
TextView degreesText = (TextView) mainView.findViewById(R.id.degrees_text);
|
||||
if (coordinateFormat == PointDescription.FORMAT_DEGREES) {
|
||||
degreesIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue));
|
||||
degreesText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue));
|
||||
((RadioButton) mainView.findViewById(R.id.degrees_radio_button)).setChecked(true);
|
||||
} else {
|
||||
degreesIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude));
|
||||
}
|
||||
degreesText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_DEGREES));
|
||||
((TextView) mainView.findViewById(R.id.coordinate_input_accuracy_descr)).setText(getString(R.string.coordinate_input_accuracy_description, accuracy));
|
||||
|
||||
ImageView minutesIcon = (ImageView) mainView.findViewById(R.id.minutes_icon);
|
||||
TextView minutesText = (TextView) mainView.findViewById(R.id.minutes_text);
|
||||
if (coordinateFormat == PointDescription.FORMAT_MINUTES) {
|
||||
minutesIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue));
|
||||
minutesText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue));
|
||||
((RadioButton) mainView.findViewById(R.id.minutes_radio_button)).setChecked(true);
|
||||
} else {
|
||||
minutesIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude));
|
||||
}
|
||||
minutesText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_MINUTES));
|
||||
|
||||
ImageView secondsIcon = (ImageView) mainView.findViewById(R.id.seconds_icon);
|
||||
TextView secondsText = (TextView) mainView.findViewById(R.id.seconds_text);
|
||||
if (coordinateFormat == PointDescription.FORMAT_SECONDS) {
|
||||
secondsIcon.setImageDrawable(getIcon(R.drawable.ic_action_coordinates_latitude, R.color.dashboard_blue));
|
||||
secondsText.setTextColor(ContextCompat.getColor(mapActivity, R.color.dashboard_blue));
|
||||
((RadioButton) mainView.findViewById(R.id.seconds_radio_button)).setChecked(true);
|
||||
} else {
|
||||
secondsIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_coordinates_latitude));
|
||||
}
|
||||
secondsText.setText(PointDescription.formatToHumanString(getContext(), PointDescription.FORMAT_SECONDS));
|
||||
|
||||
if (coordinateFormat != -1) {
|
||||
((CompoundButton) mainView.findViewById(R.id.use_system_keyboard_switch)).setChecked(!useOsmandKeyboard);
|
||||
((ImageView) mainView.findViewById(R.id.use_system_keyboard_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_keyboard));
|
||||
mainView.findViewById(R.id.use_system_keyboard_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
useOsmandKeyboard = !useOsmandKeyboard;
|
||||
((CompoundButton) mainView.findViewById(R.id.use_system_keyboard_switch)).setChecked(!useOsmandKeyboard);
|
||||
if (listener != null) {
|
||||
listener.onKeyboardChanged(useOsmandKeyboard);
|
||||
}
|
||||
((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() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
goToNextField = !goToNextField;
|
||||
((CompoundButton) mainView.findViewById(R.id.go_to_next_field_switch)).setChecked(goToNextField);
|
||||
if (listener != null) {
|
||||
listener.onGoToNextFieldChanged(goToNextField);
|
||||
}
|
||||
});
|
||||
highlightSelectedItem(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
View.OnClickListener formatChangeListener = new View.OnClickListener() {
|
||||
if (accuracy == 4) {
|
||||
((RadioButton) mainView.findViewById(R.id.four_digits_radio_button)).setChecked(true);
|
||||
}
|
||||
((TextView) mainView.findViewById(R.id.four_digits_title)).setText(getString(R.string.coordinate_input_accuracy, 4));
|
||||
((TextView) mainView.findViewById(R.id.four_digits_description)).setText("00:00." + "5555");
|
||||
|
||||
if (accuracy == 3) {
|
||||
((RadioButton) mainView.findViewById(R.id.three_digits_radio_button)).setChecked(true);
|
||||
}
|
||||
((TextView) mainView.findViewById(R.id.three_digits_title)).setText(getString(R.string.coordinate_input_accuracy, 3));
|
||||
((TextView) mainView.findViewById(R.id.three_digits_description)).setText("00:00." + "555");
|
||||
|
||||
if (accuracy == 2) {
|
||||
((RadioButton) mainView.findViewById(R.id.two_digits_radio_button)).setChecked(true);
|
||||
}
|
||||
((TextView) mainView.findViewById(R.id.two_digits_title)).setText(getString(R.string.coordinate_input_accuracy, 2));
|
||||
((TextView) mainView.findViewById(R.id.two_digits_description)).setText("00:00." + "55");
|
||||
|
||||
((CompoundButton) mainView.findViewById(R.id.use_system_keyboard_switch)).setChecked(!useOsmandKeyboard);
|
||||
((ImageView) mainView.findViewById(R.id.use_system_keyboard_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_keyboard));
|
||||
mainView.findViewById(R.id.use_system_keyboard_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
useOsmandKeyboard = !useOsmandKeyboard;
|
||||
((CompoundButton) mainView.findViewById(R.id.use_system_keyboard_switch)).setChecked(!useOsmandKeyboard);
|
||||
if (listener != null) {
|
||||
listener.onKeyboardChanged(useOsmandKeyboard);
|
||||
}
|
||||
}
|
||||
});
|
||||
highlightSelectedItem(true);
|
||||
|
||||
View.OnClickListener accuracyChangedListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
highlightSelectedItem(false);
|
||||
switch (view.getId()) {
|
||||
case R.id.degrees_row:
|
||||
coordinateFormat = PointDescription.FORMAT_DEGREES;
|
||||
case R.id.four_digits_row:
|
||||
accuracy = 4;
|
||||
break;
|
||||
case R.id.minutes_row:
|
||||
coordinateFormat = PointDescription.FORMAT_MINUTES;
|
||||
case R.id.three_digits_row:
|
||||
accuracy = 3;
|
||||
break;
|
||||
case R.id.seconds_row:
|
||||
coordinateFormat = PointDescription.FORMAT_SECONDS;
|
||||
case R.id.two_digits_row:
|
||||
accuracy = 2;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unsupported format");
|
||||
throw new IllegalArgumentException("Unsupported accuracy");
|
||||
}
|
||||
highlightSelectedItem(true);
|
||||
if (listener != null) {
|
||||
listener.onCoordinateFormatChanged(coordinateFormat);
|
||||
}
|
||||
if (shouldClose) {
|
||||
dismiss();
|
||||
listener.onAccuracyChanged(accuracy);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
mainView.findViewById(R.id.degrees_row).setOnClickListener(formatChangeListener);
|
||||
mainView.findViewById(R.id.minutes_row).setOnClickListener(formatChangeListener);
|
||||
mainView.findViewById(R.id.seconds_row).setOnClickListener(formatChangeListener);
|
||||
mainView.findViewById(R.id.four_digits_row).setOnClickListener(accuracyChangedListener);
|
||||
mainView.findViewById(R.id.three_digits_row).setOnClickListener(accuracyChangedListener);
|
||||
mainView.findViewById(R.id.two_digits_row).setOnClickListener(accuracyChangedListener);
|
||||
|
||||
mainView.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
if (shouldClose && listener != null) {
|
||||
listener.onCancel();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -215,48 +205,32 @@ public class CoordinateInputBottomSheetDialogFragment extends BottomSheetDialogF
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
super.onCancel(dialog);
|
||||
if (shouldClose && listener != null) {
|
||||
listener.onCancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Drawable getContentIcon(@DrawableRes int id) {
|
||||
return getIcon(id, night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color);
|
||||
}
|
||||
|
||||
private void highlightSelectedItem(boolean check) {
|
||||
int iconColor = check ? R.color.dashboard_blue : night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color;
|
||||
int textColor = ContextCompat.getColor(getContext(), check ? (night ? R.color.color_dialog_buttons_dark : R.color.dashboard_blue) : night ? R.color.color_white : R.color.color_black);
|
||||
switch (coordinateFormat) {
|
||||
case PointDescription.FORMAT_DEGREES:
|
||||
((TextView) mainView.findViewById(R.id.degrees_text)).setTextColor(textColor);
|
||||
((ImageView) mainView.findViewById(R.id.degrees_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor)));
|
||||
((RadioButton) mainView.findViewById(R.id.degrees_radio_button)).setChecked(check);
|
||||
switch (accuracy) {
|
||||
case 4:
|
||||
((RadioButton) mainView.findViewById(R.id.four_digits_radio_button)).setChecked(check);
|
||||
break;
|
||||
case PointDescription.FORMAT_MINUTES:
|
||||
((TextView) mainView.findViewById(R.id.minutes_text)).setTextColor(textColor);
|
||||
((ImageView) mainView.findViewById(R.id.minutes_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor)));
|
||||
((RadioButton) mainView.findViewById(R.id.minutes_radio_button)).setChecked(check);
|
||||
case 3:
|
||||
((RadioButton) mainView.findViewById(R.id.three_digits_radio_button)).setChecked(check);
|
||||
break;
|
||||
case PointDescription.FORMAT_SECONDS:
|
||||
((TextView) mainView.findViewById(R.id.seconds_text)).setTextColor(textColor);
|
||||
((ImageView) mainView.findViewById(R.id.seconds_icon)).setImageDrawable((getIcon(R.drawable.ic_action_coordinates_latitude, iconColor)));
|
||||
((RadioButton) mainView.findViewById(R.id.seconds_radio_button)).setChecked(check);
|
||||
case 2:
|
||||
((RadioButton) mainView.findViewById(R.id.two_digits_radio_button)).setChecked(check);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
interface CoordinateInputFormatChangeListener {
|
||||
|
||||
void onCoordinateFormatChanged(int format);
|
||||
|
||||
void onKeyboardChanged(boolean useOsmandKeyboard);
|
||||
|
||||
void onCancel();
|
||||
void onGoToNextFieldChanged(boolean goToNextField);
|
||||
|
||||
void onAccuracyChanged(int accuracy);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import android.support.v7.widget.LinearLayoutManager;
|
|||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.Editable;
|
||||
import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.TypedValue;
|
||||
|
@ -69,17 +68,12 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
|
||||
public static final String TAG = "CoordinateInputDialogFragment";
|
||||
|
||||
public static final String COORDINATE_FORMAT = "coordinate_format";
|
||||
public static final String USE_OSMAND_KEYBOARD = "use_osmand_keyboard";
|
||||
public static final String GO_TO_NEXT_FIELD = "go_to_next_field";
|
||||
public static final String ACCURACY = "accuracy";
|
||||
|
||||
private static final int CLEAR_BUTTON_POSITION = 9;
|
||||
private static final int DELETE_BUTTON_POSITION = 11;
|
||||
private static final int DEGREES_MAX_LENGTH = 6;
|
||||
private static final int MINUTES_MAX_LENGTH = 9;
|
||||
private static final int SECONDS_MAX_LENGTH = 12;
|
||||
private static final String DEGREES_HINT = "50.000";
|
||||
private static final String MINUTES_HINT = "50:00.000";
|
||||
private static final String SECONDS_HINT = "50:00:00.000";
|
||||
private static final String LATITUDE_LABEL = "latitude";
|
||||
private static final String LONGITUDE_LABEL = "longitude";
|
||||
private static final String NAME_LABEL = "name";
|
||||
|
@ -89,7 +83,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
private CoordinateInputAdapter adapter;
|
||||
private boolean lightTheme;
|
||||
private boolean useOsmandKeyboard = true;
|
||||
private int coordinateFormat = -1;
|
||||
private boolean goToNextField;
|
||||
private int accuracy = 4;
|
||||
private List<OsmandTextFieldBoxes> textFieldBoxes;
|
||||
private List<EditText> inputEditTexts;
|
||||
private View mainView;
|
||||
|
@ -112,10 +107,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
lightTheme = app.getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
||||
int themeId = lightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
|
||||
setStyle(STYLE_NO_FRAME, themeId);
|
||||
|
||||
CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment();
|
||||
fragment.setListener(createCoordinateInputFormatChangeListener());
|
||||
fragment.show(getMapActivity().getSupportFragmentManager(), CoordinateInputBottomSheetDialogFragment.TAG);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -172,8 +163,9 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
}
|
||||
CoordinateInputBottomSheetDialogFragment fragment = new CoordinateInputBottomSheetDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(COORDINATE_FORMAT, coordinateFormat);
|
||||
args.putBoolean(USE_OSMAND_KEYBOARD, useOsmandKeyboard);
|
||||
args.putBoolean(GO_TO_NEXT_FIELD, goToNextField);
|
||||
args.putInt(ACCURACY, accuracy);
|
||||
fragment.setArguments(args);
|
||||
fragment.setListener(createCoordinateInputFormatChangeListener());
|
||||
fragment.show(getMapActivity().getSupportFragmentManager(), CoordinateInputBottomSheetDialogFragment.TAG);
|
||||
|
@ -215,10 +207,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
|
||||
if (savedInstanceState == null) {
|
||||
latitudeBox.select();
|
||||
} else {
|
||||
changeInputEditTextHints();
|
||||
changeInputEditTextsLengths();
|
||||
changeKeyboardInEditTexts();
|
||||
}
|
||||
|
||||
final View mapMarkersLayout = mainView.findViewById(R.id.map_markers_layout);
|
||||
|
@ -382,42 +370,6 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
if (focusedView != null && focusedView instanceof EditText) {
|
||||
EditText focusedEditText = (EditText) focusedView;
|
||||
String str = focusedEditText.getText().toString();
|
||||
int strLength = str.length();
|
||||
if (len < strLength) {
|
||||
String strAfterChanging = str.substring(len);
|
||||
String strDivider = null;
|
||||
if (strLength == 3) {
|
||||
if (coordinateFormat == PointDescription.FORMAT_DEGREES) {
|
||||
strDivider = ".";
|
||||
} else {
|
||||
strDivider = ":";
|
||||
}
|
||||
} else if (strLength == 6 && coordinateFormat != PointDescription.FORMAT_DEGREES) {
|
||||
if (coordinateFormat == PointDescription.FORMAT_MINUTES) {
|
||||
strDivider = ".";
|
||||
} else {
|
||||
strDivider = ":";
|
||||
}
|
||||
} else if (strLength == 9 && coordinateFormat == PointDescription.FORMAT_SECONDS) {
|
||||
strDivider = ".";
|
||||
}
|
||||
if (strDivider != null) {
|
||||
String textToSet = strBeforeChanging + strDivider + strAfterChanging;
|
||||
focusedEditText.setText(textToSet);
|
||||
focusedEditText.setSelection(textToSet.length());
|
||||
}
|
||||
} else if (len > strLength) {
|
||||
if (strLength > 0 && (".:").contains(str.substring(strLength - 1))) {
|
||||
focusedEditText.setText(str.substring(0, str.length() - 1));
|
||||
}
|
||||
focusedEditText.setSelection(focusedEditText.getText().length());
|
||||
}
|
||||
|
||||
if ((strLength == DEGREES_MAX_LENGTH && coordinateFormat == PointDescription.FORMAT_DEGREES)
|
||||
|| (strLength == MINUTES_MAX_LENGTH && coordinateFormat == PointDescription.FORMAT_MINUTES)
|
||||
|| (strLength == SECONDS_MAX_LENGTH && coordinateFormat == PointDescription.FORMAT_SECONDS)) {
|
||||
switchToNextInput(focusedEditText.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -429,13 +381,16 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
if (orientationPortrait && !isOsmandKeyboardCurrentlyVisible()) {
|
||||
changeOsmandKeyboardVisibility(true);
|
||||
}
|
||||
AndroidUtils.hideSoftKeyboard(getActivity(), view);
|
||||
return false;
|
||||
EditText editText = (EditText) view;
|
||||
int inType = editText.getInputType(); // Backup the input type
|
||||
editText.setInputType(InputType.TYPE_NULL); // Disable standard keyboard
|
||||
editText.onTouchEvent(motionEvent); // Call native handler
|
||||
editText.setInputType(inType); // Restore input type
|
||||
return true; // Consume touch event
|
||||
} else {
|
||||
if (isOsmandKeyboardCurrentlyVisible()) {
|
||||
changeOsmandKeyboardVisibility(false);
|
||||
}
|
||||
AndroidUtils.showSoftKeyboard(view);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -554,17 +509,14 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
textView.setOnFocusChangeListener(focusChangeListener);
|
||||
textView.setOnEditorActionListener(inputTextViewOnEditorActionListener);
|
||||
}
|
||||
|
||||
changeInputEditTextHints();
|
||||
changeInputEditTextLengths();
|
||||
changeKeyboardInEditTexts();
|
||||
}
|
||||
|
||||
private CoordinateInputBottomSheetDialogFragment.CoordinateInputFormatChangeListener createCoordinateInputFormatChangeListener() {
|
||||
return new CoordinateInputBottomSheetDialogFragment.CoordinateInputFormatChangeListener() {
|
||||
@Override
|
||||
public void onCoordinateFormatChanged(int format) {
|
||||
coordinateFormat = format;
|
||||
changeInputEditTextHints();
|
||||
changeInputEditTextsLengths();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyboardChanged(boolean useOsmandKeyboard) {
|
||||
CoordinateInputDialogFragment.this.useOsmandKeyboard = useOsmandKeyboard;
|
||||
|
@ -576,8 +528,15 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
dismiss();
|
||||
public void onGoToNextFieldChanged(boolean goToNextField) {
|
||||
CoordinateInputDialogFragment.this.goToNextField = goToNextField;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccuracyChanged(int accuracy) {
|
||||
CoordinateInputDialogFragment.this.accuracy = accuracy;
|
||||
changeInputEditTextHints();
|
||||
changeInputEditTextLengths();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -608,37 +567,37 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
// }
|
||||
}
|
||||
|
||||
private void changeInputEditTextsLengths() {
|
||||
int maxLength;
|
||||
if (coordinateFormat == PointDescription.FORMAT_DEGREES) {
|
||||
maxLength = DEGREES_MAX_LENGTH;
|
||||
} else if (coordinateFormat == PointDescription.FORMAT_MINUTES) {
|
||||
maxLength = MINUTES_MAX_LENGTH;
|
||||
} else {
|
||||
maxLength = SECONDS_MAX_LENGTH;
|
||||
}
|
||||
InputFilter[] filtersArray = new InputFilter[] {new InputFilter.LengthFilter(maxLength)};
|
||||
for (EditText editText : inputEditTexts) {
|
||||
if (editText.getId() != R.id.name_edit_text) {
|
||||
editText.setFilters(filtersArray);
|
||||
}
|
||||
}
|
||||
private void changeInputEditTextLengths() {
|
||||
// int maxLength;
|
||||
// if (accuracy == PointDescription.FORMAT_DEGREES) {
|
||||
// maxLength = DEGREES_MAX_LENGTH;
|
||||
// } else if (accuracy == PointDescription.FORMAT_MINUTES) {
|
||||
// maxLength = MINUTES_MAX_LENGTH;
|
||||
// } else {
|
||||
// maxLength = SECONDS_MAX_LENGTH;
|
||||
// }
|
||||
// InputFilter[] filtersArray = new InputFilter[] {new InputFilter.LengthFilter(maxLength)};
|
||||
// for (EditText editText : inputEditTexts) {
|
||||
// if (editText.getId() != R.id.name_edit_text) {
|
||||
// editText.setFilters(filtersArray);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void changeInputEditTextHints() {
|
||||
String hint;
|
||||
if (coordinateFormat == PointDescription.FORMAT_DEGREES) {
|
||||
hint = DEGREES_HINT;
|
||||
} else if (coordinateFormat == PointDescription.FORMAT_MINUTES) {
|
||||
hint = MINUTES_HINT;
|
||||
} else {
|
||||
hint = SECONDS_HINT;
|
||||
}
|
||||
for (EditText editText : inputEditTexts) {
|
||||
if (editText.getId() != R.id.name_edit_text) {
|
||||
editText.setHint(hint);
|
||||
}
|
||||
}
|
||||
// String hint;
|
||||
// if (accuracy == PointDescription.FORMAT_DEGREES) {
|
||||
// hint = DEGREES_HINT;
|
||||
// } else if (accuracy == PointDescription.FORMAT_MINUTES) {
|
||||
// hint = MINUTES_HINT;
|
||||
// } else {
|
||||
// hint = SECONDS_HINT;
|
||||
// }
|
||||
// for (EditText editText : inputEditTexts) {
|
||||
// if (editText.getId() != R.id.name_edit_text) {
|
||||
// editText.setHint(hint);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void switchToNextInput(int id) {
|
||||
|
|
Loading…
Reference in a new issue