|
|
|
@ -1,37 +1,145 @@
|
|
|
|
|
package com.example.musicplayer.contract;
|
|
|
|
|
|
|
|
|
|
// 导入所需的包和类
|
|
|
|
|
import com.example.musicplayer.base.presenter.IPresenter;
|
|
|
|
|
import com.example.musicplayer.base.view.BaseView;
|
|
|
|
|
import com.example.musicplayer.entiy.Song;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created by 残渊 on 2018/10/26.
|
|
|
|
|
* 定义了播放模块的契约类,包含视图(View)和 presenter 之间的接口。
|
|
|
|
|
* <p>
|
|
|
|
|
* author : 残渊
|
|
|
|
|
* time : 2018/10/26
|
|
|
|
|
* desc : 规定了播放模块中视图和 presenter 需要实现的方法。
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
public interface IPlayContract {
|
|
|
|
|
/**
|
|
|
|
|
* 定义了视图(View)需要实现的方法。
|
|
|
|
|
*/
|
|
|
|
|
interface View extends BaseView {
|
|
|
|
|
String getSingerName(); //得到歌手的姓名
|
|
|
|
|
void getSingerAndLrc();//按钮点击事件,获取封面和歌词
|
|
|
|
|
void setSingerImg(String ImgUrl); //将图片设置成背景
|
|
|
|
|
void showLove(boolean love); //判断是否显示我喜欢的图标
|
|
|
|
|
void showLoveAnim(); //喜欢的动画
|
|
|
|
|
void saveToLoveSuccess();//保存到我喜欢数据库成功
|
|
|
|
|
void sendUpdateCollection(); //发送广播更新收藏列表
|
|
|
|
|
void showLrc(String lrc);//显示歌词
|
|
|
|
|
void getLrcError(String content);//获取不到歌词
|
|
|
|
|
void setLocalSongId(String songId); //设置本地音乐的songId
|
|
|
|
|
void getSongIdSuccess(String songId);//成功获取到该音乐的id
|
|
|
|
|
void saveLrc(String lrc);//保存歌词
|
|
|
|
|
/**
|
|
|
|
|
* 获取歌手的姓名。
|
|
|
|
|
* @return 歌手姓名。
|
|
|
|
|
*/
|
|
|
|
|
String getSingerName();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 按钮点击事件,获取封面和歌词。
|
|
|
|
|
*/
|
|
|
|
|
void getSingerAndLrc();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 将图片设置成背景。
|
|
|
|
|
* @param ImgUrl 背景图片的URL。
|
|
|
|
|
*/
|
|
|
|
|
void setSingerImg(String ImgUrl);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断是否显示我喜欢的图标。
|
|
|
|
|
* @param love 是否喜欢。
|
|
|
|
|
*/
|
|
|
|
|
void showLove(boolean love);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 显示喜欢的动画。
|
|
|
|
|
*/
|
|
|
|
|
void showLoveAnim();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 保存到我喜欢数据库成功。
|
|
|
|
|
*/
|
|
|
|
|
void saveToLoveSuccess();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 发送广播更新收藏列表。
|
|
|
|
|
*/
|
|
|
|
|
void sendUpdateCollection();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 显示歌词。
|
|
|
|
|
* @param lrc 歌词内容。
|
|
|
|
|
*/
|
|
|
|
|
void showLrc(String lrc);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取不到歌词时显示错误信息。
|
|
|
|
|
* @param content 错误内容。
|
|
|
|
|
*/
|
|
|
|
|
void getLrcError(String content);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置本地音乐的songId。
|
|
|
|
|
* @param songId 歌曲ID。
|
|
|
|
|
*/
|
|
|
|
|
void setLocalSongId(String songId);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 成功获取到该音乐的id。
|
|
|
|
|
* @param songId 歌曲ID。
|
|
|
|
|
*/
|
|
|
|
|
void getSongIdSuccess(String songId);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 保存歌词。
|
|
|
|
|
* @param lrc 歌词内容。
|
|
|
|
|
*/
|
|
|
|
|
void saveLrc(String lrc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 定义了 presenter 需要实现的方法。
|
|
|
|
|
*/
|
|
|
|
|
interface Presenter extends IPresenter<View> {
|
|
|
|
|
void getSingerImg(String singer,String song,long duration);
|
|
|
|
|
void getLrc(String songId,int type);//获取歌词
|
|
|
|
|
void getSongId(String song,long duration);//获取歌曲在qq音乐中的id
|
|
|
|
|
void setPlayMode(int mode);//保存播放状态
|
|
|
|
|
int getPlayMode();//得到播放状态
|
|
|
|
|
|
|
|
|
|
void queryLove(String songId);//查询我喜欢的数据库中有没这首歌
|
|
|
|
|
void saveToLove(Song song); //添加到我喜欢的表
|
|
|
|
|
void deleteFromLove(String songId); //从我喜欢的表中移除
|
|
|
|
|
/**
|
|
|
|
|
* 获取歌手图片。
|
|
|
|
|
* @param singer 歌手名称。
|
|
|
|
|
* @param song 歌曲名称。
|
|
|
|
|
* @param duration 歌曲时长。
|
|
|
|
|
*/
|
|
|
|
|
void getSingerImg(String singer, String song, long duration);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取歌词。
|
|
|
|
|
* @param songId 歌曲ID。
|
|
|
|
|
* @param type 类型。
|
|
|
|
|
*/
|
|
|
|
|
void getLrc(String songId, int type);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取歌曲在qq音乐中的id。
|
|
|
|
|
* @param song 歌曲名称。
|
|
|
|
|
* @param duration 歌曲时长。
|
|
|
|
|
*/
|
|
|
|
|
void getSongId(String song, long duration);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 保存播放模式。
|
|
|
|
|
* @param mode 播放模式。
|
|
|
|
|
*/
|
|
|
|
|
void setPlayMode(int mode);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取播放模式。
|
|
|
|
|
* @return 当前播放模式。
|
|
|
|
|
*/
|
|
|
|
|
int getPlayMode();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询我喜欢的数据库中是否有这首歌。
|
|
|
|
|
* @param songId 歌曲ID。
|
|
|
|
|
*/
|
|
|
|
|
void queryLove(String songId);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加到我喜欢的表。
|
|
|
|
|
* @param song 歌曲对象。
|
|
|
|
|
*/
|
|
|
|
|
void saveToLove(Song song);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 从我喜欢的表中移除。
|
|
|
|
|
* @param songId 歌曲ID。
|
|
|
|
|
*/
|
|
|
|
|
void deleteFromLove(String songId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|