From b0773514eedfb002bc29bcdb9440e749fb507101 Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Mon, 16 May 2022 10:32:34 +0200 Subject: [PATCH] Extracting LocationLiveMessageBannerViewState into separated file --- .../live/LocationLiveMessagBannerViewState.kt | 36 +++++++++++++++++++ .../live/LocationLiveMessageBannerView.kt | 19 ---------- 2 files changed, 36 insertions(+), 19 deletions(-) create mode 100644 vector/src/main/java/im/vector/app/features/location/live/LocationLiveMessagBannerViewState.kt diff --git a/vector/src/main/java/im/vector/app/features/location/live/LocationLiveMessagBannerViewState.kt b/vector/src/main/java/im/vector/app/features/location/live/LocationLiveMessagBannerViewState.kt new file mode 100644 index 0000000000..976085386b --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/location/live/LocationLiveMessagBannerViewState.kt @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.location.live + +sealed class LocationLiveMessageBannerViewState( + open val bottomStartCornerRadiusInDp: Float, + open val bottomEndCornerRadiusInDp: Float, +) { + + data class Emitter( + override val bottomStartCornerRadiusInDp: Float, + override val bottomEndCornerRadiusInDp: Float, + val remainingTimeInMillis: Long, + val isStopButtonCenteredVertically: Boolean + ) : LocationLiveMessageBannerViewState(bottomStartCornerRadiusInDp, bottomEndCornerRadiusInDp) + + data class Watcher( + override val bottomStartCornerRadiusInDp: Float, + override val bottomEndCornerRadiusInDp: Float, + val formattedLocalTimeOfEndOfLive: String, + ) : LocationLiveMessageBannerViewState(bottomStartCornerRadiusInDp, bottomEndCornerRadiusInDp) +} diff --git a/vector/src/main/java/im/vector/app/features/location/live/LocationLiveMessageBannerView.kt b/vector/src/main/java/im/vector/app/features/location/live/LocationLiveMessageBannerView.kt index bb69cdd1c2..8cb552e3c4 100644 --- a/vector/src/main/java/im/vector/app/features/location/live/LocationLiveMessageBannerView.kt +++ b/vector/src/main/java/im/vector/app/features/location/live/LocationLiveMessageBannerView.kt @@ -35,25 +35,6 @@ import im.vector.app.databinding.ViewLocationLiveMessageBannerBinding import im.vector.app.features.themes.ThemeUtils import org.threeten.bp.Duration -sealed class LocationLiveMessageBannerViewState( - open val bottomStartCornerRadiusInDp: Float, - open val bottomEndCornerRadiusInDp: Float, -) { - - data class Emitter( - override val bottomStartCornerRadiusInDp: Float, - override val bottomEndCornerRadiusInDp: Float, - val remainingTimeInMillis: Long, - val isStopButtonCenteredVertically: Boolean - ) : LocationLiveMessageBannerViewState(bottomStartCornerRadiusInDp, bottomEndCornerRadiusInDp) - - data class Watcher( - override val bottomStartCornerRadiusInDp: Float, - override val bottomEndCornerRadiusInDp: Float, - val formattedLocalTimeOfEndOfLive: String, - ) : LocationLiveMessageBannerViewState(bottomStartCornerRadiusInDp, bottomEndCornerRadiusInDp) -} - private const val REMAINING_TIME_COUNTER_INTERVAL_IN_MS = 1000L class LocationLiveMessageBannerView @JvmOverloads constructor(