Merge pull request #5020 from osmandapp/MeasureDistanceImprovements
Made improvements in Measure Distance
This commit is contained in:
commit
077d24465b
7 changed files with 70 additions and 36 deletions
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<color name="map_toolbar_switch_track_color">#c5d2e6</color>
|
||||
<color name="mapillary_color">#3db878</color>
|
||||
<color name="mapillary_color_pressed">#3a9f73</color>
|
||||
<color name="mapillary_action_bar">#14c45d</color>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
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="enter_the_file_name">Enter the file name.</string>
|
||||
<string name="map_import_error">Map import error</string>
|
||||
<string name="map_imported_successfully">Map imported successfully</string>
|
||||
<string name="make_as_start_point">Make as Start Point</string>
|
||||
|
|
|
@ -96,6 +96,10 @@
|
|||
<item name="android:statusBarColor">@color/status_bar_route_light</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.App.DarkTextInputLayout" parent="@android:style/TextAppearance">
|
||||
<item name="android:textColor">@color/color_dialog_buttons_dark</item>
|
||||
</style>
|
||||
|
||||
<!-- Osmand themes styles -->
|
||||
<style name="OsmandLightTheme" parent="Theme.AppCompat.Light">
|
||||
<item name="android:statusBarColor">@color/status_bar_light</item>
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.Context;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.ContextThemeWrapper;
|
||||
|
@ -52,7 +53,7 @@ public class RenameMarkerBottomSheetDialogFragment extends BottomSheetDialogFrag
|
|||
? R.layout.markers_track_name_text_field_box
|
||||
: R.layout.markers_track_name_edit_text;
|
||||
contentLayout.addView(getLayoutInflater().inflate(layoutRes, contentLayout, false), 1);
|
||||
|
||||
View textBox = mainView.findViewById(R.id.name_text_box);
|
||||
if (portrait) {
|
||||
AndroidUtils.setBackground(getActivity(), mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||
}
|
||||
|
@ -60,12 +61,17 @@ public class RenameMarkerBottomSheetDialogFragment extends BottomSheetDialogFrag
|
|||
final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text);
|
||||
if (nightMode) {
|
||||
nameEditText.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_white));
|
||||
if (textBox instanceof TextInputLayout) {
|
||||
((TextInputLayout) textBox).setHintTextAppearance(R.style.TextAppearance_App_DarkTextInputLayout);
|
||||
} else if (textBox instanceof OsmandTextFieldBoxes) {
|
||||
((OsmandTextFieldBoxes) textBox).setPrimaryColor(ContextCompat.getColor(mapActivity,R.color.color_dialog_buttons_dark));
|
||||
}
|
||||
}
|
||||
nameEditText.setText(marker.getName(mapActivity));
|
||||
nameEditText.requestFocus();
|
||||
final InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_IMPLICIT_ONLY);
|
||||
View textBox = mainView.findViewById(R.id.name_text_box);
|
||||
|
||||
if (textBox instanceof OsmandTextFieldBoxes) {
|
||||
((OsmandTextFieldBoxes) textBox).activate(true);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package net.osmand.plus.mapmarkers;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.Gravity;
|
||||
|
@ -59,6 +61,14 @@ public class SaveAsTrackBottomSheetDialogFragment extends BottomSheetDialogFragm
|
|||
if (portrait) {
|
||||
AndroidUtils.setBackground(getActivity(), mainView, nightMode, R.drawable.bg_bottom_menu_light, R.drawable.bg_bottom_menu_dark);
|
||||
}
|
||||
View textBox = mainView.findViewById(R.id.name_text_box);
|
||||
if (nightMode) {
|
||||
if (textBox instanceof TextInputLayout) {
|
||||
((TextInputLayout) textBox).setHintTextAppearance(R.style.TextAppearance_App_DarkTextInputLayout);
|
||||
} else if (textBox instanceof OsmandTextFieldBoxes) {
|
||||
((OsmandTextFieldBoxes) textBox).setPrimaryColor(ContextCompat.getColor(mapActivity, R.color.color_dialog_buttons_dark));
|
||||
}
|
||||
}
|
||||
|
||||
final File dir = mapActivity.getMyApplication().getAppPath(IndexConstants.GPX_INDEX_DIR + "/map markers");
|
||||
if (!dir.exists()) {
|
||||
|
@ -75,7 +85,6 @@ public class SaveAsTrackBottomSheetDialogFragment extends BottomSheetDialogFragm
|
|||
}
|
||||
final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text);
|
||||
nameEditText.setText(displayedName);
|
||||
View textBox = mainView.findViewById(R.id.name_text_box);
|
||||
if (textBox instanceof OsmandTextFieldBoxes) {
|
||||
((OsmandTextFieldBoxes) textBox).activate(true);
|
||||
}
|
||||
|
|
|
@ -1097,7 +1097,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
final LayoutInflater inflater = mapActivity.getLayoutInflater();
|
||||
final View view = inflater.inflate(R.layout.save_gpx_dialog, null);
|
||||
final EditText nameEt = (EditText) view.findViewById(R.id.gpx_name_et);
|
||||
final TextView fileExistsTv = (TextView) view.findViewById(R.id.file_exists_text_view);
|
||||
final TextView warningTextView = (TextView) view.findViewById(R.id.file_exists_text_view);
|
||||
final SwitchCompat showOnMapToggle = (SwitchCompat) view.findViewById(R.id.toggle_show_on_map);
|
||||
showOnMapToggle.setChecked(true);
|
||||
|
||||
|
@ -1111,31 +1111,9 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
nameEt.setText(displayedName);
|
||||
nameEt.setSelection(displayedName.length());
|
||||
|
||||
final boolean[] textChanged = new boolean[1];
|
||||
nameEt.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
if (new File(dir, editable.toString() + GPX_SUFFIX).exists()) {
|
||||
fileExistsTv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
fileExistsTv.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
textChanged[0] = true;
|
||||
}
|
||||
});
|
||||
|
||||
new AlertDialog.Builder(mapActivity)
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity)
|
||||
.setTitle(R.string.enter_gpx_name)
|
||||
.setView(view)
|
||||
.setPositiveButton(R.string.shared_string_save, new DialogInterface.OnClickListener() {
|
||||
|
@ -1154,8 +1132,38 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
saveNewGpx(dir, fileName, showOnMapToggle.isChecked(), saveType, false);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.shared_string_cancel, null)
|
||||
.show();
|
||||
.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
final AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
|
||||
nameEt.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
if (new File(dir, editable.toString() + GPX_SUFFIX).exists()) {
|
||||
warningTextView.setVisibility(View.VISIBLE);
|
||||
warningTextView.setText(R.string.file_with_name_already_exists);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
|
||||
} else if (editable.toString().trim().isEmpty()) {
|
||||
warningTextView.setVisibility(View.VISIBLE);
|
||||
warningTextView.setText(R.string.enter_the_file_name);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||
} else {
|
||||
warningTextView.setVisibility(View.INVISIBLE);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
|
||||
}
|
||||
textChanged[0] = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1168,13 +1176,13 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
private void saveGpx(final File dir,
|
||||
final String fileName,
|
||||
final boolean showOnMap,
|
||||
final GPXFile gpx,
|
||||
final boolean openTrackActivity,
|
||||
final NewGpxData.ActionType actionType,
|
||||
final SaveType saveType,
|
||||
final boolean close) {
|
||||
final String fileName,
|
||||
final boolean showOnMap,
|
||||
final GPXFile gpx,
|
||||
final boolean openTrackActivity,
|
||||
final NewGpxData.ActionType actionType,
|
||||
final SaveType saveType,
|
||||
final boolean close) {
|
||||
|
||||
new AsyncTask<Void, Void, String>() {
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package net.osmand.plus.views.mapwidgets;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -417,6 +419,9 @@ public class MapInfoWidgetsFactory {
|
|||
view.updateVisibility(switchCompat, topBarSwitchVisible);
|
||||
if (topBarSwitchVisible) {
|
||||
switchCompat.setChecked(topBarSwitchChecked);
|
||||
if (topBarSwitchChecked) {
|
||||
DrawableCompat.setTint(switchCompat.getTrackDrawable(), ContextCompat.getColor(switchCompat.getContext(),R.color.map_toolbar_switch_track_color));
|
||||
}
|
||||
}
|
||||
if (view.getShadowView() != null) {
|
||||
view.getShadowView().setVisibility(View.VISIBLE);
|
||||
|
|
Loading…
Reference in a new issue