Fixes
This commit is contained in:
parent
704ab9d457
commit
e75ff85aba
7 changed files with 77 additions and 71 deletions
|
@ -54,10 +54,9 @@
|
||||||
|
|
||||||
<net.osmand.plus.widgets.CursorTextView
|
<net.osmand.plus.widgets.CursorTextView
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
android:id="@+id/latitude_edit_text"
|
android:id="@+id/latitude_input_text_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"/>
|
||||||
android:inputType="number"/>
|
|
||||||
|
|
||||||
</net.osmand.plus.widgets.OsmandTextViewFieldBoxes>
|
</net.osmand.plus.widgets.OsmandTextViewFieldBoxes>
|
||||||
|
|
||||||
|
@ -72,10 +71,9 @@
|
||||||
|
|
||||||
<net.osmand.plus.widgets.CursorTextView
|
<net.osmand.plus.widgets.CursorTextView
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
android:id="@+id/longitude_edit_text"
|
android:id="@+id/longitude_input_text_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"/>
|
||||||
android:inputType="number"/>
|
|
||||||
|
|
||||||
</net.osmand.plus.widgets.OsmandTextViewFieldBoxes>
|
</net.osmand.plus.widgets.OsmandTextViewFieldBoxes>
|
||||||
|
|
||||||
|
@ -90,11 +88,10 @@
|
||||||
|
|
||||||
<net.osmand.plus.widgets.CursorTextView
|
<net.osmand.plus.widgets.CursorTextView
|
||||||
android:imeOptions="actionDone"
|
android:imeOptions="actionDone"
|
||||||
android:id="@+id/name_edit_text"
|
android:id="@+id/name_input_text_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/access_hint_enter_name"
|
android:hint="@string/access_hint_enter_name"/>
|
||||||
android:inputType="text"/>
|
|
||||||
|
|
||||||
</net.osmand.plus.widgets.OsmandTextViewFieldBoxes>
|
</net.osmand.plus.widgets.OsmandTextViewFieldBoxes>
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,7 @@
|
||||||
|
|
||||||
<net.osmand.plus.widgets.CursorTextView
|
<net.osmand.plus.widgets.CursorTextView
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
android:inputType="number"
|
android:id="@+id/latitude_input_text_view"
|
||||||
android:id="@+id/latitude_edit_text"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
@ -112,8 +111,7 @@
|
||||||
|
|
||||||
<net.osmand.plus.widgets.CursorTextView
|
<net.osmand.plus.widgets.CursorTextView
|
||||||
android:imeOptions="actionNext"
|
android:imeOptions="actionNext"
|
||||||
android:inputType="number"
|
android:id="@+id/longitude_input_text_view"
|
||||||
android:id="@+id/longitude_edit_text"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
@ -138,9 +136,8 @@
|
||||||
|
|
||||||
<net.osmand.plus.widgets.CursorTextView
|
<net.osmand.plus.widgets.CursorTextView
|
||||||
android:imeOptions="actionDone"
|
android:imeOptions="actionDone"
|
||||||
android:inputType="text"
|
|
||||||
android:hint="@string/access_hint_enter_name"
|
android:hint="@string/access_hint_enter_name"
|
||||||
android:id="@+id/name_edit_text"
|
android:id="@+id/name_input_text_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ import android.view.WindowManager;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.GridView;
|
import android.widget.GridView;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -204,17 +203,21 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
registerTextFieldBoxes();
|
registerTextFieldBoxes();
|
||||||
|
|
||||||
inputTextViews = new ArrayList<>();
|
inputTextViews = new ArrayList<>();
|
||||||
final TextView latitudeEditText = (TextView) mainView.findViewById(R.id.latitude_edit_text);
|
final TextView latitudeInputTextView = (TextView) mainView.findViewById(R.id.latitude_input_text_view);
|
||||||
inputTextViews.add(latitudeEditText);
|
inputTextViews.add(latitudeInputTextView);
|
||||||
final TextView longitudeEditText = (TextView) mainView.findViewById(R.id.longitude_edit_text);
|
final TextView longitudeInputTextView = (TextView) mainView.findViewById(R.id.longitude_input_text_view);
|
||||||
inputTextViews.add(longitudeEditText);
|
inputTextViews.add(longitudeInputTextView);
|
||||||
final TextView nameEditText = (TextView) mainView.findViewById(R.id.name_edit_text);
|
final TextView nameInputTextView = (TextView) mainView.findViewById(R.id.name_input_text_view);
|
||||||
inputTextViews.add(nameEditText);
|
inputTextViews.add(nameInputTextView);
|
||||||
|
|
||||||
registerEditTexts();
|
registerInputTextViews();
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
latitudeBox.select();
|
latitudeBox.select();
|
||||||
|
} else {
|
||||||
|
changeInputTextViewHints();
|
||||||
|
changeInputTextViewLengths();
|
||||||
|
changeKeyboardInInputTextViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
final View mapMarkersLayout = mainView.findViewById(R.id.map_markers_layout);
|
final View mapMarkersLayout = mainView.findViewById(R.id.map_markers_layout);
|
||||||
|
@ -356,7 +359,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
changeKeyboardInBoxes();
|
changeKeyboardInBoxes();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerEditTexts() {
|
private void registerInputTextViews() {
|
||||||
TextWatcher textWatcher = new TextWatcher() {
|
TextWatcher textWatcher = new TextWatcher() {
|
||||||
int len = 0;
|
int len = 0;
|
||||||
String strBeforeChanging = "";
|
String strBeforeChanging = "";
|
||||||
|
@ -375,7 +378,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable editable) {
|
public void afterTextChanged(Editable editable) {
|
||||||
View focusedView = getDialog().getCurrentFocus();
|
View focusedView = getDialog().getCurrentFocus();
|
||||||
if (focusedView != null && focusedView instanceof EditText) {
|
if (focusedView != null && focusedView instanceof TextView) {
|
||||||
TextView focusedTextView = (TextView) focusedView;
|
TextView focusedTextView = (TextView) focusedView;
|
||||||
String str = focusedTextView.getText().toString();
|
String str = focusedTextView.getText().toString();
|
||||||
int strLength = str.length();
|
int strLength = str.length();
|
||||||
|
@ -416,34 +419,30 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
View.OnTouchListener editTextOnTouchListener = new View.OnTouchListener() {
|
View.OnTouchListener inputTextViewOnTouchListener = new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
if (useOsmandKeyboard || !orientationPortrait) {
|
if (useOsmandKeyboard || !orientationPortrait) {
|
||||||
if (orientationPortrait && !isOsmandKeyboardCurrentlyVisible()) {
|
if (orientationPortrait && !isOsmandKeyboardCurrentlyVisible()) {
|
||||||
changeOsmandKeyboardVisibility(true);
|
changeOsmandKeyboardVisibility(true);
|
||||||
}
|
}
|
||||||
EditText editText = (EditText) view;
|
AndroidUtils.hideSoftKeyboard(getActivity(), view);
|
||||||
int inType = editText.getInputType(); // Backup the input type
|
return false;
|
||||||
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 {
|
} else {
|
||||||
if (isOsmandKeyboardCurrentlyVisible()) {
|
if (isOsmandKeyboardCurrentlyVisible()) {
|
||||||
changeOsmandKeyboardVisibility(false);
|
changeOsmandKeyboardVisibility(false);
|
||||||
}
|
}
|
||||||
|
AndroidUtils.showSoftKeyboard(view);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
View.OnLongClickListener editTextOnLongClickListener = new View.OnLongClickListener() {
|
View.OnLongClickListener inputTextViewOnLongClickListener = new View.OnLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(final View view) {
|
public boolean onLongClick(final View view) {
|
||||||
if (useOsmandKeyboard) {
|
final TextView inputTextView = (TextView) view;
|
||||||
final EditText editText = (EditText) view;
|
PopupMenu popupMenu = new PopupMenu(getContext(), inputTextView);
|
||||||
PopupMenu popupMenu = new PopupMenu(getContext(), editText);
|
|
||||||
Menu menu = popupMenu.getMenu();
|
Menu menu = popupMenu.getMenu();
|
||||||
popupMenu.getMenuInflater().inflate(R.menu.copy_paste_menu, menu);
|
popupMenu.getMenuInflater().inflate(R.menu.copy_paste_menu, menu);
|
||||||
final ClipboardManager clipboardManager = ((ClipboardManager) getContext().getSystemService(CLIPBOARD_SERVICE));
|
final ClipboardManager clipboardManager = ((ClipboardManager) getContext().getSystemService(CLIPBOARD_SERVICE));
|
||||||
|
@ -462,29 +461,28 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
case R.id.action_copy:
|
case R.id.action_copy:
|
||||||
String labelText;
|
String labelText;
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.latitude_edit_text:
|
case R.id.latitude_input_text_view:
|
||||||
labelText = LATITUDE_LABEL;
|
labelText = LATITUDE_LABEL;
|
||||||
break;
|
break;
|
||||||
case R.id.longitude_edit_text:
|
case R.id.longitude_input_text_view:
|
||||||
labelText = LONGITUDE_LABEL;
|
labelText = LONGITUDE_LABEL;
|
||||||
break;
|
break;
|
||||||
case R.id.name_edit_text:
|
case R.id.name_input_text_view:
|
||||||
labelText = NAME_LABEL;
|
labelText = NAME_LABEL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
labelText = "";
|
labelText = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ClipData clip = ClipData.newPlainText(labelText, editText.getText().toString());
|
ClipData clip = ClipData.newPlainText(labelText, inputTextView.getText().toString());
|
||||||
clipboardManager.setPrimaryClip(clip);
|
clipboardManager.setPrimaryClip(clip);
|
||||||
return true;
|
return true;
|
||||||
case R.id.action_paste:
|
case R.id.action_paste:
|
||||||
ClipData.Item pasteItem = clipboardManager.getPrimaryClip().getItemAt(0);
|
ClipData.Item pasteItem = clipboardManager.getPrimaryClip().getItemAt(0);
|
||||||
CharSequence pasteData = pasteItem.getText();
|
CharSequence pasteData = pasteItem.getText();
|
||||||
if (pasteData != null) {
|
if (pasteData != null) {
|
||||||
String str = editText.getText().toString();
|
String str = inputTextView.getText().toString();
|
||||||
editText.setText(str + pasteData.toString());
|
inputTextView.setText(str + pasteData.toString());
|
||||||
editText.setSelection(editText.getText().length());
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -494,9 +492,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
popupMenu.show();
|
popupMenu.show();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -505,13 +501,13 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
public void onFocusChange(View view, boolean b) {
|
public void onFocusChange(View view, boolean b) {
|
||||||
int resId;
|
int resId;
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.latitude_edit_text:
|
case R.id.latitude_input_text_view:
|
||||||
resId = R.id.latitude_box;
|
resId = R.id.latitude_box;
|
||||||
break;
|
break;
|
||||||
case R.id.longitude_edit_text:
|
case R.id.longitude_input_text_view:
|
||||||
resId = R.id.longitude_box;
|
resId = R.id.longitude_box;
|
||||||
break;
|
break;
|
||||||
case R.id.name_edit_text:
|
case R.id.name_input_text_view:
|
||||||
resId = R.id.name_box;
|
resId = R.id.name_box;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -533,7 +529,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TextView.OnEditorActionListener editTextOnEditorActionListener = new TextView.OnEditorActionListener() {
|
TextView.OnEditorActionListener inputTextViewOnEditorActionListener = new TextView.OnEditorActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
|
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
|
||||||
if (i == EditorInfo.IME_ACTION_NEXT) {
|
if (i == EditorInfo.IME_ACTION_NEXT) {
|
||||||
|
@ -546,13 +542,13 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
};
|
};
|
||||||
|
|
||||||
for (TextView textView : inputTextViews) {
|
for (TextView textView : inputTextViews) {
|
||||||
if (textView.getId() != R.id.name_edit_text) {
|
// if (textView.getId() != R.id.name_input_text_view) {
|
||||||
textView.addTextChangedListener(textWatcher);
|
// textView.addTextChangedListener(textWatcher);
|
||||||
}
|
// }
|
||||||
textView.setOnTouchListener(editTextOnTouchListener);
|
textView.setOnTouchListener(inputTextViewOnTouchListener);
|
||||||
textView.setOnLongClickListener(editTextOnLongClickListener);
|
textView.setOnLongClickListener(inputTextViewOnLongClickListener);
|
||||||
textView.setOnFocusChangeListener(focusChangeListener);
|
textView.setOnFocusChangeListener(focusChangeListener);
|
||||||
textView.setOnEditorActionListener(editTextOnEditorActionListener);
|
textView.setOnEditorActionListener(inputTextViewOnEditorActionListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,8 +557,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
@Override
|
@Override
|
||||||
public void onCoordinateFormatChanged(int format) {
|
public void onCoordinateFormatChanged(int format) {
|
||||||
coordinateFormat = format;
|
coordinateFormat = format;
|
||||||
changeEditTextHints();
|
changeInputTextViewHints();
|
||||||
changeEditTextLengths();
|
changeInputTextViewLengths();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -572,6 +568,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
changeOsmandKeyboardVisibility(false);
|
changeOsmandKeyboardVisibility(false);
|
||||||
}
|
}
|
||||||
changeKeyboardInBoxes();
|
changeKeyboardInBoxes();
|
||||||
|
changeKeyboardInInputTextViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -593,13 +590,21 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
.setImageDrawable(iconsCache.getThemedIcon(show ? R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up));
|
.setImageDrawable(iconsCache.getThemedIcon(show ? R.drawable.ic_action_arrow_down : R.drawable.ic_action_arrow_up));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeKeyboardInBoxes() {
|
private void changeKeyboardInBoxes() {
|
||||||
for (OsmandTextViewFieldBoxes textFieldBox : textFieldBoxes) {
|
for (OsmandTextViewFieldBoxes textFieldBox : textFieldBoxes) {
|
||||||
textFieldBox.setUseOsmandKeyboard(useOsmandKeyboard);
|
textFieldBox.setUseOsmandKeyboard(useOsmandKeyboard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeEditTextLengths() {
|
private void changeKeyboardInInputTextViews() {
|
||||||
|
int coordinateInputType = useOsmandKeyboard ? InputType.TYPE_NULL : InputType.TYPE_CLASS_NUMBER;
|
||||||
|
int nameInputType = useOsmandKeyboard ? InputType.TYPE_NULL : InputType.TYPE_CLASS_TEXT;
|
||||||
|
for (TextView inputTextView : inputTextViews) {
|
||||||
|
inputTextView.setInputType(inputTextView.getId() == R.id.name_input_text_view ? nameInputType : coordinateInputType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void changeInputTextViewLengths() {
|
||||||
int maxLength;
|
int maxLength;
|
||||||
if (coordinateFormat == PointDescription.FORMAT_DEGREES) {
|
if (coordinateFormat == PointDescription.FORMAT_DEGREES) {
|
||||||
maxLength = DEGREES_MAX_LENGTH;
|
maxLength = DEGREES_MAX_LENGTH;
|
||||||
|
@ -610,13 +615,13 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
}
|
}
|
||||||
InputFilter[] filtersArray = new InputFilter[] {new InputFilter.LengthFilter(maxLength)};
|
InputFilter[] filtersArray = new InputFilter[] {new InputFilter.LengthFilter(maxLength)};
|
||||||
for (TextView textView : inputTextViews) {
|
for (TextView textView : inputTextViews) {
|
||||||
if (textView.getId() != R.id.name_edit_text) {
|
if (textView.getId() != R.id.name_input_text_view) {
|
||||||
textView.setFilters(filtersArray);
|
textView.setFilters(filtersArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeEditTextHints() {
|
private void changeInputTextViewHints() {
|
||||||
String hint;
|
String hint;
|
||||||
if (coordinateFormat == PointDescription.FORMAT_DEGREES) {
|
if (coordinateFormat == PointDescription.FORMAT_DEGREES) {
|
||||||
hint = DEGREES_HINT;
|
hint = DEGREES_HINT;
|
||||||
|
@ -626,14 +631,14 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
hint = SECONDS_HINT;
|
hint = SECONDS_HINT;
|
||||||
}
|
}
|
||||||
for (TextView textView : inputTextViews) {
|
for (TextView textView : inputTextViews) {
|
||||||
if (textView.getId() != R.id.name_edit_text) {
|
if (textView.getId() != R.id.name_input_text_view) {
|
||||||
textView.setHint(hint);
|
textView.setHint(hint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void switchToNextInput(int id) {
|
private void switchToNextInput(int id) {
|
||||||
if (id == R.id.latitude_edit_text) {
|
if (id == R.id.latitude_input_text_view) {
|
||||||
((OsmandTextViewFieldBoxes) mainView.findViewById(R.id.longitude_box)).select();
|
((OsmandTextViewFieldBoxes) mainView.findViewById(R.id.longitude_box)).select();
|
||||||
} else {
|
} else {
|
||||||
((OsmandTextViewFieldBoxes) mainView.findViewById(R.id.name_box)).select();
|
((OsmandTextViewFieldBoxes) mainView.findViewById(R.id.name_box)).select();
|
||||||
|
@ -641,12 +646,12 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMapMarker() {
|
private void addMapMarker() {
|
||||||
String latitude = ((EditText) mainView.findViewById(R.id.latitude_edit_text)).getText().toString();
|
String latitude = ((TextView) mainView.findViewById(R.id.latitude_input_text_view)).getText().toString();
|
||||||
String longitude = ((EditText) mainView.findViewById(R.id.longitude_edit_text)).getText().toString();
|
String longitude = ((TextView) mainView.findViewById(R.id.longitude_input_text_view)).getText().toString();
|
||||||
String locPhrase = latitude + ", " + longitude;
|
String locPhrase = latitude + ", " + longitude;
|
||||||
LatLon latLon = MapUtils.parseLocation(locPhrase);
|
LatLon latLon = MapUtils.parseLocation(locPhrase);
|
||||||
if (latLon != null) {
|
if (latLon != null) {
|
||||||
String name = ((EditText) mainView.findViewById(R.id.name_edit_text)).getText().toString();
|
String name = ((TextView) mainView.findViewById(R.id.name_input_text_view)).getText().toString();
|
||||||
addMapMarker(latLon, name);
|
addMapMarker(latLon, name);
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getContext(), getString(R.string.wrong_format), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), getString(R.string.wrong_format), Toast.LENGTH_SHORT).show();
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class RenameMarkerBottomSheetDialogFragment extends BottomSheetDialogFrag
|
||||||
AndroidUtils.setBackground(getActivity(), mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
AndroidUtils.setBackground(getActivity(), mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text);
|
final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_input_text_view);
|
||||||
nameEditText.setText(marker.getName(mapActivity));
|
nameEditText.setText(marker.getName(mapActivity));
|
||||||
nameEditText.requestFocus();
|
nameEditText.requestFocus();
|
||||||
final InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
final InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class SaveAsTrackBottomSheetDialogFragment extends BottomSheetDialogFragm
|
||||||
displayedName = suggestedName + "_" + (++ind);
|
displayedName = suggestedName + "_" + (++ind);
|
||||||
fout = new File(dir, displayedName + GPX_SUFFIX);
|
fout = new File(dir, displayedName + GPX_SUFFIX);
|
||||||
}
|
}
|
||||||
final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text);
|
final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_input_text_view);
|
||||||
nameEditText.setText(displayedName);
|
nameEditText.setText(displayedName);
|
||||||
View textBox = mainView.findViewById(R.id.name_text_box);
|
View textBox = mainView.findViewById(R.id.name_text_box);
|
||||||
if (textBox instanceof OsmandEditTextFieldBoxes) {
|
if (textBox instanceof OsmandEditTextFieldBoxes) {
|
||||||
|
|
|
@ -34,6 +34,13 @@ public class CursorTextView extends AppCompatTextView {
|
||||||
linePaint.setFilterBitmap(true);
|
linePaint.setFilterBitmap(true);
|
||||||
linePaint.setColor(Color.RED);
|
linePaint.setColor(Color.RED);
|
||||||
bounds = new Rect();
|
bounds = new Rect();
|
||||||
|
setFocusable(true);
|
||||||
|
setFocusableInTouchMode(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getFreezesText() {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -115,13 +115,13 @@ public class OsmandTextViewFieldBoxes extends FrameLayout {
|
||||||
themeArray.recycle();
|
themeArray.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AppCompatTextView findEditTextChild() {
|
protected AppCompatTextView findTextViewChild() {
|
||||||
return this.getChildCount() > 0 && this.getChildAt(0) instanceof AppCompatTextView?(AppCompatTextView) this.getChildAt(0):null;
|
return this.getChildCount() > 0 && this.getChildAt(0) instanceof AppCompatTextView?(AppCompatTextView) this.getChildAt(0):null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
this.inputText = this.findEditTextChild();
|
this.inputText = this.findTextViewChild();
|
||||||
if(this.inputText != null) {
|
if(this.inputText != null) {
|
||||||
this.addView(LayoutInflater.from(this.getContext()).inflate(studio.carbonylgroup.textfieldboxes.R.layout.text_field_boxes_layout, this, false));
|
this.addView(LayoutInflater.from(this.getContext()).inflate(studio.carbonylgroup.textfieldboxes.R.layout.text_field_boxes_layout, this, false));
|
||||||
this.removeView(this.inputText);
|
this.removeView(this.inputText);
|
||||||
|
|
Loading…
Reference in a new issue