customize placeholder text and fix update bug
This commit is contained in:
@@ -24,6 +24,8 @@ import (
|
||||
type SearchDialog struct {
|
||||
widget.BaseWidget
|
||||
|
||||
PlaceholderText string
|
||||
|
||||
OnDismiss func()
|
||||
OnNavigateTo func(mediaprovider.ContentType, string)
|
||||
OnSearched func(string) []*mediaprovider.SearchResult
|
||||
@@ -97,6 +99,13 @@ func (sd *SearchDialog) Show() {
|
||||
sd.BaseWidget.Show()
|
||||
}
|
||||
|
||||
func (sd *SearchDialog) Refresh() {
|
||||
if sd.PlaceholderText != "" {
|
||||
sd.searchEntry.SetPlaceHolder(sd.PlaceholderText)
|
||||
}
|
||||
sd.BaseWidget.Refresh()
|
||||
}
|
||||
|
||||
func (sd *SearchDialog) onDismiss() {
|
||||
if sd.OnDismiss != nil {
|
||||
sd.OnDismiss()
|
||||
@@ -267,7 +276,7 @@ func (s *searchResult) Update(result *mediaprovider.SearchResult) {
|
||||
if result == nil {
|
||||
return
|
||||
}
|
||||
if s.contentType == result.Type && s.id == result.ID {
|
||||
if s.contentType == result.Type && s.id == result.ID && s.title.Text == result.Name {
|
||||
return // nothing to do
|
||||
}
|
||||
s.id = result.ID
|
||||
|
||||
@@ -35,6 +35,7 @@ func NewSelectPlaylistDialog(mp mediaprovider.MediaProvider, im util.ImageFetche
|
||||
sp.onSearched,
|
||||
sp.onInit,
|
||||
)
|
||||
sd.PlaceholderText = "Search playlists or new playlist name"
|
||||
sp.SearchDialog = sd
|
||||
return sp
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user