private void setUpMap() {
    verifyLocationPermission();

    mMap.setOnMapClickListener(this);
    mMap.setOnInfoWindowClickListener(this);

    UiSettings settings = mMap.getUiSettings();
    settings.setAllGesturesEnabled(true);
    settings.setMapToolbarEnabled(false);

    // Use stops location if present, otherwise set a geo point in
    // central Stockholm.
    LatLng latLng;
    int zoom;
    if (mStop.getLocation() != null) {
      latLng = new LatLng(mStop.getLocation().getLatitude(), mStop.getLocation().getLongitude());
      zoom = 16;
    } else {
      latLng = new LatLng(59.325309, 18.069763);
      zoom = 12;
    }

    mMarker =
        mMap.addMarker(
            new MarkerOptions()
                .position(latLng)
                .title(getString(R.string.tap_to_select_this_point))
                .visible(true)
                .draggable(true)
                .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
    mMarker.showInfoWindow();

    mMap.moveCamera(
        CameraUpdateFactory.newCameraPosition(CameraPosition.fromLatLngZoom(latLng, zoom)));
  }
 @Override
 public boolean equals(final Object other) {
   return other != null
       && (other == this
           || other instanceof GoogleCameraPositionDelegate
               && cameraPosition.equals(((GoogleCameraPositionDelegate) other).cameraPosition));
 }
 public static GoogleMapOptions a(Location paramLocation)
 {
   CameraPosition localCameraPosition = null;
   if (paramLocation != null) {
     localCameraPosition = CameraPosition.b().a(new LatLng(paramLocation.getLatitude(), paramLocation.getLongitude())).a(16.0F).a();
   }
   return b(localCameraPosition);
 }
Пример #4
0
  /** adding lines */
  private void addLines() {

    googleMap.addPolyline(
        (new PolylineOptions()).addAll(coordinates).width(5).color(Color.BLUE).geodesic(true));
    CameraPosition mCameraPosition =
        CameraPosition.builder().target(COPPER).zoom(14).bearing(90).build();
    // Animate the change in camera view over 2 seconds
    googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(mCameraPosition), 2000, null);
  }
Пример #5
0
 static void a(CameraPosition cameraPosition, Parcel parcel, int n) {
   int n2 = b.D(parcel);
   b.c(parcel, 1, cameraPosition.getVersionCode());
   b.a(parcel, 2, cameraPosition.target, n, false);
   b.a(parcel, 3, cameraPosition.zoom);
   b.a(parcel, 4, cameraPosition.tilt);
   b.a(parcel, 5, cameraPosition.bearing);
   b.H(parcel, n2);
 }
 public Builder(@NonNull final OPFCameraPosition cameraPosition) {
   this.delegate =
       CameraPosition.builder(
           new CameraPosition(
               new LatLng(
                   cameraPosition.getTarget().getLat(), cameraPosition.getTarget().getLng()),
               cameraPosition.getZoom(),
               cameraPosition.getTilt(),
               cameraPosition.getBearing()));
 }
 public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
 {
   ViewGroup localViewGroup = (ViewGroup)super.onCreateView(paramLayoutInflater, paramViewGroup, paramBundle);
   paramLayoutInflater.inflate(2130903548, localViewGroup);
   c(localViewGroup);
   paramLayoutInflater = (TextView)localViewGroup.findViewById(2131690940);
   paramViewGroup = getArguments().getString("business_name");
   b = ((Address)getArguments().getParcelable("address"));
   Address localAddress = c.c();
   if (localAddress != null) {
     b = localAddress;
   }
   if (TextUtils.isEmpty(paramViewGroup)) {}
   for (int i = 2131166373;; i = 2131166372)
   {
     paramLayoutInflater.setText(StringUtils.a(getActivity(), i, new Object[] { paramViewGroup, a.a(", ", b) }));
     paramViewGroup = YelpMap.a(AppData.b().r().c());
     paramLayoutInflater = paramViewGroup;
     if (b.hasLatitude())
     {
       paramLayoutInflater = paramViewGroup;
       if (b.hasLongitude()) {
         paramLayoutInflater = YelpMap.b(CameraPosition.b().a(new LatLng(b.getLatitude(), b.getLongitude())).a());
       }
     }
     CameraPosition.b();
     if (paramLayoutInflater.n() != null) {
       paramLayoutInflater.a(CameraPosition.a(paramLayoutInflater.n()).a(19.0F).a());
     }
     a.setOptions(paramLayoutInflater);
     a.a(paramBundle, null);
     g();
     paramLayoutInflater = (ImageView)a.findViewById(2131689600);
     paramViewGroup = getResources().getDrawable(2130838392);
     paramLayoutInflater.setImageDrawable(paramViewGroup);
     paramLayoutInflater.setPadding(0, 0, 0, paramViewGroup.getIntrinsicHeight());
     return localViewGroup;
   }
 }
Пример #8
0
public class MainActivity extends AppCompatActivity implements OnMapReadyCallback {
  // Variables
  GoogleMap m_map;
  boolean mapReady = false;
  LatLng renton = new LatLng(47.489805, -122.120502);
  LatLng kirkland = new LatLng(47.7301986, -122.1768858);
  LatLng everett = new LatLng(47.978748, -122.202001);
  LatLng lynnwood = new LatLng(47.819533, -122.32288);
  LatLng montlake = new LatLng(47.7973733, -122.3281771);
  LatLng kent = new LatLng(47.385938, -122.258212);
  LatLng showare = new LatLng(47.38702, -122.23986);

  // Default Camera position for start a program
  static final CameraPosition SEATTLE =
      CameraPosition.builder()
          .target(new LatLng(47.6204, -122.2491))
          .zoom(9)
          .bearing(0)
          .tilt(45)
          .build();

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
  }

  @Override
  public void onMapReady(GoogleMap googleMap) {
    googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(SEATTLE));
    googleMap.addCircle(
        new CircleOptions()
            .center(renton)
            .radius(5000)
            .strokeColor(Color.GREEN)
            .fillColor(Color.argb(64, 0, 255, 0)));

    googleMap.addPolyline(
        new PolylineOptions()
            .geodesic(true)
            .add(renton)
            .add(kirkland)
            .add(everett)
            .add(montlake)
            .add(kent)
            .add(showare)
            .add(renton));
  }
}
 public GoogleCameraPositionDelegate(@NonNull final OPFLatLng target, final float zoom) {
   this.cameraPosition =
       CameraPosition.fromLatLngZoom(new LatLng(target.getLat(), target.getLng()), zoom);
 }
 public GoogleCameraPositionDelegate(
     @NonNull final Context context, @NonNull final AttributeSet attrs) {
   this.cameraPosition = CameraPosition.createFromAttributes(context, attrs);
 }
 public Builder() {
   this.delegate = CameraPosition.builder();
 }
 @Override
 public int describeContents() {
   return cameraPosition.describeContents();
 }
 @Override
 public int hashCode() {
   return cameraPosition.hashCode();
 }
 @Override
 public String toString() {
   return cameraPosition.toString();
 }
 private void a(LatLng paramLatLng)
 {
   paramLatLng = CameraPosition.b().a(paramLatLng).a(19.0F).a();
   a.a(paramLatLng, null);
 }
Пример #16
0
 @Override
 public void onCameraChange(CameraPosition cameraPosition) {
   mCameraTextView.setText(cameraPosition.toString());
 }