mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Implement live location promotional bottom sheet.
This commit is contained in:
parent
b37dce7da7
commit
13144f078a
1 changed files with 57 additions and 0 deletions
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment
|
||||
import im.vector.app.databinding.BottomSheetLiveLocationLabsFlagPromotionBinding
|
||||
|
||||
/**
|
||||
* Bottom sheet to warn users that feature is still in active development. Users are able to enable labs flag by using the switch in this bottom sheet.
|
||||
* This should not be shown if the user already enabled the labs flag.
|
||||
*/
|
||||
class LiveLocationLabsFlagPromotionBottomSheet
|
||||
: VectorBaseBottomSheetDialogFragment<BottomSheetLiveLocationLabsFlagPromotionBinding>() {
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): BottomSheetLiveLocationLabsFlagPromotionBinding {
|
||||
return BottomSheetLiveLocationLabsFlagPromotionBinding.inflate(inflater, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
initOkButton()
|
||||
}
|
||||
|
||||
private fun initOkButton() {
|
||||
views.promoteLiveLocationFlagOkButton.debouncedClicks {
|
||||
val enableLabsFlag = views.promoteLiveLocationFlagSwitch.isChecked
|
||||
resultListener?.onBottomSheetResult(ResultListener.RESULT_OK, enableLabsFlag)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(resultListener: ResultListener): LiveLocationLabsFlagPromotionBottomSheet {
|
||||
return LiveLocationLabsFlagPromotionBottomSheet().also {
|
||||
it.resultListener = resultListener
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue