From fdc1222055e198881b7e26816840efc7952463ec Mon Sep 17 00:00:00 2001 From: gaopeng <11153621@bbktel.com> Date: Tue, 13 Dec 2022 16:16:46 +0800 Subject: [PATCH] =?UTF-8?q?[hapjs-platform#631]=E3=80=901300=E8=81=94?= =?UTF-8?q?=E7=9B=9F=E7=89=88=E6=9C=AC=E3=80=91=E6=97=A0=E9=9A=9C=E7=A2=8D?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=84=E4=BB=B6=E5=B1=9E=E6=80=A7=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ibbecf575c1387ee592ed328b4883476f59d1d465 --- .../src/main/res/layout/titlebar_view.xml | 6 +++-- .../src/main/res/values-zh-rCN/strings.xml | 6 +++++ .../runtime/src/main/res/values/strings.xml | 8 ++++++- .../widgets/view/video/MediaController.java | 24 +++++++++++++++++-- .../src/main/res/values-zh-rCN/strings.xml | 6 +++++ .../widgets/src/main/res/values/strings.xml | 5 ++++ 6 files changed, 50 insertions(+), 5 deletions(-) diff --git a/core/runtime/android/runtime/src/main/res/layout/titlebar_view.xml b/core/runtime/android/runtime/src/main/res/layout/titlebar_view.xml index d224bb1f..937b2c59 100644 --- a/core/runtime/android/runtime/src/main/res/layout/titlebar_view.xml +++ b/core/runtime/android/runtime/src/main/res/layout/titlebar_view.xml @@ -46,7 +46,8 @@ android:layout_width="16dp" android:layout_height="16dp" android:layout_gravity="center" - android:src="@drawable/menu_dot" /> + android:src="@drawable/menu_dot" + android:contentDescription="@string/talkback_titlebar_left_menu_iv"/> + android:src="@drawable/menu_close" + android:contentDescription="@string/talkback_close"/> diff --git a/core/runtime/android/runtime/src/main/res/values-zh-rCN/strings.xml b/core/runtime/android/runtime/src/main/res/values-zh-rCN/strings.xml index 6e796a90..d3509503 100644 --- a/core/runtime/android/runtime/src/main/res/values-zh-rCN/strings.xml +++ b/core/runtime/android/runtime/src/main/res/values-zh-rCN/strings.xml @@ -104,4 +104,10 @@ 加桌 桌面 添加到桌面 + + + 更多-按钮 + 弹出式窗口 + 关闭-按钮 + 按钮 \ No newline at end of file diff --git a/core/runtime/android/runtime/src/main/res/values/strings.xml b/core/runtime/android/runtime/src/main/res/values/strings.xml index d1aabd2f..2052f033 100644 --- a/core/runtime/android/runtime/src/main/res/values/strings.xml +++ b/core/runtime/android/runtime/src/main/res/values/strings.xml @@ -139,8 +139,14 @@ , and start debugging again. Click to add %1$s to the desktop,which is more convenient to use next time. Added to desktop \"%1$s\" - + Add to desktop Add to desktop Add to desktop + + + more-button + pop-up window + close-button + button diff --git a/core/runtime/android/widgets/src/main/java/org/hapjs/widgets/view/video/MediaController.java b/core/runtime/android/widgets/src/main/java/org/hapjs/widgets/view/video/MediaController.java index 4c95edf7..9042d5b0 100644 --- a/core/runtime/android/widgets/src/main/java/org/hapjs/widgets/view/video/MediaController.java +++ b/core/runtime/android/widgets/src/main/java/org/hapjs/widgets/view/video/MediaController.java @@ -28,6 +28,7 @@ import org.hapjs.component.Component; import org.hapjs.model.videodata.VideoCacheData; import org.hapjs.model.videodata.VideoCacheManager; +import org.hapjs.system.utils.TalkBackUtils; import org.hapjs.widgets.R; import org.hapjs.widgets.video.ExoPlayer; import org.hapjs.widgets.video.IMediaPlayer; @@ -112,6 +113,7 @@ public void onClick(View v) { private TextView mTitle; private int mTitleHeight; private final String TAG = "MediaController"; + private boolean mIsEnableTalkBack; private FullscreenChangeListener mFullScreenChangeListener; private OnSeekBarChangeListener mOnSeekBarChangeListener; // There are two scenarios that can trigger the seekbar listener to trigger: @@ -205,6 +207,7 @@ public MediaController(Context context, AttributeSet attrs) { public MediaController(Context context, boolean useFastForward) { super(context); mContext = context; + mIsEnableTalkBack = TalkBackUtils.isEnableTalkBack(mContext, false); makeControllerView(); } @@ -245,6 +248,9 @@ private void initControllerView(View v) { if (mPauseButton != null) { mPauseButton.requestFocus(); mPauseButton.setOnClickListener(mPauseListener); + if (mIsEnableTalkBack) { + mPauseButton.setContentDescription(getContext().getResources().getString(R.string.talkback_video_controller_play)); + } } mProgress = (SeekBar) v.findViewById(R.id.mediacontroller_progress); if (mProgress != null) { @@ -279,6 +285,10 @@ public void onClick(View v) { mTitleBarContainer = v.findViewById(R.id.title_bar_container); v.findViewById(R.id.back_arrow).setOnClickListener(view -> mVideoView.exitFullscreen()); mTitle = v.findViewById(R.id.title); + if (mIsEnableTalkBack) { + v.findViewById(R.id.back_arrow).setContentDescription(getContext().getResources().getString(R.string.talkback_video_controller_exit_full_screen)); + mFullButton.setContentDescription(getContext().getResources().getString(R.string.talkback_video_controller_full_screen)); + } } private void applyButtonVisibility() { @@ -591,8 +601,14 @@ private void updatePausePlay() { if (mPlayer.isPlaying()) { mPauseButton.setImageResource(R.drawable.ic_media_pause); + if (mIsEnableTalkBack) { + mPauseButton.setContentDescription(getContext().getResources().getString(R.string.talkback_video_controller_pause)); + } } else { mPauseButton.setImageResource(R.drawable.ic_media_play); + if (mIsEnableTalkBack) { + mPauseButton.setContentDescription(getContext().getResources().getString(R.string.talkback_video_controller_play)); + } } } @@ -642,7 +658,9 @@ public void setOnSeekBarChangeListener(OnSeekBarChangeListener l) { public void enterFullscreen() { mFullButton.setImageResource(R.drawable.ic_media_exit_fullscreen); - + if (mIsEnableTalkBack) { + mFullButton.setContentDescription(getContext().getResources().getString(R.string.talkback_video_controller_exit_full_screen)); + } mTitleBarContainer.setVisibility(VISIBLE); View statusBarPlaceholder = mTitleBarContainer.findViewById(R.id.status_bar_bg); LinearLayout.LayoutParams params = @@ -658,7 +676,9 @@ public void enterFullscreen() { public void exitFullscreen() { mFullButton.setImageResource(R.drawable.ic_media_enter_fullscreen); - + if (mIsEnableTalkBack) { + mFullButton.setContentDescription(getContext().getResources().getString(R.string.talkback_video_controller_full_screen)); + } mTitleBarContainer.setVisibility(GONE); mVideoView.getComponent().getRootComponent().resetStatusBar(); } diff --git a/core/runtime/android/widgets/src/main/res/values-zh-rCN/strings.xml b/core/runtime/android/widgets/src/main/res/values-zh-rCN/strings.xml index e25f7319..71733e55 100644 --- a/core/runtime/android/widgets/src/main/res/values-zh-rCN/strings.xml +++ b/core/runtime/android/widgets/src/main/res/values-zh-rCN/strings.xml @@ -55,4 +55,10 @@ 选中 单选框 + + 播放 + 暂停 + 全屏 + 退出全屏 + diff --git a/core/runtime/android/widgets/src/main/res/values/strings.xml b/core/runtime/android/widgets/src/main/res/values/strings.xml index 4275a095..1d0bafe2 100644 --- a/core/runtime/android/widgets/src/main/res/values/strings.xml +++ b/core/runtime/android/widgets/src/main/res/values/strings.xml @@ -56,4 +56,9 @@ Check Radio + + play + pause + full screen + exit full screen