Search in sources :

Example 1 with WaypointHelper

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;
}
Also used : WaypointHelper(net.osmand.plus.helpers.WaypointHelper) LocationPointWrapper(net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper) ArrayList(java.util.ArrayList) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) TargetPoint(net.osmand.plus.TargetPointsHelper.TargetPoint) ImageButton(android.widget.ImageButton) Button(android.widget.Button) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Aggregations

View (android.view.View)1 Button (android.widget.Button)1 ImageButton (android.widget.ImageButton)1 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1 ArrayList (java.util.ArrayList)1 TargetPoint (net.osmand.plus.TargetPointsHelper.TargetPoint)1 WaypointHelper (net.osmand.plus.helpers.WaypointHelper)1 LocationPointWrapper (net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper)1