Android Open Source - dttv-android Volume Util






From Project

Back to project page dttv-android.

License

The source code is released under:

GNU General Public License

If you think the Android project dttv-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package dttv.app.utils;
/* w  w w.ja va 2  s.c om*/
import android.app.Activity;
import android.app.Service;
import android.media.AudioManager;

public class VolumeUtil {
  private Activity cr;
  private AudioManager audioManager;
  public VolumeUtil(Activity activity) {
    // TODO Auto-generated constructor stub
    this.cr = activity;
    audioManager = (AudioManager)cr.getSystemService(Service.AUDIO_SERVICE);
  }
  
  
  public void upVolume(int value){
    audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, 
        AudioManager.FLAG_PLAY_SOUND);
  }
  
  public void downVolume(int value){
    audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER,
        AudioManager.FLAG_PLAY_SOUND);
        //AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI);
  }
  
  public int getCurrentVolume(){
    int current = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
    return current;
  }
  
  public int getMaxVolume(){
    int max = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
    return max;
  }
}




Java Source Code List

dttv.app.DtPlayer.java
dttv.app.FileBrowserActivity.java
dttv.app.FileShowActivity.java
dttv.app.IndexActivity.java
dttv.app.MainActivity.java
dttv.app.SettingActivity.java
dttv.app.VideoPlayerActivity.java
dttv.app.adapter.FileAdapter.java
dttv.app.compnent.Compnent.java
dttv.app.compnent.MethodPlayerCompnent.java
dttv.app.compnent.PopWindowCompnent.java
dttv.app.impl.ICallBack.java
dttv.app.impl.I_Async.java
dttv.app.impl.I_KeyIntercept.java
dttv.app.impl.I_OnMyKey.java
dttv.app.impl.I_PopWindow.java
dttv.app.model.Item.java
dttv.app.multithread.DataAsyncTask.java
dttv.app.utils.Constant.java
dttv.app.utils.ControlLightness.java
dttv.app.utils.FileUtil.java
dttv.app.utils.Log.java
dttv.app.utils.MultiMediaTypeUtil.java
dttv.app.utils.MusicUtils.java
dttv.app.utils.PlayerUtil.java
dttv.app.utils.SettingUtil.java
dttv.app.utils.TimesUtil.java
dttv.app.utils.VolumeUtil.java
dttv.app.view.SimpleDialog.java
dttv.app.widget.AudioUIFragment.java
dttv.app.widget.EffectWindow.java
dttv.app.widget.FilesUIFragment.java
dttv.app.widget.GlVideoView.java
dttv.app.widget.OnTouchMoveListener.java
dttv.app.widget.SlideTabsFragment.java
dttv.app.widget.VideoUIFragment.java