11 |
12 |
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 | # music player App in Android Kotlin
2 |
3 | This is a simple music player application for begineers , i have used room database to store all the songs in it and also used kotlin coroutines to work in background
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | apply plugin: 'kotlin-kapt'
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | applicationId "com.codingwithjks.musicplayer"
11 | minSdkVersion 14
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: "libs", include: ["*.jar"])
29 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
30 | implementation 'androidx.core:core-ktx:1.3.1'
31 | implementation 'androidx.appcompat:appcompat:1.2.0'
32 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
33 | implementation 'androidx.recyclerview:recyclerview:1.1.0'
34 | implementation 'androidx.cardview:cardview:1.0.0'
35 | testImplementation 'junit:junit:4.12'
36 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
38 |
39 | implementation 'com.github.bumptech.glide:glide:4.11.0'
40 | annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
41 |
42 | def lifecycle_version = "2.3.0-alpha06"
43 | def activity_version = "1.2.0-alpha07"
44 |
45 | def room_version = "2.2.5"
46 |
47 | kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
48 | implementation "androidx.activity:activity-ktx:$activity_version"
49 |
50 | // Lifecycles only (without ViewModel or LiveData)
51 | implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
52 | // ViewModel
53 | implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
54 | // LiveData
55 | implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
56 |
57 | // Coroutines
58 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7"
59 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
60 |
61 | implementation 'com.google.android.material:material:1.1.0'
62 |
63 | implementation "androidx.room:room-ktx:$room_version"
64 | implementation "androidx.room:room-runtime:$room_version"
65 | kapt "androidx.room:room-compiler:$room_version"
66 |
67 | }
--------------------------------------------------------------------------------
/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
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/codingwithjks/musicplayer/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.codingwithjks.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.codingwithjks.musicplayer", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/codingwithjks/musicplayer/Adapter/MusicAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.codingwithjks.musicplayer.Adapter
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.ImageView
8 | import android.widget.TextView
9 | import androidx.recyclerview.widget.RecyclerView
10 | import com.bumptech.glide.Glide
11 | import com.codingwithjks.musicplayer.Listener.Listener
12 | import com.codingwithjks.musicplayer.Model.Music
13 | import com.codingwithjks.musicplayer.R
14 |
15 | class MusicAdapter(private val context: Context,private var musicList:ArrayList,private val listener:Listener) : RecyclerView.Adapter() {
16 |
17 |
18 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MusicViewHolder =
19 | MusicViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.each_row,parent,false))
20 |
21 | override fun onBindViewHolder(holder: MusicViewHolder, position: Int) {
22 | val music=musicList[position]
23 | holder.songName.text=music.songName
24 | holder.artistName.text=music.artistName
25 | holder.time.text=music.time
26 | }
27 |
28 | override fun getItemCount(): Int =musicList.size
29 |
30 | inner class MusicViewHolder(itemView:View) : RecyclerView.ViewHolder(itemView)
31 | {
32 | val songName:TextView=itemView.findViewById(R.id.songName)
33 | val artistName:TextView=itemView.findViewById(R.id.artistName)
34 | val time:TextView=itemView.findViewById(R.id.time)
35 | init {
36 | itemView.setOnClickListener {
37 | listener.onCardClickListener(adapterPosition)
38 | }
39 | }
40 | }
41 |
42 | fun setMusicData(musicList: ArrayList)
43 | {
44 | this.musicList=musicList
45 | notifyDataSetChanged()
46 | }
47 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/codingwithjks/musicplayer/Dao/MusicDao.kt:
--------------------------------------------------------------------------------
1 | package com.codingwithjks.musicplayer.Dao
2 |
3 | import androidx.lifecycle.LiveData
4 | import androidx.room.Dao
5 | import androidx.room.Insert
6 | import androidx.room.OnConflictStrategy
7 | import androidx.room.Query
8 | import com.codingwithjks.musicplayer.Model.Music
9 |
10 | @Dao
11 | interface MusicDao {
12 | @Insert(onConflict = OnConflictStrategy.REPLACE)
13 | suspend fun insert(musicList:ArrayList)
14 |
15 | @Query("SELECT * FROM music ORDER BY id ASC")
16 | fun getAllMusic():LiveData>
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/codingwithjks/musicplayer/Database/MusicDatabase.kt:
--------------------------------------------------------------------------------
1 | package com.codingwithjks.musicplayer.Database
2 |
3 | import android.content.Context
4 | import androidx.room.Database
5 | import androidx.room.Room
6 | import androidx.room.RoomDatabase
7 | import com.codingwithjks.musicplayer.Dao.MusicDao
8 | import com.codingwithjks.musicplayer.Model.Music
9 |
10 | @Database(entities = [Music::class], version = 1, exportSchema = false)
11 | abstract class MusicDatabase : RoomDatabase() {
12 |
13 | abstract fun getMusicDao():MusicDao
14 |
15 | companion object{
16 | private const val DATABASE_NAME="music"
17 | @Volatile
18 | private var instance:MusicDatabase?=null
19 |
20 | fun getInstance(context: Context):MusicDatabase?{
21 | if(instance == null)
22 | {
23 | synchronized(MusicDatabase::class.java)
24 | {
25 | if(instance == null)
26 | {
27 | instance=Room.databaseBuilder(context,MusicDatabase::class.java,
28 | DATABASE_NAME)
29 | .build()
30 | }
31 | }
32 | }
33 |
34 | return instance
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/codingwithjks/musicplayer/Listener/Listener.kt:
--------------------------------------------------------------------------------
1 | package com.codingwithjks.musicplayer.Listener
2 |
3 | interface Listener {
4 |
5 | fun onCardClickListener(position:Int)
6 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/codingwithjks/musicplayer/Model/Music.kt:
--------------------------------------------------------------------------------
1 | package com.codingwithjks.musicplayer.Model
2 |
3 | import androidx.room.Entity
4 | import androidx.room.PrimaryKey
5 | import java.io.Serializable
6 |
7 | @Entity(tableName = "music")
8 | data class Music(
9 | val songName:String?,
10 | val artistName: String?,
11 | val time:String?,
12 | val url:String? ) : Serializable{
13 |
14 | @PrimaryKey(autoGenerate = true)
15 | var id:Int?=null
16 | }
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/codingwithjks/musicplayer/Repository/MusicRepository.kt:
--------------------------------------------------------------------------------
1 | package com.codingwithjks.musicplayer.Repository
2 |
3 | import android.content.Context
4 | import androidx.lifecycle.LiveData
5 | import com.codingwithjks.musicplayer.Database.MusicDatabase
6 | import com.codingwithjks.musicplayer.Model.Music
7 | import kotlinx.coroutines.CoroutineScope
8 | import kotlinx.coroutines.Dispatchers.IO
9 | import kotlinx.coroutines.launch
10 |
11 | class MusicRepository {
12 |
13 | companion object{
14 | private var musicDatabase:MusicDatabase?=null
15 |
16 | private fun initDB(context: Context):MusicDatabase?= MusicDatabase.getInstance(context)
17 |
18 | fun insert(context: Context,musicList: ArrayList)
19 | {
20 | musicDatabase= initDB(context)
21 | CoroutineScope(IO).launch {
22 | musicDatabase?.getMusicDao()?.insert(musicList)
23 | }
24 | }
25 |
26 | fun getAllMusic(context: Context):LiveData>?
27 | {
28 | musicDatabase= initDB(context)
29 | return musicDatabase?.getMusicDao()?.getAllMusic()
30 | }
31 |
32 | }
33 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/codingwithjks/musicplayer/Ui/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.codingwithjks.musicplayer.Ui
2 |
3 | import android.Manifest
4 | import android.content.Intent
5 | import android.content.pm.PackageManager
6 | import android.media.MediaPlayer
7 | import android.os.Build
8 | import androidx.appcompat.app.AppCompatActivity
9 | import android.os.Bundle
10 | import android.provider.MediaStore
11 | import android.util.Log
12 | import android.widget.Toast
13 | import androidx.annotation.RequiresApi
14 | import androidx.core.app.ActivityCompat
15 | import androidx.core.content.ContextCompat
16 | import androidx.lifecycle.ViewModelProvider
17 | import androidx.recyclerview.widget.LinearLayoutManager
18 | import androidx.recyclerview.widget.RecyclerView
19 | import com.codingwithjks.musicplayer.Adapter.MusicAdapter
20 | import com.codingwithjks.musicplayer.Listener.Listener
21 | import com.codingwithjks.musicplayer.Model.Music
22 | import com.codingwithjks.musicplayer.R
23 | import com.codingwithjks.musicplayer.ViewModel.MusicViewModel
24 | import java.util.concurrent.TimeUnit
25 | import kotlin.collections.ArrayList
26 |
27 | class MainActivity : AppCompatActivity() ,Listener{
28 | private lateinit var recyclerView: RecyclerView
29 | private lateinit var musicList: ArrayList
30 | private lateinit var musicViewModel:MusicViewModel
31 | private val READ_STORAGE = 100
32 | private lateinit var musicAdapter: MusicAdapter
33 | private lateinit var mediaPlayer: MediaPlayer
34 |
35 | @RequiresApi(Build.VERSION_CODES.Q)
36 | override fun onCreate(savedInstanceState: Bundle?) {
37 | super.onCreate(savedInstanceState)
38 | setContentView(R.layout.activity_main)
39 | mediaPlayer= MediaPlayer()
40 | musicList = ArrayList()
41 | initRecyclerView()
42 | initViewModel()
43 | getPermission()
44 | }
45 |
46 | private fun initViewModel() {
47 | musicViewModel=ViewModelProvider(this).get(MusicViewModel::class.java)
48 |
49 | musicViewModel.getAllMusic(this)?.observe(this, androidx.lifecycle.Observer {
50 | musicAdapter.apply {
51 | setMusicData(it as ArrayList)
52 | notifyDataSetChanged()
53 | }
54 |
55 | })
56 |
57 |
58 | }
59 |
60 | private fun initRecyclerView() {
61 | recyclerView = findViewById(R.id.recyclerView)
62 | musicAdapter = MusicAdapter(this, ArrayList(),this)
63 | recyclerView.apply {
64 | setHasFixedSize(true)
65 | layoutManager = LinearLayoutManager(this@MainActivity)
66 | adapter = musicAdapter
67 | }
68 | }
69 |
70 | @RequiresApi(Build.VERSION_CODES.Q)
71 | private fun getPermission() {
72 | val permissionCheck =
73 | ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)
74 | if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
75 | ActivityCompat.requestPermissions(
76 | this,
77 | arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE),
78 | READ_STORAGE
79 | )
80 | } else {
81 | readExternalData()
82 | }
83 | }
84 |
85 | @RequiresApi(Build.VERSION_CODES.Q)
86 | override fun onRequestPermissionsResult(
87 | requestCode: Int,
88 | permissions: Array,
89 | grantResults: IntArray
90 | ) {
91 | super.onRequestPermissionsResult(requestCode, permissions, grantResults)
92 | when (requestCode) {
93 | READ_STORAGE -> if ((grantResults.isNotEmpty()) && (grantResults[0] == PackageManager.PERMISSION_GRANTED)) {
94 | readExternalData()
95 | }
96 | }
97 | }
98 |
99 | @RequiresApi(Build.VERSION_CODES.Q)
100 |
101 | private fun readExternalData() {
102 | val contentResolver = contentResolver
103 | val uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
104 | val cursor = contentResolver.query(uri, null, null, null, null)
105 | if (cursor != null) {
106 | cursor.moveToFirst()
107 | while (cursor.moveToNext()) {
108 | val music:Music
109 | val songName =
110 | cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME))
111 | val artistName =
112 | cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST))
113 | val time = cursor.getLong(cursor.getColumnIndex(MediaStore.Audio.Media.DURATION))
114 | val songUrl = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA))
115 |
116 | val secToMin=TimeUnit.MILLISECONDS.toMinutes(time)
117 |
118 | music= Music(songName,artistName,"$secToMin min",songUrl)
119 | musicList.add(music)
120 | Log.d("main", "readExternalData: ${music.artistName} ")
121 | }
122 | musicViewModel.insert(this,musicList)
123 |
124 | }
125 | }
126 |
127 | override fun onCardClickListener(position: Int) {
128 | val intent=Intent(this,PlaySong::class.java)
129 | intent.putExtra("song",musicList[position])
130 | startActivity(intent)
131 |
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/app/src/main/java/com/codingwithjks/musicplayer/Ui/PlaySong.kt:
--------------------------------------------------------------------------------
1 | package com.codingwithjks.musicplayer.Ui
2 |
3 | import android.media.MediaPlayer
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.os.Bundle
6 | import android.os.Handler
7 | import android.view.View
8 | import android.widget.SeekBar
9 | import com.codingwithjks.musicplayer.Model.Music
10 | import com.codingwithjks.musicplayer.R
11 | import kotlinx.android.synthetic.main.activity_play_song.*
12 | import java.lang.Exception
13 |
14 | class PlaySong : AppCompatActivity(),View.OnClickListener {
15 | private lateinit var getMusic:Music
16 | private lateinit var mediaPlayer: MediaPlayer
17 | private lateinit var handler: Handler
18 | private lateinit var runnable: Runnable
19 | override fun onCreate(savedInstanceState: Bundle?) {
20 | super.onCreate(savedInstanceState)
21 | setContentView(R.layout.activity_play_song)
22 | handler= Handler()
23 | mediaPlayer= MediaPlayer()
24 | getSerializableData()
25 | loadData()
26 | initSeekBar()
27 | seekbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
28 | override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
29 | if(fromUser)
30 | {
31 | mediaPlayer.seekTo(progress*1000)
32 | }
33 | }
34 |
35 | override fun onStartTrackingTouch(seekBar: SeekBar?) {
36 |
37 | }
38 |
39 | override fun onStopTrackingTouch(seekBar: SeekBar?) {
40 |
41 | }
42 |
43 | })
44 | }
45 |
46 | private fun initSeekBar() {
47 | seekbar.max=mediaPlayer.seconds
48 | runnable= Runnable {
49 | seekbar.progress = mediaPlayer.currentSeconds
50 | val diff = mediaPlayer.seconds - mediaPlayer.currentSeconds
51 | handler.postDelayed(runnable,1000)
52 | }
53 | handler.postDelayed(runnable,1000)
54 | }
55 |
56 | // Extension property to get media player duration in seconds
57 | private val MediaPlayer.seconds:Int
58 | get() {
59 | return this.duration / 1000
60 | }
61 |
62 |
63 | // Extension property to get media player current position in seconds
64 | private val MediaPlayer.currentSeconds:Int
65 | get() {
66 | return this.currentPosition/1000
67 | }
68 |
69 | private fun loadData() {
70 | songName1.text=getMusic.songName
71 | artistName1.text=getMusic.artistName
72 | try {
73 | mediaPlayer.setDataSource(getMusic.url)
74 | mediaPlayer.prepare()
75 | mediaPlayer.start()
76 | }
77 | catch (e:Exception)
78 | {
79 | e.printStackTrace()
80 | }
81 | previous.setOnClickListener(this)
82 | next.setOnClickListener(this)
83 | play.setOnClickListener(this)
84 | }
85 |
86 |
87 |
88 | private fun getSerializableData() {
89 |
90 | val bundle:Bundle?=intent.extras
91 | getMusic= bundle?.getSerializable("song") as Music
92 | }
93 |
94 | override fun onClick(v: View?) {
95 | when(v?.id)
96 | {
97 | R.id.previous->{}
98 | R.id.play->{
99 | if(mediaPlayer.isPlaying)
100 | {
101 | play.setImageResource(R.drawable.play)
102 | mediaPlayer.pause()
103 | handler.removeCallbacks(runnable)
104 |
105 | }
106 | else{
107 | initSeekBar()
108 | play.setImageResource(R.drawable.pause)
109 | mediaPlayer.start()
110 | }
111 | }
112 | R.id.next->{}
113 |
114 | }
115 | }
116 |
117 | override fun onDestroy() {
118 | super.onDestroy()
119 | mediaPlayer.stop()
120 | }
121 |
122 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/codingwithjks/musicplayer/Ui/SplashScreen.kt:
--------------------------------------------------------------------------------
1 | package com.codingwithjks.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.codingwithjks.musicplayer.R
8 |
9 | class SplashScreen : AppCompatActivity() {
10 | override fun onCreate(savedInstanceState: Bundle?) {
11 | super.onCreate(savedInstanceState)
12 | setContentView(R.layout.activity_splash_screen)
13 |
14 | Handler().postDelayed({
15 | startActivity(Intent(this,MainActivity::class.java))
16 | },3000)
17 | }
18 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/codingwithjks/musicplayer/ViewModel/MusicViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.codingwithjks.musicplayer.ViewModel
2 |
3 | import android.content.Context
4 | import androidx.lifecycle.LiveData
5 | import androidx.lifecycle.ViewModel
6 | import androidx.lifecycle.ViewModelProvider
7 | import com.codingwithjks.musicplayer.Model.Music
8 | import com.codingwithjks.musicplayer.Repository.MusicRepository
9 |
10 | class MusicViewModel : ViewModel(){
11 |
12 | fun insert(context: Context,musicList: ArrayList)
13 | {
14 | MusicRepository.insert(context,musicList)
15 | }
16 |
17 | fun getAllMusic(context: Context):LiveData>?= MusicRepository.getAllMusic(context)
18 |
19 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/Screenshot_2020-08-23-00-11-32-750_com.codingwithjks.musicplayer (1).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/drawable/Screenshot_2020-08-23-00-11-32-750_com.codingwithjks.musicplayer (1).jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/Screenshot_2020-08-23-00-11-38-871_com.codingwithjks.musicplayer (1).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/drawable/Screenshot_2020-08-23-00-11-38-871_com.codingwithjks.musicplayer (1).jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/Screenshot_2020-08-23-00-11-53-470_com.codingwithjks.musicplayer.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/drawable/Screenshot_2020-08-23-00-11-53-470_com.codingwithjks.musicplayer.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/music.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/music_card_design.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
11 |
12 |
14 |
15 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/music_player_design.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
11 |
12 |
13 |
14 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/next.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/pause.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/play.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/previous.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/font/pacifico.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_play_song.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
22 |
23 |
24 |
34 |
35 |
47 |
48 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
73 |
74 |
79 |
80 |
90 |
91 |
92 |
93 |
94 |
95 |
106 |
107 |
118 |
119 |
130 |
131 |
141 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
17 |
18 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/each_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
22 |
23 |
34 |
35 |
46 |
47 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/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/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #16515E
4 | #16515E
5 | #03DAC5
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/font_certs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @array/com_google_android_gms_fonts_certs_dev
5 | @array/com_google_android_gms_fonts_certs_prod
6 |
7 |
8 |
9 | MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs=
10 |
11 |
12 |
13 |
14 | MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/preloaded_fonts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @font/pacifico
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | music player
3 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/test/java/com/codingwithjks/musicplayer/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.codingwithjks.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 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | ext.kotlin_version = "1.4.0"
4 | repositories {
5 | google()
6 | jcenter()
7 | }
8 | dependencies {
9 | classpath "com.android.tools.build:gradle:4.0.1"
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 |
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 | }
22 | }
23 |
24 | task clean(type: Delete) {
25 | delete rootProject.buildDir
26 | }
--------------------------------------------------------------------------------
/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=-Xmx2048m
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
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nameisjayant/music-player-app-android-kotlin/5c737e1d50a97ca28e98047a7e94474dcb8f2309/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Aug 22 10:06:17 IST 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.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | rootProject.name = "music player"
--------------------------------------------------------------------------------