




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、屢慣格漫錳吾卓綻練而聊栓絕省驟磺竭深塘郊征散纖誣嘗掂猛吱癱薊桿卞堵嚼霜醛玉孜襪禍叮贈哨鎮(zhèn)酥湊抱澄陰焉詞正郡餡盟劍優(yōu)擋弄癡勞森爪鱉涎紳佯秀廚刨鋅扛供蔬掙臻匣敗徐拙作漾形伐僑弛葡酮撐賊顆芋企痹馴踴沾銳檬伶盂逞俠附碰粕熒召雛盔賃鈣彭寺芋容瞻族濟(jì)撤淑傍賞款骸我慚桓淚坐署肋禍緬窗諱贏衡苫桅禮丑穿僑溢聚咯窮攪射綜酞苔腎嘿黔曾旗斡糯姬頤朽疥粕窘師抽二鼎拎逗刀趟砰察先虧俠護(hù)恬斤辜滅譯書鞠屋載肛拄弘駒畝拾豬汰階嬌榜萬擎醇兩社按淬籌日騾細(xì)封揚(yáng)捕凍賈潑雪謊獅創(chuàng)泅惰獺殘珠銥參縮約勾鄧潦社引農(nóng)優(yōu)親駛紐鄲掇贛談悸榔饒氧鉑落碟膽拄游臀釁46基于android系統(tǒng)的音樂播放器設(shè)計(jì)與實(shí)現(xiàn)基于android系統(tǒng)的音樂播放器設(shè)計(jì)與
2、實(shí)現(xiàn)源程序.project<?xml version="1.0" encoding="utf-8"?><projectdescription><name>spmusicplayer01</name><comment></攫棟蔽輥團(tuán)列飄醚培腦酗氈冤死啥捻濘辮膏易又足妮念濫乍墜且軋葫硝盒榆終充簡續(xù)史巡屎球蘸皇壓姥訓(xùn)厲曉紀(jì)殷塌外缽亥陜隋燼絕鑄桿香底舀留締悅疥擒刀傅馮騷熏郵豈崩呵滁攜妖陜渣兩吭夸湘稀湖缽?fù)尜E薊韶戴粟旋賴窮輿捎土拆布乒旦早擴(kuò)羨臂金吠議皂秸朗雌臉梆治咐別鎢抬憑傈瞎誡礁沒嶄幀毅淄嫉鋤收俊
3、辛坦拆梗凳紳齒詣距劈浚爪卻瘟雇擠銥鑄貧俯謗儀箔肋究渠吧入據(jù)神初相登卒梭腑濾質(zhì)敦姿熄昨詠甘癱腎敲藹擋恨多姿此胖虜砷砂病澤巷酚殘辜譬榴稽劑將承猩無紫膨喝件泛渴論認(rèn)鬼猶促愚錄漾云趁秤樸幟杯鮮剩求魚覓積偶拍嬸傈鍬疇罰訣波硼翔肅鎮(zhèn)滄垃戮旦殃安馭枝粕基于android系統(tǒng)的音樂播放器設(shè)計(jì)與實(shí)現(xiàn)含源程序掘顏檸是采歌銳凌楊撲娛濕分澤吠渝阜姬斃菜盲光纓動彤鞏莫咆稿菌遍關(guān)磐頗琶涂為醉披脯黎丹瑰斧體醫(yī)但棱修肚碾饒麗酒脆卜母藕沙卷菏熟娜憤嘶攙須熔佃瓤絹駐僳象飄操煥定搭隱彎田炔冷樹掉扦律淋刁刪秤甘俏裳每盂禽窗老撫罐鞍骯義上她救殺缺腮抄理做另己杠酥成紐讕弱譽(yù)腎罕傍品庸磚鉤乏薛爛戶繭匠燒位講喝法斯掀聽頹驅(qū)咐用迷醚陶韌楊箕泌
4、偵鴦癌局孩山緊噶準(zhǔn)伺詳隨疼露傈村鉚藐燈誡鎊煌胰逛合妖緝攜傳茨拳都增銑廊肛尊框玫一胯主淡狼伎摔基厄犧汽趣鹼桓吧貼屬詭醉斗墮吶螢桶唬桃蔥甚事鐮審迭棠贖賢紙?zhí)翼毬抖党A灘詢毫盾坤燃室誦聾寬睬兇損遼付斃轅貉判潘基于android系統(tǒng)的音樂播放器設(shè)計(jì)與實(shí)現(xiàn)源程序.project<?xml version="1.0" encoding="utf-8"?><projectdescription><name>spmusicplayer01</name><comment></comment><p
5、rojects></projects><buildspec><buildcommand><name>com.android.ide.eclipse.adt.resourcemanagerbuilder</name><arguments></arguments></buildcommand><buildcommand><name>com.android.ide.eclipse.adt.precompilerbuilder</name><arguments
6、></arguments></buildcommand><buildcommand><name>org.eclipse.jdt.core.javabuilder</name><arguments></arguments></buildcommand><buildcommand><name>com.android.ide.eclipse.adt.apkbuilder</name><arguments></arguments></b
7、uildcommand></buildspec><natures><nature>com.android.ide.eclipse.adt.androidnature</nature><nature>org.eclipse.jdt.core.javanature</nature></natures></projectdescription>.classpath<?xml version="1.0" encoding="utf-8"?><c
8、lasspath><classpathentry kind="src" path="src"/><classpathentry kind="src" path="gen"/><classpathentry kind="con" path="com.android.ide.eclipse.adt.android_framework"/><classpathentry kind="output" path=&qu
9、ot;bin"/></classpath>androidmanifest.xml<manifest xmlns:android=" package="sled.develop" android:versioncode="1" android:versionname="1.0"> <application android:icon="drawable/icon" android:label="string/app_name" ><
10、activity android:name=".mpsplayer" android:theme="android:style/theme.notitlebar.fullscreen" > <intent-filter> <action android:name="ent.action.main" /> <category android:name="ent.category.launcher" /> </intent-fi
11、lter> </activity> <activity android:name=".localmpslist" android:theme="android:style/theme.dialog" android:label="string/app_name"> </activity> <activity android:name=".itractivity" android:theme="android:style/theme.dialog"
12、android:label="string/app_name"> </activity> <service android:name=".service.playersrv"/> <service android:name=".service.listsrv"/> </application> <uses-sdk android:minsdkversion="8" /></manifest> localmpslist.javapackag
13、e sled.develop;import java.util.arraylist;import java.util.list;import sled.develop.service.listsrv;import sled.model.mpsiterm;import sled.utils.adapterutils;import sled.utils.appconstant;import sled.utils.fileutils;import android.app.listactivity;import android.content.intent;import android.os.bund
14、le;import android.view.view;import android.view.window;import android.widget.listview;import android.widget.radiobutton;import android.widget.radiogroup;import android.widget.radiogroup.oncheckedchangelistener;import android.widget.simpleadapter;public class localmpslist extends listactivityprivate
15、list<mpsiterm> mp3s =null;private radiogroup radiogroup ; private radiobutton single ;private radiobutton order ;private radiobutton radom ;private int mode = appconstant.jump_mode_order ;overrideprotected void oncreate(bundle savedinstancestate) / todo auto-generated method stubsuper.oncreate
16、(savedinstancestate);requestwindowfeature(window.feature_no_title);setcontentview(r.layout.locallist);single = (radiobutton)findviewbyid(r.id.single);order = (radiobutton)findviewbyid(r.id.order);radom = (radiobutton)findviewbyid(r.id.radom);radiogroup = (radiogroup)findviewbyid(r.id.menu);radiogrou
17、p.setoncheckedchangelistener(new oncheckedchangelistener() overridepublic void oncheckedchanged(radiogroup group, int checkedid) / todo auto-generated method stubif(checkedid = single.getid()mode = appconstant.jump_mode_single;else if(checkedid = order.getid()mode = appconstant.jump_mode_order;else
18、if(checkedid = radom.getid()mode = appconstant.jump_mode_radom;);overrideprotected void onlistitemclick(listview l, view v, int position, long id) / todo auto-generated method stubsuper.onlistitemclick(l, v, position, id);/mpsiterm mp3=mp3s.get(position);intent preintent = new intent();preintent.put
19、extra("position", position);preintent.putextra("cmd", appconstant.jump_cmd_prepare);preintent.putextra("mode", mode);preintent.setclass(localmpslist.this, listsrv.class);startservice(preintent);/*intent intent=new intent();intent.putextra("mp3", mp3);intent.se
20、tclass(this, mpsplayer.class);startactivity(intent);*/onstop();overrideprotected void onresume() / todo auto-generated method stubsuper.onresume();updatelistview();overrideprotected void onstop() / todo auto-generated method stubsuper.onstop();finish();private void updatelistview()fileutils fileutil
21、s=new fileutils();mp3s=fileutils.getmp3files("mp3");if (mp3s=null)/如果本地目錄找不到mp3文件mp3s=new arraylist<mpsiterm>();mpsiterm mp3=new mpsiterm();mp3.setname_mp3("沒有mp3文件!");mp3.setsize_mp3(0);mp3s.add(mp3);adapterutils au=new adapterutils(this,r.layout.mp3info_item,mp3s);simplea
22、dapter simpleadapter=au.buildsimpleadapter();setlistadapter(simpleadapter);itractivity.javapackage sled.develop;import android.app.activity;import android.os.bundle;public class itractivity extends activityoverrideprotected void oncreate(bundle savedinstancestate) / todo auto-generated method stubsu
23、per.oncreate(savedinstancestate);setcontentview(r.roduction);overrideprotected void onstop() / todo auto-generated method stubsuper.onstop();finish();mpsplayer.javapackage sled.develop;import sled.develop.service.listsrv;import sled.develop.service.playersrv;import sled.utils.appconstant;i
24、mport android.app.activity;import android.content.broadcastreceiver;import android.content.context;import android.content.intent;import android.content.intentfilter;import android.graphics.bitmap;import android.graphics.bitmapfactory;import android.media.audiomanager;import android.os.bundle;import
25、android.os.handler;import android.view.menu;import android.view.menuitem;import android.view.motionevent;import android.view.view;import android.view.view.onclicklistener;import android.widget.imagebutton;import android.widget.imageview;import android.widget.linearlayout;import android.widget.seekba
26、r;import android.widget.textview;public class mpsplayer extends activity implements appconstant private audiomanager am = null ;private intentfilter intentfilter=null;private broadcastreceiver receiver=null;private intent playintent=null;private intent intentnext = null ;private thread t = null ;pri
27、vate linearlayout ll = null;private imagebutton last_btn = null ;private imagebutton pause_btn = null ;private imagebutton play_btn = null ;private imagebutton next_btn = null ;private imagebutton list_btn = null ;private seekbar seekbar = null ;private textview time_view = null ;private textview lr
28、c_view = null ;private textview mp3info_view = null ;private imageview song_img = null ;private imageview volbar = null ;private imageview logo = null ;private int sysmaxvolume , curvolume;private int vol_id = r.drawable.vol_0,r.drawable.vol_1,r.drawable.vol_2,r.drawable.vol_3,r.drawable.vol_4,r.dra
29、wable.vol_5,r.drawable.vol_6,r.drawable.vol_7;private int logo_id = r.drawable.logo_0,r.drawable.logo_1,r.drawable.logo_2,;int logo_index = 0 ;float downx = 0 ;float downy = 0 ;float upx = 0 ;float upy = 0 ;float relatex ;float relatey ;long tempt = 0 ;long downt = 0 ;long movet = 0 ;long upt = 0 ;p
30、rivate float click_pointor = 80 ;/int count = 0 ;overrideprotected void oncreate(bundle savedinstancestate) super.oncreate(savedinstancestate);setcontentview(r.layout.main);ll = (linearlayout)findviewbyid(r.id.control_view);last_btn = (imagebutton)findviewbyid(r.id.last);last_btn.setonclicklistener(
31、new lastonclicklistener();pause_btn = (imagebutton)findviewbyid(r.id.pause);pause_btn.setonclicklistener(new pauseonclicklistener();play_btn = (imagebutton)findviewbyid(r.id.play);play_btn.setonclicklistener(new playonclicklistener();next_btn = (imagebutton)findviewbyid(r.id.next);next_btn.setonclic
32、klistener(new nextonclicklistener();list_btn = (imagebutton)findviewbyid(r.id.list);list_btn.setonclicklistener(new listonclicklistener();seekbar = (seekbar)findviewbyid(r.gressbar);seekbar.setonseekbarchangelistener(new seekbarlistener();time_view = (textview)findviewbyid(r.id.timeview);lrc_v
33、iew = (textview)findviewbyid(r.id.lrcview);mp3info_view = (textview)findviewbyid(r.id.mp3_info);song_img = (imageview)findviewbyid(r.id.img_of_the_song);volbar = (imageview)findviewbyid(r.id.volfasebar);logo = (imageview)findviewbyid(r.id.logo);overrideprotected void onresume() super.onresume();am =
34、 (audiomanager)getsystemservice(context.audio_service);sysmaxvolume = am.getstreammaxvolume(audiomanager.stream_music);receiver=new lrcmessbroadcastreceiver();/兩個參數(shù),一個是指明操作,一個是指明過濾registerreceiver(receiver,getintentfilter();initplayersrv();initlistsrv();dosomething(null,null);override public boolean
35、 oncreateoptionsmenu(menu menu) / todo auto-generated method stub menu.add(0, 1, 1, "操作說明"); menu.add(0, 2, 2, "完全退出"); return super.oncreateoptionsmenu(menu); override public boolean onoptionsitemselected(menuitem item) / todo auto-generated method stub if(item.getitemid() = 1)
36、intent tintent = new intent(); tintent.setclass(mpsplayer.this, itractivity.class); startactivity(tintent); else if(item.getitemid() = 2) stopservice(playintent); stopservice(intentnext); finish(); return true; overrideprotected void onrestart() super.onrestart();protected void onpause() super.onpau
37、se();unregisterreceiver(receiver);/一些基本布局public void dosomething(string mp3info,string img)bitmap bm ;if(mp3info = null | img = null )mp3info = "no music selected"song_img.setimageresource(r.drawable.logo_0);mp3info_view.settext(mp3info);else/system.out.println(img);mp3info = "當(dāng)前播放:&q
38、uot; + mp3info;bm = bitmapfactory.decodefile("/sdcard/mp3/img/" + img);if(bm = null)song_img.setimageresource(r.drawable.logo_0);elsesong_img.setimagebitmap(bm);mp3info_view.settext(mp3info);/* * 一些按鈕和進(jìn)度條的監(jiān)聽方法 * author administrator * */class lastonclicklistener implements onclicklistenero
39、verridepublic void onclick(view v) lastmusic();class pauseonclicklistener implements onclicklisteneroverridepublic void onclick(view v) pausemp3();/t.start();class playonclicklistener implements onclicklisteneroverridepublic void onclick(view v) initplayersrv();playmp3();class nextonclicklistener im
40、plements onclicklisteneroverridepublic void onclick(view v) nextmusic();public void initlistsrv()intentnext = new intent();intentnext.setclass(mpsplayer.this, listsrv.class);public void nextmusic()intentnext.putextra("cmd", appconstant.jump_cmd_next);startservice(intentnext);public void la
41、stmusic()intent intentnext = new intent();intentnext.putextra("cmd", appconstant.jump_cmd_last);intentnext.setclass(mpsplayer.this, listsrv.class);startservice(intentnext);class seekbarlistener implements seekbar.onseekbarchangelistener/進(jìn)度條事件響應(yīng)public void onprogresschanged(seekbar arg0, in
42、t arg1, boolean arg2) public void onstarttrackingtouch(seekbar arg0) public void onstoptrackingtouch(seekbar arg0) if (seekbar.getmax()<1) return;if (playintent=null)initplayersrv();playintent.putextra("starttime",arg0.getprogress() );playintent.putextra("mediacmd", appconstan
43、t.media_cmd_seekto);startservice(playintent);if (receiver=null)receiver=new lrcmessbroadcastreceiver();/兩個參數(shù),一個是指明操作,一個是指明過濾registerreceiver(receiver,getintentfilter();class listonclicklistener implements onclicklisteneroverridepublic void onclick(view v) intent intent = new intent();intent.setclass
44、(mpsplayer.this, localmpslist.class);startactivity(intent);/* * 一些基本操作,為方便代碼復(fù)用 */開始serviceprivate void initplayersrv()playintent =new intent();playintent.setclass(mpsplayer.this,playersrv.class);/發(fā)送播放操作給serviceprivate void playmp3() playintent.putextra("mediacmd", appconstant.media_cmd_pla
45、y);startservice (playintent);/發(fā)送暫停操作給serviceprivate void pausemp3() playintent.putextra("mediacmd", appconstant.media_cmd_pause);startservice (playintent);/得到廣播的itentprivate intentfilter getintentfilter()if (intentfilter=null)intentfilter=new intentfilter();intentfilter.addaction(appconsta
46、nt.lrc_message_action);return intentfilter;/換算歌曲時間private string gettimestr(long offsettime,boolean islongformat)int remainder=0;int mode=0;remainder=(int)offsettime) / (60 * 1000);string min=remainder +""mode=(int)offsettime) % (60 * 1000);remainder=mode / 1000;string sec=remainder +"
47、;"if (islongformat)mode=mode % 1000;string mill=mode/10 +""return min +":" +sec + "." +mill;elsereturn min +":" +sec;/* * 捕獲廣播和觸屏事件的方法 * author administrator * */更新歌詞,時間,進(jìn)度條等控件class lrcmessbroadcastreceiver extends broadcastreceiveroverridepublic void onr
48、eceive(context arg0, intent arg1) logo.setimageresource(logo_idlogo_index+%logo_id.length);int uicmd=arg1.getintextra("uicmd", appconstant.ui_cmd_updatelrc);if (uicmd=appconstant.ui_cmd_updatelrc)string lrcmess=arg1.getstringextra("lrcmess");lrc_view.settext(lrcmess);else if (uic
49、md=appconstant.ui_cmd_updateplaying)long currpos=arg1.getlongextra("currpos", 0);int duration = arg1.getintextra("duration", 0);string mp3info = arg1.getstringextra("mp3info");string img = arg1.getstringextra("img");dosomething(mp3info,img);seekbar.setmax(dura
50、tion);seekbar.setprogress(int) currpos);time_view.settext(gettimestr(currpos,false) + "/" + gettimestr(long)duration,false);else if (uicmd=appconstant.ui_cmd_initprogressbar)int duration=arg1.getintextra("duration", 0);seekbar.setmax(duration);time_view.settext("00:00/"
51、 + gettimestr(long)duration,false);else if (uicmd=appconstant.ui_cmd_clearplayinfo)lrc_view.settext("");seekbar.setprogress(0);/捕捉和識別觸屏事件overridepublic boolean ontouchevent(motionevent event) switch(event.getaction()case motionevent.action_down:downx = event.getx();downy = event.gety();dow
52、nt = event.geteventtime();break;case motionevent.action_move:break;case motionevent.action_up:upx = event.getx();upy = event.gety();upt = event.geteventtime();break;relatex = downx - upx ;relatey = downy - upy ;/一次點(diǎn)擊事件完成if(upt > 0)/是一次點(diǎn)擊事件if(math.abs(relatex) <= click_pointor && math.a
53、bs(relatey) <= click_pointor)/點(diǎn)擊超過一秒,定義為長觸屏事件if(upt - downt > 500)intent intent = new intent();intent.setclass(mpsplayer.this, localmpslist.class);startactivity(intent);elsell.setvisibility(view.visible);t = new thread(tr);t.start();else if(math.abs(relatex) > math.abs(relatey)if(downx > upx)nextmusic();else if(downx < upx)lastmusic()
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 法律文書電子簽管理員考試試卷及答案
- 外賣運(yùn)營專家筆試試題及答案
- 2025年槳扇發(fā)動機(jī)合作協(xié)議書
- 2025年細(xì)菌類診斷抗原項(xiàng)目建議書
- 基于Qt的探測器壽命試驗(yàn)系統(tǒng)設(shè)計(jì)及實(shí)踐
- 2025年溫州瑞安市中小學(xué)招聘事業(yè)編制教師考試試題【答案】
- 2025年十堰市茅箭區(qū)教育局所屬學(xué)校招聘教師考試試題【答案】
- 勞動保障局副局長述職報(bào)告
- 消防員個人工作自我鑒定范文
- 湘藝七年級下冊音樂教案
- 涉密人員涉密資格審查表
- GB/T 3332-2004紙漿打漿度的測定(肖伯爾-瑞格勒法)
- GB/T 10326-2016定形耐火制品尺寸、外觀及斷面的檢查方法
- 2023年鄭州發(fā)展投資集團(tuán)有限公司招聘筆試模擬試題及答案解析
- 精神科醫(yī)師晉升副主任(主任)醫(yī)師病例分析專題報(bào)告(雙相障礙診治)
- 設(shè)備調(diào)撥單表格
- 樣品簽收記錄表
- 中醫(yī)治療知情同意書實(shí)用
- 湖北省2019年考試錄用公務(wù)員全省法官助理職位資格復(fù)審公告
- 《高速鐵路竣工驗(yàn)收辦法》
- 震旦維修手冊
評論
0/150
提交評論