🔨 Optimizes imports
This commit is contained in:
@@ -17,12 +17,10 @@ import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.outlined.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.Visibility
|
||||
import androidx.compose.material.icons.filled.VisibilityOff
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.FloatingActionButton
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Scaffold
|
||||
@@ -45,7 +43,6 @@ import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.core.content.edit
|
||||
import dev.svitan.antifed.ui.components.DropdownList
|
||||
import dev.svitan.antifed.ui.theme.AntiFedTheme
|
||||
import io.ktor.client.call.body
|
||||
import io.ktor.client.request.get
|
||||
@@ -55,14 +52,12 @@ import kotlinx.coroutines.delay
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
class AuthActivity : ComponentActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
|
||||
setContent {
|
||||
AntiFedTheme {
|
||||
|
||||
var serverUrl by remember { mutableStateOf("") }
|
||||
var token by remember { mutableStateOf("") }
|
||||
var showToken by remember { mutableStateOf(false) }
|
||||
@@ -257,37 +252,6 @@ class AuthActivity : ComponentActivity() {
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
|
||||
if (auths.isNotEmpty()) {
|
||||
DropdownList(
|
||||
itemList = auths.map { it.name },
|
||||
selectedIndex = authIndex.coerceAtLeast(0),
|
||||
onItemClick = {
|
||||
authIndex = it
|
||||
authId = auths[it].id
|
||||
prefs.edit {
|
||||
putString(
|
||||
getString(R.string.auth_key), authId
|
||||
)
|
||||
}
|
||||
},
|
||||
modifier = Modifier
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
FloatingActionButton(
|
||||
onClick = {
|
||||
println("creating new auth!!")
|
||||
}) {
|
||||
Icon(
|
||||
Icons.Default.Add,
|
||||
contentDescription = stringResource(R.string.create_auth)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,19 +29,20 @@ import androidx.compose.ui.window.PopupProperties
|
||||
fun DropdownList(
|
||||
itemList: List<String>,
|
||||
selectedIndex: Int,
|
||||
modifier: Modifier,
|
||||
modifier: Modifier = Modifier,
|
||||
onItemClick: (Int) -> Unit
|
||||
) {
|
||||
var showDropdown by rememberSaveable { mutableStateOf(true) }
|
||||
var showDropdown by rememberSaveable { mutableStateOf(false) }
|
||||
val scrollState = rememberScrollState()
|
||||
|
||||
Column(
|
||||
modifier = Modifier,
|
||||
modifier = modifier,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(Color.Red)
|
||||
.clickable { showDropdown = !showDropdown },
|
||||
contentAlignment = Alignment.Center
|
||||
|
||||
Reference in New Issue
Block a user