Extracting LocationLiveMessageBannerViewState into separated file

This commit is contained in:
Maxime NATUREL 2022-05-16 10:32:34 +02:00
parent 2aeee79c63
commit b0773514ee
2 changed files with 36 additions and 19 deletions

View File

@ -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)
}

View File

@ -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(