From b751725368096cf794ef88d3908377d5e79fc3dc Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Mon, 6 Jul 2020 22:09:29 +0200 Subject: [PATCH] Support for media controls live language update (#3622) --- .../ui/widgets/MediaControlsWidget.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/MediaControlsWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/MediaControlsWidget.java index d9bcc103f..2b047d78d 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/MediaControlsWidget.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/MediaControlsWidget.java @@ -6,6 +6,7 @@ package org.mozilla.vrbrowser.ui.widgets; import android.content.Context; +import android.content.res.Configuration; import android.graphics.Rect; import android.os.Handler; import android.util.AttributeSet; @@ -38,20 +39,26 @@ public class MediaControlsWidget extends UIWidget implements MediaElement.Delega public MediaControlsWidget(Context aContext) { super(aContext); - initialize(aContext); + initialize(); } public MediaControlsWidget(Context aContext, AttributeSet aAttrs) { super(aContext, aAttrs); - initialize(aContext); + initialize(); } public MediaControlsWidget(Context aContext, AttributeSet aAttrs, int aDefStyle) { super(aContext, aAttrs, aDefStyle); - initialize(aContext); + initialize(); } - private void initialize(Context aContext) { + private void initialize() { + updateUI(); + } + + private void updateUI() { + removeAllViews(); + LayoutInflater inflater = LayoutInflater.from(getContext()); mBinding = DataBindingUtil.inflate(inflater, R.layout.media_controls, this, true); mBinding.setPlaying(true); @@ -237,8 +244,13 @@ else if ((event.getX() <= 0) || (event.getX() >= v.getWidth()) || (!(event.getY( } return false; }); + } + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + updateUI(); } @Override