Skip to content

Task/hw 9#11

Open
GorlovDanila wants to merge 4 commits intomasterfrom
task/hw-9
Open

Task/hw 9#11
GorlovDanila wants to merge 4 commits intomasterfrom
task/hw-9

Conversation

@GorlovDanila
Copy link
Copy Markdown
Owner

No description provided.

@GorlovDanila
Copy link
Copy Markdown
Owner Author

video_2022-12-31_16-53-52.mp4

}
binding?.run {
if (intent.getLongExtra("arg_id_value", -1L) == -1L) {
supportFragmentManager.beginTransaction().setCustomAnimations(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

смену фрагмента можно было вынести в отдельный метод, и как аргумент передавать фрагмент

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

В параметрах этого метода получается будет fragment: Fragment, то есть восходящее преобразование, а у класса Fragment нет метода newInstance, который мне нужен. Либо кастить и проверять успешно ли и от этого уже отталкиваться, но мне кажется это ещё больше код усложнит для читаемости

)
.add(R.id.fragment_container, MainFragment()).commit()
} else {
val id = intent.getLongExtra("arg_id_value", -1)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

"arg_id_value" лучше константы выносить в const val

}
}

private var broadcastReceiver = object : BroadcastReceiver() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

имеет место быть, но можно было и обычным интентом передать


prevIdFromBundle = idFromBundle
idFromBundle = nextIdFromBundle
nextIdFromBundle = nextIdFromBundle!! + 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

!! такое себе

}
}

companion object {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

companion object обычно располагается в самом конце класса

nextSong = SongRepository.songsList[nextIdFromBundle!!.toInt()]
}

fun actionFromNotification(intent: Intent) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

можно было приватным сделать, не?

.setPriority(NotificationCompat.PRIORITY_LOW)
.setContentIntent(pending)
.build()
notificationManagerCompat.notify(1, notification!!)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

очень много !!, надо разучиться писать их, это bad practice. Ты как разраб, должен эти нули обрабатывать

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants