├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── inspectionProfiles
│ ├── Project_Default.xml
│ └── profiles_settings.xml
├── markdown-exported-files.xml
├── markdown-navigator.xml
├── markdown-navigator
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── Screenshot
├── 1.png
├── 10.png
├── 11.png
├── 12.png
├── 13.png
├── 2.png
├── 3.png
├── 4.png
├── 5.png
├── 6.png
├── 7.png
├── 8.png
└── 9.png
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ ├── 9squares-AlBoardman.json
│ ├── EmptyState.json
│ ├── HamburgerArrow.json
│ ├── litepal.xml
│ ├── lottiefiles.com - ATM.json
│ ├── lottiefiles.com - Animated Graph.json
│ ├── lottiefiles.com - Beating Heart.json
│ ├── lottiefiles.com - Camera.json
│ ├── lottiefiles.com - Countdown.json
│ ├── lottiefiles.com - Emoji Shock.json
│ ├── lottiefiles.com - Emoji Tongue.json
│ ├── lottiefiles.com - Emoji Wink.json
│ ├── lottiefiles.com - Favorite Star.json
│ └── lottiefiles.com - Gears.json
│ ├── ic_launcher-web.png
│ ├── java
│ └── sbingo
│ │ └── likecloudmusic
│ │ ├── bean
│ │ ├── PlayList.java
│ │ ├── ResultBean.java
│ │ └── Song.java
│ │ ├── common
│ │ ├── Constants.java
│ │ └── MyApplication.java
│ │ ├── contract
│ │ ├── BaseContract.java
│ │ └── DiskMusicContract.java
│ │ ├── db
│ │ └── LitePalHelper.java
│ │ ├── di
│ │ ├── component
│ │ │ ├── ActivityComponent.java
│ │ │ ├── ApplicationComponent.java
│ │ │ ├── FragmentComponent.java
│ │ │ └── ServiceComponent.java
│ │ ├── module
│ │ │ ├── ActivityModule.java
│ │ │ ├── ApplicationModule.java
│ │ │ ├── FragmentModule.java
│ │ │ └── ServiceModule.java
│ │ └── scope
│ │ │ ├── ContextLife.java
│ │ │ ├── PerActivity.java
│ │ │ ├── PerApp.java
│ │ │ ├── PerFragment.java
│ │ │ └── PerService.java
│ │ ├── event
│ │ ├── DiskMusicChangeEvent.java
│ │ ├── PausePlayingEvent.java
│ │ ├── PlayingMusicUpdateEvent.java
│ │ ├── PlaylistCreatedEvent.java
│ │ ├── PlaylistDeletedEvent.java
│ │ ├── RxBus.java
│ │ └── StartPlayingEvent.java
│ │ ├── network
│ │ ├── HttpManager.java
│ │ ├── RxHttpObserver.java
│ │ └── RxHttpResult.java
│ │ ├── player
│ │ ├── PlayMode.java
│ │ └── PlayService.java
│ │ ├── presenter
│ │ ├── DiskMusicPresenter.java
│ │ └── RxPresenter.java
│ │ ├── ui
│ │ ├── activity
│ │ │ ├── BaseActivity.java
│ │ │ ├── LoadingActivity.java
│ │ │ ├── MainActivity.java
│ │ │ └── ScanMusicActivity.java
│ │ ├── adapter
│ │ │ ├── PageAdapter
│ │ │ │ ├── LocalPagerAdapter.java
│ │ │ │ └── MainPagerAdapter.java
│ │ │ └── RvAdapter
│ │ │ │ ├── BaseRvAdapter.java
│ │ │ │ └── DiskMusicAdapter.java
│ │ └── fragment
│ │ │ ├── BaseFragment.java
│ │ │ ├── LocalMusic
│ │ │ ├── DiskMusicFragment.java
│ │ │ └── LocalMusicFragment.java
│ │ │ ├── NetMusic
│ │ │ ├── NetMusicFragment.java
│ │ │ ├── PlaylistFragment.java
│ │ │ ├── RadioFragment.java
│ │ │ ├── RankingFragment.java
│ │ │ └── RecommendFragment.java
│ │ │ └── Social
│ │ │ ├── FriendsFragment.java
│ │ │ ├── NearbyFragment.java
│ │ │ ├── NewStateFragment.java
│ │ │ └── SocialFragment.java
│ │ ├── utils
│ │ ├── DeviceUtils.java
│ │ ├── FileUtils.java
│ │ ├── InputUtils.java
│ │ ├── NavigationUtils.java
│ │ ├── NetUtils.java
│ │ ├── NumberUtils.java
│ │ ├── PreferenceUtils.java
│ │ ├── RegExpUtil.java
│ │ ├── RemindUtils.java
│ │ ├── RxUtils.java
│ │ ├── ScreenUtils.java
│ │ └── TimeUtils.java
│ │ └── widget
│ │ ├── LocalMenuItem.java
│ │ └── OutPlayerController.java
│ └── res
│ ├── anim
│ ├── loading_fade_out.xml
│ └── main_finish.xml
│ ├── drawable-xhdpi
│ ├── avatar.png
│ ├── box.png
│ ├── car.png
│ ├── clock.png
│ ├── clock_45.png
│ ├── close_48.png
│ ├── clothes.png
│ ├── cloud.png
│ ├── cry.png
│ ├── diamond.png
│ ├── download_45.png
│ ├── envelop.png
│ ├── lamp.png
│ ├── list.png
│ ├── loading.jpg
│ ├── lyric_48.png
│ ├── mic.png
│ ├── mobile_45.png
│ ├── more_40.png
│ ├── more_white_48.png
│ ├── music_disk_45.png
│ ├── mv_45.png
│ ├── mv_64.png
│ ├── next.png
│ ├── notification_last_32.png
│ ├── notification_love_32.png
│ ├── notification_love_checked_32.png
│ ├── notification_lyric_32.png
│ ├── notification_lyric_checked_32.png
│ ├── notification_next_32.png
│ ├── notification_pause_64.png
│ ├── notification_play_64.png
│ ├── pause.png
│ ├── pic_error_150.png
│ ├── pic_error_45.png
│ ├── pic_loading_150.png
│ ├── pic_loading_45.png
│ ├── play.png
│ ├── right_arrow_40.png
│ ├── scan.png
│ ├── scan_local_40.png
│ ├── search.png
│ ├── shop.png
│ ├── singer_45.png
│ ├── sort_35.png
│ ├── speaker.png
│ ├── timing.png
│ ├── white_logo_50.png
│ ├── yes_10.png
│ ├── yes_20.png
│ ├── yes_30.png
│ └── yes_40.png
│ ├── drawable
│ ├── ic_music.xml
│ ├── ic_music_selected.xml
│ ├── ic_people.xml
│ ├── ic_people_selected.xml
│ ├── ic_symbol.xml
│ ├── ic_symbol_selected.xml
│ ├── local_music_selector.xml
│ ├── message.xml
│ ├── net_music_selector.xml
│ ├── progress_bar.xml
│ ├── side_nav_bar.xml
│ ├── social_selector.xml
│ ├── stroke_grey.xml
│ └── stroke_white.xml
│ ├── layout
│ ├── activity_loading.xml
│ ├── activity_main.xml
│ ├── disk_music_layout.xml
│ ├── disk_other_item.xml
│ ├── disk_song_item.xml
│ ├── local_layout.xml
│ ├── local_menu_item.xml
│ ├── local_music_layout.xml
│ ├── main_layout.xml
│ ├── main_radio_group.xml
│ ├── menu_night_switch.xml
│ ├── menu_text.xml
│ ├── nav_bottom.xml
│ ├── nav_header.xml
│ ├── net_music_layout.xml
│ ├── notification_view.xml
│ ├── notification_view_small.xml
│ ├── out_player_controller.xml
│ ├── social_layout.xml
│ └── timing_stop_bottom.xml
│ ├── menu
│ ├── activity_main_drawer.xml
│ ├── main.xml
│ └── scan_menu.xml
│ ├── mipmap-xhdpi
│ ├── logo.png
│ └── white_logo_90.png
│ ├── values-night
│ └── colors.xml
│ ├── values-v21
│ └── styles.xml
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── attrs.xml
│ ├── colors.xml
│ ├── dimens.xml
│ ├── drawables.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gif
└── LikeCloudMusic.gif
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── mylibrary
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── sbingo
│ │ └── com
│ │ └── mylibrary
│ │ ├── CustomSnackbar.java
│ │ └── CustomToast.java
│ └── res
│ ├── drawable
│ └── custom_toast_bg.xml
│ ├── layout
│ └── default_custom_toast.xml
│ └── values
│ ├── colors.xml
│ └── strings.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/markdown-exported-files.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 1.8
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### LikeCloudMusic 云音
2 | 仿网易云音乐 v3.7.5,Material Design 风格,基于 MVP,使用 RxBus 作为事件总线通信库
3 |
4 | LikeCloudMusic 中的 Like 有两层意思
5 |
6 | 1.喜欢,正因为喜欢网易云音乐这款 APP,才有了该项目。
7 |
8 | 2.像、类似,表明该项目是对云音乐的仿造。
9 |
10 | 本项目仅用于技术学习交流,不得用于其他用途。
11 |
12 | ### 效果图
13 | 
14 | 
15 | 
16 | 
17 | 
18 | 
19 | 
20 | 
21 | ### 目前功能
22 |
23 | 扫描本地歌曲
24 |
25 | 存储歌曲及歌单
26 |
27 | 后台播放歌曲
28 |
29 | 底部播放控制器(暂停、开始、切歌、当前播放进度等)
30 |
31 | 两个界面的控制器状态同步
32 |
33 | 通知栏播放控制
34 |
35 | 记忆播放歌曲及进度
36 |
37 | 夜间模式
38 |
39 | ……
40 | ### TODO
41 |
42 | 通知栏底色可选
43 |
44 | 夜间模式图标更改
45 |
46 | 播放列表展示及选歌
47 |
48 | 定时停止播放
49 |
50 | 音乐闹钟
51 |
52 | 本地音乐其他分类
53 |
54 | 播放界面 UI 及逻辑
55 |
56 | 歌词滚动显示
57 |
58 | server 端
59 |
60 | ……
61 | ### 主要用到的开源库
62 |
63 | Butterknife
64 |
65 | RxJava
66 |
67 | RxAndroid
68 |
69 | Okhttp3
70 |
71 | Retrofit2
72 |
73 | Dagger2
74 |
75 | Glide
76 |
77 | LitePal
78 |
79 | ### 公众号
80 | 
81 |
82 | License
83 | ---------------
84 | ```
85 | Copyright (c) 2016 Sbingo
86 |
87 | Licensed under the Apache License, Version 2.0 (the "License");
88 | you may not use this file except in compliance with the License.
89 | You may obtain a copy of the License at
90 |
91 | http://www.apache.org/licenses/LICENSE-2.0
92 |
93 | Unless required by applicable law or agreed to in writing, software
94 | distributed under the License is distributed on an "AS IS" BASIS,
95 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
96 | See the License for the specific language governing permissions and
97 | limitations under the License.
98 | ```
99 |
--------------------------------------------------------------------------------
/Screenshot/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/1.png
--------------------------------------------------------------------------------
/Screenshot/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/10.png
--------------------------------------------------------------------------------
/Screenshot/11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/11.png
--------------------------------------------------------------------------------
/Screenshot/12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/12.png
--------------------------------------------------------------------------------
/Screenshot/13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/13.png
--------------------------------------------------------------------------------
/Screenshot/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/2.png
--------------------------------------------------------------------------------
/Screenshot/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/3.png
--------------------------------------------------------------------------------
/Screenshot/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/4.png
--------------------------------------------------------------------------------
/Screenshot/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/5.png
--------------------------------------------------------------------------------
/Screenshot/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/6.png
--------------------------------------------------------------------------------
/Screenshot/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/7.png
--------------------------------------------------------------------------------
/Screenshot/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/8.png
--------------------------------------------------------------------------------
/Screenshot/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/Screenshot/9.png
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'com.neenbedankt.android-apt'
3 |
4 | android {
5 | compileSdkVersion 25
6 | buildToolsVersion "24.0.3"
7 | defaultConfig {
8 | applicationId "sbingo.likecloudmusic"
9 | minSdkVersion 16
10 | targetSdkVersion 25
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(include: ['*.jar'], dir: 'libs')
24 | compile 'com.jakewharton:butterknife:8.4.0'
25 | apt 'com.jakewharton:butterknife-compiler:8.4.0'
26 | compile 'com.android.support:support-v4:25.0.1'
27 | compile 'io.reactivex:rxandroid:1.2.1'
28 | compile 'io.reactivex:rxjava:1.1.6'
29 | compile 'com.squareup.retrofit2:retrofit:2.1.0'
30 | compile 'com.squareup.retrofit2:converter-gson:2.0.2'
31 | compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
32 | compile 'com.squareup.okhttp3:okhttp:3.4.1'
33 | compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
34 | compile 'com.github.bumptech.glide:glide:3.6.1'
35 | compile 'com.orhanobut:logger:1.15'
36 | compile 'com.github.chrisbanes:PhotoView:1.2.6'
37 | compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
38 | compile 'com.google.dagger:dagger:2.4'
39 | apt 'com.google.dagger:dagger-compiler:2.4'
40 | compile 'org.litepal.android:core:1.4.1'
41 | compile 'com.airbnb.android:lottie:2.0.0-beta4'
42 | compile project(':mylibrary')
43 | }
44 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in E:\AS-SDK/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
14 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
37 |
38 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/app/src/main/assets/litepal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
22 |
23 |
24 |
34 |
35 |
36 |
37 |
38 |
39 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/binaryshao/LikeCloudMusic/cdeb705c3c035d85fb924703241176b59adcfde8/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/bean/ResultBean.java:
--------------------------------------------------------------------------------
1 | package sbingo.likecloudmusic.bean;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Author: Sbingo
7 | * Date: 2016/12/12
8 | */
9 |
10 | public class ResultBean implements Serializable{
11 |
12 | private String status;
13 |
14 | private String code;
15 |
16 | private String message;
17 |
18 | private T data;
19 |
20 | public String getStatus() {
21 | return status;
22 | }
23 |
24 | public void setStatus(String status) {
25 | this.status = status;
26 | }
27 |
28 | public String getCode() {
29 | return code;
30 | }
31 |
32 | public void setCode(String code) {
33 | this.code = code;
34 | }
35 |
36 | public String getMessage() {
37 | return message;
38 | }
39 |
40 | public void setMessage(String message) {
41 | this.message = message;
42 | }
43 |
44 | public T getData() {
45 | return data;
46 | }
47 |
48 | public void setData(T data) {
49 | this.data = data;
50 | }
51 |
52 | public boolean isSuccess() {
53 | return getCode().equals("0");
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/bean/Song.java:
--------------------------------------------------------------------------------
1 | package sbingo.likecloudmusic.bean;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | import org.litepal.annotation.Column;
7 | import org.litepal.crud.DataSupport;
8 |
9 | /**
10 | * Author: Sbingo
11 | * Date: 2016/12/15
12 | */
13 |
14 | public class Song extends DataSupport implements Parcelable {
15 |
16 | private int id;
17 |
18 | private String title;
19 |
20 | private String displayName;
21 |
22 | private String artist;
23 |
24 | private String album;
25 |
26 | private String path;
27 |
28 | private int duration;
29 |
30 | private int size;
31 |
32 | private boolean favorite;
33 |
34 | private boolean isPlaying;
35 |
36 | public int getId() {
37 | return id;
38 | }
39 |
40 | public void setId(int id) {
41 | this.id = id;
42 | }
43 |
44 | public String getTitle() {
45 | return title;
46 | }
47 |
48 | public void setTitle(String title) {
49 | this.title = title;
50 | }
51 |
52 | public String getDisplayName() {
53 | return displayName;
54 | }
55 |
56 | public void setDisplayName(String displayName) {
57 | this.displayName = displayName;
58 | }
59 |
60 | public String getArtist() {
61 | return artist;
62 | }
63 |
64 | public void setArtist(String artist) {
65 | this.artist = artist;
66 | }
67 |
68 | public String getAlbum() {
69 | return album;
70 | }
71 |
72 | public void setAlbum(String album) {
73 | this.album = album;
74 | }
75 |
76 | public String getPath() {
77 | return path;
78 | }
79 |
80 | public void setPath(String path) {
81 | this.path = path;
82 | }
83 |
84 | public int getDuration() {
85 | return duration;
86 | }
87 |
88 | public void setDuration(int duration) {
89 | this.duration = duration;
90 | }
91 |
92 | public int getSize() {
93 | return size;
94 | }
95 |
96 | public void setSize(int size) {
97 | this.size = size;
98 | }
99 |
100 | public boolean isFavorite() {
101 | return favorite;
102 | }
103 |
104 | public void setFavorite(boolean favorite) {
105 | this.favorite = favorite;
106 | }
107 |
108 | public boolean isPlaying() {
109 | return isPlaying;
110 | }
111 |
112 | public void setPlaying(boolean playing) {
113 | isPlaying = playing;
114 | }
115 |
116 | public static Creator getCREATOR() {
117 | return CREATOR;
118 | }
119 |
120 | public Song() {
121 | }
122 |
123 | public Song(Parcel in) {
124 | readFromParcel(in);
125 | }
126 |
127 | @Override
128 | public void writeToParcel(Parcel dest, int flags) {
129 | dest.writeInt(this.id);
130 | dest.writeString(this.title);
131 | dest.writeString(this.displayName);
132 | dest.writeString(this.artist);
133 | dest.writeString(this.album);
134 | dest.writeString(this.path);
135 | dest.writeInt(this.duration);
136 | dest.writeInt(this.size);
137 | dest.writeInt(this.favorite ? 1 : 0);
138 | dest.writeInt(this.isPlaying ? 1 : 0);
139 | }
140 |
141 | public void readFromParcel(Parcel in) {
142 | this.id = in.readInt();
143 | this.title = in.readString();
144 | this.displayName = in.readString();
145 | this.artist = in.readString();
146 | this.album = in.readString();
147 | this.path = in.readString();
148 | this.duration = in.readInt();
149 | this.size = in.readInt();
150 | this.favorite = in.readInt() == 1;
151 | this.isPlaying = in.readInt() == 1;
152 | }
153 |
154 | @Override
155 | public int describeContents() {
156 | return 0;
157 | }
158 |
159 | public static final Creator CREATOR = new Creator() {
160 | @Override
161 | public Song createFromParcel(Parcel in) {
162 | return new Song(in);
163 | }
164 |
165 | @Override
166 | public Song[] newArray(int size) {
167 | return new Song[size];
168 | }
169 | };
170 | }
171 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/common/Constants.java:
--------------------------------------------------------------------------------
1 | package sbingo.likecloudmusic.common;
2 |
3 |
4 | /**
5 | * Author: Sbingo
6 | * Date: 2016/12/11
7 | */
8 |
9 | public class Constants {
10 |
11 | public static final String PREFERENCE_NAME = "likecloudmusic";
12 |
13 | public static final String LOCAL_TYPE = "local_type";
14 |
15 | //是否已经扫描过本地音乐
16 | public static final String IS_SCANNED = "is_scanned";
17 | //无播放列表则不显示控制器
18 | public static final String HAS_PLAYLIST = "has_playlist";
19 | //播放服务是否在运行中
20 | public static final String PLAY_SERVICE_RUNNING = "Play_Service_Running";
21 | //退出时保存的播放序号
22 | public static final String PLAYING_INDEX = "playing_index";
23 | //退出时保存的播放进度
24 | public static final String PLAYING_PROGRESS = "playing_progress";
25 | //夜间模式
26 | public static final String IS_NIGHT = "is_night";
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/common/MyApplication.java:
--------------------------------------------------------------------------------
1 | package sbingo.likecloudmusic.common;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 |
6 | import com.orhanobut.logger.LogLevel;
7 | import com.orhanobut.logger.Logger;
8 |
9 | import org.litepal.LitePal;
10 |
11 | import sbingo.likecloudmusic.db.LitePalHelper;
12 | import sbingo.likecloudmusic.di.component.ApplicationComponent;
13 | import sbingo.likecloudmusic.di.component.DaggerApplicationComponent;
14 | import sbingo.likecloudmusic.di.module.ApplicationModule;
15 |
16 | /**
17 | * Author: Sbingo
18 | * Date: 2016/12/11
19 | */
20 |
21 | public class MyApplication extends Application {
22 |
23 | public static long mLastClickTime = 0;
24 |
25 | private static Context appContext;
26 |
27 | private ApplicationComponent mApplicationComponent;
28 |
29 |
30 | @Override
31 | public void onCreate() {
32 | super.onCreate();
33 | appContext = this;
34 | LitePal.initialize(this);
35 | LitePalHelper.initDB();
36 | initLogger();
37 | initApplicationComponent();
38 | }
39 |
40 | public static Context getAppContext() {
41 | return appContext;
42 | }
43 |
44 | public ApplicationComponent getApplicationComponent() {
45 | return mApplicationComponent;
46 | }
47 |
48 | private void initLogger() {
49 | LogLevel lever = LogLevel.FULL;
50 | Logger.init("MyLogger") // default PRETTYLOGGER or use just init()
51 | .methodCount(3) // default 2
52 | .logLevel(lever); // default LogLevel.FULL
53 | }
54 |
55 | private void initApplicationComponent() {
56 | mApplicationComponent = DaggerApplicationComponent.builder()
57 | .applicationModule(new ApplicationModule(this))
58 | .build();
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/contract/BaseContract.java:
--------------------------------------------------------------------------------
1 | package sbingo.likecloudmusic.contract;
2 |
3 | /**
4 | * Author: Sbingo
5 | * Date: 2017/5/3
6 | */
7 |
8 | public interface BaseContract {
9 |
10 | interface BasePresenter {
11 | void attachView(T view);
12 |
13 | void detachView();
14 | }
15 |
16 | interface BaseView {
17 | void onError(String err);
18 |
19 | void onCompleted();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/contract/DiskMusicContract.java:
--------------------------------------------------------------------------------
1 | package sbingo.likecloudmusic.contract;
2 |
3 | import android.database.Cursor;
4 | import android.support.v4.app.LoaderManager;
5 |
6 | import java.util.List;
7 |
8 | import sbingo.likecloudmusic.bean.PlayList;
9 | import sbingo.likecloudmusic.bean.Song;
10 |
11 | /**
12 | * Author: Sbingo
13 | * Date: 2017/5/3
14 | */
15 |
16 | public interface DiskMusicContract {
17 |
18 | interface Presenter extends BaseContract.BasePresenter {
19 |
20 | Song cursorToSong(Cursor cursor);
21 |
22 | void loadSongFromDB();
23 |
24 | void createPlaylist(PlayList playlist, int index);
25 |
26 | }
27 |
28 | interface View extends BaseContract.BaseView {
29 |
30 | void onMusicLoaded(List songs);
31 |
32 | void showEmptyView();
33 |
34 | void hideEmptyView();
35 |
36 | LoaderManager getLoaderManager();
37 |
38 | void onPlaylistDeleted(PlayList playlist);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/component/ActivityComponent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.component;
18 |
19 | import android.app.Activity;
20 | import android.content.Context;
21 |
22 | import dagger.Component;
23 | import sbingo.likecloudmusic.di.module.ActivityModule;
24 | import sbingo.likecloudmusic.di.scope.ContextLife;
25 | import sbingo.likecloudmusic.di.scope.PerActivity;
26 |
27 | /**
28 | * Author: Sbingo
29 | * Date: 2016/12/19
30 | */
31 | @PerActivity
32 | @Component(dependencies = ApplicationComponent.class, modules = ActivityModule.class)
33 | public interface ActivityComponent {
34 |
35 | @ContextLife("Activity")
36 | Context getActivityContext();
37 |
38 | @ContextLife("Application")
39 | Context getApplicationContext();
40 |
41 | Activity getActivity();
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/component/ApplicationComponent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.component;
18 |
19 | import android.content.Context;
20 |
21 |
22 | import dagger.Component;
23 | import sbingo.likecloudmusic.di.module.ApplicationModule;
24 | import sbingo.likecloudmusic.di.scope.ContextLife;
25 | import sbingo.likecloudmusic.di.scope.PerApp;
26 |
27 | /**
28 | * Author: Sbingo
29 | * Date: 2016/12/19
30 | */
31 | @PerApp
32 | @Component(modules = ApplicationModule.class)
33 | public interface ApplicationComponent {
34 | @ContextLife("Application")
35 | Context getApplication();
36 |
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/component/FragmentComponent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.component;
18 |
19 | import android.app.Activity;
20 | import android.content.Context;
21 |
22 |
23 | import dagger.Component;
24 | import sbingo.likecloudmusic.di.module.FragmentModule;
25 | import sbingo.likecloudmusic.di.scope.ContextLife;
26 | import sbingo.likecloudmusic.di.scope.PerFragment;
27 | import sbingo.likecloudmusic.ui.fragment.LocalMusic.DiskMusicFragment;
28 |
29 | /**
30 | * Author: Sbingo
31 | * Date: 2016/12/19
32 | */
33 | @PerFragment
34 | @Component(dependencies = ApplicationComponent.class, modules = FragmentModule.class)
35 | public interface FragmentComponent {
36 | @ContextLife("Activity")
37 | Context getActivityContext();
38 |
39 | @ContextLife("Application")
40 | Context getApplicationContext();
41 |
42 | Activity getActivity();
43 |
44 | void inject(DiskMusicFragment diskMusicFragment);
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/component/ServiceComponent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.component;
18 |
19 | import android.content.Context;
20 |
21 |
22 | import dagger.Component;
23 | import sbingo.likecloudmusic.di.module.ServiceModule;
24 | import sbingo.likecloudmusic.di.scope.ContextLife;
25 | import sbingo.likecloudmusic.di.scope.PerService;
26 |
27 | /**
28 | * Author: Sbingo
29 | * Date: 2016/12/19
30 | */
31 | @PerService
32 | @Component(dependencies = ApplicationComponent.class, modules = ServiceModule.class)
33 | public interface ServiceComponent {
34 | @ContextLife("Service")
35 | Context getServiceContext();
36 |
37 | @ContextLife("Application")
38 | Context getApplicationContext();
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/module/ActivityModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.module;
18 |
19 | import android.app.Activity;
20 | import android.content.Context;
21 |
22 |
23 | import dagger.Module;
24 | import dagger.Provides;
25 | import sbingo.likecloudmusic.di.scope.ContextLife;
26 | import sbingo.likecloudmusic.di.scope.PerActivity;
27 |
28 | /**
29 | * Author: Sbingo
30 | * Date: 2016/12/19
31 | */
32 | @Module
33 | public class ActivityModule {
34 | private Activity mActivity;
35 |
36 | public ActivityModule(Activity activity) {
37 | mActivity = activity;
38 | }
39 |
40 | @Provides
41 | @PerActivity
42 | @ContextLife("Activity")
43 | public Context ProvideActivityContext() {
44 | return mActivity;
45 | }
46 |
47 | @Provides
48 | @PerActivity
49 | public Activity ProvideActivity() {
50 | return mActivity;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/module/ApplicationModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.module;
18 |
19 | import android.content.Context;
20 |
21 |
22 | import dagger.Module;
23 | import dagger.Provides;
24 | import sbingo.likecloudmusic.common.MyApplication;
25 | import sbingo.likecloudmusic.di.scope.ContextLife;
26 | import sbingo.likecloudmusic.di.scope.PerApp;
27 |
28 | /**
29 | * Author: Sbingo
30 | * Date: 2016/12/19
31 | */
32 |
33 | @Module
34 | public class ApplicationModule {
35 | private MyApplication mApplication;
36 |
37 | public ApplicationModule(MyApplication application) {
38 | mApplication = application;
39 | }
40 |
41 | @Provides
42 | @PerApp
43 | @ContextLife("Application")
44 | public Context provideApplicationContext() {
45 | return mApplication.getApplicationContext();
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/module/FragmentModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.module;
18 |
19 | import android.app.Activity;
20 | import android.content.Context;
21 | import android.support.v4.app.Fragment;
22 |
23 |
24 | import dagger.Module;
25 | import dagger.Provides;
26 | import sbingo.likecloudmusic.di.scope.ContextLife;
27 | import sbingo.likecloudmusic.di.scope.PerFragment;
28 |
29 | /**
30 | * Author: Sbingo
31 | * Date: 2016/12/19
32 | */
33 | @Module
34 | public class FragmentModule {
35 | private Fragment mFragment;
36 |
37 | public FragmentModule(Fragment fragment) {
38 | mFragment = fragment;
39 | }
40 |
41 | @Provides
42 | @PerFragment
43 | @ContextLife("Activity")
44 | public Context provideActivityContext() {
45 | return mFragment.getActivity();
46 | }
47 |
48 | @Provides
49 | @PerFragment
50 | public Activity provideActivity() {
51 | return mFragment.getActivity();
52 | }
53 |
54 | @Provides
55 | @PerFragment
56 | public Fragment provideFragment() {
57 | return mFragment;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/module/ServiceModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.module;
18 |
19 | import android.app.Service;
20 | import android.content.Context;
21 |
22 |
23 | import dagger.Module;
24 | import dagger.Provides;
25 | import sbingo.likecloudmusic.di.scope.ContextLife;
26 | import sbingo.likecloudmusic.di.scope.PerService;
27 |
28 | /**
29 | * Author: Sbingo
30 | * Date: 2016/12/19
31 | */
32 | @Module
33 | public class ServiceModule {
34 | private Service mService;
35 |
36 | public ServiceModule(Service service) {
37 | mService = service;
38 | }
39 |
40 | @Provides
41 | @PerService
42 | @ContextLife("Service")
43 | public Context ProvideServiceContext() {
44 | return mService;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/scope/ContextLife.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.scope;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 |
23 | import javax.inject.Qualifier;
24 |
25 | /**
26 | * Author: Sbingo
27 | * Date: 2016/12/19
28 | */
29 | @Qualifier
30 | @Documented
31 | @Retention(RetentionPolicy.RUNTIME)
32 | public @interface ContextLife {
33 | String value() default "Application";
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/scope/PerActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.scope;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 |
23 | import javax.inject.Scope;
24 |
25 | /**
26 | * Author: Sbingo
27 | * Date: 2016/12/19
28 | */
29 | @Scope
30 | @Documented
31 | @Retention(RetentionPolicy.RUNTIME)
32 | public @interface PerActivity {
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/scope/PerApp.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.scope;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 |
23 | import javax.inject.Scope;
24 |
25 | /**
26 | * Author: Sbingo
27 | * Date: 2016/12/19
28 | */
29 | @Scope
30 | @Documented
31 | @Retention(RetentionPolicy.RUNTIME)
32 | public @interface PerApp {
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/scope/PerFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.scope;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 |
23 | import javax.inject.Scope;
24 |
25 | /**
26 | * Author: Sbingo
27 | * Date: 2016/12/19
28 | */
29 | @Scope
30 | @Documented
31 | @Retention(RetentionPolicy.RUNTIME)
32 | public @interface PerFragment {
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/di/scope/PerService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2016 咖枯
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | *
16 | */
17 | package sbingo.likecloudmusic.di.scope;
18 |
19 | import java.lang.annotation.Documented;
20 | import java.lang.annotation.Retention;
21 | import java.lang.annotation.RetentionPolicy;
22 |
23 | import javax.inject.Scope;
24 |
25 | /**
26 | * Author: Sbingo
27 | * Date: 2016/12/19
28 | */
29 | @Scope
30 | @Documented
31 | @Retention(RetentionPolicy.RUNTIME)
32 | public @interface PerService {
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/event/DiskMusicChangeEvent.java:
--------------------------------------------------------------------------------
1 | package sbingo.likecloudmusic.event;
2 |
3 | import java.util.List;
4 |
5 | import sbingo.likecloudmusic.bean.Song;
6 |
7 | /**
8 | * Author: Sbingo
9 | * Date: 2016/12/19
10 | */
11 |
12 | public class DiskMusicChangeEvent {
13 |
14 | private int count;
15 |
16 | private List songs;
17 |
18 | public int getCount() {
19 | return count;
20 | }
21 |
22 | public List getSongs() {
23 | return songs;
24 | }
25 |
26 | public void setSongs(List songs) {
27 | this.songs = songs;
28 | }
29 |
30 | public void setCount(int count) {
31 | this.count = count;
32 | }
33 |
34 | public DiskMusicChangeEvent(List songs) {
35 | this.songs = songs;
36 | count = songs.size();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/event/PausePlayingEvent.java:
--------------------------------------------------------------------------------
1 | package sbingo.likecloudmusic.event;
2 |
3 | /**
4 | * Author: Sbingo
5 | * Date: 2016/12/27
6 | */
7 |
8 | public class PausePlayingEvent {
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/event/PlayingMusicUpdateEvent.java:
--------------------------------------------------------------------------------
1 | package sbingo.likecloudmusic.event;
2 |
3 | import sbingo.likecloudmusic.bean.Song;
4 |
5 | /**
6 | * Author: Sbingo
7 | * Date: 2016/12/26
8 | */
9 |
10 | public class PlayingMusicUpdateEvent {
11 |
12 | private Song song;
13 | private int index;
14 |
15 | public Song getSong() {
16 | return song;
17 | }
18 |
19 | public void setSong(Song song) {
20 | this.song = song;
21 | }
22 |
23 | public int getIndex() {
24 | return index;
25 | }
26 |
27 | public void setIndex(int index) {
28 | this.index = index;
29 | }
30 |
31 | public PlayingMusicUpdateEvent(Song song, int index) {
32 | this.song = song;
33 | this.index = index;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/event/PlaylistCreatedEvent.java:
--------------------------------------------------------------------------------
1 | package sbingo.likecloudmusic.event;
2 |
3 | import sbingo.likecloudmusic.bean.PlayList;
4 |
5 | /**
6 | * Author: Sbingo
7 | * Date: 2016/12/20
8 | */
9 |
10 | public class PlaylistCreatedEvent {
11 |
12 | private PlayList playlist;
13 | private int index;
14 |
15 | public PlayList getPlaylist() {
16 | return playlist;
17 | }
18 |
19 | public void setPlaylist(PlayList playlist) {
20 | this.playlist = playlist;
21 | }
22 |
23 | public int getIndex() {
24 | return index;
25 | }
26 |
27 | public void setIndex(int index) {
28 | this.index = index;
29 | }
30 |
31 | public PlaylistCreatedEvent(PlayList playlist, int index) {
32 | this.playlist = playlist;
33 | this.index = index;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/event/PlaylistDeletedEvent.java:
--------------------------------------------------------------------------------
1 | package sbingo.likecloudmusic.event;
2 |
3 | /**
4 | * Author: Sbingo
5 | * Date: 2016/12/20
6 | */
7 |
8 | public class PlaylistDeletedEvent {
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/sbingo/likecloudmusic/event/RxBus.java:
--------------------------------------------------------------------------------
1 | package sbingo.likecloudmusic.event;
2 |
3 | import rx.Observable;
4 | import rx.subjects.PublishSubject;
5 | import rx.subjects.SerializedSubject;
6 | import rx.subjects.Subject;
7 |
8 | /**
9 | * Author: Sbingo
10 | * Date: 2016/12/12
11 | */
12 |
13 | public class RxBus {
14 | private static volatile RxBus mRxBus;
15 | // 主题
16 | private final Subject