Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-02-27 14:57:20 +01:00
commit 7109330dd1
7 changed files with 138 additions and 41 deletions

View file

@ -72,26 +72,6 @@
</LinearLayout>
<Button
android:id="@+id/removeDestButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:drawableLeft="@drawable/ic_action_delete_dark"
android:drawablePadding="12dp"
android:gravity="left|center_vertical"
android:textColor="?android:textColorPrimary"
style="@style/Widget.AppCompat.Button.Borderless"
android:text="@string/delete_target_point"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<Button
android:id="@+id/findParkingButton"
android:layout_width="match_parent"
@ -107,6 +87,46 @@
style="@style/Widget.AppCompat.Button.Borderless"
android:text="@string/find_parking"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<Button
android:id="@+id/recalcDestButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:drawableLeft="@drawable/ic_action_gdirections_dark"
android:drawablePadding="12dp"
android:gravity="left|center_vertical"
android:textColor="?android:textColorPrimary"
style="@style/Widget.AppCompat.Button.Borderless"
android:text="@string/recalculate_route"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<Button
android:id="@+id/removeDestButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:drawableLeft="@drawable/ic_action_delete_dark"
android:drawablePadding="12dp"
android:gravity="left|center_vertical"
android:textColor="?android:textColorPrimary"
style="@style/Widget.AppCompat.Button.Borderless"
android:text="@string/delete_target_point"/>
</LinearLayout>

View file

@ -72,26 +72,6 @@
</LinearLayout>
<Button
android:id="@+id/removeDestButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:drawableLeft="@drawable/ic_action_delete_dark"
android:drawablePadding="12dp"
android:gravity="left|center_vertical"
android:textColor="?android:textColorPrimary"
style="@style/Widget.AppCompat.Button.Borderless"
android:text="@string/delete_target_point"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<Button
android:id="@+id/findParkingButton"
android:layout_width="match_parent"
@ -107,6 +87,46 @@
style="@style/Widget.AppCompat.Button.Borderless"
android:text="@string/find_parking"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<Button
android:id="@+id/recalcDestButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:drawableLeft="@drawable/ic_action_gdirections_dark"
android:drawablePadding="12dp"
android:gravity="left|center_vertical"
android:textColor="?android:textColorPrimary"
style="@style/Widget.AppCompat.Button.Borderless"
android:text="@string/recalculate_route"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/dashboard_divider"/>
<Button
android:id="@+id/removeDestButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:drawableLeft="@drawable/ic_action_delete_dark"
android:drawablePadding="12dp"
android:gravity="left|center_vertical"
android:textColor="?android:textColorPrimary"
style="@style/Widget.AppCompat.Button.Borderless"
android:text="@string/delete_target_point"/>
</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).
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="recalculate_route">Recalculate route</string>
<string name="donations">Donations</string>
<string name="number_of_recipients">Number of recipients</string>
<string name="osm_user_stat">Edits %1$s, rank %2$s, total edits %3$s</string>

View file

@ -437,6 +437,34 @@ public class MapActivityActions implements DialogProvider {
}
}
public void recalculateRoute(boolean showDialog) {
settings.USE_INTERMEDIATE_POINTS_NAVIGATION.set(true);
OsmandApplication app = mapActivity.getMyApplication();
TargetPointsHelper targets = app.getTargetPointsHelper();
ApplicationMode mode = getRouteMode(null);
app.getSettings().APPLICATION_MODE.set(mode);
app.getRoutingHelper().setAppMode(mode);
app.initVoiceCommandPlayer(mapActivity);
// save application mode controls
settings.FOLLOW_THE_ROUTE.set(false);
app.getRoutingHelper().setFollowingMode(false);
app.getRoutingHelper().setRoutePlanningMode(true);
// reset start point
targets.setStartPoint(null, false, null);
// then update start and destination point
targets.updateRouteAndRefresh(true);
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
mapActivity.getMapView().refreshMap(true);
if (showDialog) {
mapActivity.getMapLayers().getMapControlsLayer().showDialog();
}
if (targets.hasTooLongDistanceToNavigate()) {
app.showToastMessage(R.string.route_is_too_long);
}
}
public ApplicationMode getRouteMode(LatLon from) {
ApplicationMode mode = settings.DEFAULT_APPLICATION_MODE.get();
ApplicationMode selected = settings.APPLICATION_MODE.get();

View file

@ -12,8 +12,10 @@ import android.widget.Button;
import android.widget.ImageButton;
import net.osmand.AndroidUtils;
import net.osmand.data.LatLon;
import net.osmand.plus.IconsCache;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.search.SearchActivity;
@ -74,6 +76,27 @@ public class DestinationReachedMenuFragment extends Fragment {
}
});
Button recalcDestButton = (Button) view.findViewById(R.id.recalcDestButton);
recalcDestButton.setCompoundDrawablesWithIntrinsicBounds(
iconsCache.getContentIcon(R.drawable.ic_action_gdirections_dark), null, null, null);
recalcDestButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TargetPointsHelper helper = getMapActivity().getMyApplication().getTargetPointsHelper();
TargetPoint target = helper.getPointToNavigate();
dismissMenu();
if (target != null) {
helper.navigateToPoint(new LatLon(target.getLatitude(), target.getLongitude()),
true, -1, target.getOriginalPointDescription());
getMapActivity().getMapActions().recalculateRoute(false);
getMapActivity().getMapLayers().getMapControlsLayer().startNavigation();
}
}
});
Button findParkingButton = (Button) view.findViewById(R.id.findParkingButton);
findParkingButton.setCompoundDrawablesWithIntrinsicBounds(
iconsCache.getContentIcon(R.drawable.ic_action_parking_dark), null, null, null);
@ -131,6 +154,7 @@ public class DestinationReachedMenuFragment extends Fragment {
}
public void dismissMenu() {
getMapActivity().getMapActions().stopNavigationWithoutConfirm();
getMapActivity().getSupportFragmentManager().popBackStack();
}

View file

@ -426,7 +426,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
}
};
MapMarkerSelectionFragment selectionFragment = new MapMarkerSelectionFragment();
MapMarkerSelectionFragment selectionFragment = MapMarkerSelectionFragment.newInstance();
selectionFragment.setClickListener(click);
selectionFragment.setDismissListener(dismissListener);
selectionFragment.show(mapActivity.getSupportFragmentManager(), MapMarkerSelectionFragment.TAG);

View file

@ -133,6 +133,10 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
}
}
public static MapMarkerSelectionFragment newInstance() {
return new MapMarkerSelectionFragment();
}
public MapActivity getMapActivity() {
Context ctx = getContext();
if (ctx instanceof MapActivity) {