Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
linphone-android
Commits
11c33bb1
Commit
11c33bb1
authored
1 year ago
by
Sylvain Berfini
Browse files
Options
Download
Patches
Plain Diff
Fixed proximity sensor not turning screen off during outgoing call
parent
047665af
master
feature/5.3
feature/UZ-8
feature/show_unsecure_conversation_event_at_top
feature/use_theme_main_color_for_icon_and_splashscreen
fix/insistent_notification
fix/telecom_default_audio_endpoint
release/5.2
release/6.0
test/UZ-8-no-telecom
6.1.0-alpha
6.0.0
6.0.0-beta
6.0.0-alpha
5.3.0-alpha
5.2.5
5.2.4
5.2.3
5.2.2
5.2.1
5.2.0
2 merge requests
!1369
Translated using Weblate (Spanish)
,
!1353
Bumped version code for new beta
Pipeline
#71311
passed with stage
in 4 minutes and 7 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/main/java/org/linphone/activities/main/chat/adapters/ChatMessagesListAdapter.kt
+18
-6
.../activities/main/chat/adapters/ChatMessagesListAdapter.kt
app/src/main/java/org/linphone/activities/voip/viewmodels/ControlsViewModel.kt
+20
-0
.../linphone/activities/voip/viewmodels/ControlsViewModel.kt
with
38 additions
and
6 deletions
app/src/main/java/org/linphone/activities/main/chat/adapters/ChatMessagesListAdapter.kt
+
18
−
6
View file @
11c33bb1
...
...
@@ -217,13 +217,17 @@ class ChatMessagesListAdapter(
previousList
:
MutableList
<
EventLogData
>,
currentList
:
MutableList
<
EventLogData
>
)
{
Log
.
i
(
"[Chat Messages Adapter] List has changed, clearing previous first unread message position"
)
Log
.
i
(
"[Chat Messages Adapter] List has changed, clearing previous first unread message position"
)
// Need to wait for messages to be added before computing new first unread message position
firstUnreadMessagePosition
=
-
1
}
override
fun
displayHeaderForPosition
(
position
:
Int
):
Boolean
{
Log
.
i
(
"[Chat Messages Adapter] Unread message count is [$unreadMessagesCount], first unread message position is [$firstUnreadMessagePosition]"
)
Log
.
i
(
"[Chat Messages Adapter] Unread message count is [$unreadMessagesCount], first unread message position is [$firstUnreadMessagePosition]"
)
if
(
unreadMessagesCount
>
0
&&
firstUnreadMessagePosition
==
-
1
)
{
computeFirstUnreadMessagePosition
()
}
...
...
@@ -255,16 +259,22 @@ class ChatMessagesListAdapter(
// when new messages are added to the history whilst it is visible
unreadMessagesCount
=
if
(
itemCount
==
0
||
forceUpdate
)
count
else
0
firstUnreadMessagePosition
=
-
1
Log
.
i
(
"[Chat Messages Adapter] Set [$unreadMessagesCount] unread message(s) for current chat room"
)
Log
.
i
(
"[Chat Messages Adapter] Set [$unreadMessagesCount] unread message(s) for current chat room"
)
}
fun
getFirstUnreadMessagePosition
():
Int
{
Log
.
i
(
"[Chat Messages Adapter] First unread message position is [$firstUnreadMessagePosition]"
)
Log
.
i
(
"[Chat Messages Adapter] First unread message position is [$firstUnreadMessagePosition]"
)
return
firstUnreadMessagePosition
}
private
fun
computeFirstUnreadMessagePosition
()
{
Log
.
i
(
"[Chat Messages Adapter] [$unreadMessagesCount] unread message(s) for current chat room"
)
Log
.
i
(
"[Chat Messages Adapter] [$unreadMessagesCount] unread message(s) for current chat room"
)
if
(
unreadMessagesCount
>
0
)
{
Log
.
i
(
"[Chat Messages Adapter] Computing first unread message position"
)
var
messageCount
=
0
...
...
@@ -275,7 +285,9 @@ class ChatMessagesListAdapter(
messageCount
+=
1
if
(
messageCount
==
unreadMessagesCount
)
{
firstUnreadMessagePosition
=
position
Log
.
i
(
"[Chat Messages Adapter] First unread message position found [$firstUnreadMessagePosition]"
)
Log
.
i
(
"[Chat Messages Adapter] First unread message position found [$firstUnreadMessagePosition]"
)
break
}
}
...
...
This diff is collapsed.
Click to expand it.
app/src/main/java/org/linphone/activities/voip/viewmodels/ControlsViewModel.kt
+
20
−
0
View file @
11c33bb1
...
...
@@ -130,6 +130,7 @@ class ControlsViewModel : ViewModel() {
fullScreenMode
.
value
=
false
}
isVideoUpdateInProgress
.
value
=
false
proximitySensorEnabled
.
value
=
shouldProximitySensorBeEnabled
()
}
else
if
(
state
==
Call
.
State
.
PausedByRemote
)
{
fullScreenMode
.
value
=
false
}
...
...
@@ -550,6 +551,25 @@ class ControlsViewModel : ViewModel() {
}
private
fun
shouldProximitySensorBeEnabled
():
Boolean
{
val
currentCall
=
coreContext
.
core
.
currentCall
?:
coreContext
.
core
.
calls
.
firstOrNull
()
if
(
currentCall
!=
null
)
{
when
(
val
state
=
currentCall
.
state
)
{
Call
.
State
.
OutgoingEarlyMedia
,
Call
.
State
.
OutgoingProgress
,
Call
.
State
.
OutgoingRinging
,
Call
.
State
.
OutgoingInit
->
{
Log
.
i
(
"[Call Controls] Call is in outgoing state [$state], enabling proximity sensor"
)
return
true
}
Call
.
State
.
IncomingEarlyMedia
,
Call
.
State
.
IncomingReceived
->
{
Log
.
i
(
"[Call Controls] Call is in incoming state [$state], enabling proximity sensor"
)
return
true
}
else
->
{
}
}
}
if
(
forceDisableProximitySensor
.
value
==
true
)
{
Log
.
i
(
"[Call Controls] Forcing proximity sensor to be disabled (usually in incoming/outgoing call fragments)"
...
...
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets