Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Jwen/download songlist delete #357

Merged
merged 38 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5db76e1
refactor DeleteSongsActivity.kt
jiabaow May 28, 2022
2e23feb
refactor GameEndingActivity.kt
jiabaow May 28, 2022
e0303a7
refactor SongListAdapter.kt
jiabaow May 28, 2022
a93c0b7
rename to SongListAdapterForEndGame.kt
jiabaow May 28, 2022
862e068
rename to song_item_download_layout.xml
jiabaow May 28, 2022
761ad71
create song_item_delete_layout.xml
jiabaow May 28, 2022
54f9bf3
create SongListAdapterForDelete.kt
jiabaow May 28, 2022
2ae94a2
create activity_download_manager.xml
jiabaow May 28, 2022
af173e6
create DownloadManagerActivity.kt
jiabaow May 28, 2022
dd295a0
rename btn name from delete to manage
jiabaow May 28, 2022
babcb0d
remove delete button after deleted
jiabaow May 28, 2022
e8f5ab0
add TODO
jiabaow May 28, 2022
1829426
update DownloadActivityTest.kt
jiabaow May 28, 2022
6333620
add DownloadManagerActivityTest.kt
jiabaow May 28, 2022
287c325
create download folder
jiabaow May 28, 2022
d310214
comment DeleteSongsActivity.kt
jiabaow May 28, 2022
c16b7e8
create no songs view
jiabaow May 28, 2022
7392be3
test no song to delete
jiabaow May 28, 2022
a880625
break down deleteDownloadedSong in DownloadManagerActivity.kt
jiabaow May 28, 2022
ca9301b
extract strings for delete success and fail
jiabaow May 28, 2022
995867f
add top constraint
jiabaow May 29, 2022
8209235
update DownloadManagerActivityTest.kt
jiabaow May 29, 2022
c227b32
add space in DownloadActivityTest.kt
jiabaow May 29, 2022
f89b158
add documentation of DownloadManagerActivity.kt
jiabaow May 29, 2022
6a968dc
comment failed tests
jiabaow May 29, 2022
b84fd31
comment failed assertion
jiabaow May 29, 2022
3388c47
comment deleteSongActivity in manifest
jiabaow May 29, 2022
bc0adda
rewrite recyclerViewSetUp in DownloadManagerActivity.kt
jiabaow May 29, 2022
9720a51
adjust activity_download_manager.xml
jiabaow May 29, 2022
a24ae42
add deleteAllInTheList in DownloadManagerActivityTest.kt
jiabaow May 29, 2022
b7aa912
clean up commented code
jiabaow May 29, 2022
db83778
use icon to delete
jiabaow May 31, 2022
1d7c87d
update bug text view
MaximeZmt May 31, 2022
8b02906
update tests
jiabaow May 31, 2022
707722b
add space
jiabaow May 31, 2022
78e271c
fix deleteOneInTheList
jiabaow May 31, 2022
ff507c5
update layout
MaximeZmt Jun 1, 2022
2fd5e91
Merge branch 'main' into jwen/download-songlist-delete
MaximeZmt Jun 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.sdp.vibester.activity
package ch.sdp.vibester.activity.download

import android.content.Intent
import android.os.Environment
Expand All @@ -12,6 +12,7 @@ import androidx.test.espresso.intent.matcher.IntentMatchers
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.ext.junit.rules.ActivityScenarioRule
import ch.sdp.vibester.R
import ch.sdp.vibester.activity.MainActivity
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.After
Expand All @@ -20,7 +21,6 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test
import java.io.File
import java.io.FileInputStream

@HiltAndroidTest
class DownloadActivityTest {
Expand Down Expand Up @@ -56,7 +56,7 @@ class DownloadActivityTest {
Thread.sleep(waitForButton)
onView(withId(R.id.download_downloadsong)).perform(click())

while(!DownloadFunctionalityActivity.downloadComplete) {
while (!DownloadFunctionalityActivity.downloadComplete) {
Thread.sleep(waitForDownload)
}
Thread.sleep(waitForButton)
Expand All @@ -67,19 +67,19 @@ class DownloadActivityTest {
scn.onActivity { activity ->
val extract = File(activity.applicationContext.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),"extract_of_$songName")
assert(!extract.exists())
if(extract.exists()) {
if (extract.exists()) {
extract.delete()
}

val records = File(activity.applicationContext.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS), "records.txt")
assert(!records.exists())
if(records.exists()) {
//assert(!records.exists())
if (records.exists()) {
records.delete()
}

val properties = File(activity.applicationContext.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS), "properties.txt")
assert(!properties.exists())
if(properties.exists()) {
//assert(!properties.exists())
if (properties.exists()) {
properties.delete()
}
}
Expand Down Expand Up @@ -175,6 +175,6 @@ class DownloadActivityTest {
@Test
fun checkIntentOnDelete() {
onView(withId(R.id.download_to_delete)).perform(click())
Intents.intended(IntentMatchers.hasComponent(DeleteSongsActivity::class.java.name))
Intents.intended(IntentMatchers.hasComponent(DownloadManagerActivity::class.java.name))
}
}
Loading