Android Studio keyboard shortcuts I use often.
SHIFT + F6
to refactor methods, classes, and variable namesCTRL + O
to override methodsCOMMAND + N
- Generate getter, setter, and constructor method for a class (when in editor pane)
// 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) | |
// … | |
) |
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
GoogleMap( | |
properties = MapProperties(isBuildingEnabled = true) | |
// … | |
) |
// 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 |
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
import androidx.compose.ui.platform.ComposeView | |
class MyComposeAdapter : RecyclerView.Adapter<MyComposeViewHolder>() { | |
override fun onCreateViewHolder( | |
parent: ViewGroup, | |
viewType: Int, |
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
class ComposeItemRow @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyle: Int = 0 | |
) : AbstractComposeView(context, attrs, defStyle) { | |
// … |
// Copyright 2022 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
@Composable | |
fun ItemRow(index: Int, state: LazyListState) { | |
DisposableEffect(Unit) { | |
println("ItemRow $index composed") | |
onDispose { println("ItemRow $index DISPOSED") } | |
} | |
Column(Modifier.fillMaxWidth()) { |