From 0f2e9ac1bbd7ca7e4c818043d7d5f5553a9055d8 Mon Sep 17 00:00:00 2001 From: jiabaow Date: Sun, 13 Mar 2022 11:32:37 +0100 Subject: [PATCH 01/11] stuck using musixmatch api --- .../ch/sdp/vibester/MusicTemporaryTest.kt | 6 +- app/src/main/AndroidManifest.xml | 93 ++++++++++--------- .../java/ch/sdp/vibester/LyricTemporary.kt | 36 +++++++ .../main/java/ch/sdp/vibester/MainActivity.kt | 8 ++ .../java/ch/sdp/vibester/MusicTemporary.kt | 4 +- .../ch/sdp/vibester/api/ItunesMusicApi.kt | 2 +- .../java/ch/sdp/vibester/api/LyricsOVHApi.kt | 5 + .../java/ch/sdp/vibester/api/MusixmatchApi.kt | 34 +++++++ .../main/java/ch/sdp/vibester/model/Lyric.kt | 27 ++++++ .../main/java/ch/sdp/vibester/model/Song.kt | 2 +- .../res/layout/activity_lyric_temporary.xml | 88 ++++++++++++++++++ app/src/main/res/layout/activity_main.xml | 19 +++- .../res/layout/activity_music_temporary.xml | 6 +- 13 files changed, 269 insertions(+), 61 deletions(-) create mode 100644 app/src/main/java/ch/sdp/vibester/LyricTemporary.kt create mode 100644 app/src/main/java/ch/sdp/vibester/api/LyricsOVHApi.kt create mode 100644 app/src/main/java/ch/sdp/vibester/api/MusixmatchApi.kt create mode 100644 app/src/main/java/ch/sdp/vibester/model/Lyric.kt create mode 100644 app/src/main/res/layout/activity_lyric_temporary.xml diff --git a/app/src/androidTest/java/ch/sdp/vibester/MusicTemporaryTest.kt b/app/src/androidTest/java/ch/sdp/vibester/MusicTemporaryTest.kt index e17ef6f00..ef861edfd 100644 --- a/app/src/androidTest/java/ch/sdp/vibester/MusicTemporaryTest.kt +++ b/app/src/androidTest/java/ch/sdp/vibester/MusicTemporaryTest.kt @@ -3,13 +3,9 @@ package ch.sdp.vibester import android.content.Intent import androidx.test.core.app.ActivityScenario import androidx.test.core.app.ApplicationProvider -import androidx.test.espresso.Espresso import androidx.test.espresso.Espresso.onView -import androidx.test.espresso.action.ViewActions import androidx.test.espresso.action.ViewActions.* -import androidx.test.espresso.assertion.ViewAssertions import androidx.test.espresso.assertion.ViewAssertions.matches -import androidx.test.espresso.matcher.ViewMatchers import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -28,7 +24,7 @@ class MusicTemporaryTest{ val scn: ActivityScenario = ActivityScenario.launch(intent) onView(withId(R.id.musicName)) .perform(typeText(inputName), closeSoftKeyboard()) - onView(withId(R.id.validate)).perform(click()) + onView(withId(R.id.validateForMusic)).perform(click()) onView(withId(R.id.textViewPlaying)) .check(matches(withText("Imagine Dragons - Believer"))) } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 5ede2fe17..351593b31 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,45 +1,50 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/ch/sdp/vibester/LyricTemporary.kt b/app/src/main/java/ch/sdp/vibester/LyricTemporary.kt new file mode 100644 index 000000000..d8b48a1b7 --- /dev/null +++ b/app/src/main/java/ch/sdp/vibester/LyricTemporary.kt @@ -0,0 +1,36 @@ +package ch.sdp.vibester + +import android.os.Bundle +import android.text.method.ScrollingMovementMethod +import android.widget.Button +import android.widget.EditText +import android.widget.TextView +import androidx.appcompat.app.AppCompatActivity +import ch.sdp.vibester.api.MusixmatchApi +import ch.sdp.vibester.model.Lyric +import okhttp3.OkHttpClient + + +class LyricTemporary: AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_lyric_temporary) + + val artistName = findViewById(R.id.artistForLyric) + + val trackName = findViewById(R.id.trackForLyric) + + val btnValidate = findViewById