@@ -10,10 +10,11 @@ import androidx.compose.material.icons.filled.Palette
1010import androidx.compose.material.icons.filled.TextSnippet
1111import androidx.compose.material.icons.outlined.*
1212import androidx.compose.material3.*
13- import androidx.compose.runtime.*
13+ import androidx.compose.runtime.Composable
14+ import androidx.compose.runtime.mutableStateOf
15+ import androidx.compose.runtime.remember
1416import androidx.compose.runtime.saveable.rememberSaveable
1517import androidx.compose.ui.Modifier
16- import androidx.compose.ui.graphics.Color
1718import androidx.compose.ui.platform.LocalContext
1819import androidx.compose.ui.res.stringResource
1920import androidx.compose.ui.unit.dp
@@ -204,88 +205,4 @@ fun ProfileActions(onClick: () -> Unit) {
204205 dismissAction = onClick,
205206 backHandler = {}
206207 )
207- }
208-
209- @Composable
210- fun FileAttachActions (onItemSelected : (Attachments ) -> Unit ) {
211-
212- var showFilter by remember { mutableStateOf(false ) }
213-
214- IconButton (onClick = {
215- showFilter = true
216- }) {
217- Icon (Icons .Outlined .AttachFile , null , tint = Color .Black )
218- }
219-
220- DropdownMenu (
221- expanded = showFilter,
222- onDismissRequest = { showFilter = false }
223- ) {
224- DropdownMenuItem (
225- onClick = {
226- showFilter = false
227- onItemSelected(Attachments .IMAGE )
228- },
229- text = { Text (stringResource(R .string.image)) },
230- leadingIcon = { Icon (Icons .Outlined .Image , null ) }
231- )
232- DropdownMenuItem (
233- onClick = {
234- showFilter = false
235- onItemSelected(Attachments .DOCUMENT )
236- },
237- text = { Text (stringResource(R .string.document)) },
238- leadingIcon = { Icon (Icons .Outlined .TextSnippet , null ) }
239- )
240- DropdownMenuItem (
241- onClick = {
242- showFilter = false
243- onItemSelected(Attachments .AUDIO )
244- },
245- text = { Text (stringResource(R .string.Audio )) },
246- leadingIcon = { Icon (Icons .Outlined .MusicNote , null ) }
247- )
248- DropdownMenuItem (
249- onClick = {
250- showFilter = false
251- onItemSelected(Attachments .FILE )
252- },
253- text = { Text (stringResource(R .string.File )) },
254- leadingIcon = { Icon (Icons .Outlined .InsertDriveFile , null ) }
255- )
256- }
257-
258- // val contentLauncher = rememberLauncherForActivityResult(
259- // ActivityResultContracts.GetContent()
260- // ) { uri: Uri? ->
261- // uri?.let { viewModel.addAttachment(uri) }
262- // }
263- //
264- // val documentLauncher = rememberLauncherForActivityResult(
265- // ActivityResultContracts.OpenDocument()
266- // ) { uri: Uri? ->
267- // uri?.let { viewModel.addAttachment(uri) }
268- // }
269- //
270- // FileAttachActions(onItemSelected = {
271- // when (it) {
272- // Attachments.IMAGE -> contentLauncher.launch("image/*")
273- // Attachments.DOCUMENT -> documentLauncher.launch(arrayOf(
274- // "docx", "doc", "ppt", "pptx", "xls", "xlsx", "pdf"
275- // ).toMimeType())
276- // Attachments.AUDIO -> contentLauncher.launch("audio/*")
277- // else -> contentLauncher.launch("*/*")
278- // }
279- // })
280-
281-
282- // fun Array<String>.toMimeType() : Array<String> {
283- // return this.map {
284- // MimeTypeMap.getSingleton().getMimeTypeFromExtension(it) ?: ""
285- // }.toTypedArray()
286- // }
287- }
288-
289- enum class Attachments {
290- IMAGE , DOCUMENT , AUDIO , FILE
291- }
208+ }
0 commit comments