Exemplo n.º 1
0
 public void refreshContent(boolean force) {
   if (visibleType == DashboardType.WAYPOINTS
       || visibleType == DashboardType.WAYPOINTS_EDIT
       || force) {
     updateListAdapter();
   } else if (visibleType == DashboardType.CONFIGURE_MAP) {
     int index = listView.getFirstVisiblePosition();
     View v = listView.getChildAt(0);
     int top = (v == null) ? 0 : (v.getTop() - listView.getPaddingTop());
     updateListAdapter();
     listView.setSelectionFromTop(index, top);
   } else {
     listAdapter.notifyDataSetChanged();
   }
 }
Exemplo n.º 2
0
 public void refreshContent(boolean force) {
   if (visibleType == DashboardType.WAYPOINTS || force) {
     updateListAdapter();
   } else {
     listAdapter.notifyDataSetChanged();
   }
 }
Exemplo n.º 3
0
  private void updateListAdapter() {
    ContextMenuAdapter cm = null;
    if (DashboardType.WAYPOINTS == visibleType || DashboardType.WAYPOINTS_FLAT == visibleType) {
      ArrayAdapter<Object> listAdapter =
          waypointDialogHelper.getWaypointsDrawerAdapter(
              false,
              deletedPoints,
              mapActivity,
              running,
              DashboardType.WAYPOINTS_FLAT == visibleType);
      OnItemClickListener listener =
          waypointDialogHelper.getDrawerItemClickListener(mapActivity, running, listAdapter);
      updateListAdapter(listAdapter, listener);
    } else if (DashboardType.WAYPOINTS_EDIT == visibleType) {
      deletedPoints.clear();
      ArrayAdapter<Object> listAdapter =
          waypointDialogHelper.getWaypointsDrawerAdapter(
              true,
              deletedPoints,
              mapActivity,
              running,
              DashboardType.WAYPOINTS_FLAT == visibleType);
      OnItemClickListener listener =
          waypointDialogHelper.getDrawerItemClickListener(mapActivity, running, listAdapter);
      updateListAdapter(listAdapter, listener);

    } else {
      if (DashboardType.CONFIGURE_SCREEN == visibleType) {
        cm =
            mapActivity
                .getMapLayers()
                .getMapWidgetRegistry()
                .getViewConfigureMenuAdapter(mapActivity);
      } else if (DashboardType.CONFIGURE_MAP == visibleType) {
        cm = new ConfigureMapMenu().createListAdapter(mapActivity);
      } else if (DashboardType.LIST_MENU == visibleType) {
        cm = mapActivity.getMapActions().createMainOptionsMenu();
      }
      if (cm != null) {
        updateListAdapter(cm);
      }
    }
  }
Exemplo n.º 4
0
 public void updateListAdapter(ContextMenuAdapter cm) {
   final ArrayAdapter<?> listAdapter =
       cm.createListAdapter(mapActivity, getMyApplication().getSettings().isLightContent());
   OnItemClickListener listener = getOptionsMenuOnClickListener(cm, listAdapter);
   updateListAdapter(listAdapter, listener);
 }
Exemplo n.º 5
0
  public void setDashboardVisibility(
      boolean visible, DashboardType type, DashboardType prevItem, boolean animation) {
    if (visible == this.visible && type == visibleType) {
      return;
    }
    this.previousVisibleType = prevItem;
    this.visible = visible;
    boolean refresh = this.visibleType == type;
    this.visibleType = type;
    DashboardOnMap.staticVisible = visible;
    DashboardOnMap.staticVisibleType = type;
    mapActivity.enableDrawer();
    if (visible) {
      mapViewLocation = mapActivity.getMapLocation();
      mapRotation = mapActivity.getMapRotate();
      mapLinkedToLocation = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
      myLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
      mapActivity.getMapViewTrackingUtilities().setDashboard(this);
      mapActivity.disableDrawer();
      dashboardView.setVisibility(View.VISIBLE);
      if (isActionButtonVisible()) {
        actionButton.setVisibility(View.VISIBLE);
      } else {
        hideActionButton();
      }
      updateDownloadBtn();
      View listViewLayout = dashboardView.findViewById(R.id.dash_list_view_layout);
      ScrollView scrollView = (ScrollView) dashboardView.findViewById(R.id.main_scroll);
      if (visibleType == DashboardType.DASHBOARD) {
        addOrUpdateDashboardFragments();
        scrollView.setVisibility(View.VISIBLE);
        scrollView.scrollTo(0, 0);
        listViewLayout.setVisibility(View.GONE);
        onScrollChanged(scrollView.getScrollY(), false, false);
      } else {
        scrollView.setVisibility(View.GONE);
        listViewLayout.setVisibility(View.VISIBLE);
        if (listView instanceof ObservableListView) {
          onScrollChanged(listView.getScrollY(), false, false);
        }
        if (refresh) {
          refreshContent(false);
        } else {
          updateListAdapter();
          updateListBackgroundHeight();
        }
      }
      mapActivity
          .findViewById(R.id.toolbar_back)
          .setVisibility(isBackButtonVisible() ? View.VISIBLE : View.GONE);
      mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);

      updateToolbarActions();
      // fabButton.showFloatingActionButton();
      open(dashboardView.findViewById(R.id.animateContent), animation);
      updateLocation(true, true, false);
      //			addOrUpdateDashboardFragments();
    } else {
      mapActivity.getMapViewTrackingUtilities().setDashboard(null);
      hide(dashboardView.findViewById(R.id.animateContent), animation);
      mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.VISIBLE);
      hideActionButton();
      for (WeakReference<DashBaseFragment> df : fragList) {
        if (df.get() != null) {
          df.get().onCloseDash();
        }
      }
    }
  }