Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
delete component package
Browse files Browse the repository at this point in the history
  • Loading branch information
thriic committed Jun 17, 2023
1 parent dc1732c commit 8535d55
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 60 deletions.
56 changes: 0 additions & 56 deletions app/src/main/java/com/thryan/secondclass/ui/component/Button.kt

This file was deleted.

1 change: 0 additions & 1 deletion app/src/main/java/com/thryan/secondclass/ui/info/Info.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import com.thryan.secondclass.R
import com.thryan.secondclass.core.utils.signIn
import com.thryan.secondclass.ui.component.TimePicker

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.thryan.secondclass.ui.component
package com.thryan.secondclass.ui.info

import android.util.Log
import androidx.compose.material3.ExperimentalMaterial3Api
Expand Down
51 changes: 49 additions & 2 deletions app/src/main/java/com/thryan/secondclass/ui/login/Login.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
Expand All @@ -12,21 +13,26 @@ import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.unit.dp
import com.thryan.secondclass.ui.component.DebouncedButton
import kotlinx.coroutines.delay


@SuppressLint("FlowOperatorInvokedInComposition")
Expand Down Expand Up @@ -100,7 +106,7 @@ fun LoginContent(uiState: LoginState, viewModel: LoginViewModel) {
keyboardActions = KeyboardActions(
onDone = { }
),
//visualTransformation = PasswordVisualTransformation()
visualTransformation = PasswordVisualTransformation()
)

OutlinedTextField(
Expand Down Expand Up @@ -159,3 +165,44 @@ private fun Dialog(
}
)
}

@Composable
fun DebouncedButton(
modifier: Modifier = Modifier,
outline: Boolean = true,
enabled: Boolean = true,
onClick: () -> Unit,
content: @Composable (RowScope.() -> Unit)
) {
var clicked by remember {
mutableStateOf(!enabled)
}
LaunchedEffect(clicked) {
if (clicked) {
delay(1000L)
clicked = !clicked
}
}
if (!outline)
Button(
modifier = modifier,
onClick = {
if (enabled && !clicked) {
clicked = true
onClick()
}
},
content = content
)
else
OutlinedButton(
modifier = modifier,
onClick = {
if (enabled && !clicked) {
clicked = true
onClick()
}
},
content = content
)
}

0 comments on commit 8535d55

Please sign in to comment.