SlideShare a Scribd company logo
1 of 20
Download to read offline
VIEW CUSTOMIZATION
IN A NUTSHELL
@bernhardpflug
plus.google.com/+BernhardPflug
Iconmobile
170
Headquarter
BMW
BMW remote apps
The app
UX Don’t just start coding
Make it easy to
send feedback
Analyse usage
One UX example
Custom view drawing with animation
public class TankView extends ViewGroup {
!
. . .
!
private void updateBoilerAppearance() {
. . .
liquidPaths[i] = new Path();

liquidPaints[i] = new Paint(liquidPaint);



liquidPaints[i].setShader(new LinearGradient(. . .}, new float[] { . . . },
Shader.TileMode.CLAMP));
!
liquidPaths[i].moveTo(. . .);
liquidPaths[i].lineTo(. . .);
liquidPaths[i].quadTo(. . .);

. . .
!
liquidPathEffects[i].add(new DashPathEffect(new float[] { . . . ));
!
}
!
. . .
}
!
!
!
@Override

protected void dispatchDraw(Canvas canvas) {



canvas.saveLayerAlpha(0, 0, canvas.getWidth(), canvas.getHeight(), alpha,
Canvas.HAS_ALPHA_LAYER_SAVE_FLAG);



canvas.drawPath(boilerContour, contourPaint);


. . .


if (state == State.HEATING) {

// draw pipe

canvas.drawRect(pipeBounds, fillPaint);

canvas.drawLine(. . . );

canvas.drawLine(. . . );



// draw liquid

for (int i = 0; i < liquidPaths.length; i++) {

canvas.drawPath(liquidPaths[i], liquidPaints[i]);

}



liquidAnimHandler.postDelayed(liquidAnimation, 50);

}

}
Custom view drawing with animation
@Override

protected void onSizeChanged(int w, int h, int oldw, int oldh) {



updateBoilerAppearance();

super.onSizeChanged(w, h, oldw, oldh);

}
Custom view drawing with animation
public class SvgView extends View {
!
. . .
!
@Override

protected void onSizeChanged(int w, int h, int oldw, int oldh) {

super.onSizeChanged(w, h, oldw, oldh);



if (w > 0 && h > 0 && svg != null) {

svg.setDocumentWidth(w);

svg.setDocumentHeight(h);

Bitmap svgBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);

Canvas bitmapCanvas = new Canvas(svgBitmap);

// Render our document onto our canvas

svg.renderToCanvas(bitmapCanvas);

setBackgroundDrawable(new BitmapDrawable(getResources(), svgBitmap));

}

}
!
. . .
}
Consider SVG instead of dpi graphics
{} @ github.com/bernhardpflug/AndroidUtilities
Custom swipe component
Custom swipe component
Ground View
Sky View
public class VerticalViewPager extends ViewGroup {
. . .
!
@Override

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {



int width = getDefaultSize(0, widthMeasureSpec);

int height = getDefaultSize(0, heightMeasureSpec);

setMeasuredDimension(width, height);



int hPadding = getPaddingLeft()+getPaddingRight();

int vPadding = getPaddingTop()+getPaddingBottom();



int contentWidth = getChildMeasureSpec(widthMeasureSpec, hPadding , width);

int contentHeight = getChildMeasureSpec(heightMeasureSpec,vPadding , height);


groundView.measure(contentWidth, contentHeight);



int skyViewHeight = skyView.getLayoutParams().height;

int skyHeight = getChildMeasureSpec(heightMeasureSpec, vPadding, skyViewHeight);

skyView.measure(contentWidth, skyHeight);


}
!
. . .
!
}
Implementing custom swipe components
{} @ github.com/bernhardpflug/AndroidUtilities
Ground View
Sky View
@Override

protected void onLayout(boolean changed, int l, int t, int r, int b) {

final int width = r - l;

final int height = b - t;



int skyViewHeight = skyView.getMeasuredHeight();

skyView.layout(0, 0, width, skyView.getMeasuredHeight());

groundView.layout(0, skyViewHeight, width, height + skyViewHeight);


}
Implementing custom swipe components
{} @ github.com/bernhardpflug/AndroidUtilities
Ground View
Sky View
@Override

