Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eda91d9b authored by Chaohui Wang's avatar Chaohui Wang
Browse files

Scaffold back arrow should be pointing right when rtl

Mirror the arrow when rtl to fix.

Fix: 266190692
Test: Manually with Settings
Change-Id: Ia4dffcdaebf0ff1dd794b59390bea467b92417e9
parent 37ac2031
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -24,7 +24,12 @@ import androidx.compose.material.icons.outlined.FindInPage
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
import androidx.compose.ui.draw.scale
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.LayoutDirection
import com.android.settingslib.spa.framework.compose.LocalNavController

/** Action that navigates back to last page. */
@@ -50,6 +55,7 @@ private fun BackAction(contentDescription: String, onClick: () -> Unit) {
        Icon(
            imageVector = Icons.Outlined.ArrowBack,
            contentDescription = contentDescription,
            modifier = Modifier.autoMirrored(),
        )
    }
}
@@ -75,3 +81,10 @@ internal fun ClearAction(onClick: () -> Unit) {
        )
    }
}

private fun Modifier.autoMirrored() = composed {
    when (LocalLayoutDirection.current) {
        LayoutDirection.Rtl -> scale(scaleX = -1f, scaleY = 1f)
        else -> this
    }
}