parent
14f2afa624
commit
ae0f6b4bf7
@ -0,0 +1,96 @@
|
||||
package com.example.musicplayer.adapter;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.musicplayer.R;
|
||||
import com.example.musicplayer.entiy.AlbumSong;
|
||||
import com.example.musicplayer.util.FileHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by 残渊 on 2018/11/27.
|
||||
*/
|
||||
|
||||
public class AlbumSongAdapter extends RecyclerView.Adapter<AlbumSongAdapter.ViewHolder> {
|
||||
|
||||
private List<AlbumSong.DataBean.SongsBean> mSongsBeanList;
|
||||
private int mLastPosition = -1;
|
||||
private SongClick mSongClick;
|
||||
|
||||
public AlbumSongAdapter(List<AlbumSong.DataBean.SongsBean> songsBeans){
|
||||
mSongsBeanList =songsBeans;
|
||||
}
|
||||
|
||||
public void setSongClick(SongClick songClick){
|
||||
mSongClick =songClick;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.recycler_song_search_item, parent, false);
|
||||
ViewHolder viewHolder = new ViewHolder(view);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
|
||||
AlbumSong.DataBean.SongsBean songsBean=mSongsBeanList.get(position);
|
||||
holder.artistTv.setText(songsBean.getSinger());
|
||||
holder.titleTv.setText(songsBean.getName());
|
||||
|
||||
if (FileHelper.getSong().getImgUrl() != null) {
|
||||
//根据点击显示
|
||||
holder.playLine.setVisibility((position == mLastPosition ? View.VISIBLE : View.INVISIBLE));
|
||||
holder.mItemView.setBackgroundResource((position == mLastPosition ? R.color.click : R.color.translucent));
|
||||
}
|
||||
holder.mItemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mSongClick.onClick(position);
|
||||
equalPosition(position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mSongsBeanList.size();
|
||||
}
|
||||
|
||||
class ViewHolder extends RecyclerView.ViewHolder{
|
||||
|
||||
TextView titleTv;
|
||||
TextView artistTv;
|
||||
View mItemView;
|
||||
View playLine;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
titleTv = itemView.findViewById(R.id.tv_title);
|
||||
artistTv = itemView.findViewById(R.id.tv_artist);
|
||||
playLine = itemView.findViewById(R.id.line_play);
|
||||
mItemView = itemView;
|
||||
}
|
||||
}
|
||||
//判断点击的是否为上一个点击的项目
|
||||
private void equalPosition(int position) {
|
||||
if (position != mLastPosition) {
|
||||
if (mLastPosition != -1) notifyItemChanged(mLastPosition);
|
||||
mLastPosition = position;
|
||||
}
|
||||
notifyItemChanged(position);
|
||||
}
|
||||
|
||||
public interface SongClick {
|
||||
void onClick(int position);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.example.musicplayer.adapter;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
|
||||
import com.example.musicplayer.view.SearchContentFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by 残渊 on 2018/11/25.
|
||||
*/
|
||||
|
||||
public class SearchAdapter extends FragmentPagerAdapter {
|
||||
private List<Fragment> mFragmentList;//顶部导航栏的内容即fragment
|
||||
private List<String> mTitle;//顶部导航栏的标题
|
||||
|
||||
|
||||
public SearchAdapter(FragmentManager fragmentManager, List<Fragment>fragments, List<String>title){
|
||||
super(fragmentManager);
|
||||
mFragmentList=fragments;
|
||||
mTitle=title;
|
||||
|
||||
}
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return mFragmentList.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mFragmentList.size();
|
||||
}
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return mTitle.get(position);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.example.musicplayer.contract;
|
||||
|
||||
import com.example.musicplayer.entiy.AlbumSong;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Created by 残渊 on 2018/11/27.
|
||||
*/
|
||||
|
||||
public interface IAlbumSongContract {
|
||||
interface Model{
|
||||
void getAlbumDetail(String id,int type); //获取专辑的更多信息
|
||||
}
|
||||
interface View{
|
||||
void setAlbumSongList(List<AlbumSong.DataBean.SongsBean> songList); //成功获取专辑歌曲后填充列表
|
||||
void showAlbumSongError();//获取专辑失败
|
||||
void showAlbumMessage(String name,String singer,String company,String desc); //展示专辑详细
|
||||
void showNetError(); //网络错误
|
||||
}
|
||||
interface Presenter{
|
||||
void getAlbumDetail(String id,int type); //获取专辑的更多信息
|
||||
void getAlbumDetailSuccess(int type,List<AlbumSong.DataBean.SongsBean>songList,
|
||||
String name,String singer,String company,String desc); //成功获取专辑信息
|
||||
void getAlbumDetailError(); //获取专辑信息失败
|
||||
void getAlbumError(); //接口出现问题
|
||||
}
|
||||
}
|
@ -0,0 +1,246 @@
|
||||
package com.example.musicplayer.entiy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by 残渊 on 2018/11/25.
|
||||
*/
|
||||
|
||||
public class Album {
|
||||
|
||||
/**
|
||||
* result : SUCCESS
|
||||
* code : 200
|
||||
* data : [{"albumID":8217,"albumMID":"000I5jJB3blWeN","albumName":"范特西","albumName_hilight":"范特西","albumPic":"http://y.gtimg.cn/music/photo_new/T002R180x180M000000I5jJB3blWeN.jpg","catch_song":"","docid":"9955806126048031202","publicTime":"2001-09-20","singerID":4558,"singerMID":"0025NhlN2yWrP4","singerName":"周杰伦","singerName_hilight":"<em>周杰伦<\/em>","singer_list":[{"id":4558,"mid":"0025NhlN2yWrP4","name":"周杰伦","name_hilight":"<em>周杰伦<\/em>"}],"song_count":10,"type":0}]
|
||||
*/
|
||||
|
||||
private String result;
|
||||
private int code;
|
||||
private List<DataBean> data;
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public List<DataBean> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<DataBean> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataBean {
|
||||
/**
|
||||
* albumID : 8217
|
||||
* albumMID : 000I5jJB3blWeN
|
||||
* albumName : 范特西
|
||||
* albumName_hilight : 范特西
|
||||
* albumPic : http://y.gtimg.cn/music/photo_new/T002R180x180M000000I5jJB3blWeN.jpg
|
||||
* catch_song :
|
||||
* docid : 9955806126048031202
|
||||
* publicTime : 2001-09-20
|
||||
* singerID : 4558
|
||||
* singerMID : 0025NhlN2yWrP4
|
||||
* singerName : 周杰伦
|
||||
* singerName_hilight : <em>周杰伦</em>
|
||||
* singer_list : [{"id":4558,"mid":"0025NhlN2yWrP4","name":"周杰伦","name_hilight":"<em>周杰伦<\/em>"}]
|
||||
* song_count : 10
|
||||
* type : 0
|
||||
*/
|
||||
|
||||
private int albumID;
|
||||
private String albumMID;
|
||||
private String albumName;
|
||||
private String albumName_hilight;
|
||||
private String albumPic;
|
||||
private String catch_song;
|
||||
private String docid;
|
||||
private String publicTime;
|
||||
private int singerID;
|
||||
private String singerMID;
|
||||
private String singerName;
|
||||
private String singerName_hilight;
|
||||
private int song_count;
|
||||
private int type;
|
||||
private List<SingerListBean> singer_list;
|
||||
|
||||
public int getAlbumID() {
|
||||
return albumID;
|
||||
}
|
||||
|
||||
public void setAlbumID(int albumID) {
|
||||
this.albumID = albumID;
|
||||
}
|
||||
|
||||
public String getAlbumMID() {
|
||||
return albumMID;
|
||||
}
|
||||
|
||||
public void setAlbumMID(String albumMID) {
|
||||
this.albumMID = albumMID;
|
||||
}
|
||||
|
||||
public String getAlbumName() {
|
||||
return albumName;
|
||||
}
|
||||
|
||||
public void setAlbumName(String albumName) {
|
||||
this.albumName = albumName;
|
||||
}
|
||||
|
||||
public String getAlbumName_hilight() {
|
||||
return albumName_hilight;
|
||||
}
|
||||
|
||||
public void setAlbumName_hilight(String albumName_hilight) {
|
||||
this.albumName_hilight = albumName_hilight;
|
||||
}
|
||||
|
||||
public String getAlbumPic() {
|
||||
return albumPic;
|
||||
}
|
||||
|
||||
public void setAlbumPic(String albumPic) {
|
||||
this.albumPic = albumPic;
|
||||
}
|
||||
|
||||
public String getCatch_song() {
|
||||
return catch_song;
|
||||
}
|
||||
|
||||
public void setCatch_song(String catch_song) {
|
||||
this.catch_song = catch_song;
|
||||
}
|
||||
|
||||
public String getDocid() {
|
||||
return docid;
|
||||
}
|
||||
|
||||
public void setDocid(String docid) {
|
||||
this.docid = docid;
|
||||
}
|
||||
|
||||
public String getPublicTime() {
|
||||
return publicTime;
|
||||
}
|
||||
|
||||
public void setPublicTime(String publicTime) {
|
||||
this.publicTime = publicTime;
|
||||
}
|
||||
|
||||
public int getSingerID() {
|
||||
return singerID;
|
||||
}
|
||||
|
||||
public void setSingerID(int singerID) {
|
||||
this.singerID = singerID;
|
||||
}
|
||||
|
||||
public String getSingerMID() {
|
||||
return singerMID;
|
||||
}
|
||||
|
||||
public void setSingerMID(String singerMID) {
|
||||
this.singerMID = singerMID;
|
||||
}
|
||||
|
||||
public String getSingerName() {
|
||||
return singerName;
|
||||
}
|
||||
|
||||
public void setSingerName(String singerName) {
|
||||
this.singerName = singerName;
|
||||
}
|
||||
|
||||
public String getSingerName_hilight() {
|
||||
return singerName_hilight;
|
||||
}
|
||||
|
||||
public void setSingerName_hilight(String singerName_hilight) {
|
||||
this.singerName_hilight = singerName_hilight;
|
||||
}
|
||||
|
||||
public int getSong_count() {
|
||||
return song_count;
|
||||
}
|
||||
|
||||
public void setSong_count(int song_count) {
|
||||
this.song_count = song_count;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<SingerListBean> getSinger_list() {
|
||||
return singer_list;
|
||||
}
|
||||
|
||||
public void setSinger_list(List<SingerListBean> singer_list) {
|
||||
this.singer_list = singer_list;
|
||||
}
|
||||
|
||||
public static class SingerListBean {
|
||||
/**
|
||||
* id : 4558
|
||||
* mid : 0025NhlN2yWrP4
|
||||
* name : 周杰伦
|
||||
* name_hilight : <em>周杰伦</em>
|
||||
*/
|
||||
|
||||
private int id;
|
||||
private String mid;
|
||||
private String name;
|
||||
private String name_hilight;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMid() {
|
||||
return mid;
|
||||
}
|
||||
|
||||
public void setMid(String mid) {
|
||||
this.mid = mid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName_hilight() {
|
||||
return name_hilight;
|
||||
}
|
||||
|
||||
public void setName_hilight(String name_hilight) {
|
||||
this.name_hilight = name_hilight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,16 @@
|
||||
package com.example.musicplayer.https.api;
|
||||
|
||||
import com.example.musicplayer.entiy.AlbumSong;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* Created by 残渊 on 2018/11/27.
|
||||
*/
|
||||
|
||||
public interface AlbumApi {
|
||||
@GET("album?key=579621905")
|
||||
Observable<AlbumSong> getAlbumSong(@Query("id")String id);
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.example.musicplayer.model;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.example.musicplayer.contract.IAlbumSongContract;
|
||||
import com.example.musicplayer.entiy.AlbumSong;
|
||||
import com.example.musicplayer.https.NetWork;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Created by 残渊 on 2018/11/27.
|
||||
*/
|
||||
|
||||
public class AlbumSongModel implements IAlbumSongContract.Model {
|
||||
private static final String TAG="AlbumSongModel";
|
||||
private IAlbumSongContract.Presenter mPresenter;
|
||||
|
||||
public AlbumSongModel(IAlbumSongContract.Presenter presenter){
|
||||
mPresenter = presenter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAlbumDetail(String id,final int type) {
|
||||
NetWork.getAlbumApi().getAlbumSong(id)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<AlbumSong>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(AlbumSong value) {
|
||||
if(value.getResult().equals("SUCCESS")){
|
||||
mPresenter.getAlbumDetailSuccess(type,value.getData().getSongs(),
|
||||
value.getData().getName(),value.getData().getSinger(),
|
||||
value.getData().getCompany(),value.getData().getDesc());
|
||||
}else{
|
||||
mPresenter.getAlbumDetailError();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.d(TAG, "onError: "+e.toString());
|
||||
mPresenter.getAlbumError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.example.musicplayer.presenter;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.example.musicplayer.base.BasePresenter;
|
||||
import com.example.musicplayer.contract.IAlbumSongContract;
|
||||
import com.example.musicplayer.entiy.AlbumSong;
|
||||
import com.example.musicplayer.model.AlbumSongModel;
|
||||
import com.example.musicplayer.view.AlbumSongFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by 残渊 on 2018/11/27.
|
||||
*/
|
||||
|
||||
public class AlbumSongPresenter extends BasePresenter<IAlbumSongContract.View> implements IAlbumSongContract.Presenter {
|
||||
|
||||
private final static String TAG="AlbumSongPresenter";
|
||||
|
||||
private AlbumSongModel mModel;
|
||||
|
||||
public AlbumSongPresenter() {
|
||||
mModel = new AlbumSongModel(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAlbumDetail(String id,int type) {
|
||||
mModel.getAlbumDetail(id,type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAlbumDetailSuccess(int type, List<AlbumSong.DataBean.SongsBean> songList,
|
||||
String name, String singer, String company, String desc) {
|
||||
if (isAttachView()) {
|
||||
if (type == AlbumSongFragment.ALBUM_SONG) {
|
||||
getMvpView().setAlbumSongList(songList);
|
||||
Log.d(TAG, "getAlbumDetailSuccess: "+songList.size());
|
||||
} else {
|
||||
getMvpView().showAlbumMessage(name, singer, company, desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAlbumDetailError() {
|
||||
if (isAttachView()) {
|
||||
getMvpView().showAlbumSongError();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAlbumError() {
|
||||
if (isAttachView()) {
|
||||
getMvpView().showNetError();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,166 @@
|
||||
package com.example.musicplayer.view;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.example.musicplayer.R;
|
||||
import com.example.musicplayer.util.CommonUtil;
|
||||
import com.github.florent37.materialviewpager.MaterialViewPager;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL;
|
||||
|
||||
/**
|
||||
* Created by 残渊 on 2018/11/25.
|
||||
*/
|
||||
|
||||
public class AlbumContentFragment extends Fragment {
|
||||
public static final String ALBUM_ID_KEY="id";
|
||||
private static final String ALBUM_NAME_KEY="albumName";
|
||||
private static final String SINGER_NAME_KEY="singerName";
|
||||
private static final String ALBUM_PIC_KEY="albumPic";
|
||||
public static final String PUBLIC_TIEM_KEY="publicTime";
|
||||
|
||||
private String mAlbumName,mSingerNmae,mAlbumPic,mPublicTime,mId;
|
||||
|
||||
private MaterialViewPager mViewPager;
|
||||
private Toolbar toolbar;
|
||||
private RelativeLayout mAlbumBackground;
|
||||
private TextView mSingerNameTv;
|
||||
private TextView mPublicTimeTv;
|
||||
private ImageView mAlbumPicIv;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
getBundle();
|
||||
View view = inflater.inflate(R.layout.fragment_album_content, container, false);
|
||||
mViewPager = view.findViewById(R.id.materialViewPager);
|
||||
toolbar = mViewPager.getToolbar();
|
||||
mAlbumBackground = mViewPager.getHeaderBackgroundContainer().findViewById(R.id.relative_album);
|
||||
mAlbumPicIv = mViewPager.getHeaderBackgroundContainer().findViewById(R.id.iv_album);
|
||||
mSingerNameTv = mViewPager.getHeaderBackgroundContainer().findViewById(R.id.tv_singer_name);
|
||||
mPublicTimeTv = mViewPager.getHeaderBackgroundContainer().findViewById(R.id.tv_public_time);
|
||||
return view;
|
||||
}
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
initView();
|
||||
}
|
||||
private void initView(){
|
||||
toolbar.setTitle(mAlbumName);
|
||||
|
||||
SimpleTarget target = new SimpleTarget<Drawable>(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) {
|
||||
@Override
|
||||
public void onResourceReady(@Nullable Drawable resource, Transition<? super Drawable> transition) {
|
||||
Bitmap bitmap = ((BitmapDrawable) resource).getBitmap();
|
||||
mAlbumBackground.setBackground(CommonUtil.getForegroundDrawable(bitmap));
|
||||
mAlbumPicIv.setImageBitmap(bitmap);
|
||||
}
|
||||
};
|
||||
Glide.with(getActivity())
|
||||
.load(mAlbumPic)
|
||||
.apply(RequestOptions.placeholderOf(R.drawable.welcome))
|
||||
.apply(RequestOptions.errorOf(R.drawable.welcome))
|
||||
.into(target);
|
||||
|
||||
|
||||
|
||||
mSingerNameTv.setText("歌手 "+mSingerNmae);
|
||||
mPublicTimeTv.setText("发行时间 "+mPublicTime);
|
||||
|
||||
toolbar.setTitleTextColor(getActivity().getResources().getColor(R.color.white));
|
||||
if (toolbar != null) {
|
||||
((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
|
||||
|
||||
final ActionBar actionBar = ((AppCompatActivity)getActivity()).getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setDisplayShowHomeEnabled(true);
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
actionBar.setDisplayUseLogoEnabled(false);
|
||||
actionBar.setHomeButtonEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
mViewPager.getViewPager().setAdapter(new FragmentStatePagerAdapter(getActivity().getSupportFragmentManager()) {
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
return AlbumSongFragment.newInstance(AlbumSongFragment.ALBUM_SONG,mId,mPublicTime);
|
||||
case 1:
|
||||
return AlbumSongFragment.newInstance(AlbumSongFragment.ALBUM_INFORATION,mId,mPublicTime);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
return "歌曲列表";
|
||||
case 1:
|
||||
return "专辑信息";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
});
|
||||
|
||||
mViewPager.getPagerTitleStrip().setViewPager(mViewPager.getViewPager());
|
||||
mViewPager.getPagerTitleStrip().setIndicatorColorResource(R.color.yellow);
|
||||
mViewPager.getPagerTitleStrip().setTabBackground(R.color.tab);
|
||||
mViewPager.getPagerTitleStrip().setTextColorStateListResource(R.color.white);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static Fragment newInstance(String id,String albumName,String albumPic,String singerName,String publicTime){
|
||||
AlbumContentFragment albumContentFragment = new AlbumContentFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(ALBUM_ID_KEY,id);
|
||||
bundle.putString(ALBUM_NAME_KEY,albumName);
|
||||
bundle.putString(ALBUM_PIC_KEY,albumPic);
|
||||
bundle.putString(SINGER_NAME_KEY,singerName);
|
||||
bundle.putString(PUBLIC_TIEM_KEY,publicTime);
|
||||
albumContentFragment.setArguments(bundle);
|
||||
return albumContentFragment;
|
||||
}
|
||||
private void getBundle(){
|
||||
Bundle bundle =getArguments();
|
||||
if(bundle !=null){
|
||||
mId =bundle.getString(ALBUM_ID_KEY);
|
||||
mAlbumName = bundle.getString(ALBUM_NAME_KEY);
|
||||
mAlbumPic = bundle.getString(ALBUM_PIC_KEY);
|
||||
mSingerNmae = bundle.getString(SINGER_NAME_KEY);
|
||||
mPublicTime = bundle.getString(PUBLIC_TIEM_KEY);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
package com.example.musicplayer.view;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.widget.NestedScrollView;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.musicplayer.R;
|
||||
import com.example.musicplayer.adapter.AlbumSongAdapter;
|
||||
import com.example.musicplayer.adapter.SearchContentAdapter;
|
||||
import com.example.musicplayer.constant.Constant;
|
||||
import com.example.musicplayer.contract.IAlbumSongContract;
|
||||
import com.example.musicplayer.entiy.Album;
|
||||
import com.example.musicplayer.entiy.AlbumSong;
|
||||
import com.example.musicplayer.entiy.SeachSong;
|
||||
import com.example.musicplayer.entiy.Song;
|
||||
import com.example.musicplayer.presenter.AlbumSongPresenter;
|
||||
import com.example.musicplayer.util.CommonUtil;
|
||||
import com.example.musicplayer.util.FileHelper;
|
||||
import com.github.florent37.materialviewpager.MaterialViewPagerHelper;
|
||||
import com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.example.musicplayer.view.SearchContentFragment.IS_ONLINE;
|
||||
|
||||
/**
|
||||
* Created by 残渊 on 2018/11/25.
|
||||
*/
|
||||
|
||||
public class AlbumSongFragment extends Fragment implements IAlbumSongContract.View{
|
||||
private static final String TYPE_KEY = "type_key";
|
||||
public static final int ALBUM_SONG = 0;
|
||||
public static final int ALBUM_INFORATION = 1;
|
||||
|
||||
private AlbumSongPresenter mPresenter;
|
||||
private String mId;
|
||||
|
||||
private NestedScrollView mScrollView;
|
||||
private TextView mNameTv,mSingerTv,mDescTv,mCompany,mPublicTimeTv;
|
||||
private int mType;
|
||||
private String mPublicTime;
|
||||
private String mDesc;
|
||||
|
||||
|
||||
private List<AlbumSong.DataBean.SongsBean> mSongsList;
|
||||
private RecyclerView mRecycle;
|
||||
private LinearLayoutManager mLinearManager;
|
||||
private AlbumSongAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
getBundle();
|
||||
View view = null;
|
||||
if (mType == ALBUM_SONG) {
|
||||
view = inflater.inflate(R.layout.fragment_album_recycler, container, false);
|
||||
mRecycle = view.findViewById(R.id.recycler_song_list);
|
||||
} else {
|
||||
view = inflater.inflate(R.layout.fragment_album_song, container, false);
|
||||
mScrollView = view.findViewById(R.id.scrollView);
|
||||
mDescTv = view.findViewById(R.id.tv_desc);
|
||||
mNameTv = view.findViewById(R.id.tv_album_name);
|
||||
mSingerTv = view.findViewById(R.id.tv_singer);
|
||||
mCompany = view.findViewById(R.id.tv_company);
|
||||
mPublicTimeTv = view.findViewById(R.id.tv_public_time);
|
||||
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle save) {
|
||||
super.onActivityCreated(save);
|
||||
MaterialViewPagerHelper.registerScrollView(getActivity(), mScrollView);
|
||||
mPresenter =new AlbumSongPresenter();
|
||||
mPresenter.attachView(this);
|
||||
mPresenter.getAlbumDetail(mId,mType);
|
||||
initView();
|
||||
}
|
||||
private void initView(){
|
||||
|
||||
}
|
||||
private void getBundle(){
|
||||
Bundle bundle = getArguments();
|
||||
if (bundle != null) {
|
||||
mType = bundle.getInt(TYPE_KEY);
|
||||
mId =bundle.getString(AlbumContentFragment.ALBUM_ID_KEY);
|
||||
mPublicTime = bundle.getString(AlbumContentFragment.PUBLIC_TIEM_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
public static Fragment newInstance(int type, String id,String publicTime) {
|
||||
AlbumSongFragment fragment = new AlbumSongFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(TYPE_KEY, type);
|
||||
bundle.putString(AlbumContentFragment.ALBUM_ID_KEY,id);
|
||||
bundle.putString(AlbumContentFragment.PUBLIC_TIEM_KEY, publicTime);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlbumSongList(final List<AlbumSong.DataBean.SongsBean> songList) {
|
||||
mLinearManager =new LinearLayoutManager(getActivity());
|
||||
mRecycle.setLayoutManager(mLinearManager);
|
||||
mAdapter =new AlbumSongAdapter(songList);
|
||||
mRecycle.addItemDecoration(new MaterialViewPagerHeaderDecorator());
|
||||
mRecycle.setAdapter(mAdapter);
|
||||
|
||||
mAdapter.setSongClick(new AlbumSongAdapter.SongClick() {
|
||||
@Override
|
||||
public void onClick(int position) {
|
||||
AlbumSong.DataBean.SongsBean dataBean= songList.get(position);
|
||||
Song song = new Song();
|
||||
song.setArtist(dataBean.getSinger());
|
||||
song.setTitle(dataBean.getName());
|
||||
song.setUrl(dataBean.getUrl());
|
||||
song.setImgUrl(dataBean.getPic());
|
||||
song.setCurrent(FileHelper.getSong() == null ? 0 : FileHelper.getSong().getCurrent());
|
||||
FileHelper.saveSong(song);
|
||||
|
||||
Intent intent = new Intent(getActivity(), PlayActivity.class);
|
||||
intent.putExtra(IS_ONLINE, true);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showAlbumSongError() {
|
||||
CommonUtil.showToast(getActivity(),"获取专辑信息失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showAlbumMessage(String name, String singer, String company, String desc) {
|
||||
mNameTv.setText(name);
|
||||
mSingerTv.setText(singer);
|
||||
mCompany.setText(company);
|
||||
mDescTv.setText(desc);
|
||||
mPublicTimeTv.setText(mPublicTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showNetError() {
|
||||
CommonUtil.showToast(getActivity(),"网络错误");
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
package com.example.musicplayer.view;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.example.musicplayer.R;
|
||||
import com.example.musicplayer.adapter.SearchAdapter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by 残渊 on 2018/11/25.
|
||||
*/
|
||||
|
||||
public class ContentFragment extends Fragment {
|
||||
|
||||
private List<String> mTitleList;
|
||||
private List<Fragment> mFragments;
|
||||
private ViewPager mPager;
|
||||
private SearchAdapter mAdapter;
|
||||
private TabLayout mTabLayout;
|
||||
private String[] mTitles = {"歌曲", "专辑"};
|
||||
private String[] mTypes = {"song", "album"};
|
||||
private Bundle mBundle;
|
||||
private String mSeek;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_content, container, false);
|
||||
mBundle = getArguments();
|
||||
if (mBundle != null) {
|
||||
mSeek = mBundle.getString(SearchContentFragment.SEEK_KEY);
|
||||
}
|
||||
|
||||
mPager = view.findViewById(R.id.page);
|
||||
mTabLayout = view.findViewById(R.id.tab_layout);
|
||||
mTitleList = new ArrayList<>();
|
||||
mFragments = new ArrayList<>();
|
||||
|
||||
initTab();
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
}
|
||||
|
||||
private void initTab() {
|
||||
for (int i = 0; i < mTitles.length; i++) {
|
||||
mTitleList.add(mTitles[i]);
|
||||
mFragments.add(SearchContentFragment.newInstance(mSeek, mTypes[i]));
|
||||
}
|
||||
mAdapter = new SearchAdapter(getChildFragmentManager(), mFragments, mTitleList);
|
||||
mPager.setAdapter(mAdapter);
|
||||
mTabLayout.setupWithViewPager(mPager);
|
||||
mTabLayout.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setIndicator(mTabLayout, 50, 50);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static Fragment newInstance(String seek) {
|
||||
ContentFragment fragment = new ContentFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(SearchContentFragment.SEEK_KEY, seek);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
||||
//修改tab指示线大小
|
||||
public static void setIndicator(TabLayout tabs, int leftDip, int rightDip) {
|
||||
Class<?> tabLayout = tabs.getClass();
|
||||
Field tabStrip = null;
|
||||
try {
|
||||
tabStrip = tabLayout.getDeclaredField("mTabStrip");
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
tabStrip.setAccessible(true);
|
||||
LinearLayout llTab = null;
|
||||
try {
|
||||
llTab = (LinearLayout) tabStrip.get(tabs);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
int left = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, leftDip, Resources.getSystem().getDisplayMetrics());
|
||||
int right = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, rightDip, Resources.getSystem().getDisplayMetrics());
|
||||
for (int i = 0; i < llTab.getChildCount(); i++) {
|
||||
View child = llTab.getChildAt(i);
|
||||
child.setPadding(0, 0, 0, 0);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1);
|
||||
params.leftMargin = left;
|
||||
params.rightMargin = right;
|
||||
child.setLayoutParams(params);
|
||||
child.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.example.musicplayer.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
/**
|
||||
* Created by 残渊 on 2018/11/26.
|
||||
*/
|
||||
|
||||
|
||||
public class CustomDrawerLayout extends DrawerLayout {
|
||||
|
||||
public CustomDrawerLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public CustomDrawerLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public CustomDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
widthMeasureSpec = MeasureSpec.makeMeasureSpec(
|
||||
MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY);
|
||||
heightMeasureSpec = MeasureSpec.makeMeasureSpec(
|
||||
MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY);
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 37 KiB |
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/linear_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:fitsSystemWindows="true"
|
||||
android:clipToPadding="false"
|
||||
>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="25dp"
|
||||
android:background="@color/actionBarColor"/>
|
||||
|
||||
<com.github.florent37.materialviewpager.MaterialViewPager
|
||||
android:fitsSystemWindows="true"
|
||||
android:clipToPadding="false"
|
||||
android:id="@+id/materialViewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:viewpager_logoMarginTop="100dp"
|
||||
app:viewpager_color="@color/actionBarColor"
|
||||
app:viewpager_headerHeight="300dp"
|
||||
app:viewpager_hideToolbarAndTitle="false"
|
||||
app:viewpager_header="@layout/header"
|
||||
app:viewpager_headerAdditionalHeight="-13dp"
|
||||
app:viewpager_disableToolbar="false"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recycler_song_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="65dp">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,178 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/material_view_pager_placeholder" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/translucent"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="15dp">
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.1dip"
|
||||
android:background="@color/line"
|
||||
/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:text="专辑"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_album_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:text="我很忙"
|
||||
android:textColor="@color/white_blue"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.1dip"
|
||||
android:background="@color/line" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:text="歌手"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_singer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:text="周杰伦"
|
||||
android:textColor="@color/white_blue"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.1dip"
|
||||
android:background="@color/line"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:text="唱片公司"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_company"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:text="杰威尔音乐"
|
||||
android:textColor="@color/white_blue"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.1dip"
|
||||
android:background="@color/line" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:text="发行时间"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_public_time"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:text="2007-11-01"
|
||||
android:textColor="@color/white_blue"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.1dp"
|
||||
android:background="@color/line" />
|
||||
|
||||
<TextView
|
||||
android:textColor="@color/white_blue"
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:lineSpacingMultiplier="1.5"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.1dp"
|
||||
android:background="@color/line"
|
||||
android:layout_marginBottom="50dp"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
</LinearLayout>
|
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tab_layout"
|
||||
android:background="@color/tab"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
style="@style/MyTabLayoutStyle">
|
||||
|
||||
</android.support.design.widget.TabLayout>
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/page"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</android.support.v4.view.ViewPager>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/relative_album"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/jay">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/iv_album_pic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginStart="30dp"
|
||||
app:cardCornerRadius="5dp"
|
||||
android:layout_marginTop="80dp"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_album"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="130dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/jay"
|
||||
/>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
<LinearLayout
|
||||
android:layout_marginTop="125dp"
|
||||
android:layout_toRightOf="@+id/iv_album_pic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<TextView
|
||||
android:id="@+id/tv_singer_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:text="歌手 周杰伦"
|
||||
android:textColor="@color/white"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_public_time"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:text="发行时间 2007-11-01"
|
||||
android:textColor="@color/white_easy"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/logo_white"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/iv_album_pic"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginStart="15dp"
|
||||
app:cardCornerRadius="5dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_album"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/jay"
|
||||
/>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
</LinearLayout>
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.astuetz.PagerSlidingTabStrip
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@id/materialviewpager_pagerTitleStrip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:pstsPaddingMiddle="true"
|
||||
app:pstsDividerPadding="20dp"
|
||||
app:pstsIndicatorColor="#FFF"
|
||||
app:pstsIndicatorHeight="2dp"
|
||||
app:pstsShouldExpand="true"
|
||||
app:pstsTabPaddingLeftRight="10dp"
|
||||
app:pstsTabTextAllCaps="true"
|
||||
tools:background="#A333"
|
||||
/>
|
@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@color/translucent">
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:id="@+id/iv_album_pic"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginStart="15dp"
|
||||
app:cardCornerRadius="5dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_album"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/welcome"
|
||||
/>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
<LinearLayout
|
||||
android:layout_toRightOf="@+id/iv_album_pic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_album_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="我很忙"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:paddingEnd="20dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_singer_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="周杰伦"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/white"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/tv_public_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="2007-11-01"
|
||||
android:ellipsize="end"
|
||||
android:textSize="12sp"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginBottom="3dp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_toRightOf="@+id/iv_album_pic"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.1dip"
|
||||
android:background="@color/gray" />
|
||||
|
||||
|
||||
</RelativeLayout>
|
Loading…
Reference in new issue