Skip to content

Instantly share code, notes, and snippets.

View RaheemJnr's full-sized avatar
🎯
Focusing

Raheem Jnr RaheemJnr

🎯
Focusing
View GitHub Profile
@ExperimentalComposeUiApi
@Composable
fun ShowKeyboard() {
val keyboardController = LocalSoftwareKeyboardController.current
var value by remember { mutableStateOf("") }
Column(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center
) {
// an enum class that hold user type
enum class UserType(val id:Int,val type: String,val imageId:Int) {
STUDENT("Student",R.drawable.one),
PARENT("Parent",R.drawable.two),
TEACHER("Contractor",R.drawable.three)
}
// a method that return a list of our user
fun getAllUserType(): List<UserType> {
return listOf(
//1
@ExperimentalAnimationApi
@Composable
fun UserListItem(
userType: UserType,
isSelected: Boolean = false,
onSelectedChanged: (String) -> Unit,
) {
//2
Surface(
@ExperimentalAnimationApi
@Composable
fun ItemGroup(
type: List<UserType> = getAllUserType(),
selected: UserType? = null,
onSelectedChanged: (String) -> Unit = {},
) {
LazyRow {
itemsIndexed(
items = type
DescGroup(
getAllUserType(),
selected = selectedDesc.value,
onSelectedChanged = {
selectedDesc.value = getUserType(it)
}
)
@ExperimentalPagerApi
@Composable
fun ListCarousel() {
val carouselImages = listOf(
R.drawable.ic_launcher_foreground,
R.drawable.ic_launcher_background,
R.drawable.splash_icon,
)
val carouselText = listOf(
"Bitcoin latest price is now at $100000",
@OptIn(ExperimentalPermissionsApi::class)
@Composable
fun Permissions(
multiplePermissionsState: MultiplePermissionsState,
context: Context,
rationaleText: String,
modifier: Modifier,
) {
// Track if the user doesn't want to see the rationale any more.
var doNotShowRationale by rememberSaveable { mutableStateOf(false) }
@Composable
fun DeniedText(
rationaleText: String,
context: Context
) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(12.dp),
verticalArrangement = Arrangement.Center,
// input the permissions to request..
val multiplePermissionsState = rememberMultiplePermissionsState(
listOf(
android.Manifest.permission.ACCESS_COARSE_LOCATION,
android.Manifest.permission.ACCESS_FINE_LOCATION,
android.Manifest.permission.CAMERA,
)
)
val context = LocalContext.current
package com.evapingnow.woodchuck.utils
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.provider.Settings
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.material.AlertDialog