Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FancyPicture class #18

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add FancyPicture class #18

wants to merge 5 commits into from

Conversation

stop-upiter
Copy link
Contributor

No description provided.

@stop-upiter stop-upiter requested a review from 0xera as a code owner May 26, 2021 21:22

// todo id generator

var image: Bitmap = pair.first
Copy link
Contributor

Choose a reason for hiding this comment

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

data class FancyPicture(
    val id: String,
    val title: String,
    val image: Bitmap,
    val colors: List<List<String>>
)

Этот класс хранит данные, попробуй сделать дата классом, Array заменить на List. String? заменить на String, Избегайте nullable по возможности.

init {
    width = colors.size
    length = colors[0].size
}

А если массив пустой? тут init отвалится с outofboundexeption. лучше вычислять length rows/columns там где это необходимо, сделав проверку на наличие чего-либо в этом списке.

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