by Dmytro Danylyk & William Shakespeare
Romeo - is the son of Montague (Developer)
Juliet - is the daughter of Capulet (Designer)
Montague (Developers) and Capulet (Designers) - are involved in a team feud that goes back years before any of the members were born.
once upon a time
Juliet meets Romeo on android project discussion where displaying video must take place.
"To Intent, or not to Intent, that is the question?" - Romeo
"We need a custom..." - Juliet
when to intent?
- when functionality is hard to implement (send email)
- when you need social sharing (facebook, twitter)
- when you don't need extra functionality (play video)
tragical history of
what romeo think will work
"I forgot to tell..." - Juliet
"We need to make it draggable like in YouTube app"
"We need to display list of videos like in Instagram app"
"Could you remove black lines"
welcome to world of black pixels
what happenS when you scroll
what happenS when you animate
what happenS if you crop
why are you doing this to me?
"Surface view creates a new window, placed behind your application’s window, to manage content."
How it works?
Chestburster design pattern - make a hole in your application to inject extra functionality.
- Unexpected behavior inside scrollable container
Unexpected behavior with animations
- No way to crop content
when to use?
- Play Video
- Stream Camera
- Render OpenGL
Why to use?
"Texture View - does not create a separate window but behaves as a regular view."
"Because it uses hardware accelerated 2D rendering - it is so fast and efficient."
- API level 14
- Hardware Acceleration
video from assets
Texture Video View
"TextureVideoView - is custom view based on android TextureView which gives you ability easily play and crop video.
why to use?
W/MediaPlayer﹕ info/warning (1, 26) E/MediaPlayer﹕ error (1, -4)
E/MediaPlayer: error (1, -2147483648)
E/MediaPlayer﹕ start called in state 4 E/MediaPlayer﹕ error (-38, 0) E/MediaPlayer﹕ Error (-38,0)
how it looks?
Prevent from appearing in Google Play
Check if device has camera
Check if camera is available
Lock activity screen orientation
Calculate camera orientation
Calculate preview size
Check if feature is available before using it
Don't lock camera forever, you are not alone
Content Stream - Android Tragedy
By Dmytro Danylyk