Skip to content

Instantly share code, notes, and snippets.

View MotasemF's full-sized avatar

MotasemJouda MotasemF

View GitHub Profile
@surajsau
surajsau / ParallaxScreen.kt
Last active June 28, 2024 21:14
Parallax effect with Jetpack Compose
@Composable
fun ParallaxScreen(modifier: Modifier = Modifier) {
val context = LocalContext.current
val scope = rememberCoroutineScope()
var data by remember { mutableStateOf<SensorData?>(null) }
DisposableEffect(Unit) {
val dataManager = SensorDataManager(context)
dataManager.init()
class AdapterBuilder<ModelType>(
private val itemList: List<ModelType>,
private val layoutId: Int,
private val viewModel: ViewModel?
) {
fun build(): BaseRecyclerAdapter<ModelType> {
val baseAdapter = BaseRecyclerAdapter(itemList, layoutId, viewModel)
baseAdapter.updateData(itemList)
return baseAdapter
@BindingAdapter(
value = [
"itemList",
"itemLayoutId",
"viewModel"
],
requireAll = false
)
fun RecyclerView.bindRecyclerView(
itemList: List<Nothing>?,