├── .idea ├── .name ├── dictionaries │ └── Dell.xml ├── codeStyles │ ├── codeStyleConfig.xml │ └── Project.xml ├── compiler.xml ├── vcs.xml ├── render.experimental.xml ├── misc.xml ├── runConfigurations.xml ├── gradle.xml └── jarRepositories.xml ├── app ├── .gitignore ├── src │ ├── main │ │ ├── ic_launcher-playstore.png │ │ ├── res │ │ │ ├── drawable-hdpi │ │ │ │ ├── heart.png │ │ │ │ ├── matt.png │ │ │ │ ├── more.png │ │ │ │ ├── pause.png │ │ │ │ ├── play.png │ │ │ │ ├── closed.png │ │ │ │ ├── forward.png │ │ │ │ ├── github.png │ │ │ │ ├── heart1.png │ │ │ │ ├── logooo.png │ │ │ │ ├── random.png │ │ │ │ ├── random1.png │ │ │ │ ├── refresh.png │ │ │ │ ├── rewind.png │ │ │ │ ├── widget.png │ │ │ │ ├── coverrrl.png │ │ │ │ ├── linkedin.png │ │ │ │ ├── playlist.png │ │ │ │ ├── refresh1.png │ │ │ │ ├── sound_new.png │ │ │ │ ├── folder_icon.png │ │ │ │ ├── search_anim.gif │ │ │ │ └── back_navar_music.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── heart.png │ │ │ │ ├── matt.png │ │ │ │ ├── more.png │ │ │ │ ├── pause.png │ │ │ │ ├── play.png │ │ │ │ ├── closed.png │ │ │ │ ├── forward.png │ │ │ │ ├── github.png │ │ │ │ ├── heart1.png │ │ │ │ ├── logooo.png │ │ │ │ ├── random.png │ │ │ │ ├── random1.png │ │ │ │ ├── refresh.png │ │ │ │ ├── rewind.png │ │ │ │ ├── widget.png │ │ │ │ ├── coverrrl.png │ │ │ │ ├── linkedin.png │ │ │ │ ├── playlist.png │ │ │ │ ├── refresh1.png │ │ │ │ ├── sound_new.png │ │ │ │ ├── folder_icon.png │ │ │ │ └── back_navar_music.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── gift.gif │ │ │ │ ├── matt.png │ │ │ │ ├── more.png │ │ │ │ ├── play.png │ │ │ │ ├── closed.png │ │ │ │ ├── github.png │ │ │ │ ├── heart.png │ │ │ │ ├── heart1.png │ │ │ │ ├── logooo.png │ │ │ │ ├── pause.png │ │ │ │ ├── random.png │ │ │ │ ├── rewind.png │ │ │ │ ├── widget.png │ │ │ │ ├── coverrrl.png │ │ │ │ ├── forward.png │ │ │ │ ├── linkedin.png │ │ │ │ ├── playlist.png │ │ │ │ ├── random1.png │ │ │ │ ├── refresh.png │ │ │ │ ├── refresh1.png │ │ │ │ ├── sound_new.png │ │ │ │ ├── folder_icon.png │ │ │ │ └── back_navar_music.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── heart.png │ │ │ │ ├── matt.png │ │ │ │ ├── more.png │ │ │ │ ├── pause.png │ │ │ │ ├── play.png │ │ │ │ ├── closed.png │ │ │ │ ├── coverrrl.png │ │ │ │ ├── forward.png │ │ │ │ ├── github.png │ │ │ │ ├── heart1.png │ │ │ │ ├── linkedin.png │ │ │ │ ├── logooo.png │ │ │ │ ├── playlist.png │ │ │ │ ├── random.png │ │ │ │ ├── random1.png │ │ │ │ ├── refresh.png │ │ │ │ ├── refresh1.png │ │ │ │ ├── rewind.png │ │ │ │ ├── widget.png │ │ │ │ ├── sound_new.png │ │ │ │ ├── folder_icon.png │ │ │ │ └── back_navar_music.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── matt.png │ │ │ │ ├── more.png │ │ │ │ ├── play.png │ │ │ │ ├── closed.png │ │ │ │ ├── forward.png │ │ │ │ ├── github.png │ │ │ │ ├── heart.png │ │ │ │ ├── heart1.png │ │ │ │ ├── logooo.png │ │ │ │ ├── pause.png │ │ │ │ ├── random.png │ │ │ │ ├── random1.png │ │ │ │ ├── refresh.png │ │ │ │ ├── rewind.png │ │ │ │ ├── widget.png │ │ │ │ ├── coverrrl.png │ │ │ │ ├── linkedin.png │ │ │ │ ├── playlist.png │ │ │ │ ├── refresh1.png │ │ │ │ ├── sound_new.png │ │ │ │ ├── folder_icon.png │ │ │ │ └── back_navar_music.png │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── ic_launcher_foreground.png │ │ │ ├── values │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ ├── strings.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── values-v14 │ │ │ │ └── dimens.xml │ │ │ ├── drawable │ │ │ │ ├── favourite_selected.xml │ │ │ │ ├── ic_next.xml │ │ │ │ ├── background_notif.xml │ │ │ │ ├── background_widget.xml │ │ │ │ ├── background_play.xml │ │ │ │ ├── ic_baseline_arrow_back_24.xml │ │ │ │ ├── background_playland.xml │ │ │ │ ├── ic_baseline_music_note_24.xml │ │ │ │ ├── ic_round_play.xml │ │ │ │ ├── ic_round_pause.xml │ │ │ │ ├── back_navar_l.xml │ │ │ │ ├── ic_baseline_favorite_24.xml │ │ │ │ ├── ic_round_next.xml │ │ │ │ ├── row_background3.xml │ │ │ │ ├── ic_round_previous.xml │ │ │ │ ├── ic_search.xml │ │ │ │ ├── ic_favorite.xml │ │ │ │ ├── ic_favorite1.xml │ │ │ │ ├── row_background.xml │ │ │ │ └── row_background2.xml │ │ │ ├── anim │ │ │ │ ├── anim_backward.xml │ │ │ │ ├── anim_repeat.xml │ │ │ │ └── anim_pause.xml │ │ │ ├── menu │ │ │ │ └── main_menu.xml │ │ │ ├── xml │ │ │ │ └── music_widget_info.xml │ │ │ ├── layout │ │ │ │ ├── fragment_folder.xml │ │ │ │ ├── fragment_favourites.xml │ │ │ │ ├── fragment_album.xml │ │ │ │ ├── music_album_item.xml │ │ │ │ ├── fragment_track.xml │ │ │ │ ├── folder_item.xml │ │ │ │ ├── activity_spalshscreen.xml │ │ │ │ ├── recent_item.xml │ │ │ │ ├── allbum_item.xml │ │ │ │ ├── music_widget.xml │ │ │ │ ├── activity_album.xml │ │ │ │ ├── activity_folder.xml │ │ │ │ ├── track_item.xml │ │ │ │ └── activity_search.xml │ │ │ └── layout-land │ │ │ │ ├── activity_album.xml │ │ │ │ └── activity_folder.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── musicPlayer │ │ │ │ ├── Services │ │ │ │ ├── DataService.kt │ │ │ │ └── MediaPlayerService.kt │ │ │ │ ├── Ui │ │ │ │ ├── SplashScreenActivity.kt │ │ │ │ ├── FolderActivity.kt │ │ │ │ ├── Controllers │ │ │ │ │ ├── FragmentFolders.kt │ │ │ │ │ ├── FragmentAlbums.kt │ │ │ │ │ └── FragmentTracks.kt │ │ │ │ ├── AboutActivity.kt │ │ │ │ ├── AlbumActivity.kt │ │ │ │ └── SearchActivity.kt │ │ │ │ ├── Models │ │ │ │ ├── AlbumInfo.kt │ │ │ │ ├── LikeInfo.kt │ │ │ │ └── SongInfo.kt │ │ │ │ ├── Helper │ │ │ │ ├── MyPagerAdapter.kt │ │ │ │ ├── MyFolderAdapter.kt │ │ │ │ ├── MyMusicAlbumAd.kt │ │ │ │ ├── MyAlbumAdapter.kt │ │ │ │ ├── MyRecentlyAdapter.kt │ │ │ │ ├── MyMusicFolderAp.kt │ │ │ │ ├── MySearchAdapter.kt │ │ │ │ └── MyTrackAdapter.kt │ │ │ │ ├── Widget │ │ │ │ └── MusicWidget.kt │ │ │ │ ├── Notification │ │ │ │ └── CreateNotification.kt │ │ │ │ └── DataBase │ │ │ │ └── DBManager.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── musicPlayer │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── example │ │ └── musicPlayer │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── README.md ├── .gitignore ├── gradle.properties ├── gradlew.bat └── gradlew /.idea/.name: -------------------------------------------------------------------------------- 1 | Music Player -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name='Music Player' 2 | include ':app' 3 | -------------------------------------------------------------------------------- /.idea/dictionaries/Dell.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/heart.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/matt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/matt.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/more.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/pause.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/play.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/heart.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/matt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/matt.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/more.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/pause.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/play.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/gift.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/gift.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/matt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/matt.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/more.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/play.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/closed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/github.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/heart1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/heart1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/logooo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/logooo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/random.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/random.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/random1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/random1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/refresh.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/rewind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/rewind.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/widget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/widget.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/closed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/github.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/heart1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/heart1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/logooo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/logooo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/random.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/random.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/random1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/random1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/refresh.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/rewind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/rewind.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/widget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/widget.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/closed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/github.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/heart.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/heart1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/heart1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/logooo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/logooo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/pause.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/random.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/random.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/rewind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/rewind.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/widget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/widget.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/heart.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/matt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/matt.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/more.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/pause.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/play.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/matt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/matt.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/more.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/play.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/coverrrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/coverrrl.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/linkedin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/linkedin.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/playlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/playlist.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/refresh1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/refresh1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/sound_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/sound_new.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/coverrrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/coverrrl.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/linkedin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/linkedin.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/playlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/playlist.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/refresh1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/refresh1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/sound_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/sound_new.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/coverrrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/coverrrl.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/linkedin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/linkedin.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/playlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/playlist.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/random1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/random1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/refresh.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/refresh1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/refresh1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/sound_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/sound_new.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/closed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/coverrrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/coverrrl.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/github.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/heart1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/heart1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/linkedin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/linkedin.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/logooo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/logooo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/playlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/playlist.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/random.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/random.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/random1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/random1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/refresh.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/refresh1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/refresh1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/rewind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/rewind.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/widget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/widget.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/closed.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/forward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/github.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/heart.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/heart1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/heart1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/logooo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/logooo.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/pause.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/random.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/random.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/random1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/random1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/refresh.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/rewind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/rewind.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/widget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/widget.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/folder_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/folder_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/search_anim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/search_anim.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/folder_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/folder_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/folder_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/folder_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/sound_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/sound_new.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/coverrrl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/coverrrl.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/linkedin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/linkedin.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/playlist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/playlist.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/refresh1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/refresh1.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/sound_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/sound_new.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/folder_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/folder_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/folder_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/folder_icon.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MusicPlayer 2 | [![](http://img.youtube.com/vi/fVYaiKLPM8s/0.jpg)](http://www.youtube.com/watch?v=fVYaiKLPM8s "") 3 | **aplication preview in YouTube** 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/back_navar_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-hdpi/back_navar_music.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/back_navar_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-mdpi/back_navar_music.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/back_navar_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xhdpi/back_navar_music.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/back_navar_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxhdpi/back_navar_music.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/back_navar_music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/drawable-xxxhdpi/back_navar_music.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soheilheydari21/MusicPlayer/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3DDC84 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | EXAMPLE 4 | 5 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/render.experimental.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Nov 08 11:10:15 PST 2020 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-6.5-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 8dp 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-v14/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 0dp 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/favourite_selected.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_next.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_backward.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/background_notif.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/background_widget.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/background_play.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_arrow_back_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_repeat.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/background_playland.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_music_note_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_round_play.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/test/java/com/example/musicPlayer/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_round_pause.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/back_navar_l.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #121112 4 | #F2FBFB 5 | #ffffff 6 | #000000 7 | #C3C3C3 8 | #058670 9 | #e5383b 10 | #202125 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_favorite_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_round_next.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/anim/anim_pause.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/row_background3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/xml/music_widget_info.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_round_previous.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_search.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_favorite.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_favorite1.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/row_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Services/DataService.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Services 2 | 3 | import com.example.musicPlayer.Helper.mediaPlayer 4 | import com.example.musicPlayer.Helper.songe 5 | 6 | class DataService { 7 | 8 | //ToDo this fixes mediaPlayer => isRepeat & isShuffle 2 9 | companion object { 10 | fun playSong(songIndex: Int = 0) { 11 | mediaPlayer!!.reset() 12 | mediaPlayer!!.setDataSource(songe!!.SongURL) 13 | mediaPlayer!!.prepare() 14 | mediaPlayer!!.start() 15 | } 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/row_background2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Ui/SplashScreenActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Ui 2 | 3 | import android.content.Intent 4 | import androidx.appcompat.app.AppCompatActivity 5 | import android.os.Bundle 6 | import android.os.Handler 7 | import com.example.musicPlayer.R 8 | 9 | @Suppress("DEPRECATION") 10 | class SplashScreenActivity : AppCompatActivity() { 11 | 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | setContentView(R.layout.activity_spalshscreen) 15 | 16 | Handler().postDelayed({ 17 | val intent = Intent(this, MainActivity::class.java) 18 | startActivity(intent) 19 | }, 4000) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Models/AlbumInfo.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Models 2 | 3 | class AlbumInfo { 4 | 5 | var album:String ?= null 6 | var album2:String ?= null 7 | var album3:String ?= null 8 | var title:String ?= null 9 | var artist:String ?= null 10 | var albumUrl:String ?= null 11 | 12 | constructor(Album:String, Album2:String, Album3:String, Title:String, Artist:String, AlbumUrl:String) { 13 | this.album = Album 14 | this.album2 = Album2 15 | this.album3 = Album3 16 | this.title = Title 17 | this.artist = Artist 18 | this.albumUrl = AlbumUrl 19 | } 20 | 21 | fun getpach(): String? { return albumUrl } 22 | fun setpach(AlbumUrl: String) { this.albumUrl = AlbumUrl } 23 | 24 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/musicPlayer/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.example.musicplayer", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 19 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Models/LikeInfo.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Models 2 | 3 | class LikeInfo { 4 | 5 | var ID:Int? = null 6 | var Title:String? = null 7 | var Artist:String? = null 8 | var SongURL:String ?= null 9 | var Cover:String ?= null 10 | 11 | constructor(id:Int, title:String, artist:String, songUrl:String, cover:String) { 12 | this.ID = id 13 | this.Title = title 14 | this.Artist = artist 15 | this.SongURL = songUrl 16 | this.Cover = cover 17 | } 18 | 19 | fun getpach(): String? { return SongURL } 20 | fun setpach(songURL: String) { this.SongURL = songURL } 21 | 22 | fun gettitle(): String? { return Title } 23 | fun settitle(title: String) { this.Title = title } 24 | 25 | fun getartist(): String? { return Artist } 26 | fun setartist(artist: String) { this.Artist = artist } 27 | 28 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Models/SongInfo.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Models 2 | 3 | public final class SongInfo { 4 | 5 | var Title:String ?= null 6 | var Desc:String ?= null 7 | var SongURL:String ?= null 8 | var Cover:String ?= null 9 | 10 | public constructor(title:String, desc:String, songURL:String, cover:String) { 11 | this.Title = title 12 | this.Desc = desc 13 | this.SongURL = songURL 14 | this.Cover = cover 15 | } 16 | 17 | fun getpach(): String? { return SongURL } 18 | fun setpach(songURL: String) { this.SongURL = songURL } 19 | 20 | fun gettitle(): String? { return Title } 21 | fun settitle(title: String) { this.Title = title } 22 | 23 | fun getdesc(): String? { return Desc } 24 | fun setdesc(desc: String) { this.Desc = desc } 25 | 26 | fun getimage(): String? { return Cover } 27 | fun setimage(cover: String) { this.Cover = cover } 28 | 29 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_favourites.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 19 | 20 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Helper/MyPagerAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Helper 2 | 3 | import androidx.fragment.app.Fragment 4 | import androidx.fragment.app.FragmentManager 5 | import androidx.fragment.app.FragmentPagerAdapter 6 | import com.example.musicPlayer.Ui.Controllers.FragmentFavourites 7 | import com.example.musicPlayer.Ui.Controllers.FragmentTracks 8 | import com.example.musicPlayer.Ui.Controllers.FragmentFolders 9 | import com.example.musicPlayer.Ui.Controllers.FragmentAlbums 10 | 11 | @Suppress("DEPRECATION") 12 | class MyPagerAdapter (fm : FragmentManager) : FragmentPagerAdapter(fm) { 13 | 14 | override fun getItem(position: Int): Fragment { 15 | return when(position) { 16 | 0-> FragmentTracks() 17 | 1-> FragmentAlbums() 18 | 2-> FragmentFolders() 19 | else-> return FragmentFavourites() 20 | } 21 | } 22 | 23 | override fun getCount(): Int { 24 | return 4 25 | } 26 | 27 | override fun getPageTitle(position: Int): CharSequence? { 28 | return when (position){ 29 | 0-> "Tracks" 30 | 1-> "Albums" 31 | 2-> "Folders" 32 | else-> return "" 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_album.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Widget/MusicWidget.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Widget 2 | 3 | import android.appwidget.AppWidgetManager 4 | import android.appwidget.AppWidgetProvider 5 | import android.content.Context 6 | import android.widget.RemoteViews 7 | import com.example.musicPlayer.R 8 | 9 | /** 10 | * Implementation of App Widget functionality. 11 | */ 12 | class MusicWidget : AppWidgetProvider() { 13 | 14 | override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) { 15 | // There may be multiple widgets active, so update all of them 16 | for (appWidgetId in appWidgetIds) { 17 | updateAppWidget( 18 | context, 19 | appWidgetManager, 20 | appWidgetId 21 | ) 22 | } 23 | } 24 | 25 | override fun onEnabled(context: Context) { 26 | // Enter relevant functionality for when the first widget is created 27 | } 28 | 29 | override fun onDisabled(context: Context) { 30 | // Enter relevant functionality for when the last widget is disabled 31 | } 32 | } 33 | 34 | internal fun updateAppWidget(context: Context, appWidgetManager: AppWidgetManager, appWidgetId: Int) { 35 | val widgetText = context.getString(R.string.appwidget_text) 36 | // Construct the RemoteViews object 37 | val views = RemoteViews(context.packageName, R.layout.music_widget) 38 | // views.setTextViewText(R.id.appwidget_text, widgetText) 39 | // Instruct the widget manager to update the widget 40 | appWidgetManager.updateAppWidget(appWidgetId, views) 41 | } -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Notification/CreateNotification.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Notification 2 | 3 | import android.app.Application 4 | import android.app.Notification 5 | import android.content.Context 6 | import android.os.Build 7 | import android.support.v4.media.session.MediaSessionCompat 8 | import androidx.core.app.NotificationCompat 9 | import androidx.core.app.NotificationManagerCompat 10 | import com.example.musicPlayer.Models.SongInfo 11 | import com.example.musicPlayer.R 12 | 13 | class CreateNotification { 14 | 15 | companion object { 16 | 17 | fun notification(context: Context, track: SongInfo, playButton: Int, pause: Int, size: Int) { 18 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 19 | 20 | val notificationManagerCompat: NotificationManagerCompat = NotificationManagerCompat.from(context) 21 | val mediaSessionCompat: MediaSessionCompat = MediaSessionCompat(context, "tag") 22 | 23 | val CHANNEL_ID = "Your_Channel_ID" 24 | var ACTION_PREVIUOS = "Action_Previous" 25 | var CHANNEL_PLAY = "Action_Play" 26 | var CHANNEL_NEXT = "Action_Next" 27 | 28 | val notification = NotificationCompat.Builder(context, CHANNEL_ID) 29 | .setContentTitle(track.gettitle()) 30 | .setContentText(track.getdesc()) 31 | .setSmallIcon(R.drawable.ic_baseline_arrow_back_24) 32 | .setOnlyAlertOnce(true) 33 | .setShowWhen(false) 34 | .setPriority(NotificationCompat.PRIORITY_LOW) 35 | .build() 36 | notificationManagerCompat.notify(1, notification) 37 | 38 | } 39 | 40 | } 41 | 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/music_album_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 20 | 21 | 36 | 37 | 48 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 18 | 19 | 25 | 26 | 30 | 31 | 35 | 36 | 40 | 41 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Helper/MyFolderAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Helper 2 | 3 | import android.content.Context 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import android.widget.TextView 8 | import androidx.recyclerview.widget.RecyclerView 9 | import com.example.musicPlayer.Models.SongInfo 10 | import com.example.musicPlayer.R 11 | 12 | //ToDo this fixes folder adapter 13 | 14 | var changNameFolder = "Title" 15 | var changAddressFolder = "Artist" 16 | 17 | class MyFolderAdapter( 18 | val context: Context, 19 | private val folders: ArrayList, 20 | private val itemClicked: (SongInfo) -> Unit 21 | ) : RecyclerView.Adapter() { 22 | 23 | companion object { 24 | var myFolderSong = ArrayList() 25 | } 26 | 27 | private val mContext: Context 28 | init { 29 | myFolderSong = folders 30 | mContext = context 31 | } 32 | 33 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): FolderHolder { 34 | val view = LayoutInflater.from(context).inflate(R.layout.folder_item, parent, false) 35 | return FolderHolder(view, itemClicked) 36 | } 37 | 38 | override fun getItemCount(): Int { 39 | return folders.size 40 | } 41 | 42 | override fun onBindViewHolder(holder: MyFolderAdapter.FolderHolder, position: Int) { 43 | return holder.bindFolder(folders[position]) 44 | } 45 | 46 | inner class FolderHolder(itemView: View?, val itemClicked: (SongInfo) -> Unit) : RecyclerView.ViewHolder(itemView!!) { 47 | private var folderTitle = itemView?.findViewById(R.id.folderName) 48 | private var folderAddress = itemView?.findViewById(R.id.folderAddres) 49 | 50 | fun bindFolder(songInfo:SongInfo) { 51 | folderTitle?.text = songInfo.Title 52 | folderAddress?.text = songInfo.Desc 53 | 54 | itemView.setOnClickListener { itemClicked(songInfo) 55 | changNameFolder = folderTitle?.text.toString() 56 | changAddressFolder = folderAddress?.text.toString() 57 | } 58 | } 59 | 60 | } 61 | 62 | 63 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/DataBase/DBManager.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.DataBase 2 | 3 | import android.content.ContentValues 4 | import android.content.Context 5 | import android.database.Cursor 6 | import android.database.sqlite.SQLiteDatabase 7 | import android.database.sqlite.SQLiteOpenHelper 8 | import android.database.sqlite.SQLiteQueryBuilder 9 | import android.widget.Toast 10 | 11 | class DBManager { 12 | 13 | val dbName = "LikeMusic" 14 | val dbTable = "TableLike" 15 | val colID = "ID" 16 | val colTitle = "Title" 17 | val colArtist = "Artist" 18 | val colSongUrl = "SongUrl" 19 | val colCover = "Cover" 20 | val dbVersion = 1 21 | 22 | val sqlCreateTable = "CREATE TABLE IF NOT EXISTS " + dbTable +" (" + colID + " INTEGER PRIMARY KEY, " + 23 | colTitle + " TEXT, " + colArtist + " TEXT, " + colSongUrl + " TEXT, " + colCover + " IMAGE);" 24 | 25 | var sqlDB:SQLiteDatabase? = null 26 | constructor(context: Context) { 27 | val db = DatabaseHelper(context) 28 | sqlDB = db.writableDatabase 29 | } 30 | 31 | inner class DatabaseHelper:SQLiteOpenHelper { 32 | 33 | var mContext:Context? = null 34 | constructor(context: Context):super(context, dbName, null, dbVersion) { 35 | this.mContext = context 36 | } 37 | 38 | override fun onCreate(db: SQLiteDatabase?) { 39 | db!!.execSQL(sqlCreateTable) 40 | } 41 | 42 | override fun onUpgrade(db: SQLiteDatabase?, oldVersion: Int, newVersion: Int) { 43 | db!!.execSQL("DROP TABLE IF EXISTS " + dbTable ) 44 | } 45 | 46 | } 47 | 48 | fun Insert(values:ContentValues): Long { 49 | val ID = sqlDB!!.insert(dbTable, "", values) 50 | return ID 51 | } 52 | 53 | fun Delete(selection: String, selectionArgs: Array): Int { 54 | val count = sqlDB!!.delete(dbTable, selection, selectionArgs) 55 | return count 56 | } 57 | 58 | fun RunQuery(columns:Array, selection:String, selectionArgs:Array,sortOrder:String): Cursor { 59 | val qb = SQLiteQueryBuilder() 60 | qb.tables = dbTable 61 | val cursor = qb.query(sqlDB,columns,selection,selectionArgs,null,null,sortOrder) 62 | return cursor 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | android { 6 | compileSdkVersion 30 7 | buildToolsVersion "29.0.3" 8 | 9 | compileOptions { 10 | sourceCompatibility JavaVersion.VERSION_1_8 11 | targetCompatibility JavaVersion.VERSION_1_8 12 | } 13 | 14 | defaultConfig { 15 | applicationId "com.SoheilHeydari.musicPlayer" 16 | minSdkVersion 21 17 | targetSdkVersion 30 18 | versionCode 1 19 | versionName "1.0" 20 | 21 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 22 | } 23 | 24 | buildTypes { 25 | release { 26 | minifyEnabled false 27 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 28 | } 29 | } 30 | 31 | } 32 | 33 | dependencies { 34 | implementation fileTree(dir: 'libs', include: ['*.jar']) 35 | //noinspection GradleDependency 36 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 37 | implementation 'androidx.appcompat:appcompat:1.3.1' 38 | implementation 'androidx.core:core-ktx:1.6.0' 39 | implementation 'androidx.constraintlayout:constraintlayout:2.1.0' 40 | implementation 'androidx.legacy:legacy-support-v4:1.0.0' 41 | //noinspection GradleCompatible 42 | implementation 'com.android.support:recyclerview-v7:28.0.0' 43 | 44 | testImplementation 'junit:junit:4.13.2' 45 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' 46 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 47 | 48 | implementation 'com.mikhaellopez:circularimageview:4.2.0' 49 | implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.4' 50 | implementation 'com.rishabhharit.roundedimageview:RoundedImageView:0.8.4' 51 | //noinspection GradleCompatible 52 | implementation 'com.android.support:design:28.0.0' 53 | //noinspection GradleCompatible 54 | implementation "com.android.support:support-compat:28.0.0" 55 | implementation 'com.squareup.picasso:picasso:2.71828' 56 | 57 | implementation 'com.github.bumptech.glide:glide:4.12.0' 58 | annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' 59 | implementation 'com.getkeepsafe.taptargetview:taptargetview:1.13.0' 60 | implementation 'com.eightbitlab:blurview:1.6.5' 61 | //++services 62 | implementation 'androidx.media:media:1.4.1' 63 | 64 | } 65 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Ui/FolderActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Ui 2 | 3 | import android.annotation.SuppressLint 4 | import androidx.appcompat.app.AppCompatActivity 5 | import android.os.Bundle 6 | import android.provider.MediaStore 7 | import androidx.recyclerview.widget.GridLayoutManager 8 | import androidx.recyclerview.widget.RecyclerView 9 | import com.example.musicPlayer.Helper.* 10 | import com.example.musicPlayer.Models.SongInfo 11 | import com.example.musicPlayer.R 12 | import kotlinx.android.synthetic.main.activity_folder.* 13 | import kotlinx.android.synthetic.main.activity_play.* 14 | import java.lang.Exception 15 | 16 | class FolderActivity : AppCompatActivity() { 17 | 18 | private lateinit var recyclerFolder: RecyclerView 19 | 20 | @SuppressLint("CutPasteId") 21 | override fun onCreate(savedInstanceState: Bundle?) { 22 | super.onCreate(savedInstanceState) 23 | setContentView(R.layout.activity_folder) 24 | 25 | textFolderName.text = changNameFolder 26 | textAddressFolder.text = changAddressFolder 27 | 28 | recyclerFolder = findViewById(R.id.listMusicFolder) 29 | 30 | recyclerFolder.apply { 31 | setHasFixedSize(true) 32 | layoutManager = GridLayoutManager(this@FolderActivity,1) 33 | } 34 | 35 | MainActivity.Cover = findViewById(R.id.coverNavar) 36 | 37 | val allMusicFolder = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI 38 | val sortOrder = MediaStore.Audio.Media.TITLE + " ASC" 39 | val cursor = this.contentResolver.query(allMusicFolder,null,null,null,sortOrder) 40 | val listOfMusicFolder= ArrayList() 41 | 42 | if (cursor != null) { 43 | if (cursor.moveToFirst()) { 44 | do { 45 | @Suppress("DEPRECATION") 46 | val songFolderURL = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA)) 47 | val songFolderDesc = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)) 48 | val songFolderName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TITLE)) 49 | val cover = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TRACK)) 50 | 51 | try { 52 | listOfMusicFolder.add( 53 | SongInfo( 54 | songFolderName, 55 | songFolderDesc, 56 | songFolderURL, 57 | cover 58 | ) 59 | ) 60 | } 61 | catch (e:Exception){ } 62 | 63 | }while (cursor.moveToNext()) 64 | } 65 | cursor.close() 66 | 67 | val songFolderList = findViewById(R.id.listMusicFolder) 68 | songFolderList.adapter = MyMusicFolderAp(this.applicationContext, listOfMusicFolder) 69 | 70 | } 71 | } 72 | 73 | 74 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_track.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 17 | 18 | 19 | 31 | 32 | 41 | 42 | 43 | 44 | 45 | 46 | 53 | 54 | 64 | 65 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 21 | 25 | 29 | 30 | 31 | 32 | 35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 49 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /app/src/main/res/layout/folder_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 18 | 19 | 20 | 28 | 29 | 30 | 37 | 38 | 55 | 56 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Ui/Controllers/FragmentFolders.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Ui.Controllers 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Intent 5 | import android.os.Bundle 6 | import android.provider.MediaStore 7 | import androidx.fragment.app.Fragment 8 | import android.view.LayoutInflater 9 | import android.view.View 10 | import android.view.ViewGroup 11 | import androidx.recyclerview.widget.GridLayoutManager 12 | import androidx.recyclerview.widget.RecyclerView 13 | import com.example.musicPlayer.Helper.MyFolderAdapter 14 | import com.example.musicPlayer.Ui.FolderActivity 15 | import com.example.musicPlayer.Models.SongInfo 16 | import com.example.musicPlayer.R 17 | 18 | @Suppress("DEPRECATION") 19 | class FragmentFolders : Fragment() { 20 | 21 | private lateinit var recyclerFolder: RecyclerView 22 | 23 | @SuppressLint("CutPasteId", "Recycle") 24 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 25 | 26 | // Inflate the layout for this fragment 27 | val view = inflater.inflate(R.layout.fragment_folder, container, false) 28 | 29 | recyclerFolder = view.findViewById(R.id.ReciycleViewFolder) 30 | recyclerFolder.apply { 31 | setHasFixedSize(true) 32 | layoutManager = GridLayoutManager(activity,1) 33 | } 34 | 35 | val allFolder = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI 36 | val selection = MediaStore.Audio.AudioColumns.TRACK 37 | val sortOrder = MediaStore.Audio.AudioColumns.TITLE + " ASC" 38 | val cursor = requireActivity().contentResolver.query(allFolder,null,selection,null,sortOrder) 39 | val listOfFolders = ArrayList() 40 | 41 | if (cursor != null) { 42 | if (cursor.moveToFirst()) { 43 | do { 44 | @Suppress("DEPRECATION") 45 | val folderURL = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.AudioColumns.DATA)) 46 | val folderDesc = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.AudioColumns.DATA)) 47 | val folderName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.AudioColumns.TITLE)) 48 | val folderIcon = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.AudioColumns.ALBUM)) 49 | 50 | try { 51 | listOfFolders.add( 52 | SongInfo( 53 | folderName, 54 | folderDesc, 55 | folderURL, 56 | folderIcon 57 | ) 58 | ) 59 | } 60 | catch (e:Exception){} 61 | 62 | } while (cursor.moveToNext()) 63 | } 64 | cursor.close() 65 | 66 | val folderList = view.findViewById(R.id.ReciycleViewFolder) 67 | folderList.adapter = MyFolderAdapter(requireActivity().applicationContext, listOfFolders){ 68 | val intent = Intent(context, FolderActivity::class.java) 69 | startActivity(intent) 70 | } 71 | } 72 | 73 | return view 74 | } 75 | 76 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Helper/MyMusicAlbumAd.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Helper 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Context 5 | import android.graphics.Color 6 | import android.media.MediaPlayer 7 | import android.view.LayoutInflater 8 | import android.view.View 9 | import android.view.ViewGroup 10 | import android.widget.BaseAdapter 11 | import android.widget.LinearLayout 12 | import android.widget.TextView 13 | import com.example.musicPlayer.Ui.AlbumActivity 14 | import com.example.musicPlayer.Ui.MainActivity 15 | import com.example.musicPlayer.Models.SongInfo 16 | import com.example.musicPlayer.R 17 | 18 | //ToDo this fixes Music album adapter 19 | 20 | class MyMusicAlbumAd (context: Context, myListSong: ArrayList) : BaseAdapter() { 21 | 22 | companion object { 23 | var TextTrack: TextView? = null 24 | var ItemMusic: LinearLayout? = null 25 | var myListSongAlbum = ArrayList() 26 | } 27 | 28 | private val mContext: Context 29 | init { 30 | myListSongAlbum = myListSong 31 | mContext = context 32 | } 33 | 34 | @SuppressLint("ViewHolder", "CutPasteId") 35 | override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View { 36 | 37 | val layoutInflate = LayoutInflater.from(mContext) 38 | val myView = layoutInflate.inflate(R.layout.music_album_item,parent,false) 39 | val song = myListSongAlbum[position] 40 | // val image = myListSongAlbum[position].getpach()?.let { getSongArt(it) } 41 | 42 | TextTrack = myView.findViewById(R.id.textNameTrack) 43 | ItemMusic = myView.findViewById(R.id.PlayAlbum) 44 | TextTrack?.text = song.Title 45 | 46 | if (mediaPlayer == null) 47 | mediaPlayer = MediaPlayer() 48 | 49 | ItemMusic?.setOnClickListener { 50 | mediaPlayer!!.reset() 51 | mediaPlayer!!.setDataSource(song.SongURL) 52 | mediaPlayer!!.prepare() 53 | mediaPlayer!!.start() 54 | 55 | myView.findViewById(R.id.textNameTrack).setTextColor(Color.parseColor("#13f8d1")) 56 | myView.findViewById(R.id.textNameTrack).isSelected = true 57 | songe = song 58 | 59 | changTextTitle = myView.findViewById(R.id.textNameTrack).text.toString() 60 | changTextArtist = AlbumActivity.artistAlbum?.text.toString() 61 | changeCover = changeCoverAlbum 62 | 63 | MainActivity.TitleN?.text = changTextTitle 64 | MainActivity.ArtistN?.text = changTextArtist 65 | MainActivity.PlayN?.setImageResource(R.drawable.ic_round_pause) 66 | } 67 | return myView 68 | 69 | } 70 | 71 | override fun getItem(position: Int): Any { 72 | return myListSongAlbum[position] 73 | } 74 | 75 | override fun getItemId(position: Int): Long { 76 | return position.toLong() 77 | } 78 | 79 | override fun getCount(): Int { 80 | return myListSongAlbum.size 81 | } 82 | 83 | // private fun getSongArt(uri: String): ByteArray? { 84 | // val retrever = MediaMetadataRetriever() 85 | // retrever.setDataSource(uri) 86 | // val art: ByteArray? = retrever.embeddedPicture 87 | // retrever.release() 88 | // return art 89 | // } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Ui/AboutActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Ui 2 | 3 | import android.annotation.SuppressLint 4 | import android.app.NotificationChannel 5 | import android.app.NotificationManager 6 | import android.content.Context 7 | import android.content.Intent 8 | import android.graphics.BitmapFactory 9 | import android.net.Uri 10 | import android.os.Build 11 | import androidx.appcompat.app.AppCompatActivity 12 | import android.os.Bundle 13 | import android.view.animation.AnimationUtils 14 | import androidx.annotation.RequiresApi 15 | import androidx.cardview.widget.CardView 16 | import androidx.core.app.NotificationCompat 17 | import com.example.musicPlayer.R 18 | import kotlinx.android.synthetic.main.activity_about.* 19 | 20 | class AboutActivity : AppCompatActivity() { 21 | 22 | private lateinit var notification: NotificationCompat.Builder 23 | private lateinit var manage: NotificationManager 24 | private val channel = "notify" 25 | private lateinit var notificationChannel: NotificationChannel 26 | 27 | @RequiresApi(Build.VERSION_CODES.M) 28 | @SuppressLint("ServiceCast", "ResourceAsColor") 29 | override fun onCreate(savedInstanceState: Bundle?) { 30 | super.onCreate(savedInstanceState) 31 | setContentView(R.layout.activity_about) 32 | 33 | //notification 34 | manage = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager 35 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { 36 | notificationChannel = NotificationChannel(channel, "notify", NotificationManager.IMPORTANCE_HIGH) 37 | manage.createNotificationChannel(notificationChannel) 38 | } 39 | 40 | notification = NotificationCompat.Builder(this, channel) 41 | .setContentTitle(textView2.text) 42 | .setContentText(textView9.text) 43 | .setSmallIcon(R.drawable.ic_baseline_music_note_24) 44 | .setLargeIcon(BitmapFactory.decodeResource(resources, R.drawable.pause)) 45 | .setAutoCancel(true) 46 | .setColor(getColor(R.color.colorTheme)) 47 | .addAction(R.drawable.ic_round_previous, "previous", null) 48 | .addAction(R.drawable.ic_round_pause, "play", null) 49 | .addAction(R.drawable.ic_round_next, "next", null) 50 | 51 | imageView.setOnClickListener { 52 | manage.notify("media", 1, notification.build()) 53 | } 54 | 55 | //click 56 | cardViewLinkedinMe.setOnClickListener { 57 | goToUrl("https://www.linkedin.com/in/soheil-heydari/") 58 | animationBlur(cardViewLinkedinMe) 59 | } 60 | 61 | cardViewGithub.setOnClickListener { 62 | goToUrl("https://github.com/soheilheydari21") 63 | animationBlur(cardViewGithub) 64 | } 65 | 66 | cardViewSupporters.setOnClickListener { 67 | goToUrl("https://www.linkedin.com/in/mohammadkhoddami/") 68 | animationBlur(cardViewSupporters) 69 | } 70 | 71 | } 72 | 73 | private fun goToUrl(open:String) { 74 | val uri:Uri = Uri.parse(open) 75 | startActivity(Intent(Intent.ACTION_VIEW, uri)) 76 | } 77 | 78 | private fun animationBlur(cardView: CardView) { 79 | val animScale = AnimationUtils.loadAnimation(this, R.anim.anim_backward) 80 | cardView.startAnimation(animScale) 81 | } 82 | 83 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Helper/MyAlbumAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Helper 2 | 3 | import android.content.Context 4 | import android.media.MediaMetadataRetriever 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import android.widget.ImageView 9 | import android.widget.TextView 10 | import androidx.recyclerview.widget.RecyclerView 11 | import com.bumptech.glide.Glide 12 | import com.example.musicPlayer.Models.AlbumInfo 13 | import com.example.musicPlayer.R 14 | 15 | //ToDo this fixes Album adapter 16 | 17 | var changTextAlbum = "Title" 18 | var changTextArtistAlbum = "Artist" 19 | var changeCoverAlbum: ByteArray? = null 20 | 21 | class MyAlbumAdapter( 22 | val context: Context, 23 | private val albums: ArrayList, 24 | private val itemClicked: (AlbumInfo) -> Unit 25 | ) : RecyclerView.Adapter() { 26 | 27 | companion object { 28 | var myAlbumSong = ArrayList() 29 | } 30 | 31 | private val mContext: Context 32 | init { 33 | myAlbumSong = albums 34 | mContext = context 35 | } 36 | 37 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AlbumHolder { 38 | val view = LayoutInflater.from(context).inflate(R.layout.allbum_item, parent, false) 39 | return AlbumHolder(view, itemClicked) 40 | } 41 | 42 | override fun getItemCount(): Int { 43 | return albums.size 44 | } 45 | 46 | override fun onBindViewHolder(holder: MyAlbumAdapter.AlbumHolder, position: Int) { 47 | return holder.bindAlbum(albums[position], position) 48 | } 49 | 50 | inner class AlbumHolder(itemView: View?, val itemClicked: (AlbumInfo) -> Unit) : RecyclerView.ViewHolder(itemView!!) { 51 | private var setAlbumTwo = itemView?.findViewById(R.id.imageViewCoverAllbum2) 52 | private var albumTitle = itemView?.findViewById(R.id.textViewTitleAllbum) 53 | private var albumArtist = itemView?.findViewById(R.id.textViewArtistAllbum) 54 | 55 | fun bindAlbum(albumInfo:AlbumInfo, position: Int) { 56 | albumTitle?.text = albumInfo.title 57 | albumArtist?.text = albumInfo.artist 58 | 59 | //cover 60 | val image = albums[position].getpach()?.let { getAlbumArt(it) } 61 | if(image != null) { 62 | setAlbumTwo?.let { 63 | Glide.with(mContext).asBitmap() 64 | .load(image) 65 | .into(it) 66 | } 67 | } 68 | else { 69 | setAlbumTwo?.let { 70 | Glide.with(mContext) 71 | .load(R.drawable.coverrrl) 72 | .into(it) 73 | } 74 | } 75 | 76 | itemView.setOnClickListener { itemClicked(albumInfo) 77 | changTextAlbum = albumTitle?.text.toString() 78 | changTextArtistAlbum = albumArtist?.text.toString() 79 | changeCoverAlbum = image 80 | } 81 | } 82 | 83 | 84 | } 85 | 86 | //cover 87 | private fun getAlbumArt(uri: String): ByteArray? { 88 | val retrever = MediaMetadataRetriever() 89 | retrever.setDataSource(uri) 90 | val art: ByteArray? = retrever.embeddedPicture 91 | retrever.release() 92 | return art 93 | } 94 | 95 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_spalshscreen.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 21 | 22 | 41 | 42 | 50 | 51 | 64 | 65 | 71 | 72 | 78 | 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Ui/AlbumActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Ui 2 | 3 | import android.annotation.SuppressLint 4 | import androidx.appcompat.app.AppCompatActivity 5 | import android.os.Bundle 6 | import android.provider.MediaStore 7 | import android.widget.ImageView 8 | import android.widget.ListView 9 | import android.widget.TextView 10 | import com.bumptech.glide.Glide 11 | import com.example.musicPlayer.Helper.* 12 | import com.example.musicPlayer.Models.SongInfo 13 | import com.example.musicPlayer.R 14 | import kotlinx.android.synthetic.main.activity_album.* 15 | 16 | class AlbumActivity : AppCompatActivity() { 17 | 18 | companion object{ 19 | @SuppressLint("StaticFieldLeak") 20 | var artistAlbum:TextView? = null 21 | @SuppressLint("StaticFieldLeak") 22 | var imageAlbum:ImageView? = null 23 | } 24 | 25 | @SuppressLint("Recycle") 26 | override fun onCreate(savedInstanceState: Bundle?) { 27 | super.onCreate(savedInstanceState) 28 | setContentView(R.layout.activity_album) 29 | 30 | artistAlbum = findViewById(R.id.textArtistAlbum) 31 | imageAlbum = findViewById(R.id.imageViewCoverAlbum) 32 | 33 | textAlbumName.text = changTextAlbum 34 | artistAlbum?.text = changTextArtistAlbum 35 | 36 | setCoverAlbumActivity() 37 | 38 | val allSongAlbum = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI 39 | val selection = MediaStore.Audio.Media.IS_MUSIC + "!= 0" 40 | val sortOrder = MediaStore.Audio.Media.TITLE + " ASC" 41 | val cursor = this.contentResolver.query(allSongAlbum,null,selection,null,sortOrder) 42 | val listOfMusicAlbum = ArrayList() 43 | 44 | if (cursor != null) { 45 | if (cursor.moveToFirst()) { 46 | do { 47 | @Suppress("DEPRECATION") 48 | val songAlbumURL = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA)) 49 | val songAlbumDesc = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)) 50 | val songAlbumName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TITLE)) 51 | val cover = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM_ID)) 52 | 53 | try { 54 | listOfMusicAlbum.add( 55 | SongInfo( 56 | songAlbumName, 57 | songAlbumDesc, 58 | songAlbumURL, 59 | cover 60 | ) 61 | ) 62 | } 63 | catch (e:Exception){ } 64 | 65 | }while (cursor.moveToNext()) 66 | } 67 | cursor.close() 68 | 69 | val songAlbumList = findViewById(R.id.listViewAlbum) 70 | songAlbumList.adapter = MyMusicAlbumAd(this.applicationContext, listOfMusicAlbum) 71 | 72 | } 73 | 74 | } 75 | 76 | private fun setCoverAlbumActivity() { 77 | if (changeCoverAlbum != null) { 78 | Glide.with(this).asBitmap() 79 | .load(changeCoverAlbum) 80 | .into(imageViewCoverAlbum) 81 | } 82 | else { 83 | Glide.with(this) 84 | .load(R.drawable.coverrrl) 85 | .into(imageViewCoverAlbum) 86 | } 87 | } 88 | 89 | 90 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Ui/Controllers/FragmentAlbums.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Ui.Controllers 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Intent 5 | import android.os.Bundle 6 | import android.provider.MediaStore 7 | import androidx.fragment.app.Fragment 8 | import android.view.LayoutInflater 9 | import android.view.View 10 | import android.view.ViewGroup 11 | import androidx.recyclerview.widget.GridLayoutManager 12 | import androidx.recyclerview.widget.RecyclerView 13 | import com.example.musicPlayer.Ui.AlbumActivity 14 | import com.example.musicPlayer.Helper.MyAlbumAdapter 15 | import com.example.musicPlayer.Models.AlbumInfo 16 | import com.example.musicPlayer.R 17 | 18 | 19 | class FragmentAlbums : Fragment() { 20 | 21 | private lateinit var recyclerAlbum:RecyclerView 22 | lateinit var adapter : MyAlbumAdapter 23 | 24 | @SuppressLint("CutPasteId", "Recycle") 25 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 26 | 27 | // Inflate the layout for this fragment 28 | val view = inflater.inflate(R.layout.fragment_album, container, false) 29 | 30 | recyclerAlbum = view.findViewById(R.id.ReciycleViewAlbum) 31 | recyclerAlbum.apply { 32 | setHasFixedSize(true) 33 | layoutManager = GridLayoutManager(activity,2) 34 | } 35 | 36 | val allAlbum = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI 37 | val selection = MediaStore.Audio.Media.ALBUM + "!= 0" 38 | val sortOrder = MediaStore.Audio.Media.TITLE + " ASC" 39 | val cursor = requireActivity().contentResolver.query(allAlbum,null,selection,null,sortOrder) 40 | val listOfAlbum = ArrayList() 41 | 42 | if (cursor != null) { 43 | if (cursor.moveToFirst()) { 44 | do { 45 | @Suppress("DEPRECATION") 46 | val albumURL = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA)) 47 | val albumDesc = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)) 48 | val albumName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM)) 49 | val album = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM)) 50 | val album2 = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM)) 51 | val album3 = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM)) 52 | 53 | try { 54 | listOfAlbum.add( 55 | AlbumInfo( 56 | album, 57 | album2, 58 | album3, 59 | albumName, 60 | albumDesc, 61 | albumURL 62 | ) 63 | ) 64 | } 65 | catch (e:Exception){ } 66 | 67 | } while (cursor.moveToNext()) 68 | } 69 | cursor.close() 70 | 71 | val albumList = view.findViewById(R.id.ReciycleViewAlbum) 72 | albumList.adapter = MyAlbumAdapter(requireActivity().applicationContext, listOfAlbum){ 73 | val intent = Intent(context, AlbumActivity::class.java) 74 | startActivity(intent) 75 | } 76 | 77 | } 78 | return view 79 | 80 | } 81 | 82 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/recent_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 21 | 22 | 39 | 40 | 56 | 57 | 58 | 59 | 67 | 68 | 79 | 80 | -------------------------------------------------------------------------------- /app/src/main/res/layout/allbum_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | 17 | 26 | 27 | 45 | 46 | 61 | 62 | 63 | 71 | 72 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /app/src/main/res/layout/music_widget.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 18 | 19 | 32 | 33 | 47 | 48 | 58 | 59 | 68 | 69 | 78 | 79 | 88 | 89 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | xmlns:android 17 | 18 | ^$ 19 | 20 | 21 | 22 |
23 |
24 | 25 | 26 | 27 | xmlns:.* 28 | 29 | ^$ 30 | 31 | 32 | BY_NAME 33 | 34 |
35 |
36 | 37 | 38 | 39 | .*:id 40 | 41 | http://schemas.android.com/apk/res/android 42 | 43 | 44 | 45 |
46 |
47 | 48 | 49 | 50 | .*:name 51 | 52 | http://schemas.android.com/apk/res/android 53 | 54 | 55 | 56 |
57 |
58 | 59 | 60 | 61 | name 62 | 63 | ^$ 64 | 65 | 66 | 67 |
68 |
69 | 70 | 71 | 72 | style 73 | 74 | ^$ 75 | 76 | 77 | 78 |
79 |
80 | 81 | 82 | 83 | .* 84 | 85 | ^$ 86 | 87 | 88 | BY_NAME 89 | 90 |
91 |
92 | 93 | 94 | 95 | .* 96 | 97 | http://schemas.android.com/apk/res/android 98 | 99 | 100 | ANDROID_ATTRIBUTE_ORDER 101 | 102 |
103 |
104 | 105 | 106 | 107 | .* 108 | 109 | .* 110 | 111 | 112 | BY_NAME 113 | 114 |
115 |
116 |
117 |
118 | 119 | 121 |
122 |
-------------------------------------------------------------------------------- /app/src/main/res/layout-land/activity_album.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 25 | 26 | 43 | 44 | 61 | 62 | 72 | 73 | 83 | 84 | 85 | 91 | 92 | 98 | 99 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_album.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 26 | 27 | 43 | 44 | 61 | 62 | 72 | 73 | 83 | 84 | 85 | 91 | 92 | 98 | 99 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 23 | 24 | 40 | 41 | 58 | 59 | 68 | 69 | 76 | 77 | 78 | 79 | 85 | 86 | 92 | 93 | 99 | 100 | -------------------------------------------------------------------------------- /app/src/main/res/layout-land/activity_folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 25 | 26 | 43 | 44 | 61 | 62 | 71 | 72 | 82 | 83 | 84 | 85 | 91 | 92 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /app/src/main/res/layout/track_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 24 | 25 | 26 | 48 | 49 | 71 | 72 | 73 | 74 | 75 | 83 | 84 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 34 | 35 | 44 | 45 | 55 | 56 | 64 | 65 | 75 | 76 | 82 | 83 | 84 | 94 | 95 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Helper/MyRecentlyAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Helper 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Context 5 | import android.graphics.Color 6 | import android.media.MediaMetadataRetriever 7 | import android.media.MediaPlayer 8 | import android.view.LayoutInflater 9 | import android.view.View 10 | import android.view.ViewGroup 11 | import android.view.animation.AnimationUtils 12 | import android.widget.ImageView 13 | import android.widget.TextView 14 | import androidx.constraintlayout.widget.ConstraintLayout 15 | import androidx.recyclerview.widget.RecyclerView 16 | import com.bumptech.glide.Glide 17 | import com.example.musicPlayer.Ui.MainActivity 18 | import com.example.musicPlayer.Models.SongInfo 19 | import com.example.musicPlayer.R 20 | import kotlinx.android.synthetic.main.recent_item.view.* 21 | import kotlin.collections.ArrayList 22 | 23 | 24 | class MyRecentlyAdapter( 25 | context: Context, 26 | myListSong: ArrayList 27 | ) : RecyclerView.Adapter() { 28 | 29 | companion object { 30 | var myListSong = ArrayList() 31 | var TextTitle: TextView? = null 32 | var TextArtist: TextView? = null 33 | } 34 | 35 | private val mContext: Context 36 | init { 37 | MyRecentlyAdapter.myListSong = myListSong 38 | myListSong.reverse() 39 | mContext = context 40 | } 41 | 42 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SongHolder { 43 | val view = LayoutInflater.from(mContext).inflate(R.layout.recent_item, parent, false) 44 | return SongHolder(view) 45 | } 46 | 47 | override fun getItemCount(): Int { 48 | return myListSong.size 49 | } 50 | 51 | override fun onBindViewHolder(holder: MyRecentlyAdapter.SongHolder, position: Int) { 52 | return holder.bindMusic(myListSong[position], position) 53 | } 54 | 55 | inner class SongHolder(itemView: View?): RecyclerView.ViewHolder(itemView!!) { 56 | private val setCover = itemView?.findViewById(R.id.coverMusic) 57 | private val songTitle = itemView?.findViewById(R.id.textViewTitleRecent) 58 | private val songArtist = itemView?.findViewById(R.id.textViewDescRecent) 59 | private val itemMusic = itemView?.findViewById(R.id.PlayMusic) 60 | 61 | @SuppressLint("ResourceType") 62 | fun bindMusic(songInfo: SongInfo, position: Int) { 63 | songTitle?.text = songInfo.Title 64 | songArtist?.text = songInfo.Desc 65 | 66 | //cover 67 | val image = myListSong[position].getpach()?.let { getSongArt(it) } 68 | if(image != null) { 69 | setCover?.let { 70 | Glide.with(mContext).asBitmap() 71 | .load(image) 72 | .into(it) 73 | } 74 | } 75 | else { 76 | setCover?.let { 77 | Glide.with(mContext) 78 | .load(R.drawable.coverrrl) 79 | .into(it) 80 | } 81 | } 82 | 83 | if (mediaPlayer == null) 84 | mediaPlayer = MediaPlayer() 85 | 86 | //ToDo this fixes Item color click 87 | itemView.setOnClickListener { 88 | mediaPlayer!!.reset() 89 | mediaPlayer!!.setDataSource(songInfo.SongURL) 90 | mediaPlayer!!.prepare() 91 | mediaPlayer!!.start() 92 | animationItem() 93 | 94 | itemView.textViewDescRecent.setTextColor(Color.parseColor("#00d6b3")) 95 | itemView.textViewTitleRecent.setTextColor(Color.parseColor("#13f8d1")) 96 | changTextTitle = itemView.textViewTitleRecent.text.toString() 97 | changTextArtist = itemView.textViewDescRecent.text.toString() 98 | changeCover = image 99 | 100 | MainActivity.TitleN?.text = changTextTitle 101 | MainActivity.ArtistN?.text = changTextArtist 102 | MainActivity.PlayN?.setImageResource(R.drawable.ic_round_pause) 103 | 104 | if (image != null) { 105 | MainActivity.Cover?.let { it1 -> Glide.with(mContext).load(image).into(it1) } 106 | MainActivity.backNavar?.let { it1 -> Glide.with(mContext).load(image).into(it1) } 107 | } 108 | else { 109 | MainActivity.Cover?.let { it1 -> Glide.with(mContext).load(R.drawable.coverrrl).into(it1) } 110 | MainActivity.backNavar?.let { it1 -> Glide.with(mContext).load(R.drawable.back_navar_music).into(it1) } 111 | } 112 | 113 | songe = songInfo 114 | } 115 | } 116 | 117 | private fun animationItem() { 118 | val animScale = AnimationUtils.loadAnimation(mContext, R.anim.anim_pause) 119 | itemMusic?.startAnimation(animScale) 120 | } 121 | 122 | } 123 | 124 | //cover 125 | private fun getSongArt(uri: String): ByteArray? { 126 | val retrever = MediaMetadataRetriever() 127 | retrever.setDataSource(uri) 128 | val art: ByteArray? = retrever.embeddedPicture 129 | retrever.release() 130 | return art 131 | } 132 | 133 | 134 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Ui/SearchActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Ui 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Intent 5 | import android.os.Bundle 6 | import android.provider.MediaStore 7 | import android.text.Editable 8 | import android.text.TextWatcher 9 | import android.view.View.GONE 10 | import android.view.View.VISIBLE 11 | import android.view.animation.AnimationUtils 12 | import android.widget.EditText 13 | import androidx.appcompat.app.AppCompatActivity 14 | import androidx.recyclerview.widget.GridLayoutManager 15 | import androidx.recyclerview.widget.LinearLayoutManager 16 | import androidx.recyclerview.widget.RecyclerView 17 | import com.example.musicPlayer.Helper.MySearchAdapter 18 | import com.example.musicPlayer.Models.SongInfo 19 | import com.example.musicPlayer.R 20 | import kotlinx.android.synthetic.main.activity_search.* 21 | 22 | 23 | @Suppress("SENSELESS_COMPARISON") 24 | class SearchActivity : AppCompatActivity() { 25 | 26 | private var listOfSearches = ArrayList() 27 | private lateinit var recyclerSearch: RecyclerView 28 | private var adapterSearch = MySearchAdapter(this, listOfSearches) 29 | private lateinit var mLayoutManager:RecyclerView.LayoutManager 30 | 31 | @SuppressLint("CutPasteId") 32 | override fun onCreate(savedInstanceState: Bundle?) { 33 | super.onCreate(savedInstanceState) 34 | setContentView(R.layout.activity_search) 35 | 36 | backSearch.setOnClickListener { 37 | onBackPressed() 38 | animationBack() 39 | } 40 | 41 | val editTextSearch = findViewById(R.id.textBoxSearch) 42 | editTextSearch.addTextChangedListener(object : TextWatcher { 43 | override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) { } 44 | override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { } 45 | override fun afterTextChanged(s: Editable) { 46 | filter(s.toString()) 47 | adapterSearch.notifyDataSetChanged() 48 | 49 | if (s.count() >= 1) { 50 | layoutSongs.visibility = VISIBLE 51 | layoutSearch.visibility = GONE 52 | } 53 | else if (s.count() < 1) { 54 | layoutSongs.visibility = GONE 55 | layoutSearch.visibility = VISIBLE 56 | } 57 | 58 | } 59 | }) 60 | 61 | buildRecyclerView() 62 | 63 | recyclerSearch = findViewById(R.id.recyclerSearch) 64 | recyclerSearch.adapter = adapterSearch 65 | MainActivity.Cover = findViewById(R.id.coverNavar) 66 | 67 | val allSearch = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI 68 | val sortOrder = MediaStore.Audio.Media.TITLE + " ASC" 69 | val cursor = this.contentResolver.query(allSearch, null, null, null, sortOrder) 70 | 71 | if (cursor != null) { 72 | if (cursor.moveToFirst()) { 73 | do { 74 | @Suppress("DEPRECATION") 75 | val songURL = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA)) 76 | val songDesc = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)) 77 | val songName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TITLE)) 78 | val cover = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TRACK)) 79 | 80 | try { 81 | listOfSearches.add( 82 | SongInfo( 83 | songName, 84 | songDesc, 85 | songURL, 86 | cover 87 | ) 88 | ) 89 | } 90 | catch (e:Exception){ } 91 | 92 | } while (cursor.moveToNext()) 93 | } 94 | cursor.close() 95 | 96 | recyclerSearch.apply { 97 | setHasFixedSize(true) 98 | layoutManager = GridLayoutManager(this@SearchActivity, 1) 99 | } 100 | } 101 | } 102 | 103 | 104 | //SEARCH 105 | @SuppressLint("DefaultLocale") 106 | private fun filter(text: String) { 107 | val filteredList: ArrayList = ArrayList() 108 | for (item in listOfSearches) { 109 | if (item.gettitle()!!.toLowerCase().contains(text.toLowerCase()) || item.getdesc()!!.toLowerCase().contains(text.toLowerCase())) 110 | filteredList.add(item) 111 | } 112 | adapterSearch.filterList(filteredList) 113 | } 114 | 115 | private fun animationBack() { 116 | val animScale = AnimationUtils.loadAnimation(this, R.anim.anim_backward) 117 | backSearch.startAnimation(animScale) 118 | } 119 | 120 | override fun onBackPressed() { 121 | val intent = Intent(this, MainActivity::class.java) 122 | startActivity(intent) 123 | } 124 | 125 | private fun buildRecyclerView() { 126 | recyclerSearch = findViewById(R.id.recyclerSearch) 127 | recyclerSearch.setHasFixedSize(true) 128 | mLayoutManager = LinearLayoutManager(this) 129 | adapterSearch = MySearchAdapter(this,listOfSearches) 130 | recyclerSearch.layoutManager = mLayoutManager 131 | recyclerSearch.adapter = adapterSearch 132 | } 133 | 134 | 135 | } 136 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Ui/Controllers/FragmentTracks.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Ui.Controllers 2 | 3 | import android.annotation.SuppressLint 4 | import android.os.Bundle 5 | import android.provider.MediaStore 6 | import android.view.* 7 | import androidx.fragment.app.Fragment 8 | import android.widget.* 9 | import androidx.recyclerview.widget.GridLayoutManager 10 | import androidx.recyclerview.widget.LinearLayoutManager 11 | import androidx.recyclerview.widget.RecyclerView 12 | import com.example.musicPlayer.* 13 | import com.example.musicPlayer.Helper.* 14 | import com.example.musicPlayer.Models.SongInfo 15 | 16 | import kotlin.collections.ArrayList 17 | 18 | @Suppress("DEPRECATION") 19 | class FragmentTracks : Fragment() { 20 | 21 | private lateinit var recycleTrack:RecyclerView 22 | private lateinit var recycleRecent:RecyclerView 23 | 24 | companion object{ 25 | @SuppressLint("StaticFieldLeak") 26 | var musicAdapter:MyTrackAdapter? = null 27 | @SuppressLint("StaticFieldLeak") 28 | var coverList:ImageView? = null 29 | } 30 | 31 | @SuppressLint("WrongViewCast", "Recycle", "CutPasteId") 32 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 33 | 34 | // Inflate the layout for this fragment 35 | val view = inflater.inflate(R.layout.fragment_track, container, false) 36 | recycleTrack = view.findViewById(R.id.RecyclerViewTrack) 37 | recycleRecent = view.findViewById(R.id.RecyclerViewRecent) 38 | 39 | recycleTrack.apply { 40 | setHasFixedSize(true) 41 | layoutManager = GridLayoutManager(activity,1) 42 | } 43 | 44 | recycleRecent.apply { 45 | setHasFixedSize(true) 46 | layoutManager = GridLayoutManager(activity,1,LinearLayoutManager.HORIZONTAL,false) 47 | } 48 | 49 | //list music track 50 | val allSong = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI 51 | val sortOrder = MediaStore.Audio.Media.TITLE + " ASC" 52 | val cursor = requireActivity().contentResolver.query(allSong,null,null,null,sortOrder) 53 | val listOfSongs = ArrayList() 54 | 55 | if (cursor != null) { 56 | if (cursor.moveToFirst()) { 57 | do { 58 | @Suppress("DEPRECATION") 59 | val songURL = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA)) 60 | val songAuthor = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)) 61 | val songName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TITLE)) 62 | val cover = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TRACK)) 63 | 64 | try { 65 | listOfSongs.add( 66 | SongInfo( 67 | songName, 68 | songAuthor, 69 | songURL, 70 | cover 71 | ) 72 | ) 73 | } 74 | catch (e:Exception){ 75 | // Toast.makeText(context,e.message.toString(),Toast.LENGTH_LONG).show() 76 | } 77 | 78 | }while (cursor.moveToNext()) 79 | } 80 | cursor.close() 81 | 82 | val songList = view.findViewById(R.id.RecyclerViewTrack) 83 | songList.adapter = MyTrackAdapter(requireActivity().applicationContext, listOfSongs) 84 | 85 | } 86 | 87 | //list music recent 88 | val recentSong = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI 89 | val recentOrder = MediaStore.Audio.Media.DATE_ADDED 90 | val recentCursor = requireActivity().contentResolver.query(recentSong,null,null,null,recentOrder) 91 | val listOfRecently = ArrayList() 92 | 93 | if (recentCursor != null) { 94 | if (recentCursor.moveToFirst()) { 95 | do { 96 | @Suppress("DEPRECATION") 97 | val songURL = recentCursor.getString(recentCursor.getColumnIndex(MediaStore.Audio.Media.DATA)) 98 | val songAuthor = recentCursor.getString(recentCursor.getColumnIndex(MediaStore.Audio.Media.ARTIST)) 99 | val songName = recentCursor.getString(recentCursor.getColumnIndex(MediaStore.Audio.Media.TITLE)) 100 | val cover = recentCursor.getString(recentCursor.getColumnIndex(MediaStore.Audio.Media.TRACK)) 101 | 102 | try { 103 | listOfRecently.add( 104 | SongInfo( 105 | songName, 106 | songAuthor, 107 | songURL, 108 | cover 109 | ) 110 | ) 111 | } 112 | catch (e:Exception){ 113 | // Toast.makeText(context,e.message.toString(),Toast.LENGTH_LONG).show() 114 | } 115 | 116 | }while (recentCursor.moveToNext()) 117 | } 118 | recentCursor.close() 119 | 120 | val recentlyList = view.findViewById(R.id.RecyclerViewRecent) 121 | recentlyList.adapter = MyRecentlyAdapter(requireActivity().applicationContext, listOfRecently) 122 | 123 | } 124 | return view 125 | 126 | } 127 | 128 | 129 | } 130 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Helper/MyMusicFolderAp.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Helper 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Context 5 | import android.graphics.Color 6 | import android.media.MediaMetadataRetriever 7 | import android.media.MediaPlayer 8 | import android.view.LayoutInflater 9 | import android.view.View 10 | import android.view.ViewGroup 11 | import android.view.animation.AnimationUtils 12 | import android.widget.ImageView 13 | import android.widget.TextView 14 | import androidx.constraintlayout.widget.ConstraintLayout 15 | import androidx.recyclerview.widget.RecyclerView 16 | import com.bumptech.glide.Glide 17 | import com.example.musicPlayer.Ui.MainActivity 18 | import com.example.musicPlayer.Models.SongInfo 19 | import com.example.musicPlayer.R 20 | import kotlinx.android.synthetic.main.track_item.view.* 21 | 22 | //ToDo this fixes Music folder adapter 23 | 24 | class MyMusicFolderAp( 25 | val context: Context, 26 | myListSong: ArrayList 27 | ) : RecyclerView.Adapter() { 28 | 29 | companion object { 30 | var myListSongFolder = ArrayList() 31 | } 32 | 33 | private val mContext: Context 34 | init { 35 | myListSongFolder = myListSong 36 | mContext = context 37 | } 38 | 39 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SongHolder { 40 | val view = LayoutInflater.from(context).inflate(R.layout.track_item, parent, false) 41 | return SongHolder(view) 42 | } 43 | 44 | override fun getItemCount(): Int { 45 | return myListSongFolder.size 46 | } 47 | 48 | override fun onBindViewHolder(holder: MyMusicFolderAp.SongHolder, position: Int) { 49 | return holder.bindMusic(myListSongFolder[position], position) 50 | } 51 | 52 | inner class SongHolder(itemView: View?) : RecyclerView.ViewHolder(itemView!!) { 53 | 54 | private val layoutCover = itemView?.findViewById(R.id.layoutCover) 55 | private var setCover = itemView?.findViewById(R.id.coverMusic) 56 | private var songTitle = itemView?.findViewById(R.id.textViewTitle) 57 | private var songArtist = itemView?.findViewById(R.id.textViewDesc) 58 | private var itemMusic = itemView?.findViewById(R.id.PlayMusic) 59 | 60 | @SuppressLint("CutPasteId") 61 | fun bindMusic(songInfo: SongInfo, position: Int) { 62 | songTitle?.text = songInfo.Title 63 | songArtist?.text = songInfo.Desc 64 | 65 | //cover 66 | val image = myListSongFolder[position].getpach()?.let { getSongArt(it) } 67 | if (image != null) { 68 | setCover?.let { 69 | Glide.with(mContext).asBitmap() 70 | .load(image) 71 | .into(it) 72 | } 73 | } 74 | else { 75 | setCover?.let { 76 | Glide.with(mContext) 77 | .load(R.drawable.coverrrl) 78 | .into(it) 79 | } 80 | } 81 | 82 | if (mediaPlayer == null) 83 | mediaPlayer = MediaPlayer() 84 | 85 | itemView.setOnClickListener { 86 | mediaPlayer!!.reset() 87 | mediaPlayer!!.setDataSource(songInfo.SongURL) 88 | mediaPlayer!!.prepare() 89 | mediaPlayer!!.start() 90 | animationItem() 91 | animationCover() 92 | 93 | itemView.textViewDesc.setTextColor(Color.parseColor("#00d6b3")) 94 | itemView.textViewTitle.setTextColor(Color.parseColor("#13f8d1")) 95 | itemView.textViewDesc.isSelected = true 96 | itemView.textViewTitle.isSelected = true 97 | 98 | changTextTitle = itemView.textViewTitle.text.toString() 99 | changTextArtist = itemView.textViewDesc.text.toString() 100 | changeCover = image 101 | 102 | MainActivity.TitleN?.text = changTextTitle 103 | MainActivity.ArtistN?.text = changTextArtist 104 | MainActivity.PlayN?.setImageResource(R.drawable.ic_round_pause) 105 | 106 | if (image != null) { 107 | MainActivity.Cover?.let { it1 -> Glide.with(mContext).load(image).into(it1) } 108 | MainActivity.backNavar?.let { it1 -> Glide.with(mContext).load(image).into(it1) } 109 | } 110 | else { 111 | MainActivity.Cover?.let { it1 -> Glide.with(mContext).load(R.drawable.coverrrl).into(it1) } 112 | MainActivity.backNavar?.let { it1 -> Glide.with(mContext).load(R.drawable.back_navar_music).into(it1) } 113 | } 114 | 115 | songe = songInfo 116 | } 117 | } 118 | 119 | private fun animationItem() { 120 | val animScale = AnimationUtils.loadAnimation(mContext, R.anim.anim_pause) 121 | itemMusic?.startAnimation(animScale) 122 | } 123 | 124 | private fun animationCover() { 125 | val animScale = AnimationUtils.loadAnimation(mContext, R.anim.anim_pause) 126 | layoutCover?.startAnimation(animScale) 127 | } 128 | 129 | } 130 | 131 | //cover 132 | private fun getSongArt(uri: String): ByteArray? { 133 | val retrever = MediaMetadataRetriever() 134 | retrever.setDataSource(uri) 135 | val art: ByteArray? = retrever.embeddedPicture 136 | retrever.release() 137 | return art 138 | } 139 | 140 | 141 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Helper/MySearchAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Helper 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Context 5 | import android.graphics.Color 6 | import android.media.MediaMetadataRetriever 7 | import android.media.MediaPlayer 8 | import android.view.LayoutInflater 9 | import android.view.View 10 | import android.view.ViewGroup 11 | import android.view.animation.AnimationUtils 12 | import android.widget.ImageView 13 | import android.widget.TextView 14 | import androidx.constraintlayout.widget.ConstraintLayout 15 | import androidx.recyclerview.widget.RecyclerView 16 | import com.bumptech.glide.Glide 17 | import com.example.musicPlayer.Ui.MainActivity 18 | import com.example.musicPlayer.Models.SongInfo 19 | import com.example.musicPlayer.R 20 | import kotlinx.android.synthetic.main.track_item.view.* 21 | 22 | class MySearchAdapter( 23 | val context: Context, 24 | myListSearches: ArrayList 25 | ) : RecyclerView.Adapter() { 26 | 27 | var listOfSearches = ArrayList() 28 | 29 | private val mContext: Context 30 | init { 31 | listOfSearches = myListSearches 32 | mContext = context 33 | } 34 | 35 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SearchHolder { 36 | val view = LayoutInflater.from(context).inflate(R.layout.track_item, parent, false) 37 | return SearchHolder(view) 38 | } 39 | 40 | override fun getItemCount(): Int { 41 | return listOfSearches.size 42 | } 43 | 44 | override fun onBindViewHolder(holder: MySearchAdapter.SearchHolder, position: Int) { 45 | return holder.bindMusic(listOfSearches[position], position) 46 | } 47 | 48 | inner class SearchHolder(itemView: View?) : RecyclerView.ViewHolder(itemView!!) { 49 | 50 | private val layoutCover = itemView?.findViewById(R.id.layoutCover) 51 | private var setCover = itemView?.findViewById(R.id.coverMusic) 52 | private var songTitle = itemView?.findViewById(R.id.textViewTitle) 53 | private var songArtist = itemView?.findViewById(R.id.textViewDesc) 54 | private var itemMusic = itemView?.findViewById(R.id.PlayMusic) 55 | 56 | @SuppressLint("CutPasteId") 57 | fun bindMusic(songInfo: SongInfo, position: Int) { 58 | songTitle?.text = songInfo.Title 59 | songArtist?.text = songInfo.Desc 60 | 61 | //cover 62 | val image = listOfSearches[position].getpach()?.let { getSongArt(it) } 63 | if(image != null) { 64 | setCover?.let { 65 | Glide.with(mContext).asBitmap() 66 | .load(image) 67 | .into(it) 68 | } 69 | } 70 | else { 71 | setCover?.let { 72 | Glide.with(mContext) 73 | .load(R.drawable.coverrrl) 74 | .into(it) 75 | } 76 | } 77 | 78 | if (mediaPlayer == null) 79 | mediaPlayer = MediaPlayer() 80 | 81 | itemView.setOnClickListener { 82 | mediaPlayer!!.reset() 83 | mediaPlayer!!.setDataSource(songInfo.SongURL) 84 | mediaPlayer!!.prepare() 85 | mediaPlayer!!.start() 86 | animationItem() 87 | animationCover() 88 | 89 | itemView.textViewDesc.setTextColor(Color.parseColor("#00d6b3")) 90 | itemView.textViewTitle.setTextColor(Color.parseColor("#13f8d1")) 91 | itemView.textViewDesc.isSelected = true 92 | itemView.textViewTitle.isSelected = true 93 | 94 | changTextTitle = itemView.textViewTitle.text.toString() 95 | changTextArtist = itemView.textViewDesc.text.toString() 96 | changeCover = image 97 | 98 | MainActivity.TitleN?.text = changTextTitle 99 | MainActivity.ArtistN?.text = changTextArtist 100 | MainActivity.PlayN?.setImageResource(R.drawable.ic_round_pause) 101 | 102 | if (image != null) { 103 | MainActivity.Cover?.let { it1 -> Glide.with(mContext).load(image).into(it1) } 104 | MainActivity.backNavar?.let { it1 -> Glide.with(mContext).load(image).into(it1) } 105 | } 106 | else { 107 | MainActivity.Cover?.let { it1 -> Glide.with(mContext).load(R.drawable.coverrrl).into(it1) } 108 | MainActivity.backNavar?.let { it1 -> Glide.with(mContext).load(R.drawable.back_navar_music).into(it1) } 109 | } 110 | 111 | songe = songInfo 112 | } 113 | } 114 | 115 | private fun animationItem() { 116 | val animScale = AnimationUtils.loadAnimation(mContext, R.anim.anim_pause) 117 | itemMusic?.startAnimation(animScale) 118 | } 119 | 120 | private fun animationCover() { 121 | val animScale = AnimationUtils.loadAnimation(mContext, R.anim.anim_pause) 122 | layoutCover?.startAnimation(animScale) 123 | } 124 | 125 | } 126 | 127 | //cover 128 | private fun getSongArt(uri: String): ByteArray? { 129 | val retrever = MediaMetadataRetriever() 130 | retrever.setDataSource(uri) 131 | val art: ByteArray? = retrever.embeddedPicture 132 | retrever.release() 133 | return art 134 | } 135 | 136 | //SEARCH 137 | fun filterList(filteredList: ArrayList) { 138 | listOfSearches = filteredList 139 | notifyDataSetChanged() 140 | } 141 | 142 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Helper/MyTrackAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Helper 2 | 3 | 4 | import android.annotation.SuppressLint 5 | import android.content.Context 6 | import android.graphics.Color 7 | import android.media.MediaMetadataRetriever 8 | import android.media.MediaPlayer 9 | import android.view.LayoutInflater 10 | import android.view.View 11 | import android.view.ViewGroup 12 | import android.view.animation.AnimationUtils 13 | import android.widget.ImageView 14 | import android.widget.TextView 15 | import androidx.constraintlayout.widget.ConstraintLayout 16 | import androidx.recyclerview.widget.RecyclerView 17 | import com.bumptech.glide.Glide 18 | import com.example.musicPlayer.Ui.MainActivity 19 | import com.example.musicPlayer.Models.SongInfo 20 | import com.example.musicPlayer.R 21 | import kotlinx.android.synthetic.main.track_item.view.* 22 | 23 | 24 | var adapter: MyTrackAdapter? = null 25 | var mediaPlayer: MediaPlayer? = null 26 | var songe:SongInfo? = null 27 | var currentSongIndex = 0 28 | 29 | var changTextTitle = "Title" 30 | var changTextArtist = "Artist" 31 | var changeCover:ByteArray? = null 32 | 33 | @Suppress("DEPRECATION") 34 | class MyTrackAdapter( 35 | context: Context, 36 | myListSong: ArrayList 37 | ) : RecyclerView.Adapter() { 38 | 39 | companion object { 40 | var myListTrack = ArrayList() 41 | } 42 | 43 | private val mContext: Context 44 | init { 45 | myListTrack = myListSong 46 | mContext = context 47 | } 48 | 49 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SongHolder { 50 | val view = LayoutInflater.from(mContext).inflate(R.layout.track_item, parent, false) 51 | return SongHolder(view) 52 | } 53 | 54 | override fun getItemCount(): Int { 55 | return myListTrack.size 56 | } 57 | 58 | override fun onBindViewHolder(holder: MyTrackAdapter.SongHolder, position: Int) { 59 | return holder.bindMusic(myListTrack[position]) 60 | } 61 | 62 | inner class SongHolder(itemView: View?): RecyclerView.ViewHolder(itemView!!) { 63 | 64 | private val layoutCover = itemView?.findViewById(R.id.layoutCover) 65 | private val setCover = itemView?.findViewById(R.id.coverMusic) 66 | private val songTitle = itemView?.findViewById(R.id.textViewTitle) 67 | private val songArtist = itemView?.findViewById(R.id.textViewDesc) 68 | private val itemMusic = itemView?.findViewById(R.id.PlayMusic) 69 | 70 | @SuppressLint("ResourceType") 71 | fun bindMusic(songInfo:SongInfo) { 72 | songTitle?.text = songInfo.Title 73 | songArtist?.text = songInfo.Desc 74 | 75 | //cover 76 | val image = myListTrack[position].getpach()?.let { getSongArt(it) } 77 | if(image != null) { 78 | setCover?.let { 79 | Glide.with(mContext).asBitmap() 80 | .load(image) 81 | .into(it) 82 | } 83 | } 84 | else { 85 | setCover?.let { 86 | Glide.with(mContext) 87 | .load(R.drawable.coverrrl) 88 | .into(it) 89 | } 90 | } 91 | 92 | if (mediaPlayer == null) 93 | mediaPlayer = MediaPlayer() 94 | 95 | 96 | //ToDo this fixes Item color click 97 | itemView.setOnClickListener { 98 | mediaPlayer!!.reset() 99 | mediaPlayer!!.setDataSource(songInfo.SongURL) 100 | mediaPlayer!!.prepare() 101 | mediaPlayer!!.start() 102 | animationItem() 103 | animationCover() 104 | 105 | itemView.textViewDesc.setTextColor(Color.parseColor("#00d6b3")) 106 | itemView.textViewTitle.setTextColor(Color.parseColor("#13f8d1")) 107 | changTextTitle = itemView.textViewTitle.text.toString() 108 | changTextArtist = itemView.textViewDesc.text.toString() 109 | changeCover = image 110 | 111 | MainActivity.TitleN?.text = changTextTitle 112 | MainActivity.ArtistN?.text = changTextArtist 113 | MainActivity.PlayN?.setImageResource(R.drawable.ic_round_pause) 114 | 115 | if (image != null) { 116 | MainActivity.Cover?.let { it1 -> Glide.with(mContext).load(image).into(it1) } 117 | MainActivity.backNavar?.let { it1 -> Glide.with(mContext).load(image).into(it1) } 118 | } 119 | else { 120 | MainActivity.Cover?.let { it1 -> Glide.with(mContext).load(R.drawable.coverrrl).into(it1) } 121 | MainActivity.backNavar?.let { it1 -> Glide.with(mContext).load(R.drawable.back_navar_music).into(it1) } 122 | } 123 | 124 | songe = songInfo 125 | } 126 | 127 | } 128 | 129 | 130 | private fun animationItem() { 131 | val animScale = AnimationUtils.loadAnimation(mContext, R.anim.anim_pause) 132 | itemMusic?.startAnimation(animScale) 133 | } 134 | 135 | private fun animationCover() { 136 | val animScale = AnimationUtils.loadAnimation(mContext, R.anim.anim_pause) 137 | layoutCover?.startAnimation(animScale) 138 | } 139 | 140 | } 141 | 142 | //cover 143 | private fun getSongArt(uri: String): ByteArray? { 144 | val retriever = MediaMetadataRetriever() 145 | retriever.setDataSource(uri) 146 | val art: ByteArray? = retriever.embeddedPicture 147 | retriever.release() 148 | return art 149 | } 150 | 151 | 152 | } -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/musicPlayer/Services/MediaPlayerService.kt: -------------------------------------------------------------------------------- 1 | package com.example.musicPlayer.Services 2 | 3 | import android.R 4 | import android.app.NotificationManager 5 | import android.app.PendingIntent 6 | import android.app.Service 7 | import android.content.BroadcastReceiver 8 | import android.content.Context 9 | import android.content.Intent 10 | import android.content.IntentFilter 11 | import android.graphics.BitmapFactory 12 | import android.media.AudioManager 13 | import android.media.AudioManager.OnAudioFocusChangeListener 14 | import android.media.MediaPlayer 15 | import android.media.MediaPlayer.* 16 | import android.os.Binder 17 | import android.os.Build 18 | import android.os.IBinder 19 | import android.util.Log 20 | import androidx.annotation.RequiresApi 21 | import com.example.musicPlayer.Helper.mediaPlayer 22 | import com.example.musicPlayer.Models.SongInfo 23 | import java.io.IOException 24 | 25 | 26 | var mediaFile:SongInfo? = null 27 | private var resumePosition = 0 28 | private var audioManager: AudioManager? = null 29 | 30 | @Suppress("DEPRECATION") 31 | class MediaPlayerService : Service(), OnCompletionListener, OnPreparedListener, 32 | OnErrorListener, OnSeekCompleteListener, OnInfoListener, 33 | OnBufferingUpdateListener, OnAudioFocusChangeListener { 34 | 35 | // Binder given to clients 36 | private val iBinder: IBinder = LocalBinder() 37 | override fun onBind(intent: Intent?): IBinder { 38 | return iBinder 39 | } 40 | 41 | override fun onBufferingUpdate(mp: MediaPlayer, percent: Int) { 42 | //Invoked indicating buffering status of 43 | //a media resource being streamed over the network. 44 | } 45 | 46 | override fun onCompletion(mp: MediaPlayer?) { 47 | //Invoked when playback of a media source has completed. 48 | stopMedia() 49 | //stop the service 50 | stopSelf() 51 | } 52 | 53 | //Handle errors 54 | override fun onError(mp: MediaPlayer?, what: Int, extra: Int): Boolean { 55 | //Invoked when there has been an error during an asynchronous operation 56 | when (what) { 57 | MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK -> Log.d( 58 | "MediaPlayer Error", 59 | "MEDIA ERROR NOT VALID FOR PROGRESSIVE PLAYBACK $extra" 60 | ) 61 | MEDIA_ERROR_SERVER_DIED -> Log.d( 62 | "MediaPlayer Error", 63 | "MEDIA ERROR SERVER DIED $extra" 64 | ) 65 | MEDIA_ERROR_UNKNOWN -> Log.d("MediaPlayer Error", "MEDIA ERROR UNKNOWN $extra") 66 | } 67 | return false 68 | } 69 | 70 | override fun onInfo(mp: MediaPlayer, what: Int, extra: Int): Boolean { 71 | //Invoked to communicate some info. 72 | return false 73 | } 74 | 75 | override fun onPrepared(mp: MediaPlayer?) { 76 | //Invoked when the media source is ready for playback. 77 | playMedia() 78 | } 79 | 80 | override fun onSeekComplete(mp: MediaPlayer) { 81 | //Invoked indicating the completion of a seek operation. 82 | } 83 | 84 | override fun onAudioFocusChange(focusState: Int) { 85 | //Invoked when the audio focus of the system is updated. 86 | when (focusState) { 87 | AudioManager.AUDIOFOCUS_GAIN -> { 88 | // resume playback 89 | if (mediaPlayer == null) initMediaPlayer() else if (!mediaPlayer!!.isPlaying) mediaPlayer!!.start() 90 | mediaPlayer!!.setVolume(1.0f, 1.0f) 91 | } 92 | AudioManager.AUDIOFOCUS_LOSS -> { 93 | // Lost focus for an unbounded amount of time: stop playback and release media player 94 | if (mediaPlayer!!.isPlaying) mediaPlayer!!.stop() 95 | mediaPlayer!!.release() 96 | mediaPlayer = null 97 | } 98 | AudioManager.AUDIOFOCUS_LOSS_TRANSIENT -> 99 | // Lost focus for a short time, but we have to stop 100 | // playback. We don't release the media player because playback 101 | // is likely to resume 102 | if (mediaPlayer!!.isPlaying) mediaPlayer!!.pause() 103 | AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK -> 104 | // Lost focus for a short time, but it's ok to keep playing 105 | // at an attenuated level 106 | if (mediaPlayer!!.isPlaying) mediaPlayer!!.setVolume(0.1f, 0.1f) 107 | } 108 | } 109 | 110 | inner class LocalBinder : Binder() { 111 | val service: MediaPlayerService 112 | get() = this@MediaPlayerService 113 | } 114 | 115 | private fun initMediaPlayer() { 116 | 117 | mediaPlayer = MediaPlayer() 118 | //Set up MediaPlayer event listeners 119 | mediaPlayer!!.setOnCompletionListener(this) 120 | mediaPlayer!!.setOnErrorListener(this) 121 | mediaPlayer!!.setOnPreparedListener(this) 122 | mediaPlayer!!.setOnBufferingUpdateListener(this) 123 | mediaPlayer!!.setOnSeekCompleteListener(this) 124 | mediaPlayer!!.setOnInfoListener(this) 125 | //Reset so !!that the MediaPlayer is not pointing to another data source 126 | mediaPlayer!!.reset() 127 | mediaPlayer!!.setAudioStreamType(AudioManager.STREAM_MUSIC) 128 | try { 129 | // Set the data source to the mediaFile location 130 | mediaPlayer!!.setDataSource(mediaFile?.SongURL) 131 | } 132 | catch (e: IOException) { 133 | e.printStackTrace() 134 | stopSelf() 135 | } 136 | mediaPlayer!!.prepareAsync() 137 | 138 | } 139 | 140 | @RequiresApi(Build.VERSION_CODES.M) 141 | private fun requestAudioFocus(): Boolean { 142 | audioManager = getSystemService(Context.AUDIO_SERVICE) as AudioManager 143 | val result = audioManager!!.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN) 144 | return result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED 145 | //Could not gain focus 146 | } 147 | 148 | private fun removeAudioFocus(): Boolean { 149 | return AudioManager.AUDIOFOCUS_REQUEST_GRANTED == 150 | audioManager!!.abandonAudioFocus(this) 151 | } 152 | 153 | @RequiresApi(Build.VERSION_CODES.M) 154 | override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int { 155 | try { 156 | //An audio file is passed to the service through putExtra(); 157 | mediaFile?.SongURL = intent.extras!!.getString("media") 158 | } 159 | catch (e: NullPointerException) { 160 | stopSelf() 161 | } 162 | 163 | //Request audio focus 164 | if (!requestAudioFocus()) { 165 | //Could not gain focus 166 | stopSelf() 167 | } 168 | if (mediaFile != null && mediaFile!!.SongURL != "") initMediaPlayer() 169 | return super.onStartCommand(intent, flags, startId) 170 | 171 | } 172 | 173 | override fun onDestroy() { 174 | super.onDestroy() 175 | if (mediaPlayer != null) { 176 | stopMedia() 177 | mediaPlayer!!.release() 178 | } 179 | removeAudioFocus() 180 | } 181 | 182 | private fun playMedia() { 183 | if (!mediaPlayer!!.isPlaying) 184 | mediaPlayer!!.start() 185 | } 186 | 187 | private fun stopMedia() { 188 | if (mediaPlayer == null) return 189 | if (mediaPlayer!!.isPlaying) mediaPlayer!!.stop() 190 | } 191 | 192 | private fun pauseMedia() { 193 | if (mediaPlayer!!.isPlaying) { 194 | mediaPlayer!!.pause() 195 | resumePosition = mediaPlayer!!.currentPosition 196 | } 197 | } 198 | 199 | private fun resumeMedia() { 200 | if (!mediaPlayer!!.isPlaying) { 201 | mediaPlayer!!.seekTo(resumePosition) 202 | mediaPlayer!!.start() 203 | } 204 | } 205 | 206 | 207 | } --------------------------------------------------------------------------------