package com.fun.airhornprank.tool;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.widget.SeekBar;

public class SeekBarBroadCast extends BroadcastReceiver {
    private AudioManager myaudioManager;
    private SeekBar myseekBar;
    public SeekBarBroadCast(AudioManager audioManager, SeekBar seekBar){
        myaudioManager = audioManager;
        myseekBar = seekBar;
    }
    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals("android.media.VOLUME_CHANGED_ACTION")){
            int currentVolume = myaudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
            myseekBar.setProgress(currentVolume);
        }
    }
}
