FileDocCategorySizeDatePackage
SoundManager.javaAPI DocAndroid 1.5 API1932Wed May 06 22:42:48 BST 2009com.android.inputmethod.pinyin

SoundManager

public class SoundManager extends Object
Class used to manage related sound resources.

Fields Summary
private static SoundManager
mInstance
private android.content.Context
mContext
private android.media.AudioManager
mAudioManager
private final float
FX_VOLUME
private boolean
mSilentMode
Constructors Summary
private SoundManager(android.content.Context context)


       
        mContext = context;
        updateRingerMode();
    
Methods Summary
public static com.android.inputmethod.pinyin.SoundManagergetInstance(android.content.Context context)

        if (null == mInstance) {
            if (null != context) {
                mInstance = new SoundManager(context);
            }
        }
        return mInstance;
    
public voidplayKeyDown()

        if (mAudioManager == null) {
            updateRingerMode();
        }
        if (!mSilentMode) {
            int sound = AudioManager.FX_KEYPRESS_STANDARD;
            mAudioManager.playSoundEffect(sound, FX_VOLUME);
        }
    
public voidupdateRingerMode()

        if (mAudioManager == null) {
            mAudioManager = (AudioManager) mContext
                    .getSystemService(Context.AUDIO_SERVICE);
        }
        mSilentMode = (mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_NORMAL);