Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7643051017
13 changed files with 247 additions and 78 deletions
|
@ -70,7 +70,7 @@ public class BinaryInspector {
|
|||
// "-vrouting",
|
||||
// "-vaddress", "-vcities","-vstreetgroups",
|
||||
// "-vstreets", "-vbuildings", "-vintersections",
|
||||
// "-zoom=16",
|
||||
"-zoom=16",
|
||||
// "-bbox=1.74,51.17,1.75,51.16",
|
||||
"-vstats",
|
||||
"/Users/victorshcherb/osmand/maps/Netherlands_europe_2.obf"
|
||||
|
|
|
@ -1197,6 +1197,7 @@ public class BinaryMapIndexReader {
|
|||
id = codedIS.readSInt64();
|
||||
if(READ_STATS) {
|
||||
req.stat.addTagHeader(OsmandOdb.MapData.ID_FIELD_NUMBER, 0);
|
||||
req.stat.lastObjectHeaderInfo -= 1;
|
||||
req.stat.lastObjectIdSize += CodedOutputStream.computeSInt64SizeNoTag(id);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/search"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/card_bg"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/dashHeaderHeight" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/search_for"
|
||||
style="?attr/dashboardSubHeaderStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="@string/search_for" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/recents"
|
||||
style="?attr/dashboardGeneralButtonStyle"
|
||||
android:text="@string/shared_string_history" />
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/poi"
|
||||
style="?attr/dashboardSearchButtonStyle"
|
||||
android:drawableTop="?attr/ic_action_info2"
|
||||
android:text="@string/poi" />
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/address"
|
||||
style="?attr/dashboardSearchButtonStyle"
|
||||
android:drawableTop="?attr/ic_action_home2"
|
||||
android:text="@string/address" />
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/coord"
|
||||
style="?attr/dashboardSearchButtonStyle"
|
||||
android:drawableTop="?attr/ic_action_marker2"
|
||||
android:text="@string/coordinates" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -103,6 +103,14 @@
|
|||
android:layout_marginLeft="@dimen/dashFavIconMargin"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:src="@drawable/ic_action_gdirections_light" />
|
||||
<ImageButton
|
||||
android:id="@+id/options"
|
||||
android:layout_width="@dimen/dashListItemHeight"
|
||||
android:layout_height="@dimen/dashListItemHeight"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:visibility="gone"
|
||||
android:background="?attr/options_button_background"
|
||||
android:src="?attr/list_settings_icon" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -9,6 +9,8 @@
|
|||
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="waypoint_visit_after">Visit after</string>
|
||||
<string name="waypoint_visit_before">Visit before</string>
|
||||
<string name="simulate_your_location">Simulate your location</string>
|
||||
<string name="drawer">Flat list</string>
|
||||
<string name="short_location_on_map">Lat %1$s\n Lon %2$s</string>
|
||||
|
@ -70,6 +72,7 @@
|
|||
<string name="shared_string_exit">Exit</string>
|
||||
<string name="shared_string_show">Show</string>
|
||||
<string name="shared_string_show_all">Show all</string>
|
||||
<string name="shared_string_collapse">Collapse</string>
|
||||
<string name="shared_string_show_on_map">Show on map</string>
|
||||
<string name="shared_string_map">Map</string>
|
||||
<string name="shared_string_favorite">Favorite</string>
|
||||
|
|
|
@ -94,7 +94,7 @@ public class PointDescription {
|
|||
if (Algorithms.isEmpty(name)) {
|
||||
return typeName;
|
||||
} else {
|
||||
return typeName + ": " + name;
|
||||
return typeName.trim() + ": " + name;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
|
|
|
@ -188,6 +188,13 @@ public class TargetPointsHelper {
|
|||
} else {
|
||||
settings.deleteIntermediatePoint(index);
|
||||
intermediatePoints.remove(index);
|
||||
int ind = 0;
|
||||
for(TargetPoint tp : intermediatePoints) {
|
||||
tp.index = ind++;
|
||||
}
|
||||
if(pointToNavigate != null) {
|
||||
pointToNavigate.index = ind++;
|
||||
}
|
||||
}
|
||||
updateRouteAndReferesh(updateRoute);
|
||||
}
|
||||
|
|
|
@ -689,6 +689,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
public void prepareConfigureMap() {
|
||||
currentDrawer = DrawerType.CONFIGURE_MAP;
|
||||
prepareOptionsMenu(new ConfigureMapMenu().createListAdapter(mapActivity, true));
|
||||
}
|
||||
|
||||
|
@ -873,7 +874,6 @@ public class MapActivityActions implements DialogProvider {
|
|||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
|
||||
currentDrawer = DrawerType.CONFIGURE_MAP;
|
||||
prepareConfigureMap();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -209,9 +209,8 @@ public class SearchActivity extends TabActivity implements OsmAndLocationListene
|
|||
searchAroundCurrentLocation = true;
|
||||
if(loc != null && System.currentTimeMillis() - loc.getTime() < 10000) {
|
||||
updateLocation(loc);
|
||||
} else {
|
||||
startSearchCurrentLocation();
|
||||
}
|
||||
startSearchCurrentLocation();
|
||||
} else {
|
||||
searchAroundCurrentLocation = false;
|
||||
endSearchCurrentLocation();
|
||||
|
|
|
@ -117,6 +117,7 @@ public class DashFavoritesFragment extends DashLocationFragment {
|
|||
distances.add(dv);
|
||||
|
||||
name.setText(point.getName());
|
||||
name.setTypeface(Typeface.DEFAULT, point.isVisible() ? Typeface.NORMAL : Typeface.ITALIC);
|
||||
view.findViewById(R.id.navigate_to).setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.navigate_to).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -126,7 +127,7 @@ public class DashFavoritesFragment extends DashLocationFragment {
|
|||
new PointDescription(PointDescription.POINT_TYPE_FAVORITE, point.getName()));
|
||||
}
|
||||
});
|
||||
label.setTypeface(Typeface.DEFAULT, point.isVisible() ? Typeface.NORMAL : Typeface.ITALIC);
|
||||
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
207
OsmAnd/src/net/osmand/plus/dashboard/DashWaypointsFragment.java
Normal file
207
OsmAnd/src/net/osmand/plus/dashboard/DashWaypointsFragment.java
Normal file
|
@ -0,0 +1,207 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
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.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||
import android.app.Dialog;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Created by Denis on 24.11.2014.
|
||||
*/
|
||||
public class DashWaypointsFragment extends DashLocationFragment {
|
||||
public static final String TAG = "DASH_WAYPOINTS_FRAGMENT";
|
||||
List<TargetPoint> points = new ArrayList<TargetPoint>();
|
||||
private static boolean SHOW_ALL;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
((TextView) view.findViewById(R.id.fav_text)).setTypeface(typeface);
|
||||
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
||||
((TextView) view.findViewById(R.id.fav_text)).setText(getString(R.string.waypoints));
|
||||
|
||||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
SHOW_ALL = !SHOW_ALL;
|
||||
setupTargets();
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpenDash() {
|
||||
setupTargets();
|
||||
}
|
||||
|
||||
public void setupTargets() {
|
||||
View mainView = getView();
|
||||
final TargetPointsHelper helper = getMyApplication().getTargetPointsHelper();
|
||||
if (helper.getPointToNavigate() == null) {
|
||||
(mainView.findViewById(R.id.main_fav)).setVisibility(View.GONE);
|
||||
return;
|
||||
} else {
|
||||
(mainView.findViewById(R.id.main_fav)).setVisibility(View.VISIBLE);
|
||||
}
|
||||
points = SHOW_ALL ? helper.getIntermediatePointsWithTarget() :
|
||||
Collections.singletonList(helper.getPointToNavigate());
|
||||
((Button) mainView.findViewById(R.id.show_all)).setText(SHOW_ALL? getString(R.string.shared_string_collapse) :
|
||||
getString(R.string.shared_string_show_all));
|
||||
((Button) mainView.findViewById(R.id.show_all)).setVisibility(
|
||||
helper.getIntermediatePoints().size() == 0 ? View.INVISIBLE : View.VISIBLE);
|
||||
((TextView) mainView.findViewById(R.id.fav_text)).setText(getString(R.string.waypoints) + " (" +
|
||||
helper.getIntermediatePointsWithTarget().size()+")");
|
||||
LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.items);
|
||||
favorites.removeAllViews();
|
||||
List<DashLocationView> distances = new ArrayList<DashLocationFragment.DashLocationView>();
|
||||
for (final TargetPoint point : points) {
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.favorites_list_item, null, false);
|
||||
TextView name = (TextView) view.findViewById(R.id.favourite_label);
|
||||
TextView label = (TextView) view.findViewById(R.id.distance);
|
||||
ImageView direction = (ImageView) view.findViewById(R.id.direction);
|
||||
direction.setVisibility(View.VISIBLE);
|
||||
label.setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.divider).setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.group_image).setVisibility(View.GONE);
|
||||
|
||||
boolean target = helper.getPointToNavigate() == point;
|
||||
int id = target ? R.drawable.list_destination : R.drawable.list_intermediate;
|
||||
((ImageView) view.findViewById(R.id.favourite_icon)).setImageDrawable(getMyApplication().getIconsCache()
|
||||
.getContentIcon(id));
|
||||
DashLocationView dv = new DashLocationView(direction, label, new LatLon(point.getLatitude(),
|
||||
point.getLongitude()));
|
||||
distances.add(dv);
|
||||
|
||||
name.setText(PointDescription.getSimpleName(point, getActivity()));
|
||||
ImageButton options = ((ImageButton)view.findViewById(R.id.options));
|
||||
options.setVisibility(View.VISIBLE);
|
||||
options.setImageDrawable(getMyApplication().getIconsCache().
|
||||
getContentIcon(R.drawable.ic_overflow_menu_white));
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
selectModel(point, view);
|
||||
}
|
||||
});
|
||||
|
||||
ImageButton navigate = ((ImageButton)view.findViewById(R.id.navigate_to));
|
||||
navigate.setImageDrawable(getMyApplication().getIconsCache().
|
||||
getContentIcon(R.drawable.ic_action_gdirections_dark));
|
||||
navigate.setVisibility(target? View.VISIBLE : View.GONE);
|
||||
navigate.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dashboard.navigationAction();
|
||||
}
|
||||
});
|
||||
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
getMyApplication().getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(),
|
||||
15, point.getPointDescription(getActivity()), false,
|
||||
point); //$NON-NLS-1$
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
});
|
||||
favorites.addView(view);
|
||||
}
|
||||
this.distances = distances;
|
||||
}
|
||||
private void selectModel(final TargetPoint model, View v) {
|
||||
boolean light = ((OsmandApplication) getActivity().getApplication()).getSettings().isLightContent();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||
MenuItem
|
||||
item = optionsMenu.getMenu().add(
|
||||
R.string.shared_string_add_to_favorites).setIcon(light ?
|
||||
R.drawable.ic_action_fav_light : R.drawable.ic_action_fav_dark);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
Bundle args = new Bundle();
|
||||
Dialog dlg = FavoriteDialogs.createAddFavouriteDialog(getActivity(), args);
|
||||
dlg.show();
|
||||
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, args, model.getLatitude(), model.getLongitude(),
|
||||
model.getOriginalPointDescription());
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if(SHOW_ALL && getMyApplication().getTargetPointsHelper().getIntermediatePoints().size() > 0) {
|
||||
final List<TargetPoint> allTargets = getMyApplication().getTargetPointsHelper().getIntermediatePointsWithTarget();
|
||||
boolean target = model == getMyApplication().getTargetPointsHelper().getPointToNavigate();
|
||||
if (model.index > 0 || target) {
|
||||
final int ind = target ? allTargets.size() - 1 : model.index;
|
||||
item = optionsMenu.getMenu().add(R.string.waypoint_visit_before)
|
||||
.setIcon(light ? R.drawable.ic_action_up_light : R.drawable.ic_action_up_dark);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
TargetPoint remove = allTargets.remove(ind - 1);
|
||||
allTargets.add(ind, remove);
|
||||
getMyApplication().getTargetPointsHelper().reorderAllTargetPoints(allTargets, true);
|
||||
setupTargets();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!target) {
|
||||
item = optionsMenu.getMenu().add(R.string.waypoint_visit_after)
|
||||
.setIcon(light ? R.drawable.ic_action_down_light : R.drawable.ic_action_down_dark);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
TargetPoint remove = allTargets.remove(model.index + 1);
|
||||
allTargets.add(model.index, remove);
|
||||
getMyApplication().getTargetPointsHelper().reorderAllTargetPoints(allTargets, true);
|
||||
setupTargets();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
item = optionsMenu.getMenu().add(
|
||||
R.string.shared_string_delete).setIcon(light ?
|
||||
R.drawable.ic_action_gdiscard_light: R.drawable.ic_action_gdiscard_dark);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
getMyApplication().getTargetPointsHelper().removeWayPoint(true, model.index);
|
||||
setupTargets();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
optionsMenu.show();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -264,13 +264,7 @@ public class DashboardOnMap {
|
|||
getMyApplication().getSettings().USE_DASHBOARD_INSTEAD_OF_DRAWER.set(false);
|
||||
mapActivity.getMapActions().toggleDrawer();
|
||||
} else if(item.getItemId() == DIRECTIONS_ID) {
|
||||
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
|
||||
if(!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
||||
mapActivity.getMapActions().enterRoutePlanningMode(null, null, false);
|
||||
} else {
|
||||
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||
mapActivity.refreshMap();
|
||||
}
|
||||
navigationAction();
|
||||
} else if(item.getItemId() == CONFIGURE_SCREEN_ID) {
|
||||
mapActivity.getMapActions().prepareConfigureScreen();
|
||||
mapActivity.getMapActions().toggleDrawer();
|
||||
|
@ -285,6 +279,17 @@ public class DashboardOnMap {
|
|||
}
|
||||
|
||||
|
||||
public void navigationAction() {
|
||||
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
|
||||
if(!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
||||
mapActivity.getMapActions().enterRoutePlanningMode(null, null, false);
|
||||
} else {
|
||||
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||
mapActivity.refreshMap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// To animate view slide out from right to left
|
||||
private void open(View view){
|
||||
TranslateAnimation animate = new TranslateAnimation(-mapActivity.findViewById(R.id.ParentLayout).getWidth(),0,0,0);
|
||||
|
@ -336,6 +341,7 @@ public class DashboardOnMap {
|
|||
FragmentTransaction fragmentTransaction = manager.beginTransaction();
|
||||
showFragment(manager, fragmentTransaction, DashErrorFragment.TAG, DashErrorFragment.class,
|
||||
mapActivity.getMyApplication().getAppInitializer().checkPreviousRunsForExceptions(mapActivity));
|
||||
showFragment(manager, fragmentTransaction, DashWaypointsFragment.TAG, DashWaypointsFragment.class);
|
||||
showFragment(manager, fragmentTransaction, DashSearchFragment.TAG, DashSearchFragment.class);
|
||||
showFragment(manager, fragmentTransaction, DashRecentsFragment.TAG, DashRecentsFragment.class);
|
||||
showFragment(manager, fragmentTransaction, DashFavoritesFragment.TAG, DashFavoritesFragment.class);
|
||||
|
|
|
@ -25,7 +25,8 @@ import java.lang.reflect.Method;
|
|||
|
||||
public class DirectionsDialogs {
|
||||
|
||||
public static void directionsToDialogAndLaunchMap(final Activity act, final double lat, final double lon, final PointDescription name) {
|
||||
public static void directionsToDialogAndLaunchMap(final Activity act, final double lat, final double lon,
|
||||
final PointDescription name) {
|
||||
final OsmandApplication ctx = (OsmandApplication) act.getApplication();
|
||||
final TargetPointsHelper targetPointsHelper = ctx.getTargetPointsHelper();
|
||||
if (targetPointsHelper.getIntermediatePoints().size() > 0) {
|
||||
|
|
Loading…
Reference in a new issue