-
Notifications
You must be signed in to change notification settings - Fork 0
Further changes to downloading structure and removal of downloaded files #205
Conversation
layout.addView(noDownloadsText) | ||
} | ||
|
||
fun switchToWelcome(view: View) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.
if(!records.exists()) { | ||
records.createNewFile() | ||
} | ||
records.appendText("$songName\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.
* If the file does not exist, it is created. | ||
*/ | ||
private fun record() { | ||
var records = File(applicationContext.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS), "records.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 4 locations. Consider refactoring.
} | ||
} | ||
|
||
private fun deleteDownloadedSong(btn: View, layout: LinearLayout): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method deleteDownloadedSong
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
generateButtons(layout) | ||
} | ||
|
||
private fun generateButtons(layout: LinearLayout) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method generateButtons
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could refactor the while loop for example in an inner function to improve maintainability?
} | ||
|
||
private fun sendDirectIntent(arg: Class<*>?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identical blocks of code found in 4 locations. Consider refactoring.
sendDirectIntent(DeleteSongsActivity::class.java) | ||
} | ||
|
||
private fun sendDirectIntent(arg: Class<*>?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identical blocks of code found in 4 locations. Consider refactoring.
sendDirectIntent(WelcomeActivity::class.java) | ||
} | ||
|
||
private fun sendDirectIntent(arg: Class<*>?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identical blocks of code found in 4 locations. Consider refactoring.
return deleteButton | ||
} | ||
|
||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method deleteDownloadedSong
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job overall 👍 . Just left some minor changes and questions below.
app/src/main/java/ch/sdp/vibester/activity/DeleteSongsActivity.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/ch/sdp/vibester/activity/DeleteSongsActivity.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/ch/sdp/vibester/activity/DeleteSongsActivity.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/ch/sdp/vibester/activity/DeleteSongsActivity.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/ch/sdp/vibester/activity/DeleteSongsActivity.kt
Outdated
Show resolved
Hide resolved
In the code below There is the same problem in the doc as mentioned in other part but as it is old code, I cannot comment it from download Activity. /*
|
return deleteButton | ||
} | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method deleteDownloadedSong
has 34 lines of code (exceeds 25 allowed). Consider refactoring.
downloadComplete = false | ||
songName = songView.text.toString() | ||
|
||
if(checkExistingSong()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
Code Climate has analyzed commit 65ed34a and detected 3 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 84.1% (80% is the threshold). This pull request will bring the total coverage in the repository to 89.9% (0.8% change). View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. There could be some (non-urgent) refactoring to do to make some functions shorter by adding calls to smaller functions instead.
The implementations for a downloading system with duplication checks and systematic recording of currently downloaded files have been completed. Also introduced a removal activity, which lists the various downloaded files that are tracked in the said recording for the user to delete.