/** * Open Search View. if animate is true, Animate the showing of the view. * * @param animate */ public void showSearch(boolean animate) { if (isSearchOpen()) { return; } // Request Focus mSearchSrcTextView.setText(null); mSearchSrcTextView.requestFocus(); if (animate) { AnimationUtil.fadeInView( mSearchLayout, AnimationUtil.ANIMATION_DURATION_SHORT, new AnimationUtil.AnimationListener() { @Override public boolean onAnimationStart(View view) { return false; } @Override public boolean onAnimationEnd(View view) { if (mSearchViewListener != null) { mSearchViewListener.onSearchViewShown(); } return false; } @Override public boolean onAnimationCancel(View view) { return false; } }); } else { mSearchLayout.setVisibility(VISIBLE); if (mSearchViewListener != null) { mSearchViewListener.onSearchViewShown(); } } mIsSearchOpen = true; }
/** * Update an existing marker on the map with the current vehicle status * * @param m Marker to update * @param l Location to add the marker at * @param isRealtime true if the marker shown indicate real-time info, false if it should * indicate schedule * @param status real-time status of the vehicle * @param response response containing the provided status */ private void updateMarker( Marker m, Location l, boolean isRealtime, ObaTripStatus status, ObaTripsForRouteResponse response) { boolean showInfo = m.isInfoWindowShown(); m.setIcon(getVehicleIcon(isRealtime, status, response)); // Update Hashmap with newest status - needed to show info when tapping on marker mVehicles.put(m, status); // Update vehicle position Location markerLoc = MapHelpV2.makeLocation(m.getPosition()); // If its a small distance, animate the movement if (l.distanceTo(markerLoc) < MAX_VEHICLE_ANIMATION_DISTANCE) { AnimationUtil.animateMarkerTo(m, MapHelpV2.makeLatLng(l)); } else { // Just snap the marker to the new location - large animations look weird m.setPosition(MapHelpV2.makeLatLng(l)); } // If the info window was shown, make sure its open (changing the icon could have closed it) if (showInfo) { m.showInfoWindow(); } }