Jitsi: add Jitsi call alert (not branched)
This commit is contained in:
parent
8e2a1d3bcd
commit
74915c1e9e
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020 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.popup
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.view.View
|
||||||
|
import im.vector.app.R
|
||||||
|
import im.vector.app.core.glide.GlideApp
|
||||||
|
import im.vector.app.databinding.AlerterJitsiCallLayoutBinding
|
||||||
|
import im.vector.app.features.home.AvatarRenderer
|
||||||
|
import org.matrix.android.sdk.api.util.MatrixItem
|
||||||
|
|
||||||
|
class JitsiCallAlert(uid: String,
|
||||||
|
override val shouldBeDisplayedIn: ((Activity) -> Boolean) = { true }
|
||||||
|
) : DefaultVectorAlert(uid, "", "", 0, shouldBeDisplayedIn) {
|
||||||
|
|
||||||
|
override val priority = PopupAlertManager.JITSI_CALL_PRIORITY
|
||||||
|
override val layoutRes = R.layout.alerter_jitsi_call_layout
|
||||||
|
override var colorAttribute: Int? = R.attr.colorSurface
|
||||||
|
override val dismissOnClick: Boolean = false
|
||||||
|
override val isLight: Boolean = true
|
||||||
|
|
||||||
|
class ViewBinder(private val matrixItem: MatrixItem?,
|
||||||
|
private val avatarRenderer: AvatarRenderer,
|
||||||
|
private val onJoin: () -> Unit) : VectorAlert.ViewBinder {
|
||||||
|
|
||||||
|
override fun bind(view: View) {
|
||||||
|
val views = AlerterJitsiCallLayoutBinding.bind(view)
|
||||||
|
views.jitsiCallNameView.text = matrixItem?.getBestName()
|
||||||
|
matrixItem?.let { avatarRenderer.render(it, views.jitsiCallAvatar, GlideApp.with(view.context.applicationContext)) }
|
||||||
|
views.jitsiCallJoinView.setOnClickListener {
|
||||||
|
onJoin()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -44,6 +44,7 @@ class PopupAlertManager @Inject constructor() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val INCOMING_CALL_PRIORITY = Int.MAX_VALUE
|
const val INCOMING_CALL_PRIORITY = Int.MAX_VALUE
|
||||||
|
const val JITSI_CALL_PRIORITY = INCOMING_CALL_PRIORITY - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
private var weakCurrentActivity: WeakReference<Activity>? = null
|
private var weakCurrentActivity: WeakReference<Activity>? = null
|
||||||
|
70
vector/src/main/res/layout/alerter_jitsi_call_layout.xml
Normal file
70
vector/src/main/res/layout/alerter_jitsi_call_layout.xml
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
tools:style="@style/AlertStyle">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/jitsiCallAvatar"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_margin="12dp"
|
||||||
|
android:contentDescription="@string/call_notification_answer"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:src="@sample/user_round_avatars" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/jitsiCallNameView"
|
||||||
|
style="@style/Widget.Vector.TextView.Subtitle"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textColor="?vctr_content_primary"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/jitsiCallJoinView"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/jitsiCallAvatar"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/jitsiCallAvatar"
|
||||||
|
tools:text="@sample/users.json/data/displayName" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/jitsiCallKindView"
|
||||||
|
style="@style/Widget.Vector.TextView.Body"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="3dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:drawablePadding="4dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="@string/call_jitsi_started"
|
||||||
|
android:textColor="?vctr_content_secondary"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/jitsiCallJoinView"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/jitsiCallNameView"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/jitsiCallNameView" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/jitsiCallJoinView"
|
||||||
|
style="@style/Widget.Vector.Button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="12dp"
|
||||||
|
android:contentDescription="@string/call_notification_answer"
|
||||||
|
android:drawableStart="@drawable/ic_call_video_small"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:text="@string/join"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -3413,5 +3413,6 @@
|
|||||||
<string name="teammate_spaces_arent_quite_ready">"Teammate spaces aren’t quite ready but you can still give them a try"</string>
|
<string name="teammate_spaces_arent_quite_ready">"Teammate spaces aren’t quite ready but you can still give them a try"</string>
|
||||||
<string name="teammate_spaces_might_not_join">"At the moment people might not be able to join any private rooms you make.\n\nWe’ll be improving this as part of the beta, but just wanted to let you know."</string>
|
<string name="teammate_spaces_might_not_join">"At the moment people might not be able to join any private rooms you make.\n\nWe’ll be improving this as part of the beta, but just wanted to let you know."</string>
|
||||||
<string name="error_failed_to_join_room">Sorry, an error occurred while trying to join: %s</string>
|
<string name="error_failed_to_join_room">Sorry, an error occurred while trying to join: %s</string>
|
||||||
|
<string name="call_jitsi_started">Group call started</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user