diff --git a/.idea/dictionaries/shabinder.xml b/.idea/dictionaries/shabinder.xml
index 8a8edde2..ef30233c 100644
--- a/.idea/dictionaries/shabinder.xml
+++ b/.idea/dictionaries/shabinder.xml
@@ -2,6 +2,7 @@
shabinder
+ spotify
spotifydownloader
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index a5f05cd8..4dcbce12 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -21,5 +21,15 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 09c5db85..8c485cc5 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -53,6 +53,14 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.1.0'
+ implementation 'com.github.kaaes:spotify-web-api-android:0.4.1'
+
+ implementation 'com.google.apis:google-api-services-youtube:v3-rev180-1.22.0'
+ implementation 'com.google.oauth-client:google-oauth-client:1.22.0'
+ implementation 'com.spotify.android:auth:1.2.3'
+ implementation 'com.google.code.gson:gson:2.8.6'
+ implementation 'com.squareup.okhttp3:okhttp:4.8.0'
+
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
diff --git a/app/src/main/java/com/shabinder/musicForEveryone/MainActivity.kt b/app/src/main/java/com/shabinder/musicForEveryone/MainActivity.kt
index 09f60c15..09862348 100644
--- a/app/src/main/java/com/shabinder/musicForEveryone/MainActivity.kt
+++ b/app/src/main/java/com/shabinder/musicForEveryone/MainActivity.kt
@@ -2,7 +2,7 @@ package com.shabinder.musicForEveryone
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
-import com.shabinder.musicForEveryone.ui.main.MainFragment
+import com.shabinder.musicForEveryone.fragments.MainFragment
class MainActivity : AppCompatActivity() {
diff --git a/app/src/main/java/com/shabinder/musicForEveryone/fragments/MainFragment.kt b/app/src/main/java/com/shabinder/musicForEveryone/fragments/MainFragment.kt
new file mode 100644
index 00000000..7db39dca
--- /dev/null
+++ b/app/src/main/java/com/shabinder/musicForEveryone/fragments/MainFragment.kt
@@ -0,0 +1,59 @@
+package com.shabinder.musicForEveryone.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import androidx.lifecycle.ViewModelProviders
+import com.shabinder.musicForEveryone.MainActivity
+import com.shabinder.musicForEveryone.R
+import com.shabinder.musicForEveryone.ui.main.MainViewModel
+import kaaes.spotify.webapi.android.SpotifyService
+
+class MainFragment : Fragment() {
+
+ var spotify: SpotifyService? = null
+
+
+ companion object {
+ fun newInstance() = MainFragment()
+ const val CLIENT_ID:String = "4fe3fecfe5334023a1472516cc99d805"
+ const val spotify_client_secret:String = "0f02b7c483c04257984695007a4a8d5c"
+ }
+
+ private lateinit var viewModel: MainViewModel
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View {
+
+ if(spotify==null){
+ authenticateSpotify()
+ }
+
+ requestPermission()
+
+ return inflater.inflate(R.layout.main_fragment, container, false)
+ }
+
+ fun authenticateSpotify() {
+ val builder: AuthenticationRequest.Builder = Builder(
+ CLIENT_ID,
+ AuthenticationResponse.Type.TOKEN,
+ MainActivity.REDIRECT_URI
+ )
+ builder.setScopes(arrayOf("user-read-private", "streaming"))
+ val request: AuthenticationRequest = builder.build()
+ AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request)
+ }
+
+
+ override fun onActivityCreated(savedInstanceState: Bundle?) {
+ super.onActivityCreated(savedInstanceState)
+ viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java)
+ // TODO: Use the ViewModel
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shabinder/musicForEveryone/mainFragment/MainViewModel.kt b/app/src/main/java/com/shabinder/musicForEveryone/fragments/MainViewModel.kt
similarity index 100%
rename from app/src/main/java/com/shabinder/musicForEveryone/mainFragment/MainViewModel.kt
rename to app/src/main/java/com/shabinder/musicForEveryone/fragments/MainViewModel.kt
diff --git a/app/src/main/java/com/shabinder/musicForEveryone/mainFragment/MainFragment.kt b/app/src/main/java/com/shabinder/musicForEveryone/mainFragment/MainFragment.kt
deleted file mode 100644
index 71377ff0..00000000
--- a/app/src/main/java/com/shabinder/musicForEveryone/mainFragment/MainFragment.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.shabinder.musicForEveryone.ui.main
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.fragment.app.Fragment
-import androidx.lifecycle.ViewModelProviders
-import com.shabinder.musicForEveryone.R
-
-class MainFragment : Fragment() {
-
- companion object {
- fun newInstance() = MainFragment()
- }
-
- private lateinit var viewModel: MainViewModel
-
- override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?,
- savedInstanceState: Bundle?
- ): View {
- return inflater.inflate(R.layout.main_fragment, container, false)
- }
-
- override fun onActivityCreated(savedInstanceState: Bundle?) {
- super.onActivityCreated(savedInstanceState)
- viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java)
- // TODO: Use the ViewModel
- }
-
-}
\ No newline at end of file
diff --git a/app/src/main/res/layout/main_fragment.xml b/app/src/main/res/layout/main_fragment.xml
index 11965424..d3e703bb 100644
--- a/app/src/main/res/layout/main_fragment.xml
+++ b/app/src/main/res/layout/main_fragment.xml
@@ -5,7 +5,7 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".ui.main.MainFragment">
+ tools:context=".fragments.MainFragment">
\ No newline at end of file