From b1535477af7ce998f0c121d7d2c05c131e37abdc Mon Sep 17 00:00:00 2001 From: crimean Date: Fri, 15 Feb 2019 10:01:49 +0300 Subject: [PATCH] Show target points in dashboard waypoints fragment --- .../plus/dashboard/DashWaypointsFragment.java | 53 +------------------ 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashWaypointsFragment.java b/OsmAnd/src/net/osmand/plus/dashboard/DashWaypointsFragment.java index 551e0c4529..6bd94bafd2 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashWaypointsFragment.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashWaypointsFragment.java @@ -3,7 +3,6 @@ package net.osmand.plus.dashboard; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.Nullable; -import android.support.v4.app.FragmentActivity; import android.support.v7.app.AlertDialog; import android.support.v7.widget.PopupMenu; import android.view.LayoutInflater; @@ -24,10 +23,6 @@ import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.dashboard.tools.DashFragmentData; import net.osmand.plus.dialogs.DirectionsDialogs; -import net.osmand.plus.helpers.WaypointDialogHelper; -import net.osmand.plus.helpers.WaypointHelper; -import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper; -import net.osmand.plus.routepreparationmenu.WaypointsFragment; import java.util.ArrayList; import java.util.Collections; @@ -62,53 +57,7 @@ public class DashWaypointsFragment extends DashLocationFragment { } public void setupView() { - if(getMyApplication().getWaypointHelper().isRouteCalculated()) { - setupWaypoints(); - } else { - setupTargets(); - } - } - - private void setupWaypoints() { - FragmentActivity activity = getActivity(); - View mainView = getView(); - if (activity != null && mainView != null) { - WaypointHelper wh = getMyApplication().getWaypointHelper(); - List allPoints = wh.getAllPoints(); - if (allPoints.size() == 0) { - (mainView.findViewById(R.id.main_fav)).setVisibility(View.GONE); - return; - } else { - (mainView.findViewById(R.id.main_fav)).setVisibility(View.VISIBLE); - } - ((TextView) mainView.findViewById(R.id.fav_text)).setText(getString(R.string.shared_string_waypoints)); - ((Button) mainView.findViewById(R.id.show_all)).setText(getString(R.string.shared_string_show_all)); - ((Button) mainView.findViewById(R.id.show_all)).setVisibility(View.VISIBLE); - ((Button) mainView.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() { - - @Override - public void onClick(View v) { - FragmentActivity activity = getActivity(); - if (activity instanceof MapActivity) { - dashboard.hideDashboard(); - WaypointsFragment.showInstance((MapActivity) activity); - } - } - }); - LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.items); - favorites.removeAllViews(); - List distances = new ArrayList(); - for (int i = 0; i < 3 && i < allPoints.size(); i++) { - LocationPointWrapper ps = allPoints.get(i); - View dv = activity.getLayoutInflater().inflate(R.layout.divider, null); - favorites.addView(dv); - View v = WaypointDialogHelper.updateWaypointItemView(false, null, getMyApplication(), - activity, null, null, ps, null, !getMyApplication().getSettings().isLightContent(), true); - favorites.addView(v); - - } - this.distances = distances; - } + setupTargets(); } public void setupTargets() {