This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExperimentalComposeUiApi | |
@Composable | |
fun ShowKeyboard() { | |
val keyboardController = LocalSoftwareKeyboardController.current | |
var value by remember { mutableStateOf("") } | |
Column( | |
modifier = Modifier.fillMaxSize(), | |
verticalArrangement = Arrangement.Center | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1 | |
@ExperimentalAnimationApi | |
@Composable | |
fun UserListItem( | |
userType: UserType, | |
isSelected: Boolean = false, | |
onSelectedChanged: (String) -> Unit, | |
) { | |
//2 | |
Surface( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExperimentalAnimationApi | |
@Composable | |
fun ItemGroup( | |
type: List<UserType> = getAllUserType(), | |
selected: UserType? = null, | |
onSelectedChanged: (String) -> Unit = {}, | |
) { | |
LazyRow { | |
itemsIndexed( | |
items = type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DescGroup( | |
getAllUserType(), | |
selected = selectedDesc.value, | |
onSelectedChanged = { | |
selectedDesc.value = getUserType(it) | |
} | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun DeniedText( | |
rationaleText: String, | |
context: Context | |
) { | |
Column( | |
modifier = Modifier | |
.fillMaxSize() | |
.padding(12.dp), | |
verticalArrangement = Arrangement.Center, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |