Made improvements in Measure Distance and changed colors of RenameMarkerBottomDialogFragment
This commit is contained in:
parent
ff4544f7f3
commit
c69bc751a6
5 changed files with 42 additions and 32 deletions
|
@ -1,6 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<color name="switch_track_color_measure_instruments">#c5d2e6</color>
|
||||
<color name="primary_text_field_boxes_color">#ff8800</color>
|
||||
|
||||
<color name="mapillary_color">#3db878</color>
|
||||
<color name="mapillary_color_pressed">#3a9f73</color>
|
||||
<color name="mapillary_action_bar">#14c45d</color>
|
||||
|
|
|
@ -95,6 +95,10 @@
|
|||
<style name="OsmandLightThemeWithLightStatusBar" parent="OsmandLightTheme">
|
||||
<item name="android:statusBarColor">@color/status_bar_route_light</item>
|
||||
</style>
|
||||
<style name="OsmandDarkTheme.MarkerFragment" >
|
||||
<item name="android:textColorPrimary">@color/primary_text_field_boxes_color</item>
|
||||
<item name="android:textColor">@color/primary_text_field_boxes_color</item>
|
||||
</style>
|
||||
|
||||
<!-- Osmand themes styles -->
|
||||
<style name="OsmandLightTheme" parent="Theme.AppCompat.Light">
|
||||
|
|
|
@ -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,18 @@ 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.OsmandDarkTheme_MarkerFragment);
|
||||
} else if (textBox instanceof OsmandTextFieldBoxes) {
|
||||
((OsmandTextFieldBoxes) textBox).activate(true);
|
||||
((OsmandTextFieldBoxes) textBox).setPrimaryColor(getResources().getColor(R.color.primary_text_field_boxes_color));
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
@ -1113,7 +1113,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
nameEt.setSelection(displayedName.length());
|
||||
final boolean[] textChanged = new boolean[1];
|
||||
|
||||
AlertDialog.Builder builder=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() {
|
||||
|
@ -1135,8 +1135,8 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
})
|
||||
.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
final AlertDialog dialog=builder.create();
|
||||
dialog.show();
|
||||
final AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
|
||||
nameEt.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
|
@ -1152,23 +1152,20 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
if (new File(dir, editable.toString() + GPX_SUFFIX).exists()) {
|
||||
fileExistsTv.setVisibility(View.VISIBLE);
|
||||
fileExistsTv.setText(R.string.file_with_name_already_exists);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE)
|
||||
.setEnabled(true);
|
||||
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()) {
|
||||
fileExistsTv.setVisibility(View.VISIBLE);
|
||||
fileExistsTv.setText(R.string.enter_the_file_name);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE)
|
||||
.setEnabled(false);
|
||||
warningTextView.setVisibility(View.VISIBLE);
|
||||
warningTextView.setText(R.string.enter_the_file_name);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
|
||||
|
||||
} else {
|
||||
fileExistsTv.setVisibility(View.INVISIBLE);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE)
|
||||
.setEnabled(true);
|
||||
warningTextView.setVisibility(View.INVISIBLE);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
|
||||
}
|
||||
textChanged[0] = true;
|
||||
textChanged[0] = true;
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -1184,13 +1181,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,7 +1,5 @@
|
|||
package net.osmand.plus.views.mapwidgets;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
|
@ -420,7 +418,7 @@ public class MapInfoWidgetsFactory {
|
|||
view.updateVisibility(switchCompat, topBarSwitchVisible);
|
||||
if (topBarSwitchVisible) {
|
||||
switchCompat.setChecked(topBarSwitchChecked);
|
||||
view.setTopBarBackgroundColor(switchCompat,topBarSwitchChecked);
|
||||
view.setTopBarSwitchTrackColor(switchCompat, topBarSwitchChecked);
|
||||
|
||||
}
|
||||
if (view.getShadowView() != null) {
|
||||
|
@ -570,13 +568,14 @@ public class MapInfoWidgetsFactory {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
public void setTopBarBackgroundColor(View v,boolean active ) {
|
||||
SwitchCompat switchCompat=(SwitchCompat)v;
|
||||
if(active){
|
||||
|
||||
DrawableCompat.setTint(switchCompat.getTrackDrawable(),Color.parseColor("#c5d2e6"));
|
||||
public void setTopBarSwitchTrackColor(View v, boolean active) {
|
||||
SwitchCompat switchCompat = (SwitchCompat) v;
|
||||
if (active) {
|
||||
DrawableCompat.setTint(switchCompat.getTrackDrawable(), map.getResources().getColor(R.color.switch_track_color_measure_instruments));
|
||||
}
|
||||
}
|
||||
|
||||
private void initToolbar(TopToolbarController controller) {
|
||||
backButton.setOnClickListener(controller.onBackButtonClickListener);
|
||||
topBarTitleLayout.setOnClickListener(controller.onTitleClickListener);
|
||||
|
|
Loading…
Reference in a new issue