Skip to content

Commit

Permalink
Remove unnecessary warnings (#1256)
Browse files Browse the repository at this point in the history
  • Loading branch information
jenxwa committed Oct 26, 2023
1 parent 191fc7d commit 045a84f
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public enum HeatmapColors {
/**
* Stores the TileOverlay corresponding to each of the keywords that have been searched for.
*/
private Hashtable<String, TileOverlay> mOverlays = new Hashtable<String, TileOverlay>();
private Hashtable<String, TileOverlay> mOverlays = new Hashtable<>();

/**
* A layout containing checkboxes for each of the heatmaps rendered.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ private class LoadLocalKmlFile extends AsyncTask<String, Void, KmlLayer> {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class MyItemReader {
private static final String REGEX_INPUT_BOUNDARY_BEGINNING = "\\A";

public List<MyItem> read(InputStream inputStream) throws JSONException {
List<MyItem> items = new ArrayList<MyItem>();
List<MyItem> 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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TextView>(R.id.textViewFirstLocation).text = "Location 1 is supported in StreetView: $response1"
findViewById<TextView>(R.id.textViewSecondLocation).text = "Location 2 is supported in StreetView: $response2"
findViewById<TextView>(R.id.textViewFirstLocation).text = getString(R.string.location_1_is_supported_in_streetview, response1)
findViewById<TextView>(R.id.textViewSecondLocation).text = getString(R.string.location_1_is_supported_in_streetview, response2)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ protected boolean shouldRenderAsCluster(@NonNull Cluster<MyItem> cluster) {
* certain zoom level and as a marker below a certain zoom level <i>even if the contents of
* the clusters themselves did not change</i>. In this case, we need to override this method
* to implement this new optimization behavior.
*
* <p>
* 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.
Expand Down
2 changes: 2 additions & 0 deletions demo/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@
<string name="button_radius">Radius</string>
<string name="button_gradient">Gradient</string>
<string name="button_opacity">Opacity</string>
<string name="location_1_is_supported_in_streetview">Location 1 is supported in StreetView: %1$s</string>
<string name="go">Go</string>
</resources>

0 comments on commit 045a84f

Please sign in to comment.