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

Commit

Permalink
Avoid volume seeker to reset when dragging out of bounds (#2691)
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo authored and bluemarvin committed Jan 24, 2020
1 parent 6b88460 commit 34732b8
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package org.mozilla.vrbrowser.ui.views;

import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.FrameLayout;
import android.widget.SeekBar;

import org.mozilla.vrbrowser.R;

import androidx.annotation.Nullable;

import org.mozilla.vrbrowser.R;

public class VolumeControl extends FrameLayout implements SeekBar.OnSeekBarChangeListener {
private SeekBar mSeekBar;
private double mVolume;
Expand Down Expand Up @@ -40,11 +42,18 @@ public interface Delegate {
void onVolumeChange(double aVolume);
}

@SuppressLint("ClickableViewAccessibility")
private void initialize() {
inflate(getContext(), R.layout.volume_control, this);
mSeekBar = findViewById(R.id.volumeSeekBar);
mSeekBar.setProgress(100);
mSeekBar.setOnSeekBarChangeListener(this);
mSeekBar.setOnTouchListener((v, event) -> {
if (event.getAction() == MotionEvent.ACTION_UP) {
return true;
}
return false;
});
}

public void setDelegate(Delegate aDelegate) {
Expand Down

0 comments on commit 34732b8

Please sign in to comment.