[Android] Fix "App wastes CPU resources while playing video"
Andrew Churilo
git at videolan.org
Wed May 18 09:00:47 UTC 2022
vlc-android | branch: master | Andrew Churilo <AndrewChuriloMinsk at gmail.com> | Wed May 18 11:41:42 2022 +0300| [4233a36a9e75cf3f13b7d183f22d77f0f4c08a47] | committer: Nicolas Pomepuy
Fix "App wastes CPU resources while playing video"
Use fixed size (half of screen) for each TextView
Fixes #2529
This modification also improve overall UI performance. #2528
UI appearing time (landscape orientation, video paused, v3.5.0):
Samsung Note 4, Android 6.0.1 (debug). Was ~300 ms if I disable animation. Now it ~65 ms.
Samsung Note 4, Android 6.0.1 (release). Was ~1450 ms if I disable animation. Now it ~350 ms.
Lenovo P2a42. Android 6.0.1 (release). Was ~130 ms if I disable animation. Now it ~55 ms.
Xiaomi 11T, Android 12 (release). Was ~100 ms if I disable animation. Now it ~40 ms.
> https://code.videolan.org/videolan/vlc-android/commit/4233a36a9e75cf3f13b7d183f22d77f0f4c08a47
---
application/vlc-android/res/layout/player_hud.xml | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/application/vlc-android/res/layout/player_hud.xml b/application/vlc-android/res/layout/player_hud.xml
index 8e6dcd88b..06ae40f72 100644
--- a/application/vlc-android/res/layout/player_hud.xml
+++ b/application/vlc-android/res/layout/player_hud.xml
@@ -198,40 +198,43 @@
<FrameLayout
android:id="@+id/player_overlay_time_container"
- android:layout_width="wrap_content"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
+ vlc:layout_constraintEnd_toStartOf="@+id/player_overlay_length_container"
+ vlc:layout_constraintHorizontal_bias="0.5"
vlc:layout_constraintHorizontal_chainStyle="spread_inside"
- vlc:layout_constraintLeft_toLeftOf="parent"
+ vlc:layout_constraintStart_toStartOf="parent"
vlc:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/player_overlay_time"
style="@style/VLC.Player.TimeText"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:nextFocusUp="@+id/ab_repeat_add_marker"
android:onClick="@{(v) -> player.toggleTimeDisplay()}"
android:text="@{Tools.millisToString(progress.time)}"
- android:textAlignment="center"
tools:text="0:32" />
</FrameLayout>
<FrameLayout
android:id="@+id/player_overlay_length_container"
- android:layout_width="wrap_content"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
- vlc:layout_constraintRight_toRightOf="parent"
+ vlc:layout_constraintEnd_toEndOf="parent"
+ vlc:layout_constraintHorizontal_bias="0.5"
+ vlc:layout_constraintStart_toEndOf="@+id/player_overlay_time_container"
vlc:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/player_overlay_length"
style="@style/VLC.Player.TimeText"
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_gravity="right"
+ android:gravity="right"
android:background="?attr/selectableItemBackgroundBorderless"
android:nextFocusUp="@+id/ab_repeat_add_marker"
android:onClick="@{(v) -> player.toggleTimeDisplay()}"
More information about the Android
mailing list