Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-11-08 09:19:47 +01:00
commit af03979854
10 changed files with 83 additions and 84 deletions

View file

@ -89,7 +89,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text="@string/shared_string_navigate" android:text="@string/get_directions"
android:textAppearance="@style/TextAppearance.ListItemTitle"/> android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout> </LinearLayout>

View file

@ -122,39 +122,4 @@
android:textAppearance="@style/TextAppearance.ListItemTitle"/> android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout> </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/bottom_sheet_divider_margin_bottom"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginTop="@dimen/bottom_sheet_divider_margin_top"
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:id="@+id/delete_row"
android:layout_width="match_parent"
android:layout_height="@dimen/bottom_sheet_list_item_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical">
<ImageView
android:id="@+id/delete_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
android:layout_marginStart="@dimen/content_padding"
tools:src="@drawable/ic_action_delete_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/shared_string_delete"
android:textAppearance="@style/TextAppearance.ListItemTitle"/>
</LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 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 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="rename_marker">Rename marker</string>
<string name="tap_on_map_to_hide_interface_descr">A tap on the map toggles the control buttons and widgets.</string> <string name="tap_on_map_to_hide_interface_descr">A tap on the map toggles the control buttons and widgets.</string>
<string name="tap_on_map_to_hide_interface">Full screen mode</string> <string name="tap_on_map_to_hide_interface">Full screen mode</string>
<string name="show_on_top_bar">Show on Top Bar</string> <string name="show_on_top_bar">Show on Top Bar</string>
@ -33,7 +34,7 @@
<string name="context_menu_item_modify_note">Modify OSM note</string> <string name="context_menu_item_modify_note">Modify OSM note</string>
<string name="make_round_trip_descr">Add copy of start point as destination.</string> <string name="make_round_trip_descr">Add copy of start point as destination.</string>
<string name="make_round_trip">Make round trip</string> <string name="make_round_trip">Make round trip</string>
<string name="shared_string_navigate">Navigate</string> <!-- string name="shared_string_navigate">Navigate</string-->
<string name="shared_string_markers">Markers</string> <string name="shared_string_markers">Markers</string>
<string name="coordinates_format">Coordinates format</string> <string name="coordinates_format">Coordinates format</string>
<string name="use_system_keyboard">Use system keyboard</string> <string name="use_system_keyboard">Use system keyboard</string>
@ -2302,7 +2303,7 @@
<string name="voice">Recorded voice</string> <string name="voice">Recorded voice</string>
<string name="voices">Voice prompts</string> <string name="voices">Voice prompts</string>
<string name="no_vector_map_loaded">Vector maps were not loaded</string> <string name="no_vector_map_loaded">Vector maps were not loaded</string>
<string name="map_route_by_gpx">Navigate using GPX</string> <!-- string name="map_route_by_gpx">Navigate using GPX</string-->
<string name="gpx_files_not_found">No GPX files found in the tracks folder</string> <string name="gpx_files_not_found">No GPX files found in the tracks folder</string>
<string name="layer_gpx_layer">GPX track…</string> <string name="layer_gpx_layer">GPX track…</string>
<string name="error_reading_gpx">Error reading GPX data</string> <string name="error_reading_gpx">Error reading GPX data</string>

View file

@ -44,6 +44,7 @@ import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu; import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
import net.osmand.plus.mapcontextmenu.other.ShareMenu; import net.osmand.plus.mapcontextmenu.other.ShareMenu;
import net.osmand.plus.mapmarkers.MapMarkersDialogFragment; import net.osmand.plus.mapmarkers.MapMarkersDialogFragment;
import net.osmand.plus.mapmarkers.RenameMarkerBottomSheetDialogFragment;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.ContextMenuLayer; import net.osmand.plus.views.ContextMenuLayer;
@ -87,6 +88,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
private boolean autoHide; private boolean autoHide;
private int favActionIconId; private int favActionIconId;
private int waypointActionIconId;
private MenuAction searchDoneAction; private MenuAction searchDoneAction;
@ -704,12 +706,27 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
return R.string.shared_string_add_to_favorites; return R.string.shared_string_add_to_favorites;
} }
public int getWaypointActionIconId() {
return waypointActionIconId;
}
public int getWaypointActionStringId() {
if (menuController != null) {
return menuController.getWaypointActionStringId();
}
return settings.USE_MAP_MARKERS.get()
? R.string.shared_string_add_to_map_markers : R.string.context_menu_item_destination_point;
}
protected void acquireIcons() { protected void acquireIcons() {
super.acquireIcons(); super.acquireIcons();
if (menuController != null) { if (menuController != null) {
favActionIconId = menuController.getFavActionIconId(); favActionIconId = menuController.getFavActionIconId();
waypointActionIconId = menuController.getWaypointActionIconId();
} else { } else {
favActionIconId = R.drawable.map_action_fav_dark; favActionIconId = R.drawable.map_action_fav_dark;
waypointActionIconId = settings.USE_MAP_MARKERS.get()
? R.drawable.map_action_flag_dark : R.drawable.map_action_waypoint;
} }
} }
@ -745,20 +762,25 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
} }
public void buttonWaypointPressed() { public void buttonWaypointPressed() {
if (pointDescription.isDestination()) { if (object != null && object instanceof MapMarker) {
mapActivity.getMapActions().editWaypoints(); RenameMarkerBottomSheetDialogFragment
} else if (settings.USE_MAP_MARKERS.get()) { .showInstance(mapActivity.getSupportFragmentManager(), (MapMarker) object);
if (pointDescription.isMapMarker()) {
hide();
MapActivity.clearPrevActivityIntent();
MapMarkersDialogFragment.showInstance(mapActivity);
} else {
mapActivity.getMapActions().addMapMarker(latLon.getLatitude(), latLon.getLongitude(),
getPointDescriptionForMarker());
}
} else { } else {
mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(), if (pointDescription.isDestination()) {
getPointDescriptionForTarget()); mapActivity.getMapActions().editWaypoints();
} else if (settings.USE_MAP_MARKERS.get()) {
if (pointDescription.isMapMarker()) {
hide();
MapActivity.clearPrevActivityIntent();
MapMarkersDialogFragment.showInstance(mapActivity);
} else {
mapActivity.getMapActions().addMapMarker(latLon.getLatitude(), latLon.getLongitude(),
getPointDescriptionForMarker());
}
} else {
mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(),
getPointDescriptionForTarget());
}
} }
close(); close();
} }

View file

