-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MD3 Request Permission Dialog
- Loading branch information
Showing
10 changed files
with
159 additions
and
240 deletions.
There are no files selected for viewing
Submodule api
updated
7 files
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
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
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
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
177 changes: 0 additions & 177 deletions
177
app/src/main/java/com/rosan/dhizuku/ui/widget/dialog/AlertDialog.kt
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
app/src/main/java/com/rosan/dhizuku/ui/widget/dialog/DialogButton.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.rosan.dhizuku.ui.widget.dialog | ||
|
||
data class DialogButton( | ||
val text: String, | ||
val onClick: () -> Unit | ||
) |
45 changes: 45 additions & 0 deletions
45
app/src/main/java/com/rosan/dhizuku/ui/widget/dialog/DialogButtons.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.rosan.dhizuku.ui.widget.dialog | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.shape.CornerSize | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.ButtonDefaults | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.TextButton | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun DialogButtons( | ||
buttons: List<DialogButton> | ||
) { | ||
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) { | ||
buttons.forEachIndexed { index, button -> | ||
val specialCornerSize = CornerSize(12.dp) | ||
val shape = RoundedCornerShape(4.dp).let { | ||
if (index != 0) it | ||
else it.copy(topStart = specialCornerSize, topEnd = specialCornerSize) | ||
}.let { | ||
if (index + 1 != buttons.size) it | ||
else it.copy(bottomStart = specialCornerSize, bottomEnd = specialCornerSize) | ||
} | ||
TextButton( | ||
button.onClick, | ||
modifier = Modifier.fillMaxWidth(), | ||
shape = shape, | ||
colors = ButtonDefaults.buttonColors( | ||
containerColor = MaterialTheme.colorScheme.primaryContainer, | ||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer | ||
), | ||
contentPadding = PaddingValues(16.dp) | ||
) { | ||
Text(button.text) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.