diff --git a/demo/src/main/java/com/google/maps/android/utils/demo/BaseDemoActivity.java b/demo/src/main/java/com/google/maps/android/utils/demo/BaseDemoActivity.java index 60e497b87..0300041c2 100644 --- a/demo/src/main/java/com/google/maps/android/utils/demo/BaseDemoActivity.java +++ b/demo/src/main/java/com/google/maps/android/utils/demo/BaseDemoActivity.java @@ -25,6 +25,8 @@ import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; +import java.util.Objects; + public abstract class BaseDemoActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; private boolean mIsRestore; @@ -51,7 +53,7 @@ public void onMapReady(@NonNull GoogleMap map) { } private void setUpMap() { - ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMapAsync(this); + ((SupportMapFragment) Objects.requireNonNull(getSupportFragmentManager().findFragmentById(R.id.map))).getMapAsync(this); } /** diff --git a/demo/src/main/java/com/google/maps/android/utils/demo/HeatmapsPlacesDemoActivity.java b/demo/src/main/java/com/google/maps/android/utils/demo/HeatmapsPlacesDemoActivity.java index 7a9c9f7d4..09caaf6ee 100644 --- a/demo/src/main/java/com/google/maps/android/utils/demo/HeatmapsPlacesDemoActivity.java +++ b/demo/src/main/java/com/google/maps/android/utils/demo/HeatmapsPlacesDemoActivity.java @@ -115,7 +115,7 @@ public enum HeatmapColors { /** * Stores the TileOverlay corresponding to each of the keywords that have been searched for. */ - private Hashtable mOverlays = new Hashtable(); + private Hashtable mOverlays = new Hashtable<>(); /** * A layout containing checkboxes for each of the heatmaps rendered. diff --git a/demo/src/main/java/com/google/maps/android/utils/demo/KmlDemoActivity.java b/demo/src/main/java/com/google/maps/android/utils/demo/KmlDemoActivity.java index 985f1a700..6d8655e7d 100644 --- a/demo/src/main/java/com/google/maps/android/utils/demo/KmlDemoActivity.java +++ b/demo/src/main/java/com/google/maps/android/utils/demo/KmlDemoActivity.java @@ -140,9 +140,7 @@ private class LoadLocalKmlFile extends AsyncTask { protected KmlLayer doInBackground(String... strings) { try { return new KmlLayer(mMap, mResourceId, KmlDemoActivity.this); - } catch (XmlPullParserException e) { - e.printStackTrace(); - } catch (IOException e) { + } catch (XmlPullParserException | IOException e) { e.printStackTrace(); } return null; diff --git a/demo/src/main/java/com/google/maps/android/utils/demo/MultiLayerDemoActivity.java b/demo/src/main/java/com/google/maps/android/utils/demo/MultiLayerDemoActivity.java index caa66d674..b3720ae0a 100644 --- a/demo/src/main/java/com/google/maps/android/utils/demo/MultiLayerDemoActivity.java +++ b/demo/src/main/java/com/google/maps/android/utils/demo/MultiLayerDemoActivity.java @@ -117,9 +117,7 @@ protected void startDemo(boolean isRestore) { kmlPolygonLayer.setOnFeatureClickListener(feature -> Toast.makeText(MultiLayerDemoActivity.this, "KML polygon clicked: " + feature.getProperty("name"), Toast.LENGTH_SHORT).show()); - } catch (XmlPullParserException e) { - e.printStackTrace(); - } catch (IOException e) { + } catch (XmlPullParserException | IOException e) { e.printStackTrace(); } diff --git a/demo/src/main/java/com/google/maps/android/utils/demo/MyItemReader.java b/demo/src/main/java/com/google/maps/android/utils/demo/MyItemReader.java index 7e33bd66c..c9e6804e3 100644 --- a/demo/src/main/java/com/google/maps/android/utils/demo/MyItemReader.java +++ b/demo/src/main/java/com/google/maps/android/utils/demo/MyItemReader.java @@ -37,7 +37,7 @@ public class MyItemReader { private static final String REGEX_INPUT_BOUNDARY_BEGINNING = "\\A"; public List read(InputStream inputStream) throws JSONException { - List items = new ArrayList(); + List items = new ArrayList<>(); String json = new Scanner(inputStream).useDelimiter(REGEX_INPUT_BOUNDARY_BEGINNING).next(); JSONArray array = new JSONArray(json); for (int i = 0; i < array.length(); i++) { diff --git a/demo/src/main/java/com/google/maps/android/utils/demo/StreetViewDemoActivity.kt b/demo/src/main/java/com/google/maps/android/utils/demo/StreetViewDemoActivity.kt index fb642a377..38c900802 100644 --- a/demo/src/main/java/com/google/maps/android/utils/demo/StreetViewDemoActivity.kt +++ b/demo/src/main/java/com/google/maps/android/utils/demo/StreetViewDemoActivity.kt @@ -19,11 +19,17 @@ class StreetViewDemoActivity : Activity() { GlobalScope.launch(Dispatchers.Main) { val response1 = - StreetViewUtils.fetchStreetViewData(LatLng(48.1425918, 11.5386121), BuildConfig.MAPS_API_KEY) - val response2 = StreetViewUtils.fetchStreetViewData(LatLng(8.1425918, 11.5386121), BuildConfig.MAPS_API_KEY) + StreetViewUtils.fetchStreetViewData( + LatLng(48.1425918, 11.5386121), + BuildConfig.MAPS_API_KEY + ) + val response2 = StreetViewUtils.fetchStreetViewData( + LatLng(8.1425918, 11.5386121), + BuildConfig.MAPS_API_KEY + ) - findViewById(R.id.textViewFirstLocation).text = "Location 1 is supported in StreetView: $response1" - findViewById(R.id.textViewSecondLocation).text = "Location 2 is supported in StreetView: $response2" + findViewById(R.id.textViewFirstLocation).text = getString(R.string.location_1_is_supported_in_streetview, response1) + findViewById(R.id.textViewSecondLocation).text = getString(R.string.location_1_is_supported_in_streetview, response2) } } } diff --git a/demo/src/main/java/com/google/maps/android/utils/demo/ZoomClusteringDemoActivity.java b/demo/src/main/java/com/google/maps/android/utils/demo/ZoomClusteringDemoActivity.java index 83c5a3b29..9cf3fda32 100644 --- a/demo/src/main/java/com/google/maps/android/utils/demo/ZoomClusteringDemoActivity.java +++ b/demo/src/main/java/com/google/maps/android/utils/demo/ZoomClusteringDemoActivity.java @@ -156,7 +156,7 @@ protected boolean shouldRenderAsCluster(@NonNull Cluster cluster) { * certain zoom level and as a marker below a certain zoom level even if the contents of * the clusters themselves did not change. In this case, we need to override this method * to implement this new optimization behavior. - * + *

* Note that always returning true from this method could potentially have negative * performance implications as clusters will be re-rendered on each pass even if they don't * change. diff --git a/demo/src/main/res/values/strings.xml b/demo/src/main/res/values/strings.xml index 7522cb78a..c51f8ae42 100644 --- a/demo/src/main/res/values/strings.xml +++ b/demo/src/main/res/values/strings.xml @@ -33,4 +33,6 @@ Radius Gradient Opacity + Location 1 is supported in StreetView: %1$s + Go