mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-24 18:04:33 +01:00
importing and implementing dependencies and libraries
This commit is contained in:
parent
b358932572
commit
d2faca10fb
@ -2,6 +2,7 @@
|
|||||||
<dictionary name="shabinder">
|
<dictionary name="shabinder">
|
||||||
<words>
|
<words>
|
||||||
<w>shabinder</w>
|
<w>shabinder</w>
|
||||||
|
<w>spotify</w>
|
||||||
<w>spotifydownloader</w>
|
<w>spotifydownloader</w>
|
||||||
</words>
|
</words>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
|
@ -21,5 +21,15 @@
|
|||||||
<option name="name" value="Google" />
|
<option name="name" value="Google" />
|
||||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="MavenRepo" />
|
||||||
|
<option name="name" value="MavenRepo" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven" />
|
||||||
|
<option name="name" value="maven" />
|
||||||
|
<option name="url" value="https://jitpack.io" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -53,6 +53,14 @@ dependencies {
|
|||||||
|
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
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'
|
testImplementation 'junit:junit:4.13'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||||
|
@ -2,7 +2,7 @@ package com.shabinder.musicForEveryone
|
|||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.shabinder.musicForEveryone.ui.main.MainFragment
|
import com.shabinder.musicForEveryone.fragments.MainFragment
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -5,7 +5,7 @@
|
|||||||
android:id="@+id/main"
|
android:id="@+id/main"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".ui.main.MainFragment">
|
tools:context=".fragments.MainFragment">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/message"
|
android:id="@+id/message"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/mainFragment"
|
android:id="@+id/mainFragment"
|
||||||
android:name="com.shabinder.musicForEveryone.ui.main.MainFragment"
|
android:name="com.shabinder.musicForEveryone.fragments.MainFragment"
|
||||||
android:label="main_fragment"
|
android:label="main_fragment"
|
||||||
tools:layout="@layout/main_fragment" />
|
tools:layout="@layout/main_fragment" />
|
||||||
</navigation>
|
</navigation>
|
Loading…
Reference in New Issue
Block a user