mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-02-07 14:58:24 +00:00
Added green & blue toasts + animation (added copy number to clipboard feature)
This commit is contained in:
parent
2dfc8f930e
commit
fb9acf8da4
20 changed files with 583 additions and 35 deletions
|
|
@ -19,14 +19,19 @@
|
|||
*/
|
||||
package org.linphone.ui.main.contacts.fragment
|
||||
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.doOnPreDraw
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import androidx.transition.ChangeBounds
|
||||
import org.linphone.R
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.ContactFragmentBinding
|
||||
import org.linphone.ui.main.contacts.model.NumberOrAddressPickerDialogModel
|
||||
|
|
@ -34,6 +39,7 @@ import org.linphone.ui.main.contacts.viewmodel.ContactViewModel
|
|||
import org.linphone.ui.main.fragment.GenericFragment
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
import org.linphone.utils.slideInToastFromTop
|
||||
|
||||
class ContactFragment : GenericFragment() {
|
||||
private lateinit var binding: ContactFragmentBinding
|
||||
|
|
@ -91,9 +97,14 @@ class ContactFragment : GenericFragment() {
|
|||
|
||||
viewModel.showLongPressMenuForNumberOrAddressEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { model ->
|
||||
val modalBottomSheet = ContactNumberOrAddressMenuDialogFragment() {
|
||||
val modalBottomSheet = ContactNumberOrAddressMenuDialogFragment({
|
||||
// onDismiss
|
||||
model.selected.value = false
|
||||
}
|
||||
}, {
|
||||
// onCopyNumberOrAddressToClipboard
|
||||
copyNumberOrAddressToClipboard(model.displayedValue, model.isSip)
|
||||
})
|
||||
|
||||
modalBottomSheet.show(
|
||||
parentFragmentManager,
|
||||
ContactNumberOrAddressMenuDialogFragment.TAG
|
||||
|
|
@ -106,8 +117,8 @@ class ContactFragment : GenericFragment() {
|
|||
val model = NumberOrAddressPickerDialogModel(viewModel)
|
||||
val dialog = DialogUtils.getNumberOrAddressPickerDialog(requireActivity(), model)
|
||||
|
||||
model.dismissEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
model.dismissEvent.observe(viewLifecycleOwner) { event ->
|
||||
event.consume {
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
|
@ -116,4 +127,16 @@ class ContactFragment : GenericFragment() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun copyNumberOrAddressToClipboard(value: String, isSip: Boolean) {
|
||||
val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
val label = if (isSip) "SIP address" else "Phone number"
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText(label, value))
|
||||
|
||||
binding.greenToast.message.text = "Numéro copié dans le presse-papier"
|
||||
binding.greenToast.icon.setImageResource(R.drawable.check)
|
||||
|
||||
val target = binding.greenToast.root
|
||||
target.slideInToastFromTop(binding.root as ViewGroup, lifecycleScope)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
|||
import org.linphone.databinding.ContactNumberOrAddressLongPressMenuBinding
|
||||
|
||||
class ContactNumberOrAddressMenuDialogFragment(
|
||||
private val onDismiss: (() -> Unit)? = null
|
||||
private val onDismiss: (() -> Unit)? = null,
|
||||
private val onCopyNumberOrAddressToClipboard: (() -> Unit)? = null
|
||||
) : BottomSheetDialogFragment() {
|
||||
companion object {
|
||||
const val TAG = "ContactNumberOrAddressMenuDialogFragment"
|
||||
|
|
@ -51,6 +52,11 @@ class ContactNumberOrAddressMenuDialogFragment(
|
|||
): View {
|
||||
val view = ContactNumberOrAddressLongPressMenuBinding.inflate(layoutInflater)
|
||||
|
||||
view.setCopyNumberOrAddressClickListener {
|
||||
onCopyNumberOrAddressToClipboard?.invoke()
|
||||
dismiss()
|
||||
}
|
||||
|
||||
return view.root
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ class ContactsListMenuDialogFragment(
|
|||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
val view = ContactsListLongPressMenuBinding.inflate(layoutInflater)
|
||||
|
||||
return view.root
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,12 +30,14 @@ class CallViewModel() : ViewModel() {
|
|||
const val TAG = "[Call ViewModel]"
|
||||
}
|
||||
|
||||
val videoEnabled = MutableLiveData<Boolean>()
|
||||
val isVideoEnabled = MutableLiveData<Boolean>()
|
||||
|
||||
val isOutgoing = MutableLiveData<Boolean>()
|
||||
|
||||
private lateinit var call: Call
|
||||
|
||||
init {
|
||||
videoEnabled.value = false
|
||||
isVideoEnabled.value = false
|
||||
|
||||
coreContext.postOnCoreThread { core ->
|
||||
val currentCall = core.currentCall ?: core.calls.firstOrNull()
|
||||
|
|
@ -45,10 +47,11 @@ class CallViewModel() : ViewModel() {
|
|||
Log.i("$TAG Found call [$call]")
|
||||
|
||||
if (call.state == Call.State.StreamsRunning) {
|
||||
videoEnabled.postValue(call.currentParams.isVideoEnabled)
|
||||
isVideoEnabled.postValue(call.currentParams.isVideoEnabled)
|
||||
} else {
|
||||
videoEnabled.postValue(call.params.isVideoEnabled)
|
||||
isVideoEnabled.postValue(call.params.isVideoEnabled)
|
||||
}
|
||||
isOutgoing.postValue(call.dir == Call.Dir.Outgoing)
|
||||
} else {
|
||||
Log.e("$TAG Failed to find outgoing call!")
|
||||
}
|
||||
|
|
|
|||
57
app/src/main/java/org/linphone/utils/AnimationsUtils.kt
Normal file
57
app/src/main/java/org/linphone/utils/AnimationsUtils.kt
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-android
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.utils
|
||||
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.lifecycle.LifecycleCoroutineScope
|
||||
import androidx.transition.Slide
|
||||
import androidx.transition.Transition
|
||||
import androidx.transition.TransitionManager
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
fun View.slideInToastFromTop(
|
||||
root: ViewGroup,
|
||||
lifecycleScope: LifecycleCoroutineScope,
|
||||
duration: Long = 5000
|
||||
) {
|
||||
val view = this
|
||||
|
||||
val transition: Transition = Slide(Gravity.TOP)
|
||||
transition.duration = 600
|
||||
transition.addTarget(view)
|
||||
|
||||
TransitionManager.beginDelayedTransition(root, transition)
|
||||
view.visibility = View.VISIBLE
|
||||
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
delay(duration)
|
||||
withContext(Dispatchers.Main) {
|
||||
TransitionManager.beginDelayedTransition(root, transition)
|
||||
view.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
app/src/main/res/drawable/incoming_call.xml
Normal file
13
app/src/main/res/drawable/incoming_call.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:name="vector"
|
||||
android:width="18dp"
|
||||
android:height="18dp"
|
||||
android:viewportWidth="18"
|
||||
android:viewportHeight="18">
|
||||
<path
|
||||
android:name="path"
|
||||
android:pathData="M 16.5 18 C 17.328 18 18 17.328 18 16.5 C 18 15.672 17.328 15 16.5 15 L 5.121 15 L 17.561 2.561 C 18.146 1.975 18.146 1.025 17.561 0.439 C 16.975 -0.146 16.025 -0.146 15.439 0.439 L 3 12.879 L 3 1.5 C 3 0.672 2.328 0 1.5 0 C 0.672 0 0 0.672 0 1.5 L 0 16.5 C 0 17.328 0.672 18 1.5 18 L 16.5 18 Z"
|
||||
android:fillColor="#4fae80"
|
||||
android:strokeWidth="1"/>
|
||||
</vector>
|
||||
5
app/src/main/res/drawable/shape_toast_background.xml
Normal file
5
app/src/main/res/drawable/shape_toast_background.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<corners android:radius="50dp" />
|
||||
<solid android:color="@color/white"/>
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/shape_toast_blue_shadow.xml
Normal file
5
app/src/main/res/drawable/shape_toast_blue_shadow.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<corners android:radius="50dp" />
|
||||
<solid android:color="@color/trusted_blue"/>
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/shape_toast_green_shadow.xml
Normal file
5
app/src/main/res/drawable/shape_toast_green_shadow.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<corners android:radius="50dp" />
|
||||
<solid android:color="@color/green_online"/>
|
||||
</shape>
|
||||
|
|
@ -17,7 +17,8 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
android:background="@color/white"
|
||||
android:animateLayoutChanges="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
|
|
@ -77,7 +78,7 @@
|
|||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_big_size"
|
||||
android:layout_height="@dimen/avatar_big_size"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:adjustViewBounds="true"
|
||||
contactAvatar="@{viewModel.contact}"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
|
|
@ -101,7 +102,7 @@
|
|||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@{viewModel.contact.name, default=`John Doe`}"
|
||||
android:textColor="@color/gray_8"
|
||||
android:textSize="14sp"
|
||||
|
|
@ -127,7 +128,7 @@
|
|||
android:id="@+id/call"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginTop="39dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/shape_button_round"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/calls"
|
||||
|
|
@ -154,7 +155,7 @@
|
|||
android:id="@+id/chat"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginTop="39dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/shape_button_round"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/chat"
|
||||
|
|
@ -181,7 +182,7 @@
|
|||
android:id="@+id/video_call"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginTop="39dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/shape_button_round"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/video_call"
|
||||
|
|
@ -212,7 +213,7 @@
|
|||
android:padding="5dp"
|
||||
android:layout_marginStart="26dp"
|
||||
android:layout_marginEnd="26dp"
|
||||
android:layout_marginTop="45dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="Numbers & addresses"
|
||||
android:drawableEnd="@{viewModel.showNumbersAndAddresses ? @drawable/collapse : @drawable/expand, default=@drawable/collapse}"
|
||||
android:drawableTint="@color/gray_9"
|
||||
|
|
@ -229,7 +230,7 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:padding="10dp"
|
||||
android:background="@drawable/shape_round_white_background"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -242,7 +243,7 @@
|
|||
android:id="@+id/info_background"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginEnd="17dp"
|
||||
android:src="@drawable/shape_round_white_background"
|
||||
|
|
@ -289,7 +290,7 @@
|
|||
android:padding="5dp"
|
||||
android:layout_marginStart="26dp"
|
||||
android:layout_marginEnd="26dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Trust"
|
||||
android:drawableEnd="@{viewModel.showDevicesTrust ? @drawable/collapse : @drawable/expand, default=@drawable/collapse}"
|
||||
android:drawableTint="@color/gray_9"
|
||||
|
|
@ -302,7 +303,7 @@
|
|||
android:id="@+id/trust_background"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginEnd="17dp"
|
||||
android:src="@drawable/shape_round_white_background"
|
||||
|
|
@ -378,7 +379,7 @@
|
|||
android:padding="5dp"
|
||||
android:layout_marginStart="26dp"
|
||||
android:layout_marginEnd="26dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="Other actions"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -389,7 +390,7 @@
|
|||
android:id="@+id/actions_background"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginEnd="17dp"
|
||||
android:src="@drawable/shape_round_white_background"
|
||||
|
|
@ -399,13 +400,13 @@
|
|||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:id="@+id/action_edit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginEnd="17dp"
|
||||
android:text="Edit"
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:drawableStart="@drawable/edit"
|
||||
app:layout_constraintTop_toTopOf="@id/actions_background"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -422,13 +423,13 @@
|
|||
app:layout_constraintTop_toBottomOf="@+id/action_edit"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:id="@+id/action_favorite"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginEnd="17dp"
|
||||
android:text="Add to favourites"
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:drawableStart="@drawable/favorite"
|
||||
app:layout_constraintTop_toBottomOf="@id/action_edit"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -445,13 +446,13 @@
|
|||
app:layout_constraintTop_toBottomOf="@+id/action_favorite"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:id="@+id/action_share"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginEnd="17dp"
|
||||
android:text="Share"
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:drawableStart="@drawable/share"
|
||||
app:layout_constraintTop_toBottomOf="@id/action_favorite"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -468,13 +469,13 @@
|
|||
app:layout_constraintTop_toBottomOf="@+id/action_share"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:id="@+id/action_invite"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginEnd="17dp"
|
||||
android:text="Invite"
|
||||
style="@style/context_menu_action_label_style"
|
||||
android:drawableStart="@drawable/invite"
|
||||
app:layout_constraintTop_toBottomOf="@id/action_share"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -491,13 +492,13 @@
|
|||
app:layout_constraintTop_toBottomOf="@+id/action_invite"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/context_menu_danger_action_label_style"
|
||||
android:id="@+id/action_delete"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginEnd="17dp"
|
||||
android:text="Delete"
|
||||
style="@style/context_menu_danger_action_label_style"
|
||||
android:drawableStart="@drawable/delete"
|
||||
app:layout_constraintTop_toBottomOf="@id/action_invite"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -507,6 +508,19 @@
|
|||
|
||||
</ScrollView>
|
||||
|
||||
<include
|
||||
android:id="@+id/green_toast"
|
||||
android:visibility="gone"
|
||||
layout="@layout/toast_green"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
app:layout_constraintTop_toTopOf="@id/scrollView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
android:id="@+id/dialog_background_shadow"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/shape_orange_shadow"
|
||||
android:src="@drawable/shape_dialog_orange_shadow"
|
||||
app:layout_constraintBottom_toBottomOf="@id/numbers_and_addresses"
|
||||
app:layout_constraintEnd_toEndOf="@id/dialog_background"
|
||||
app:layout_constraintStart_toStartOf="@id/dialog_background"
|
||||
|
|
|
|||
76
app/src/main/res/layout/toast_blue.xml
Normal file
76
app/src/main/res/layout/toast_blue.xml
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<import type="android.graphics.Typeface" />
|
||||
<variable
|
||||
name="icon"
|
||||
type="Integer" />
|
||||
<variable
|
||||
name="message"
|
||||
type="String" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginEnd="17dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toast_background_shadow"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/shape_toast_blue_shadow"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message"
|
||||
app:layout_constraintEnd_toEndOf="@id/toast_background"
|
||||
app:layout_constraintStart_toStartOf="@id/toast_background"
|
||||
app:layout_constraintTop_toTopOf="@id/toast_background" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toast_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:src="@drawable/shape_dialog_background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message"
|
||||
app:layout_constraintEnd_toEndOf="@id/message"
|
||||
app:layout_constraintStart_toStartOf="@id/icon"
|
||||
app:layout_constraintTop_toTopOf="@id/message" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@{icon, default=@drawable/trusted}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/message"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="packed" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/message"
|
||||
style="@style/default_text_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="@{message, default=`Call is completely secured`}"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/trusted_blue"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/icon"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
77
app/src/main/res/layout/toast_green.xml
Normal file
77
app/src/main/res/layout/toast_green.xml
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<import type="android.graphics.Typeface" />
|
||||
<variable
|
||||
name="icon"
|
||||
type="Integer" />
|
||||
<variable
|
||||
name="message"
|
||||
type="String" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="17dp"
|
||||
android:layout_marginEnd="17dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toast_background_shadow"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:src="@drawable/shape_toast_green_shadow"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message"
|
||||
app:layout_constraintEnd_toEndOf="@id/toast_background"
|
||||
app:layout_constraintStart_toStartOf="@id/toast_background"
|
||||
app:layout_constraintTop_toTopOf="@id/toast_background" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toast_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:src="@drawable/shape_dialog_background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/message"
|
||||
app:layout_constraintEnd_toEndOf="@id/message"
|
||||
app:layout_constraintStart_toStartOf="@id/icon"
|
||||
app:layout_constraintTop_toTopOf="@id/message" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@{icon, default=@drawable/check}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/message"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:tint="@color/green_online" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/message"
|
||||
style="@style/default_text_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="@{message, default=`Number copied to clipboard!`}"
|
||||
android:textColor="@color/green_online"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/icon"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
133
app/src/main/res/layout/voip_active_call_fragment.xml
Normal file
133
app/src/main/res/layout/voip_active_call_fragment.xml
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:bind="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.voip.viewmodel.CallViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/in_call_black">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/call_direction_icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@{viewModel.isOutgoing ? @drawable/outgoing_call : @drawable/incoming_call, default=@drawable/outgoing_call}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/call_direction_label"
|
||||
app:layout_constraintBottom_toBottomOf="@id/call_direction_label"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_800"
|
||||
android:id="@+id/call_direction_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:text="@{viewModel.isOutgoing ? `Outgoing call` : `Incoming call`, default=`Outgoing call`}"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toEndOf="@id/call_direction_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/switch_camera"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/switch_camera"
|
||||
android:enabled="@{viewModel.isVideoEnabled()}"
|
||||
app:layout_constraintTop_toTopOf="@id/call_direction_label"
|
||||
app:layout_constraintBottom_toBottomOf="@id/call_direction_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:tint="@color/white" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/background"
|
||||
android:src="@drawable/shape_round_in_call_gray_background"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/call_direction_label"
|
||||
app:layout_constraintBottom_toTopOf="@id/bottom_bar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<include
|
||||
layout="@layout/toast_blue"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/background"/>
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_in_call_size"
|
||||
android:layout_height="@dimen/avatar_in_call_size"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
app:avatarViewInitials="SB"
|
||||
app:avatarViewInitialsBackgroundColor="@color/blue_outgoing_message"
|
||||
app:avatarViewInitialsTextColor="@color/gray_9"
|
||||
app:avatarViewInitialsTextSize="36sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewPlaceholder="@drawable/contact_avatar"
|
||||
app:avatarViewShape="circle"
|
||||
app:layout_constraintEnd_toEndOf="@id/background"
|
||||
app:layout_constraintStart_toStartOf="@id/background"
|
||||
app:layout_constraintTop_toTopOf="@id/background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/background"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="Sylvain Berfini"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="22sp"
|
||||
app:layout_constraintTop_toBottomOf="@id/avatar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/address"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="sip:sberfini@sip.linphone.org"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<include
|
||||
bind:viewModel="@{viewModel}"
|
||||
android:id="@+id/bottom_bar"
|
||||
layout="@layout/voip_call_bottom_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/toggle_video"
|
||||
android:enabled="@{viewModel.videoEnabled}"
|
||||
android:enabled="@{viewModel.isVideoEnabled}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
|
|
|
|||
131
app/src/main/res/layout/voip_incoming_call_fragment.xml
Normal file
131
app/src/main/res/layout/voip_incoming_call_fragment.xml
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:bind="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.voip.viewmodel.CallViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/in_call_black">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/call_direction_icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/incoming_call"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/call_direction_label"
|
||||
app:layout_constraintBottom_toBottomOf="@id/call_direction_label"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_800"
|
||||
android:id="@+id/call_direction_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:text="Incoming call"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toEndOf="@id/call_direction_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/background"
|
||||
android:src="@drawable/shape_round_in_call_gray_background"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/call_direction_label"
|
||||
app:layout_constraintBottom_toTopOf="@id/bottom_bar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<io.getstream.avatarview.AvatarView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="@dimen/avatar_in_call_size"
|
||||
android:layout_height="@dimen/avatar_in_call_size"
|
||||
app:avatarViewBorderWidth="0dp"
|
||||
app:avatarViewInitials="SB"
|
||||
app:avatarViewInitialsBackgroundColor="@color/blue_outgoing_message"
|
||||
app:avatarViewInitialsTextColor="@color/gray_9"
|
||||
app:avatarViewInitialsTextSize="36sp"
|
||||
app:avatarViewInitialsTextStyle="bold"
|
||||
app:avatarViewPlaceholder="@drawable/contact_avatar"
|
||||
app:avatarViewShape="circle"
|
||||
app:layout_constraintEnd_toEndOf="@id/background"
|
||||
app:layout_constraintStart_toStartOf="@id/background"
|
||||
app:layout_constraintTop_toTopOf="@id/background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/background"/>
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:indeterminate="true"
|
||||
app:indicatorColor="@color/white"
|
||||
app:layout_constraintBottom_toTopOf="@id/chronometer"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<Chronometer
|
||||
style="@style/default_text_style_300"
|
||||
android:id="@+id/chronometer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/background"
|
||||
app:layout_constraintBottom_toTopOf="@id/avatar" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style_300"
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="Sylvain Berfini"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="22sp"
|
||||
app:layout_constraintTop_toBottomOf="@id/avatar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/address"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="sip:sberfini@sip.linphone.org"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<include
|
||||
bind:viewModel="@{viewModel}"
|
||||
android:id="@+id/bottom_bar"
|
||||
layout="@layout/voip_call_bottom_bar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -44,10 +44,11 @@
|
|||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/switch_camera"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:enabled="@{viewModel.isVideoEnabled()}"
|
||||
app:layout_constraintTop_toTopOf="@id/call_direction_label"
|
||||
app:layout_constraintBottom_toBottomOf="@id/call_direction_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:tint="@color/white" />
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@
|
|||
|
||||
<dimen name="avatar_list_cell_size">45dp</dimen>
|
||||
<dimen name="avatar_favorite_list_cell_size">50dp</dimen>
|
||||
<dimen name="avatar_big_size">72dp</dimen>
|
||||
<dimen name="avatar_big_size">100dp</dimen>
|
||||
<dimen name="avatar_in_call_size">120dp</dimen>
|
||||
</resources>
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
</style>
|
||||
<style name="context_menu_action_label_style">
|
||||
<item name="android:fontFamily">@font/noto_sans</item>
|
||||
<item name="android:textSize">17sp</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textColor">@color/gray_1</item>
|
||||
<item name="android:gravity">start</item>
|
||||
<item name="android:padding">20dp</item>
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
</style>
|
||||
<style name="context_menu_danger_action_label_style">
|
||||
<item name="android:fontFamily">@font/noto_sans</item>
|
||||
<item name="android:textSize">17sp</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textColor">@color/red_danger</item>
|
||||
<item name="android:gravity">start</item>
|
||||
<item name="android:padding">20dp</item>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue