srctree

Robin Linden parent 7eef6ee7 7091b155
Add a button to go back to the chat from an ongoing call

inlinesplit
atox/src/main/kotlin/ui/call/CallFragment.kt added: 32, removed: 5, total 27
@@ -11,6 +11,7 @@ import android.util.TypedValue
import android.view.View
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.os.bundleOf
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updatePadding
@@ -47,13 +48,14 @@ class CallFragment : BaseFragment<FragmentCallBinding>(FragmentCallBinding::infl
}
 
override fun onViewCreated(view: View, savedInstanceState: Bundle?) = binding.run {
val pk = requireStringArg(CONTACT_PUBLIC_KEY)
ViewCompat.setOnApplyWindowInsetsListener(view) { _, compat ->
val insets = compat.getInsets(WindowInsetsCompat.Type.systemBars())
controlContainer.updatePadding(bottom = insets.bottom + dpToPx(16f, resources))
compat
}
 
vm.setActiveContact(PublicKey(requireStringArg(CONTACT_PUBLIC_KEY)))
vm.setActiveContact(PublicKey(pk))
vm.contact.observe(viewLifecycleOwner) {
setAvatarFromContact(callBackground, it)
}
@@ -83,6 +85,10 @@ class CallFragment : BaseFragment<FragmentCallBinding>(FragmentCallBinding::infl
}
}
 
backToChat.setOnClickListener {
findNavController().navigate(R.id.chatFragment, bundleOf(CONTACT_PUBLIC_KEY to pk))
}
 
if (vm.inCall.value is CallState.InCall) {
vm.inCall.asLiveData().observe(viewLifecycleOwner) { inCall ->
if (inCall == CallState.NotInCall) {
 
filename was Deleted added: 32, removed: 5, total 27
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM6,9h12v2L6,11L6,9zM14,14L6,14v-2h8v2zM18,8L6,8L6,6h12v2z"/>
</vector>
 
atox/src/main/res/layout/fragment_call.xml added: 32, removed: 5, total 27
@@ -38,6 +38,17 @@
android:contentDescription="@string/end_call"
android:src="@drawable/ic_call_end"
app:backgroundTint="@android:color/holo_red_dark" />
 
<ImageButton android:id="@+id/back_to_chat"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:background="@null"
android:contentDescription="@string/return_to_chat"
android:scaleType="fitCenter"
android:src="@drawable/ic_chat"/>
</RelativeLayout>
 
<com.google.android.material.imageview.ShapeableImageView android:id="@+id/user_avatar"
 
atox/src/main/res/values/strings.xml added: 32, removed: 5, total 27
@@ -175,4 +175,5 @@
<string name="passwords_must_match">The passwords must match</string>
<string name="pref_block_screenshots">Block screenshots of aTox</string>
<string name="pref_block_screenshots_description">This **only** blocks screenshots on **your** device, and provides no protection against your contacts taking screenshots or otherwise saving your conversations</string>
<string name="return_to_chat">Return to chat</string>
</resources>
No newline at end of file