Skip to content

Instantly share code, notes, and snippets.

View arriolac's full-sized avatar
🌍

Chris Arriola arriolac

🌍
View GitHub Profile
@arriolac
arriolac / FlatIterator.java
Last active January 6, 2016 20:01
An Iterator that flattens iterating over a list of Iterators.
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
/**
* An Iterator that flattens iterating over a list of Iterators.
*
* Created by chris on 1/5/16.
*/
@arriolac
arriolac / ActionBarDrawerToggle.java
Created February 23, 2016 20:44
ActionBarDrawerToggle with no animation
new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) {
@Override public void onDrawerSlide(View drawerView, float slideOffset) {
super.onDrawerSlide(drawerView, 0);
}
};

Keybase proof

I hereby claim:

  • I am arriolac on github.
  • I am chrisarriola (https://keybase.io/chrisarriola) on keybase.
  • I have a public key ASBSQlNOoGj57_pr5_Rn2ei1zRfC6Xm4GHkigxYOwjIXCQo

To claim this, I am signing this object:

@arriolac
arriolac / GoogleMapAnimate.kt
Created May 16, 2022 16:47
Maps Compose Snippets
// Copyright 2022 Google LLC.
// SPDX-License-Identifier: Apache-2.0
val singapore = LatLng(1.35, 103.87)
val cameraPositionState = rememberCameraPositionState {
position = CameraPosition.fromLatLngZoom(singapore, 11f)
}
Box(Modifier.fillMaxSize()) {
GoogleMap(
modifier = Modifier.matchParentSize(),
// Copyright 2022 Google LLC.
// SPDX-License-Identifier: Apache-2.0
GoogleMap(
uiSettings = MapUiSettings(compassEnabled = false, mapToolbarEnabled = true)
// …
)
@arriolac
arriolac / GoogleMapProperties.kt
Created June 1, 2022 19:33
GoogleMapProperties.kt
// Copyright 2022 Google LLC.
// SPDX-License-Identifier: Apache-2.0
GoogleMap(
properties = MapProperties(isBuildingEnabled = true)
// …
)
@arriolac
arriolac / GoogleMapMarker.kt
Created June 1, 2022 19:34
GoogleMapMarker.kt
// Copyright 2022 Google LLC.
// SPDX-License-Identifier: Apache-2.0
GoogleMap(modifier = Modifier.fillMaxSize()) {
Marker(
state = MarkerState(LatLng(1.35, 103.87)),
title = "Marker in Singapore",
onClick = { Log.d("Marker", "Marker was clicked") }
)
}
// Copyright 2022 Google LLC.
// SPDX-License-Identifier: Apache-2.0
val singapore = LatLng(1.35, 103.87)
val cameraPositionState = rememberCameraPositionState {
position = CameraPosition.fromLatLngZoom(singapore, 11f)
}
Box(Modifier.fillMaxSize()) {
GoogleMap(
modifier = Modifier.matchParentSize(),
// Copyright 2022 Google LLC.
// SPDX-License-Identifier: Apache-2.0
MyAppTheme {
GoogleMap(
//…
) {
Circle(
center = singapore,
fillColor = MaterialTheme.colors.primary
@arriolac
arriolac / RvComposePoolingContainer.kt
Last active July 14, 2022 03:01
Example usage of ComposeView in RV (Compose version 1.2.0-beta02+ and RecyclerView version 1.3.0-alpha02)
// Copyright 2022 Google LLC.
// SPDX-License-Identifier: Apache-2.0
class MyComposeAdapter : RecyclerView.Adapter<MyComposeViewHolder>() {
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int,
): MyComposeViewHolder {
return MyComposeViewHolder(ComposeView(parent.context))