-
Notifications
You must be signed in to change notification settings - Fork 155
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
Playlist thumbnail #4411
Playlist thumbnail #4411
Conversation
2. Updated thumbnail in HomePage also
Moderators, |
btw, i used this api for photo picker |
Thanks, but app must remain FOSS and isn't possible to use Google Play Service api, instead try a solution without it. |
Updated, now i am using |
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.
some suggestions to make the code easier to read and understand
@@ -503,6 +505,31 @@ fun PlaylistsItemGridMenu( | |||
) | |||
} | |||
|
|||
onEditThumbnail?.let { onEditThumbnail -> |
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.
These two are identical, except for the title
. Having two similar blocks of code makes it harder to read and harder to maintain.
I can suggest a solution
var title: Int? = null
if( onEditThumbnail != null )
title = R.string.edit_thumbnail
if( onResetThumbnail != null )
title = R.string.reset_thumbnail
title ?: return // Or something that skip next line
GridMenuItem(
icon = R.drawable.image,
title = title,
colorIcon = colorPalette.text,
colorText = colorPalette.text,
onClick = {
onDismiss()
onEditThumbnail()
}
)
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.
- This code snippet doesn't allow both options simultaneously, right?
- They differ in the callback function too, not just the title.
- It's kind of repetitive, I agree, but thats how all the other options were written
@@ -566,6 +570,28 @@ fun PlaylistsItemMenu( | |||
} | |||
) | |||
} | |||
|
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.
Same thing.
Even better, make a separate function handles this particular thing
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.
I understand that they are kind of repetitive. But, Since all the other menu items are listed this way, putting only these 2 items in a separate function and then calling them here will lead to more confusion is what I feel.
false | ||
} | ||
} | ||
|
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.
use rememberLauncherForActivityResult
. Example HERE
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.
But these are operations on file that are stored in internal storage of the apps, so there is no need to ask user consent right? Hence, rememberLauncherForActivityResult
is unnecessary right?
@Abhinavreddy-B Two improvements:
|
Resolved in 29e21f6 |
Update your repo and resolve conflict in your branch please, i can't merge it. |
Resolved conflicts now :) |
Thanks for patience |
@knighthat it's ok, isn't necessary add other extreme code optimizations. @Abhinavreddy-B merge in progress... |
@fast4x not extreme but eaiser down the road to read and fix bugs. I'm fixing tons of ridiculous errors in the code base and you couldn't believe the amount of duplicate/nested code |
Please don’t change the code, because it can indirectly generate bugs. Focus on other things please, code it's ok, not necessary change it. |
Functionality to pick custom thumbnails for playlist