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

Kamila/game manger online #364

Open
wants to merge 108 commits into
base: main
Choose a base branch
from
Open

Conversation

kamilababayeva
Copy link
Collaborator

No description provided.

val searchByTag = LastfmMethod.BY_TAG.method
val searchByArtist = LastfmMethod.BY_ARTIST.method

kpop.setOnClickListener { chooseGenre(method = searchByTag, tag = "kpop", mode = R.string.kpop) }
Copy link

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 5 locations. Consider refactoring.

val searchByArtist = LastfmMethod.BY_ARTIST.method

kpop.setOnClickListener { chooseGenre(method = searchByTag, tag = "kpop", mode = R.string.kpop) }
rock.setOnClickListener { chooseGenre(method = searchByTag, tag = "rock", mode = R.string.rock) }
Copy link

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 5 locations. Consider refactoring.


kpop.setOnClickListener { chooseGenre(method = searchByTag, tag = "kpop", mode = R.string.kpop) }
rock.setOnClickListener { chooseGenre(method = searchByTag, tag = "rock", mode = R.string.rock) }
bts.setOnClickListener { chooseGenre(method = searchByArtist, artist = "BTS", mode = R.string.gameGenre_bts) }
Copy link

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 5 locations. Consider refactoring.

rock.setOnClickListener { chooseGenre(method = searchByTag, tag = "rock", mode = R.string.rock) }
bts.setOnClickListener { chooseGenre(method = searchByArtist, artist = "BTS", mode = R.string.gameGenre_bts) }
topTracks.setOnClickListener { chooseGenre(method = LastfmMethod.BY_CHART.method, mode = R.string.top_tracks) }
imagDragons.setOnClickListener{ chooseGenre(method = searchByArtist, artist = "Imagine Dragons", mode = R.string.gameGenre_imagine_dragons) }
Copy link

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 5 locations. Consider refactoring.

bts.setOnClickListener { chooseGenre(method = searchByArtist, artist = "BTS", mode = R.string.gameGenre_bts) }
topTracks.setOnClickListener { chooseGenre(method = LastfmMethod.BY_CHART.method, mode = R.string.top_tracks) }
imagDragons.setOnClickListener{ chooseGenre(method = searchByArtist, artist = "Imagine Dragons", mode = R.string.gameGenre_imagine_dragons) }
billieEilish.setOnClickListener { chooseGenre(method = searchByArtist, artist = "Billie Eilish", mode = R.string.gameGenre_billie_eilish) }
Copy link

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 5 locations. Consider refactoring.

validate.setOnClickListener{ chooseGenreByArtist(searchArtistEditable.toString(), R.string.gameGenre_byArtistSearch) }
}

private fun chooseGenreByTag(tag: String, mode: Int) {
Copy link

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.

chooseGenre(method = LastfmMethod.BY_TAG.method, tag = tag, mode = mode)
}

private fun chooseGenreByArtist(artist: String, mode: Int) {
Copy link

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.

queryRooms.addValueEventListener(object : ValueEventListener {
override fun onDataChange(dataSnapshot: DataSnapshot) {
for (score in dataSnapshot.children) {
val email = (score.value as HashMap<String, Object>)["first"] as String
Copy link

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.

override fun onDataChange(dataSnapshot: DataSnapshot) {
for (score in dataSnapshot.children) {
val email = (score.value as HashMap<String, Object>)["first"] as String
val gameScore = ((score.value as HashMap<String, Object>)["second"] as Long).toInt()
Copy link

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.

val billieEilish = vmGenreSetup.view.findViewById<Button>(R.id.billieEilishButton)
val validate = vmGenreSetup.view.findViewById<Button>(R.id.validateSearch)

kpop.setOnClickListener { chooseGenre(tag = "kpop", mode = R.string.kpop) }
Copy link

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 5 locations. Consider refactoring.

val validate = vmGenreSetup.view.findViewById<Button>(R.id.validateSearch)

kpop.setOnClickListener { chooseGenre(tag = "kpop", mode = R.string.kpop) }
rock.setOnClickListener { chooseGenre(tag = "rock", mode = R.string.rock) }
Copy link

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 5 locations. Consider refactoring.


kpop.setOnClickListener { chooseGenre(tag = "kpop", mode = R.string.kpop) }
rock.setOnClickListener { chooseGenre(tag = "rock", mode = R.string.rock) }
bts.setOnClickListener { chooseGenre(artist = "BTS", mode = R.string.gameGenre_bts) }
Copy link

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 5 locations. Consider refactoring.

rock.setOnClickListener { chooseGenre(tag = "rock", mode = R.string.rock) }
bts.setOnClickListener { chooseGenre(artist = "BTS", mode = R.string.gameGenre_bts) }
topTracks.setOnClickListener { chooseGenre(mode = R.string.top_tracks) }
imagDragons.setOnClickListener{ chooseGenre(artist = "Imagine Dragons", mode = R.string.gameGenre_imagine_dragons) }
Copy link

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 5 locations. Consider refactoring.

bts.setOnClickListener { chooseGenre(artist = "BTS", mode = R.string.gameGenre_bts) }
topTracks.setOnClickListener { chooseGenre(mode = R.string.top_tracks) }
imagDragons.setOnClickListener{ chooseGenre(artist = "Imagine Dragons", mode = R.string.gameGenre_imagine_dragons) }
billieEilish.setOnClickListener { chooseGenre(artist = "Billie Eilish", mode = R.string.gameGenre_billie_eilish) }
Copy link

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 5 locations. Consider refactoring.

Copy link
Collaborator

@laurislopata laurislopata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Owner

@MaximeZmt MaximeZmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be accepted by the CI one day

setGenreListeners()

val bundle = this.arguments
if (bundle != null) {
Copy link

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 2 locations. Consider refactoring.

vmChooseRoom.view = view
vmChooseRoom.ctx = view.context
val bundle = this.arguments
if (bundle != null) {
Copy link

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 2 locations. Consider refactoring.

setGameSongList(uri, playOffline)

val bundle = bundleOf("gameManager" to gameManager)
if(!test) {
Copy link

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.


createPartyRoom.setOnClickListener {
val bundle = bundleOf("gameManager" to gameManager)
if(!test){
Copy link

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.


private fun setReturnBtnListener() {
vmGenreSetup.view.findViewById<FloatingActionButton>(R.id.genreSetup_returnToMain).setOnClickListener {
if(!test) {
Copy link

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 2 locations. Consider refactoring.

@codeclimate
Copy link

codeclimate bot commented Jun 9, 2022

Code Climate has analyzed commit 3fc67c4 and detected 11 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 3
Duplication 8

The test coverage on the diff in this pull request is 0.0% (80% is the threshold).

This pull request will bring the total coverage in the repository to 0.0% (-84.4% change).

View more on Code Climate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants