use of net.osmand.plus.helpers.WaypointHelper in project Osmand by osmandapp.
the class DashWaypointsFragment method setupWaypoints.
private void setupWaypoints() {
View mainView = getView();
WaypointHelper wh = getMyApplication().getWaypointHelper();
List<LocationPointWrapper> 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.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) {
dashboard.setDashboardVisibility(true, DashboardType.WAYPOINTS, AndroidUtils.getCenterViewCoordinates(v));
}
});
LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.items);
favorites.removeAllViews();
List<DashLocationView> distances = new ArrayList<DashLocationFragment.DashLocationView>();
for (int i = 0; i < 3 && i < allPoints.size(); i++) {
LocationPointWrapper ps = allPoints.get(i);
View dv = getActivity().getLayoutInflater().inflate(R.layout.divider, null);
favorites.addView(dv);
View v = WaypointDialogHelper.updateWaypointItemView(false, null, getMyApplication(), getActivity(), null, null, ps, null, !getMyApplication().getSettings().isLightContent(), true);
favorites.addView(v);
}
this.distances = distances;
}
Aggregations