From 26bdcffb68e6475dc2d65e244a8c646109eadb58 Mon Sep 17 00:00:00 2001 From: yutou Date: Tue, 24 Nov 2020 18:32:19 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=9C=89=E5=86=85=E5=AD=98=E6=B3=84?= =?UTF-8?q?=E9=9C=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 + app/src/main/AndroidManifest.xml | 8 +- .../{containers => Datas}/MusicData.java | 25 ++- .../Datas/PreviousPlayerList.java | 34 ++++ .../containers/MediaBrowserHelper.java | 1 - .../containers/MusicContainer.java | 180 ++++++++++++++--- .../services/MusicService.java | 27 +-- .../yutou/nas_music_player/tools/AppData.java | 5 + .../nas_music_player/tools/AppTools.java | 86 ++++++++ .../nas_music_player/tools/NetworkTool.java | 6 +- .../nas_music_player/views/MainActivity.java | 188 +++++++++++++++--- .../nas_music_player/views/OpenActivity.java | 2 +- .../views/PlayLibsActivity.java | 145 ++++++++++++++ app/src/main/res/drawable/ic_play_list.png | Bin 0 -> 785 bytes app/src/main/res/drawable/ic_play_loop.png | Bin 0 -> 962 bytes .../main/res/drawable/ic_play_one_loop.png | Bin 0 -> 1098 bytes app/src/main/res/drawable/ic_play_random.png | Bin 0 -> 1286 bytes app/src/main/res/layout/activity_main.xml | 48 ++++- .../main/res/layout/activity_play_list.xml | 59 ++++++ app/src/main/res/layout/layout_play.xml | 91 +++++++++ app/src/main/res/values/colors.xml | 2 +- 21 files changed, 826 insertions(+), 85 deletions(-) rename app/src/main/java/com/yutou/nas_music_player/{containers => Datas}/MusicData.java (86%) create mode 100644 app/src/main/java/com/yutou/nas_music_player/Datas/PreviousPlayerList.java create mode 100644 app/src/main/java/com/yutou/nas_music_player/tools/AppTools.java create mode 100644 app/src/main/java/com/yutou/nas_music_player/views/PlayLibsActivity.java create mode 100644 app/src/main/res/drawable/ic_play_list.png create mode 100644 app/src/main/res/drawable/ic_play_loop.png create mode 100644 app/src/main/res/drawable/ic_play_one_loop.png create mode 100644 app/src/main/res/drawable/ic_play_random.png create mode 100644 app/src/main/res/layout/activity_play_list.xml create mode 100644 app/src/main/res/layout/layout_play.xml diff --git a/app/build.gradle b/app/build.gradle index 4d2655b..3af6eee 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -40,4 +40,8 @@ dependencies { implementation 'androidx.palette:palette:1.0.0' implementation 'com.github.zrunker:ZTextView:v1.0.2' + debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.5' + implementation 'com.kaopiz:kprogresshud:1.2.0' + implementation 'com.ogaclejapan.smarttablayout:library:2.0.0@aar' + } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 87c0897..b030d9d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,7 +15,7 @@ android:usesCleartextTraffic="true"> + android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"> @@ -25,7 +25,11 @@ + android:theme="@style/Theme.AppCompat.DayNight.NoActionBar" /> + list; + public PreviousPlayerList(){ + list=new ArrayList<>(); + } + public void add(MusicData musicData){ + MusicData tmp = null; + for (MusicData data : list) { + if(data.getFile().equals(musicData.getFile())){ + tmp=data; + } + + } + if(tmp!=null){ + list.remove(tmp); + } + list.add(musicData); + } + public MusicData getMusicData(){ + if(list.size()>1){ + list.remove(list.size()-1); + } + return list.get(list.size()-1); + } +} diff --git a/app/src/main/java/com/yutou/nas_music_player/containers/MediaBrowserHelper.java b/app/src/main/java/com/yutou/nas_music_player/containers/MediaBrowserHelper.java index a343ee2..f1a9b50 100644 --- a/app/src/main/java/com/yutou/nas_music_player/containers/MediaBrowserHelper.java +++ b/app/src/main/java/com/yutou/nas_music_player/containers/MediaBrowserHelper.java @@ -53,7 +53,6 @@ public class MediaBrowserHelper { public void regPlayListener(MediaControllerCompat.Callback playListener) { callbacks.add(playListener); } - private class MediaBrowserConnectionCallback extends MediaBrowserCompat.ConnectionCallback { @Override public void onConnected() { diff --git a/app/src/main/java/com/yutou/nas_music_player/containers/MusicContainer.java b/app/src/main/java/com/yutou/nas_music_player/containers/MusicContainer.java index 545a4ce..9e3722b 100644 --- a/app/src/main/java/com/yutou/nas_music_player/containers/MusicContainer.java +++ b/app/src/main/java/com/yutou/nas_music_player/containers/MusicContainer.java @@ -1,11 +1,17 @@ package com.yutou.nas_music_player.containers; import android.media.MediaPlayer; +import android.os.Build; import android.support.v4.media.MediaMetadataCompat; +import android.widget.Toast; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.yutou.nas_music_player.Datas.MusicData; +import com.yutou.nas_music_player.Datas.PreviousPlayerList; import com.yutou.nas_music_player.Interfaces.NetworkInterface; +import com.yutou.nas_music_player.MyApplication; +import com.yutou.nas_music_player.tools.ConfigTools; import com.yutou.nas_music_player.tools.NetworkTool; import com.yutou.nas_music_player.tools.StringUtil; @@ -18,23 +24,26 @@ import java.util.Random; import java.util.Timer; import java.util.TimerTask; +import static android.media.MediaPlayer.SEEK_PREVIOUS_SYNC; + public class MusicContainer { - public static final int PLAY_MODEL_RANDOM = 0; - public static final int PLAY_MODEL_LIST = 1; - public static final int PLAY_MODEL_TMP_LIST = 2; - public static final int PLAY_MODEL_ALBUM = 3; + public static final int PLAY_MODEL_RANDOM = 0;//随机 + public static final int PLAY_MODEL_ORDER = 1;//顺序 + public static final int PLAY_MODEL_ONE_LOOP = 2;//单曲循环 + public static final int PLAY_MODEL_LOOP = 3;//列表循环 private static MusicContainer container; private MusicLibs libs; private MediaPlayer mediaPlayer; private int playIndex = 0; private MusicData nowPlayData = null; - private final MusicLibsInitInterface initInterface; + private MusicLibsInitInterface initInterface; private List completionListener; private MediaBrowserHelper browserHelper; private List playList, tmpList; private Map> albumMapList; private int playModel = PLAY_MODEL_RANDOM; + private PreviousPlayerList previousPlayerList; private MusicContainer(MusicLibsInitInterface initInterface) { this.initInterface = initInterface; @@ -42,6 +51,8 @@ public class MusicContainer { playList = new ArrayList<>(); tmpList = new ArrayList<>(); albumMapList = new HashMap<>(); + previousPlayerList = new PreviousPlayerList(); + playIndex = ConfigTools.getPreferences().getInt("playIndex", 0); initMediaPlayer(); libs = new MusicLibs(); } @@ -52,12 +63,36 @@ public class MusicContainer { private void initMediaPlayer() { completionListener = new ArrayList<>(); + mediaPlayer.setLooping(false); mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { + + System.out.println(nowPlayData.getFile()); + int tmp=((int)(nowPlayData.getDurationAsDouble()*1000)-mp.getCurrentPosition()); + if(tmp>1000){ + System.out.println("发生跳曲行为"); + mp.start(); + seekTo(mp.getCurrentPosition()); + }else { + System.out.println("自动播放完成,进行下一曲"); playTimer.cancel(); playTimer = null; browserHelper.getTransportControls().skipToNext(); + } + } + }); + mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() { + @Override + public boolean onError(MediaPlayer mp, int what, int extra) { + System.out.println("播放错误: what="+what+" extra="+extra); + return false; + } + }); + mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { + @Override + public void onPrepared(MediaPlayer mp) { + System.out.println("调用了onPrepared"); } }); } @@ -110,13 +145,15 @@ public class MusicContainer { isPause = false; return; } + ConfigTools.getPreferences().edit().putInt("playIndex", playIndex).apply(); nowPlayData = data; String url = data.getPlayUrl(); + previousPlayerList.add(data); try { if (mediaPlayer.isPlaying()) { mediaPlayer.stop(); - mediaPlayer.reset(); } + mediaPlayer.reset(); mediaPlayer.setDataSource(url); mediaPlayer.prepare(); mediaPlayer.start(); @@ -133,11 +170,23 @@ public class MusicContainer { } }, 0, 1000); } + ConfigTools.getPreferences().edit().putString(ConfigTools.previous_music, JSONObject.toJSONString(data)).apply(); } catch (IOException e) { e.printStackTrace(); } } + public void seekTo(long pos) { + System.out.println("跳帧:" + pos); + if (mediaPlayer.isPlaying()) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + mediaPlayer.seekTo(pos, SEEK_PREVIOUS_SYNC); + } else { + mediaPlayer.seekTo((int) pos); + } + } + } + private Timer playTimer; public MediaMetadataCompat getNowPlayMetadataCompat() { @@ -162,7 +211,13 @@ public class MusicContainer { return 8888L; } + private MediaMetadataCompat metadataCompat; + private String metaDataFile; + public MediaMetadataCompat getMetadataCompat(MusicData data) { + if (data.getFile().equals(metaDataFile)) { + return metadataCompat; + } MediaMetadataCompat.Builder builder = new MediaMetadataCompat.Builder(); builder.putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, data.getTitle()); builder.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, data.getArtist()); @@ -172,12 +227,13 @@ public class MusicContainer { builder.putLong(MediaMetadataCompat.METADATA_KEY_YEAR, getYear(data.getYear())); builder.putLong(MediaMetadataCompat.METADATA_KEY_TRACK_NUMBER, Long.parseLong(data.getTrack())); builder.putLong(MediaMetadataCompat.METADATA_KEY_DISC_NUMBER, Long.parseLong(data.getDisc_no())); - builder.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, ((int) data.getDurationAsDouble()) * 1000); + builder.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, ((int) (data.getDurationAsDouble() * 1000))); if (data.getImg() != null) { builder.putBitmap(MediaMetadataCompat.METADATA_KEY_DISPLAY_ICON, data.getImg()); } builder.putString("md5", data.getMd5()); - return builder.build(); + metadataCompat = builder.build(); + return metadataCompat; } public static MusicLibs getLibs() { @@ -191,16 +247,20 @@ public class MusicContainer { mediaPlayer.pause(); } + /** + * 播放下一曲 + */ public void playNext() { + System.out.println("播放模式:" + playModel); switch (playModel) { - case PLAY_MODEL_LIST: - playList(true); + case PLAY_MODEL_ORDER: + playOrder(false); break; - case PLAY_MODEL_TMP_LIST: - playTmpList(true); + case PLAY_MODEL_ONE_LOOP: + playOneLoop(); break; - case PLAY_MODEL_ALBUM: - playAlbumList(true); + case PLAY_MODEL_LOOP: + playOrder(true); break; case PLAY_MODEL_RANDOM: default: @@ -208,18 +268,73 @@ public class MusicContainer { } } - private void playList(boolean isNext) { - + /** + * 播放上一曲 + */ + public void playPrevious() { + playIndex--; + MusicData data = previousPlayerList.getMusicData(); + if (data != null) { + play(data); + } else { + Toast.makeText(MyApplication.application, "没有上一曲记录", Toast.LENGTH_LONG).show(); + } } - private void playTmpList(boolean isNext) { - + /** + * 顺序播放 + * + * @param isLoop 循环播放列表 + */ + private void playOrder(boolean isLoop) { + if (tmpList.size() != 0) {//有插队列表,优先播放 + play(tmpList.get(0));//后插入先播放 + tmpList.remove(0); + } else if (playList.size() == 0) {//播放列表为空,以所有歌列表顺序播放 + if (libs.mainData.size() > (playIndex + 1)) { + playIndex++; + } else { + playIndex = 0; + } + play(libs.mainData.get(playIndex)); + } else {//播放列表中的歌单 + if (playList.size() > (playIndex + 1)) { + playIndex++; + } + if (isLoop) { + playIndex = 0; + play(playList.get(playIndex)); + } else { + playList.clear();//列表播放完了,清空 + playOfAllRandom();//暂时先设计成后续随机播放,毕竟列表已经空了 + } + } } + /** + * 单曲循环 + */ + private void playOneLoop() { + play(nowPlayData); + } + + /** + * 专辑播放 + * + * @param isNext 下一首 + */ private void playAlbumList(boolean isNext) { } - + public List getPlayList(){ + if(!tmpList.isEmpty()){ + return tmpList; + } + if(!playList.isEmpty()){ + return playList; + } + return libs.mainData; + } public class MusicLibs { private List mainData; @@ -245,12 +360,13 @@ public class MusicContainer { } System.out.println("获取列表完成"); for (MusicData mainDatum : mainData) { - if(StringUtil.isEmpty(mainDatum.getMd5())){ - System.out.println(mainDatum.getFile()); - } + if (StringUtil.isEmpty(mainDatum.getMd5())) { + System.out.println(mainDatum.getFile()); + } } if (initInterface != null) { initInterface.init(); + initInterface = null; } } } @@ -262,14 +378,30 @@ public class MusicContainer { }); } - public MusicData findMusic(String md5) { - for (MusicData data : mainData) { + public MusicData findMusic(String md5,List list) { + for (MusicData data : list) { + if (data.getMd5() == null) { + continue; + } if (md5.contains(data.getMd5())) { return data; } } return null; } + + public int findMusicIndex(String md5, List list) { + for (int i = 0; i < list.size(); i++) { + if (list.get(i).getMd5() == null) { + continue; + } + if (md5.contains((list.get(i).getMd5()))) { + return i; + } + } + + return 0; + } } public interface MusicLibsInitInterface { diff --git a/app/src/main/java/com/yutou/nas_music_player/services/MusicService.java b/app/src/main/java/com/yutou/nas_music_player/services/MusicService.java index 519f51b..c213b06 100644 --- a/app/src/main/java/com/yutou/nas_music_player/services/MusicService.java +++ b/app/src/main/java/com/yutou/nas_music_player/services/MusicService.java @@ -1,12 +1,8 @@ package com.yutou.nas_music_player.services; import android.app.Notification; -import android.app.Service; -import android.content.Intent; import android.media.MediaPlayer; -import android.os.Build; import android.os.Bundle; -import android.os.IBinder; import android.os.SystemClock; import android.support.v4.media.MediaBrowserCompat; import android.support.v4.media.MediaMetadataCompat; @@ -19,15 +15,10 @@ import androidx.media.MediaBrowserServiceCompat; import com.yutou.nas_music_player.containers.MediaNotificationManager; import com.yutou.nas_music_player.containers.MusicContainer; -import com.yutou.nas_music_player.containers.MusicData; -import com.yutou.nas_music_player.tools.AppData; +import com.yutou.nas_music_player.Datas.MusicData; import java.util.ArrayList; import java.util.List; -import java.util.Timer; -import java.util.TimerTask; - -import static android.media.MediaPlayer.SEEK_PREVIOUS_SYNC; public class MusicService extends MediaBrowserServiceCompat { public MediaSessionCompat mediaSession; @@ -78,7 +69,7 @@ public class MusicService extends MediaBrowserServiceCompat { result.sendResult(mediaItems); } - public void onSeekTo(long pos) { + public void seekToNotification(long pos) { MusicData data = MusicContainer.getInstance().getNowPlayData(); MediaMetadataCompat metadataCompat = MusicContainer.getInstance().getMetadataCompat(data); Notification notification = notificationManager.getNotification(metadataCompat, builderState(pos).build(), getSessionToken()); @@ -163,13 +154,9 @@ public class MusicService extends MediaBrowserServiceCompat { @Override public void onSeekTo(long pos) { super.onSeekTo(pos); - System.out.println("SeeTo :"+pos); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - MusicContainer.getInstance().getMediaPlayer().seekTo(pos,SEEK_PREVIOUS_SYNC); - }else{ - MusicContainer.getInstance().getMediaPlayer().seekTo((int) pos); - } - MusicService.this.onSeekTo(pos); + System.out.println("接收到跳帧指令~~~"); + MusicContainer.getInstance().seekTo(pos); + MusicService.this.seekToNotification(pos); } @Override @@ -182,6 +169,8 @@ public class MusicService extends MediaBrowserServiceCompat { @Override public void onSkipToPrevious() { super.onSkipToPrevious(); + MusicContainer.getInstance().playPrevious(); + updateNotification(); } @Override @@ -196,7 +185,7 @@ public class MusicService extends MediaBrowserServiceCompat { @Override public void onCompletion(MediaPlayer mp) { - onSeekTo(mp.getCurrentPosition()); + seekToNotification(mp.getCurrentPosition()); } } } diff --git a/app/src/main/java/com/yutou/nas_music_player/tools/AppData.java b/app/src/main/java/com/yutou/nas_music_player/tools/AppData.java index ef9444c..8fe0b43 100644 --- a/app/src/main/java/com/yutou/nas_music_player/tools/AppData.java +++ b/app/src/main/java/com/yutou/nas_music_player/tools/AppData.java @@ -3,9 +3,14 @@ package com.yutou.nas_music_player.tools; import android.os.Handler; import android.os.Looper; +import com.yutou.nas_music_player.MyApplication; + +import java.io.File; + public class AppData { public static String download_dir="downloads"; + public static String dir= MyApplication.application.getFilesDir() + File.separator; public static boolean isDebug=true; public static Handler handler=new Handler(Looper.getMainLooper()); } diff --git a/app/src/main/java/com/yutou/nas_music_player/tools/AppTools.java b/app/src/main/java/com/yutou/nas_music_player/tools/AppTools.java new file mode 100644 index 0000000..0edb144 --- /dev/null +++ b/app/src/main/java/com/yutou/nas_music_player/tools/AppTools.java @@ -0,0 +1,86 @@ +package com.yutou.nas_music_player.tools; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; + +import com.kaopiz.kprogresshud.KProgressHUD; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.security.MessageDigest; + +public class AppTools { + + public static KProgressHUD showLoading(Context context){ + return KProgressHUD.create(context) + .setStyle(KProgressHUD.Style.SPIN_INDETERMINATE) + .setDetailsLabel("loading...") + .setCancellable(true) + .setAnimationSpeed(2) + .setDimAmount(0.5f) + .show(); + } + public static void saveBitmap(final Bitmap bitmap, final String saveKey){ + new Thread(new Runnable() { + @Override + public void run() { + String md5=getMD5(saveKey); + File path=new File(AppData.dir+"img_cache"+File.separator); + if(!path.exists()){ + path.mkdirs(); + } + File image=new File(AppData.dir+"img_cache"+File.separator+md5); + try { + + if(!image.exists()){ + image.createNewFile(); + } + FileOutputStream outputStream=new FileOutputStream(image); + bitmap.compress(Bitmap.CompressFormat.PNG,100,outputStream); + outputStream.flush(); + outputStream.close(); + ConfigTools.getPreferences().edit().putString("img_"+md5,image.getAbsolutePath()).apply(); + } catch (Exception e) { + e.printStackTrace(); + System.out.println(image.getAbsolutePath()); + } + } + }).start(); + + } + public static Bitmap getSaveBitmap(String saveKey){ + String path=ConfigTools.getPreferences().getString(getMD5(saveKey),null); + if(path==null){ + return null; + } + return BitmapFactory.decodeFile(path); + } + public static String getMD5(String data) { + try { + MessageDigest digest = MessageDigest.getInstance("MD5"); + digest.update(data.getBytes()); + return bytesToHexString(digest.digest()); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + private static String bytesToHexString(byte[] src) { + StringBuilder stringBuilder = new StringBuilder(""); + if (src == null || src.length <= 0) { + return null; + } + for (byte aSrc : src) { + int v = aSrc & 0xFF; + String hv = Integer.toHexString(v); + if (hv.length() < 2) { + stringBuilder.append(0); + } + stringBuilder.append(hv); + } + return stringBuilder.toString(); + } + +} diff --git a/app/src/main/java/com/yutou/nas_music_player/tools/NetworkTool.java b/app/src/main/java/com/yutou/nas_music_player/tools/NetworkTool.java index c9dc703..59894a2 100644 --- a/app/src/main/java/com/yutou/nas_music_player/tools/NetworkTool.java +++ b/app/src/main/java/com/yutou/nas_music_player/tools/NetworkTool.java @@ -47,7 +47,7 @@ public class NetworkTool { private static final String TAG = NetworkTool.class.getName(); private static NetworkTool network; public boolean isNet = true; - public static String donwloadPath = MyApplication.application.getFilesDir() + File.separator + AppData.download_dir + File.separator; + public static String donwloadPath = AppData.dir + AppData.download_dir + File.separator; private NetworkTool() { if (StringUtil.isEmpty(HOME)) { @@ -101,6 +101,10 @@ public class NetworkTool { HttpURLConnection connection = (HttpURLConnection) new URL(url + "?" + toGetSplice(body)).openConnection(); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); connection.connect(); + if(connection.getResponseCode()!=200){ + networkInterface.httpError(new RuntimeException("http code to :"+connection.getResponseCode())); + return; + } String tmp; StringBuilder str = new StringBuilder(); while ((tmp = reader.readLine()) != null) { diff --git a/app/src/main/java/com/yutou/nas_music_player/views/MainActivity.java b/app/src/main/java/com/yutou/nas_music_player/views/MainActivity.java index a68ff5a..18bf060 100644 --- a/app/src/main/java/com/yutou/nas_music_player/views/MainActivity.java +++ b/app/src/main/java/com/yutou/nas_music_player/views/MainActivity.java @@ -1,17 +1,23 @@ package com.yutou.nas_music_player.views; import androidx.appcompat.app.AppCompatActivity; +import androidx.core.app.ActivityOptionsCompat; +import androidx.core.util.Pair; import android.annotation.SuppressLint; +import android.app.ActivityOptions; +import android.content.Intent; import android.os.Bundle; +import android.os.Handler; import android.support.v4.media.MediaMetadataCompat; import android.support.v4.media.session.MediaControllerCompat; import android.support.v4.media.session.MediaSessionCompat; import android.support.v4.media.session.PlaybackStateCompat; +import android.view.MotionEvent; import android.view.View; +import android.view.Window; import android.widget.ImageButton; import android.widget.ImageView; -import android.widget.ProgressBar; import android.widget.SeekBar; import android.widget.TextView; import android.widget.Toast; @@ -19,14 +25,18 @@ import android.widget.Toast; import com.alibaba.fastjson.JSON; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; +import com.kaopiz.kprogresshud.KProgressHUD; import com.yutou.nas_music_player.R; import com.yutou.nas_music_player.containers.MediaBrowserHelper; import com.yutou.nas_music_player.containers.MusicContainer; -import com.yutou.nas_music_player.containers.MusicData; +import com.yutou.nas_music_player.Datas.MusicData; import com.yutou.nas_music_player.tools.AppData; +import com.yutou.nas_music_player.tools.AppTools; import com.yutou.nas_music_player.tools.ConfigTools; +import java.util.ArrayList; import java.util.List; +import java.util.Locale; import java.util.Timer; import java.util.TimerTask; @@ -35,46 +45,94 @@ import jp.wasabeef.glide.transformations.BlurTransformation; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; public class MainActivity extends AppCompatActivity { - private ImageButton play, previous, next; + private ImageButton play, previous, next, playModel; private MediaBrowserHelper browserHelper; private ImageView album_image, background_image; private MarqueeTextView title, album, artist; private TextView positionTime, durationTime, bitRate; private SeekBar seekBar; + private Handler handler; + private KProgressHUD hud; @Override protected void onCreate(Bundle savedInstanceState) { + getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); setBarColor(android.R.color.transparent); setContentView(R.layout.activity_main); + handler = new Handler(); initView(); play.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - if (browserHelper.isPlayer()) { - browserHelper.getTransportControls().pause(); - } else { - browserHelper.getTransportControls().play(); + if (hud != null) { + hud.dismiss(); + hud = null; } + hud = AppTools.showLoading(MainActivity.this); + handler.post(new Runnable() { + @Override + public void run() { + + if (browserHelper.isPlayer()) { + browserHelper.getTransportControls().pause(); + } else { + browserHelper.getTransportControls().play(); + } + if (hud != null && hud.isShowing()) { + hud.dismiss(); + hud = null; + } + } + }); + } }); next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - browserHelper.getTransportControls().skipToNext(); + if (hud != null) { + hud.dismiss(); + hud = null; + } + hud = AppTools.showLoading(MainActivity.this); + handler.post(new Runnable() { + @Override + public void run() { + browserHelper.getTransportControls().skipToNext(); + if (hud != null && hud.isShowing()) { + hud.dismiss(); + hud = null; + } + } + }); + } }); previous.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - browserHelper.getTransportControls().skipToPrevious(); + if (hud != null) { + hud.dismiss(); + hud = null; + } + hud = AppTools.showLoading(MainActivity.this); + handler.post(new Runnable() { + @Override + public void run() { + browserHelper.getTransportControls().skipToPrevious(); + if (hud != null && hud.isShowing()) { + hud.dismiss(); + hud = null; + } + } + }); } }); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { - if (browserHelper.getTransportControls() != null) - browserHelper.getTransportControls().seekTo(progress); + } @Override @@ -84,11 +142,70 @@ public class MainActivity extends AppCompatActivity { @Override public void onStopTrackingTouch(SeekBar seekBar) { + if (hud != null) { + hud.dismiss(); + hud = null; + } + hud = AppTools.showLoading(MainActivity.this); + handler.post(new Runnable() { + @Override + public void run() { + if (browserHelper.getTransportControls() != null) + browserHelper.getTransportControls().seekTo(MainActivity.this.seekBar.getProgress()); + if (hud != null && hud.isShowing()) { + hud.dismiss(); + hud = null; + } + } + }); } }); + playModel.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int model = (int) playModel.getTag(); + if (model == MusicContainer.PLAY_MODEL_LOOP) { + setPlayModelButton(MusicContainer.PLAY_MODEL_RANDOM); + return; + } + setPlayModelButton(model + 1); + } + }); + getWindow().getDecorView().setOnTouchListener(new View.OnTouchListener() { + float downPosition_x = 0, downPosition_y = 0; + + @Override + public boolean onTouch(View v, MotionEvent event) { + if (event.getAction() == MotionEvent.ACTION_DOWN) { + downPosition_x = event.getRawX(); + downPosition_y = event.getRawY(); + } else if (event.getAction() == MotionEvent.ACTION_UP) { + if (Math.abs(downPosition_x - event.getRawX()) < 500 && downPosition_y - event.getRawY() > 500) { + Pair pImage = Pair.create((View) album_image, "album_image"); + Pair pPrevious = Pair.create((View) previous, "previous"); + Pair pPlay = Pair.create((View) play, "play"); + Pair pNext = Pair.create((View) next, "next"); + Pair pTitle = Pair.create((View) title, "title"); + Pair pArtist = Pair.create((View) artist, "artist"); + //ActivityOptionsCompat.makeSceneTransitionAnimation(MainActivity.this,list); + Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(MainActivity.this, pImage, pPrevious, pPlay, pNext, pTitle, pArtist).toBundle(); + + Intent intent = new Intent( + MainActivity.this, PlayLibsActivity.class); + if (bundle != null) { + startActivity(intent, bundle); + } else { + startActivity(intent); + } + } + } + return false; + } + }); browserHelper = new MediaBrowserHelper(this); browserHelper.regPlayListener(new PlayListener()); + initData(); } @@ -113,17 +230,19 @@ public class MainActivity extends AppCompatActivity { private void setPlayData(final MusicData data) { System.out.println("设置歌曲"); System.out.println(data); - if(data==null) + if (data == null) return; title.setText(data.getTitle()); artist.setText(data.getArtist()); album.setText(data.getAlbum()); bitRate.setText(data.getBitRate() + "kbps / " + data.getSampleRate() + "hz"); - seekBar.setMax((int) data.getDurationAsDouble()); + seekBar.setMax((int) (data.getDurationAsDouble() * 1000)); int minutes = (int) (data.getDurationAsDouble() / 60); int seconds = (int) (data.getDurationAsDouble() % 60); - durationTime.setText(minutes + ":" + seconds); - + durationTime.setText(String.format(Locale.CHINA, "%02d", minutes) + ":" + + String.format(Locale.CHINA, "%02d", seconds)); + int model = ConfigTools.getPreferences().getInt("playModel", MusicContainer.PLAY_MODEL_RANDOM); + setPlayModelButton(model); if (data.getImg() != null) { setImage(data); } else { @@ -145,6 +264,26 @@ public class MainActivity extends AppCompatActivity { } + private void setPlayModelButton(int model) { + playModel.setTag(model); + MusicContainer.getInstance().setPlayModel(model); + switch (model) { + case MusicContainer.PLAY_MODEL_RANDOM: + playModel.setImageResource(R.drawable.ic_play_random); + break; + case MusicContainer.PLAY_MODEL_ORDER: + playModel.setImageResource(R.drawable.ic_play_list); + break; + case MusicContainer.PLAY_MODEL_ONE_LOOP: + playModel.setImageResource(R.drawable.ic_play_one_loop); + break; + case MusicContainer.PLAY_MODEL_LOOP: + playModel.setImageResource(R.drawable.ic_play_loop); + break; + } + ConfigTools.getPreferences().edit().putInt("playModel", model).apply(); + } + private void setImage(MusicData data) { album_image.setImageBitmap(data.getImg()); background_image.setImageBitmap(data.getImg()); @@ -170,6 +309,7 @@ public class MainActivity extends AppCompatActivity { positionTime = findViewById(R.id.positionTime); durationTime = findViewById(R.id.durationTime); seekBar = findViewById(R.id.seekBar); + playModel = findViewById(R.id.playModel); } public void setBarColor(int color) { @@ -182,13 +322,14 @@ public class MainActivity extends AppCompatActivity { @Override public void onPlaybackStateChanged(PlaybackStateCompat state) { super.onPlaybackStateChanged(state); - System.out.println("播放状态变化:" + state.getState()); + System.out.println("播放状态变化:" + state.getPosition() + " " + seekBar.getMax()); if (state.getState() == PlaybackStateCompat.STATE_PLAYING) { int duration = (int) (state.getPosition() / 1000); int minutes = duration / 60; int seconds = duration % 60; - positionTime.setText(minutes + ":" + seconds); - seekBar.setProgress((int) (state.getPosition() / 1000)); + positionTime.setText(String.format(Locale.CHINA, "%02d", minutes) + ":" + + String.format(Locale.CHINA, "%02d", seconds)); + seekBar.setProgress((int) (state.getPosition())); play.setImageResource(android.R.drawable.ic_media_pause); } else { play.setImageResource(android.R.drawable.ic_media_play); @@ -199,16 +340,15 @@ public class MainActivity extends AppCompatActivity { @Override public void onMetadataChanged(MediaMetadataCompat metadata) { super.onMetadataChanged(metadata); - String md5=null; + String md5 = null; try { - System.out.println("播放歌曲变换:"+metadata.getString("md5")); - md5=metadata.getString("md5"); - }catch (Exception e){ - e.printStackTrace(); + System.out.println("播放歌曲变换:" + metadata.getString("md5")); + md5 = metadata.getString("md5"); + } catch (Exception ignored) { } if (md5 != null) { - setPlayData(MusicContainer.getLibs().findMusic(md5)); + setPlayData(MusicContainer.getLibs().findMusic(md5, MusicContainer.getInstance().getPlayList())); } } diff --git a/app/src/main/java/com/yutou/nas_music_player/views/OpenActivity.java b/app/src/main/java/com/yutou/nas_music_player/views/OpenActivity.java index e305fad..4933e02 100644 --- a/app/src/main/java/com/yutou/nas_music_player/views/OpenActivity.java +++ b/app/src/main/java/com/yutou/nas_music_player/views/OpenActivity.java @@ -23,7 +23,7 @@ public class OpenActivity extends AppCompatActivity { public void init() { Intent intent=new Intent(OpenActivity.this,MainActivity.class); startActivity(intent); - finish(); + OpenActivity.this.finish(); } }); } diff --git a/app/src/main/java/com/yutou/nas_music_player/views/PlayLibsActivity.java b/app/src/main/java/com/yutou/nas_music_player/views/PlayLibsActivity.java new file mode 100644 index 0000000..317d233 --- /dev/null +++ b/app/src/main/java/com/yutou/nas_music_player/views/PlayLibsActivity.java @@ -0,0 +1,145 @@ +package com.yutou.nas_music_player.views; + +import android.annotation.SuppressLint; +import android.os.Bundle; +import android.support.v4.media.MediaMetadataCompat; +import android.support.v4.media.session.MediaControllerCompat; +import android.support.v4.media.session.MediaSessionCompat; +import android.support.v4.media.session.PlaybackStateCompat; +import android.view.Window; +import android.widget.ImageButton; +import android.widget.ImageView; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.request.RequestOptions; +import com.yutou.nas_music_player.Datas.MusicData; +import com.yutou.nas_music_player.R; +import com.yutou.nas_music_player.containers.MediaBrowserHelper; +import com.yutou.nas_music_player.containers.MusicContainer; +import com.yutou.nas_music_player.tools.AppData; +import com.yutou.nas_music_player.tools.ConfigTools; + +import java.util.List; +import java.util.Locale; +import java.util.Timer; +import java.util.TimerTask; + +import cc.ibooker.ztextviewlib.MarqueeTextView; +import jp.wasabeef.glide.transformations.BlurTransformation; +import jp.wasabeef.glide.transformations.RoundedCornersTransformation; + +public class PlayLibsActivity extends AppCompatActivity { + private ImageButton play, previous, next; + private MediaBrowserHelper browserHelper; + private ImageView album_image; + private MarqueeTextView title, artist; + private PlayListener playListener; + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_play_list); + initView(); + setPlayData(MusicContainer.getInstance().getNowPlayData()); + browserHelper = new MediaBrowserHelper(this); + playListener=new PlayListener(); + browserHelper.regPlayListener(playListener); + } + private void initView() { + play = findViewById(R.id.play); + next = findViewById(R.id.next); + previous = findViewById(R.id.previous); + album_image = findViewById(R.id.album_image); + title = findViewById(R.id.title); + artist = findViewById(R.id.artist); + } + private void setImage(MusicData data) { + album_image.setImageBitmap(data.getImg()); + Glide.with(this).load(data.getImg()) + .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(25, 3))) + .into(album_image); + } + @SuppressLint("SetTextI18n") + private void setPlayData(final MusicData data) { + System.out.println("设置歌曲"); + System.out.println(data); + if (data == null) + return; + title.setText(data.getTitle()); + artist.setText(data.getArtist()); + if (data.getImg() != null) { + setImage(data); + } else { + new Timer().schedule(new TimerTask() { + @Override + public void run() { + if (data.getImg() != null) { + AppData.handler.post(new Runnable() { + @Override + public void run() { + setImage(data); + } + }); + cancel(); + } + } + }, 0, 100); + } + + } + + @Override + protected void onDestroy() { + super.onDestroy(); + browserHelper=null; + finish(); + } + + private class PlayListener extends MediaControllerCompat.Callback { + @SuppressLint("SetTextI18n") + @Override + public void onPlaybackStateChanged(PlaybackStateCompat state) { + super.onPlaybackStateChanged(state); + if (state.getState() == PlaybackStateCompat.STATE_PLAYING) { + play.setImageResource(android.R.drawable.ic_media_pause); + } else { + play.setImageResource(android.R.drawable.ic_media_play); + } + + } + + @Override + public void onMetadataChanged(MediaMetadataCompat metadata) { + super.onMetadataChanged(metadata); + String md5 = null; + try { + System.out.println("播放歌曲变换:" + metadata.getString("md5")); + md5 = metadata.getString("md5"); + } catch (Exception ignored) { + } + + if (md5 != null) { + setPlayData(MusicContainer.getLibs().findMusic(md5, MusicContainer.getInstance().getPlayList())); + } + } + + @Override + public void onSessionDestroyed() { + super.onSessionDestroyed(); + System.out.println("连接被销毁"); + } + + @Override + public void onQueueChanged(List queue) { + super.onQueueChanged(queue); + System.out.println("不知道是啥变换了"); + } + + public void setImage() { + + } + } +} diff --git a/app/src/main/res/drawable/ic_play_list.png b/app/src/main/res/drawable/ic_play_list.png new file mode 100644 index 0000000000000000000000000000000000000000..28f1419d37f7b8c88bebad86bd0b7d6f6f3030eb GIT binary patch literal 785 zcmeAS@N?(olHy`uVBq!ia0vp^3Lq@N1|*eVE!z&HSkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?nXP>=ES4z)+>ez|hdb!0-zw)bN6Vq11qZ;Z*_ygVhWM2JwP9y8>;15^PD{ z?k+$Y2!1;6t_M<_1s;*bK-vS0-A-oP0gYef>EalYaqsPP+x3i&B5lt*np`wYwCo)g z332vLa#D4CVZybxqr=Nl@#1IcDOwjbLPfZGTf$r&HB^f8KDuo*pT2ir*_}I;vnEg8 zy!rP&_069ZTih03{FD45s&VE_%c(*-5e0Vny>rqg=cFj#uBnR-H{*_dxkbUTiHlW9 zY0=}4_w;Y&Pp`E*5^!P`+m5^YtMvpLKKiirYKX19_?tGr#?)WExkKJhb=eJ%F8y*~H+HYsoP_Ph*TlK!@W<#~wTrvbaj@aN z()8f9ze{;1=tTbdYq0J9eKR|md%x=@pAInT(h=KyEN_4R*7UvqBK@~^t+{I!rayf_ zg23bO)ytPYX#V=EHuycKiubgSKSFIMse130Ei^OctE-uAG?Q_Dxj@r850=RF?S&6F zTxHjIxzm0Xkxq!^40j0|)Q4Rwu7LJUo;jE$`f z&9x0ItPBid&pB>H(U6;;l9^VCTZ7KzpS(Z~0U#TS%hIiq5{pxHON%lY(lT>Wt@QQv zGxBp&^%GNaGxPK_lk@X*)AI95^hbP0l+XkKcIPab literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/ic_play_loop.png b/app/src/main/res/drawable/ic_play_loop.png new file mode 100644 index 0000000000000000000000000000000000000000..2f830693d7405f6755faf1ab621be0128eb24c3d GIT binary patch literal 962 zcmeAS@N?(olHy`uVBq!ia0vp^3Lq@N1|*eVE!z&HSkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?nXP>=ES4z)+>ez|hdb!0-zw)bN6Vq11qZ;Z*_ygVhWM2JwP9y8>;15^PD{ z?k+$Y2!1;6t_M<_1s;*bK-vS0-A-oPF)%PCd%8G=WZZi@bFUwhqrma}6F(ha9zB(z z$ji#w%Gn#DmX(vUrjqxe=8^>uWHUVeXz+#)J=iBGzL6qt7TFe_L6- zebK+!CuL5*`;+$FtlBzdsZLtjGbhG-FE!shRDAPo+flLTJzGuxGDoId%xHPOSn!V@ zyM0`okf0zhTW0YJW^OSZFV!2nt*_}GY;xVsot}T*WIg+yO-&86eD%E+%GT7G?J0a! zdL;4o%SL14&5siv{Qh0iaQMltj`UJfjl5_x-YkcCV&{K6Q`>Vpde7pci=uAH$tT`^ zyYjqPw2j< zR+c18Jq#Jue@30bQ$*x*px9%lf5JCIqwJ?ho$?Buwx|*%f8NMxXd`?T7Rwi z(nZ>J3aS)y-c^x9r+!D4U*jh_fV@H~R6{(mRv)WXhEmyg%{Q zzNuaFkMcQ_aEl+?)Aro|9)CwCk?B#B|L==)87jY;SWhr3Nc*=ZHf*hO4eRxJ3?}Qt z{?<>QK2cr0D(%k;j&E;u^>%DyIm13*`C!x0&&G42c+Jk4_f)%5fv}Yyk++0Xsh{M&FQvgKQ`+OSei&EKb!eEy`p_%gjl&(%09|$j?pHPfW?p%+t?I z&d<|L%g-y(FUc(c^WxKta?{Hz)6BC=lJ#@)^9xM$fQB?w&HoEDlfl!~&t;ucLK6V= C>4oJ0 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/ic_play_one_loop.png b/app/src/main/res/drawable/ic_play_one_loop.png new file mode 100644 index 0000000000000000000000000000000000000000..4f0701a93720ecf5cf95350a411aa26164b24cc8 GIT binary patch literal 1098 zcmeAS@N?(olHy`uVBq!ia0vp^3Lq@N1|*eVE!z&HSkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?nXP>=ES4z)+>ez|hdb!0-zw)bN6Vq11qZ;Z*_ygVhWM2JwP9y8>;15^PD{ z?k+$Y2!1;6t_M<_1s;*bK-vS0-A-oPF)%Pa@pN$v$+-76!q!{cQDm;?l#Zs>CbKMM z!GlhL(w^#Ki^9apye=)>u;BxLM{6rbSW|)^4_8w{y811TH;WcMVDC86Fl$Sl@bf*7 z4Bi`_bo;z>^`1G;p5&FiyHow_-0?mE(U1??jI6Ao@&0{oj0_f*3-4ZhSW@#;oPpuO z1qVNs1q&A}nB*zN%Yc>@t!)ciwvLhOG=AcSt@zwK2aty6-$R!)iiJJZ5Goi%IW-h25h6_tsd{}vow86Xj?FC57t zA(iC3e6ha05lg~KHzhyzFr78$b!P^DI4+yx)xAvZa$U`z^DG~J{`=R`aNuU-MZL(V z+S*?nuS&WiA8+}S!_UU;6X9hQ6JsKK?6IGEmTbO3#<9xk+25~g3$I(1bU5I|uj0!; zC(Ar8*e&_~jn3PUu0J0gx1T;=UMtDXVPdu^ zzE;)T)b-sfrTzORF*Cl)vg)5B8XJ8$zqzUD*6qvT^aAcC>nC}Q!>*kacj_-{F4``!5?Hpaap=m zQettcZfQ{_Lt17|s+GRJenx(7s(xZhZf2f-W^#U>Zd!g`iGE3L0hkw`W|W&=UYTZ| nU6QPyl9*RmT2Y#pQJR>i2Q=&T`NHEsqZvG1{an^LB{Ts5pVP(F literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/ic_play_random.png b/app/src/main/res/drawable/ic_play_random.png new file mode 100644 index 0000000000000000000000000000000000000000..5bc9e5ca328b0c77424fb68a81bf45916c11c581 GIT binary patch literal 1286 zcmeAS@N?(olHy`uVBq!ia0vp^3Lq@N1|*eVE!z&HSkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?nXP>=ES4z)+>ez|hdb!0-zw)bN6Vq11qZ;Z*_ygVhWM2JwP9y8>;15^PD{ z?k+$Y2!1;6t_M<_1s;*bK-vS0-A-oPF)%PM_jGX#$+-7+##!%>K#61TH~!HPbzN?- zqE&%;>5R<=S}MUAf~gWM54;xkc6)4ey(oX-kUmH3iGbN~~iG#v~zrPt70<`XZ zeKW6s;lRnsPc8{ba$TG-X;Q^?@oHukrp(+{Q!%k`djv&hOm{yhZ|3^6H z_piFYfBXB6r>RB)9P;bWxIBH@S2SgD-u{}UjH()D52ra`*1JKr7lT& zA`BDeom;)jYSXS+rN3&{7@JRjo0>XX*rMRWS8e@s^TR#0JXL%9+AM#*65S?}oGerR z&?%=ieve1p&rMr@DIM(=pRF#$v1Dy-HK*%|bAHb}eeceEQ2YB#RY~3YM+civuyU{j zg&gT?Z1|Tw!8~un-_PmaIpg-Je4W-4R^i5W^ZN67|L9~;E8OOMw|L| z&u>1Q=Hsuvd)FQAzdt706dk$y;ZMz{ui4*gY;7M}_gufeK7YlXJ;5wYmEUrXAG*t% znWIwwZ;N={`+2o7j*OX>#~2v)*G=T*{q}L{)F;1wt>fOl{>jbFa|+6)#Y8LX$D93@ zwLSICfBu_8^?wwyv+nff=WXMz{}uB7$_(!9;?pKBJfFUK?}iCICFb#wimO*GGPcp~ ze)Cq<+Uk+oox1}2=g*n7iTnSzUYlC0dta+`_H3CF6S0AN{@kahM8%Kqj(gw2%@P!t zxGtx{$M4nSYbI+p1kC5Ucy{r9RyljMX2)&mY47$GFgWC{trX_oZ|UnZ;dtN7$LnHl zzSvUOQ~Up1-E_U3(gH7Y3o0z0xfLiaJ>&Ex*51a={bUoK@^e%56H{_C^Yk;5^Ye7m^7BgcOL7aqy!bSu-1PFw iH1q6|Wc}jO%&bg3pds>U3d}$=89ZJ6T-G@yGywn!0!Q5d literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 84498cf..4187d94 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -34,6 +34,7 @@ android:layout_marginTop="150dp" android:contentDescription="专辑图" android:src="@drawable/ic_launcher_foreground" + android:transitionName="album_image" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -43,13 +44,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="26dp" - android:shadowColor="@color/textColorGray" + android:shadowColor="@color/colorBlack" android:shadowDx="5" android:shadowDy="5" android:shadowRadius="1" android:text="title" android:textColor="@color/musicTitle" android:textSize="24sp" + android:transitionName="title" app:layout_constraintBottom_toTopOf="@+id/album_image" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> @@ -76,6 +78,10 @@ android:layout_height="wrap_content" android:layout_marginStart="10dp" android:layout_weight="1" + android:shadowColor="@color/colorBlack" + android:shadowDx="5" + android:shadowDy="5" + android:shadowRadius="1" android:text="00:00" android:textColor="@color/textColorWhite" /> @@ -85,8 +91,12 @@ android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" - android:textColor="@color/textColorWhite" - android:text="TextView" /> + android:shadowColor="@color/colorBlack" + android:shadowDx="5" + android:shadowDy="5" + android:shadowRadius="1" + android:text="TextView" + android:textColor="@color/textColorWhite" /> @@ -125,20 +139,30 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"> + + + android:src="@android:drawable/ic_media_previous" + android:transitionName="previous" /> + android:src="@android:drawable/ic_media_play" + android:transitionName="play" /> + android:layout_marginEnd="80dp" + android:src="@android:drawable/ic_media_next" + android:transitionName="next" /> + android:textSize="20sp" + android:transitionName="artist" /> diff --git a/app/src/main/res/layout/activity_play_list.xml b/app/src/main/res/layout/activity_play_list.xml new file mode 100644 index 0000000..44a18aa --- /dev/null +++ b/app/src/main/res/layout/activity_play_list.xml @@ -0,0 +1,59 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_play.xml b/app/src/main/res/layout/layout_play.xml new file mode 100644 index 0000000..4ceb1f3 --- /dev/null +++ b/app/src/main/res/layout/layout_play.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index e80d227..ea8faca 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -5,7 +5,7 @@ #03DAC5 #000000 - #000000 + #FFFFFF #000000 #DEDEDE #FFFFFF