├── data ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── lauzy │ │ │ └── freedom │ │ │ └── data │ │ │ ├── entity │ │ │ ├── MusicEntity.java │ │ │ ├── StatusEntity.java │ │ │ ├── SingerAvatarEntity.java │ │ │ ├── mapper │ │ │ │ ├── LrcMapper.java │ │ │ │ ├── SingerAvatarMapper.java │ │ │ │ └── NetSongMapper.java │ │ │ ├── BaiduLrcEntity.java │ │ │ └── SongListEntity.java │ │ │ ├── local │ │ │ └── data │ │ │ │ ├── CacheRepo.java │ │ │ │ ├── ConfigRepo.java │ │ │ │ ├── impl │ │ │ │ ├── CacheRepoImpl.java │ │ │ │ └── ConfigRepoImpl.java │ │ │ │ ├── DataRepo.java │ │ │ │ └── DataManager.java │ │ │ ├── exception │ │ │ ├── NetworkConnectionException.java │ │ │ └── ErrorMsgException.java │ │ │ ├── repository │ │ │ ├── MusicFolderRepositoryImpl.java │ │ │ ├── SearchSongRepositoryImpl.java │ │ │ ├── FolderSongsRepositoryImpl.java │ │ │ ├── CacheDataManagerImpl.java │ │ │ ├── ConfigDataManagerImpl.java │ │ │ └── NetSongRepositoryImpl.java │ │ │ ├── net │ │ │ ├── interceptor │ │ │ │ └── UserAgentInterceptor.java │ │ │ └── retrofit │ │ │ │ └── TickRequestBodyConvert.java │ │ │ ├── database │ │ │ └── TickDaoHelper.java │ │ │ └── executor │ │ │ └── JobExecutor.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── lauzy │ │ │ └── freedom │ │ │ └── data │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── lauzy │ │ └── freedom │ │ └── data │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── domain ├── .gitignore ├── src │ └── main │ │ └── java │ │ └── com │ │ └── freedom │ │ └── lauzy │ │ ├── model │ │ ├── LrcBean.java │ │ ├── ArtistAvatar.java │ │ ├── CategoryBean.java │ │ ├── Folder.java │ │ ├── SongType.java │ │ ├── LocalArtistBean.java │ │ ├── LocalAlbumBean.java │ │ ├── RecentSongBean.java │ │ ├── FavoriteSongBean.java │ │ ├── QueueSongBean.java │ │ ├── LocalSongBean.java │ │ ├── BillboardBean.java │ │ ├── NetSongEntity.java │ │ └── NetSongBean.java │ │ ├── repository │ │ ├── ICacheDataManager.java │ │ ├── IConfigDataManager.java │ │ ├── MusicFolderRepository.java │ │ ├── SearchSongRepository.java │ │ ├── NetSongRepository.java │ │ ├── FolderSongsRepository.java │ │ ├── LrcRepository.java │ │ ├── SongRepository.java │ │ ├── RecentRepository.java │ │ ├── FavoriteRepository.java │ │ ├── QueueRepository.java │ │ └── LocalSongRepository.java │ │ ├── executor │ │ ├── ThreadExecutor.java │ │ └── PostExecutionThread.java │ │ ├── utils │ │ └── Preconditions.java │ │ └── interactor │ │ ├── CacheManagerUseCase.java │ │ ├── ConfigManagerUseCase.java │ │ ├── SearchSongUseCase.java │ │ ├── MusicFolderUseCase.java │ │ ├── GetLocalAlbumUseCase.java │ │ ├── FolderSongsUseCase.java │ │ ├── GetLocalSongUseCase.java │ │ ├── NetSongUseCase.java │ │ ├── GetLocalArtistUseCase.java │ │ ├── LrcUseCase.java │ │ └── RecentSongUseCase.java └── build.gradle ├── libraries ├── .gitignore ├── src │ ├── main │ │ ├── cpp │ │ │ ├── Application.mk │ │ │ ├── stackblur.h │ │ │ ├── clipblur.h │ │ │ ├── Android.mk │ │ │ ├── load.c │ │ │ └── com_lauzy_freedom_librarys_view_blur_ImageBlur.h │ │ ├── res │ │ │ ├── values-zh │ │ │ │ └── strings.xml │ │ │ ├── drawable │ │ │ │ ├── play_icon.png │ │ │ │ └── ic_album_default.png │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── ids.xml │ │ ├── assets │ │ │ └── fonts │ │ │ │ ├── fzlt.TTF │ │ │ │ └── fzltzxh.TTF │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── lauzy │ │ │ └── freedom │ │ │ └── librarys │ │ │ ├── common │ │ │ ├── StringUtil.java │ │ │ ├── LogUtil.java │ │ │ ├── NetworkUtils.java │ │ │ └── DensityUtils.java │ │ │ ├── widght │ │ │ ├── music │ │ │ │ └── lrc │ │ │ │ │ └── Lrc.java │ │ │ ├── TickAppBarLayout.java │ │ │ ├── TickSwipeRefreshLayout.java │ │ │ ├── fonts │ │ │ │ ├── SubTextUtil.java │ │ │ │ └── FontsCache.java │ │ │ ├── TickImageView.java │ │ │ ├── TickFrameLayout.java │ │ │ ├── TickProgressBar.java │ │ │ ├── TickToolbar.java │ │ │ ├── TickRelativeLayout.java │ │ │ └── TickBottomSheetDialog.java │ │ │ ├── view │ │ │ └── util │ │ │ │ ├── ColorUtil.java │ │ │ │ └── GradientBitmap.java │ │ │ └── imageload │ │ │ ├── IBaseImageStrategy.java │ │ │ └── ImageLoader.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── lauzy │ │ │ └── freedom │ │ │ └── librarys │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── lauzy │ │ └── freedom │ │ └── librarys │ │ └── ExampleInstrumentedTest.java └── proguard-rules.pro ├── presentation ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── ids.xml │ │ │ │ ├── string_values.xml │ │ │ │ ├── themes.xml │ │ │ │ └── styles.xml │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_about.png │ │ │ │ ├── ic_exit.png │ │ │ │ ├── ic_music.png │ │ │ │ ├── ic_default.png │ │ │ │ ├── ic_folder.png │ │ │ │ ├── ic_recent.png │ │ │ │ ├── ic_setting.png │ │ │ │ ├── play_black.png │ │ │ │ ├── play_white.png │ │ │ │ ├── splash_txt.png │ │ │ │ ├── ic_empty_view.png │ │ │ │ ├── ic_fab_play.png │ │ │ │ ├── ic_favorite.png │ │ │ │ ├── ic_net_song.png │ │ │ │ ├── ic_skip_next.png │ │ │ │ ├── splash_music.png │ │ │ │ ├── ic_delete_black.png │ │ │ │ ├── ic_file_folder.png │ │ │ │ ├── ic_notification.png │ │ │ │ ├── ic_favorite_white.png │ │ │ │ ├── ic_skip_previous.png │ │ │ │ ├── ic_default_horizontal.png │ │ │ │ ├── ic_select_theme_white.png │ │ │ │ ├── ic_favorite_border_black.png │ │ │ │ └── ic_favorite_border_white.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── ic_play.png │ │ │ │ ├── ic_pause.png │ │ │ │ ├── ic_clear_black.png │ │ │ │ ├── ic_clear_white.png │ │ │ │ ├── ic_repeat_black.png │ │ │ │ ├── ic_shuffle_black.png │ │ │ │ ├── ic_repeat_one_black.png │ │ │ │ ├── ic_skip_next_notify.png │ │ │ │ ├── ic_playlist_play_black.png │ │ │ │ └── ic_skip_previous_notify.png │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── xml │ │ │ │ └── provider_paths.xml │ │ │ ├── drawable │ │ │ │ ├── ripple_bg.xml │ │ │ │ ├── divider.xml │ │ │ │ ├── bg_edit_text.xml │ │ │ │ ├── edit_text_cursor.xml │ │ │ │ ├── selector_selected_theme.xml │ │ │ │ ├── side_nav_bar.xml │ │ │ │ ├── splash_bg.xml │ │ │ │ └── ic_menu_point.xml │ │ │ ├── color │ │ │ │ ├── color_tab.xml │ │ │ │ ├── color_drawer_item.xml │ │ │ │ └── color_tab_txt.xml │ │ │ ├── layouts │ │ │ │ ├── main │ │ │ │ │ ├── values │ │ │ │ │ │ └── strings.xml │ │ │ │ │ ├── layout │ │ │ │ │ │ ├── status_bar_view.xml │ │ │ │ │ │ ├── activity_splash.xml │ │ │ │ │ │ ├── fragment_play_cover.xml │ │ │ │ │ │ ├── layout_toolbar.xml │ │ │ │ │ │ ├── layout_main_content.xml │ │ │ │ │ │ ├── activity_main.xml │ │ │ │ │ │ └── nav_header_main.xml │ │ │ │ │ ├── color │ │ │ │ │ │ ├── selector_switch_thumb.xml │ │ │ │ │ │ └── selector_switch_track.xml │ │ │ │ │ └── values-w820dp │ │ │ │ │ │ └── dimens.xml │ │ │ │ └── music │ │ │ │ │ ├── layout │ │ │ │ │ ├── layout_music.xml │ │ │ │ │ ├── fragment_artist.xml │ │ │ │ │ ├── fragment_artist_album.xml │ │ │ │ │ ├── fragment_artist_song.xml │ │ │ │ │ ├── fragment_album.xml │ │ │ │ │ ├── fragment_folder_songs.xml │ │ │ │ │ ├── fragment_recent.xml │ │ │ │ │ ├── fragment_favorite.xml │ │ │ │ │ ├── fragment_file_folder.xml │ │ │ │ │ ├── layout_net_music.xml │ │ │ │ │ ├── activity_play.xml │ │ │ │ │ ├── fragment_song.xml │ │ │ │ │ ├── layout_empty.xml │ │ │ │ │ ├── play_view.xml │ │ │ │ │ ├── song_category_item.xml │ │ │ │ │ └── activity_search.xml │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ └── menu │ │ │ │ ├── menu_album_singer_item.xml │ │ │ │ ├── menu_net_play_list_item.xml │ │ │ │ ├── menu_delete.xml │ │ │ │ ├── menu_search.xml │ │ │ │ ├── play_menu.xml │ │ │ │ ├── menu_play_list_item.xml │ │ │ │ └── activity_main_drawer.xml │ │ └── java │ │ │ └── com │ │ │ └── freedom │ │ │ └── lauzy │ │ │ └── ticktockmusic │ │ │ ├── event │ │ │ ├── PlayModeEvent.java │ │ │ ├── ThemeEvent.java │ │ │ ├── ClearQueueEvent.java │ │ │ ├── MediaUpdateEvent.java │ │ │ ├── ClearRecentEvent.java │ │ │ ├── ClearFavoriteEvent.java │ │ │ ├── DeleteQueueItemEvent.java │ │ │ ├── ChangeFavoriteItemEvent.java │ │ │ └── PaletteEvent.java │ │ │ ├── base │ │ │ ├── IBaseView.java │ │ │ ├── IPresenter.java │ │ │ ├── BasePresenter.java │ │ │ └── BaseRxPresenter.java │ │ │ ├── contract │ │ │ ├── ArtistDetailContract.java │ │ │ ├── SettingContract.java │ │ │ ├── MusicFolderContract.java │ │ │ ├── LocalAlbumContract.java │ │ │ ├── ArtistSongContract.java │ │ │ ├── RecentContract.java │ │ │ ├── FavoriteContract.java │ │ │ ├── LocalMusicContract.java │ │ │ ├── NetMusicCategoryContract.java │ │ │ ├── SearchContract.java │ │ │ ├── FolderSongsContract.java │ │ │ ├── LocalArtistContract.java │ │ │ ├── PlayQueueContract.java │ │ │ ├── NetMusicContract.java │ │ │ └── PlayContract.java │ │ │ ├── presenter │ │ │ ├── MainPresenter.java │ │ │ ├── ArtistDetailPresenter.java │ │ │ ├── SettingPresenter.java │ │ │ └── MusicFolderPresenter.java │ │ │ ├── injection │ │ │ ├── scope │ │ │ │ ├── PerActivity.java │ │ │ │ ├── PerFragment.java │ │ │ │ └── ContextLife.java │ │ │ ├── module │ │ │ │ ├── ActivityModule.java │ │ │ │ └── FragmentModule.java │ │ │ └── component │ │ │ │ └── ActivityComponent.java │ │ │ ├── function │ │ │ ├── DConstants.java │ │ │ ├── exception │ │ │ │ └── ArtistAvatarException.java │ │ │ ├── UIThread.java │ │ │ ├── RxHelper.java │ │ │ └── DefaultDisposableObserver.java │ │ │ ├── utils │ │ │ ├── anim │ │ │ │ ├── PlayPagerTransformer.java │ │ │ │ ├── FragmentTransition.java │ │ │ │ └── FragmentAnimUtil.java │ │ │ └── HighlightFormatUtil.java │ │ │ ├── receiver │ │ │ └── BecomingNoisyReceiver.java │ │ │ └── ui │ │ │ └── adapter │ │ │ ├── ArtistDetailPagerAdapter.java │ │ │ ├── LocalMusicPagerAdapter.java │ │ │ ├── MusicFolderAdapter.java │ │ │ └── NetSongPagerAdapter.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── freedom │ │ │ └── lauzy │ │ │ └── ticktockmusic │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── freedom │ │ └── lauzy │ │ └── ticktockmusic │ │ └── ExampleInstrumentedTest.java └── proguard-rules.pro ├── settings.gradle ├── screenshots ├── screenshot01.jpg ├── screenshot02.jpg ├── screenshot03.jpg ├── screenshot04.jpg └── screenshot05.jpg ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore └── gradle.properties /data/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /domain/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /libraries/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /presentation/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':presentation', ':domain', ':data', ':libraries' 2 | -------------------------------------------------------------------------------- /presentation/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /libraries/src/main/cpp/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | APP_PLATFORM:= android-25 3 | APP_OPTIM := release -------------------------------------------------------------------------------- /screenshots/screenshot01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/screenshots/screenshot01.jpg -------------------------------------------------------------------------------- /screenshots/screenshot02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/screenshots/screenshot02.jpg -------------------------------------------------------------------------------- /screenshots/screenshot03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/screenshots/screenshot03.jpg -------------------------------------------------------------------------------- /screenshots/screenshot04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/screenshots/screenshot04.jpg -------------------------------------------------------------------------------- /screenshots/screenshot05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/screenshots/screenshot05.jpg -------------------------------------------------------------------------------- /data/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | data 3 | 4 | -------------------------------------------------------------------------------- /libraries/src/main/res/values-zh/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 分享 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | .idea 4 | /local.properties 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | -------------------------------------------------------------------------------- /libraries/src/main/cpp/stackblur.h: -------------------------------------------------------------------------------- 1 | int *blur_ARGB_8888(int *, int, int, int); 2 | 3 | short *blur_RGB_565(short *, int, int, int); -------------------------------------------------------------------------------- /libraries/src/main/assets/fonts/fzlt.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/libraries/src/main/assets/fonts/fzlt.TTF -------------------------------------------------------------------------------- /libraries/src/main/assets/fonts/fzltzxh.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/libraries/src/main/assets/fonts/fzltzxh.TTF -------------------------------------------------------------------------------- /libraries/src/main/res/drawable/play_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/libraries/src/main/res/drawable/play_icon.png -------------------------------------------------------------------------------- /presentation/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /libraries/src/main/res/drawable/ic_album_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/libraries/src/main/res/drawable/ic_album_default.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_about.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_exit.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_music.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxxhdpi/ic_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxxhdpi/ic_play.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_default.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_folder.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_recent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_recent.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_setting.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/play_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/play_black.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/play_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/play_white.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/splash_txt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/splash_txt.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxxhdpi/ic_pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxxhdpi/ic_pause.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /libraries/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Librarys 3 | 4 | Share 5 | 6 | -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_empty_view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_empty_view.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_fab_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_fab_play.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_favorite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_favorite.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_net_song.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_net_song.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_skip_next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_skip_next.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/splash_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/splash_music.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_delete_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_delete_black.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_file_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_file_folder.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_notification.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxxhdpi/ic_clear_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxxhdpi/ic_clear_black.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxxhdpi/ic_clear_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxxhdpi/ic_clear_white.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_favorite_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_favorite_white.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_skip_previous.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_skip_previous.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxxhdpi/ic_repeat_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxxhdpi/ic_repeat_black.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxxhdpi/ic_shuffle_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxxhdpi/ic_shuffle_black.png -------------------------------------------------------------------------------- /presentation/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxxhdpi/ic_repeat_one_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxxhdpi/ic_repeat_one_black.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxxhdpi/ic_skip_next_notify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxxhdpi/ic_skip_next_notify.png -------------------------------------------------------------------------------- /presentation/src/main/res/xml/provider_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_default_horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_default_horizontal.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_select_theme_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_select_theme_white.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxxhdpi/ic_playlist_play_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxxhdpi/ic_playlist_play_black.png -------------------------------------------------------------------------------- /libraries/src/main/cpp/clipblur.h: -------------------------------------------------------------------------------- 1 | int *clip_blur_ARGB_8888(int *, const int, const int, const int, const int); 2 | 3 | short *clip_blur_RGB_565(short *, const int, const int, const int, const int); -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_favorite_border_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_favorite_border_black.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxhdpi/ic_favorite_border_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxhdpi/ic_favorite_border_white.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable-xxxhdpi/ic_skip_previous_notify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lauzy/TicktockMusic/HEAD/presentation/src/main/res/drawable-xxxhdpi/ic_skip_previous_notify.png -------------------------------------------------------------------------------- /presentation/src/main/res/drawable/ripple_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | -------------------------------------------------------------------------------- /presentation/src/main/res/color/color_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/main/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello blank fragment 4 | play_img 5 | 6 | -------------------------------------------------------------------------------- /libraries/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /presentation/src/main/res/drawable/divider.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Oct 26 10:17:14 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /presentation/src/main/res/drawable/bg_edit_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /presentation/src/main/res/drawable/edit_text_cursor.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /libraries/src/main/cpp/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := ImageBlurJni 6 | LOCAL_SRC_FILES := stackblur.c com_lauzy_freedom_librarys_view_blur_ImageBlur.c load.c 7 | LOCAL_LDLIBS := -lm -llog -ljnigraphics 8 | 9 | include $(BUILD_SHARED_LIBRARY) -------------------------------------------------------------------------------- /presentation/src/main/res/values/string_values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | TransitionImage 4 | TransitionSingerImage 5 | TransitionText 6 | -------------------------------------------------------------------------------- /presentation/src/main/res/color/color_drawer_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /presentation/src/main/res/color/color_tab_txt.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /presentation/src/main/res/drawable/selector_selected_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/event/PlayModeEvent.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.event; 2 | 3 | /** 4 | * Desc : 播放模式 5 | * Author : Lauzy 6 | * Date : 2017/9/11 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class PlayModeEvent { 11 | } 12 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/main/layout/status_bar_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/layout_music.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/event/ThemeEvent.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.event; 2 | 3 | /** 4 | * Desc : Change Theme 5 | * Author : Lauzy 6 | * Date : 2017/7/6 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class ThemeEvent { 11 | } 12 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/event/ClearQueueEvent.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.event; 2 | 3 | /** 4 | * Desc : 清空播放队列 5 | * Author : Lauzy 6 | * Date : 2017/9/12 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class ClearQueueEvent { 11 | } 12 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/event/MediaUpdateEvent.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.event; 2 | 3 | /** 4 | * Desc : 媒体库更新事件 5 | * Author : Lauzy 6 | * Date : 2017/12/26 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class MediaUpdateEvent { 11 | } 12 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/LrcBean.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : 在线歌词 5 | * Author : Lauzy 6 | * Date : 2018/3/26 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class LrcBean { 11 | public String lrc; 12 | public String song; 13 | } 14 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/event/ClearRecentEvent.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.event; 2 | 3 | /** 4 | * Desc : 清空最近播放Event 5 | * Author : Lauzy 6 | * Date : 2017/9/15 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class ClearRecentEvent { 11 | } 12 | -------------------------------------------------------------------------------- /data/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/event/ClearFavoriteEvent.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.event; 2 | 3 | /** 4 | * Desc : 清空我的喜欢Event 5 | * Author : Lauzy 6 | * Date : 2017/9/13 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class ClearFavoriteEvent { 11 | } 12 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/event/DeleteQueueItemEvent.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.event; 2 | 3 | /** 4 | * Desc : 删除播放队列数据事件 5 | * Author : Lauzy 6 | * Date : 2017/10/18 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class DeleteQueueItemEvent { 11 | } 12 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/ArtistAvatar.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : 歌手头像 5 | * Author : Lauzy 6 | * Date : 2017/9/28 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class ArtistAvatar { 11 | public String picUrl; 12 | public String bigPicUrl; 13 | } 14 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/base/IBaseView.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.base; 2 | 3 | /** 4 | * Desc : IBaseView 5 | * Author : Lauzy 6 | * Date : 2017/7/3 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public interface IBaseView { 11 | // Context context(); 12 | } 13 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/event/ChangeFavoriteItemEvent.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.event; 2 | 3 | /** 4 | * Desc : 添加删除单个喜欢的音乐Event 5 | * Author : Lauzy 6 | * Date : 2017/9/14 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class ChangeFavoriteItemEvent { 11 | } 12 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/CategoryBean.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : 分类Bean 5 | * Author : Lauzy 6 | * Date : 2017/8/4 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class CategoryBean { 11 | public String title; 12 | public int type; 13 | public String imgUrl; 14 | } 15 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/Folder.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : 文件夹 5 | * Author : Lauzy 6 | * Date : 2018/3/14 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class Folder { 11 | public String folderPath; 12 | public String folderName; 13 | public int songCount; 14 | } 15 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/main/color/selector_switch_thumb.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/main/color/selector_switch_track.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /presentation/src/main/res/menu/menu_album_singer_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /presentation/src/main/res/menu/menu_net_play_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/SongType.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : 音乐类型 5 | * Author : Lauzy 6 | * Date : 2018/4/3 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class SongType { 11 | public static final String NET = "NET"; 12 | public static final String LOCAL = "LOCAL"; 13 | } 14 | -------------------------------------------------------------------------------- /presentation/src/main/res/drawable/side_nav_bar.xml: -------------------------------------------------------------------------------- 1 | 3 | 9 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/entity/MusicEntity.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.entity; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Desc : MusicBean 7 | * Author : Lauzy 8 | * Date : 2017/7/11 9 | * Blog : http://www.jianshu.com/u/e76853f863a9 10 | * Email : freedompaladin@gmail.com 11 | */ 12 | public class MusicEntity extends StatusEntity { 13 | public List song_list; 14 | } 15 | -------------------------------------------------------------------------------- /presentation/src/main/res/menu/menu_delete.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /presentation/src/main/res/menu/menu_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /presentation/src/main/res/menu/play_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /presentation/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/base/IPresenter.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.base; 2 | 3 | /** 4 | * Desc : IPresenter 5 | * Author : Lauzy 6 | * Date : 2017/7/5 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public interface IPresenter { 11 | void attachView(T view); 12 | void detachView(); 13 | } 14 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/main/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/LocalArtistBean.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : 歌手信息 5 | * Author : Lauzy 6 | * Date : 2017/9/28 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class LocalArtistBean { 11 | public long artistId; 12 | public String artistName; 13 | public int songsNum; 14 | public int albumsNum; 15 | } 16 | -------------------------------------------------------------------------------- /libraries/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/repository/ICacheDataManager.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.repository; 2 | 3 | /** 4 | * Desc : 缓存 5 | * Author : Lauzy 6 | * Date : 2018/4/3 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public interface ICacheDataManager { 11 | 12 | void setArtistAvatar(String artistName, String avatarUrl); 13 | 14 | String getArtistAvatar(String artistName); 15 | } 16 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/ArtistDetailContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | /** 4 | * Desc : 歌手详情 5 | * Author : Lauzy 6 | * Date : 2018/4/3 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public interface ArtistDetailContract { 11 | interface Presenter { 12 | String getArtistAvatarUrl(String artistName); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/executor/ThreadExecutor.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.executor; 2 | 3 | import java.util.concurrent.Executor; 4 | 5 | /** 6 | * Desc : 线程执行接口,{@link com.freedom.lauzy.interactor.UseCase} 中使用, 7 | * 执行 useCase 可控制线程均在非 UI 线程。 8 | * Author : Lauzy 9 | * Date : 2017/7/6 10 | * Blog : http://www.jianshu.com/u/e76853f863a9 11 | * Email : freedompaladin@gmail.com 12 | */ 13 | public interface ThreadExecutor extends Executor { 14 | } 15 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/main/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/local/data/CacheRepo.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.local.data; 2 | 3 | /** 4 | * Desc : 缓存 5 | * Author : Lauzy 6 | * Date : 2018/4/3 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public interface CacheRepo extends DataRepo{ 11 | 12 | void setArtistAvatar(String artistName, String avatarUrl); 13 | 14 | String getArtistAvatar(String artistName); 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/common/StringUtil.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.common; 2 | 3 | /** 4 | * Desc : 字符串工具类 5 | * Author : Lauzy 6 | * Date : 2018/5/25 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class StringUtil { 11 | 12 | public static boolean isEmpty(CharSequence charSequence) { 13 | return charSequence == null || charSequence.length() <= 0; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/executor/PostExecutionThread.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.executor; 2 | 3 | import io.reactivex.Scheduler; 4 | 5 | /** 6 | * Desc : 线程调度接口, useCase 观察者 observeOn 均在此线程中执行, 7 | * Presentation 中实现此接口,返回值为 Android 的 mainThread 8 | * Author : Lauzy 9 | * Date : 2017/7/6 10 | * Blog : http://www.jianshu.com/u/e76853f863a9 11 | * Email : freedompaladin@gmail.com 12 | */ 13 | public interface PostExecutionThread { 14 | Scheduler getScheduler(); 15 | } 16 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/LocalAlbumBean.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : LocalAlbum 5 | * Author : Lauzy 6 | * Date : 2017/8/10 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class LocalAlbumBean { 11 | public String artistName; 12 | public long albumId; 13 | public long id; 14 | public int songsNum; 15 | public String albumName; 16 | public Object albumCover; 17 | } 18 | -------------------------------------------------------------------------------- /data/src/test/java/com/lauzy/freedom/data/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/SettingContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | /** 4 | * Desc : 设置接口 5 | * Author : Lauzy 6 | * Date : 2018/4/3 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public interface SettingContract { 11 | 12 | interface Presenter { 13 | 14 | boolean isEnablePlayByNetwork(); 15 | 16 | void enablePlayByNetwork(boolean isEnable); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/repository/IConfigDataManager.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.repository; 2 | 3 | /** 4 | * Desc : 配置管理 5 | * Author : Lauzy 6 | * Date : 2018/4/3 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public interface IConfigDataManager { 11 | 12 | void setRepeatMode(int mode); 13 | 14 | int getRepeatMode(int defaultMode); 15 | 16 | void enablePlayByNetwork(boolean isEnable); 17 | 18 | boolean isEnablePlayByNetwork(); 19 | } 20 | -------------------------------------------------------------------------------- /libraries/src/test/java/com/lauzy/freedom/librarys/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/fragment_artist.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/local/data/ConfigRepo.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.local.data; 2 | 3 | /** 4 | * Desc : 配置 5 | * Author : Lauzy 6 | * Date : 2018/4/3 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public interface ConfigRepo extends DataRepo{ 11 | 12 | void setRepeatMode(int mode); 13 | 14 | int getRepeatMode(int defaultMode); 15 | 16 | void enablePlayByNetwork(boolean isEnable); 17 | 18 | boolean isEnablePlayByNetwork(); 19 | } 20 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/event/PaletteEvent.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.event; 2 | 3 | /** 4 | * Desc : 取色Event 5 | * Author : Lauzy 6 | * Date : 2017/8/17 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class PaletteEvent { 11 | 12 | private int mColor; 13 | 14 | public PaletteEvent(int color) { 15 | mColor = color; 16 | } 17 | 18 | public int getColor() { 19 | return mColor; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/fragment_artist_album.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/fragment_artist_song.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/presenter/MainPresenter.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.presenter; 2 | 3 | import com.freedom.lauzy.ticktockmusic.base.BasePresenter; 4 | 5 | import javax.inject.Inject; 6 | 7 | /** 8 | * Desc : MainPresenter 9 | * Author : Lauzy 10 | * Date : 2017/8/2 11 | * Blog : http://www.jianshu.com/u/e76853f863a9 12 | * Email : freedompaladin@gmail.com 13 | */ 14 | public class MainPresenter extends BasePresenter { 15 | 16 | @Inject 17 | MainPresenter() { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /presentation/src/test/java/com/freedom/lauzy/ticktockmusic/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/injection/scope/PerActivity.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.injection.scope; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | import javax.inject.Scope; 7 | 8 | /** 9 | * Desc : PerActivity 10 | * Author : Lauzy 11 | * Date : 2017/7/3 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | @Scope 16 | @Retention(RetentionPolicy.RUNTIME) 17 | public @interface PerActivity { 18 | } 19 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/injection/scope/PerFragment.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.injection.scope; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | import javax.inject.Scope; 7 | 8 | /** 9 | * Desc : PerFragment 10 | * Author : Lauzy 11 | * Date : 2017/7/3 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | @Scope 16 | @Retention(RetentionPolicy.RUNTIME) 17 | public @interface PerFragment { 18 | } 19 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/exception/NetworkConnectionException.java: -------------------------------------------------------------------------------- 1 | 2 | package com.lauzy.freedom.data.exception; 3 | 4 | /** 5 | * Desc : 网络异常 6 | * Author : Lauzy 7 | * Date : 2017/7/7 8 | * Blog : http://www.jianshu.com/u/e76853f863a9 9 | * Email : freedompaladin@gmail.com 10 | */ 11 | public class NetworkConnectionException extends Exception { 12 | 13 | public NetworkConnectionException() { 14 | super(); 15 | } 16 | 17 | public NetworkConnectionException(final Throwable cause) { 18 | super(cause); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/function/DConstants.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.function; 2 | 3 | /** 4 | * Desc : 逻辑常量 5 | * Author : Lauzy 6 | * Date : 2017/8/4 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class DConstants { 11 | public static class Status { 12 | public static final int INIT_STATUS = 0x0017; 13 | public static final int REFRESH_STATUS = 0x0018; 14 | public static final int LOAD_MORE_STATUS = 0x0019; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/function/exception/ArtistAvatarException.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.function.exception; 2 | 3 | /** 4 | * Desc : 歌手头像异常 5 | * Author : Lauzy 6 | * Date : 2017/10/16 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class ArtistAvatarException extends RuntimeException { 11 | 12 | public ArtistAvatarException() { 13 | } 14 | 15 | public ArtistAvatarException(String message) { 16 | super(message); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/entity/StatusEntity.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.entity; 2 | 3 | import com.lauzy.freedom.data.net.constants.NetConstants; 4 | 5 | /** 6 | * Desc : StatusEntity 7 | * Author : Lauzy 8 | * Date : 2017/7/7 9 | * Blog : http://www.jianshu.com/u/e76853f863a9 10 | * Email : freedompaladin@gmail.com 11 | */ 12 | public class StatusEntity { 13 | public int error_code; 14 | public String error_msg; 15 | 16 | public boolean isInvalidCode() { 17 | return error_code != NetConstants.ErrorCode.CODE_SUCCESS; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /presentation/src/main/res/drawable/splash_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /domain/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | 3 | configurations { 4 | provided 5 | } 6 | 7 | dependencies { 8 | def domainDependencies = rootProject.ext.domainDependencies 9 | implementation fileTree(dir: 'libs', include: ['*.jar']) 10 | implementation domainDependencies.javaxAnnotation 11 | implementation domainDependencies.javaxInject 12 | implementation domainDependencies.rxJava 13 | implementation domainDependencies.okHttp 14 | } 15 | 16 | tasks.withType(JavaCompile) { 17 | options.encoding = "UTF-8" 18 | } 19 | 20 | sourceCompatibility = "1.7" 21 | targetCompatibility = "1.7" 22 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/fragment_album.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/fragment_folder_songs.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/fragment_recent.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/fragment_favorite.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/repository/MusicFolderRepository.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.repository; 2 | 3 | import com.freedom.lauzy.model.Folder; 4 | import com.freedom.lauzy.model.LocalSongBean; 5 | 6 | import java.util.List; 7 | 8 | import io.reactivex.Observable; 9 | 10 | /** 11 | * Desc : 文件夹 12 | * Author : Lauzy 13 | * Date : 2018/3/15 14 | * Blog : http://www.jianshu.com/u/e76853f863a9 15 | * Email : freedompaladin@gmail.com 16 | */ 17 | public interface MusicFolderRepository { 18 | 19 | /** 20 | * 获取文件夹 21 | * @return ob 22 | */ 23 | Observable> getMusicFolders(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/repository/SearchSongRepository.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.repository; 2 | 3 | import com.freedom.lauzy.model.LocalSongBean; 4 | 5 | import java.util.List; 6 | 7 | import io.reactivex.Observable; 8 | 9 | /** 10 | * Desc : 搜索歌曲 11 | * Author : Lauzy 12 | * Date : 2018/5/22 13 | * Blog : http://www.jianshu.com/u/e76853f863a9 14 | * Email : freedompaladin@gmail.com 15 | */ 16 | public interface SearchSongRepository { 17 | 18 | /** 19 | * 搜索歌曲 20 | * 21 | * @param songName 模糊名称 22 | * @return ob 23 | */ 24 | Observable> searchSong(String songName); 25 | } 26 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/function/UIThread.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.function; 2 | 3 | 4 | import com.freedom.lauzy.executor.PostExecutionThread; 5 | 6 | import javax.inject.Inject; 7 | import javax.inject.Singleton; 8 | 9 | import io.reactivex.Scheduler; 10 | import io.reactivex.android.schedulers.AndroidSchedulers; 11 | 12 | 13 | @Singleton 14 | public class UIThread implements PostExecutionThread { 15 | 16 | @Inject 17 | public UIThread() { 18 | } 19 | 20 | @Override 21 | public Scheduler getScheduler() { 22 | return AndroidSchedulers.mainThread(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/repository/NetSongRepository.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.repository; 2 | 3 | import com.freedom.lauzy.model.NetSongEntity; 4 | 5 | import io.reactivex.Observable; 6 | 7 | /** 8 | * Desc : 网络歌曲数据仓库接口 9 | * Author : Lauzy 10 | * Date : 2017/9/17 11 | * Blog : http://www.jianshu.com/u/e76853f863a9 12 | * Email : freedompaladin@gmail.com 13 | */ 14 | public interface NetSongRepository { 15 | /** 16 | * 获取网络数据 17 | * @param method 接口参数 method 18 | * @param songId songId 19 | * @return Observable 20 | */ 21 | Observable getNetSongData(String method, long songId); 22 | } 23 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/fragment_file_folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/repository/FolderSongsRepository.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.repository; 2 | 3 | import com.freedom.lauzy.model.LocalSongBean; 4 | 5 | import java.util.List; 6 | 7 | import io.reactivex.Observable; 8 | 9 | /** 10 | * Desc : 文件夹下音乐 11 | * Author : Lauzy 12 | * Date : 2018/3/15 13 | * Blog : http://www.jianshu.com/u/e76853f863a9 14 | * Email : freedompaladin@gmail.com 15 | */ 16 | public interface FolderSongsRepository { 17 | /** 18 | * 获取文件夹下的音乐 19 | * 20 | * @param folderPath 文件夹路径 21 | * @return ob 22 | */ 23 | Observable> getFolderSongs(String folderPath); 24 | } 25 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/injection/scope/ContextLife.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.injection.scope; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | 7 | import javax.inject.Qualifier; 8 | 9 | /** 10 | * Desc : ContextLife 11 | * Author : Lauzy 12 | * Date : 2017/7/3 13 | * Blog : http://www.jianshu.com/u/e76853f863a9 14 | * Email : freedompaladin@gmail.com 15 | */ 16 | @Qualifier 17 | @Documented 18 | @Retention(RetentionPolicy.RUNTIME) 19 | public @interface ContextLife { 20 | String value() default "Application"; 21 | } 22 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/layout_net_music.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/main/layout/fragment_play_cover.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/RecentSongBean.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : 最近播放bean 5 | * Author : Lauzy 6 | * Date : 2017/9/14 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class RecentSongBean { 11 | public long id; //音乐ID 12 | public String title; //音乐名 13 | public String path; //路径 14 | public long albumId; //专辑ID 15 | public String albumName; //专辑名 16 | public String artistName; //歌手名 17 | public long duration;//时长 18 | public String songLength;//音乐长度(时间格式化) 19 | public String type;//来源(本地或网络) 20 | public String albumCover; 21 | } 22 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/FavoriteSongBean.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : 喜欢歌曲Bean 5 | * Author : Lauzy 6 | * Date : 2017/9/12 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class FavoriteSongBean { 11 | public long id; //音乐ID 12 | public String title; //音乐名 13 | public String path; //路径 14 | public long albumId; //专辑ID 15 | public String albumName; //专辑名 16 | public String artistName; //歌手名 17 | public long duration;//时长 18 | public String songLength;//音乐长度(时间格式化) 19 | public String type;//来源(本地或网络) 20 | public String albumCover; 21 | } 22 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/base/BasePresenter.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.base; 2 | 3 | /** 4 | * Desc : BasePresenter 5 | * Author : Lauzy 6 | * Date : 2017/7/3 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class BasePresenter implements IPresenter { 11 | 12 | private T mView; 13 | 14 | public T getView() { 15 | return mView; 16 | } 17 | 18 | @Override 19 | public void attachView(T view) { 20 | mView = view; 21 | } 22 | 23 | @Override 24 | public void detachView() { 25 | mView = null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/widght/music/lrc/Lrc.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.widght.music.lrc; 2 | 3 | /** 4 | * Desc : 歌词实体 5 | * Author : Lauzy 6 | * Date : 2017/10/13 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class Lrc { 11 | private long time; 12 | private String text; 13 | 14 | public void setTime(long time) { 15 | this.time = time; 16 | } 17 | 18 | public void setText(String text) { 19 | this.text = text; 20 | } 21 | 22 | public long getTime() { 23 | return time; 24 | } 25 | 26 | public String getText() { 27 | return text; 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /data/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:\StudioSDK/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 | -------------------------------------------------------------------------------- /libraries/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:\StudioSDK/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 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/function/RxHelper.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.function; 2 | 3 | import io.reactivex.ObservableTransformer; 4 | import io.reactivex.android.schedulers.AndroidSchedulers; 5 | import io.reactivex.schedulers.Schedulers; 6 | 7 | /** 8 | * Desc : Rx转换 9 | * Author : Lauzy 10 | * Date : 2017/8/25 11 | * Blog : http://www.jianshu.com/u/e76853f863a9 12 | * Email : freedompaladin@gmail.com 13 | */ 14 | public class RxHelper { 15 | public static ObservableTransformer ioMain() { 16 | return upstream -> upstream 17 | .subscribeOn(Schedulers.io()) 18 | .observeOn(AndroidSchedulers.mainThread()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /presentation/src/main/res/menu/menu_play_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/widght/TickAppBarLayout.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.widght; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | import com.bilibili.magicasakura.widgets.TintAppBarLayout; 7 | 8 | /** 9 | * Desc : 换肤AppBarLayout 10 | * Author : Lauzy 11 | * Date : 2017/8/8 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public class TickAppBarLayout extends TintAppBarLayout { 16 | public TickAppBarLayout(Context context) { 17 | super(context); 18 | } 19 | 20 | public TickAppBarLayout(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/view/util/ColorUtil.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.view.util; 2 | 3 | import android.graphics.Color; 4 | import android.support.annotation.ColorInt; 5 | 6 | /** 7 | * Desc : 颜色工具类 8 | * Author : Lauzy 9 | * Date : 2018/3/13 10 | * Blog : http://www.jianshu.com/u/e76853f863a9 11 | * Email : freedompaladin@gmail.com 12 | */ 13 | public class ColorUtil { 14 | 15 | /** 16 | * 判断深浅色 17 | * @param color 颜色值 18 | * @return 是否为深色 19 | */ 20 | public static boolean isDarkColor(@ColorInt int color) { 21 | double rgb = Color.red(color) * 0.299 + Color.green(color) * 0.587 + Color.blue(color) * 0.114; 22 | return rgb <= 192; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/main/layout/layout_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/widght/TickSwipeRefreshLayout.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.widght; 2 | 3 | import android.content.Context; 4 | import android.support.v4.widget.SwipeRefreshLayout; 5 | import android.util.AttributeSet; 6 | 7 | /** 8 | * Desc : 基类 SwipeRefreshLayout 9 | * Author : Lauzy 10 | * Date : 2017/8/8 11 | * Blog : http://www.jianshu.com/u/e76853f863a9 12 | * Email : freedompaladin@gmail.com 13 | */ 14 | public class TickSwipeRefreshLayout extends SwipeRefreshLayout { 15 | 16 | public TickSwipeRefreshLayout(Context context) { 17 | super(context); 18 | } 19 | 20 | public TickSwipeRefreshLayout(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/QueueSongBean.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : 播放队列 Item 实体类 5 | * Author : Lauzy 6 | * Date : 2017/8/29 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class QueueSongBean { 11 | public long id; //音乐ID 12 | public String title; //音乐名 13 | public String path; //路径 14 | public long albumId; //专辑ID 15 | public String albumName; //专辑名 16 | public Object albumCover;//专辑封面 17 | public long artistId; //歌手ID 18 | public String artistName; //歌手名 19 | public long size;//大小 20 | public long duration;//时长 21 | public String songLength;//音乐长度(时间格式化) 22 | public String type;//来源(本地或网络) 23 | } 24 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/main/layout/layout_main_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/LocalSongBean.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : 原设计仅为本地音乐Bean。添加至播放队列时,网络数据经映射转换后也采用了此对象。 5 | * Author : Lauzy 6 | * Date : 2017/8/9 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class LocalSongBean { 11 | public long id; //音乐ID 12 | public String title; //音乐名 13 | public long duration; //时长 14 | public String songLength; 15 | public String path; //路径 16 | public long albumId; //专辑ID 17 | public String albumName; //专辑名 18 | public Object albumCover;//专辑封面 19 | public long artistId; //歌手ID 20 | public String artistName; //歌手名 21 | public long size;//大小 22 | public String type;//类型 23 | } 24 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/utils/anim/PlayPagerTransformer.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.utils.anim; 2 | 3 | import android.support.v4.view.ViewPager; 4 | import android.view.View; 5 | 6 | /** 7 | * Desc : ViewPager转场动画 8 | * Author : Lauzy 9 | * Date : 2018/3/8 10 | * Blog : http://www.jianshu.com/u/e76853f863a9 11 | * Email : freedompaladin@gmail.com 12 | */ 13 | public class PlayPagerTransformer implements ViewPager.PageTransformer { 14 | @Override 15 | public void transformPage(View page, float position) { 16 | page.setPivotX(position < 0 ? 0 : page.getWidth()); 17 | page.setTranslationX(-page.getWidth() * position); 18 | page.setScaleX(position < 0 ? 1 + position : 1 - position); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/widght/fonts/SubTextUtil.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.widght.fonts; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | /** 6 | * Desc : 截取字符串工具类 7 | * Author : Lauzy 8 | * Date : 2017/9/6 9 | * Blog : http://www.jianshu.com/u/e76853f863a9 10 | * Email : freedompaladin@gmail.com 11 | */ 12 | public class SubTextUtil { 13 | 14 | /** 15 | * 截取添加省略号 16 | * @param content 内容 17 | * @param subLength 截取长度 18 | * @return 截取后的字符串 19 | */ 20 | public static String addEllipsis(@NonNull String content, int subLength) { 21 | if (content.length() > subLength) { 22 | content = content.substring(0, subLength) + "..."; 23 | } 24 | return content; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/BillboardBean.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : BillboardBean 歌曲列表介绍 5 | * Author : Lauzy 6 | * Date : 2017/7/6 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | @SuppressWarnings("unused") 11 | public class BillboardBean { 12 | public String billboard_type; 13 | public String billboard_no; 14 | public String update_date; 15 | public String billboard_songnum; 16 | public int havemore; 17 | public String name; 18 | public String comment; 19 | public String pic_s192; 20 | public String pic_s640; 21 | public String pic_s444; 22 | public String pic_s260; 23 | public String pic_s210; 24 | public String web_url; 25 | } 26 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/exception/ErrorMsgException.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.exception; 2 | 3 | /** 4 | * Desc : 错误信息 5 | * gson 基类提取,封装后抛多种异常 后在 presentation 中处理, 6 | * 防止 自定义DisposableObserver造成的多状态多场景无法处理 7 | * Author : Lauzy 8 | * Date : 2017/7/7 9 | * Blog : http://www.jianshu.com/u/e76853f863a9 10 | * Email : freedompaladin@gmail.com 11 | */ 12 | public class ErrorMsgException extends RuntimeException { 13 | 14 | private int mErrCode; 15 | 16 | public ErrorMsgException(int errCode, String message) { 17 | super(message); 18 | mErrCode = errCode; 19 | } 20 | 21 | public int getErrCode() { 22 | return mErrCode; 23 | } 24 | 25 | public void setErrCode(int errCode) { 26 | mErrCode = errCode; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/repository/LrcRepository.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.repository; 2 | 3 | import io.reactivex.Observable; 4 | import okhttp3.ResponseBody; 5 | 6 | /** 7 | * Desc : 歌词 8 | * Author : Lauzy 9 | * Date : 2018/3/26 10 | * Blog : http://www.jianshu.com/u/e76853f863a9 11 | * Email : freedompaladin@gmail.com 12 | */ 13 | public interface LrcRepository { 14 | /** 15 | * 获取歌词 16 | * 17 | * @param songName 歌曲名 18 | * @param singer 歌手 19 | * @return ob 20 | */ 21 | Observable getLrcData(String songName, String singer); 22 | 23 | /** 24 | * 获取百度音乐歌词 25 | * 26 | * @param songId 歌曲ID 27 | * @return ob 28 | */ 29 | Observable getBaiduLrcData(String method, long songId); 30 | } 31 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/imageload/IBaseImageStrategy.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.imageload; 2 | 3 | import android.content.Context; 4 | import android.widget.ImageView; 5 | 6 | /** 7 | * Desc : 基础策略接口,此处也可可采用泛型,子类继承ImageConfig来实现,此处暂不使用。 8 | * 因为若三方库改动,则子类Config变动太大。故认为直接使用ImageConfig即可,可自行斟酌。 9 | * 代码如下: 10 | * public interface IBaseImageStrategy { 11 | * void display(Context context, T imageConfig);} 12 | * Author : Lauzy 13 | * Date : 2017/6/30 14 | * Blog : http://www.jianshu.com/u/e76853f863a9 15 | * Email : freedompaladin@gmail.com 16 | */ 17 | public interface IBaseImageStrategy { 18 | 19 | void display(Context context, ImageConfig imageConfig); 20 | 21 | void clean(Context context, ImageView imageView); 22 | } 23 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/MusicFolderContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import com.freedom.lauzy.model.Folder; 4 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 文件夹接口 10 | * Author : Lauzy 11 | * Date : 2018/3/15 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public interface MusicFolderContract { 16 | 17 | interface Presenter { 18 | 19 | void loadFolders(); 20 | } 21 | 22 | interface View extends IBaseView { 23 | void onLoadFoldersSuccess(List folders); 24 | 25 | void setEmptyView(); 26 | 27 | void loadFailed(Throwable throwable); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/entity/SingerAvatarEntity.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.entity; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Desc : 歌手信息Bean 9 | * Author : Lauzy 10 | * Date : 2017/9/28 11 | * Blog : http://www.jianshu.com/u/e76853f863a9 12 | * Email : freedompaladin@gmail.com 13 | */ 14 | public class SingerAvatarEntity { 15 | 16 | public ArtistBean artist; 17 | 18 | public static class ArtistBean { 19 | 20 | public String name; 21 | public String url; 22 | public List image; 23 | 24 | public static class ImageBean { 25 | @SerializedName("#text") 26 | public String imgUrl; 27 | public String size; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/LocalAlbumContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import com.freedom.lauzy.model.LocalAlbumBean; 4 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : LocalAlbum 10 | * Author : Lauzy 11 | * Date : 2017/8/10 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public interface LocalAlbumContract { 16 | interface Presenter { 17 | void loadLocalAlbum(); 18 | } 19 | 20 | interface View extends IBaseView { 21 | void loadLocalAlbum(List localAlbumBeen); 22 | 23 | void setEmptyView(); 24 | 25 | void loadFailed(Throwable throwable); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | android.useDeprecatedNdk=true -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/ArtistSongContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 4 | import com.freedom.lauzy.ticktockmusic.model.SongEntity; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 歌手音乐接口 10 | * Author : Lauzy 11 | * Date : 2017/9/29 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public interface ArtistSongContract { 16 | interface Presenter { 17 | void loadArtistSongs(long id); 18 | } 19 | 20 | interface View extends IBaseView{ 21 | void loadArtistSongsResult(List songEntities); 22 | 23 | void loadFailed(Throwable throwable); 24 | 25 | void emptyView(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/utils/Preconditions.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.utils; 2 | 3 | 4 | import io.reactivex.annotations.Nullable; 5 | 6 | /** 7 | * Desc : 判断条件 8 | * Author : Lauzy 9 | * Date : 2017/7/6 10 | * Blog : http://www.jianshu.com/u/e76853f863a9 11 | * Email : freedompaladin@gmail.com 12 | */ 13 | public class Preconditions { 14 | 15 | public static T checkNotNull(T reference) { 16 | if (reference == null) { 17 | throw new NullPointerException(); 18 | } 19 | return reference; 20 | } 21 | 22 | public static T checkNotNull(T reference, @Nullable Object errorMessage) { 23 | if (reference == null) { 24 | throw new NullPointerException(String.valueOf(errorMessage)); 25 | } 26 | return reference; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/activity_play.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/widght/TickImageView.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.widght; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | import com.bilibili.magicasakura.widgets.TintImageView; 7 | 8 | /** 9 | * Desc : 换肤 ImageView 10 | * Author : Lauzy 11 | * Date : 2017/8/8 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public class TickImageView extends TintImageView { 16 | public TickImageView(Context context) { 17 | super(context); 18 | } 19 | 20 | public TickImageView(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public TickImageView(Context context, AttributeSet attrs, int defStyleAttr) { 25 | super(context, attrs, defStyleAttr); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/widght/TickFrameLayout.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.widght; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | import com.bilibili.magicasakura.widgets.TintFrameLayout; 7 | 8 | /** 9 | * Desc : FrameLayout 10 | * Author : Lauzy 11 | * Date : 2017/8/2 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public class TickFrameLayout extends TintFrameLayout { 16 | public TickFrameLayout(Context context) { 17 | super(context); 18 | } 19 | 20 | public TickFrameLayout(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public TickFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { 25 | super(context, attrs, defStyleAttr); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/widght/TickProgressBar.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.widght; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | import com.bilibili.magicasakura.widgets.TintProgressBar; 7 | 8 | /** 9 | * Desc : ProgressBar 10 | * Author : Lauzy 11 | * Date : 2017/8/18 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public class TickProgressBar extends TintProgressBar { 16 | public TickProgressBar(Context context) { 17 | super(context); 18 | } 19 | 20 | public TickProgressBar(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public TickProgressBar(Context context, AttributeSet attrs, int defStyleAttr) { 25 | super(context, attrs, defStyleAttr); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/widght/TickToolbar.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.widght; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | import com.bilibili.magicasakura.widgets.TintToolbar; 7 | 8 | /** 9 | * Desc : Custom the Toolbar for better use of the theme changing. 10 | * Author : Lauzy 11 | * Date : 2017/7/4 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public class TickToolbar extends TintToolbar { 16 | 17 | public TickToolbar(Context context) { 18 | super(context); 19 | } 20 | 21 | public TickToolbar(Context context, AttributeSet attrs) { 22 | super(context, attrs); 23 | } 24 | 25 | public TickToolbar(Context context, AttributeSet attrs, int defStyleAttr) { 26 | super(context, attrs, defStyleAttr); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/NetSongEntity.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : 播放 Bean,经 mapper 转换,可即时增添修改 5 | * Author : Lauzy 6 | * Date : 2017/9/6 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class NetSongEntity { 11 | 12 | public String artistId; //歌手ID 13 | public String imgUrl; //图片链接 14 | public String lrcLink; //歌词路径 15 | public String info; //额外信息 16 | public String songId; //歌曲ID 17 | public String title; //名称 18 | public String tingUid; //歌手信息ID 19 | public String author; //作者 20 | public String albumId; //专辑ID 21 | public String albumTitle; //专辑标题 22 | public String artistName; //歌手名字 23 | public String size;//大小 24 | public long duration;//时长 25 | public String songLength;//时长(格式化) 26 | public String playPath;//播放路径 27 | } 28 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/widght/TickRelativeLayout.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.widght; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | 6 | import com.bilibili.magicasakura.widgets.TintRelativeLayout; 7 | 8 | /** 9 | * Desc : 换肤 RelativeLayout 10 | * Author : Lauzy 11 | * Date : 2017/8/8 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public class TickRelativeLayout extends TintRelativeLayout { 16 | public TickRelativeLayout(Context context) { 17 | super(context); 18 | } 19 | 20 | public TickRelativeLayout(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public TickRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { 25 | super(context, attrs, defStyleAttr); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/repository/SongRepository.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.repository; 2 | 3 | import com.freedom.lauzy.model.NetSongBean; 4 | 5 | import java.util.List; 6 | 7 | import io.reactivex.Observable; 8 | 9 | /** 10 | * Desc : SongRepository 11 | * Author : Lauzy 12 | * Date : 2017/7/6 13 | * Blog : http://www.jianshu.com/u/e76853f863a9 14 | * Email : freedompaladin@gmail.com 15 | */ 16 | public interface SongRepository { 17 | /** 18 | * 获取网络数据 19 | * @param method method 20 | * @param type 类型 21 | * @param offset 页数 22 | * @param size 页面加载量 23 | * @return ob 24 | */ 25 | Observable> getSongList(String method, int type, int offset, int size); 26 | 27 | /** 28 | * 获取缓存数据 29 | * @param type 类型 30 | * @return ob 31 | */ 32 | Observable> getCacheSongList(int type); 33 | } 34 | -------------------------------------------------------------------------------- /data/src/androidTest/java/com/lauzy/freedom/data/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.lauzy.freedom.data.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/fragment_song.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /libraries/src/androidTest/java/com/lauzy/freedom/librarys/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.lauzy.freedom.librarys.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/interactor/CacheManagerUseCase.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.interactor; 2 | 3 | import com.freedom.lauzy.repository.ICacheDataManager; 4 | 5 | import javax.inject.Inject; 6 | 7 | /** 8 | * Desc : 缓存 9 | * Author : Lauzy 10 | * Date : 2018/4/3 11 | * Blog : http://www.jianshu.com/u/e76853f863a9 12 | * Email : freedompaladin@gmail.com 13 | */ 14 | public class CacheManagerUseCase { 15 | 16 | private ICacheDataManager mCacheDataManager; 17 | 18 | @Inject 19 | public CacheManagerUseCase(ICacheDataManager cacheDataManager) { 20 | mCacheDataManager = cacheDataManager; 21 | } 22 | 23 | public void setArtistAvatar(String artistName, String avatarUrl) { 24 | mCacheDataManager.setArtistAvatar(artistName, avatarUrl); 25 | } 26 | 27 | public String getArtistAvatar(String artistName) { 28 | return mCacheDataManager.getArtistAvatar(artistName); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /presentation/src/androidTest/java/com/freedom/lauzy/ticktockmusic/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.freedom.lauzy.ticktockmusic", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/RecentContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 4 | import com.freedom.lauzy.ticktockmusic.model.SongEntity; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 最近播放接口 10 | * Author : Lauzy 11 | * Date : 2017/9/15 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public interface RecentContract { 16 | interface Presenter { 17 | void loadRecentSongs(); 18 | 19 | void clearRecentSongs(); 20 | 21 | void deleteRecentSong(long songId, int position); 22 | } 23 | 24 | interface View extends IBaseView { 25 | void getRecentSongs(List songEntities); 26 | 27 | void clearAllRecentSongs(); 28 | 29 | void emptyView(); 30 | 31 | void deleteSongSuccess(int position); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/function/DefaultDisposableObserver.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.function; 2 | 3 | import com.freedom.lauzy.ticktockmusic.function.exception.ArtistAvatarException; 4 | 5 | import io.reactivex.annotations.NonNull; 6 | import io.reactivex.observers.DisposableObserver; 7 | 8 | /** 9 | * Desc : 默认,可设置一些Dialog等 10 | * Author : Lauzy 11 | * Date : 2017/8/4 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public class DefaultDisposableObserver extends DisposableObserver { 16 | 17 | @Override 18 | public void onNext(@NonNull T t) { 19 | 20 | } 21 | 22 | @Override 23 | public void onError(@NonNull Throwable e) { 24 | if (!(e instanceof ArtistAvatarException)) { 25 | e.printStackTrace(); 26 | } 27 | } 28 | 29 | @Override 30 | public void onComplete() { 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/FavoriteContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 4 | import com.freedom.lauzy.ticktockmusic.model.SongEntity; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 我的喜欢接口 10 | * Author : Lauzy 11 | * Date : 2017/9/13 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public interface FavoriteContract { 16 | interface Presenter { 17 | void loadFavoriteSongs(); 18 | 19 | void clearFavoriteSongs(); 20 | 21 | void deleteFavoriteSong(long songId, int position); 22 | 23 | } 24 | 25 | interface View extends IBaseView { 26 | void getFavoriteSongs(List songEntities); 27 | 28 | void emptyView(); 29 | 30 | void clearSongs(); 31 | 32 | void deleteFavoriteSong(int position); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/LocalMusicContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 4 | import com.freedom.lauzy.ticktockmusic.model.SongEntity; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : LocalMusic 10 | * Author : Lauzy 11 | * Date : 2017/8/10 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public interface LocalMusicContract { 16 | interface SongPresenter { 17 | void loadLocalSong(); 18 | 19 | void deleteSong(int position, SongEntity songEntity); 20 | } 21 | 22 | interface View extends IBaseView { 23 | 24 | void loadLocalMusic(List localSongBeen); 25 | 26 | void setEmptyView(); 27 | 28 | void loadFailed(Throwable throwable); 29 | 30 | void deleteSongSuccess(int position, SongEntity songEntity); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/NetMusicCategoryContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | 6 | import com.freedom.lauzy.model.CategoryBean; 7 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Desc : CategoryPresenter 13 | * Author : Lauzy 14 | * Date : 2017/8/21 15 | * Blog : http://www.jianshu.com/u/e76853f863a9 16 | * Email : freedompaladin@gmail.com 17 | */ 18 | public interface NetMusicCategoryContract { 19 | interface Presenter{ 20 | void loadData(); 21 | void setCategoryColor(String imgUrl); 22 | } 23 | interface View extends IBaseView{ 24 | Context context(); 25 | void loadCategoryData(List categoryBeen); 26 | void setCategoryBitmap(Bitmap bitmap); 27 | void setCategoryColor(int color); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/SearchContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 4 | import com.freedom.lauzy.ticktockmusic.base.IPresenter; 5 | import com.freedom.lauzy.ticktockmusic.model.SongEntity; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Desc : 搜索 11 | * Author : Lauzy 12 | * Date : 2018/5/22 13 | * Blog : http://www.jianshu.com/u/e76853f863a9 14 | * Email : freedompaladin@gmail.com 15 | */ 16 | public interface SearchContract { 17 | 18 | interface View extends IBaseView { 19 | void onSearchSuccess(List songEntities); 20 | 21 | void onSearchFailed(); 22 | 23 | void setEmptyView(); 24 | } 25 | 26 | interface Presenter extends IPresenter{ 27 | /** 28 | * 搜索 29 | * @param searchContent 内容 30 | */ 31 | void searchSongs(String searchContent); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/layout_empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 24 | 25 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/injection/module/ActivityModule.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.injection.module; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | 6 | import com.freedom.lauzy.ticktockmusic.injection.scope.PerActivity; 7 | 8 | import dagger.Module; 9 | import dagger.Provides; 10 | 11 | /** 12 | * Desc : ActivityModule 13 | * Author : Lauzy 14 | * Date : 2017/7/3 15 | * Blog : http://www.jianshu.com/u/e76853f863a9 16 | * Email : freedompaladin@gmail.com 17 | */ 18 | @Module 19 | public class ActivityModule { 20 | private final Activity mActivity; 21 | 22 | public ActivityModule(Activity activity) { 23 | mActivity = activity; 24 | } 25 | 26 | @Provides 27 | @PerActivity 28 | public Activity provideActivity() { 29 | return mActivity; 30 | } 31 | 32 | @Provides 33 | public Context provideActivityContext() { 34 | return mActivity; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/FolderSongsContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 4 | import com.freedom.lauzy.ticktockmusic.model.SongEntity; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 文件夹音乐 10 | * Author : Lauzy 11 | * Date : 2018/3/15 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public interface FolderSongsContract { 16 | interface Presenter { 17 | void loadFolderSongs(String folderPath); 18 | 19 | void deleteSong(int position, SongEntity songEntity); 20 | } 21 | 22 | interface View extends IBaseView { 23 | 24 | void onLoadFolderSongsSuccess(List songEntities); 25 | 26 | void setEmptyView(); 27 | 28 | void loadFail(Throwable throwable); 29 | 30 | void deleteSongSuccess(int position, SongEntity songEntity); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/model/NetSongBean.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.model; 2 | 3 | /** 4 | * Desc : 歌曲 Bean,经 mapper 转换,可即时增添修改 5 | * Author : Lauzy 6 | * Date : 2017/7/6 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class NetSongBean { 11 | 12 | public String artistId; //歌手ID 13 | public String language; //语言 14 | public String imgUrl; //图片链接 15 | public String publishTime; //编辑时间 16 | public String lrcLink; //歌词路径 17 | public String versions; //分类?(“影视原声等”) 18 | public String info; //额外信息 19 | public String songId; //歌曲ID 20 | public String title; //名称 21 | public String tingUid; //歌手信息ID 22 | public String author; //作者 23 | public String albumId; //专辑ID 24 | public String albumTitle; //专辑标题 25 | public String artistName; //歌手名字 26 | public long duration;//时长 27 | public String songLength;//时长(格式化) 28 | public int rank;//排序 29 | public String type; 30 | } 31 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/widght/fonts/FontsCache.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.widght.fonts; 2 | 3 | import android.content.Context; 4 | import android.graphics.Typeface; 5 | 6 | import java.util.HashMap; 7 | 8 | /** 9 | * Desc : 字体缓存 10 | * Author : Lauzy 11 | * Date : 2017/8/9 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public class FontsCache { 16 | private static HashMap mFontCache = new HashMap<>(); 17 | 18 | public static Typeface getTypeface(String fontName, Context context) { 19 | Typeface typeface = mFontCache.get(fontName); 20 | if (typeface == null) { 21 | try { 22 | typeface = Typeface.createFromAsset(context.getAssets(), fontName); 23 | } catch (Exception e) { 24 | return null; 25 | } 26 | mFontCache.put(fontName, typeface); 27 | } 28 | return typeface; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /presentation/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 B:\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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/injection/module/FragmentModule.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.injection.module; 2 | 3 | import android.app.Activity; 4 | import android.support.v4.app.Fragment; 5 | 6 | import com.freedom.lauzy.ticktockmusic.injection.scope.PerFragment; 7 | 8 | import dagger.Module; 9 | import dagger.Provides; 10 | 11 | /** 12 | * Desc : FragmentModule 13 | * Author : Lauzy 14 | * Date : 2017/7/3 15 | * Blog : http://www.jianshu.com/u/e76853f863a9 16 | * Email : freedompaladin@gmail.com 17 | */ 18 | @Module 19 | public class FragmentModule { 20 | private Fragment mFragment; 21 | 22 | public FragmentModule(Fragment fragment) { 23 | mFragment = fragment; 24 | } 25 | 26 | @Provides 27 | @PerFragment 28 | public Activity provideActivity() { 29 | return mFragment.getActivity(); 30 | } 31 | 32 | @Provides 33 | @PerFragment 34 | public Fragment provideFragment() { 35 | return mFragment; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/local/data/impl/CacheRepoImpl.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.local.data.impl; 2 | 3 | import android.content.Context; 4 | 5 | import com.lauzy.freedom.data.local.data.CacheRepo; 6 | 7 | /** 8 | * Desc : 缓存 9 | * Author : Lauzy 10 | * Date : 2018/4/3 11 | * Blog : http://www.jianshu.com/u/e76853f863a9 12 | * Email : freedompaladin@gmail.com 13 | */ 14 | public class CacheRepoImpl extends SharedPreferenceDataRepo implements CacheRepo { 15 | 16 | private static final String FILE_NAME = "ticktock_cache_sp"; 17 | private static final String ARTIST_SHARED_KEY = "key_artist_avatar"; 18 | 19 | public CacheRepoImpl(Context context) { 20 | super(context, FILE_NAME, Context.MODE_PRIVATE); 21 | } 22 | 23 | @Override 24 | public void setArtistAvatar(String artistName, String avatarUrl) { 25 | put(artistName, avatarUrl); 26 | } 27 | 28 | @Override 29 | public String getArtistAvatar(String artistName) { 30 | return getString(artistName); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/main/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/local/data/DataRepo.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.local.data; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * Desc : 数据仓库接口 7 | * Author : Lauzy 8 | * Date : 2017/12/14 9 | * Blog : http://www.jianshu.com/u/e76853f863a9 10 | * Email : freedompaladin@gmail.com 11 | */ 12 | public interface DataRepo { 13 | 14 | void put(String key, String value); 15 | 16 | void put(String key, int value); 17 | 18 | void put(String key, boolean value); 19 | 20 | void put(String key, long value); 21 | 22 | String getString(String key); 23 | 24 | String getString(String key, String defaultValue); 25 | 26 | int getInt(String key); 27 | 28 | int getInt(String key, int defaultValue); 29 | 30 | long getLong(String key); 31 | 32 | boolean getBoolean(String key); 33 | 34 | boolean getBoolean(String key, boolean defaultValue); 35 | 36 | void remove(String key); 37 | 38 | Map getAll(); 39 | 40 | boolean contains(String key); 41 | 42 | void clear(); 43 | } 44 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/repository/MusicFolderRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.repository; 2 | 3 | import android.content.Context; 4 | 5 | import com.freedom.lauzy.model.Folder; 6 | import com.freedom.lauzy.repository.MusicFolderRepository; 7 | import com.lauzy.freedom.data.local.loader.LocalFolderLoader; 8 | 9 | import java.util.List; 10 | 11 | import javax.inject.Inject; 12 | 13 | import io.reactivex.Observable; 14 | 15 | /** 16 | * Desc : 音乐文件夹数据实现类 17 | * Author : Lauzy 18 | * Date : 2018/3/15 19 | * Blog : http://www.jianshu.com/u/e76853f863a9 20 | * Email : freedompaladin@gmail.com 21 | */ 22 | public class MusicFolderRepositoryImpl implements MusicFolderRepository { 23 | 24 | private Context mContext; 25 | 26 | @Inject 27 | public MusicFolderRepositoryImpl(Context context) { 28 | mContext = context; 29 | } 30 | 31 | @Override 32 | public Observable> getMusicFolders() { 33 | return Observable.just(LocalFolderLoader.getMusicFolders(mContext)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/presenter/ArtistDetailPresenter.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.presenter; 2 | 3 | import com.freedom.lauzy.interactor.CacheManagerUseCase; 4 | import com.freedom.lauzy.ticktockmusic.base.BasePresenter; 5 | import com.freedom.lauzy.ticktockmusic.contract.ArtistDetailContract; 6 | 7 | import javax.inject.Inject; 8 | 9 | /** 10 | * Desc : 歌手详情 11 | * Author : Lauzy 12 | * Date : 2018/4/3 13 | * Blog : http://www.jianshu.com/u/e76853f863a9 14 | * Email : freedompaladin@gmail.com 15 | */ 16 | public class ArtistDetailPresenter extends BasePresenter implements ArtistDetailContract.Presenter { 17 | 18 | CacheManagerUseCase mCacheManagerUseCase; 19 | 20 | @Inject 21 | public ArtistDetailPresenter(CacheManagerUseCase cacheManagerUseCase) { 22 | mCacheManagerUseCase = cacheManagerUseCase; 23 | } 24 | 25 | @Override 26 | public String getArtistAvatarUrl(String artistName) { 27 | return mCacheManagerUseCase.getArtistAvatar(artistName); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/repository/SearchSongRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.repository; 2 | 3 | import android.content.Context; 4 | 5 | import com.freedom.lauzy.model.LocalSongBean; 6 | import com.freedom.lauzy.repository.SearchSongRepository; 7 | import com.lauzy.freedom.data.local.loader.LocalSongLoader; 8 | 9 | import java.util.List; 10 | 11 | import javax.inject.Inject; 12 | 13 | import io.reactivex.Observable; 14 | 15 | /** 16 | * Desc : 搜索 17 | * Author : Lauzy 18 | * Date : 2018/5/22 19 | * Blog : http://www.jianshu.com/u/e76853f863a9 20 | * Email : freedompaladin@gmail.com 21 | */ 22 | public class SearchSongRepositoryImpl implements SearchSongRepository { 23 | 24 | private Context mContext; 25 | 26 | @Inject 27 | public SearchSongRepositoryImpl(Context context) { 28 | mContext = context; 29 | } 30 | 31 | @Override 32 | public Observable> searchSong(String songName) { 33 | return Observable.just(LocalSongLoader.getSearchSongList(mContext, songName)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/repository/RecentRepository.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.repository; 2 | 3 | import com.freedom.lauzy.model.RecentSongBean; 4 | 5 | import java.util.List; 6 | 7 | import io.reactivex.Observable; 8 | 9 | /** 10 | * Desc : 最近播放数据仓库接口 11 | * Author : Lauzy 12 | * Date : 2017/9/12 13 | * Blog : http://www.jianshu.com/u/e76853f863a9 14 | * Email : freedompaladin@gmail.com 15 | */ 16 | public interface RecentRepository { 17 | 18 | /** 19 | * 添加至最近播放 20 | * @param songBean 待添加的数据 21 | * @return Observable 22 | */ 23 | Observable addRecentSong(RecentSongBean songBean); 24 | 25 | /** 26 | * 获取最近播放的数据 27 | * @return Observable 28 | */ 29 | Observable> getRecentSongs(); 30 | 31 | /** 32 | * 清空最近播放的数据 33 | * @return Observable 34 | */ 35 | Observable clearRecentSongs(); 36 | 37 | /** 38 | * 删除最近播放的数据 39 | * @param songId 需要删除的songId 40 | * @return Observable 41 | */ 42 | Observable deleteRecentSong(long songId); 43 | } 44 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/repository/FolderSongsRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.repository; 2 | 3 | import android.content.Context; 4 | 5 | import com.freedom.lauzy.model.LocalSongBean; 6 | import com.freedom.lauzy.repository.FolderSongsRepository; 7 | import com.lauzy.freedom.data.local.loader.LocalSongLoader; 8 | 9 | import java.util.List; 10 | 11 | import javax.inject.Inject; 12 | 13 | import io.reactivex.Observable; 14 | 15 | /** 16 | * Desc : 文件夹音乐 17 | * Author : Lauzy 18 | * Date : 2018/3/15 19 | * Blog : http://www.jianshu.com/u/e76853f863a9 20 | * Email : freedompaladin@gmail.com 21 | */ 22 | public class FolderSongsRepositoryImpl implements FolderSongsRepository { 23 | 24 | private Context mContext; 25 | 26 | @Inject 27 | public FolderSongsRepositoryImpl(Context context) { 28 | mContext = context; 29 | } 30 | 31 | @Override 32 | public Observable> getFolderSongs(String folderPath) { 33 | return Observable.just(LocalSongLoader.getLocalFolderSongList(mContext, folderPath)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/LocalArtistContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import android.content.Context; 4 | import android.widget.ImageView; 5 | 6 | import com.freedom.lauzy.model.LocalArtistBean; 7 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Desc : 本地歌手接口 13 | * Author : Lauzy 14 | * Date : 2017/9/28 15 | * Blog : http://www.jianshu.com/u/e76853f863a9 16 | * Email : freedompaladin@gmail.com 17 | */ 18 | public interface LocalArtistContract { 19 | 20 | interface Presenter { 21 | void loadLocalArtists(); 22 | 23 | void loadArtistAvatar(String artistName, ImageView imageView); 24 | } 25 | 26 | interface View extends IBaseView { 27 | 28 | Context getContext(); 29 | 30 | void loadArtistResult(List artistBeen); 31 | 32 | void loadAvatarResult(String imgUrl, ImageView imageView); 33 | 34 | void emptyView(); 35 | 36 | void loadFailed(Throwable throwable); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/PlayQueueContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 4 | import com.freedom.lauzy.ticktockmusic.model.SongEntity; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 播放队列接口 10 | * Author : Lauzy 11 | * Date : 2017/9/8 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public interface PlayQueueContract { 16 | interface Presenter { 17 | void loadQueueData(String[] ids); 18 | 19 | void deleteQueueData(String[] ids, int position, SongEntity entity); 20 | 21 | void deleteAllQueueData(String[] ids); 22 | 23 | void setRepeatMode(int mode); 24 | 25 | int getRepeatMode(int defaultMode); 26 | } 27 | 28 | interface View extends IBaseView { 29 | void loadQueueData(List songEntities); 30 | 31 | void deleteItem(int position); 32 | 33 | void emptyView(); 34 | 35 | void deleteAllQueueData(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/repository/CacheDataManagerImpl.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.repository; 2 | 3 | import android.content.Context; 4 | 5 | import com.freedom.lauzy.repository.ICacheDataManager; 6 | import com.lauzy.freedom.data.local.data.DataManager; 7 | 8 | import javax.inject.Inject; 9 | 10 | /** 11 | * Desc : 缓存 12 | * Author : Lauzy 13 | * Date : 2018/4/3 14 | * Blog : http://www.jianshu.com/u/e76853f863a9 15 | * Email : freedompaladin@gmail.com 16 | */ 17 | public class CacheDataManagerImpl implements ICacheDataManager { 18 | 19 | private Context mContext; 20 | 21 | @Inject 22 | public CacheDataManagerImpl(Context context) { 23 | mContext = context; 24 | } 25 | 26 | @Override 27 | public void setArtistAvatar(String artistName, String avatarUrl) { 28 | DataManager.getInstance(mContext).getCacheRepo().setArtistAvatar(artistName, avatarUrl); 29 | } 30 | 31 | @Override 32 | public String getArtistAvatar(String artistName) { 33 | return DataManager.getInstance(mContext).getCacheRepo().getArtistAvatar(artistName); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /libraries/src/main/cpp/load.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014-2016 Qiujuer 3 | * WebSite http://www.qiujuer.net 4 | * Author qiujuer 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | #include 19 | #include 20 | 21 | JNIEXPORT jint 22 | JNI_OnLoad(JavaVM 23 | *vm, 24 | void *reserved) { 25 | JNIEnv *env = NULL; 26 | jint result = -1; 27 | 28 | if ((*vm)->GetEnv(vm, (void **) &env, JNI_VERSION_1_4) != JNI_OK) 29 | return -1; 30 | 31 | result = JNI_VERSION_1_4; 32 | return result; 33 | } -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/utils/anim/FragmentTransition.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.utils.anim; 2 | 3 | import android.content.Context; 4 | import android.transition.ChangeBounds; 5 | import android.transition.ChangeImageTransform; 6 | import android.transition.ChangeTransform; 7 | import android.transition.TransitionSet; 8 | import android.util.AttributeSet; 9 | 10 | /** 11 | * Desc : FragmentTransition 12 | * Author : Lauzy 13 | * Date : 2017/8/9 14 | * Blog : http://www.jianshu.com/u/e76853f863a9 15 | * Email : freedompaladin@gmail.com 16 | */ 17 | public class FragmentTransition extends TransitionSet { 18 | public FragmentTransition() { 19 | init(); 20 | } 21 | 22 | public FragmentTransition(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | init(); 25 | } 26 | 27 | private void init() { 28 | setOrdering(ORDERING_TOGETHER); 29 | addTransition(new ChangeBounds()). 30 | addTransition(new ChangeTransform()). 31 | addTransition(new ChangeImageTransform()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/NetMusicContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import com.freedom.lauzy.model.NetSongBean; 4 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : Contract Interface 10 | * Author : Lauzy 11 | * Date : 2017/8/4 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public interface NetMusicContract { 16 | interface Presenter { 17 | 18 | void loadCacheMusicList(); 19 | 20 | void loadNetMusicList(); 21 | 22 | void loadMoreNetMusicList(); 23 | } 24 | 25 | interface View extends IBaseView { 26 | 27 | void loadCacheData(List songListBeen); 28 | 29 | void loadSuccess(List songListBeen); 30 | 31 | void setEmptyView(); 32 | 33 | void loadFail(Throwable throwable); 34 | 35 | void loadMoreSuccess(List songListBeen); 36 | 37 | void loadMoreEnd(); 38 | 39 | void loadMoreFail(Throwable throwable); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/interactor/ConfigManagerUseCase.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.interactor; 2 | 3 | import com.freedom.lauzy.repository.IConfigDataManager; 4 | 5 | import javax.inject.Inject; 6 | 7 | /** 8 | * Desc : 配置信息 9 | * Author : Lauzy 10 | * Date : 2018/4/3 11 | * Blog : http://www.jianshu.com/u/e76853f863a9 12 | * Email : freedompaladin@gmail.com 13 | */ 14 | public class ConfigManagerUseCase { 15 | 16 | private IConfigDataManager mConfigDataManager; 17 | 18 | @Inject 19 | public ConfigManagerUseCase(IConfigDataManager configDataManager) { 20 | mConfigDataManager = configDataManager; 21 | } 22 | 23 | 24 | public void setRepeatMode(int mode) { 25 | mConfigDataManager.setRepeatMode(mode); 26 | } 27 | 28 | public int getRepeatMode(int defaultMode) { 29 | return mConfigDataManager.getRepeatMode(defaultMode); 30 | } 31 | 32 | public void enablePlayByNetwork(boolean isEnable) { 33 | mConfigDataManager.enablePlayByNetwork(isEnable); 34 | } 35 | 36 | public boolean isEnablePlayByNetwork() { 37 | return mConfigDataManager.isEnablePlayByNetwork(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/receiver/BecomingNoisyReceiver.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.receiver; 2 | 3 | import android.content.BroadcastReceiver; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.media.AudioManager; 7 | 8 | import com.freedom.lauzy.ticktockmusic.service.MusicService; 9 | 10 | /** 11 | * Desc : 拔出耳机暂停 12 | * Author : Lauzy 13 | * Date : 2018/4/4 14 | * Blog : http://www.jianshu.com/u/e76853f863a9 15 | * Email : freedompaladin@gmail.com 16 | */ 17 | public class BecomingNoisyReceiver extends BroadcastReceiver { 18 | @Override 19 | public void onReceive(Context context, Intent intent) { 20 | String action = intent.getAction(); 21 | if (action == null) { 22 | return; 23 | } 24 | switch (action) { 25 | case AudioManager.ACTION_AUDIO_BECOMING_NOISY: 26 | Intent musicIntent = new Intent(context, MusicService.class); 27 | musicIntent.setAction(MusicService.ACTION_PAUSE); 28 | context.startService(musicIntent); 29 | break; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/presenter/SettingPresenter.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.presenter; 2 | 3 | import com.freedom.lauzy.interactor.ConfigManagerUseCase; 4 | import com.freedom.lauzy.ticktockmusic.base.BasePresenter; 5 | import com.freedom.lauzy.ticktockmusic.contract.SettingContract; 6 | 7 | import javax.inject.Inject; 8 | 9 | /** 10 | * Desc : 设置 11 | * Author : Lauzy 12 | * Date : 2018/4/3 13 | * Blog : http://www.jianshu.com/u/e76853f863a9 14 | * Email : freedompaladin@gmail.com 15 | */ 16 | public class SettingPresenter extends BasePresenter implements SettingContract.Presenter { 17 | 18 | private ConfigManagerUseCase mConfigManagerUseCase; 19 | 20 | @Inject 21 | SettingPresenter(ConfigManagerUseCase configManagerUseCase) { 22 | mConfigManagerUseCase = configManagerUseCase; 23 | } 24 | 25 | @Override 26 | public boolean isEnablePlayByNetwork() { 27 | return mConfigManagerUseCase.isEnablePlayByNetwork(); 28 | } 29 | 30 | @Override 31 | public void enablePlayByNetwork(boolean isEnable) { 32 | mConfigManagerUseCase.enablePlayByNetwork(isEnable); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/net/interceptor/UserAgentInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.net.interceptor; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | import java.io.IOException; 6 | 7 | import okhttp3.Interceptor; 8 | import okhttp3.Request; 9 | import okhttp3.Response; 10 | 11 | /** 12 | * Desc : 设置为 Chrome 浏览器的代理 13 | * Author : Lauzy 14 | * Date : 2017/8/1 15 | * Blog : http://www.jianshu.com/u/e76853f863a9 16 | * Email : freedompaladin@gmail.com 17 | */ 18 | public class UserAgentInterceptor implements Interceptor { 19 | private static final String USER_AGENT = "User-Agent"; 20 | 21 | @Override 22 | public Response intercept(@NonNull Chain chain) throws IOException { 23 | Request original = chain.request(); 24 | Request request = original 25 | .newBuilder() 26 | .addHeader(USER_AGENT, getUserAgent()) 27 | .build(); 28 | return chain.proceed(request); 29 | } 30 | 31 | private String getUserAgent() { 32 | return "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, " + 33 | "like Gecko) Chrome/59.0.3071.115 Safari/537.36"; 34 | } 35 | } -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/interactor/SearchSongUseCase.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.interactor; 2 | 3 | import com.freedom.lauzy.executor.PostExecutionThread; 4 | import com.freedom.lauzy.executor.ThreadExecutor; 5 | import com.freedom.lauzy.model.LocalSongBean; 6 | import com.freedom.lauzy.repository.SearchSongRepository; 7 | 8 | import java.util.List; 9 | 10 | import javax.inject.Inject; 11 | 12 | import io.reactivex.Observable; 13 | 14 | /** 15 | * Desc : 搜索 16 | * Author : Lauzy 17 | * Date : 2018/5/22 18 | * Blog : http://www.jianshu.com/u/e76853f863a9 19 | * Email : freedompaladin@gmail.com 20 | */ 21 | public class SearchSongUseCase extends UseCase, String> { 22 | 23 | private SearchSongRepository mSearchSongRepository; 24 | 25 | @Inject 26 | SearchSongUseCase(ThreadExecutor threadExecutor, PostExecutionThread postExecutionThread, 27 | SearchSongRepository searchSongRepository) { 28 | super(threadExecutor, postExecutionThread); 29 | mSearchSongRepository = searchSongRepository; 30 | } 31 | 32 | @Override 33 | Observable> buildUseCaseObservable(String s) { 34 | return mSearchSongRepository.searchSong(s); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/interactor/MusicFolderUseCase.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.interactor; 2 | 3 | import com.freedom.lauzy.executor.PostExecutionThread; 4 | import com.freedom.lauzy.executor.ThreadExecutor; 5 | import com.freedom.lauzy.model.Folder; 6 | import com.freedom.lauzy.repository.MusicFolderRepository; 7 | 8 | import java.util.List; 9 | 10 | import javax.inject.Inject; 11 | 12 | import io.reactivex.Observable; 13 | 14 | /** 15 | * Desc : 音乐文件夹 16 | * Author : Lauzy 17 | * Date : 2018/3/15 18 | * Blog : http://www.jianshu.com/u/e76853f863a9 19 | * Email : freedompaladin@gmail.com 20 | */ 21 | public class MusicFolderUseCase extends UseCase, Void> { 22 | 23 | private final MusicFolderRepository mMusicFolderRepository; 24 | 25 | @Inject 26 | MusicFolderUseCase(ThreadExecutor threadExecutor, PostExecutionThread postExecutionThread, 27 | MusicFolderRepository musicFolderRepository) { 28 | super(threadExecutor, postExecutionThread); 29 | mMusicFolderRepository = musicFolderRepository; 30 | } 31 | 32 | @Override 33 | Observable> buildUseCaseObservable(Void aVoid) { 34 | return mMusicFolderRepository.getMusicFolders(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 17 | 26 | 27 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/interactor/GetLocalAlbumUseCase.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.interactor; 2 | 3 | import com.freedom.lauzy.executor.PostExecutionThread; 4 | import com.freedom.lauzy.executor.ThreadExecutor; 5 | import com.freedom.lauzy.model.LocalAlbumBean; 6 | import com.freedom.lauzy.repository.LocalSongRepository; 7 | 8 | import java.util.List; 9 | 10 | import javax.inject.Inject; 11 | 12 | import io.reactivex.Observable; 13 | 14 | /** 15 | * Desc : 本地专辑 16 | * Author : Lauzy 17 | * Date : 2017/8/9 18 | * Blog : http://www.jianshu.com/u/e76853f863a9 19 | * Email : freedompaladin@gmail.com 20 | */ 21 | public class GetLocalAlbumUseCase extends UseCase, Long> { 22 | 23 | private final LocalSongRepository mLocalSongRepository; 24 | 25 | @Inject 26 | GetLocalAlbumUseCase(LocalSongRepository localSongRepository, ThreadExecutor threadExecutor, 27 | PostExecutionThread postExecutionThread) { 28 | super(threadExecutor, postExecutionThread); 29 | mLocalSongRepository = localSongRepository; 30 | } 31 | 32 | @Override 33 | Observable> buildUseCaseObservable(Long id) { 34 | return mLocalSongRepository.getLocalAlbumList(id); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/injection/component/ActivityComponent.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.injection.component; 2 | 3 | import android.app.Activity; 4 | 5 | import com.freedom.lauzy.ticktockmusic.injection.module.ActivityModule; 6 | import com.freedom.lauzy.ticktockmusic.injection.scope.PerActivity; 7 | import com.freedom.lauzy.ticktockmusic.ui.activity.MainActivity; 8 | import com.freedom.lauzy.ticktockmusic.ui.activity.PlayActivity; 9 | import com.freedom.lauzy.ticktockmusic.ui.activity.SearchActivity; 10 | import com.freedom.lauzy.ticktockmusic.ui.activity.SettingActivity; 11 | 12 | import dagger.Component; 13 | 14 | /** 15 | * Desc : ActivityComponent 16 | * Author : Lauzy 17 | * Date : 2017/7/3 18 | * Blog : http://www.jianshu.com/u/e76853f863a9 19 | * Email : freedompaladin@gmail.com 20 | */ 21 | 22 | @PerActivity 23 | @Component(dependencies = ApplicationComponent.class, modules = ActivityModule.class) 24 | public interface ActivityComponent { 25 | Activity getActivity(); 26 | 27 | void inject(MainActivity mainActivity); 28 | 29 | void inject(PlayActivity playActivity); 30 | 31 | void inject(SettingActivity settingActivity); 32 | 33 | void inject(SearchActivity searchActivity); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/repository/FavoriteRepository.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.repository; 2 | 3 | import com.freedom.lauzy.model.FavoriteSongBean; 4 | 5 | import java.util.List; 6 | 7 | import io.reactivex.Observable; 8 | 9 | /** 10 | * Desc : 我的喜欢数据接口 11 | * Author : Lauzy 12 | * Date : 2017/9/12 13 | * Blog : http://www.jianshu.com/u/e76853f863a9 14 | * Email : freedompaladin@gmail.com 15 | */ 16 | public interface FavoriteRepository { 17 | 18 | /** 19 | * 添加歌曲至我的喜欢队列 20 | * @param songBean songBean 21 | * @return Observable 22 | */ 23 | Observable addFavoriteSong(FavoriteSongBean songBean); 24 | 25 | /** 26 | * 获取我的喜欢数据 27 | * @return Observable 28 | */ 29 | Observable> getFavoriteSongs(); 30 | 31 | /** 32 | * 清空我的喜欢数据 33 | * @return Observable 34 | */ 35 | Observable clearFavoriteSongs(); 36 | 37 | /** 38 | * 判断是否为我喜欢的歌曲 39 | * @param songId songId 40 | * @return Observable 41 | */ 42 | Observable isFavoriteSong(long songId); 43 | 44 | /** 45 | * 删除我喜欢的歌曲 46 | * @param songId songId 47 | * @return Observable 48 | */ 49 | Observable deleteFavoriteSong(long songId); 50 | } 51 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/ui/adapter/ArtistDetailPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.ui.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Desc : 歌手详情 PagerAdapter 11 | * Author : Lauzy 12 | * Date : 2017/9/29 13 | * Blog : http://www.jianshu.com/u/e76853f863a9 14 | * Email : freedompaladin@gmail.com 15 | */ 16 | public class ArtistDetailPagerAdapter extends FragmentPagerAdapter { 17 | 18 | private String[] mTitles; 19 | private List mFragments; 20 | 21 | public ArtistDetailPagerAdapter(FragmentManager fm, List fragments, String[] titles) { 22 | super(fm); 23 | mTitles = titles; 24 | mFragments = fragments; 25 | } 26 | 27 | @Override 28 | public Fragment getItem(int position) { 29 | return mFragments.get(position); 30 | } 31 | 32 | @Override 33 | public int getCount() { 34 | return mFragments != null ? mFragments.size() : 0; 35 | } 36 | 37 | @Override 38 | public CharSequence getPageTitle(int position) { 39 | return mTitles[position]; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/interactor/FolderSongsUseCase.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.interactor; 2 | 3 | import com.freedom.lauzy.executor.PostExecutionThread; 4 | import com.freedom.lauzy.executor.ThreadExecutor; 5 | import com.freedom.lauzy.model.LocalSongBean; 6 | import com.freedom.lauzy.repository.FolderSongsRepository; 7 | 8 | import java.util.List; 9 | 10 | import javax.inject.Inject; 11 | 12 | import io.reactivex.Observable; 13 | 14 | /** 15 | * Desc : 音乐文件夹 16 | * Author : Lauzy 17 | * Date : 2018/3/15 18 | * Blog : http://www.jianshu.com/u/e76853f863a9 19 | * Email : freedompaladin@gmail.com 20 | */ 21 | public class FolderSongsUseCase extends UseCase, String> { 22 | 23 | private final FolderSongsRepository mFolderSongsRepository; 24 | 25 | @Inject 26 | FolderSongsUseCase(ThreadExecutor threadExecutor, PostExecutionThread postExecutionThread, 27 | FolderSongsRepository folderSongsRepository) { 28 | super(threadExecutor, postExecutionThread); 29 | mFolderSongsRepository = folderSongsRepository; 30 | } 31 | 32 | @Override 33 | Observable> buildUseCaseObservable(String folderPath) { 34 | return mFolderSongsRepository.getFolderSongs(folderPath); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/ui/adapter/LocalMusicPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.ui.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Desc : LocalMusicAdapter 11 | * Author : Lauzy 12 | * Date : 2017/8/3 13 | * Blog : http://www.jianshu.com/u/e76853f863a9 14 | * Email : freedompaladin@gmail.com 15 | */ 16 | public class LocalMusicPagerAdapter extends FragmentPagerAdapter { 17 | 18 | private List mFragments; 19 | private String[] mTitles; 20 | 21 | public LocalMusicPagerAdapter(FragmentManager fm, List fragments) { 22 | super(fm); 23 | mFragments = fragments; 24 | } 25 | 26 | @Override 27 | public Fragment getItem(int position) { 28 | return mFragments.get(position); 29 | } 30 | 31 | @Override 32 | public int getCount() { 33 | return mFragments != null ? mFragments.size() : 0; 34 | } 35 | 36 | public void setTitles(String[] titles) { 37 | mTitles = titles; 38 | } 39 | 40 | @Override 41 | public CharSequence getPageTitle(int position) { 42 | return mTitles[position]; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/entity/mapper/LrcMapper.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.entity.mapper; 2 | 3 | import com.freedom.lauzy.model.LrcBean; 4 | import com.lauzy.freedom.data.entity.OnLineLrcEntity; 5 | 6 | import java.util.ArrayList; 7 | import java.util.Collections; 8 | import java.util.List; 9 | 10 | /** 11 | * Desc : 歌词转换 12 | * Author : Lauzy 13 | * Date : 2018/3/26 14 | * Blog : http://www.jianshu.com/u/e76853f863a9 15 | * Email : freedompaladin@gmail.com 16 | */ 17 | public class LrcMapper { 18 | 19 | private static LrcBean transform(OnLineLrcEntity.ResultBean resultBean) { 20 | if (resultBean == null) { 21 | return null; 22 | } 23 | LrcBean lrcBean = new LrcBean(); 24 | lrcBean.lrc = resultBean.lrc; 25 | lrcBean.song = resultBean.song; 26 | return lrcBean; 27 | } 28 | 29 | public static List transform(List resultBeans) { 30 | if (resultBeans == null || resultBeans.isEmpty()) { 31 | return Collections.emptyList(); 32 | } 33 | List lrcBeans = new ArrayList<>(); 34 | for (OnLineLrcEntity.ResultBean resultBean : resultBeans) { 35 | lrcBeans.add(transform(resultBean)); 36 | } 37 | return lrcBeans; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/local/data/DataManager.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.local.data; 2 | 3 | import android.content.Context; 4 | 5 | import com.lauzy.freedom.data.local.data.impl.CacheRepoImpl; 6 | import com.lauzy.freedom.data.local.data.impl.ConfigRepoImpl; 7 | 8 | /** 9 | * Desc : 数据管理 10 | * Author : Lauzy 11 | * Date : 2018/4/2 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public class DataManager { 16 | 17 | private final CacheRepo mCacheRepo; 18 | private final ConfigRepo mConfigRepo; 19 | private volatile static DataManager INSTANCE; 20 | 21 | private DataManager(Context context) { 22 | mCacheRepo = new CacheRepoImpl(context); 23 | mConfigRepo = new ConfigRepoImpl(context); 24 | } 25 | 26 | public static DataManager getInstance(Context context) { 27 | if (INSTANCE == null) { 28 | synchronized (DataManager.class) { 29 | if (INSTANCE == null) { 30 | INSTANCE = new DataManager(context); 31 | } 32 | } 33 | } 34 | return INSTANCE; 35 | } 36 | 37 | public CacheRepo getCacheRepo() { 38 | return mCacheRepo; 39 | } 40 | 41 | public ConfigRepo getConfigRepo() { 42 | return mConfigRepo; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/base/BaseRxPresenter.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.base; 2 | 3 | import io.reactivex.disposables.CompositeDisposable; 4 | import io.reactivex.disposables.Disposable; 5 | 6 | /** 7 | * Desc : BasePresenter 8 | * Author : Lauzy 9 | * Date : 2017/7/3 10 | * Blog : http://www.jianshu.com/u/e76853f863a9 11 | * Email : freedompaladin@gmail.com 12 | */ 13 | public class BaseRxPresenter implements IPresenter { 14 | 15 | private T mView; 16 | private CompositeDisposable mCompositeDisposable; 17 | 18 | public BaseRxPresenter() { 19 | } 20 | 21 | protected void addDisposable(Disposable disposable) { 22 | if (mCompositeDisposable == null) { 23 | mCompositeDisposable = new CompositeDisposable(); 24 | } 25 | mCompositeDisposable.add(disposable); 26 | } 27 | 28 | protected void dispose() { 29 | if (mCompositeDisposable != null) { 30 | mCompositeDisposable.dispose(); 31 | } 32 | } 33 | 34 | public T getView() { 35 | return mView; 36 | } 37 | 38 | @Override 39 | public void attachView(T view) { 40 | mView = view; 41 | } 42 | 43 | @Override 44 | public void detachView() { 45 | mView = null; 46 | dispose(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/repository/QueueRepository.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.repository; 2 | 3 | import com.freedom.lauzy.model.LocalSongBean; 4 | import com.freedom.lauzy.model.QueueSongBean; 5 | 6 | import java.util.List; 7 | 8 | import io.reactivex.Observable; 9 | 10 | /** 11 | * Desc : 播放队列数据接口。 12 | * 原设计为分别添加本地及网络数据,后通过定义Type来区分音乐的数据来源, 13 | * 然后在播放时具体调用本地或音乐的数据,数据统一,简化操作。 14 | * Author : Lauzy 15 | * Date : 2017/9/8 16 | * Blog : http://www.jianshu.com/u/e76853f863a9 17 | * Email : freedompaladin@gmail.com 18 | */ 19 | public interface QueueRepository { 20 | 21 | /** 22 | * 获取队列数据方法 23 | * @param songIds songIds 24 | * @return Observable 25 | */ 26 | Observable> getQueueData(String[] songIds); 27 | 28 | /** 29 | * 添加至队列数据Observable 30 | * @param songIds songIds 31 | * @param queueSongBeen 队列数据集合 {@link LocalSongBean} 32 | * @return Observable 33 | */ 34 | Observable> addQueueData(String[] songIds, List queueSongBeen); 35 | 36 | // Observable> addNetQueueData(String[] songIds, List netSongBeen); 37 | 38 | /** 39 | * 删除队列数据Observable 40 | * @param songIds songIds 41 | * @return Observable 42 | */ 43 | Observable deleteQueueData(String[] songIds); 44 | } 45 | -------------------------------------------------------------------------------- /presentation/src/main/res/drawable/ic_menu_point.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 15 | 17 | 20 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/local/data/impl/ConfigRepoImpl.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.local.data.impl; 2 | 3 | import android.content.Context; 4 | 5 | import com.lauzy.freedom.data.local.data.ConfigRepo; 6 | 7 | /** 8 | * Desc : 配置 9 | * Author : Lauzy 10 | * Date : 2018/4/3 11 | * Blog : http://www.jianshu.com/u/e76853f863a9 12 | * Email : freedompaladin@gmail.com 13 | */ 14 | public class ConfigRepoImpl extends SharedPreferenceDataRepo implements ConfigRepo { 15 | 16 | private static final String FILE_NAME = "ticktock_config_sp"; 17 | private static final String REPEAT_MODE = "repeat_mode"; 18 | private static final String ENABLE_NETWORK_PLAY_KEY = "enable_play_key"; 19 | 20 | public ConfigRepoImpl(Context context) { 21 | super(context, FILE_NAME, Context.MODE_PRIVATE); 22 | } 23 | 24 | @Override 25 | public void setRepeatMode(int mode) { 26 | put(REPEAT_MODE, mode); 27 | } 28 | 29 | @Override 30 | public int getRepeatMode(int defaultMode) { 31 | return getInt(REPEAT_MODE, defaultMode); 32 | } 33 | 34 | @Override 35 | public void enablePlayByNetwork(boolean isEnable) { 36 | put(ENABLE_NETWORK_PLAY_KEY, isEnable); 37 | } 38 | 39 | @Override 40 | public boolean isEnablePlayByNetwork() { 41 | return getBoolean(ENABLE_NETWORK_PLAY_KEY); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/interactor/GetLocalSongUseCase.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.interactor; 2 | 3 | import com.freedom.lauzy.executor.PostExecutionThread; 4 | import com.freedom.lauzy.executor.ThreadExecutor; 5 | import com.freedom.lauzy.model.LocalSongBean; 6 | import com.freedom.lauzy.repository.LocalSongRepository; 7 | 8 | import java.util.List; 9 | 10 | import javax.inject.Inject; 11 | 12 | import io.reactivex.Observable; 13 | 14 | /** 15 | * Desc : 本地音乐数据列表 16 | * Author : Lauzy 17 | * Date : 2017/8/9 18 | * Blog : http://www.jianshu.com/u/e76853f863a9 19 | * Email : freedompaladin@gmail.com 20 | */ 21 | public class GetLocalSongUseCase extends UseCase, Long> { 22 | 23 | private final LocalSongRepository mLocalSongRepository; 24 | 25 | @Inject 26 | GetLocalSongUseCase(LocalSongRepository localSongRepository, ThreadExecutor threadExecutor, 27 | PostExecutionThread postExecutionThread) { 28 | super(threadExecutor, postExecutionThread); 29 | mLocalSongRepository = localSongRepository; 30 | } 31 | 32 | @Override 33 | Observable> buildUseCaseObservable(Long id) { 34 | return mLocalSongRepository.getLocalSongList(id); 35 | } 36 | 37 | public Observable deleteSong(long id) { 38 | return mLocalSongRepository.deleteSong(id); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/widght/TickBottomSheetDialog.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.widght; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.support.annotation.NonNull; 6 | import android.support.annotation.StyleRes; 7 | import android.support.design.widget.BottomSheetDialog; 8 | import android.view.ViewGroup; 9 | 10 | import com.lauzy.freedom.librarys.common.ScreenUtils; 11 | 12 | /** 13 | * Desc : 自定义修复状态栏变黑的问题 14 | * Author : Lauzy 15 | * Date : 2017/10/11 16 | * Blog : http://www.jianshu.com/u/e76853f863a9 17 | * Email : freedompaladin@gmail.com 18 | */ 19 | public class TickBottomSheetDialog extends BottomSheetDialog { 20 | 21 | private Context mContext; 22 | 23 | public TickBottomSheetDialog(@NonNull Context context) { 24 | this(context, 0); 25 | } 26 | 27 | public TickBottomSheetDialog(@NonNull Context context, @StyleRes int theme) { 28 | super(context, theme); 29 | mContext = context; 30 | } 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | if (getWindow() != null) { 36 | getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, 37 | ScreenUtils.getScreenHeight(mContext) - ScreenUtils.getStatusHeight(mContext)); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/imageload/ImageLoader.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.imageload; 2 | 3 | import android.content.Context; 4 | import android.widget.ImageView; 5 | 6 | import com.lauzy.freedom.librarys.imageload.glide.GlideImageLoaderStrategy; 7 | 8 | /** 9 | * Desc : Image Library Util 10 | * Author : Lauzy 11 | * Date : 2017/6/29 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public class ImageLoader implements IBaseImageStrategy { 16 | 17 | private static ImageLoader INSTANCE; 18 | private IBaseImageStrategy mImageStrategy; 19 | 20 | private ImageLoader(){ 21 | mImageStrategy = new GlideImageLoaderStrategy(); 22 | } 23 | 24 | public static ImageLoader getInstance() { 25 | if (INSTANCE == null) { 26 | synchronized (ImageLoader.class) { 27 | if (INSTANCE == null) { 28 | INSTANCE = new ImageLoader(); 29 | } 30 | } 31 | } 32 | return INSTANCE; 33 | } 34 | 35 | @Override 36 | public void display(Context context, ImageConfig imageConfig) { 37 | mImageStrategy.display(context, imageConfig); 38 | } 39 | 40 | @Override 41 | public void clean(Context context, ImageView imageView) { 42 | mImageStrategy.clean(context, imageView); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /libraries/src/main/cpp/com_lauzy_freedom_librarys_view_blur_ImageBlur.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | //#include 3 | #include "../../../../../../../SDK/ndk-bundle/sysroot/usr/include/jni.h" 4 | /* Header for class com_lauzy_freedom_librarys_view_blur_ImageBlur */ 5 | 6 | #ifndef _Included_com_lauzy_freedom_librarys_view_blur_ImageBlur 7 | #define _Included_com_lauzy_freedom_librarys_view_blur_ImageBlur 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | /* 12 | * Class: com_lauzy_freedom_librarys_view_blur_ImageBlur 13 | * Method: blurPixels 14 | * Signature: ([IIII)V 15 | */ 16 | JNIEXPORT void JNICALL Java_com_lauzy_freedom_librarys_view_blur_ImageBlur_blurPixels 17 | (JNIEnv *, jclass, jintArray, jint, jint, jint); 18 | 19 | /* 20 | * Class: com_lauzy_freedom_librarys_view_blur_ImageBlur 21 | * Method: blurBitmap 22 | * Signature: (Landroid/graphics/Bitmap;I)V 23 | */ 24 | JNIEXPORT void JNICALL Java_com_lauzy_freedom_librarys_view_blur_ImageBlur_blurBitmap 25 | (JNIEnv *, jclass, jobject, jint); 26 | 27 | /* 28 | * Class: com_lauzy_freedom_librarys_view_blur_ImageBlur 29 | * Method: blurBitmapClip 30 | * Signature: (Landroid/graphics/Bitmap;II)V 31 | */ 32 | JNIEXPORT void JNICALL Java_com_lauzy_freedom_librarys_view_blur_ImageBlur_blurBitmapClip 33 | (JNIEnv *, jclass, jobject, jint, jint); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | #endif 39 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/repository/ConfigDataManagerImpl.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.repository; 2 | 3 | import android.content.Context; 4 | 5 | import com.freedom.lauzy.repository.IConfigDataManager; 6 | import com.lauzy.freedom.data.local.data.DataManager; 7 | 8 | import javax.inject.Inject; 9 | 10 | /** 11 | * Desc : 配置 12 | * Author : Lauzy 13 | * Date : 2018/4/3 14 | * Blog : http://www.jianshu.com/u/e76853f863a9 15 | * Email : freedompaladin@gmail.com 16 | */ 17 | public class ConfigDataManagerImpl implements IConfigDataManager { 18 | 19 | private Context mContext; 20 | 21 | @Inject 22 | public ConfigDataManagerImpl(Context context) { 23 | mContext = context; 24 | } 25 | 26 | @Override 27 | public void setRepeatMode(int mode) { 28 | DataManager.getInstance(mContext).getConfigRepo().setRepeatMode(mode); 29 | } 30 | 31 | @Override 32 | public int getRepeatMode(int defaultMode) { 33 | return DataManager.getInstance(mContext).getConfigRepo().getRepeatMode(defaultMode); 34 | } 35 | 36 | @Override 37 | public void enablePlayByNetwork(boolean isEnable) { 38 | DataManager.getInstance(mContext).getConfigRepo().enablePlayByNetwork(isEnable); 39 | } 40 | 41 | @Override 42 | public boolean isEnablePlayByNetwork() { 43 | return DataManager.getInstance(mContext).getConfigRepo().isEnablePlayByNetwork(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/utils/anim/FragmentAnimUtil.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.utils.anim; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.transition.Explode; 5 | import android.transition.Fade; 6 | import android.transition.Scene; 7 | import android.transition.Slide; 8 | import android.transition.Visibility; 9 | import android.view.Gravity; 10 | import android.view.animation.BounceInterpolator; 11 | import android.view.animation.DecelerateInterpolator; 12 | 13 | /** 14 | * Desc : Fragment切换动画 15 | * Author : Lauzy 16 | * Date : 2017/8/9 17 | * Blog : http://www.jianshu.com/u/e76853f863a9 18 | * Email : freedompaladin@gmail.com 19 | */ 20 | public class FragmentAnimUtil { 21 | public static void setEnterExitAnim(Fragment fragment) { 22 | Explode explode = new Explode(); 23 | explode.setDuration(350); 24 | explode.setInterpolator(new DecelerateInterpolator()); 25 | explode.setMode(Visibility.MODE_IN); 26 | Slide slide = new Slide(); 27 | slide.setSlideEdge(Gravity.LEFT); 28 | slide.setDuration(200); 29 | Fade fade = new Fade(); 30 | fade.setDuration(200); 31 | fragment.setReturnTransition(fade); 32 | fragment.setEnterTransition(explode); 33 | fragment.setSharedElementEnterTransition(new FragmentTransition()); 34 | fragment.setSharedElementReturnTransition(new FragmentTransition()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/view/util/GradientBitmap.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.view.util; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.LinearGradient; 7 | import android.graphics.Paint; 8 | import android.graphics.PorterDuff; 9 | import android.graphics.PorterDuffXfermode; 10 | import android.graphics.Shader; 11 | 12 | /** 13 | * Desc : 渐变bitmap 14 | * Author : Lauzy 15 | * Date : 2018/3/8 16 | * Blog : http://www.jianshu.com/u/e76853f863a9 17 | * Email : freedompaladin@gmail.com 18 | */ 19 | public class GradientBitmap { 20 | 21 | public static Bitmap getGradientBitmap(Bitmap originalBitmap, int gradientColor) { 22 | int width = originalBitmap.getWidth(); 23 | int height = originalBitmap.getHeight(); 24 | Bitmap updatedBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); 25 | Canvas canvas = new Canvas(updatedBitmap); 26 | canvas.drawBitmap(originalBitmap, 0, 0, null); 27 | 28 | Paint paint = new Paint(); 29 | LinearGradient linearGradient = new LinearGradient(0, height / 2, 0, height, 30 | Color.TRANSPARENT, gradientColor, Shader.TileMode.MIRROR); 31 | paint.setShader(linearGradient); 32 | paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP)); 33 | canvas.drawRect(0, 0, width, height, paint); 34 | return updatedBitmap; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/play_view.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 22 | 23 | 24 | 25 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/repository/NetSongRepositoryImpl.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.repository; 2 | 3 | import com.freedom.lauzy.model.NetSongEntity; 4 | import com.freedom.lauzy.repository.NetSongRepository; 5 | import com.lauzy.freedom.data.entity.OnlineSongEntity; 6 | import com.lauzy.freedom.data.entity.mapper.NetSongMapper; 7 | import com.lauzy.freedom.data.net.RetrofitHelper; 8 | import com.lauzy.freedom.data.net.api.SongService; 9 | 10 | import io.reactivex.Observable; 11 | import io.reactivex.annotations.NonNull; 12 | import io.reactivex.functions.Function; 13 | 14 | /** 15 | * Desc : 获取单个歌曲信息(包括播放链接) 16 | * Author : Lauzy 17 | * Date : 2017/9/17 18 | * Blog : http://www.jianshu.com/u/e76853f863a9 19 | * Email : freedompaladin@gmail.com 20 | */ 21 | public class NetSongRepositoryImpl implements NetSongRepository { 22 | @Override 23 | public Observable getNetSongData(String method, long songId) { 24 | return RetrofitHelper.getInstance().createApi(SongService.class) 25 | .getOnlineSongData(method, songId) 26 | .map(new Function() { 27 | @Override 28 | public NetSongEntity apply(@NonNull OnlineSongEntity songEntity) throws Exception { 29 | NetSongMapper netSongMapper = new NetSongMapper(); 30 | return netSongMapper.transform(songEntity); 31 | } 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/interactor/NetSongUseCase.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.interactor; 2 | 3 | import com.freedom.lauzy.executor.PostExecutionThread; 4 | import com.freedom.lauzy.executor.ThreadExecutor; 5 | import com.freedom.lauzy.model.NetSongEntity; 6 | import com.freedom.lauzy.repository.NetSongRepository; 7 | 8 | import javax.inject.Inject; 9 | 10 | import io.reactivex.Observable; 11 | 12 | /** 13 | * Desc : 获取网络歌曲的播放资源 14 | * Author : Lauzy 15 | * Date : 2017/9/17 16 | * Blog : http://www.jianshu.com/u/e76853f863a9 17 | * Email : freedompaladin@gmail.com 18 | */ 19 | public class NetSongUseCase extends UseCase { 20 | 21 | private final NetSongRepository mNetSongRepository; 22 | 23 | @Inject 24 | public NetSongUseCase(NetSongRepository netSongRepository, ThreadExecutor threadExecutor, 25 | PostExecutionThread postExecutionThread) { 26 | super(threadExecutor, postExecutionThread); 27 | mNetSongRepository = netSongRepository; 28 | } 29 | 30 | @Override 31 | Observable buildUseCaseObservable(Params params) { 32 | return mNetSongRepository.getNetSongData(params.method, params.songId); 33 | } 34 | 35 | public static final class Params { 36 | private String method; 37 | private long songId; 38 | 39 | public Params(String method, long songId) { 40 | this.method = method; 41 | this.songId = songId; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/common/LogUtil.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.common; 2 | 3 | import android.support.annotation.NonNull; 4 | import android.text.TextUtils; 5 | 6 | import com.lauzy.freedom.librarys.BuildConfig; 7 | import com.orhanobut.logger.AndroidLogAdapter; 8 | import com.orhanobut.logger.Logger; 9 | 10 | /** 11 | * Desc : Utils for log 12 | * Author : Lauzy 13 | * Date : 2017/6/29 14 | * Blog : http://www.jianshu.com/u/e76853f863a9 15 | * Email : freedompaladin@gmail.com 16 | */ 17 | public class LogUtil { 18 | 19 | private static final String LTAG = "NullTag"; 20 | 21 | static { 22 | Logger.addLogAdapter(new AndroidLogAdapter()); 23 | } 24 | 25 | public static void e(@NonNull String tag, String content) { 26 | if (BuildConfig.DEBUG && !TextUtils.isEmpty(content)) 27 | Logger.t(checkTag(tag)).e(content); 28 | } 29 | 30 | public static void i(@NonNull String tag, String content) { 31 | if (BuildConfig.DEBUG && !TextUtils.isEmpty(content)) 32 | Logger.t(checkTag(tag)).i(content); 33 | } 34 | 35 | public static void d(@NonNull String tag, String content) { 36 | if (BuildConfig.DEBUG && !TextUtils.isEmpty(content)) 37 | Logger.t(checkTag(tag)).d(content); 38 | } 39 | 40 | public static void json(String content) { 41 | if (BuildConfig.DEBUG && !TextUtils.isEmpty(content)) 42 | Logger.json(content); 43 | } 44 | 45 | private static String checkTag(String tag) { 46 | return !TextUtils.isEmpty(tag) ? tag : LTAG; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/contract/PlayContract.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.contract; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | 6 | import com.freedom.lauzy.ticktockmusic.base.IBaseView; 7 | import com.freedom.lauzy.ticktockmusic.model.SongEntity; 8 | import com.lauzy.freedom.librarys.widght.music.lrc.Lrc; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * Desc : 14 | * Author : Lauzy 15 | * Date : 2017/9/7 16 | * Blog : http://www.jianshu.com/u/e76853f863a9 17 | * Email : freedompaladin@gmail.com 18 | */ 19 | public interface PlayContract { 20 | interface View extends IBaseView { 21 | 22 | Context getContext(); 23 | 24 | void setCoverBackground(Bitmap background); 25 | 26 | void addFavoriteSong(); 27 | 28 | void deleteFavoriteSong(); 29 | 30 | void setViewBgColor(int paletteColor); 31 | 32 | void setPlayView(Bitmap resource); 33 | 34 | void showLightViews(boolean isFavorite); 35 | 36 | void showDarkViews(boolean isFavorite); 37 | 38 | void startDownloadLrc(); 39 | 40 | void downloadLrcSuccess(List lrcs); 41 | 42 | void downloadFailed(Throwable e); 43 | } 44 | 45 | interface Presenter { 46 | void setCoverImgUrl(long songId, Object url); 47 | 48 | void addFavoriteSong(SongEntity entity); 49 | 50 | void deleteFavoriteSong(long songId); 51 | 52 | void loadLrc(SongEntity entity); 53 | 54 | void setRepeatMode(int mode); 55 | 56 | int getRepeatMode(int defautMode); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/main/layout/nav_header_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 25 | 26 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/net/retrofit/TickRequestBodyConvert.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.net.retrofit; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | import com.google.gson.Gson; 6 | import com.google.gson.TypeAdapter; 7 | import com.google.gson.stream.JsonWriter; 8 | 9 | import java.io.IOException; 10 | import java.io.OutputStreamWriter; 11 | import java.io.Writer; 12 | import java.nio.charset.Charset; 13 | 14 | import okhttp3.MediaType; 15 | import okhttp3.RequestBody; 16 | import okio.Buffer; 17 | import retrofit2.Converter; 18 | 19 | /** 20 | * Desc : 自定义请求转换器 21 | * Author : Lauzy 22 | * Date : 2017/7/11 23 | * Blog : http://www.jianshu.com/u/e76853f863a9 24 | * Email : freedompaladin@gmail.com 25 | */ 26 | public class TickRequestBodyConvert implements Converter { 27 | private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8"); 28 | private static final Charset UTF_8 = Charset.forName("UTF-8"); 29 | 30 | private final Gson gson; 31 | private final TypeAdapter adapter; 32 | 33 | TickRequestBodyConvert(Gson gson, TypeAdapter adapter) { 34 | this.gson = gson; 35 | this.adapter = adapter; 36 | } 37 | 38 | @Override 39 | public RequestBody convert(@NonNull T value) throws IOException { 40 | Buffer buffer = new Buffer(); 41 | Writer writer = new OutputStreamWriter(buffer.outputStream(), UTF_8); 42 | JsonWriter jsonWriter = gson.newJsonWriter(writer); 43 | adapter.write(jsonWriter, value); 44 | jsonWriter.close(); 45 | return RequestBody.create(MEDIA_TYPE, buffer.readByteString()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/entity/BaiduLrcEntity.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.entity; 2 | 3 | /** 4 | * Desc : 百度音乐 5 | * Author : Lauzy 6 | * Date : 2018/3/28 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | public class BaiduLrcEntity { 11 | 12 | /** 13 | * title : 海阔天空 14 | * lrcContent : [00:00.33]海阔天空 15 | [00:02.87]作词:黄家驹 作曲:黄家驹 16 | [00:04.61]演唱:Beyond 17 | [00:06.51] 18 | [00:18.58]今天我 寒夜里看雪飘过 19 | [00:25.05]怀着冷却了的心窝漂远方 20 | [00:30.99]风雨里追赶 雾里分不清影踪 21 | [00:37.15]天空海阔你与我 可会变 (谁没在变) 22 | [00:43.86] 23 | [00:44.19]多少次 迎着冷眼与嘲笑 24 | [00:49.96]从没有放弃过心中的理想 25 | [00:55.94]一刹那恍惚 若有所失的感觉 26 | [01:02.06]不知不觉已变淡 心里爱 (谁明白我) 27 | [01:08.66] 28 | [01:08.93]原谅我这一生不羁放纵爱自由 29 | [01:15.88]也会怕有一天会跌倒 30 | [01:21.99]背弃了理想 谁人都可以 31 | [01:28.37]哪会怕有一天只你共我 32 | [01:34.01] 33 | [01:42.87]今天我 寒夜里看雪飘过 34 | [01:49.28]怀着冷却了的心窝漂远方 35 | [01:55.10]风雨里追赶 雾里分不清影踪 36 | [02:01.46]天空海阔你与我 可会变 (谁没在变) 37 | [02:08.17] 38 | [02:08.39]原谅我这一生不羁放纵爱自由 39 | [02:15.26]也会怕有一天会跌倒 40 | [02:21.41]背弃了理想 谁人都可以 41 | [02:27.56]哪会怕有一天只你共我 42 | [02:33.38] 43 | [03:08.48]仍然自由自我 永远高唱我歌 44 | [03:15.16]走遍千里 45 | [03:19.41] 46 | [03:19.99]原谅我这一生不羁放纵爱自由 47 | [03:26.78]也会怕有一天会跌倒 48 | [03:33.05]背弃了理想 谁人都可以 49 | [03:38.88]哪会怕有一天只你共我 50 | [03:45.72]背弃了理想 谁人都可以 51 | [03:51.71]哪会怕有一天只你共我 52 | [03:57.38] 53 | [03:57.88]原谅我这一生不羁放纵爱自由 54 | [04:04.23]也会怕有一天会跌倒 55 | [04:10.52]背弃了理想 谁人都可以 56 | [04:16.63]哪会怕有一天只你共我 57 | [04:22.80] 58 | */ 59 | 60 | public String title; 61 | public String lrcContent; 62 | 63 | } 64 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/interactor/GetLocalArtistUseCase.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.interactor; 2 | 3 | import com.freedom.lauzy.executor.PostExecutionThread; 4 | import com.freedom.lauzy.executor.ThreadExecutor; 5 | import com.freedom.lauzy.model.ArtistAvatar; 6 | import com.freedom.lauzy.model.LocalArtistBean; 7 | import com.freedom.lauzy.model.LocalSongBean; 8 | import com.freedom.lauzy.repository.LocalSongRepository; 9 | 10 | import java.util.List; 11 | 12 | import javax.inject.Inject; 13 | 14 | import io.reactivex.Observable; 15 | 16 | /** 17 | * Desc : 本地歌手数据 18 | * Author : Lauzy 19 | * Date : 2017/9/28 20 | * Blog : http://www.jianshu.com/u/e76853f863a9 21 | * Email : freedompaladin@gmail.com 22 | */ 23 | public class GetLocalArtistUseCase extends UseCase, Void> { 24 | 25 | private final LocalSongRepository mLocalSongRepository; 26 | 27 | @Inject 28 | GetLocalArtistUseCase(LocalSongRepository localSongRepository, ThreadExecutor threadExecutor, 29 | PostExecutionThread postExecutionThread) { 30 | super(threadExecutor, postExecutionThread); 31 | mLocalSongRepository = localSongRepository; 32 | } 33 | 34 | @Override 35 | Observable> buildUseCaseObservable(Void aVoid) { 36 | return mLocalSongRepository.getLocalArtistList(); 37 | } 38 | 39 | public Observable getArtistAvatar(String method, String apiKey, String artistName, String format) { 40 | return mLocalSongRepository.getArtistAvatar(method, apiKey, artistName, format); 41 | } 42 | 43 | public Observable> getArtistSongList(long id) { 44 | return mLocalSongRepository.getLocalArtistSongList(id); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /presentation/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | 16 | 17 | 25 | 26 | 29 | 30 | 33 | 34 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/ui/adapter/MusicFolderAdapter.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.ui.adapter; 2 | 3 | import android.support.annotation.Nullable; 4 | 5 | import com.chad.library.adapter.base.BaseQuickAdapter; 6 | import com.chad.library.adapter.base.BaseViewHolder; 7 | import com.freedom.lauzy.model.Folder; 8 | import com.freedom.lauzy.ticktockmusic.R; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * Desc : 文件夹Adapter 14 | * Author : Lauzy 15 | * Date : 2018/3/15 16 | * Blog : http://www.jianshu.com/u/e76853f863a9 17 | * Email : freedompaladin@gmail.com 18 | */ 19 | public class MusicFolderAdapter extends BaseQuickAdapter { 20 | 21 | public MusicFolderAdapter(int layoutResId, @Nullable List data) { 22 | super(layoutResId, data); 23 | } 24 | 25 | @Override 26 | protected void convert(BaseViewHolder helper, Folder item) { 27 | helper.setText(R.id.tv_file_name, item.folderName) 28 | .setText(R.id.tv_desc, item.folderPath); 29 | helper.getView(R.id.ll_folder_item).setOnClickListener(v -> { 30 | if (mOnFolderClickListener != null) { 31 | Folder folder = mData.get(helper.getAdapterPosition()); 32 | mOnFolderClickListener.onFolderClick(folder.folderPath, folder.folderName); 33 | } 34 | }); 35 | } 36 | 37 | private OnFolderClickListener mOnFolderClickListener; 38 | 39 | public void setOnFolderClickListener(OnFolderClickListener onFolderClickListener) { 40 | mOnFolderClickListener = onFolderClickListener; 41 | } 42 | 43 | public interface OnFolderClickListener { 44 | void onFolderClick(String folderPath, String folderName); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/repository/LocalSongRepository.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.repository; 2 | 3 | import com.freedom.lauzy.model.ArtistAvatar; 4 | import com.freedom.lauzy.model.LocalAlbumBean; 5 | import com.freedom.lauzy.model.LocalArtistBean; 6 | import com.freedom.lauzy.model.LocalSongBean; 7 | 8 | import java.util.List; 9 | 10 | import io.reactivex.Observable; 11 | 12 | /** 13 | * Desc : LocalSongRepository 14 | * Author : Lauzy 15 | * Date : 2017/8/9 16 | * Blog : http://www.jianshu.com/u/e76853f863a9 17 | * Email : freedompaladin@gmail.com 18 | */ 19 | public interface LocalSongRepository { 20 | /** 21 | * 获取本地音乐列表 22 | * 23 | * @param albumId 专辑id,为0时返回所有音乐 24 | * @return Observable 25 | */ 26 | Observable> getLocalSongList(long albumId); 27 | 28 | /** 29 | * 获取本地专辑列表 30 | * 31 | * @param id 专辑Id,为0是返回所有专辑(未使用) 32 | * @return Observable 33 | */ 34 | Observable> getLocalAlbumList(long id); 35 | 36 | /** 37 | * 获取本地歌曲列表 38 | * 39 | * @return Observable 40 | */ 41 | Observable> getLocalArtistList(); 42 | 43 | /** 44 | * 获取歌手头像 45 | * 46 | * @param artistName 歌手名称 47 | * @return Observable 48 | */ 49 | Observable getArtistAvatar(String method, String apiKey, String artistName, String format); 50 | 51 | /** 52 | * 获取本地歌手的音乐 53 | * 54 | * @param artistId 歌手ID 55 | * @return Observable 56 | */ 57 | Observable> getLocalArtistSongList(long artistId); 58 | 59 | /** 60 | * 删除歌曲 61 | * @param songId ID 62 | * @return ob 63 | */ 64 | Observable deleteSong(long songId); 65 | } 66 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/database/TickDaoHelper.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.database; 2 | 3 | import android.content.Context; 4 | import android.database.sqlite.SQLiteDatabase; 5 | import android.database.sqlite.SQLiteOpenHelper; 6 | 7 | /** 8 | * Desc : DB helper 9 | * Author : Lauzy 10 | * Date : 2017/8/28 11 | * Blog : http://www.jianshu.com/u/e76853f863a9 12 | * Email : freedompaladin@gmail.com 13 | */ 14 | public class TickDaoHelper extends SQLiteOpenHelper { 15 | static final String FAVORITE_TABLE = "Favorite"; 16 | static final String RECENT_TABLE = "Recent"; 17 | static final String NET_MUSIC_TABLE = "NetMusic"; 18 | static final String PLAY_QUEUE = "PlayQueue"; 19 | private static final String DB_NAME = "ticktock.db"; 20 | private static final int DB_VERSION = 1; 21 | private Context mContext; 22 | 23 | public TickDaoHelper(Context context) { 24 | super(context, DB_NAME, null, DB_VERSION); 25 | mContext = context; 26 | } 27 | 28 | @Override 29 | public void onCreate(SQLiteDatabase db) { 30 | NetMusicDb.getInstance(mContext).createTable(db); 31 | PlayQueueDb.getInstance(mContext).createTable(db); 32 | FavoriteDb.getInstance(mContext).createTable(db); 33 | RecentDb.getInstance(mContext).createTable(db); 34 | } 35 | 36 | @Override 37 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 38 | NetMusicDb.getInstance(mContext).upgradeTable(db, oldVersion, newVersion); 39 | PlayQueueDb.getInstance(mContext).upgradeTable(db, oldVersion, newVersion); 40 | FavoriteDb.getInstance(mContext).upgradeTable(db, oldVersion, newVersion); 41 | RecentDb.getInstance(mContext).upgradeTable(db, oldVersion, newVersion); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/common/NetworkUtils.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.common; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | import android.net.NetworkInfo; 6 | 7 | /** 8 | * Desc : 9 | * Author : Lauzy 10 | * Date : 2018/4/2 11 | * Blog : http://www.jianshu.com/u/e76853f863a9 12 | * Email : freedompaladin@gmail.com 13 | */ 14 | public class NetworkUtils { 15 | 16 | 17 | public static boolean isConnect(Context context) { 18 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 19 | if (cm == null) { 20 | return false; 21 | } 22 | NetworkInfo info = cm.getActiveNetworkInfo(); 23 | return info != null && info.isConnected(); 24 | } 25 | 26 | public static boolean isMobileNetwork(Context context) { 27 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 28 | if (cm == null) { 29 | return false; 30 | } 31 | NetworkInfo info = cm.getActiveNetworkInfo(); 32 | if (info == null) { 33 | return false; 34 | } 35 | int type = info.getType(); 36 | return type == ConnectivityManager.TYPE_MOBILE; 37 | } 38 | 39 | public static boolean isWifiNetwork(Context context){ 40 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 41 | if (cm == null) { 42 | return false; 43 | } 44 | NetworkInfo info = cm.getActiveNetworkInfo(); 45 | if (info == null) { 46 | return false; 47 | } 48 | int type = info.getType(); 49 | return type == ConnectivityManager.TYPE_WIFI; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/ui/adapter/NetSongPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.ui.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import com.freedom.lauzy.model.CategoryBean; 8 | import com.freedom.lauzy.ticktockmusic.ui.fragment.NetSongListFragment; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * Desc : 15 | * Author : Lauzy 16 | * Date : 2017/8/14 17 | * Blog : http://www.jianshu.com/u/e76853f863a9 18 | * Email : freedompaladin@gmail.com 19 | */ 20 | public class NetSongPagerAdapter extends FragmentPagerAdapter { 21 | 22 | private List mCategoryBeen; 23 | 24 | public NetSongPagerAdapter(FragmentManager fm, List categoryBeen) { 25 | super(fm); 26 | mCategoryBeen = categoryBeen; 27 | } 28 | 29 | @Override 30 | public Fragment getItem(int position) { 31 | CategoryBean categoryBean = mCategoryBeen.get(position); 32 | return NetSongListFragment.newInstance(categoryBean.type); 33 | } 34 | 35 | @Override 36 | public int getCount() { 37 | return mCategoryBeen != null ? mCategoryBeen.size() : 0; 38 | } 39 | 40 | @Override 41 | public CharSequence getPageTitle(int position) { 42 | List titles = new ArrayList<>(); 43 | if (mCategoryBeen != null) { 44 | // titles.addAll(mCategoryBeen.stream().map(categoryBean -> categoryBean.title).collect(Collectors.toList())); 45 | for (int i = 0; i < mCategoryBeen.size(); i++) { 46 | titles.add(mCategoryBeen.get(i).title); 47 | } 48 | } 49 | return titles.get(position); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /presentation/src/main/res/menu/activity_main_drawer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 11 | 12 | 16 | 17 | 21 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 38 | 39 | 43 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/utils/HighlightFormatUtil.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.utils; 2 | 3 | import android.support.annotation.ColorInt; 4 | import android.text.Spannable; 5 | import android.text.SpannableStringBuilder; 6 | import android.text.style.ForegroundColorSpan; 7 | 8 | import com.lauzy.freedom.librarys.common.StringUtil; 9 | 10 | /** 11 | * Desc : 文字高亮工具类 12 | * Author : Lauzy 13 | * Date : 2017/11/22 14 | * Blog : http://www.jianshu.com/u/e76853f863a9 15 | * Email : freedompaladin@gmail.com 16 | */ 17 | public class HighlightFormatUtil { 18 | 19 | private SpannableStringBuilder mBuilder; 20 | private String mWholeStr; 21 | private String mHighlightStr; 22 | private int mColor; 23 | 24 | public HighlightFormatUtil(String wholeStr, String highlightStr, @ColorInt int color) { 25 | mWholeStr = wholeStr; 26 | mHighlightStr = highlightStr; 27 | mColor = color; 28 | } 29 | 30 | public HighlightFormatUtil fillColor() { 31 | int start = 0; 32 | int end = 0; 33 | if (!StringUtil.isEmpty(mWholeStr) && !StringUtil.isEmpty(mHighlightStr)) { 34 | if (mWholeStr.toLowerCase().contains(mHighlightStr.toLowerCase())) { 35 | start = mWholeStr.toLowerCase().indexOf(mHighlightStr.toLowerCase()); 36 | end = start + mHighlightStr.length(); 37 | } 38 | } 39 | if (end != 0) { 40 | mBuilder = new SpannableStringBuilder(mWholeStr); 41 | mBuilder.setSpan(new ForegroundColorSpan(mColor), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 42 | } 43 | return this; 44 | } 45 | 46 | public CharSequence getResult() { 47 | return mBuilder != null ? mBuilder : (mWholeStr != null ? mWholeStr : "-"); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/entity/SongListEntity.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.entity; 2 | 3 | /** 4 | * Desc : music list 音乐列表,接口参数 5 | * Author : Lauzy 6 | * Date : 2017/7/6 7 | * Blog : http://www.jianshu.com/u/e76853f863a9 8 | * Email : freedompaladin@gmail.com 9 | */ 10 | @SuppressWarnings("unused") 11 | public class SongListEntity { 12 | public String artist_id; 13 | public String language; 14 | public String pic_big; 15 | public String pic_small; 16 | public String country; 17 | public String area; 18 | public String publishtime; 19 | public String album_no; 20 | public String lrclink; 21 | public String copy_type; 22 | public String hot; 23 | public String all_artist_ting_uid; 24 | public String resource_type; 25 | public String is_new; 26 | public String rank_change; 27 | public int rank; 28 | public String all_artist_id; 29 | public String style; 30 | public String del_status; 31 | public String relate_status; 32 | public String toneid; 33 | public String all_rate; 34 | public long file_duration; 35 | public String has_mv_mobile; 36 | public String versions; 37 | public String bitrate_fee; 38 | public String biaoshi; 39 | public String info; 40 | public String has_filmtv; 41 | public String song_id; 42 | public String title; 43 | public String ting_uid; 44 | public String author; 45 | public String album_id; 46 | public String album_title; 47 | public String is_first_publish; 48 | public String havehigh; 49 | public String charge; 50 | public String has_mv; 51 | public String learn; 52 | public String song_source; 53 | public String piao_id; 54 | public String korean_bb_song; 55 | public String resource_type_ext; 56 | public String mv_provider; 57 | public String artist_name; 58 | } 59 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/executor/JobExecutor.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.executor; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | import com.freedom.lauzy.executor.ThreadExecutor; 6 | 7 | import java.util.concurrent.LinkedBlockingQueue; 8 | import java.util.concurrent.ThreadFactory; 9 | import java.util.concurrent.ThreadPoolExecutor; 10 | import java.util.concurrent.TimeUnit; 11 | 12 | import javax.inject.Inject; 13 | import javax.inject.Singleton; 14 | 15 | /** 16 | * Desc : 自定义线程池 17 | * Author : Lauzy 18 | * Date : 2017/7/25 19 | * Blog : http://www.jianshu.com/u/e76853f863a9 20 | * Email : freedompaladin@gmail.com 21 | */ 22 | @Singleton 23 | public class JobExecutor implements ThreadExecutor { 24 | 25 | private ThreadPoolExecutor mThreadPoolExecutor; 26 | private static final int INITIAL_POOL_SIZE = 3; 27 | private static final int MAX_POOL_SIZE = 5; 28 | private static final int KEEP_ALIVE_TIME = 10; 29 | private static final TimeUnit KEEP_ALIVE_TIME_UNIT = TimeUnit.SECONDS; 30 | 31 | @Inject 32 | public JobExecutor() { 33 | mThreadPoolExecutor = new ThreadPoolExecutor(INITIAL_POOL_SIZE, 34 | MAX_POOL_SIZE, 35 | KEEP_ALIVE_TIME, 36 | KEEP_ALIVE_TIME_UNIT, 37 | new LinkedBlockingQueue(), 38 | new JobThreadFactory()); 39 | } 40 | 41 | @Override 42 | public void execute(@NonNull Runnable command) { 43 | mThreadPoolExecutor.execute(command); 44 | } 45 | 46 | private static class JobThreadFactory implements ThreadFactory { 47 | private int counter = 0; 48 | private static final String THREAD_NAME = "Android_"; 49 | 50 | @Override 51 | public Thread newThread(@NonNull Runnable r) { 52 | return new Thread(r, THREAD_NAME + counter++); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /libraries/src/main/java/com/lauzy/freedom/librarys/common/DensityUtils.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.librarys.common; 2 | 3 | 4 | import android.content.Context; 5 | import android.util.TypedValue; 6 | 7 | /** 8 | * 常用单位转换的辅助类 9 | * Created by Lauzy on 2016/12/2. 10 | */ 11 | @SuppressWarnings("unused") 12 | public class DensityUtils { 13 | private DensityUtils() { 14 | /* cannot be instantiated */ 15 | throw new UnsupportedOperationException("cannot be instantiated"); 16 | } 17 | 18 | /** 19 | * dp转px 20 | * 21 | * @param context context 22 | * @param dpVal dp 23 | * @return px 24 | */ 25 | public static int dp2px(Context context, float dpVal) { 26 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 27 | dpVal, context.getResources().getDisplayMetrics()); 28 | } 29 | 30 | /** 31 | * sp转px 32 | * 33 | * @param context context 34 | * @param spVal sp 35 | * @return px 36 | */ 37 | public static int sp2px(Context context, float spVal) { 38 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 39 | spVal, context.getResources().getDisplayMetrics()); 40 | } 41 | 42 | /** 43 | * px转dp 44 | * 45 | * @param context context 46 | * @param pxVal px 47 | * @return dp 48 | */ 49 | public static float px2dp(Context context, float pxVal) { 50 | final float scale = context.getResources().getDisplayMetrics().density; 51 | return (pxVal / scale); 52 | } 53 | 54 | /** 55 | * px转sp 56 | * 57 | * @param context context 58 | * @param pxVal px 59 | * @return sp 60 | */ 61 | public static float px2sp(Context context, float pxVal) { 62 | return (pxVal / context.getResources().getDisplayMetrics().scaledDensity); 63 | } 64 | 65 | } 66 | 67 | -------------------------------------------------------------------------------- /data/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | 5 | def globalConfiguration = rootProject.extensions.getByName("ext") 6 | 7 | compileSdkVersion globalConfiguration["androidCompileSdkVersion"] 8 | buildToolsVersion globalConfiguration["androidBuildToolsVersion"] 9 | 10 | defaultConfig { 11 | minSdkVersion globalConfiguration["androidMinSdkVersion"] 12 | targetSdkVersion globalConfiguration["androidTargetSdkVersion"] 13 | versionCode globalConfiguration["androidVersionCode"] 14 | versionName globalConfiguration["androidVersionName"] 15 | testInstrumentationRunner globalConfiguration["testInstrumentationRunner"] 16 | } 17 | 18 | publishNonDefault true 19 | 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | } 27 | 28 | dependencies { 29 | def testDependencies = rootProject.ext.testDependencies 30 | def dataDependencies = rootProject.ext.dataDependencies 31 | implementation fileTree(include: ['*.jar'], dir: 'libs') 32 | androidTestImplementation testDependencies.espresso, { 33 | exclude group: 'com.android.support', module: 'support-annotations' 34 | } 35 | api project(':domain') 36 | api dataDependencies.rxJava 37 | api dataDependencies.dagger 38 | annotationProcessor dataDependencies.daggerCompiler 39 | api dataDependencies.okHttp 40 | api dataDependencies.okHttpInterceptor 41 | api dataDependencies.gson 42 | api dataDependencies.retrofit 43 | api dataDependencies.gsonConverter 44 | api dataDependencies.rxJava2Adapter 45 | api dataDependencies.javaxInject 46 | api dataDependencies.androidAnnotations 47 | api dataDependencies.log 48 | testImplementation testDependencies.junit 49 | } 50 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/song_category_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 22 | 23 | 31 | 32 | 35 | 36 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /presentation/src/main/res/layouts/music/layout/activity_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 17 | 18 | 32 | 33 | 34 | 35 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/entity/mapper/SingerAvatarMapper.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.entity.mapper; 2 | 3 | import com.freedom.lauzy.model.ArtistAvatar; 4 | import com.lauzy.freedom.data.entity.SingerAvatarEntity; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 歌手头像Mapper 10 | * Author : Lauzy 11 | * Date : 2017/9/28 12 | * Blog : http://www.jianshu.com/u/e76853f863a9 13 | * Email : freedompaladin@gmail.com 14 | */ 15 | public class SingerAvatarMapper { 16 | 17 | public static ArtistAvatar transform(SingerAvatarEntity avatarEntity) { 18 | if (null == avatarEntity) { 19 | return null; 20 | } 21 | ArtistAvatar artistAvatar = new ArtistAvatar(); 22 | if (avatarEntity.artist != null && avatarEntity.artist.image != null 23 | && avatarEntity.artist.image.size() != 0) { 24 | List imageBeen = avatarEntity.artist.image; 25 | artistAvatar.picUrl = imageBeen.get(3) != null ? imageBeen.get(3).imgUrl : ""; 26 | artistAvatar.bigPicUrl = imageBeen.get(4) != null ? imageBeen.get(4).imgUrl : ""; 27 | } 28 | return artistAvatar; 29 | } 30 | 31 | /* 32 | * "image": [{ 33 | "#text": "https://lastfm-img2.akamaized.net/i/u/34s/a0a0915d75ac49c1828559bda7ab1191.png", 34 | "size": "small"}, 35 | { 36 | "#text": "https://lastfm-img2.akamaized.net/i/u/64s/a0a0915d75ac49c1828559bda7ab1191.png", 37 | "size": "medium"}, 38 | { 39 | "#text": "https://lastfm-img2.akamaized.net/i/u/174s/a0a0915d75ac49c1828559bda7ab1191.png", 40 | "size": "large"}, 41 | { 42 | "#text": "https://lastfm-img2.akamaized.net/i/u/300x300/a0a0915d75ac49c1828559bda7ab1191.png", 43 | "size": "extralarge"}, 44 | { 45 | "#text": "https://lastfm-img2.akamaized.net/i/u/300x300/a0a0915d75ac49c1828559bda7ab1191.png", 46 | "size": "mega"}, 47 | ], 48 | * */ 49 | } 50 | -------------------------------------------------------------------------------- /presentation/src/main/java/com/freedom/lauzy/ticktockmusic/presenter/MusicFolderPresenter.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.ticktockmusic.presenter; 2 | 3 | import com.freedom.lauzy.interactor.MusicFolderUseCase; 4 | import com.freedom.lauzy.model.Folder; 5 | import com.freedom.lauzy.ticktockmusic.base.BaseRxPresenter; 6 | import com.freedom.lauzy.ticktockmusic.contract.MusicFolderContract; 7 | import com.freedom.lauzy.ticktockmusic.function.DefaultDisposableObserver; 8 | 9 | import java.util.List; 10 | 11 | import javax.inject.Inject; 12 | 13 | /** 14 | * Desc : 文件夹 15 | * Author : Lauzy 16 | * Date : 2018/3/15 17 | * Blog : http://www.jianshu.com/u/e76853f863a9 18 | * Email : freedompaladin@gmail.com 19 | */ 20 | public class MusicFolderPresenter extends BaseRxPresenter 21 | implements MusicFolderContract.Presenter { 22 | 23 | private MusicFolderUseCase mMusicFolderUseCase; 24 | 25 | @Inject 26 | MusicFolderPresenter(MusicFolderUseCase musicFolderUseCase) { 27 | mMusicFolderUseCase = musicFolderUseCase; 28 | } 29 | 30 | @Override 31 | public void loadFolders() { 32 | mMusicFolderUseCase.execute(new DefaultDisposableObserver>() { 33 | @Override 34 | public void onNext(List folders) { 35 | super.onNext(folders); 36 | if (getView() == null) { 37 | return; 38 | } 39 | if (folders == null || folders.isEmpty()) { 40 | getView().setEmptyView(); 41 | } else { 42 | getView().onLoadFoldersSuccess(folders); 43 | } 44 | } 45 | 46 | @Override 47 | public void onError(Throwable e) { 48 | super.onError(e); 49 | if (getView() == null) { 50 | return; 51 | } 52 | getView().loadFailed(e); 53 | } 54 | }, null); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/interactor/LrcUseCase.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.interactor; 2 | 3 | import com.freedom.lauzy.executor.PostExecutionThread; 4 | import com.freedom.lauzy.executor.ThreadExecutor; 5 | import com.freedom.lauzy.repository.LrcRepository; 6 | 7 | import javax.inject.Inject; 8 | 9 | import io.reactivex.Observable; 10 | import okhttp3.ResponseBody; 11 | 12 | /** 13 | * Desc : 歌词 14 | * Author : Lauzy 15 | * Date : 2018/3/26 16 | * Blog : http://www.jianshu.com/u/e76853f863a9 17 | * Email : freedompaladin@gmail.com 18 | */ 19 | public class LrcUseCase extends UseCase { 20 | 21 | private final LrcRepository mLrcRepository; 22 | 23 | @Inject 24 | LrcUseCase(ThreadExecutor threadExecutor, PostExecutionThread postExecutionThread, 25 | LrcRepository lrcRepository) { 26 | super(threadExecutor, postExecutionThread); 27 | mLrcRepository = lrcRepository; 28 | } 29 | 30 | @Override 31 | Observable buildUseCaseObservable(Param param) { 32 | return mLrcRepository.getLrcData(param.getSongName(), param.getSinger()); 33 | } 34 | 35 | public Observable getBaiduLrcData(String method, long songId) { 36 | return mLrcRepository.getBaiduLrcData(method, songId); 37 | } 38 | 39 | public static final class Param { 40 | 41 | private String songName; 42 | private String singer; 43 | 44 | public Param(String songName, String singer) { 45 | this.songName = songName; 46 | this.singer = singer; 47 | } 48 | 49 | public String getSongName() { 50 | return songName; 51 | } 52 | 53 | public void setSongName(String songName) { 54 | this.songName = songName; 55 | } 56 | 57 | public String getSinger() { 58 | return singer; 59 | } 60 | 61 | public void setSinger(String singer) { 62 | this.singer = singer; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /data/src/main/java/com/lauzy/freedom/data/entity/mapper/NetSongMapper.java: -------------------------------------------------------------------------------- 1 | package com.lauzy.freedom.data.entity.mapper; 2 | 3 | import com.freedom.lauzy.model.NetSongEntity; 4 | import com.lauzy.freedom.data.entity.OnlineSongEntity; 5 | import com.lauzy.freedom.data.local.LocalUtil; 6 | 7 | /** 8 | * Desc : 将Json默认生成格式的播放信息实体类转化为直接使用的NetSongBean 9 | * Author : Lauzy 10 | * Date : 2017/9/17 11 | * Blog : http://www.jianshu.com/u/e76853f863a9 12 | * Email : freedompaladin@gmail.com 13 | */ 14 | public class NetSongMapper { 15 | 16 | public NetSongEntity transform(OnlineSongEntity songEntity) { 17 | NetSongEntity netSongBean = null; 18 | try { 19 | if (songEntity != null && songEntity.songinfo != null && songEntity.bitrate != null) { 20 | netSongBean = new NetSongEntity(); 21 | netSongBean.imgUrl = songEntity.songinfo.pic_big; 22 | netSongBean.lrcLink = songEntity.songinfo.lrclink; 23 | netSongBean.songId = songEntity.songinfo.song_id; 24 | netSongBean.title = songEntity.songinfo.title; 25 | netSongBean.tingUid = songEntity.songinfo.ting_uid; 26 | netSongBean.author = songEntity.songinfo.author; 27 | netSongBean.albumId = songEntity.songinfo.album_id; 28 | netSongBean.albumTitle = songEntity.songinfo.album_title; 29 | netSongBean.artistId = songEntity.songinfo.artist_id; 30 | netSongBean.artistName = songEntity.songinfo.author; 31 | netSongBean.size = songEntity.bitrate.file_size; 32 | netSongBean.duration = Long.parseLong(songEntity.bitrate.file_duration); 33 | netSongBean.songLength = LocalUtil.formatSecondTime(Long.parseLong 34 | (songEntity.bitrate.file_duration)); 35 | netSongBean.playPath = songEntity.bitrate.file_link; 36 | } 37 | } catch (Exception e) { 38 | e.printStackTrace(); 39 | } 40 | return netSongBean; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /domain/src/main/java/com/freedom/lauzy/interactor/RecentSongUseCase.java: -------------------------------------------------------------------------------- 1 | package com.freedom.lauzy.interactor; 2 | 3 | import com.freedom.lauzy.executor.PostExecutionThread; 4 | import com.freedom.lauzy.executor.ThreadExecutor; 5 | import com.freedom.lauzy.model.RecentSongBean; 6 | import com.freedom.lauzy.repository.RecentRepository; 7 | 8 | import java.util.List; 9 | 10 | import javax.inject.Inject; 11 | 12 | import io.reactivex.Observable; 13 | 14 | /** 15 | * Desc : 最近播放 16 | * Author : Lauzy 17 | * Date : 2017/9/15 18 | * Blog : http://www.jianshu.com/u/e76853f863a9 19 | * Email : freedompaladin@gmail.com 20 | */ 21 | public class RecentSongUseCase extends UseCase { 22 | 23 | private RecentRepository mRecentRepository; 24 | 25 | @Inject 26 | public RecentSongUseCase(RecentRepository recentRepository, ThreadExecutor threadExecutor, 27 | PostExecutionThread postExecutionThread) { 28 | super(threadExecutor, postExecutionThread); 29 | mRecentRepository = recentRepository; 30 | } 31 | 32 | /** 33 | * 添加最近播放音乐 34 | * 35 | * @param songBean 最近播放音乐 36 | * @return Observable 37 | */ 38 | @Override 39 | Observable buildUseCaseObservable(RecentSongBean songBean) { 40 | return mRecentRepository.addRecentSong(songBean); 41 | } 42 | 43 | /** 44 | * 获取最近播放数据 Observable 45 | * @return Observable 46 | */ 47 | public Observable> getRecentSongs() { 48 | return mRecentRepository.getRecentSongs(); 49 | } 50 | 51 | /** 52 | * 清空最近播放数据 Observable 53 | * @return Observable 54 | */ 55 | public Observable clearRecentSongs() { 56 | return mRecentRepository.clearRecentSongs(); 57 | } 58 | 59 | /** 60 | * 根据 songId 删除最近播放数据 Observable 61 | * @param songId songId 62 | * @return Observable 63 | */ 64 | public Observable deleteRecentSong(long songId) { 65 | return mRecentRepository.deleteRecentSong(songId); 66 | } 67 | } 68 | --------------------------------------------------------------------------------