-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
207 additions
and
5 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
app/src/main/java/io/agora/flat/data/model/StreamAgreement.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,3 @@ | ||
package io.agora.flat.data.model | ||
|
||
data class StreamAgreement(val isAgree: Boolean) |
3 changes: 3 additions & 0 deletions
3
app/src/main/java/io/agora/flat/data/model/StreamAgreementReq.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,3 @@ | ||
package io.agora.flat.data.model | ||
|
||
class StreamAgreementReq(val isAgree: Boolean) |
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
94 changes: 94 additions & 0 deletions
94
app/src/main/java/io/agora/flat/ui/compose/StreamCollectDialog.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,94 @@ | ||
package io.agora.flat.ui.compose | ||
|
||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.heightIn | ||
import androidx.compose.material.Surface | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.ExperimentalComposeUiApi | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.window.Dialog | ||
import androidx.compose.ui.window.DialogProperties | ||
import io.agora.flat.R | ||
import io.agora.flat.ui.theme.FlatTheme | ||
|
||
@OptIn(ExperimentalComposeUiApi::class) | ||
@Composable | ||
fun StreamCollectDialog(onOpen: () -> Unit, onClose: () -> Unit, onCancel: () -> Unit) { | ||
val openDialog = remember { mutableStateOf(true) } | ||
|
||
if (openDialog.value) { | ||
FlatTheme { | ||
Dialog( | ||
onDismissRequest = { | ||
onCancel() | ||
openDialog.value = false | ||
}, | ||
properties = DialogProperties(usePlatformDefaultWidth = false), | ||
) { | ||
Box( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.clickable { | ||
onCancel() | ||
openDialog.value = false | ||
}, | ||
contentAlignment = Alignment.BottomCenter, | ||
) { | ||
Surface( | ||
modifier = Modifier.fillMaxWidth(), | ||
) { | ||
Column( | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.spacedBy(6.dp) | ||
) { | ||
OperationItem(stringResource(R.string.setting_on)) { | ||
onOpen() | ||
openDialog.value = false | ||
} | ||
OperationItem(stringResource(R.string.setting_off)) { | ||
onClose() | ||
openDialog.value = false | ||
} | ||
OperationItem(stringResource(R.string.cancel)) { | ||
onCancel() | ||
openDialog.value = false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun OperationItem(text: String, onClick: () -> Unit) { | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.heightIn(min = 48.dp) | ||
.clickable(onClick = onClick), | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.Center | ||
) { | ||
FlatTextBodyOne(text) | ||
} | ||
} | ||
|
||
@Composable | ||
@Preview(locale = "zh") | ||
fun StreamCollectDialogPreview() { | ||
StreamCollectDialog({}, {}, {}) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:fillColor="#00000000" | ||
android:pathData="M21,7.6V20.4C21,20.731 20.731,21 20.4,21H7.6C7.269,21 7,20.731 7,20.4V7.6C7,7.269 7.269,7 7.6,7H20.4C20.731,7 21,7.269 21,7.6Z" | ||
android:strokeWidth="1.25" | ||
android:strokeColor="#5D6066" | ||
android:strokeLineCap="round" | ||
android:strokeLineJoin="round" /> | ||
<path | ||
android:fillColor="#00000000" | ||
android:pathData="M18,4H4.6C4.269,4 4,4.269 4,4.6V18" | ||
android:strokeWidth="1.25" | ||
android:strokeColor="#5D6066" | ||
android:strokeLineCap="round" | ||
android:strokeLineJoin="round" /> | ||
<path | ||
android:fillColor="#00000000" | ||
android:pathData="M12.909,11.545C12.509,11.305 12,11.593 12,12.06V15.94C12,16.407 12.509,16.695 12.909,16.455L16.142,14.514C16.531,14.281 16.531,13.719 16.142,13.486L12.909,11.545Z" | ||
android:strokeWidth="1.25" | ||
android:strokeColor="#5D6066" | ||
android:strokeLineCap="round" | ||
android:strokeLineJoin="round" /> | ||
</vector> |
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