importing and implementing dependencies and libraries

This commit is contained in:
shabinder 2020-07-16 12:41:32 +05:30
parent b358932572
commit d2faca10fb
9 changed files with 81 additions and 35 deletions

View File

@ -2,6 +2,7 @@
<dictionary name="shabinder">
<words>
<w>shabinder</w>
<w>spotify</w>
<w>spotifydownloader</w>
</words>
</dictionary>

View File

@ -21,5 +21,15 @@
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</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>
</project>

View File

@ -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'

View File

@ -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() {

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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">
<TextView
android:id="@+id/message"

View File

@ -7,7 +7,7 @@
<fragment
android:id="@+id/mainFragment"
android:name="com.shabinder.musicForEveryone.ui.main.MainFragment"
android:name="com.shabinder.musicForEveryone.fragments.MainFragment"
android:label="main_fragment"
tools:layout="@layout/main_fragment" />
</navigation>