public boolean onTouchEvent(MotionEvent event) {
!
. . .
!
switch (event.getAction()) {

. . .



case MotionEvent.ACTION_MOVE:
!
int touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();




if (!verticalScrolling && Math.abs(deltaY) > touchSlop) {

verticalScrolling = true;



requestDisallowInterceptTouchEvent(true);
!
if (getScrollY() + deltaY <= State.CLOSED && getScrollY() + deltaY >= State.OPEN)
{

scrollBy(0, (int) deltaY);



}


}
!
!
}
Implementing custom swipe components
{} @ github.com/bernhardpflug/AndroidUtilities
@Override

public boolean onTouchEvent(MotionEvent event) {
!
. . .
!
switch (event.getAction()) {

. . .



case MotionEvent.ACTION_UP:



scroller.startScroll(0, getScrollY(), 0, getY(destinationState) - getScrollY());


break;
!
!
}
Implementing custom swipe components
{} @ github.com/bernhardpflug/AndroidUtilities
@Override

public void computeScroll() {

if (scroller.computeScrollOffset()) {



int x = scroller.getCurrX();

int y = scroller.getCurrY();



scrollTo(x, y);



postInvalidate();

}
}
Implementing custom swipe components
{} @ github.com/bernhardpflug/AndroidUtilities
at.bernhardpflug.heating
Give it a try
Google Play
{} @ github.com/bernhardpflug/AndroidUtilities
Thank you!
plus.google.com/+BernhardPflug
@bernhardpflug

More Related Content

Viewers also liked

Knock knock on GameDev gateway! - Introduction to Game development
Knock knock on GameDev gateway! - Introduction to Game developmentKnock knock on GameDev gateway! - Introduction to Game development
Knock knock on GameDev gateway! - Introduction to Game developmentMamdouh Tarabishi
 
[MBF2] APIs Deezer par Cédric Pascal & Louis Cheynel
[MBF2] APIs Deezer par Cédric Pascal & Louis Cheynel[MBF2] APIs Deezer par Cédric Pascal & Louis Cheynel
[MBF2] APIs Deezer par Cédric Pascal & Louis CheynelBeMyApp
 
Deloitte UK / Facebook : a people based telecom business - breathing new lif...
Deloitte UK / Facebook  : a people based telecom business - breathing new lif...Deloitte UK / Facebook  : a people based telecom business - breathing new lif...
Deloitte UK / Facebook : a people based telecom business - breathing new lif...yann le gigan
 
[MBF2] Webinar plate-forme Salesforce #1
[MBF2] Webinar plate-forme Salesforce #1[MBF2] Webinar plate-forme Salesforce #1
[MBF2] Webinar plate-forme Salesforce #1BeMyApp
 
“Les Français et les Campagnes «Santé»” Enquête Future Thinking / FNAIM - Fév...
“Les Français et les Campagnes «Santé»” Enquête Future Thinking / FNAIM - Fév...“Les Français et les Campagnes «Santé»” Enquête Future Thinking / FNAIM - Fév...
“Les Français et les Campagnes «Santé»” Enquête Future Thinking / FNAIM - Fév...yann le gigan
 
[Ultracode Munich Meetup #9] From Sand to Silicon by Christian Anderka
[Ultracode Munich Meetup #9] From Sand to Silicon by Christian Anderka[Ultracode Munich Meetup #9] From Sand to Silicon by Christian Anderka
[Ultracode Munich Meetup #9] From Sand to Silicon by Christian AnderkaBeMyApp
 
L'oculus rift de a à z meetup unity
L'oculus rift de a à z   meetup unityL'oculus rift de a à z   meetup unity
L'oculus rift de a à z meetup unityBeMyApp
 
HP Helion European Webinar Series ,Webinar #3
HP Helion European Webinar Series ,Webinar #3 HP Helion European Webinar Series ,Webinar #3
HP Helion European Webinar Series ,Webinar #3 BeMyApp
 
HP Helion Webinar #2
HP Helion Webinar #2 HP Helion Webinar #2
HP Helion Webinar #2 BeMyApp
 
HP Helion Webinar #1 - Introduction to HP Helion OpenStack w/Christian Frank
HP Helion Webinar #1 - Introduction to HP Helion OpenStack w/Christian FrankHP Helion Webinar #1 - Introduction to HP Helion OpenStack w/Christian Frank
HP Helion Webinar #1 - Introduction to HP Helion OpenStack w/Christian FrankBeMyApp
 
[MirrorLink Hackathon] Introduction Slideshow by Alexandre Sutra
[MirrorLink Hackathon] Introduction Slideshow by Alexandre Sutra[MirrorLink Hackathon] Introduction Slideshow by Alexandre Sutra
[MirrorLink Hackathon] Introduction Slideshow by Alexandre SutraBeMyApp
 
Augmented Reality (AR) in Education
Augmented Reality (AR) in EducationAugmented Reality (AR) in Education
Augmented Reality (AR) in EducationSteve Yuen
 

Viewers also liked (13)

Knock knock on GameDev gateway! - Introduction to Game development
Knock knock on GameDev gateway! - Introduction to Game developmentKnock knock on GameDev gateway! - Introduction to Game development
Knock knock on GameDev gateway! - Introduction to Game development
 
Web Server Load Balancing
Web Server Load BalancingWeb Server Load Balancing
Web Server Load Balancing
 
[MBF2] APIs Deezer par Cédric Pascal & Louis Cheynel
[MBF2] APIs Deezer par Cédric Pascal & Louis Cheynel[MBF2] APIs Deezer par Cédric Pascal & Louis Cheynel
[MBF2] APIs Deezer par Cédric Pascal & Louis Cheynel
 
Deloitte UK / Facebook : a people based telecom business - breathing new lif...
Deloitte UK / Facebook  : a people based telecom business - breathing new lif...Deloitte UK / Facebook  : a people based telecom business - breathing new lif...
Deloitte UK / Facebook : a people based telecom business - breathing new lif...
 
[MBF2] Webinar plate-forme Salesforce #1
[MBF2] Webinar plate-forme Salesforce #1[MBF2] Webinar plate-forme Salesforce #1
[MBF2] Webinar plate-forme Salesforce #1
 
“Les Français et les Campagnes «Santé»” Enquête Future Thinking / FNAIM - Fév...
“Les Français et les Campagnes «Santé»” Enquête Future Thinking / FNAIM - Fév...“Les Français et les Campagnes «Santé»” Enquête Future Thinking / FNAIM - Fév...
“Les Français et les Campagnes «Santé»” Enquête Future Thinking / FNAIM - Fév...
 
[Ultracode Munich Meetup #9] From Sand to Silicon by Christian Anderka
[Ultracode Munich Meetup #9] From Sand to Silicon by Christian Anderka[Ultracode Munich Meetup #9] From Sand to Silicon by Christian Anderka
[Ultracode Munich Meetup #9] From Sand to Silicon by Christian Anderka
 
L'oculus rift de a à z meetup unity
L'oculus rift de a à z   meetup unityL'oculus rift de a à z   meetup unity
L'oculus rift de a à z meetup unity
 
HP Helion European Webinar Series ,Webinar #3
HP Helion European Webinar Series ,Webinar #3 HP Helion European Webinar Series ,Webinar #3
HP Helion European Webinar Series ,Webinar #3
 
HP Helion Webinar #2
HP Helion Webinar #2 HP Helion Webinar #2
HP Helion Webinar #2
 
HP Helion Webinar #1 - Introduction to HP Helion OpenStack w/Christian Frank
HP Helion Webinar #1 - Introduction to HP Helion OpenStack w/Christian FrankHP Helion Webinar #1 - Introduction to HP Helion OpenStack w/Christian Frank
HP Helion Webinar #1 - Introduction to HP Helion OpenStack w/Christian Frank
 
[MirrorLink Hackathon] Introduction Slideshow by Alexandre Sutra
[MirrorLink Hackathon] Introduction Slideshow by Alexandre Sutra[MirrorLink Hackathon] Introduction Slideshow by Alexandre Sutra
[MirrorLink Hackathon] Introduction Slideshow by Alexandre Sutra
 
Augmented Reality (AR) in Education
Augmented Reality (AR) in EducationAugmented Reality (AR) in Education
Augmented Reality (AR) in Education
 

Similar to [Ultracode Munich Meetup #7] Android view customization in a nutshell

Creating an Uber Clone - Part XXIV - Transcript.pdf
Creating an Uber Clone - Part XXIV - Transcript.pdfCreating an Uber Clone - Part XXIV - Transcript.pdf
Creating an Uber Clone - Part XXIV - Transcript.pdfShaiAlmog1
 
Android design and Custom views
Android design and Custom views Android design and Custom views
Android design and Custom views Lars Vogel
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)Katsumi Kishikawa
 
Android Wear Essentials
Android Wear EssentialsAndroid Wear Essentials
Android Wear EssentialsNilhcem
 
How to build a html5 websites.v1
How to build a html5 websites.v1How to build a html5 websites.v1
How to build a html5 websites.v1Bitla Software
 
HTML5って必要?
HTML5って必要?HTML5って必要?
HTML5って必要?GCS2013
 
Responsive layouts by Maqbool
Responsive layouts by MaqboolResponsive layouts by Maqbool
Responsive layouts by MaqboolNavin Agarwal
 
Enhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsEnhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsNaman Dwivedi
 
Sperimentazioni lezione6 from_designtoapplication copy
Sperimentazioni lezione6 from_designtoapplication copySperimentazioni lezione6 from_designtoapplication copy
Sperimentazioni lezione6 from_designtoapplication copySalvatore Iaconesi
 
Custom UI Components at Android Only 2011
Custom UI Components at Android Only 2011Custom UI Components at Android Only 2011
Custom UI Components at Android Only 2011Johan Nilsson
 
Manual Layout Revisited
Manual Layout RevisitedManual Layout Revisited
Manual Layout Revisitedgillygize
 
Android accessibility for developers and QA
Android accessibility for developers and QAAndroid accessibility for developers and QA
Android accessibility for developers and QATed Drake
 
Drawing with the HTML5 Canvas
Drawing with the HTML5 CanvasDrawing with the HTML5 Canvas
Drawing with the HTML5 CanvasHenry Osborne
 
Creating custom views
Creating custom viewsCreating custom views
Creating custom viewsMu Chun Wang
 
Android development for iOS developers
Android development for iOS developersAndroid development for iOS developers
Android development for iOS developersDarryl Bayliss
 

Similar to [Ultracode Munich Meetup #7] Android view customization in a nutshell (20)

Creating an Uber Clone - Part XXIV - Transcript.pdf
Creating an Uber Clone - Part XXIV - Transcript.pdfCreating an Uber Clone - Part XXIV - Transcript.pdf
Creating an Uber Clone - Part XXIV - Transcript.pdf
 
Android design and Custom views
Android design and Custom views Android design and Custom views
Android design and Custom views
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)
 
Prototype UI
Prototype UIPrototype UI
Prototype UI
 
Android Wear Essentials
Android Wear EssentialsAndroid Wear Essentials
Android Wear Essentials
 
How to build a html5 websites.v1
How to build a html5 websites.v1How to build a html5 websites.v1
How to build a html5 websites.v1
 
HTML5って必要?
HTML5って必要?HTML5って必要?
HTML5って必要?
 
Responsive layouts by Maqbool
Responsive layouts by MaqboolResponsive layouts by Maqbool
Responsive layouts by Maqbool
 
Enhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsEnhancing UI/UX using Java animations
Enhancing UI/UX using Java animations
 
Canvas al ajillo
Canvas al ajilloCanvas al ajillo
Canvas al ajillo
 
Sperimentazioni lezione6 from_designtoapplication copy
Sperimentazioni lezione6 from_designtoapplication copySperimentazioni lezione6 from_designtoapplication copy
Sperimentazioni lezione6 from_designtoapplication copy
 
Prototype UI Intro
Prototype UI IntroPrototype UI Intro
Prototype UI Intro
 
Custom UI Components at Android Only 2011
Custom UI Components at Android Only 2011Custom UI Components at Android Only 2011
Custom UI Components at Android Only 2011
 
Manual Layout Revisited
Manual Layout RevisitedManual Layout Revisited
Manual Layout Revisited
 
Android accessibility for developers and QA
Android accessibility for developers and QAAndroid accessibility for developers and QA
Android accessibility for developers and QA
 
Drawing with the HTML5 Canvas
Drawing with the HTML5 CanvasDrawing with the HTML5 Canvas
Drawing with the HTML5 Canvas
 
Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
 
Android query
Android queryAndroid query
Android query
 
Creating custom views
Creating custom viewsCreating custom views
Creating custom views
 
Android development for iOS developers
Android development for iOS developersAndroid development for iOS developers
Android development for iOS developers
 

More from BeMyApp

Introduction to epid
Introduction to epidIntroduction to epid
Introduction to epidBeMyApp
 
Introduction ciot workshop premeetup
Introduction ciot workshop premeetupIntroduction ciot workshop premeetup
Introduction ciot workshop premeetupBeMyApp
 
Présentation des APIs cognitives IBM Watson
Présentation des APIs cognitives IBM WatsonPrésentation des APIs cognitives IBM Watson
Présentation des APIs cognitives IBM WatsonBeMyApp
 
Crédit Agricole S.A. Personae et Parcours
Crédit Agricole S.A. Personae et ParcoursCrédit Agricole S.A. Personae et Parcours
Crédit Agricole S.A. Personae et ParcoursBeMyApp
 
Cisco Paris DevNet Hackathon slideshow - Intro
Cisco Paris DevNet Hackathon slideshow - IntroCisco Paris DevNet Hackathon slideshow - Intro
Cisco Paris DevNet Hackathon slideshow - IntroBeMyApp
 
Tumeurs Neuroendocrines : une vue d'ensemble
Tumeurs Neuroendocrines : une vue d'ensembleTumeurs Neuroendocrines : une vue d'ensemble
Tumeurs Neuroendocrines : une vue d'ensembleBeMyApp
 
Building your first game in Unity 3d by Sarah Sexton
Building your first game in Unity 3d  by Sarah SextonBuilding your first game in Unity 3d  by Sarah Sexton
Building your first game in Unity 3d by Sarah SextonBeMyApp
 
Using intel's real sense to create games with natural user interfaces justi...
Using intel's real sense to create games with natural user interfaces   justi...Using intel's real sense to create games with natural user interfaces   justi...
Using intel's real sense to create games with natural user interfaces justi...BeMyApp
 
Introduction to using the R200 camera & Realsense SDK in Unity3d - Jon Collins
Introduction to using the R200 camera & Realsense SDK in Unity3d - Jon CollinsIntroduction to using the R200 camera & Realsense SDK in Unity3d - Jon Collins
Introduction to using the R200 camera & Realsense SDK in Unity3d - Jon CollinsBeMyApp
 
Audio Mixer in Unity5 - Andy Touch
Audio Mixer in Unity5 - Andy TouchAudio Mixer in Unity5 - Andy Touch
Audio Mixer in Unity5 - Andy TouchBeMyApp
 
Shaders - Claudia Doppioslash - Unity With the Best
Shaders - Claudia Doppioslash - Unity With the BestShaders - Claudia Doppioslash - Unity With the Best
Shaders - Claudia Doppioslash - Unity With the BestBeMyApp
 
[HACKATHON CISCO PARIS] Slideshow du workshop Smart City
[HACKATHON CISCO PARIS] Slideshow du workshop Smart City[HACKATHON CISCO PARIS] Slideshow du workshop Smart City
[HACKATHON CISCO PARIS] Slideshow du workshop Smart CityBeMyApp
 
Tools to Save Time
Tools to Save TimeTools to Save Time
Tools to Save TimeBeMyApp
 
[Workshop e résidents] présentation intent, craft ai, dalkia et incubateur
[Workshop e résidents] présentation intent, craft ai, dalkia et incubateur[Workshop e résidents] présentation intent, craft ai, dalkia et incubateur
[Workshop e résidents] présentation intent, craft ai, dalkia et incubateurBeMyApp
 
[Webinar E-résidents #1] Présentation des différents métiers du bâtiment conn...
[Webinar E-résidents #1] Présentation des différents métiers du bâtiment conn...[Webinar E-résidents #1] Présentation des différents métiers du bâtiment conn...
[Webinar E-résidents #1] Présentation des différents métiers du bâtiment conn...BeMyApp
 
[IoT World Forum Webinar] Review of CMX Cisco technology
[IoT World Forum Webinar] Review of CMX Cisco technology[IoT World Forum Webinar] Review of CMX Cisco technology
[IoT World Forum Webinar] Review of CMX Cisco technologyBeMyApp
 
HP Helion Episode 6: Cloud Foundry Summit Recap
HP Helion Episode 6: Cloud Foundry Summit RecapHP Helion Episode 6: Cloud Foundry Summit Recap
HP Helion Episode 6: Cloud Foundry Summit RecapBeMyApp
 
Webinar UI/UX by Francesco Marcellino
Webinar UI/UX by Francesco MarcellinoWebinar UI/UX by Francesco Marcellino
Webinar UI/UX by Francesco MarcellinoBeMyApp
 
HP Helion Webinar #5 - Security Beyond Firewalls
HP Helion Webinar #5 - Security Beyond FirewallsHP Helion Webinar #5 - Security Beyond Firewalls
HP Helion Webinar #5 - Security Beyond FirewallsBeMyApp
 
HP Helion Webinar #4 - Open stack the magic pill
HP Helion Webinar #4 - Open stack the magic pillHP Helion Webinar #4 - Open stack the magic pill
HP Helion Webinar #4 - Open stack the magic pillBeMyApp
 

More from BeMyApp (20)

Introduction to epid
Introduction to epidIntroduction to epid
Introduction to epid
 
Introduction ciot workshop premeetup
Introduction ciot workshop premeetupIntroduction ciot workshop premeetup
Introduction ciot workshop premeetup
 
Présentation des APIs cognitives IBM Watson
Présentation des APIs cognitives IBM WatsonPrésentation des APIs cognitives IBM Watson
Présentation des APIs cognitives IBM Watson
 
Crédit Agricole S.A. Personae et Parcours
Crédit Agricole S.A. Personae et ParcoursCrédit Agricole S.A. Personae et Parcours
Crédit Agricole S.A. Personae et Parcours
 
Cisco Paris DevNet Hackathon slideshow - Intro
Cisco Paris DevNet Hackathon slideshow - IntroCisco Paris DevNet Hackathon slideshow - Intro
Cisco Paris DevNet Hackathon slideshow - Intro
 
Tumeurs Neuroendocrines : une vue d'ensemble
Tumeurs Neuroendocrines : une vue d'ensembleTumeurs Neuroendocrines : une vue d'ensemble
Tumeurs Neuroendocrines : une vue d'ensemble
 
Building your first game in Unity 3d by Sarah Sexton
Building your first game in Unity 3d  by Sarah SextonBuilding your first game in Unity 3d  by Sarah Sexton
Building your first game in Unity 3d by Sarah Sexton
 
Using intel's real sense to create games with natural user interfaces justi...
Using intel's real sense to create games with natural user interfaces   justi...Using intel's real sense to create games with natural user interfaces   justi...
Using intel's real sense to create games with natural user interfaces justi...
 
Introduction to using the R200 camera & Realsense SDK in Unity3d - Jon Collins
Introduction to using the R200 camera & Realsense SDK in Unity3d - Jon CollinsIntroduction to using the R200 camera & Realsense SDK in Unity3d - Jon Collins
Introduction to using the R200 camera & Realsense SDK in Unity3d - Jon Collins
 
Audio Mixer in Unity5 - Andy Touch
Audio Mixer in Unity5 - Andy TouchAudio Mixer in Unity5 - Andy Touch
Audio Mixer in Unity5 - Andy Touch
 
Shaders - Claudia Doppioslash - Unity With the Best
Shaders - Claudia Doppioslash - Unity With the BestShaders - Claudia Doppioslash - Unity With the Best
Shaders - Claudia Doppioslash - Unity With the Best
 
[HACKATHON CISCO PARIS] Slideshow du workshop Smart City
[HACKATHON CISCO PARIS] Slideshow du workshop Smart City[HACKATHON CISCO PARIS] Slideshow du workshop Smart City
[HACKATHON CISCO PARIS] Slideshow du workshop Smart City
 
Tools to Save Time
Tools to Save TimeTools to Save Time
Tools to Save Time
 
[Workshop e résidents] présentation intent, craft ai, dalkia et incubateur
[Workshop e résidents] présentation intent, craft ai, dalkia et incubateur[Workshop e résidents] présentation intent, craft ai, dalkia et incubateur
[Workshop e résidents] présentation intent, craft ai, dalkia et incubateur
 
[Webinar E-résidents #1] Présentation des différents métiers du bâtiment conn...
[Webinar E-résidents #1] Présentation des différents métiers du bâtiment conn...[Webinar E-résidents #1] Présentation des différents métiers du bâtiment conn...
[Webinar E-résidents #1] Présentation des différents métiers du bâtiment conn...
 
[IoT World Forum Webinar] Review of CMX Cisco technology
[IoT World Forum Webinar] Review of CMX Cisco technology[IoT World Forum Webinar] Review of CMX Cisco technology
[IoT World Forum Webinar] Review of CMX Cisco technology
 
HP Helion Episode 6: Cloud Foundry Summit Recap
HP Helion Episode 6: Cloud Foundry Summit RecapHP Helion Episode 6: Cloud Foundry Summit Recap
HP Helion Episode 6: Cloud Foundry Summit Recap
 
Webinar UI/UX by Francesco Marcellino
Webinar UI/UX by Francesco MarcellinoWebinar UI/UX by Francesco Marcellino
Webinar UI/UX by Francesco Marcellino
 
HP Helion Webinar #5 - Security Beyond Firewalls
HP Helion Webinar #5 - Security Beyond FirewallsHP Helion Webinar #5 - Security Beyond Firewalls
HP Helion Webinar #5 - Security Beyond Firewalls
 
HP Helion Webinar #4 - Open stack the magic pill
HP Helion Webinar #4 - Open stack the magic pillHP Helion Webinar #4 - Open stack the magic pill
HP Helion Webinar #4 - Open stack the magic pill
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

[Ultracode Munich Meetup #7] Android view customization in a nutshell

  • 6. UX Don’t just start coding Make it easy to send feedback Analyse usage
  • 8. Custom view drawing with animation public class TankView extends ViewGroup { ! . . . ! private void updateBoilerAppearance() { . . . liquidPaths[i] = new Path();
 liquidPaints[i] = new Paint(liquidPaint);
 
 liquidPaints[i].setShader(new LinearGradient(. . .}, new float[] { . . . }, Shader.TileMode.CLAMP)); ! liquidPaths[i].moveTo(. . .); liquidPaths[i].lineTo(. . .); liquidPaths[i].quadTo(. . .);
 . . . ! liquidPathEffects[i].add(new DashPathEffect(new float[] { . . . )); ! } ! . . . } ! !
  • 9. ! @Override
 protected void dispatchDraw(Canvas canvas) {
 
 canvas.saveLayerAlpha(0, 0, canvas.getWidth(), canvas.getHeight(), alpha, Canvas.HAS_ALPHA_LAYER_SAVE_FLAG);
 
 canvas.drawPath(boilerContour, contourPaint); 
 . . . 
 if (state == State.HEATING) {
 // draw pipe
 canvas.drawRect(pipeBounds, fillPaint);
 canvas.drawLine(. . . );
 canvas.drawLine(. . . );
 
 // draw liquid
 for (int i = 0; i < liquidPaths.length; i++) {
 canvas.drawPath(liquidPaths[i], liquidPaints[i]);
 }
 
 liquidAnimHandler.postDelayed(liquidAnimation, 50);
 }
 } Custom view drawing with animation
  • 10. @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
 
 updateBoilerAppearance();
 super.onSizeChanged(w, h, oldw, oldh);
 } Custom view drawing with animation
  • 11. public class SvgView extends View { ! . . . ! @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
 super.onSizeChanged(w, h, oldw, oldh);
 
 if (w > 0 && h > 0 && svg != null) {
 svg.setDocumentWidth(w);
 svg.setDocumentHeight(h);
 Bitmap svgBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
 Canvas bitmapCanvas = new Canvas(svgBitmap);
 // Render our document onto our canvas
 svg.renderToCanvas(bitmapCanvas);
 setBackgroundDrawable(new BitmapDrawable(getResources(), svgBitmap));
 }
 } ! . . . } Consider SVG instead of dpi graphics {} @ github.com/bernhardpflug/AndroidUtilities
  • 14. public class VerticalViewPager extends ViewGroup { . . . ! @Override
 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
 
 int width = getDefaultSize(0, widthMeasureSpec);
 int height = getDefaultSize(0, heightMeasureSpec);
 setMeasuredDimension(width, height);
 
 int hPadding = getPaddingLeft()+getPaddingRight();
 int vPadding = getPaddingTop()+getPaddingBottom();
 
 int contentWidth = getChildMeasureSpec(widthMeasureSpec, hPadding , width);
 int contentHeight = getChildMeasureSpec(heightMeasureSpec,vPadding , height); 
 groundView.measure(contentWidth, contentHeight);
 
 int skyViewHeight = skyView.getLayoutParams().height;
 int skyHeight = getChildMeasureSpec(heightMeasureSpec, vPadding, skyViewHeight);
 skyView.measure(contentWidth, skyHeight); 
 } ! . . . ! } Implementing custom swipe components {} @ github.com/bernhardpflug/AndroidUtilities Ground View Sky View
  • 15. @Override
 protected void onLayout(boolean changed, int l, int t, int r, int b) {
 final int width = r - l;
 final int height = b - t;
 
 int skyViewHeight = skyView.getMeasuredHeight();
 skyView.layout(0, 0, width, skyView.getMeasuredHeight());
 groundView.layout(0, skyViewHeight, width, height + skyViewHeight); 
 } Implementing custom swipe components {} @ github.com/bernhardpflug/AndroidUtilities Ground View Sky View
  • 16. @Override
 public boolean onTouchEvent(MotionEvent event) { ! . . . ! switch (event.getAction()) {
 . . .
 
 case MotionEvent.ACTION_MOVE: ! int touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); 
 
 if (!verticalScrolling && Math.abs(deltaY) > touchSlop) {
 verticalScrolling = true;
 
 requestDisallowInterceptTouchEvent(true); ! if (getScrollY() + deltaY <= State.CLOSED && getScrollY() + deltaY >= State.OPEN) {
 scrollBy(0, (int) deltaY);
 
 } 
 } ! ! } Implementing custom swipe components {} @ github.com/bernhardpflug/AndroidUtilities
  • 17. @Override
 public boolean onTouchEvent(MotionEvent event) { ! . . . ! switch (event.getAction()) {
 . . .
 
 case MotionEvent.ACTION_UP:
 
 scroller.startScroll(0, getScrollY(), 0, getY(destinationState) - getScrollY()); 
 break; ! ! } Implementing custom swipe components {} @ github.com/bernhardpflug/AndroidUtilities
  • 18. @Override
 public void computeScroll() {
 if (scroller.computeScrollOffset()) {
 
 int x = scroller.getCurrX();
 int y = scroller.getCurrY();
 
 scrollTo(x, y);
 
 postInvalidate();
 } } Implementing custom swipe components {} @ github.com/bernhardpflug/AndroidUtilities
  • 19. at.bernhardpflug.heating Give it a try Google Play {} @ github.com/bernhardpflug/AndroidUtilities