From c56c0124e89d1c8fb9190d887579c1bda9a3eace Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 1 Feb 2024 18:32:31 +0100 Subject: [PATCH] Refactor again and cleanup avatar stuff --- app/src/main/AndroidManifest.xml | 8 +- .../avatar/components/AvatarEmpty.kt | 2 +- .../avatar/components/AvatarImage.kt | 2 +- .../avatar/components/AvatarURL.kt | 6 +- .../avatar/components/AvatarUser.kt | 2 +- .../avatar/components/AvatarUserId.kt | 4 +- .../avatar/effects/avatarUrlFromUserId.kt | 4 +- .../effects/bitmapFromMatrixUrl.kt} | 14 +- .../avatar/utils/getSqOrBitmapFromFile.kt | 15 ++ .../avatar/utils/getSqOrBitmapFromStreams.kt | 19 +++ .../twom/avatar/utils/getSqOrBitmapFromUri.kt | 18 +++ .../twom/avatar/utils/readExifOrientation.kt | 6 + .../steffo/twom/avatar/utils/readRawBitmap.kt | 9 ++ .../twom/avatar/utils/squareAndOrient.kt | 80 +++++++++++ .../steffo/twom/avatar/utils/toCachedFile.kt | 13 ++ .../components}/AvatarPickerWrapbox.kt | 8 +- .../activities/ConfigureRoomActivity.kt | 4 +- .../components}/ConfigureRoomForm.kt | 17 ++- .../components}/ConfigureRoomScaffold.kt | 12 +- .../components}/ConfigureRoomTopBar.kt | 4 +- .../components}/ErrorIconButton.kt | 2 +- .../components}/ErrorText.kt | 2 +- .../components}/LoadingText.kt | 2 +- .../utils}/LocalizableError.kt | 3 +- .../{ => login}/activities/LoginActivity.kt | 4 +- .../login/components/LoginForm.kt | 13 +- .../login/components/LoginScaffold.kt | 4 +- .../login/components/LoginTopBar.kt | 4 +- .../components}/PasswordField.kt | 2 +- .../login/effects/manageLogin.kt | 10 +- .../{ => main}/activities/MainActivity.kt | 12 +- .../components}/AccountIconButton.kt | 8 +- .../main => main/components}/CreateRoomFAB.kt | 4 +- .../components}/MainContentLoggedIn.kt | 12 +- .../components}/MainContentNotLoggedIn.kt | 5 +- .../main => main/components}/MainScaffold.kt | 8 +- .../main => main/components}/MainTopBar.kt | 2 +- .../main => main/components}/RoomListItem.kt | 12 +- .../complocals}/LocalSession.kt | 2 +- .../utils/TwoMMatrix.kt} | 7 +- .../TwoMRoomDisplayNameFallbackProvider.kt | 2 +- .../components}/BackIconButton.kt | 2 +- .../theme => theme/components}/TwoMTheme.kt | 2 +- .../theme => theme/utils}/LaterColorRole.kt | 2 +- .../theme => theme/utils}/MaybeColorRole.kt | 2 +- .../theme => theme/utils}/NowayColorRole.kt | 2 +- .../theme => theme/utils}/NullishColorRole.kt | 2 +- .../theme => theme/utils}/StaticColorRole.kt | 2 +- .../theme => theme/utils}/SureColorRole.kt | 2 +- .../eu/steffo/twom/theme/utils/basePadding.kt | 10 ++ .../utils/chipPadding.kt} | 7 +- .../eu/steffo/twom/utils/BitmapUtilities.kt | 130 ------------------ .../activities/ViewRoomActivity.kt | 8 +- .../complocals}/LocalRoom.kt | 2 +- .../complocals}/LocalRoomSummary.kt | 2 +- .../components}/InviteFAB.kt | 3 +- .../components}/InviteSheet.kt | 4 +- .../components}/InviteUserForm.kt | 13 +- .../components}/MemberListItem.kt | 14 +- .../components}/RSVPChip.kt | 4 +- .../components}/RSVPChipRow.kt | 6 +- .../components}/RSVPCommentField.kt | 4 +- .../components}/RSVPForm.kt | 10 +- .../components}/RSVPUpdateButton.kt | 4 +- .../components}/RoomIconButton.kt | 12 +- .../components}/UnclippedIconButtonlike.kt | 2 +- .../components}/ViewRoomContent.kt | 6 +- .../components}/ViewRoomForm.kt | 16 ++- .../components}/ViewRoomMembers.kt | 9 +- .../components}/ViewRoomScaffold.kt | 8 +- .../components}/ViewRoomTopBar.kt | 9 +- .../components}/ViewRoomTopic.kt | 9 +- .../effects}/observeRSVP.kt | 14 +- .../viewroom/effects/resolveUser.kt | 4 +- .../steffo/twom/{ => viewroom}/utils/RSVP.kt | 4 +- .../twom/{ => viewroom}/utils/RSVPAnswer.kt | 16 +-- 76 files changed, 376 insertions(+), 337 deletions(-) rename app/src/main/java/eu/steffo/twom/{composables => }/avatar/components/AvatarEmpty.kt (95%) rename app/src/main/java/eu/steffo/twom/{composables => }/avatar/components/AvatarImage.kt (96%) rename app/src/main/java/eu/steffo/twom/{composables => }/avatar/components/AvatarURL.kt (80%) rename app/src/main/java/eu/steffo/twom/{composables => }/avatar/components/AvatarUser.kt (94%) rename app/src/main/java/eu/steffo/twom/{composables => }/avatar/components/AvatarUserId.kt (85%) rename app/src/main/java/eu/steffo/twom/{composables => }/avatar/effects/avatarUrlFromUserId.kt (93%) rename app/src/main/java/eu/steffo/twom/{composables/avatar/effects/bitmapFromMatrixFile.kt => avatar/effects/bitmapFromMatrixUrl.kt} (82%) create mode 100644 app/src/main/java/eu/steffo/twom/avatar/utils/getSqOrBitmapFromFile.kt create mode 100644 app/src/main/java/eu/steffo/twom/avatar/utils/getSqOrBitmapFromStreams.kt create mode 100644 app/src/main/java/eu/steffo/twom/avatar/utils/getSqOrBitmapFromUri.kt create mode 100644 app/src/main/java/eu/steffo/twom/avatar/utils/readExifOrientation.kt create mode 100644 app/src/main/java/eu/steffo/twom/avatar/utils/readRawBitmap.kt create mode 100644 app/src/main/java/eu/steffo/twom/avatar/utils/squareAndOrient.kt create mode 100644 app/src/main/java/eu/steffo/twom/avatar/utils/toCachedFile.kt rename app/src/main/java/eu/steffo/twom/{composables/avatar/picker => avatarpicker/components}/AvatarPickerWrapbox.kt (87%) rename app/src/main/java/eu/steffo/twom/{ => configureroom}/activities/ConfigureRoomActivity.kt (96%) rename app/src/main/java/eu/steffo/twom/{composables/configureroom => configureroom/components}/ConfigureRoomForm.kt (89%) rename app/src/main/java/eu/steffo/twom/{composables/configureroom => configureroom/components}/ConfigureRoomScaffold.kt (71%) rename app/src/main/java/eu/steffo/twom/{composables/configureroom => configureroom/components}/ConfigureRoomTopBar.kt (89%) rename app/src/main/java/eu/steffo/twom/{composables/errorhandling => errorhandling/components}/ErrorIconButton.kt (97%) rename app/src/main/java/eu/steffo/twom/{composables/errorhandling => errorhandling/components}/ErrorText.kt (93%) rename app/src/main/java/eu/steffo/twom/{composables/errorhandling => errorhandling/components}/LoadingText.kt (93%) rename app/src/main/java/eu/steffo/twom/{composables/errorhandling => errorhandling/utils}/LocalizableError.kt (93%) rename app/src/main/java/eu/steffo/twom/{ => login}/activities/LoginActivity.kt (88%) rename app/src/main/java/eu/steffo/twom/{composables => }/login/components/LoginForm.kt (90%) rename app/src/main/java/eu/steffo/twom/{composables => }/login/components/LoginScaffold.kt (91%) rename app/src/main/java/eu/steffo/twom/{composables => }/login/components/LoginTopBar.kt (85%) rename app/src/main/java/eu/steffo/twom/{composables/fields => login/components}/PasswordField.kt (98%) rename app/src/main/java/eu/steffo/twom/{composables => }/login/effects/manageLogin.kt (91%) rename app/src/main/java/eu/steffo/twom/{ => main}/activities/MainActivity.kt (95%) rename app/src/main/java/eu/steffo/twom/{composables/main => main/components}/AccountIconButton.kt (93%) rename app/src/main/java/eu/steffo/twom/{composables/main => main/components}/CreateRoomFAB.kt (92%) rename app/src/main/java/eu/steffo/twom/{composables/main => main/components}/MainContentLoggedIn.kt (82%) rename app/src/main/java/eu/steffo/twom/{composables/main => main/components}/MainContentNotLoggedIn.kt (85%) rename app/src/main/java/eu/steffo/twom/{composables/main => main/components}/MainScaffold.kt (87%) rename app/src/main/java/eu/steffo/twom/{composables/main => main/components}/MainTopBar.kt (95%) rename app/src/main/java/eu/steffo/twom/{composables/main => main/components}/RoomListItem.kt (94%) rename app/src/main/java/eu/steffo/twom/{composables/matrix => matrix/complocals}/LocalSession.kt (80%) rename app/src/main/java/eu/steffo/twom/{utils/TwoMGlobals.kt => matrix/utils/TwoMMatrix.kt} (96%) rename app/src/main/java/eu/steffo/twom/{ => matrix}/utils/TwoMRoomDisplayNameFallbackProvider.kt (97%) rename app/src/main/java/eu/steffo/twom/{composables/navigation => navigation/components}/BackIconButton.kt (95%) rename app/src/main/java/eu/steffo/twom/{composables/theme => theme/components}/TwoMTheme.kt (97%) rename app/src/main/java/eu/steffo/twom/{composables/theme => theme/utils}/LaterColorRole.kt (92%) rename app/src/main/java/eu/steffo/twom/{composables/theme => theme/utils}/MaybeColorRole.kt (92%) rename app/src/main/java/eu/steffo/twom/{composables/theme => theme/utils}/NowayColorRole.kt (92%) rename app/src/main/java/eu/steffo/twom/{composables/theme => theme/utils}/NullishColorRole.kt (92%) rename app/src/main/java/eu/steffo/twom/{composables/theme => theme/utils}/StaticColorRole.kt (97%) rename app/src/main/java/eu/steffo/twom/{composables/theme => theme/utils}/SureColorRole.kt (92%) create mode 100644 app/src/main/java/eu/steffo/twom/theme/utils/basePadding.kt rename app/src/main/java/eu/steffo/twom/{composables/theme/TwoMPadding.kt => theme/utils/chipPadding.kt} (64%) delete mode 100644 app/src/main/java/eu/steffo/twom/utils/BitmapUtilities.kt rename app/src/main/java/eu/steffo/twom/{ => viewroom}/activities/ViewRoomActivity.kt (86%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/complocals}/LocalRoom.kt (82%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/complocals}/LocalRoomSummary.kt (85%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/InviteFAB.kt (90%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/InviteSheet.kt (95%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/InviteUserForm.kt (89%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/MemberListItem.kt (92%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/RSVPChip.kt (95%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/RSVPChipRow.kt (93%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/RSVPCommentField.kt (94%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/RSVPForm.kt (87%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/RSVPUpdateButton.kt (91%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/RoomIconButton.kt (92%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/UnclippedIconButtonlike.kt (94%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/ViewRoomContent.kt (85%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/ViewRoomForm.kt (90%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/ViewRoomMembers.kt (85%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/ViewRoomScaffold.kt (90%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/ViewRoomTopBar.kt (82%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/components}/ViewRoomTopic.kt (79%) rename app/src/main/java/eu/steffo/twom/{composables/viewroom => viewroom/effects}/observeRSVP.kt (87%) rename app/src/main/java/eu/steffo/twom/{composables => }/viewroom/effects/resolveUser.kt (93%) rename app/src/main/java/eu/steffo/twom/{ => viewroom}/utils/RSVP.kt (80%) rename app/src/main/java/eu/steffo/twom/{ => viewroom}/utils/RSVPAnswer.kt (94%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a1da7f7..9af6ee9 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -31,7 +31,7 @@ @@ -41,15 +41,15 @@ (null) } @@ -68,8 +65,7 @@ fun bitmapFromMatrixFile(url: String? = null): Bitmap? { } Log.d(TAG, "File for $url is: $file") - - bitmap = BitmapUtilities.getCorrectedBitmap(resolver, file.toUri()) + bitmap = getSqOrBitmapFromUri(file) } return bitmap diff --git a/app/src/main/java/eu/steffo/twom/avatar/utils/getSqOrBitmapFromFile.kt b/app/src/main/java/eu/steffo/twom/avatar/utils/getSqOrBitmapFromFile.kt new file mode 100644 index 0000000..b8b5b32 --- /dev/null +++ b/app/src/main/java/eu/steffo/twom/avatar/utils/getSqOrBitmapFromFile.kt @@ -0,0 +1,15 @@ +package eu.steffo.twom.avatar.utils + +import android.graphics.Bitmap +import java.io.File + +fun getSqOrBitmapFromUri(file: File): Bitmap { + file.inputStream().use { is1 -> + file.inputStream().use { is2 -> + return getSqOrBitmapFromStreams( + inputStream1 = is1, + inputStream2 = is2, + ) + } + } +} diff --git a/app/src/main/java/eu/steffo/twom/avatar/utils/getSqOrBitmapFromStreams.kt b/app/src/main/java/eu/steffo/twom/avatar/utils/getSqOrBitmapFromStreams.kt new file mode 100644 index 0000000..6a27952 --- /dev/null +++ b/app/src/main/java/eu/steffo/twom/avatar/utils/getSqOrBitmapFromStreams.kt @@ -0,0 +1,19 @@ +package eu.steffo.twom.avatar.utils + +import android.graphics.Bitmap +import readExifOrientation +import java.io.InputStream + +fun getSqOrBitmapFromStreams(inputStream1: InputStream, inputStream2: InputStream): Bitmap { + var orientation: Int + inputStream1.use { + orientation = it.readExifOrientation() + } + + lateinit var bitmap: Bitmap + inputStream2.use { + bitmap = it.readRawBitmap() + } + + return bitmap.squareAndOrient(orientation) +} diff --git a/app/src/main/java/eu/steffo/twom/avatar/utils/getSqOrBitmapFromUri.kt b/app/src/main/java/eu/steffo/twom/avatar/utils/getSqOrBitmapFromUri.kt new file mode 100644 index 0000000..d007fdd --- /dev/null +++ b/app/src/main/java/eu/steffo/twom/avatar/utils/getSqOrBitmapFromUri.kt @@ -0,0 +1,18 @@ +package eu.steffo.twom.avatar.utils + +import android.content.ContentResolver +import android.graphics.Bitmap +import android.net.Uri + +fun getSqOrBitmapFromUri(contentResolver: ContentResolver, uri: Uri): Bitmap? { + contentResolver.openInputStream(uri).use { is1 -> + is1 ?: return null + contentResolver.openInputStream(uri).use { is2 -> + is2 ?: return null + return getSqOrBitmapFromStreams( + inputStream1 = is1, + inputStream2 = is2, + ) + } + } +} diff --git a/app/src/main/java/eu/steffo/twom/avatar/utils/readExifOrientation.kt b/app/src/main/java/eu/steffo/twom/avatar/utils/readExifOrientation.kt new file mode 100644 index 0000000..3ddb947 --- /dev/null +++ b/app/src/main/java/eu/steffo/twom/avatar/utils/readExifOrientation.kt @@ -0,0 +1,6 @@ +import androidx.exifinterface.media.ExifInterface +import java.io.InputStream + +fun InputStream.readExifOrientation(): Int { + return ExifInterface(this).getAttributeInt(ExifInterface.TAG_ORIENTATION, 1) +} diff --git a/app/src/main/java/eu/steffo/twom/avatar/utils/readRawBitmap.kt b/app/src/main/java/eu/steffo/twom/avatar/utils/readRawBitmap.kt new file mode 100644 index 0000000..ec69047 --- /dev/null +++ b/app/src/main/java/eu/steffo/twom/avatar/utils/readRawBitmap.kt @@ -0,0 +1,9 @@ +package eu.steffo.twom.avatar.utils + +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import java.io.InputStream + +fun InputStream.readRawBitmap(): Bitmap { + return BitmapFactory.decodeStream(this) +} diff --git a/app/src/main/java/eu/steffo/twom/avatar/utils/squareAndOrient.kt b/app/src/main/java/eu/steffo/twom/avatar/utils/squareAndOrient.kt new file mode 100644 index 0000000..6e935b7 --- /dev/null +++ b/app/src/main/java/eu/steffo/twom/avatar/utils/squareAndOrient.kt @@ -0,0 +1,80 @@ +package eu.steffo.twom.avatar.utils + +import android.graphics.Bitmap +import android.graphics.Matrix +import androidx.exifinterface.media.ExifInterface + +fun Bitmap.squareAndOrient( + orientation: Int = ExifInterface.ORIENTATION_NORMAL +): Bitmap { + // Determine the starting points and the size to crop the image to a 1:1 square + val xStart: Int + val yStart: Int + val size: Int + if (this.width > this.height) { + yStart = 0 + xStart = (this.width - this.height) / 2 + size = this.height + } else { + xStart = 0 + yStart = (this.height - this.width) / 2 + size = this.width + } + + // Create a transformation matrix to rotate the bitmap based on the orientation + val transformationMatrix = Matrix() + + when (orientation) { + ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> { + transformationMatrix.postScale(-1f, 1f) + } + + ExifInterface.ORIENTATION_ROTATE_180 -> { + transformationMatrix.postRotate(180f) + } + + ExifInterface.ORIENTATION_FLIP_VERTICAL -> { + transformationMatrix.postScale(1f, -1f) + } + + ExifInterface.ORIENTATION_TRANSPOSE -> { + // Untested. + transformationMatrix.setValues(FloatArray(16) { + if (it == 0 || it == 6 || it == 9 || it == 15) { + 1f + } else { + 0f + } + }) + } + + ExifInterface.ORIENTATION_ROTATE_90 -> { + transformationMatrix.postRotate(90f) + } + + ExifInterface.ORIENTATION_TRANSVERSE -> { + // Untested. + transformationMatrix.setValues(FloatArray(16) { + if (it == 3 || it == 5 || it == 10 || it == 12) { + 1f + } else { + 0f + } + }) + } + + ExifInterface.ORIENTATION_ROTATE_270 -> { + transformationMatrix.postRotate(270f) + } + } + + return Bitmap.createBitmap( + this, + xStart, + yStart, + size, + size, + transformationMatrix, + true + ) +} \ No newline at end of file diff --git a/app/src/main/java/eu/steffo/twom/avatar/utils/toCachedFile.kt b/app/src/main/java/eu/steffo/twom/avatar/utils/toCachedFile.kt new file mode 100644 index 0000000..f6cfeaa --- /dev/null +++ b/app/src/main/java/eu/steffo/twom/avatar/utils/toCachedFile.kt @@ -0,0 +1,13 @@ +package eu.steffo.twom.avatar.utils + +import android.graphics.Bitmap +import java.io.File + +fun Bitmap.toCachedFile(id: String): File { + val file = File.createTempFile("bitmap_$id", ".jpg") + file.outputStream().use { + this.compress(Bitmap.CompressFormat.JPEG, 85, it) + it.flush() + } + return file +} diff --git a/app/src/main/java/eu/steffo/twom/composables/avatar/picker/AvatarPickerWrapbox.kt b/app/src/main/java/eu/steffo/twom/avatarpicker/components/AvatarPickerWrapbox.kt similarity index 87% rename from app/src/main/java/eu/steffo/twom/composables/avatar/picker/AvatarPickerWrapbox.kt rename to app/src/main/java/eu/steffo/twom/avatarpicker/components/AvatarPickerWrapbox.kt index f4c7f15..924aa27 100644 --- a/app/src/main/java/eu/steffo/twom/composables/avatar/picker/AvatarPickerWrapbox.kt +++ b/app/src/main/java/eu/steffo/twom/avatarpicker/components/AvatarPickerWrapbox.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.avatar.picker +package eu.steffo.twom.avatarpicker.components import android.graphics.Bitmap import androidx.activity.compose.rememberLauncherForActivityResult @@ -11,7 +11,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.tooling.preview.Preview -import eu.steffo.twom.utils.BitmapUtilities +import eu.steffo.twom.avatar.utils.getSqOrBitmapFromUri @OptIn(ExperimentalFoundationApi::class) @Composable @@ -29,8 +29,8 @@ fun AvatarPickerWrapbox( val launcher = rememberLauncherForActivityResult(ActivityResultContracts.PickVisualMedia()) ImageSelect@{ it ?: return@ImageSelect - val correctedBitmap = BitmapUtilities.getCorrectedBitmap(resolver, it) - onPick(correctedBitmap) + val bitmap = getSqOrBitmapFromUri(resolver, it) + onPick(bitmap) } Box( diff --git a/app/src/main/java/eu/steffo/twom/activities/ConfigureRoomActivity.kt b/app/src/main/java/eu/steffo/twom/configureroom/activities/ConfigureRoomActivity.kt similarity index 96% rename from app/src/main/java/eu/steffo/twom/activities/ConfigureRoomActivity.kt rename to app/src/main/java/eu/steffo/twom/configureroom/activities/ConfigureRoomActivity.kt index 76a2244..545a0a6 100644 --- a/app/src/main/java/eu/steffo/twom/activities/ConfigureRoomActivity.kt +++ b/app/src/main/java/eu/steffo/twom/configureroom/activities/ConfigureRoomActivity.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.activities +package eu.steffo.twom.configureroom.activities import android.content.Context import android.content.Intent @@ -7,7 +7,7 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.result.contract.ActivityResultContract -import eu.steffo.twom.composables.configureroom.ConfigureRoomScaffold +import eu.steffo.twom.configureroom.components.ConfigureRoomScaffold class ConfigureRoomActivity : ComponentActivity() { diff --git a/app/src/main/java/eu/steffo/twom/composables/configureroom/ConfigureRoomForm.kt b/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomForm.kt similarity index 89% rename from app/src/main/java/eu/steffo/twom/composables/configureroom/ConfigureRoomForm.kt rename to app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomForm.kt index 6d0a859..9dff761 100644 --- a/app/src/main/java/eu/steffo/twom/composables/configureroom/ConfigureRoomForm.kt +++ b/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomForm.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.configureroom +package eu.steffo.twom.configureroom.components import android.app.Activity import android.graphics.Bitmap @@ -30,19 +30,18 @@ import androidx.compose.ui.semantics.semantics import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import eu.steffo.twom.R -import eu.steffo.twom.activities.ConfigureRoomActivity -import eu.steffo.twom.composables.avatar.components.AvatarImage -import eu.steffo.twom.composables.avatar.components.AvatarURL -import eu.steffo.twom.composables.avatar.picker.AvatarPickerWrapbox -import eu.steffo.twom.composables.theme.basePadding -import eu.steffo.twom.utils.BitmapUtilities +import eu.steffo.twom.avatar.components.AvatarImage +import eu.steffo.twom.avatar.components.AvatarURL +import eu.steffo.twom.avatar.utils.toCachedFile +import eu.steffo.twom.avatarpicker.components.AvatarPickerWrapbox +import eu.steffo.twom.configureroom.activities.ConfigureRoomActivity +import eu.steffo.twom.theme.utils.basePadding @Composable @Preview(showBackground = true) fun ConfigureRoomForm( modifier: Modifier = Modifier, initialConfiguration: ConfigureRoomActivity.Configuration? = null, - onSubmit: (ConfigureRoomActivity.Configuration) -> Unit = {}, ) { var name by rememberSaveable { mutableStateOf(initialConfiguration?.name ?: "") } var description by rememberSaveable { mutableStateOf(initialConfiguration?.description ?: "") } @@ -118,7 +117,7 @@ fun ConfigureRoomForm( description = description, avatarUri = if (avatarBitmap != null) { Uri.fromFile( - BitmapUtilities.bitmapToCache("createAvatar", avatarBitmap!!) + avatarBitmap!!.toCachedFile("avatar") ) } else { null diff --git a/app/src/main/java/eu/steffo/twom/composables/configureroom/ConfigureRoomScaffold.kt b/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomScaffold.kt similarity index 71% rename from app/src/main/java/eu/steffo/twom/composables/configureroom/ConfigureRoomScaffold.kt rename to app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomScaffold.kt index ce91f78..677c94f 100644 --- a/app/src/main/java/eu/steffo/twom/composables/configureroom/ConfigureRoomScaffold.kt +++ b/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomScaffold.kt @@ -1,20 +1,20 @@ -package eu.steffo.twom.composables.configureroom +package eu.steffo.twom.configureroom.components import androidx.compose.foundation.layout.padding import androidx.compose.material3.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Modifier -import eu.steffo.twom.activities.ConfigureRoomActivity -import eu.steffo.twom.composables.matrix.LocalSession -import eu.steffo.twom.composables.theme.TwoMTheme -import eu.steffo.twom.utils.TwoMGlobals +import eu.steffo.twom.configureroom.activities.ConfigureRoomActivity +import eu.steffo.twom.matrix.complocals.LocalSession +import eu.steffo.twom.matrix.utils.TwoMMatrix +import eu.steffo.twom.theme.components.TwoMTheme @Composable fun ConfigureRoomScaffold( initialConfiguration: ConfigureRoomActivity.Configuration? = null, ) { - val session = TwoMGlobals.matrix.authenticationService().getLastAuthenticatedSession()!! + val session = TwoMMatrix.matrix.authenticationService().getLastAuthenticatedSession()!! TwoMTheme { CompositionLocalProvider(LocalSession provides session) { diff --git a/app/src/main/java/eu/steffo/twom/composables/configureroom/ConfigureRoomTopBar.kt b/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomTopBar.kt similarity index 89% rename from app/src/main/java/eu/steffo/twom/composables/configureroom/ConfigureRoomTopBar.kt rename to app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomTopBar.kt index 46eac96..fa08d93 100644 --- a/app/src/main/java/eu/steffo/twom/composables/configureroom/ConfigureRoomTopBar.kt +++ b/app/src/main/java/eu/steffo/twom/configureroom/components/ConfigureRoomTopBar.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.configureroom +package eu.steffo.twom.configureroom.components import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text @@ -8,7 +8,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R -import eu.steffo.twom.composables.navigation.BackIconButton +import eu.steffo.twom.navigation.components.BackIconButton @OptIn(ExperimentalMaterial3Api::class) @Composable diff --git a/app/src/main/java/eu/steffo/twom/composables/errorhandling/ErrorIconButton.kt b/app/src/main/java/eu/steffo/twom/errorhandling/components/ErrorIconButton.kt similarity index 97% rename from app/src/main/java/eu/steffo/twom/composables/errorhandling/ErrorIconButton.kt rename to app/src/main/java/eu/steffo/twom/errorhandling/components/ErrorIconButton.kt index c263ea4..9c76923 100644 --- a/app/src/main/java/eu/steffo/twom/composables/errorhandling/ErrorIconButton.kt +++ b/app/src/main/java/eu/steffo/twom/errorhandling/components/ErrorIconButton.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.errorhandling +package eu.steffo.twom.errorhandling.components import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Warning diff --git a/app/src/main/java/eu/steffo/twom/composables/errorhandling/ErrorText.kt b/app/src/main/java/eu/steffo/twom/errorhandling/components/ErrorText.kt similarity index 93% rename from app/src/main/java/eu/steffo/twom/composables/errorhandling/ErrorText.kt rename to app/src/main/java/eu/steffo/twom/errorhandling/components/ErrorText.kt index 08d921f..c850003 100644 --- a/app/src/main/java/eu/steffo/twom/composables/errorhandling/ErrorText.kt +++ b/app/src/main/java/eu/steffo/twom/errorhandling/components/ErrorText.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.errorhandling +package eu.steffo.twom.errorhandling.components import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.MaterialTheme diff --git a/app/src/main/java/eu/steffo/twom/composables/errorhandling/LoadingText.kt b/app/src/main/java/eu/steffo/twom/errorhandling/components/LoadingText.kt similarity index 93% rename from app/src/main/java/eu/steffo/twom/composables/errorhandling/LoadingText.kt rename to app/src/main/java/eu/steffo/twom/errorhandling/components/LoadingText.kt index 60e5d0b..7a770e0 100644 --- a/app/src/main/java/eu/steffo/twom/composables/errorhandling/LoadingText.kt +++ b/app/src/main/java/eu/steffo/twom/errorhandling/components/LoadingText.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.errorhandling +package eu.steffo.twom.errorhandling.components import androidx.compose.material3.LocalContentColor import androidx.compose.material3.LocalTextStyle diff --git a/app/src/main/java/eu/steffo/twom/composables/errorhandling/LocalizableError.kt b/app/src/main/java/eu/steffo/twom/errorhandling/utils/LocalizableError.kt similarity index 93% rename from app/src/main/java/eu/steffo/twom/composables/errorhandling/LocalizableError.kt rename to app/src/main/java/eu/steffo/twom/errorhandling/utils/LocalizableError.kt index 3fbfca0..9893d26 100644 --- a/app/src/main/java/eu/steffo/twom/composables/errorhandling/LocalizableError.kt +++ b/app/src/main/java/eu/steffo/twom/errorhandling/utils/LocalizableError.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.errorhandling +package eu.steffo.twom.errorhandling.utils import android.util.Log import androidx.annotation.StringRes @@ -6,6 +6,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource +import eu.steffo.twom.errorhandling.components.ErrorText import kotlinx.coroutines.CancellationException private const val TAG = "LocalizableError" diff --git a/app/src/main/java/eu/steffo/twom/activities/LoginActivity.kt b/app/src/main/java/eu/steffo/twom/login/activities/LoginActivity.kt similarity index 88% rename from app/src/main/java/eu/steffo/twom/activities/LoginActivity.kt rename to app/src/main/java/eu/steffo/twom/login/activities/LoginActivity.kt index 8c1a41f..8ae9403 100644 --- a/app/src/main/java/eu/steffo/twom/activities/LoginActivity.kt +++ b/app/src/main/java/eu/steffo/twom/login/activities/LoginActivity.kt @@ -1,11 +1,11 @@ -package eu.steffo.twom.activities +package eu.steffo.twom.login.activities import android.content.Context import android.content.Intent import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.result.contract.ActivityResultContract -import eu.steffo.twom.composables.login.components.LoginScaffold +import eu.steffo.twom.login.components.LoginScaffold class LoginActivity : ComponentActivity() { diff --git a/app/src/main/java/eu/steffo/twom/composables/login/components/LoginForm.kt b/app/src/main/java/eu/steffo/twom/login/components/LoginForm.kt similarity index 90% rename from app/src/main/java/eu/steffo/twom/composables/login/components/LoginForm.kt rename to app/src/main/java/eu/steffo/twom/login/components/LoginForm.kt index d713ea4..64c2e3a 100644 --- a/app/src/main/java/eu/steffo/twom/composables/login/components/LoginForm.kt +++ b/app/src/main/java/eu/steffo/twom/login/components/LoginForm.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.login.components +package eu.steffo.twom.login.components import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -19,12 +19,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R -import eu.steffo.twom.composables.errorhandling.Display -import eu.steffo.twom.composables.errorhandling.ErrorText -import eu.steffo.twom.composables.fields.PasswordField -import eu.steffo.twom.composables.login.effects.LoginStep -import eu.steffo.twom.composables.login.effects.manageLogin -import eu.steffo.twom.composables.theme.basePadding +import eu.steffo.twom.errorhandling.components.ErrorText +import eu.steffo.twom.errorhandling.utils.Display +import eu.steffo.twom.login.effects.LoginStep +import eu.steffo.twom.login.effects.manageLogin +import eu.steffo.twom.theme.utils.basePadding import kotlinx.coroutines.launch import org.matrix.android.sdk.api.session.Session diff --git a/app/src/main/java/eu/steffo/twom/composables/login/components/LoginScaffold.kt b/app/src/main/java/eu/steffo/twom/login/components/LoginScaffold.kt similarity index 91% rename from app/src/main/java/eu/steffo/twom/composables/login/components/LoginScaffold.kt rename to app/src/main/java/eu/steffo/twom/login/components/LoginScaffold.kt index e8bd166..16a372c 100644 --- a/app/src/main/java/eu/steffo/twom/composables/login/components/LoginScaffold.kt +++ b/app/src/main/java/eu/steffo/twom/login/components/LoginScaffold.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.login.components +package eu.steffo.twom.login.components import android.app.Activity import android.content.Intent @@ -9,7 +9,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.tooling.preview.Preview -import eu.steffo.twom.composables.theme.TwoMTheme +import eu.steffo.twom.theme.components.TwoMTheme import org.matrix.android.sdk.api.session.Session diff --git a/app/src/main/java/eu/steffo/twom/composables/login/components/LoginTopBar.kt b/app/src/main/java/eu/steffo/twom/login/components/LoginTopBar.kt similarity index 85% rename from app/src/main/java/eu/steffo/twom/composables/login/components/LoginTopBar.kt rename to app/src/main/java/eu/steffo/twom/login/components/LoginTopBar.kt index ffc0883..5af05a5 100644 --- a/app/src/main/java/eu/steffo/twom/composables/login/components/LoginTopBar.kt +++ b/app/src/main/java/eu/steffo/twom/login/components/LoginTopBar.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.login.components +package eu.steffo.twom.login.components import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text @@ -8,7 +8,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R -import eu.steffo.twom.composables.navigation.BackIconButton +import eu.steffo.twom.navigation.components.BackIconButton @OptIn(ExperimentalMaterial3Api::class) @Composable diff --git a/app/src/main/java/eu/steffo/twom/composables/fields/PasswordField.kt b/app/src/main/java/eu/steffo/twom/login/components/PasswordField.kt similarity index 98% rename from app/src/main/java/eu/steffo/twom/composables/fields/PasswordField.kt rename to app/src/main/java/eu/steffo/twom/login/components/PasswordField.kt index f6e6c0e..7795ce1 100644 --- a/app/src/main/java/eu/steffo/twom/composables/fields/PasswordField.kt +++ b/app/src/main/java/eu/steffo/twom/login/components/PasswordField.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.fields +package eu.steffo.twom.login.components import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.RemoveRedEye diff --git a/app/src/main/java/eu/steffo/twom/composables/login/effects/manageLogin.kt b/app/src/main/java/eu/steffo/twom/login/effects/manageLogin.kt similarity index 91% rename from app/src/main/java/eu/steffo/twom/composables/login/effects/manageLogin.kt rename to app/src/main/java/eu/steffo/twom/login/effects/manageLogin.kt index eb29fee..74ebb69 100644 --- a/app/src/main/java/eu/steffo/twom/composables/login/effects/manageLogin.kt +++ b/app/src/main/java/eu/steffo/twom/login/effects/manageLogin.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.login.effects +package eu.steffo.twom.login.effects import android.util.Log import androidx.compose.runtime.Composable @@ -7,9 +7,9 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import eu.steffo.twom.R -import eu.steffo.twom.composables.errorhandling.LocalizableError -import eu.steffo.twom.composables.errorhandling.capture -import eu.steffo.twom.utils.TwoMGlobals +import eu.steffo.twom.errorhandling.utils.LocalizableError +import eu.steffo.twom.errorhandling.utils.capture +import eu.steffo.twom.matrix.utils.TwoMMatrix import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig import org.matrix.android.sdk.api.auth.wellknown.WellknownResult import org.matrix.android.sdk.api.session.Session @@ -43,7 +43,7 @@ fun manageLogin(): LoginManager { Log.d(TAG, "Resetting authentication service...") step = LoginStep.RESET - val auth = TwoMGlobals.matrix.authenticationService() + val auth = TwoMMatrix.matrix.authenticationService() error.capture(R.string.login_error_wellknown_generic) { auth.reset() } ?: return null diff --git a/app/src/main/java/eu/steffo/twom/activities/MainActivity.kt b/app/src/main/java/eu/steffo/twom/main/activities/MainActivity.kt similarity index 95% rename from app/src/main/java/eu/steffo/twom/activities/MainActivity.kt rename to app/src/main/java/eu/steffo/twom/main/activities/MainActivity.kt index e913e63..60727ad 100644 --- a/app/src/main/java/eu/steffo/twom/activities/MainActivity.kt +++ b/app/src/main/java/eu/steffo/twom/main/activities/MainActivity.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.activities +package eu.steffo.twom.main.activities import android.os.Bundle import android.util.Log @@ -6,8 +6,8 @@ import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.core.net.toFile import androidx.lifecycle.lifecycleScope -import eu.steffo.twom.composables.main.MainScaffold -import eu.steffo.twom.utils.TwoMGlobals +import eu.steffo.twom.main.components.MainScaffold +import eu.steffo.twom.matrix.utils.TwoMMatrix import kotlinx.coroutines.launch import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.room.model.create.CreateRoomParams @@ -21,7 +21,7 @@ class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - TwoMGlobals.ensureMatrix(applicationContext) + TwoMMatrix.ensureMatrix(applicationContext) fetchLastSession() openSession() @@ -36,7 +36,7 @@ class MainActivity : ComponentActivity() { private fun fetchLastSession() { Log.d("Main", "Fetching the last successfully authenticated session...") - session = TwoMGlobals.matrix.authenticationService().getLastAuthenticatedSession() + session = TwoMMatrix.matrix.authenticationService().getLastAuthenticatedSession() } private fun openSession() { @@ -113,7 +113,7 @@ class MainActivity : ComponentActivity() { createRoomParams.name = name createRoomParams.topic = description createRoomParams.preset = CreateRoomPreset.PRESET_PRIVATE_CHAT - createRoomParams.roomType = TwoMGlobals.ROOM_TYPE + createRoomParams.roomType = TwoMMatrix.ROOM_TYPE createRoomParams.initialStates = mutableListOf( CreateRoomStateEvent( type = "m.room.power_levels", diff --git a/app/src/main/java/eu/steffo/twom/composables/main/AccountIconButton.kt b/app/src/main/java/eu/steffo/twom/main/components/AccountIconButton.kt similarity index 93% rename from app/src/main/java/eu/steffo/twom/composables/main/AccountIconButton.kt rename to app/src/main/java/eu/steffo/twom/main/components/AccountIconButton.kt index 2738812..f0ef02c 100644 --- a/app/src/main/java/eu/steffo/twom/composables/main/AccountIconButton.kt +++ b/app/src/main/java/eu/steffo/twom/main/components/AccountIconButton.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.main +package eu.steffo.twom.main.components import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.launch @@ -20,9 +20,9 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R -import eu.steffo.twom.activities.LoginActivity -import eu.steffo.twom.composables.avatar.components.AvatarUserId -import eu.steffo.twom.composables.matrix.LocalSession +import eu.steffo.twom.avatar.components.AvatarUserId +import eu.steffo.twom.login.activities.LoginActivity +import eu.steffo.twom.matrix.complocals.LocalSession @Composable @Preview(showBackground = true) diff --git a/app/src/main/java/eu/steffo/twom/composables/main/CreateRoomFAB.kt b/app/src/main/java/eu/steffo/twom/main/components/CreateRoomFAB.kt similarity index 92% rename from app/src/main/java/eu/steffo/twom/composables/main/CreateRoomFAB.kt rename to app/src/main/java/eu/steffo/twom/main/components/CreateRoomFAB.kt index 6a00579..3499181 100644 --- a/app/src/main/java/eu/steffo/twom/composables/main/CreateRoomFAB.kt +++ b/app/src/main/java/eu/steffo/twom/main/components/CreateRoomFAB.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.main +package eu.steffo.twom.main.components import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.launch @@ -12,7 +12,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R -import eu.steffo.twom.activities.ConfigureRoomActivity +import eu.steffo.twom.configureroom.activities.ConfigureRoomActivity @Composable @Preview diff --git a/app/src/main/java/eu/steffo/twom/composables/main/MainContentLoggedIn.kt b/app/src/main/java/eu/steffo/twom/main/components/MainContentLoggedIn.kt similarity index 82% rename from app/src/main/java/eu/steffo/twom/composables/main/MainContentLoggedIn.kt rename to app/src/main/java/eu/steffo/twom/main/components/MainContentLoggedIn.kt index 9605cbc..35731e6 100644 --- a/app/src/main/java/eu/steffo/twom/composables/main/MainContentLoggedIn.kt +++ b/app/src/main/java/eu/steffo/twom/main/components/MainContentLoggedIn.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.main +package eu.steffo.twom.main.components import androidx.compose.foundation.layout.Column import androidx.compose.material3.Text @@ -8,10 +8,10 @@ import androidx.compose.runtime.livedata.observeAsState import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import eu.steffo.twom.R -import eu.steffo.twom.composables.errorhandling.ErrorText -import eu.steffo.twom.composables.matrix.LocalSession -import eu.steffo.twom.composables.theme.basePadding -import eu.steffo.twom.utils.TwoMGlobals +import eu.steffo.twom.errorhandling.components.ErrorText +import eu.steffo.twom.matrix.complocals.LocalSession +import eu.steffo.twom.matrix.utils.TwoMMatrix +import eu.steffo.twom.theme.utils.basePadding import org.matrix.android.sdk.api.session.room.model.Membership import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams @@ -30,7 +30,7 @@ fun MainContentLoggedIn( val roomSummaries by session.roomService().getRoomSummariesLive( roomSummaryQueryParams { this.memberships = listOf(Membership.JOIN, Membership.INVITE) - this.includeType = listOf(TwoMGlobals.ROOM_TYPE) + this.includeType = listOf(TwoMMatrix.ROOM_TYPE) } ).observeAsState() diff --git a/app/src/main/java/eu/steffo/twom/composables/main/MainContentNotLoggedIn.kt b/app/src/main/java/eu/steffo/twom/main/components/MainContentNotLoggedIn.kt similarity index 85% rename from app/src/main/java/eu/steffo/twom/composables/main/MainContentNotLoggedIn.kt rename to app/src/main/java/eu/steffo/twom/main/components/MainContentNotLoggedIn.kt index 9531b04..0a432b5 100644 --- a/app/src/main/java/eu/steffo/twom/composables/main/MainContentNotLoggedIn.kt +++ b/app/src/main/java/eu/steffo/twom/main/components/MainContentNotLoggedIn.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.main +package eu.steffo.twom.main.components import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -8,13 +8,12 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R -import eu.steffo.twom.composables.theme.basePadding +import eu.steffo.twom.theme.utils.basePadding @Composable @Preview(showBackground = true) fun MainContentNotLoggedIn( modifier: Modifier = Modifier, - onClickLogin: () -> Unit = {}, ) { Column(modifier) { Row(Modifier.basePadding()) { diff --git a/app/src/main/java/eu/steffo/twom/composables/main/MainScaffold.kt b/app/src/main/java/eu/steffo/twom/main/components/MainScaffold.kt similarity index 87% rename from app/src/main/java/eu/steffo/twom/composables/main/MainScaffold.kt rename to app/src/main/java/eu/steffo/twom/main/components/MainScaffold.kt index 6aecb04..621090b 100644 --- a/app/src/main/java/eu/steffo/twom/composables/main/MainScaffold.kt +++ b/app/src/main/java/eu/steffo/twom/main/components/MainScaffold.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.main +package eu.steffo.twom.main.components import androidx.compose.foundation.layout.padding import androidx.compose.material3.Scaffold @@ -6,9 +6,9 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview -import eu.steffo.twom.activities.ConfigureRoomActivity -import eu.steffo.twom.composables.matrix.LocalSession -import eu.steffo.twom.composables.theme.TwoMTheme +import eu.steffo.twom.configureroom.activities.ConfigureRoomActivity +import eu.steffo.twom.matrix.complocals.LocalSession +import eu.steffo.twom.theme.components.TwoMTheme import org.matrix.android.sdk.api.session.Session @Composable diff --git a/app/src/main/java/eu/steffo/twom/composables/main/MainTopBar.kt b/app/src/main/java/eu/steffo/twom/main/components/MainTopBar.kt similarity index 95% rename from app/src/main/java/eu/steffo/twom/composables/main/MainTopBar.kt rename to app/src/main/java/eu/steffo/twom/main/components/MainTopBar.kt index f6f4973..ba3a4b0 100644 --- a/app/src/main/java/eu/steffo/twom/composables/main/MainTopBar.kt +++ b/app/src/main/java/eu/steffo/twom/main/components/MainTopBar.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.main +package eu.steffo.twom.main.components import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.ExperimentalMaterial3Api diff --git a/app/src/main/java/eu/steffo/twom/composables/main/RoomListItem.kt b/app/src/main/java/eu/steffo/twom/main/components/RoomListItem.kt similarity index 94% rename from app/src/main/java/eu/steffo/twom/composables/main/RoomListItem.kt rename to app/src/main/java/eu/steffo/twom/main/components/RoomListItem.kt index 0655ed1..c824ffa 100644 --- a/app/src/main/java/eu/steffo/twom/composables/main/RoomListItem.kt +++ b/app/src/main/java/eu/steffo/twom/main/components/RoomListItem.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.main +package eu.steffo.twom.main.components import android.util.Log import androidx.activity.compose.rememberLauncherForActivityResult @@ -24,11 +24,11 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import eu.steffo.twom.R -import eu.steffo.twom.activities.ViewRoomActivity -import eu.steffo.twom.composables.avatar.components.AvatarURL -import eu.steffo.twom.composables.errorhandling.ErrorText -import eu.steffo.twom.composables.errorhandling.LocalizableError -import eu.steffo.twom.composables.matrix.LocalSession +import eu.steffo.twom.avatar.components.AvatarURL +import eu.steffo.twom.errorhandling.components.ErrorText +import eu.steffo.twom.errorhandling.utils.LocalizableError +import eu.steffo.twom.matrix.complocals.LocalSession +import eu.steffo.twom.viewroom.activities.ViewRoomActivity import kotlinx.coroutines.launch import org.matrix.android.sdk.api.session.room.model.Membership import org.matrix.android.sdk.api.session.room.model.RoomSummary diff --git a/app/src/main/java/eu/steffo/twom/composables/matrix/LocalSession.kt b/app/src/main/java/eu/steffo/twom/matrix/complocals/LocalSession.kt similarity index 80% rename from app/src/main/java/eu/steffo/twom/composables/matrix/LocalSession.kt rename to app/src/main/java/eu/steffo/twom/matrix/complocals/LocalSession.kt index a60d1fe..bcaae14 100644 --- a/app/src/main/java/eu/steffo/twom/composables/matrix/LocalSession.kt +++ b/app/src/main/java/eu/steffo/twom/matrix/complocals/LocalSession.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.matrix +package eu.steffo.twom.matrix.complocals import androidx.compose.runtime.staticCompositionLocalOf import org.matrix.android.sdk.api.session.Session diff --git a/app/src/main/java/eu/steffo/twom/utils/TwoMGlobals.kt b/app/src/main/java/eu/steffo/twom/matrix/utils/TwoMMatrix.kt similarity index 96% rename from app/src/main/java/eu/steffo/twom/utils/TwoMGlobals.kt rename to app/src/main/java/eu/steffo/twom/matrix/utils/TwoMMatrix.kt index 5d685ac..f43dbe3 100644 --- a/app/src/main/java/eu/steffo/twom/utils/TwoMGlobals.kt +++ b/app/src/main/java/eu/steffo/twom/matrix/utils/TwoMMatrix.kt @@ -1,15 +1,14 @@ -package eu.steffo.twom.utils +package eu.steffo.twom.matrix.utils import android.content.Context import android.util.Log import org.matrix.android.sdk.api.Matrix import org.matrix.android.sdk.api.MatrixConfiguration - /** * Object containing the global state of the application. */ -object TwoMGlobals { +object TwoMMatrix { /** * The global [Matrix] object of the application. * @@ -44,4 +43,4 @@ object TwoMGlobals { const val RSVP_STATE_ANSWER_FIELD = "answer" const val RSVP_STATE_COMMENT_FIELD = "comment" -} +} \ No newline at end of file diff --git a/app/src/main/java/eu/steffo/twom/utils/TwoMRoomDisplayNameFallbackProvider.kt b/app/src/main/java/eu/steffo/twom/matrix/utils/TwoMRoomDisplayNameFallbackProvider.kt similarity index 97% rename from app/src/main/java/eu/steffo/twom/utils/TwoMRoomDisplayNameFallbackProvider.kt rename to app/src/main/java/eu/steffo/twom/matrix/utils/TwoMRoomDisplayNameFallbackProvider.kt index f403ec0..b375b50 100644 --- a/app/src/main/java/eu/steffo/twom/utils/TwoMRoomDisplayNameFallbackProvider.kt +++ b/app/src/main/java/eu/steffo/twom/matrix/utils/TwoMRoomDisplayNameFallbackProvider.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.utils +package eu.steffo.twom.matrix.utils import android.content.Context import eu.steffo.twom.R diff --git a/app/src/main/java/eu/steffo/twom/composables/navigation/BackIconButton.kt b/app/src/main/java/eu/steffo/twom/navigation/components/BackIconButton.kt similarity index 95% rename from app/src/main/java/eu/steffo/twom/composables/navigation/BackIconButton.kt rename to app/src/main/java/eu/steffo/twom/navigation/components/BackIconButton.kt index 33b7d99..d0b5346 100644 --- a/app/src/main/java/eu/steffo/twom/composables/navigation/BackIconButton.kt +++ b/app/src/main/java/eu/steffo/twom/navigation/components/BackIconButton.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.navigation +package eu.steffo.twom.navigation.components import android.app.Activity import androidx.compose.material.icons.Icons diff --git a/app/src/main/java/eu/steffo/twom/composables/theme/TwoMTheme.kt b/app/src/main/java/eu/steffo/twom/theme/components/TwoMTheme.kt similarity index 97% rename from app/src/main/java/eu/steffo/twom/composables/theme/TwoMTheme.kt rename to app/src/main/java/eu/steffo/twom/theme/components/TwoMTheme.kt index 753bfdd..06df5d2 100644 --- a/app/src/main/java/eu/steffo/twom/composables/theme/TwoMTheme.kt +++ b/app/src/main/java/eu/steffo/twom/theme/components/TwoMTheme.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.theme +package eu.steffo.twom.theme.components import android.app.Activity import androidx.compose.foundation.isSystemInDarkTheme diff --git a/app/src/main/java/eu/steffo/twom/composables/theme/LaterColorRole.kt b/app/src/main/java/eu/steffo/twom/theme/utils/LaterColorRole.kt similarity index 92% rename from app/src/main/java/eu/steffo/twom/composables/theme/LaterColorRole.kt rename to app/src/main/java/eu/steffo/twom/theme/utils/LaterColorRole.kt index c40fae1..418b659 100644 --- a/app/src/main/java/eu/steffo/twom/composables/theme/LaterColorRole.kt +++ b/app/src/main/java/eu/steffo/twom/theme/utils/LaterColorRole.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.theme +package eu.steffo.twom.theme.utils import androidx.compose.ui.graphics.Color diff --git a/app/src/main/java/eu/steffo/twom/composables/theme/MaybeColorRole.kt b/app/src/main/java/eu/steffo/twom/theme/utils/MaybeColorRole.kt similarity index 92% rename from app/src/main/java/eu/steffo/twom/composables/theme/MaybeColorRole.kt rename to app/src/main/java/eu/steffo/twom/theme/utils/MaybeColorRole.kt index a163523..b0dbd9a 100644 --- a/app/src/main/java/eu/steffo/twom/composables/theme/MaybeColorRole.kt +++ b/app/src/main/java/eu/steffo/twom/theme/utils/MaybeColorRole.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.theme +package eu.steffo.twom.theme.utils import androidx.compose.ui.graphics.Color diff --git a/app/src/main/java/eu/steffo/twom/composables/theme/NowayColorRole.kt b/app/src/main/java/eu/steffo/twom/theme/utils/NowayColorRole.kt similarity index 92% rename from app/src/main/java/eu/steffo/twom/composables/theme/NowayColorRole.kt rename to app/src/main/java/eu/steffo/twom/theme/utils/NowayColorRole.kt index bb03068..bfe78da 100644 --- a/app/src/main/java/eu/steffo/twom/composables/theme/NowayColorRole.kt +++ b/app/src/main/java/eu/steffo/twom/theme/utils/NowayColorRole.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.theme +package eu.steffo.twom.theme.utils import androidx.compose.ui.graphics.Color diff --git a/app/src/main/java/eu/steffo/twom/composables/theme/NullishColorRole.kt b/app/src/main/java/eu/steffo/twom/theme/utils/NullishColorRole.kt similarity index 92% rename from app/src/main/java/eu/steffo/twom/composables/theme/NullishColorRole.kt rename to app/src/main/java/eu/steffo/twom/theme/utils/NullishColorRole.kt index 7dbd2e8..e80da07 100644 --- a/app/src/main/java/eu/steffo/twom/composables/theme/NullishColorRole.kt +++ b/app/src/main/java/eu/steffo/twom/theme/utils/NullishColorRole.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.theme +package eu.steffo.twom.theme.utils import androidx.compose.ui.graphics.Color diff --git a/app/src/main/java/eu/steffo/twom/composables/theme/StaticColorRole.kt b/app/src/main/java/eu/steffo/twom/theme/utils/StaticColorRole.kt similarity index 97% rename from app/src/main/java/eu/steffo/twom/composables/theme/StaticColorRole.kt rename to app/src/main/java/eu/steffo/twom/theme/utils/StaticColorRole.kt index 232107b..02955ce 100644 --- a/app/src/main/java/eu/steffo/twom/composables/theme/StaticColorRole.kt +++ b/app/src/main/java/eu/steffo/twom/theme/utils/StaticColorRole.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.theme +package eu.steffo.twom.theme.utils import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.runtime.Composable diff --git a/app/src/main/java/eu/steffo/twom/composables/theme/SureColorRole.kt b/app/src/main/java/eu/steffo/twom/theme/utils/SureColorRole.kt similarity index 92% rename from app/src/main/java/eu/steffo/twom/composables/theme/SureColorRole.kt rename to app/src/main/java/eu/steffo/twom/theme/utils/SureColorRole.kt index 4ae03c9..0b9f679 100644 --- a/app/src/main/java/eu/steffo/twom/composables/theme/SureColorRole.kt +++ b/app/src/main/java/eu/steffo/twom/theme/utils/SureColorRole.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.theme +package eu.steffo.twom.theme.utils import androidx.compose.ui.graphics.Color diff --git a/app/src/main/java/eu/steffo/twom/theme/utils/basePadding.kt b/app/src/main/java/eu/steffo/twom/theme/utils/basePadding.kt new file mode 100644 index 0000000..7982a36 --- /dev/null +++ b/app/src/main/java/eu/steffo/twom/theme/utils/basePadding.kt @@ -0,0 +1,10 @@ +package eu.steffo.twom.theme.utils + +import androidx.compose.foundation.layout.padding +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp + + +fun Modifier.basePadding(): Modifier { + return this.padding(all = 10.dp) +} diff --git a/app/src/main/java/eu/steffo/twom/composables/theme/TwoMPadding.kt b/app/src/main/java/eu/steffo/twom/theme/utils/chipPadding.kt similarity index 64% rename from app/src/main/java/eu/steffo/twom/composables/theme/TwoMPadding.kt rename to app/src/main/java/eu/steffo/twom/theme/utils/chipPadding.kt index aab87b3..681357e 100644 --- a/app/src/main/java/eu/steffo/twom/composables/theme/TwoMPadding.kt +++ b/app/src/main/java/eu/steffo/twom/theme/utils/chipPadding.kt @@ -1,14 +1,9 @@ -package eu.steffo.twom.composables.theme +package eu.steffo.twom.theme.utils import androidx.compose.foundation.layout.padding import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp - -fun Modifier.basePadding(): Modifier { - return this.padding(all = 10.dp) -} - fun Modifier.chipPadding(): Modifier { return this.padding(start = 2.5.dp, end = 2.5.dp) } diff --git a/app/src/main/java/eu/steffo/twom/utils/BitmapUtilities.kt b/app/src/main/java/eu/steffo/twom/utils/BitmapUtilities.kt deleted file mode 100644 index 500e2e0..0000000 --- a/app/src/main/java/eu/steffo/twom/utils/BitmapUtilities.kt +++ /dev/null @@ -1,130 +0,0 @@ -package eu.steffo.twom.utils - -import android.content.ContentResolver -import android.graphics.Bitmap -import android.graphics.BitmapFactory -import android.graphics.Matrix -import android.net.Uri -import androidx.exifinterface.media.ExifInterface -import java.io.File - -class BitmapUtilities { - companion object { - fun getOrientation(contentResolver: ContentResolver, uri: Uri): Int? { - contentResolver.openInputStream(uri).use { - if (it == null) { - return null - } else { - return ExifInterface(it).getAttributeInt(ExifInterface.TAG_ORIENTATION, 1) - } - } - } - - fun getRawBitmap(contentResolver: ContentResolver, uri: Uri): Bitmap? { - contentResolver.openInputStream(uri).use { - if (it == null) { - return null - } else { - return BitmapFactory.decodeStream(it) - } - } - } - - fun squareAndOrient( - bitmap: Bitmap, - orientation: Int = ExifInterface.ORIENTATION_NORMAL - ): Bitmap { - // Determine the starting points and the size to crop the image to a 1:1 square - val xStart: Int - val yStart: Int - val size: Int - if (bitmap.width > bitmap.height) { - yStart = 0 - xStart = (bitmap.width - bitmap.height) / 2 - size = bitmap.height - } else { - xStart = 0 - yStart = (bitmap.height - bitmap.width) / 2 - size = bitmap.width - } - - // Create a transformation matrix to rotate the bitmap based on the orientation - val transformationMatrix = Matrix() - - when (orientation) { - ExifInterface.ORIENTATION_FLIP_HORIZONTAL -> { - transformationMatrix.postScale(-1f, 1f) - } - - ExifInterface.ORIENTATION_ROTATE_180 -> { - transformationMatrix.postRotate(180f) - } - - ExifInterface.ORIENTATION_FLIP_VERTICAL -> { - transformationMatrix.postScale(1f, -1f) - } - - ExifInterface.ORIENTATION_TRANSPOSE -> { - // Untested. - transformationMatrix.setValues(FloatArray(16) { - if (it == 0 || it == 6 || it == 9 || it == 15) { - 1f - } else { - 0f - } - }) - } - - ExifInterface.ORIENTATION_ROTATE_90 -> { - transformationMatrix.postRotate(90f) - } - - ExifInterface.ORIENTATION_TRANSVERSE -> { - // Untested. - transformationMatrix.setValues(FloatArray(16) { - if (it == 3 || it == 5 || it == 10 || it == 12) { - 1f - } else { - 0f - } - }) - } - - ExifInterface.ORIENTATION_ROTATE_270 -> { - transformationMatrix.postRotate(270f) - } - } - - return Bitmap.createBitmap( - bitmap, - xStart, - yStart, - size, - size, - transformationMatrix, - true - ) - } - - fun getCorrectedBitmap(resolver: ContentResolver, uri: Uri): Bitmap? { - val rawBitmap = getRawBitmap(resolver, uri) ?: return null - val orientation = getOrientation(resolver, uri) ?: return null - return squareAndOrient(rawBitmap, orientation) - } - - fun bitmapToCache(id: String, bitmap: Bitmap): File { - val file = File.createTempFile("bitmap_$id", ".jpg") - file.outputStream().use { - bitmap.compress(Bitmap.CompressFormat.JPEG, 85, it) - it.flush() - } - return file - } - - fun bitmapFromCache(file: File): Bitmap { - file.inputStream().use { - return BitmapFactory.decodeStream(it) - } - } - } -} diff --git a/app/src/main/java/eu/steffo/twom/activities/ViewRoomActivity.kt b/app/src/main/java/eu/steffo/twom/viewroom/activities/ViewRoomActivity.kt similarity index 86% rename from app/src/main/java/eu/steffo/twom/activities/ViewRoomActivity.kt rename to app/src/main/java/eu/steffo/twom/viewroom/activities/ViewRoomActivity.kt index c6e975f..bb248b1 100644 --- a/app/src/main/java/eu/steffo/twom/activities/ViewRoomActivity.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/activities/ViewRoomActivity.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.activities +package eu.steffo.twom.viewroom.activities import android.content.Context import android.content.Intent @@ -7,8 +7,8 @@ import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.result.contract.ActivityResultContract -import eu.steffo.twom.composables.viewroom.ViewRoomScaffold -import eu.steffo.twom.utils.TwoMGlobals +import eu.steffo.twom.matrix.utils.TwoMMatrix +import eu.steffo.twom.viewroom.components.ViewRoomScaffold import org.matrix.android.sdk.api.session.Session class ViewRoomActivity : ComponentActivity() { @@ -31,7 +31,7 @@ class ViewRoomActivity : ComponentActivity() { private fun fetchLastSession() { Log.d("Main", "Fetching the last successfully authenticated session...") // FIXME: If this is null, it means that something launched this while no session was authenticated... - session = TwoMGlobals.matrix.authenticationService().getLastAuthenticatedSession()!! + session = TwoMMatrix.matrix.authenticationService().getLastAuthenticatedSession()!! } override fun onCreate(savedInstanceState: Bundle?) { diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/LocalRoom.kt b/app/src/main/java/eu/steffo/twom/viewroom/complocals/LocalRoom.kt similarity index 82% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/LocalRoom.kt rename to app/src/main/java/eu/steffo/twom/viewroom/complocals/LocalRoom.kt index 412fc4e..4cf62a5 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/LocalRoom.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/complocals/LocalRoom.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.complocals import androidx.compose.runtime.staticCompositionLocalOf import org.matrix.android.sdk.api.session.room.Room diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/LocalRoomSummary.kt b/app/src/main/java/eu/steffo/twom/viewroom/complocals/LocalRoomSummary.kt similarity index 85% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/LocalRoomSummary.kt rename to app/src/main/java/eu/steffo/twom/viewroom/complocals/LocalRoomSummary.kt index 0ace9c5..f88785a 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/LocalRoomSummary.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/complocals/LocalRoomSummary.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.complocals import androidx.compose.runtime.staticCompositionLocalOf import org.matrix.android.sdk.api.session.room.model.RoomSummary diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/InviteFAB.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/InviteFAB.kt similarity index 90% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/InviteFAB.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/InviteFAB.kt index b00fef1..191d6b9 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/InviteFAB.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/InviteFAB.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Email @@ -16,7 +16,6 @@ import eu.steffo.twom.R fun InviteFAB( modifier: Modifier = Modifier, onClick: () -> Unit = {}, - onUserSelected: (userId: String) -> Unit = {}, ) { // TODO: Hide if unprivileged ExtendedFloatingActionButton( diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/InviteSheet.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/InviteSheet.kt similarity index 95% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/InviteSheet.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/InviteSheet.kt index c2c1f83..998bdb9 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/InviteSheet.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/InviteSheet.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth @@ -15,7 +15,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import eu.steffo.twom.R -import eu.steffo.twom.composables.theme.basePadding +import eu.steffo.twom.theme.utils.basePadding import kotlinx.coroutines.launch @OptIn(ExperimentalMaterial3Api::class) diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/InviteUserForm.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/InviteUserForm.kt similarity index 89% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/InviteUserForm.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/InviteUserForm.kt index 35df895..01c2a35 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/InviteUserForm.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/InviteUserForm.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import android.util.Log import androidx.compose.foundation.layout.fillMaxWidth @@ -15,11 +15,12 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import eu.steffo.twom.R -import eu.steffo.twom.composables.errorhandling.Display -import eu.steffo.twom.composables.errorhandling.ErrorText -import eu.steffo.twom.composables.errorhandling.LoadingText -import eu.steffo.twom.composables.errorhandling.LocalizableError -import eu.steffo.twom.composables.theme.basePadding +import eu.steffo.twom.errorhandling.components.ErrorText +import eu.steffo.twom.errorhandling.components.LoadingText +import eu.steffo.twom.errorhandling.utils.Display +import eu.steffo.twom.errorhandling.utils.LocalizableError +import eu.steffo.twom.theme.utils.basePadding +import eu.steffo.twom.viewroom.complocals.LocalRoom import kotlinx.coroutines.launch import kotlin.jvm.optionals.getOrNull diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/MemberListItem.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/MemberListItem.kt similarity index 92% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/MemberListItem.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/MemberListItem.kt index 3086030..4f8d31c 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/MemberListItem.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/MemberListItem.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import android.util.Log import androidx.compose.foundation.ExperimentalFoundationApi @@ -23,11 +23,13 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import eu.steffo.twom.R -import eu.steffo.twom.composables.avatar.components.AvatarUser -import eu.steffo.twom.composables.errorhandling.ErrorText -import eu.steffo.twom.composables.matrix.LocalSession -import eu.steffo.twom.composables.viewroom.effects.resolveUser -import eu.steffo.twom.utils.RSVPAnswer +import eu.steffo.twom.avatar.components.AvatarUser +import eu.steffo.twom.errorhandling.components.ErrorText +import eu.steffo.twom.matrix.complocals.LocalSession +import eu.steffo.twom.viewroom.complocals.LocalRoom +import eu.steffo.twom.viewroom.effects.observeRSVP +import eu.steffo.twom.viewroom.effects.resolveUser +import eu.steffo.twom.viewroom.utils.RSVPAnswer import kotlinx.coroutines.launch import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary import kotlin.jvm.optionals.getOrNull diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPChip.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPChip.kt similarity index 95% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPChip.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/RSVPChip.kt index 64d653f..6e10563 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPChip.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPChip.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FilterChip @@ -10,7 +10,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import eu.steffo.twom.utils.RSVPAnswer +import eu.steffo.twom.viewroom.utils.RSVPAnswer @OptIn(ExperimentalMaterial3Api::class) @Composable diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPChipRow.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPChipRow.kt similarity index 93% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPChipRow.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/RSVPChipRow.kt index 5f208f4..4f363f2 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPChipRow.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPChipRow.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.layout.Box @@ -9,8 +9,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import eu.steffo.twom.composables.theme.chipPadding -import eu.steffo.twom.utils.RSVPAnswer +import eu.steffo.twom.theme.utils.chipPadding +import eu.steffo.twom.viewroom.utils.RSVPAnswer @Composable @Preview diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPCommentField.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPCommentField.kt similarity index 94% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPCommentField.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/RSVPCommentField.kt index c50eeb0..54e1a15 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPCommentField.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPCommentField.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField @@ -7,7 +7,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview -import eu.steffo.twom.utils.RSVPAnswer +import eu.steffo.twom.viewroom.utils.RSVPAnswer @Composable @Preview diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPForm.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPForm.kt similarity index 87% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPForm.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/RSVPForm.kt index 10833a1..660a0b3 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPForm.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPForm.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth @@ -10,10 +10,10 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import eu.steffo.twom.composables.errorhandling.LoadingText -import eu.steffo.twom.composables.theme.basePadding -import eu.steffo.twom.utils.RSVP -import eu.steffo.twom.utils.RSVPAnswer +import eu.steffo.twom.errorhandling.components.LoadingText +import eu.steffo.twom.theme.utils.basePadding +import eu.steffo.twom.viewroom.utils.RSVP +import eu.steffo.twom.viewroom.utils.RSVPAnswer @Composable fun RSVPForm( diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPUpdateButton.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPUpdateButton.kt similarity index 91% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPUpdateButton.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/RSVPUpdateButton.kt index b519f30..ee1218e 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/RSVPUpdateButton.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/RSVPUpdateButton.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults @@ -9,7 +9,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R -import eu.steffo.twom.utils.RSVPAnswer +import eu.steffo.twom.viewroom.utils.RSVPAnswer @Composable @Preview diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/RoomIconButton.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/RoomIconButton.kt similarity index 92% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/RoomIconButton.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/RoomIconButton.kt index 99be980..0fbc6c3 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/RoomIconButton.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/RoomIconButton.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import android.net.Uri import android.util.Log @@ -23,10 +23,12 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.core.net.toFile import eu.steffo.twom.R -import eu.steffo.twom.activities.ConfigureRoomActivity -import eu.steffo.twom.composables.avatar.components.AvatarURL -import eu.steffo.twom.composables.errorhandling.ErrorIconButton -import eu.steffo.twom.composables.matrix.LocalSession +import eu.steffo.twom.avatar.components.AvatarURL +import eu.steffo.twom.configureroom.activities.ConfigureRoomActivity +import eu.steffo.twom.errorhandling.components.ErrorIconButton +import eu.steffo.twom.matrix.complocals.LocalSession +import eu.steffo.twom.viewroom.complocals.LocalRoom +import eu.steffo.twom.viewroom.complocals.LocalRoomSummary import kotlinx.coroutines.launch import kotlin.jvm.optionals.getOrNull diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/UnclippedIconButtonlike.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/UnclippedIconButtonlike.kt similarity index 94% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/UnclippedIconButtonlike.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/UnclippedIconButtonlike.kt index 114ee49..24fd426 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/UnclippedIconButtonlike.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/UnclippedIconButtonlike.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomContent.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomContent.kt similarity index 85% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomContent.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomContent.kt index 8632b25..7b8c165 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomContent.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomContent.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -9,8 +9,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import eu.steffo.twom.R -import eu.steffo.twom.composables.errorhandling.ErrorText -import eu.steffo.twom.composables.matrix.LocalSession +import eu.steffo.twom.errorhandling.components.ErrorText +import eu.steffo.twom.matrix.complocals.LocalSession @Composable diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomForm.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomForm.kt similarity index 90% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomForm.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomForm.kt index 245087e..cf703d2 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomForm.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomForm.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import android.util.Log import androidx.compose.foundation.layout.Row @@ -14,12 +14,14 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import eu.steffo.twom.R -import eu.steffo.twom.composables.errorhandling.Display -import eu.steffo.twom.composables.errorhandling.ErrorText -import eu.steffo.twom.composables.errorhandling.LoadingText -import eu.steffo.twom.composables.errorhandling.LocalizableError -import eu.steffo.twom.composables.matrix.LocalSession -import eu.steffo.twom.composables.theme.basePadding +import eu.steffo.twom.errorhandling.components.ErrorText +import eu.steffo.twom.errorhandling.components.LoadingText +import eu.steffo.twom.errorhandling.utils.Display +import eu.steffo.twom.errorhandling.utils.LocalizableError +import eu.steffo.twom.matrix.complocals.LocalSession +import eu.steffo.twom.theme.utils.basePadding +import eu.steffo.twom.viewroom.complocals.LocalRoom +import eu.steffo.twom.viewroom.effects.observeRSVP import kotlinx.coroutines.launch import org.matrix.android.sdk.api.session.room.model.Membership import kotlin.jvm.optionals.getOrNull diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomMembers.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomMembers.kt similarity index 85% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomMembers.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomMembers.kt index be21602..5abf451 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomMembers.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomMembers.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.foundation.layout.Row import androidx.compose.material3.MaterialTheme @@ -9,9 +9,10 @@ import androidx.compose.runtime.livedata.observeAsState import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import eu.steffo.twom.R -import eu.steffo.twom.composables.errorhandling.ErrorText -import eu.steffo.twom.composables.errorhandling.LoadingText -import eu.steffo.twom.composables.theme.basePadding +import eu.steffo.twom.errorhandling.components.ErrorText +import eu.steffo.twom.errorhandling.components.LoadingText +import eu.steffo.twom.theme.utils.basePadding +import eu.steffo.twom.viewroom.complocals.LocalRoom import org.matrix.android.sdk.api.session.room.members.RoomMemberQueryParams import kotlin.jvm.optionals.getOrNull diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomScaffold.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomScaffold.kt similarity index 90% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomScaffold.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomScaffold.kt index b5da082..6917cae 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomScaffold.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomScaffold.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.padding @@ -13,8 +13,10 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import eu.steffo.twom.composables.matrix.LocalSession -import eu.steffo.twom.composables.theme.TwoMTheme +import eu.steffo.twom.matrix.complocals.LocalSession +import eu.steffo.twom.theme.components.TwoMTheme +import eu.steffo.twom.viewroom.complocals.LocalRoom +import eu.steffo.twom.viewroom.complocals.LocalRoomSummary import org.matrix.android.sdk.api.session.Session import java.util.Optional diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomTopBar.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomTopBar.kt similarity index 82% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomTopBar.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomTopBar.kt index 99aef88..cd882da 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomTopBar.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomTopBar.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme @@ -7,9 +7,10 @@ import androidx.compose.material3.TopAppBar import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview -import eu.steffo.twom.composables.errorhandling.ErrorText -import eu.steffo.twom.composables.errorhandling.LoadingText -import eu.steffo.twom.composables.navigation.BackIconButton +import eu.steffo.twom.errorhandling.components.ErrorText +import eu.steffo.twom.errorhandling.components.LoadingText +import eu.steffo.twom.navigation.components.BackIconButton +import eu.steffo.twom.viewroom.complocals.LocalRoomSummary @OptIn(ExperimentalMaterial3Api::class) diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomTopic.kt b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomTopic.kt similarity index 79% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomTopic.kt rename to app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomTopic.kt index af4ad59..a06096d 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/ViewRoomTopic.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/components/ViewRoomTopic.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.components import androidx.compose.foundation.layout.Row import androidx.compose.material3.MaterialTheme @@ -8,9 +8,10 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import eu.steffo.twom.R -import eu.steffo.twom.composables.errorhandling.ErrorText -import eu.steffo.twom.composables.errorhandling.LoadingText -import eu.steffo.twom.composables.theme.basePadding +import eu.steffo.twom.errorhandling.components.ErrorText +import eu.steffo.twom.errorhandling.components.LoadingText +import eu.steffo.twom.theme.utils.basePadding +import eu.steffo.twom.viewroom.complocals.LocalRoomSummary @Composable @Preview diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/observeRSVP.kt b/app/src/main/java/eu/steffo/twom/viewroom/effects/observeRSVP.kt similarity index 87% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/observeRSVP.kt rename to app/src/main/java/eu/steffo/twom/viewroom/effects/observeRSVP.kt index 95d2c6c..a82be82 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/observeRSVP.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/effects/observeRSVP.kt @@ -1,11 +1,11 @@ -package eu.steffo.twom.composables.viewroom +package eu.steffo.twom.viewroom.effects import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState -import eu.steffo.twom.utils.RSVP -import eu.steffo.twom.utils.RSVPAnswer -import eu.steffo.twom.utils.TwoMGlobals +import eu.steffo.twom.matrix.utils.TwoMMatrix +import eu.steffo.twom.viewroom.utils.RSVP +import eu.steffo.twom.viewroom.utils.RSVPAnswer import org.matrix.android.sdk.api.query.QueryStringValue import org.matrix.android.sdk.api.session.room.Room import org.matrix.android.sdk.api.session.room.model.Membership @@ -26,7 +26,7 @@ fun observeRSVP(room: Room, member: RoomMemberSummary): RSVP? { } val request by room.stateService().getStateEventLive( - eventType = TwoMGlobals.RSVP_STATE_TYPE, + eventType = TwoMMatrix.RSVP_STATE_TYPE, stateKey = QueryStringValue.Equals(member.userId), ).observeAsState() @@ -61,7 +61,7 @@ fun observeRSVP(room: Room, member: RoomMemberSummary): RSVP? { ) } - val commentField = content[TwoMGlobals.RSVP_STATE_COMMENT_FIELD] + val commentField = content[TwoMMatrix.RSVP_STATE_COMMENT_FIELD] ?: return RSVP( event = event, answer = RSVPAnswer.UNKNOWN, @@ -75,7 +75,7 @@ fun observeRSVP(room: Room, member: RoomMemberSummary): RSVP? { comment = "", ) - val answerField = content[TwoMGlobals.RSVP_STATE_ANSWER_FIELD] + val answerField = content[TwoMMatrix.RSVP_STATE_ANSWER_FIELD] ?: return RSVP( event = event, answer = RSVPAnswer.NONE, diff --git a/app/src/main/java/eu/steffo/twom/composables/viewroom/effects/resolveUser.kt b/app/src/main/java/eu/steffo/twom/viewroom/effects/resolveUser.kt similarity index 93% rename from app/src/main/java/eu/steffo/twom/composables/viewroom/effects/resolveUser.kt rename to app/src/main/java/eu/steffo/twom/viewroom/effects/resolveUser.kt index cf0dbb6..2989422 100644 --- a/app/src/main/java/eu/steffo/twom/composables/viewroom/effects/resolveUser.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/effects/resolveUser.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.composables.viewroom.effects +package eu.steffo.twom.viewroom.effects import android.util.Log import androidx.compose.runtime.Composable @@ -7,7 +7,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue -import eu.steffo.twom.composables.matrix.LocalSession +import eu.steffo.twom.matrix.complocals.LocalSession import kotlinx.coroutines.CancellationException import org.matrix.android.sdk.api.session.user.model.User diff --git a/app/src/main/java/eu/steffo/twom/utils/RSVP.kt b/app/src/main/java/eu/steffo/twom/viewroom/utils/RSVP.kt similarity index 80% rename from app/src/main/java/eu/steffo/twom/utils/RSVP.kt rename to app/src/main/java/eu/steffo/twom/viewroom/utils/RSVP.kt index cbcb703..1eab40f 100644 --- a/app/src/main/java/eu/steffo/twom/utils/RSVP.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/utils/RSVP.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.utils +package eu.steffo.twom.viewroom.utils import org.matrix.android.sdk.api.session.events.model.Event @@ -6,4 +6,4 @@ data class RSVP( val event: Event?, val answer: RSVPAnswer, val comment: String, -) +) \ No newline at end of file diff --git a/app/src/main/java/eu/steffo/twom/utils/RSVPAnswer.kt b/app/src/main/java/eu/steffo/twom/viewroom/utils/RSVPAnswer.kt similarity index 94% rename from app/src/main/java/eu/steffo/twom/utils/RSVPAnswer.kt rename to app/src/main/java/eu/steffo/twom/viewroom/utils/RSVPAnswer.kt index b1e1d24..27dfbdc 100644 --- a/app/src/main/java/eu/steffo/twom/utils/RSVPAnswer.kt +++ b/app/src/main/java/eu/steffo/twom/viewroom/utils/RSVPAnswer.kt @@ -1,4 +1,4 @@ -package eu.steffo.twom.utils +package eu.steffo.twom.viewroom.utils import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.BuildCircle @@ -13,12 +13,12 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource import eu.steffo.twom.R -import eu.steffo.twom.composables.theme.LaterColorRole -import eu.steffo.twom.composables.theme.MaybeColorRole -import eu.steffo.twom.composables.theme.NowayColorRole -import eu.steffo.twom.composables.theme.NullishColorRole -import eu.steffo.twom.composables.theme.StaticColorRole -import eu.steffo.twom.composables.theme.SureColorRole +import eu.steffo.twom.theme.utils.LaterColorRole +import eu.steffo.twom.theme.utils.MaybeColorRole +import eu.steffo.twom.theme.utils.NowayColorRole +import eu.steffo.twom.theme.utils.NullishColorRole +import eu.steffo.twom.theme.utils.StaticColorRole +import eu.steffo.twom.theme.utils.SureColorRole enum class RSVPAnswer { // Will be there! @@ -224,4 +224,4 @@ enum class RSVPAnswer { @Composable abstract fun toCommentPlaceholder(): String -} +} \ No newline at end of file