1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.compose.runtime 18 19 import androidx.compose.runtime.Composable 20 import androidx.compose.runtime.InternalComposeApi 21 import androidx.compose.runtime.MovableContent 22 import androidx.compose.runtime.currentComposer 23 24 /** 25 * An overload of [androidx.compose.runtime.movableContentOf] with 5 parameters. 26 * 27 * @see androidx.compose.runtime.movableContentOf 28 */ 29 @OptIn(InternalComposeApi::class) 30 fun <P1, P2, P3, P4, P5> movableContentOf( 31 content: @Composable (P1, P2, P3, P4, P5) -> Unit 32 ): @Composable (P1, P2, P3, P4, P5) -> Unit { 33 val movableContent = 34 MovableContent<Pair<Triple<P1, P2, P3>, Pair<P4, P5>>> { 35 content( 36 it.first.first, 37 it.first.second, 38 it.first.third, 39 it.second.first, 40 it.second.second, 41 ) 42 } 43 return { p1, p2, p3, p4, p5 -> 44 currentComposer.insertMovableContent(movableContent, Triple(p1, p2, p3) to (p4 to p5)) 45 } 46 } 47