@ -455,15 +455,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}); });
final ImageButton buttonWaypoint = (ImageButton) view.findViewById(R.id.context_menu_route_button); final ImageButton buttonWaypoint = (ImageButton) view.findViewById(R.id.context_menu_route_button);
if (getMyApplication().getSettings().USE_MAP_MARKERS.get()) { buttonWaypoint.setImageDrawable(getIcon(menu.getWaypointActionIconId(),
buttonWaypoint.setImageDrawable(getIcon(R.drawable.map_action_flag_dark, !nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark)); buttonWaypoint.setContentDescription(getString(menu.getWaypointActionStringId()));
buttonWaypoint.setContentDescription(getString(R.string.shared_string_add_to_map_markers));
} else {
buttonWaypoint.setImageDrawable(getIcon(R.drawable.map_action_waypoint,
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
buttonWaypoint.setContentDescription(getString(R.string.context_menu_item_destination_point));
}
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonWaypoint, nightMode); AndroidUtils.setDashButtonBackground(getMapActivity(), buttonWaypoint, nightMode);
buttonWaypoint.setOnClickListener(new View.OnClickListener() { buttonWaypoint.setOnClickListener(new View.OnClickListener() {
@Override @Override

View file

@ -411,6 +411,16 @@ public abstract class MenuController extends BaseMenuController {
return R.string.shared_string_add_to_favorites; return R.string.shared_string_add_to_favorites;
} }
public int getWaypointActionIconId() {
return getMapActivity().getMyApplication().getSettings().USE_MAP_MARKERS.get()
? R.drawable.map_action_flag_dark : R.drawable.map_action_waypoint;
}
public int getWaypointActionStringId() {
return getMapActivity().getMyApplication().getSettings().USE_MAP_MARKERS.get()
? R.string.shared_string_add_to_map_markers : R.string.context_menu_item_destination_point;
}
public String getTypeStr() { public String getTypeStr() {
return ""; return "";
} }

View file

@ -94,4 +94,14 @@ public class MapMarkerMenuController extends MenuController {
public boolean needStreetName() { public boolean needStreetName() {
return !needTypeStr(); return !needTypeStr();
} }
@Override
public int getWaypointActionIconId() {
return R.drawable.map_action_edit_dark;
}
@Override
public int getWaypointActionStringId() {
return R.string.rename_marker;
}
} }

View file

@ -55,6 +55,10 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi
} }
ListView listView = (ListView) view.findViewById(R.id.list); ListView listView = (ListView) view.findViewById(R.id.list);
if (menu.isLandscapeLayout() && Build.VERSION.SDK_INT >= 21) {
AndroidUtils.addStatusBarPadding21v(getActivity(), listView);
listView.setClipToPadding(false);
}
listAdapter = createAdapter(); listAdapter = createAdapter();
listView.setAdapter(listAdapter); listView.setAdapter(listAdapter);
listView.setOnItemClickListener(this); listView.setOnItemClickListener(this);

View file

@ -82,7 +82,6 @@ public class MarkerMenuOnMapFragment extends BaseOsmAndFragment implements OsmAn
((ImageView) mainView.findViewById(R.id.marker_icon)) ((ImageView) mainView.findViewById(R.id.marker_icon))
.setImageDrawable(getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(marker.colorIndex))); .setImageDrawable(getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(marker.colorIndex)));
((ImageView) mainView.findViewById(R.id.rename_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_edit_dark)); ((ImageView) mainView.findViewById(R.id.rename_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_edit_dark));
((ImageView) mainView.findViewById(R.id.delete_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_delete_dark));
((TextView) mainView.findViewById(R.id.marker_title)).setText(marker.getName(getActivity())); ((TextView) mainView.findViewById(R.id.marker_title)).setText(marker.getName(getActivity()));
@ -135,33 +134,11 @@ public class MarkerMenuOnMapFragment extends BaseOsmAndFragment implements OsmAn
public void onClick(View view) { public void onClick(View view) {
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null) { if (mapActivity != null) {
RenameMarkerBottomSheetDialogFragment fragment = new RenameMarkerBottomSheetDialogFragment(); RenameMarkerBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager(), marker);
fragment.setMarker(marker);
fragment.setRetainInstance(true);
fragment.show(mapActivity.getSupportFragmentManager(), RenameMarkerBottomSheetDialogFragment.TAG);
} }
} }
}); });
mainView.findViewById(R.id.delete_row).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
app.getMapMarkersHelper().removeMarker(marker);
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
Snackbar.make(mapActivity.findViewById(R.id.bottomFragmentContainer), R.string.item_removed, Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
@Override
public void onClick(View view) {
app.getMapMarkersHelper().addMarker(marker);
}
})
.show();
}
dismiss();
}
});
mainView.findViewById(R.id.back_row).setOnClickListener(new View.OnClickListener() { mainView.findViewById(R.id.back_row).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {

View file

@ -7,6 +7,7 @@ import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -58,6 +59,9 @@ public class RenameMarkerBottomSheetDialogFragment extends BottomSheetDialogFrag
} }
final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text); final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text);
if (nightMode) {
nameEditText.setTextColor(ContextCompat.getColor(mapActivity, R.color.color_white));
}
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);
@ -162,4 +166,16 @@ public class RenameMarkerBottomSheetDialogFragment extends BottomSheetDialogFrag
} }
super.onDestroyView(); super.onDestroyView();
} }
public static boolean showInstance(FragmentManager fm, MapMarker marker) {
try {
RenameMarkerBottomSheetDialogFragment fragment = new RenameMarkerBottomSheetDialogFragment();
fragment.setMarker(marker);
fragment.setRetainInstance(true);
fragment.show(fm, RenameMarkerBottomSheetDialogFragment.TAG);
return true;
} catch (Exception e) {
return false;
}
}
} }