mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-25 13:13:01 +00:00
fix: add keep screen on and more end call message on back pressed / on finish
This commit is contained in:
@@ -6,6 +6,7 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.view.MenuItem
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import kotlinx.android.synthetic.main.activity_webrtc_tests.*
|
import kotlinx.android.synthetic.main.activity_webrtc_tests.*
|
||||||
@@ -28,8 +29,8 @@ class WebRtcTestsActivity: PassphraseRequiredActionBarActivity(), PeerConnection
|
|||||||
SdpObserver, RTCStatsCollectorCallback {
|
SdpObserver, RTCStatsCollectorCallback {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val HD_VIDEO_WIDTH = 320
|
const val HD_VIDEO_WIDTH = 900
|
||||||
const val HD_VIDEO_HEIGHT = 240
|
const val HD_VIDEO_HEIGHT = 1600
|
||||||
const val CALL_ID = "call_id_session"
|
const val CALL_ID = "call_id_session"
|
||||||
private const val LOCAL_TRACK_ID = "local_track"
|
private const val LOCAL_TRACK_ID = "local_track"
|
||||||
private const val LOCAL_STREAM_ID = "local_track"
|
private const val LOCAL_STREAM_ID = "local_track"
|
||||||
@@ -106,6 +107,18 @@ class WebRtcTestsActivity: PassphraseRequiredActionBarActivity(), PeerConnection
|
|||||||
connectionFactory.createPeerConnection(rtcConfig, this)!!
|
connectionFactory.createPeerConnection(rtcConfig, this)!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onBackPressed() {
|
||||||
|
endCall()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||||
|
if (item.itemId == android.R.id.home) {
|
||||||
|
endCall()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
|
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
|
||||||
super.onCreate(savedInstanceState, ready)
|
super.onCreate(savedInstanceState, ready)
|
||||||
setContentView(R.layout.activity_webrtc_tests)
|
setContentView(R.layout.activity_webrtc_tests)
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:keepScreenOn="true"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
@@ -39,27 +40,49 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
<org.webrtc.SurfaceViewRenderer
|
|
||||||
android:id="@+id/remote_renderer"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent">
|
||||||
app:layout_constraintBottom_toTopOf="@+id/halfway_guideline"
|
<org.webrtc.SurfaceViewRenderer
|
||||||
app:layout_constraintTop_toTopOf="parent"/>
|
android:id="@+id/remote_renderer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
<com.github.ybq.android.spinkit.SpinKitView
|
||||||
|
android:id="@+id/remove_loading_view"
|
||||||
|
style="@style/SpinKitView.Large.ThreeBounce"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:SpinKit_Color="@color/text"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
tools:visibility="visible"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Guideline
|
<FrameLayout
|
||||||
android:id="@+id/halfway_guideline"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_width="wrap_content"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:layout_height="wrap_content"
|
android:elevation="8dp"
|
||||||
android:orientation="horizontal"
|
app:layout_constraintDimensionRatio="h,9:16"
|
||||||
app:layout_constraintGuide_percent="0.5" />
|
android:layout_margin="@dimen/large_spacing"
|
||||||
|
app:layout_constraintWidth_percent="0.2"
|
||||||
<org.webrtc.SurfaceViewRenderer
|
|
||||||
android:id="@+id/local_renderer"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:layout_width="0dp">
|
||||||
app:layout_constraintTop_toBottomOf="@+id/halfway_guideline" />
|
<org.webrtc.SurfaceViewRenderer
|
||||||
|
android:id="@+id/local_renderer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
<com.github.ybq.android.spinkit.SpinKitView
|
||||||
|
android:id="@+id/local_loading_view"
|
||||||
|
style="@style/SpinKitView.Large.ThreeBounce"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:SpinKit_Color="@color/text"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
tools:visibility="visible"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/end_call_button"
|
android:id="@+id/end_call_button"
|
||||||
|
Reference in New Issue
Block a user