資源簡介
Android MIUI小米錄音機源碼

代碼片段和文件信息
/*
?*?Copyright?(c)?2010-2011?The?MiCode?Open?Source?Community?(www.micode.net)
?*
?*?Licensed?under?the?Apache?License?Version?2.0?(the?“License“);
?*?you?may?not?use?this?file?except?in?compliance?with?the?License.
?*?You?may?obtain?a?copy?of?the?License?at
?*
?*????????http://www.apache.org/licenses/LICENSE-2.0
?*
?*?Unless?required?by?applicable?law?or?agreed?to?in?writing?software
?*?distributed?under?the?License?is?distributed?on?an?“AS?IS“?BASIS
?*?WITHOUT?WARRANTIES?OR?CONDITIONS?OF?ANY?KIND?either?express?or?implied.
?*?See?the?License?for?the?specific?language?governing?permissions?and
?*?limitations?under?the?License.
?*/
package?net.micode.soundrecorder;
import?java.io.File;
import?java.io.IOException;
import?android.content.Context;
import?android.media.MediaPlayer;
import?android.media.MediaPlayer.OnCompletionListener;
import?android.media.MediaPlayer.onerrorListener;
import?android.os.Bundle;
import?android.os.Environment;
import?android.text.TextUtils;
public?class?Recorder?implements?OnCompletionListener?onerrorListener?{
????private?static?final?String?SAMPLE_PREFIX?=?“recording“;
????private?static?final?String?SAMPLE_PATH_KEY?=?“sample_path“;
????private?static?final?String?SAMPLE_LENGTH_KEY?=?“sample_length“;
????public?static?final?String?SAMPLE_DEFAULT_DIR?=?“/sound_recorder“;
????public?static?final?int?IDLE_STATE?=?0;
????public?static?final?int?RECORDING_STATE?=?1;
????public?static?final?int?PLAYING_STATE?=?2;
????public?static?final?int?PLAYING_PAUSED_STATE?=?3;
????private?int?mState?=?IDLE_STATE;
????public?static?final?int?NO_ERROR?=?0;
????public?static?final?int?STORAGE_ACCESS_ERROR?=?1;
????public?static?final?int?INTERNAL_ERROR?=?2;
????public?static?final?int?IN_CALL_RECORD_ERROR?=?3;
????public?interface?OnStateChangedListener?{
????????public?void?onStateChanged(int?state);
????????public?void?onerror(int?error);
????}
????private?Context?mContext;
????private?OnStateChangedListener?mOnStateChangedListener?=?null;
????private?long?mSampleStart?=?0;?//?time?at?which?latest?record?or?play
???????????????????????????????????//?operation?started
????private?int?mSampleLength?=?0;?//?length?of?current?sample
????private?File?mSampleFile?=?null;
????private?File?mSampleDir?=?null;
????private?MediaPlayer?mPlayer?=?null;
????public?Recorder(Context?context)?{
????????mContext?=?context;
????????File?sampleDir?=?new?File(Environment.getExternalStorageDirectory().getAbsolutePath()
????????????????+?SAMPLE_DEFAULT_DIR);
????????if?(!sampleDir.exists())?{
????????????sampleDir.mkdirs();
????????}
????????mSampleDir?=?sampleDir;
????????syncStateWithService();
????}
????public?boolean?syncStateWithService()?{
????????if?(RecorderService.isRecording())?{
????????????mState?=?RECORDING_STATE;
????????????mSampleStart?=?RecorderService.getStartTime();
????????????mSampleFile?=?new?File(RecorderService.getFilePath());
????????????return?true;
????????}?else?if?(mState?==?RECORDING_STATE)?{
?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????.......???????135??2012-02-23?20:08??MiCode-SoundRecorder\.gitignore
????.......??????2908??2012-02-23?20:08??MiCode-SoundRecorder\AndroidManifest.xm
????.......?????10713??2012-02-23?20:08??MiCode-SoundRecorder\NOTICE
????.......??????1038??2012-02-23?20:08??MiCode-SoundRecorder\README
????.......??????1170??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable\btn_delete.xm
????.......??????1170??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable\btn_finish.xm
????.......??????1157??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable\btn_new.xm
????.......??????1059??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable\btn_pause.xm
????.......??????1056??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable\btn_play.xm
????.......??????1062??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable\btn_record.xm
????.......??????1056??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable\btn_stop.xm
?????文件??????32300??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\background.png
?????文件??????65991??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\background_key.png
?????文件???????3198??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\background_number.png
?????文件???????2827??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\background_vumeter.png
?????文件???????4649??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_delete_disabled.9.png
?????文件???????4753??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_delete_normal.9.png
?????文件???????7449??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_delete_pressed.9.png
?????文件???????5690??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_finish_disabled.9.png
?????文件???????5976??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_finish_normal.9.png
?????文件???????8693??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_finish_pressed.9.png
?????文件???????5666??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_new_disabled.9.png
?????文件???????5951??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_new_normal.9.png
?????文件???????8646??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_new_pressed.9.png
?????文件???????4264??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_pause_normal.9.png
?????文件???????7083??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_pause_pressed.9.png
?????文件???????4803??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_play_normal.9.png
?????文件???????7662??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_play_pressed.9.png
?????文件???????5141??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_record_normal.9.png
?????文件???????8038??2012-02-23?20:08??MiCode-SoundRecorder\res\drawable-hdpi\btn_record_pressed.9.png
............此處省略60個文件信息
- 上一篇:Java Cipher
- 下一篇:通訊錄管理系統(java+sql)
評論
共有 條評論