admin 管理员组

文章数量: 887007

音乐播放器简单版加欢迎页面SP添加MySQ数据库存储

//这是欢迎页面
package com.example.yinyuebofang;import androidx.appcompat.app.AppCompatActivity;import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;public class MainActivity2 extends AppCompatActivity {private Button bu1;private Button button;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main2);bu1 = (Button) findViewById(R.id.bu1);button = (Button) findViewById(R.id.button);SharedPreferences ssd = getSharedPreferences("ssd", MODE_PRIVATE);if(ssd.getAll().size()>0){Intent intent=new Intent(MainActivity2.this,MainActivity.class);startActivity(intent);}else {bu1.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {ssd.edit().putString("ssd","ssd")mit();Intent intent=new Intent(MainActivity2.this,MainActivity.class);startActivity(intent);}});button.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {finish();}});}}
}
//音乐控制
package com.example.yinyuebofang;
import static com.example.yinyuebofang.fg.BlankFragment2.shows;import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;import com.bumptech.glide.Glide;
import com.example.yinyuebofang.gongju.Gongchang;
import com.example.yinyuebofang.gongju.LanJanzai;
import com.example.yinyuebofang.gongju.Nugong;
import com.google.android.material.tabs.TabLayout;
import com.youth.banner.Banner;
import com.youth.banner.loader.ImageLoader;import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;public class MainActivity extends AppCompatActivity {private Banner ban;private List<String>list1=new ArrayList<>();private TabLayout tabl;private List<String>list2=new ArrayList<>();private ViewPager vip;private List<Fragment>list3=new ArrayList<>();private LanJanzai lanJanzai;private ImageView im1;private ImageView im2;private ImageView im3;private ImageView im4;private ImageView im5;private static TextView text1;private static TextView text2;private TextView text3;private TextView text4;private SeekBar see;private Handler handler=new Handler();@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);ban = (Banner) findViewById(R.id.ban);list1.add("http://43.143.146.165:8080/gift/1.jpg");list1.add("http://43.143.146.165:8080/gift/2.jpg");list1.add("http://43.143.146.165:8080/gift/3.jpg");list1.add("http://43.143.146.165:8080/gift/4.jpg");list1.add("http://43.143.146.165:8080/gift/5.jpg");list1.add("http://43.143.146.165:8080/gift/6.jpg");list1.add("http://43.143.146.165:8080/gift/7.jpg");list1.add("http://43.143.146.165:8080/gift/8.jpg");list1.add("http://43.143.146.165:8080/gift/9.jpg");//轮播图ban.setImages(list1);//添加ban.setImageLoader(new ImageLoader() {@Overridepublic void displayImage(Context context, Object path, ImageView imageView) {Glide.with(context).load(path).into(imageView);}//网络图片用Glide解开}).start();//展示tabl = (TabLayout) findViewById(R.id.tabl);vip = (ViewPager) findViewById(R.id.vip);}@Overrideprotected void onResume() {//懒加载list2.add("音乐列表");list2.add("音乐歌词");list2.add("音乐收藏");//滑动展示list3.add(Gongchang.srest(Gongchang.HSW_A));list3.add(Gongchang.srest(Gongchang.HSW_B));list3.add(Gongchang.srest(Gongchang.HSW_C));//工厂添加lanJanzai=new LanJanzai(getSupportFragmentManager(),list2,list3);vip.setAdapter(lanJanzai);tabl.setupWithViewPager(vip);super.onResume();im1 = (ImageView) findViewById(R.id.im1);im2 = (ImageView) findViewById(R.id.im2);im3 = (ImageView) findViewById(R.id.im3);im4 = (ImageView) findViewById(R.id.im4);im5 = (ImageView) findViewById(R.id.im5);im3.setOnClickListener(new View.OnClickListener() {//暂停@Overridepublic void onClick(View view) {Nugong.getInstance().zan(im3);show();shows();}});im1.setOnClickListener(new View.OnClickListener() {//上一首@Overridepublic void onClick(View view) {Nugong.getInstance().shang();show();shows();}});im5.setOnClickListener(new View.OnClickListener() {//下一首@Overridepublic void onClick(View view) {Nugong.getInstance().xia();show();shows();}});im2.setOnClickListener(new View.OnClickListener() {//后退5秒@Overridepublic void onClick(View view) {Nugong.getInstance().qian();}});im4.setOnClickListener(new View.OnClickListener() {//前进5秒@Overridepublic void onClick(View view) {Nugong.getInstance().hou();}});text1 = (TextView) findViewById(R.id.text1);text2 = (TextView) findViewById(R.id.text2);text3 = (TextView) findViewById(R.id.text3);text4 = (TextView) findViewById(R.id.text4);see = (SeekBar) findViewById(R.id.see);Timer timer = new Timer();timer.schedule(new TimerTask() {//进度条展示@Overridepublic void run() {handler.post(new Runnable() {@Overridepublic void run() {int xian = Nugong.getInstance().xian();//音乐方法现在时间int zong = Nugong.getInstance().zong();//音乐方法总时间SimpleDateFormat simpleDateFormat=new             SimpleDateFormat("mm:ss");//时间展示text3.setText(simpleDateFormat.format(xian));//音乐方法现在时间text4.setText(simpleDateFormat.format(zong));//音乐方法总时间see.setMax(zong);//总时间see.setProgress(xian);}});}},0,1000);see.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {//进度条拖拽@Overridepublic void onProgressChanged(SeekBar seekBar, int i, boolean b) {if(b){Nugong.getInstance().tuo(i);}}@Overridepublic void onStartTrackingTouch(SeekBar seekBar) {}@Overridepublic void onStopTrackingTouch(SeekBar seekBar) {}});}public static void show(){//上下文展示方法调用String name = Nugong.getInstance().name();String shou = Nugong.getInstance().shou();text1.setText(name);text2.setText(shou);}
}
package com.example.yinyuebofang.adapter;import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;import com.example.yinyuebofang.R;
import com.example.yinyuebofang.enity.YinyueEnity;
import com.example.yinyuebofang.gongju.LanJanzai;import java.util.ArrayList;
import java.util.List;public class YinyueAdapter extends BaseAdapter {//适配器private List<YinyueEnity.DataDTO> list=new ArrayList<>();private Context context;public YinyueAdapter(List<YinyueEnity.DataDTO> list, Context context) {this.list = list;this.context = context;}@Overridepublic int getCount() {return list.size();}@Overridepublic Object getItem(int i) {return list.get(i);}@Overridepublic long getItemId(int i) {return i;}@Overridepublic View getView(int i, View view, ViewGroup viewGroup) {View inflate = LayoutInflater.from(context).inflate(R.layout.yinyue, null);TextView textView1=inflate.findViewById(R.id.textView);TextView textView2=inflate.findViewById(R.id.textView2);TextView textView3=inflate.findViewById(R.id.textView3);textView1.setText(list.get(i).getTitle()+"");textView2.setText(list.get(i).getArtist()+"");int i1= Integer.parseInt(list.get(i).getDuration());textView3.setText(i1/1000/60+":"+i1/1000%60+"分");return inflate;}
}
package com.example.yinyuebofang.enity;import java.util.List;public class YinyueEnity {//类private int code;private List<DataDTO> data;public int getCode() {return code;}public void setCode(int code) {this.code = code;}public List<DataDTO> getData() {return data;}public void setData(List<DataDTO> data) {this.data = data;}public static class DataDTO {private int id;private String title;private String artist;private String data;private int mvid;private String album;private int size;private String duration;private String lrc;public int getId() {return id;}public void setId(int id) {this.id = id;}public String getTitle() {return title;}public void setTitle(String title) {this.title = title;}public String getArtist() {return artist;}public void setArtist(String artist) {this.artist = artist;}public String getData() {return data;}public void setData(String data) {this.data = data;}public int getMvid() {return mvid;}public void setMvid(int mvid) {this.mvid = mvid;}public String getAlbum() {return album;}public void setAlbum(String album) {this.album = album;}public int getSize() {return size;}public void setSize(int size) {this.size = size;}public String getDuration() {return duration;}public void setDuration(String duration) {this.duration = duration;}public String getLrc() {return lrc;}public void setLrc(String lrc) {this.lrc = lrc;}}
}
package com.example.yinyuebofang.fg;import static com.example.yinyuebofang.MainActivity.show;
import static com.example.yinyuebofang.fg.BlankFragment2.shows;import android.content.ContentValues;
import android.content.DialogInterface;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import android.os.Bundle;import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;import com.example.yinyuebofang.R;
import com.example.yinyuebofang.adapter.YinyueAdapter;
import com.example.yinyuebofang.enity.YinyueEnity;
import com.example.yinyuebofang.gongju.MySqTime;
import com.example.yinyuebofang.gongju.NetUitl;
import com.example.yinyuebofang.gongju.Nugong;
import com.google.gson.Gson;import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.HttpURLConnection;
import java.MalformedURLException;
import java.URL;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;public class BlankFragment extends Fragment {private ListView lv;private List<YinyueEnity.DataDTO>list=new ArrayList<>();private YinyueAdapter yinyueAdapter;private MySqTime mySqTime;private SQLiteDatabase se;private EditText ed;boolean isw=false;boolean isb=false;public BlankFragment() {//模糊搜索// Required empty public constructor}@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {View inflate = inflater.inflate(R.layout.fragment_blank, container, false);lv = inflate.findViewById(R.id.lv);ed = inflate.findViewById(R.id.ed);ed.addTextChangedListener(new TextWatcher() {@Overridepublic void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}@Overridepublic void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {String s = ed.getText().toString();List<YinyueEnity.DataDTO> list =new ArrayList<>();for(YinyueEnity.DataDTO dataDTO:Nugong.getInstance().getList()){if(dataDTO.getTitle().contains(s)){list.add(dataDTO);}}YinyueAdapter yinyueAdapter1 = new YinyueAdapter(list, getActivity());lv.setAdapter(yinyueAdapter1);}@Overridepublic void afterTextChanged(Editable editable) {}});isw=true;Nugong.getInstance().setList(list);lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {@Overridepublic void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {Nugong.getInstance().bofang(i);show();shows();}});lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {@Overridepublic boolean onItemLongClick(AdapterView<?> adapterView, View view, int n, long l) {AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());builder.setTitle("是否收藏").setPositiveButton("确定", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialogInterface, int i) {ContentValues contentValues = new ContentValues();contentValues.put("title",list.get(n).getTitle());contentValues.put("artist",list.get(n).getArtist());contentValues.put("time",list.get(n).getDuration());se.insert("mc",null,contentValues);Toast.makeText(getActivity(), "收藏成功", Toast.LENGTH_SHORT).show();}}).setNegativeButton("取消", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialogInterface, int i) {Toast.makeText(getActivity(), "取消收藏", Toast.LENGTH_SHORT).show();}}).create().show();return true;}});return inflate;}class Yinyue extends AsyncTask<String, Instant,String>{@Overrideprotected String doInBackground(String... strings) {return NetUitl.getInstance().Yin(strings[0]);}@Overrideprotected void onPostExecute(String s) {super.onPostExecute(s);YinyueEnity yinyueEnity = new Gson().fromJson(s, YinyueEnity.class);List<YinyueEnity.DataDTO> data = yinyueEnity.getData();list.clear();list.addAll(data);yinyueAdapter.notifyDataSetChanged();}}@Overridepublic void setUserVisibleHint(boolean isVisibleToUser) {super.setUserVisibleHint(isVisibleToUser);if(isVisibleToUser){isb=true;lay();}else {isb=false;}}private void lay() {if(isb&&isw){isb=false;isw=false;}}@Overridepublic void onResume() {new Yinyue().execute("http://39.106.204.190:7777/music/search?singer=邓紫棋");yinyueAdapter=new YinyueAdapter(list,getActivity());lv.setAdapter(yinyueAdapter);yinyueAdapter.notifyDataSetChanged();mySqTime=new MySqTime(getActivity());se=mySqTime.getWritableDatabase();super.onResume();}
}
package com.example.yinyuebofang.fg;import android.os.Bundle;import androidx.fragment.app.Fragment;import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;import com.bawei.lrcutils.YaoLrcHelper;
import com.example.yinyuebofang.R;
import com.example.yinyuebofang.adapter.YinyueAdapter;
import com.example.yinyuebofang.gongju.Nugong;
import com.lauzy.freedom.library.Lrc;
import com.lauzy.freedom.library.LrcView;import java.sql.Time;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;public class BlankFragment2 extends Fragment {//歌词private static TextView text7;private static TextView text8;private static LrcView lrc;boolean isq=false;boolean isa=false;private Handler handler=new Handler();public BlankFragment2() {// Required empty public constructor}@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {View inflate = inflater.inflate(R.layout.fragment_blank2, container, false);text7 = inflate. findViewById(R.id.text7);text8 = inflate. findViewById(R.id.text8);lrc = inflate.findViewById(R.id.lrc);isq=true;return inflate;}@Overridepublic void setUserVisibleHint(boolean isVisibleToUser) {super.setUserVisibleHint(isVisibleToUser);if(isVisibleToUser){isa=true;lax();}else {isa=false;}}private void lax() {if(isa&&isq){isa=false;isq=false;}}@Overridepublic void onResume() {Timer timer = new Timer();timer.schedule(new TimerTask() {@Overridepublic void run() {handler.post(new Runnable() {@Overridepublic void run() {int xian = Nugong.getInstance().xian();lrc.updateTime(xian);}});}},0,1000);lrc.setOnPlayIndicatorLineListener(new LrcView.OnPlayIndicatorLineListener() {@Overridepublic void onPlay(long time, String content) {Nugong.getInstance().tuo((int)time);}});super.onResume();}public static void shows(){String name = Nugong.getInstance().name();String shou = Nugong.getInstance().shou();text7.setText(name);text8.setText(shou);YaoLrcHelper.parseUrl(Nugong.getInstance().lrc(), new YaoLrcHelper.LrcCallBack() {@Overridepublic void getLrcData(List<Lrc> list) {lrc.setLrcData(list);}});}
}
package com.example.yinyuebofang.fg;
import android.annotation.SuppressLint;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.PopupMenu;
import com.example.yinyuebofang.R;
import com.example.yinyuebofang.adapter.YinyueAdapter;
import com.example.yinyuebofang.enity.YinyueEnity;
import com.example.yinyuebofang.gongju.MySqTime;
import com.example.yinyuebofang.gongju.Nugong;import java.util.ArrayList;
import java.util.List;
public class BlankFragment3 extends Fragment {//数据展示private ListView liv;private MySqTime mSqTime;private SQLiteDatabase se;private List<YinyueEnity.DataDTO>list=new ArrayList<>();private YinyueAdapter yinyueAdapter;public BlankFragment3() {// Required empty public constructor}@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {View inflate = inflater.inflate(R.layout.fragment_blank3, container, false);liv = inflate. findViewById(R.id.liv);mSqTime=new MySqTime(getActivity());se=mSqTime.getWritableDatabase();liv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {@Overridepublic boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {popMenu(i);return true;}});return inflate;}@SuppressLint("Range")@Overridepublic void onResume() {super.onResume();list.clear();Cursor mc = se.query("mc", null, null, null, null, null, null);if(mc!=null){while (mc.moveToNext()){String title = mc.getString(mc.getColumnIndex("title"));String artist = mc.getString(mc.getColumnIndex("artist"));String time = mc.getString(mc.getColumnIndex("time"));YinyueEnity.DataDTO yyue =new YinyueEnity.DataDTO();yyue.setTitle(title);yyue.setArtist(artist);yyue.setDuration(time);list.add(yyue);}}yinyueAdapter=new YinyueAdapter(list,getActivity());liv.setAdapter(yinyueAdapter);}public void popMenu(int a) {PopupMenu popupMenu = new PopupMenu(getActivity(), liv);popupMenu.inflate(R.menu.menu);popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {@Overridepublic boolean onMenuItemClick(MenuItem menuItem) {se.delete("mc","title=?",new String[]{list.get(a).getTitle()});return false;}});popupMenu.show();}
}
package com.example.yinyuebofang.gongju;import android.util.SparseArray;import androidx.fragment.app.Fragment;import com.example.yinyuebofang.fg.BlankFragment;
import com.example.yinyuebofang.fg.BlankFragment2;
import com.example.yinyuebofang.fg.BlankFragment3;public class Gongchang {public static final int HSW_A=0;public static final int HSW_B=1;public static final int HSW_C=2;private static SparseArray<Fragment>sparseArray=new SparseArray<>();public static Fragment srest(int id){Fragment fragment=sparseArray.get(id);if(fragment==null){switch (id){case HSW_A:fragment=new BlankFragment();break;case HSW_B:fragment=new BlankFragment2();break;case HSW_C:fragment=new BlankFragment3();break;}}sparseArray.put(id,fragment);return fragment;}
}
package com.example.yinyuebofang.gongju;import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;import java.util.List;public class LanJanzai extends FragmentPagerAdapter {private List<String>list1;private List<Fragment>list2;public LanJanzai(@NonNull FragmentManager fm, List<String> list1, List<Fragment> list2) {super(fm);this.list1 = list1;this.list2 = list2;}@NonNull@Overridepublic Fragment getItem(int position) {return list2.get(position);}@Overridepublic int getCount() {return list2.size();}@Nullable@Overridepublic CharSequence getPageTitle(int position) {return list1.get(position);}
}
package com.example.yinyuebofang.gongju;import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;public class MySqTime extends SQLiteOpenHelper {public MySqTime(@Nullable Context context) {super(context, "mc", null, 1);}@Overridepublic void onCreate(SQLiteDatabase sqLiteDatabase) {sqLiteDatabase.execSQL("create table mc(title varchar(255),artist varchar(255),time varchar(255))");}@Overridepublic void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {}
}
package com.example.yinyuebofang.gongju;import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.HttpURLConnection;
import java.MalformedURLException;
import java.URL;public class NetUitl {public NetUitl(){}public static NetUitl netUitl=null;public static NetUitl getInstance(){if(netUitl==null){netUitl=new NetUitl();}return netUitl;}public String Yin(String urls){try {URL url=new URL(urls);HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();httpURLConnection.setRequestMethod("GET");httpURLConnection.setReadTimeout(10*1000);httpURLConnection.setConnectTimeout(10*1000);httpURLConnection.connect();if(httpURLConnection.getResponseCode()==200){InputStream inputStream = httpURLConnection.getInputStream();BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));StringBuilder stringBuilder = new StringBuilder();String str="";while ((str=bufferedReader.readLine())!=null){stringBuilder.append(str);}return stringBuilder.toString();}} catch (MalformedURLException e) {throw new RuntimeException(e);} catch (IOException e) {throw new RuntimeException(e);}return urls;}
}
package com.example.yinyuebofang.gongju;import android.media.MediaPlayer;
import android.widget.ImageView;import com.example.yinyuebofang.R;
import com.example.yinyuebofang.enity.YinyueEnity;import java.io.IOException;
import java.util.ArrayList;
import java.util.List;public class Nugong {private MediaPlayer mediaPlayer;private int inid=0;private int in=0;private List<YinyueEnity.DataDTO>list=new ArrayList<>();private Nugong(){mediaPlayer=new MediaPlayer();}private static Nugong nugong=null;public static Nugong getInstance(){if(nugong==null){nugong=new Nugong();}return nugong;}public MediaPlayer getMediaPlayer() {return mediaPlayer;}public void setMediaPlayer(MediaPlayer mediaPlayer) {this.mediaPlayer = mediaPlayer;}public int getInid() {return inid;}public void setInid(int inid) {this.inid = inid;}public int getIn() {return in;}public void setIn(int in) {this.in = in;}public List<YinyueEnity.DataDTO> getList() {return list;}public void setList(List<YinyueEnity.DataDTO> list) {this.list = list;}public static Nugong getNugong() {return nugong;}public static void setNugong(Nugong nugong) {Nugong.nugong = nugong;}public void bofang(int i){inid=i;if(inid<0){inid=list.size()-1;}else if(inid>list.size()-1){inid=0;}if(mediaPlayer==null){mediaPlayer=new MediaPlayer();mediaPlayer.setOnCompletionListener(this::setMediaPlayer);}try {mediaPlayer.reset();mediaPlayer.setDataSource(list.get(inid).getData());mediaPlayer.prepare();mediaPlayer.start();} catch (IOException e) {throw new RuntimeException(e);}mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {@Overridepublic void onCompletion(MediaPlayer mediaPlayer) {bofang(++inid);}});}public void zan(ImageView imageView){if(mediaPlayer.isPlaying()){mediaPlayer.pause();imageView.setImageResource(R.drawable.img3);}else {mediaPlayer.start();imageView.setImageResource(R.drawable.img4);}}public void shang(){inid--;if(inid<0){inid=list.size()-1;}bofang(inid);}public void xia(){inid++;if(inid>list.size()-1){inid=0;}bofang(inid);}public void qian(){int times=mediaPlayer.getCurrentPosition();times-=5*1000;mediaPlayer.seekTo(times);}public void hou(){int times=mediaPlayer.getCurrentPosition();times+=5*1000;mediaPlayer.seekTo(times);}public String name(){return list.get(inid).getTitle();}public String shou(){return list.get(inid).getArtist();}public int xian(){return mediaPlayer.getCurrentPosition();}public int zong(){return mediaPlayer.getDuration();}public String lrc(){return list.get(inid).getLrc();}public void tuo(int times){mediaPlayer.seekTo(times);}
}

本文标签: 音乐播放器简单版加欢迎页面SP添加MySQ数据库存储