RouteViewHolder(View itemView, List<RouteModel> routesCV, Context context) { super(itemView); Typeface gidole = Typeface.createFromAsset(itemView.getContext().getAssets(), "fonts/Gidole_Regular.ttf"); mContext = context; this.routesCV = routesCV; cv = (CardView) itemView.findViewById(R.id.cv); destination = (TextView) itemView.findViewById(R.id.destinationCV); startingPoint = (TextView) itemView.findViewById(R.id.startingPointCV); startingDateAndTime = (TextView) itemView.findViewById(R.id.textDateAndTimeCV); destination.setTypeface(gidole); startingPoint.setTypeface(gidole); startingDateAndTime.setTypeface(gidole); map = (MapView) itemView.findViewById(R.id.map_view); linearlayout = (LinearLayout) itemView.findViewById(R.id.linearlayout); itemView.setOnClickListener(this); map.onCreate(null); map.onResume(); map.getMapAsync(this); }
public AccidentViewHolder(final View itemView) { super(itemView); final Context context = itemView.getContext(); mPadding = context.getResources().getDimensionPixelSize(R.dimen.content_inset_material); mMapView = (MapView) itemView.findViewById(R.id.map_view); final int gmsState = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context); if (gmsState == ConnectionResult.SUCCESS) { mMapView.onCreate(null); } // Gets to GoogleMap from the MapView and does initialization stuff mGoogleMap = mMapView.getMap(); mGoogleMap.setMyLocationEnabled(false); mGoogleMap.setOnMapLoadedCallback(this); final UiSettings uiSettings = mGoogleMap.getUiSettings(); uiSettings.setMyLocationButtonEnabled(false); uiSettings.setAllGesturesEnabled(false); uiSettings.setZoomControlsEnabled(false); // Needs to call MapsInitializer before doing any CameraUpdateFactory calls try { MapsInitializer.initialize(context); } catch (final Exception e) { Log.e(LOG_TAG, "Failed to initialize Google Maps. ", e); } mTimeView = (TextView) itemView.findViewById(R.id.time); mMaxSpeedView = (TextView) itemView.findViewById(R.id.max_speed); }
public CameraPosition getCurrentCamera() { if (b.getMap() != null) { return b.getMap().a(); } return null; }
/** * Called in a situation of low memory. Lets the map handle this situation. * * @see android.support.v4.app.Fragment#onLowMemory() */ @Override public void onLowMemory() { super.onLowMemory(); if (mapView != null) { mapView.onResume(); mapView.onLowMemory(); } }
/** * Called when the fragment is destroyed. Finishes the map. * * @see android.support.v4.app.Fragment#onDestroy() */ @Override public void onDestroy() { super.onDestroy(); if (map != null) map.setMyLocationEnabled(false); if (mapView != null) { mapView.onResume(); mapView.onDestroy(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); mv = (MapView) findViewById(R.id.mapView); mv.onCreate(savedInstanceState); map = mv.getMap(); init(); initDemoPoint(); }
@Override protected void onDestroy() { if (mListAdapter != null) { for (MapView m : mListAdapter.getMapViews()) { m.onDestroy(); } } super.onDestroy(); }
@Override public void onLowMemory() { super.onLowMemory(); if (mListAdapter != null) { for (MapView m : mListAdapter.getMapViews()) { m.onLowMemory(); } } }
@Override protected void onPause() { super.onPause(); if (mListAdapter != null) { for (MapView m : mListAdapter.getMapViews()) { m.onPause(); } } }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mMapView = (MapView) view.findViewById(R.id.map); mMapView.onCreate(savedInstanceState != null ? savedInstanceState.getBundle(STATE_MAP) : null); mMapView.getMapAsync(this); mToolbar = (Toolbar) view.findViewById(R.id.toolbar); ((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar); mWeatherModeBtn = (ImageButton) view.findViewById(R.id.feature_mode_weather_btn); mWeatherModeBtn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { setFeatureMode(FeatureMode.WEATHER); } }); mTemperatureModeBtn = (ImageButton) view.findViewById(R.id.feature_mode_temperature_btn); mTemperatureModeBtn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { setFeatureMode(FeatureMode.TEMPERATURE); } }); mLogoView = view.findViewById(R.id.logo); mPostButton = view.findViewById(R.id.post_button); mPostButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { showPostFragment(null); } }); if (getHomeFragment() != null) { showHomeFragment(); } else if (getPostFragment() != null) { showPostFragment(null); } if (savedInstanceState == null) { Bundle args = getArguments(); if (args != null) { if (args.getBoolean(ARG_SHOW_HOME)) showHomeFragment(); else if (args.getBoolean(ARG_SHOW_POST)) showPostFragment(args); else if (args.containsKey(ARG_LOCATION)) { mMapLocation = args.getParcelable(ARG_LOCATION); } } mWeatherModeBtn.setSelected(true); } }
public double[] getViewableRegion() { if (b.getMap() != null) { Object localObject = b.getMap().d(); LatLng localLatLng1 = ((g)localObject).a(new Point(0, 0)); localObject = ((g)localObject).a(new Point(b.getWidth(), b.getHeight())); LatLng localLatLng2 = b.getMap().a().a; return new double[] { a, b, a, b, a, b }; } return null; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_google_map_view, container, false); mMapView = (MapView) v.findViewById(R.id.mapView); mMapView.onCreate(savedInstanceState); mMapView.onResume(); // needed to get the map to display immediately try { MapsInitializer.initialize(getActivity().getApplicationContext()); } catch (Exception e) { e.printStackTrace(); } md = new GMapV2Direction(getActivity()); queue = Volley.newRequestQueue(getActivity()); googleMap = mMapView.getMap(); googleMap.setMyLocationEnabled(true); if (checkPlayServices()) { // Building the GoogleApi client buildGoogleApiClient(); } makeJsonObjectRequest(); return v; // Button btn_find = (Button) v.findViewById(R.id.button); // etLocation = (EditText) v.findViewById(R.id.startLocation); // // // Defining button click event listener for the find button // OnClickListener findClickListener = new OnClickListener() { // @Override // public void onClick(View v) { // // Getting user input location // String location = etLocation.getText().toString(); // // if(location!=null && !location.equals("")){ // new GeocoderTask().execute(location); // }else{ // makeJsonObjectRequest(); // } // } // }; // btn_find.setOnClickListener(findClickListener); }
@Override public void onDestroy() { super.onDestroy(); mMapView.onDestroy(); GpsManager gps = new GpsManager(this.getActivity()); gps.stopUsingGPS(); }
public void bind(final Context context, @NonNull final Accident accident) { mMapView.onResume(); final int flags = DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_ABBREV_WEEKDAY | DateUtils.FORMAT_ABBREV_MONTH | DateUtils.FORMAT_SHOW_DATE; mTimeView.setText( DateUtils.getRelativeDateTimeString( context, accident.getTimestamp(), DateUtils.MINUTE_IN_MILLIS, DateUtils.DAY_IN_MILLIS, flags)); mMaxSpeedView.setText( context.getString( R.string.max_speed_format, SpeedConverter.mpsToKph(accident.getMaxSpeed()))); mTrackPolyline = new PolylineOptions(); final LatLngBounds.Builder builder = new LatLngBounds.Builder(); final List<AccidentPoint> points = accident.getPoints(); for (final AccidentPoint point : points) { final LatLng latLng = point.asLatLng(); mTrackPolyline.add(latLng); builder.include(latLng); } mMapBounds = builder.build(); if (mMapLoaded) { showBoundsOnGoogleMap(mMapBounds); drawPolygonOnMap(mTrackPolyline); } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View inflatedView = inflater.inflate(R.layout.info, container, false); try { MapsInitializer.initialize(getActivity()); } catch (GooglePlayServicesNotAvailableException e) { // TODO handle this situation } mMapView = (MapView) inflatedView.findViewById(R.id.map); // viewDistance = (CheckedTextView) inflatedView // .findViewById(R.id.CheckedTextView07); mMapView.onCreate(mBundle); setUpMap(inflatedView); final Button button = (Button) inflatedView.findViewById(id.button1); button.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { showRoute = true; final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity().getBaseContext()); final String lat = prefs.getString("Latitude", ""); final String lon = prefs.getString("Longitude", ""); final String name = prefs.getString("Longitude", ""); standortLatitude = Double.parseDouble(lat); standortLongitude = Double.parseDouble(lon); // Intent intent = new Intent(); // intent.setAction("infoTab"); // // Bundle extras = intent.getExtras(); // //// Float lat = extras.getFloat("Latitude"); //// Float lon = extras.getFloat("Longitude"); // String test = extras.getString("Test"); // test = test; // Location cafeteria = new Location(""); cafeteria.setLatitude(49.01578); cafeteria.setLongitude(8.39137); Location start = new Location(""); start.setLatitude(standortLatitude); start.setLongitude(standortLongitude); distance = cafeteria.distanceTo(start); // viewDistance.setText("Entfernung: " + distance/1000 + "km"); setUpMap(); } }); return inflatedView; }
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); Bundle mapOutState = new Bundle(); mMapView.onSaveInstanceState(mapOutState); outState.putBundle(STATE_MAP, mapOutState); }
//// ---onCreate--start---------------------------------------------- @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // inflat and return the layout View view = inflater.inflate(R.layout.fragment_map, container, false); mMapView = (MapView) view.findViewById(R.id.mapView); mMapView.onCreate(savedInstanceState); mMapView.onResume(); // needed to get the map to display immediately try { MapsInitializer.initialize(getActivity().getApplicationContext()); } catch (Exception e) { e.printStackTrace(); } googleMap = mMapView.getMap(); if (!isGooglePlayServicesAvailable()) getActivity().finish(); createLocationRequest(); mGoogleApiClient = new GoogleApiClient.Builder(getActivity()) .addApi(LocationServices.API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.map_swipeLayout); swipeLayout.setOnRefreshListener( new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { Intent intent = new Intent(getActivity(), ReloadService.class); getActivity().startService(intent); } }); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(ReloadService.DONE); getActivity().registerReceiver(reloadDone, intentFilter); // Perform any camera updates here return view; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_map, container, false); mMapView = (MapView) v.findViewById(R.id.map); mMapView.onCreate(savedInstanceState); mMapView.onResume(); try { MapsInitializer.initialize(getActivity().getApplicationContext()); } catch (Exception e) { e.printStackTrace(); } GoogleMap googleMap = mMapView.getMap(); googleMap.setOnInfoWindowClickListener(this); indicative = new LatLng(48.511902, 32.269087); hydrosila = new LatLng(48.524263, 32.265076); zirka = new LatLng(48.515700, 32.265896); MarkerOptions mrkIndicative = new MarkerOptions() .position(indicative) .title("Indicative") .snippet(getString(R.string.indicative_snippet)); MarkerOptions mrkHydrosila = new MarkerOptions() .position(hydrosila) .title("Hydrosila") .snippet(getString(R.string.hydrosila_snippet)); MarkerOptions mrkZirka = new MarkerOptions() .position(zirka) .title("Zirka") .snippet(getString(R.string.zirka_snippet)); googleMap.addMarker(mrkHydrosila); googleMap.addMarker(mrkIndicative); googleMap.addMarker(mrkZirka); CameraPosition cameraPosition = new CameraPosition.Builder().target(indicative).zoom(15).build(); googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); return v; }
@Override public void onResume() { super.onResume(); mMapView.onResume(); if (getHomeFragment() == null) { AnalyticsHelper.trackScreen("map"); } }
@Override public void onLocationChanged(Location location) { Log.d(TAG, "onLocationChanged"); if (mapIsInitialised) { presenter.addMarker(location.getLatitude(), location.getLongitude()); mapView.invalidate(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ubicacion); // Para agregar al LocationManager un nuevo LocationListener // que escuche las actualización de ubicación del GPS. LocationManager locManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); MyLocationListener locListener = new MyLocationListener(); locListener.setUbicacionActivity(this); locManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, 0, 0, (LocationListener) locListener); // locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, (LocationListener) // locListener); // ELEMENTOS DE LA INTERFAZ tvUbicacion = (TextView) findViewById(R.id.tvUbi); tvDireccion = (TextView) findViewById(R.id.tvDireccion); logo = (ImageView) findViewById(R.id.logo); vistaMapa = (MapView) findViewById(R.id.miMapa); Button btnActualizar = (Button) findViewById(R.id.btnActualizar); vistaMapa.onCreate(savedInstanceState); // inicializar google map googleMapa = vistaMapa.getMap(); // tipo de mapa que queramos mostrar googleMapa.setMapType(GoogleMap.MAP_TYPE_NORMAL); // poner a disponible la ubicacion para poder utilizar if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return; } googleMapa.setMyLocationEnabled(true); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); }
@Override public void onPause() { super.onPause(); mapView.onPause(); if (mapRender != null) { // save memory mapRender.clear(); } }
/** * Remove the location listener updates when Activity is paused. * * @see android.support.v4.app.Fragment#onPause() */ @Override public void onPause() { super.onPause(); if (map != null) map.setMyLocationEnabled(false); if (mapView != null) { mapView.onPause(); } locationManager.removeUpdates(this); }
/** * Called when the fragment is brought back into the foreground. Resumes the map and the location * manager. * * @see android.support.v4.app.Fragment#onResume() */ @Override public void onResume() { if (mapView != null) mapView.onResume(); if (map != null) map.setMyLocationEnabled(true); Criteria criteria = new Criteria(); provider = locationManager.getBestProvider(criteria, false); locationManager.requestLocationUpdates(provider, 5000, 10, this); super.onResume(); }
private void setupMap(final LatLng center, final Bundle savedInstanceState) { mapView = new MapView(this); mapView.onCreate(savedInstanceState); MapsInitializer.initialize(this); if (mapView.getMap() != null) { mapRender = new MapRender(this, mapView.getMap(), true); if (center != null) { final CameraPosition cameraPosition = new CameraPosition.Builder().target(center).zoom(DEFAULT_ZOOM).build(); mapView.getMap().moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); } } final RelativeLayout rlView = (RelativeLayout) findViewById(R.id.db_map_rl); rlView.addView(mapView); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_detail_list, container, false); // Gets the MapView from the XML layout and creates it mapView = (MapView) v.findViewById(R.id.map_view); mapView.onCreate(savedInstanceState); // Gets to GoogleMap from the MapView and does initialization stuff mMap = mapView.getMap(); mMap.getUiSettings().setMyLocationButtonEnabled(false); mMap.setMyLocationEnabled(true); setUpMap(); return v; }
@Override protected void onResume() { super.onResume(); int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (resultCode == ConnectionResult.SUCCESS) { mRecyclerView.setAdapter(mListAdapter); } else { GooglePlayServicesUtil.getErrorDialog(resultCode, this, 1).show(); } if (mListAdapter != null) { for (MapView m : mListAdapter.getMapViews()) { m.onResume(); } } }
@Override public void onLowMemory() { super.onLowMemory(); mMapView.onLowMemory(); googleMap.setMyLocationEnabled(false); GpsManager gps = new GpsManager(this.getActivity()); gps.stopUsingGPS(); }
public void a(Bundle paramBundle) { if (b != null) { Bundle localBundle = new Bundle(); b.b(localBundle); paramBundle.putParcelable("extra.map_view", localBundle); } }
public void setMapMode(final int paramInt) { b.a(new com.google.android.gms.maps.e() { public void a(com.google.android.gms.maps.c paramAnonymousc) { paramAnonymousc.a(paramInt); } }); }