diff --git a/audioPlayer.go b/audioPlayer.go index 3fd8053..cbba431 100644 --- a/audioPlayer.go +++ b/audioPlayer.go @@ -9,7 +9,7 @@ type audioPlayerData struct { } // NewAudioPlayer create new MediaPlayer object and return it -func NewAudioPlayer(session Session, params Params) MediaPlayer { +func NewAudioPlayer(session Session, params Params) AudioPlayer { view := new(audioPlayerData) view.Init(session) view.tag = "AudioPlayer" diff --git a/videoPlayer.go b/videoPlayer.go index 17158fe..0f50f5c 100644 --- a/videoPlayer.go +++ b/videoPlayer.go @@ -28,7 +28,7 @@ type videoPlayerData struct { } // NewVideoPlayer create new MediaPlayer object and return it -func NewVideoPlayer(session Session, params Params) MediaPlayer { +func NewVideoPlayer(session Session, params Params) VideoPlayer { view := new(videoPlayerData) view.Init(session) view.tag = "VideoPlayer" diff --git a/viewByID.go b/viewByID.go index 91a2927..2714c0a 100644 --- a/viewByID.go +++ b/viewByID.go @@ -312,3 +312,27 @@ func VideoPlayerByID(rootView View, id string) VideoPlayer { } return nil } + +// ImageViewByID return a ImageView with id equal to the argument of the function or +// nil if there is no such View or View is not ImageView +func ImageViewByID(rootView View, id string) ImageView { + if view := ViewByID(rootView, id); view != nil { + if canvas, ok := view.(ImageView); ok { + return canvas + } + ErrorLog(`ImageViewByID(_, "` + id + `"): The found View is not ImageView`) + } + return nil +} + +// TableViewByID return a TableView with id equal to the argument of the function or +// nil if there is no such View or View is not TableView +func TableViewByID(rootView View, id string) TableView { + if view := ViewByID(rootView, id); view != nil { + if canvas, ok := view.(TableView); ok { + return canvas + } + ErrorLog(`TableViewByID(_, "` + id + `"): The found View is not TableView`) + } + return nil +}