Add show number pad setting
This commit is contained in:
parent
a8f18ea653
commit
99298344f2
6 changed files with 246 additions and 200 deletions
|
@ -121,94 +121,11 @@
|
|||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/hand_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
android:layout_weight="0.55"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/map_markers_layout"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
osmand:cardUseCompatPadding="true"
|
||||
osmand:cardCornerRadius="8dp">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:id="@+id/markers_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_weight="0.45"
|
||||
android:id="@+id/keyboard_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<GridView
|
||||
android:id="@+id/keyboard_grid_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="53dp"
|
||||
android:horizontalSpacing="1dp"
|
||||
android:numColumns="4"
|
||||
android:stretchMode="columnWidth"
|
||||
android:verticalSpacing="1dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:id="@+id/keyboard_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/keyboard_item_add_button_bg_pressed"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:background="@drawable/keyboard_item_add_button_bg"
|
||||
android:id="@+id/add_marker_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_add"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="@color/keyboard_item_add_button_text_color"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
41
OsmAnd/res/layout/coordinate_input_land_map_markers_list.xml
Normal file
41
OsmAnd/res/layout/coordinate_input_land_map_markers_list.xml
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
android:layout_weight="0.55"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/map_markers_layout"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="8dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"/>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
osmand:cardUseCompatPadding="true"
|
||||
osmand:cardCornerRadius="8dp">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:id="@+id/markers_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v4.widget.NestedScrollView>
|
46
OsmAnd/res/layout/coordinate_input_land_osmand_keyboard.xml
Normal file
46
OsmAnd/res/layout/coordinate_input_land_osmand_keyboard.xml
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
android:layout_weight="0.45"
|
||||
android:id="@+id/keyboard_layout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<GridView
|
||||
android:id="@+id/keyboard_grid_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="53dp"
|
||||
android:horizontalSpacing="1dp"
|
||||
android:numColumns="4"
|
||||
android:stretchMode="columnWidth"
|
||||
android:verticalSpacing="1dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:id="@+id/keyboard_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/keyboard_item_add_button_bg_pressed"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatTextView
|
||||
android:background="@drawable/keyboard_item_add_button_bg"
|
||||
android:id="@+id/add_marker_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:text="@string/shared_string_add"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="@color/keyboard_item_add_button_text_color"
|
||||
android:textSize="@dimen/default_list_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -102,7 +102,7 @@
|
|||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:id="@+id/show_direction_text_view"
|
||||
android:id="@+id/hand_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.mapmarkers;
|
|||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -11,7 +12,6 @@ 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;
|
||||
|
@ -69,8 +69,34 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
|
|||
|
||||
((TextView) mainView.findViewById(R.id.coordinate_input_accuracy_descr)).setText(getString(R.string.coordinate_input_accuracy_description, accuracy));
|
||||
|
||||
((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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
View handRow = mainView.findViewById(R.id.hand_row);
|
||||
if (portrait) {
|
||||
mainView.findViewById(R.id.hand_row).setVisibility(View.GONE);
|
||||
handRow.setVisibility(View.GONE);
|
||||
} else {
|
||||
handRow.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
rightHand = !rightHand;
|
||||
populateChangeHandRow();
|
||||
if (listener != null) {
|
||||
listener.onHandChanged(rightHand);
|
||||
}
|
||||
}
|
||||
});
|
||||
populateChangeHandRow();
|
||||
}
|
||||
|
||||
((CompoundButton) mainView.findViewById(R.id.go_to_next_field_switch)).setChecked(goToNextField);
|
||||
|
@ -104,18 +130,6 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
|
|||
((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() {
|
||||
|
@ -158,6 +172,12 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
|
|||
return mainView;
|
||||
}
|
||||
|
||||
private void populateChangeHandRow() {
|
||||
((ImageView) mainView.findViewById(R.id.hand_icon)).setImageDrawable(getContentIcon(rightHand ? R.drawable.ic_action_show_keypad_right : R.drawable.ic_action_show_keypad_left));
|
||||
((TextView) mainView.findViewById(R.id.hand_text_view)).setText(getString(rightHand ? R.string.shared_string_right : R.string.shared_string_left));
|
||||
((TextView) mainView.findViewById(R.id.hand_text_view)).setTextColor(ContextCompat.getColor(getContext(), nightMode ? R.color.color_dialog_buttons_dark : R.color.map_widget_blue_pressed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
outState.putBoolean(USE_OSMAND_KEYBOARD, useOsmandKeyboard);
|
||||
|
|
|
@ -36,6 +36,7 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.EditText;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -188,19 +189,21 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
final OsmandTextFieldBoxes longitudeBox = (OsmandTextFieldBoxes) mainView.findViewById(R.id.longitude_box);
|
||||
textFieldBoxes.add(longitudeBox);
|
||||
final OsmandTextFieldBoxes nameBox = (OsmandTextFieldBoxes) mainView.findViewById(R.id.name_box);
|
||||
nameBox.setEndIcon(iconsCache.getIcon(R.drawable.ic_action_keyboard, R.color.coordinate_input_keyboard_icon_color));
|
||||
nameBox.getEndIconImageButton().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
View focusedView = getDialog().getCurrentFocus();
|
||||
if (focusedView != null) {
|
||||
if (orientationPortrait && isOsmandKeyboardCurrentlyVisible()) {
|
||||
changeOsmandKeyboardVisibility(false);
|
||||
if (orientationPortrait) {
|
||||
nameBox.setEndIcon(iconsCache.getIcon(R.drawable.ic_action_keyboard, R.color.coordinate_input_keyboard_icon_color));
|
||||
nameBox.getEndIconImageButton().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
View focusedView = getDialog().getCurrentFocus();
|
||||
if (focusedView != null) {
|
||||
if (isOsmandKeyboardCurrentlyVisible()) {
|
||||
changeOsmandKeyboardVisibility(false);
|
||||
}
|
||||
AndroidUtils.showSoftKeyboard(focusedView);
|
||||
}
|
||||
AndroidUtils.showSoftKeyboard(focusedView);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
textFieldBoxes.add(nameBox);
|
||||
|
||||
registerTextFieldBoxes();
|
||||
|
@ -219,99 +222,116 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
latitudeBox.select();
|
||||
}
|
||||
|
||||
final View mapMarkersLayout = mainView.findViewById(R.id.map_markers_layout);
|
||||
|
||||
RecyclerView recyclerView = (RecyclerView) mainView.findViewById(R.id.markers_recycler_view);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
adapter = new CoordinateInputAdapter(mapActivity, mapMarkers);
|
||||
if (mapMarkersLayout != null) {
|
||||
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
||||
@Override
|
||||
public void onChanged() {
|
||||
super.onChanged();
|
||||
mapMarkersLayout.setVisibility(adapter.isEmpty() ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
compassUpdateAllowed = newState == RecyclerView.SCROLL_STATE_IDLE;
|
||||
}
|
||||
});
|
||||
|
||||
mainView.findViewById(R.id.add_marker_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
addMapMarker();
|
||||
}
|
||||
});
|
||||
|
||||
View keyboardLayout = mainView.findViewById(R.id.keyboard_layout);
|
||||
if (orientationPortrait) {
|
||||
AndroidUtils.setBackground(mapActivity, keyboardLayout, !lightTheme, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||
}
|
||||
|
||||
Object[] keyboardItems = new Object[] { "1", "2", "3", getString(R.string.shared_string_clear),
|
||||
"4", "5", "6", "-",
|
||||
"7", "8", "9", R.drawable.ic_keyboard_backspace,
|
||||
".", "0", ":", R.drawable.ic_keyboard_next_field};
|
||||
final GridView keyboardGrid = (GridView) mainView.findViewById(R.id.keyboard_grid_view);
|
||||
keyboardGrid.setBackgroundColor(ContextCompat.getColor(getContext(), lightTheme ? R.color.keyboard_divider_light : R.color.keyboard_divider_dark));
|
||||
final KeyboardAdapter keyboardAdapter = new KeyboardAdapter(mapActivity, keyboardItems);
|
||||
keyboardGrid.setAdapter(keyboardAdapter);
|
||||
keyboardGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
View focusedView = getDialog().getCurrentFocus();
|
||||
if (focusedView != null && focusedView instanceof EditText) {
|
||||
EditText focusedEditText = (EditText) focusedView;
|
||||
switch (i) {
|
||||
case CLEAR_BUTTON_POSITION:
|
||||
focusedEditText.setText("");
|
||||
break;
|
||||
case BACKSPACE_BUTTON_POSITION:
|
||||
String str = focusedEditText.getText().toString();
|
||||
if (str.length() > 0) {
|
||||
str = str.substring(0, str.length() - 1);
|
||||
focusedEditText.setText(str);
|
||||
focusedEditText.setSelection(str.length());
|
||||
}
|
||||
break;
|
||||
case SWITCH_TO_NEXT_INPUT_BUTTON_POSITION:
|
||||
switchToNextInput(focusedEditText.getId());
|
||||
break;
|
||||
default:
|
||||
focusedEditText.setText(focusedEditText.getText().toString() + keyboardAdapter.getItem(i));
|
||||
focusedEditText.setSelection(focusedEditText.getText().length());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (orientationPortrait) {
|
||||
final ImageView showHideKeyboardIcon = (ImageView) mainView.findViewById(R.id.show_hide_keyboard_icon);
|
||||
showHideKeyboardIcon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_arrow_down, R.color.keyboard_item_show_hide_color));
|
||||
showHideKeyboardIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
boolean isCurrentlyVisible = isOsmandKeyboardCurrentlyVisible();
|
||||
View focusedView = getDialog().getCurrentFocus();
|
||||
if (focusedView != null && !isCurrentlyVisible) {
|
||||
AndroidUtils.hideSoftKeyboard(getActivity(), focusedView);
|
||||
}
|
||||
if (orientationPortrait) {
|
||||
changeOsmandKeyboardVisibility(!isCurrentlyVisible);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
registerMainView();
|
||||
|
||||
return mainView;
|
||||
}
|
||||
|
||||
private void registerMainView() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
|
||||
if (mapActivity != null) {
|
||||
if (!orientationPortrait) {
|
||||
LinearLayout handContainer = (LinearLayout) mainView.findViewById(R.id.hand_container);
|
||||
if (rightHand) {
|
||||
View.inflate(getContext(), R.layout.coordinate_input_land_map_markers_list, handContainer);
|
||||
View.inflate(getContext(), R.layout.coordinate_input_land_osmand_keyboard, handContainer);
|
||||
} else {
|
||||
View.inflate(getContext(), R.layout.coordinate_input_land_osmand_keyboard, handContainer);
|
||||
View.inflate(getContext(), R.layout.coordinate_input_land_map_markers_list, handContainer);
|
||||
}
|
||||
}
|
||||
|
||||
final View mapMarkersLayout = mainView.findViewById(R.id.map_markers_layout);
|
||||
|
||||
RecyclerView recyclerView = (RecyclerView) mainView.findViewById(R.id.markers_recycler_view);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
adapter = new CoordinateInputAdapter(mapActivity, mapMarkers);
|
||||
if (mapMarkersLayout != null) {
|
||||
adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
||||
@Override
|
||||
public void onChanged() {
|
||||
super.onChanged();
|
||||
mapMarkersLayout.setVisibility(adapter.isEmpty() ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
recyclerView.setAdapter(adapter);
|
||||
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
super.onScrollStateChanged(recyclerView, newState);
|
||||
compassUpdateAllowed = newState == RecyclerView.SCROLL_STATE_IDLE;
|
||||
}
|
||||
});
|
||||
|
||||
mainView.findViewById(R.id.add_marker_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
addMapMarker();
|
||||
}
|
||||
});
|
||||
|
||||
View keyboardLayout = mainView.findViewById(R.id.keyboard_layout);
|
||||
if (orientationPortrait) {
|
||||
AndroidUtils.setBackground(mapActivity, keyboardLayout, !lightTheme, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||
}
|
||||
|
||||
Object[] keyboardItems = new Object[] { "1", "2", "3", getString(R.string.shared_string_clear),
|
||||
"4", "5", "6", "-",
|
||||
"7", "8", "9", R.drawable.ic_keyboard_backspace,
|
||||
".", "0", ":", R.drawable.ic_keyboard_next_field};
|
||||
final GridView keyboardGrid = (GridView) mainView.findViewById(R.id.keyboard_grid_view);
|
||||
keyboardGrid.setBackgroundColor(ContextCompat.getColor(getContext(), lightTheme ? R.color.keyboard_divider_light : R.color.keyboard_divider_dark));
|
||||
final KeyboardAdapter keyboardAdapter = new KeyboardAdapter(mapActivity, keyboardItems);
|
||||
keyboardGrid.setAdapter(keyboardAdapter);
|
||||
keyboardGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
View focusedView = getDialog().getCurrentFocus();
|
||||
if (focusedView != null && focusedView instanceof EditText) {
|
||||
EditText focusedEditText = (EditText) focusedView;
|
||||
switch (i) {
|
||||
case CLEAR_BUTTON_POSITION:
|
||||
focusedEditText.setText("");
|
||||
break;
|
||||
case BACKSPACE_BUTTON_POSITION:
|
||||
String str = focusedEditText.getText().toString();
|
||||
if (str.length() > 0) {
|
||||
str = str.substring(0, str.length() - 1);
|
||||
focusedEditText.setText(str);
|
||||
focusedEditText.setSelection(str.length());
|
||||
}
|
||||
break;
|
||||
case SWITCH_TO_NEXT_INPUT_BUTTON_POSITION:
|
||||
switchToNextInput(focusedEditText.getId());
|
||||
break;
|
||||
default:
|
||||
focusedEditText.setText(focusedEditText.getText().toString() + keyboardAdapter.getItem(i));
|
||||
focusedEditText.setSelection(focusedEditText.getText().length());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (orientationPortrait) {
|
||||
final ImageView showHideKeyboardIcon = (ImageView) mainView.findViewById(R.id.show_hide_keyboard_icon);
|
||||
showHideKeyboardIcon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_arrow_down, R.color.keyboard_item_show_hide_color));
|
||||
showHideKeyboardIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
boolean isCurrentlyVisible = isOsmandKeyboardCurrentlyVisible();
|
||||
View focusedView = getDialog().getCurrentFocus();
|
||||
if (focusedView != null && !isCurrentlyVisible) {
|
||||
AndroidUtils.hideSoftKeyboard(getActivity(), focusedView);
|
||||
}
|
||||
changeOsmandKeyboardVisibility(!isCurrentlyVisible);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
@ -584,7 +604,9 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
}
|
||||
|
||||
private void changeHand() {
|
||||
|
||||
LinearLayout handContainer = (LinearLayout) mainView.findViewById(R.id.hand_container);
|
||||
handContainer.removeAllViewsInLayout();
|
||||
registerMainView();
|
||||
}
|
||||
|
||||
private void changeEditTextSelections() {
|
||||
|
|
Loading…
Reference in a new issue