Conversation
video_2022-12-31_16-53-52.mp4 |
| } | ||
| binding?.run { | ||
| if (intent.getLongExtra("arg_id_value", -1L) == -1L) { | ||
| supportFragmentManager.beginTransaction().setCustomAnimations( |
There was a problem hiding this comment.
смену фрагмента можно было вынести в отдельный метод, и как аргумент передавать фрагмент
There was a problem hiding this comment.
В параметрах этого метода получается будет fragment: Fragment, то есть восходящее преобразование, а у класса Fragment нет метода newInstance, который мне нужен. Либо кастить и проверять успешно ли и от этого уже отталкиваться, но мне кажется это ещё больше код усложнит для читаемости
| ) | ||
| .add(R.id.fragment_container, MainFragment()).commit() | ||
| } else { | ||
| val id = intent.getLongExtra("arg_id_value", -1) |
There was a problem hiding this comment.
"arg_id_value" лучше константы выносить в const val
| } | ||
| } | ||
|
|
||
| private var broadcastReceiver = object : BroadcastReceiver() { |
There was a problem hiding this comment.
имеет место быть, но можно было и обычным интентом передать
|
|
||
| prevIdFromBundle = idFromBundle | ||
| idFromBundle = nextIdFromBundle | ||
| nextIdFromBundle = nextIdFromBundle!! + 1 |
| } | ||
| } | ||
|
|
||
| companion object { |
There was a problem hiding this comment.
companion object обычно располагается в самом конце класса
| nextSong = SongRepository.songsList[nextIdFromBundle!!.toInt()] | ||
| } | ||
|
|
||
| fun actionFromNotification(intent: Intent) { |
There was a problem hiding this comment.
можно было приватным сделать, не?
| .setPriority(NotificationCompat.PRIORITY_LOW) | ||
| .setContentIntent(pending) | ||
| .build() | ||
| notificationManagerCompat.notify(1, notification!!) |
There was a problem hiding this comment.
очень много !!, надо разучиться писать их, это bad practice. Ты как разраб, должен эти нули обрабатывать
No description provided.