Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 432d0737 authored by Hugh Chen's avatar Hugh Chen
Browse files

Stop the ringtone when other seek bar is adjust

- Stop the ringtone when other seek bar is adjust.
- Add test to verify when onStartTrackingTouch() is called,
  will call stopSample().

Bug: 80194851
Test: make -j42 RunSettingsRoboTests
Change-Id: I2300f0f56340c3698f62cc911bda7b7a94d23a7a
parent b96878a8
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -204,10 +204,6 @@ public class SoundSettings extends DashboardFragment implements OnActivityResult

        @Override
        public void onSampleStarting(SeekBarVolumizer sbv) {
            if (mCurrent != null && mCurrent != sbv) {
                mCurrent.stopSample();
            }
            mCurrent = sbv;
            if (mCurrent != null) {
                mHandler.removeMessages(STOP_SAMPLE);
                mHandler.sendEmptyMessageDelayed(STOP_SAMPLE, SAMPLE_CUTOFF);
@@ -222,6 +218,15 @@ public class SoundSettings extends DashboardFragment implements OnActivityResult
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBarVolumizer sbv) {
            // stop the ringtone when other seek bar is adjust
            if (mCurrent != null && mCurrent != sbv) {
                mCurrent.stopSample();
            }
            mCurrent = sbv;
        }

        public void stopSample() {
            if (mCurrent != null) {
                mCurrent.stopSample();
+11 −0
Original line number Diff line number Diff line
@@ -138,6 +138,12 @@ public class VolumeSeekBarPreference extends SeekBarPreference {
                mZenMuted = zenMuted;
                updateIconView();
            }
            @Override
            public void onStartTrackingTouch(SeekBarVolumizer sbv) {
                if (mCallback != null) {
                    mCallback.onStartTrackingTouch(sbv);
                }
            }
        };
        final Uri sampleUri = mStream == AudioManager.STREAM_MUSIC ? getMediaVolumeUri() : null;
        if (mVolumizer == null) {
@@ -201,5 +207,10 @@ public class VolumeSeekBarPreference extends SeekBarPreference {
    public interface Callback {
        void onSampleStarting(SeekBarVolumizer sbv);
        void onStreamValueChanged(int stream, int progress);

        /**
         * Callback reporting that the seek bar is start tracking.
         */
        void onStartTrackingTouch(SeekBarVolumizer sbv);
    }
}