Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Support for media controls live language update (#3622)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo authored Jul 6, 2020
1 parent 8df3e8a commit 2e47792
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2e47792

Please sign in to comment.