7. What Do We Do?
â—ŹAndroid Fundamentals - NOW
â—Ź Android UI / UX - 29/1 !
â—Ź Community Hackathon - 9/3 !!!
â—ŹAndroid Performance
â—ŹMentors Program
12. What’s the UI?
Hiush Royi!
...and you
are….?
President
Obama...
is this for me?!?!
So when is my birthday
?!?!?!??
And where are my balloons?
What’s the UX?
13. Capturing users
â—ŹJudgement will be served 30 seconds~
â—‹ Visuals will decide
â—‹ functionality means less
â—ŹYou need to:
â—‹ Captivate
â—‹ Impress
â—‹ Retain
16. When Using Standards
- Better UX
- Better UI
- Easier Development
- Shorter implementation
- Less bugs
17. When Using Standards
- Better UX
- Better UI
- Easier Development
- Shorter implementation
- Less bugs
- And better harmony
- designer --- developer --- user
22. Viewz - recap
Rectangle widget
A View:
â—ŹKnows to draw itself
â—ŹUsed for user interaction
â—ŹHas (at least) hight and width (match_parent / wrap_content/fixed)
●May has an id (@+id/ means to create an id if it doesn’t exist)
23. View Group (Layout)
A special kind of view.
Knows to position other views on the screen.
28. Step 1: Measure
Goal: obtain view size,
including its descendants size
REF: http://developer.android.com/reference/android/view/View.html#onMeasure(int, int)
29. Step 1: Measure
Goal: obtain view size,
including its descendants size,
agreed by its parent.
REF: http://developer.android.com/reference/android/view/View.html#onMeasure(int, int)
34. Step 2: Layout
Goal : set position for view and all its children
â—ŹonLayout() is called
REF: http://developer.android.com/reference/android/view/View.html#onLayout(boolean, int, int, int, int)
35. - View draws itself with size and position from previous steps.
- onDraw(Canvas) is called
Step 3: Draw
REF: http://developer.android.com/reference/android/view/View.html#onDraw(android.graphics.Canvas)
Guide: http://developer.android.com/training/custom-views/custom-drawing.html
53. State List Resource
●Sets a color / drawable per the view’s state.
â—ŹDefined in .xml file
https://developer.android.com/guide/topics/resources/color-list-resource.html
76. Important Text Colors
â—Ź textColorPrimary
â—Ź textColorPrimaryInverse
â—Ź textColorSecondary
â—Ź textColorSecondaryInverse
77. More important Colors
â—Ź colorControlNormal
â—‹ (defaults to textColorSecondary)
â—Ź colorControlActivated
â—‹ (defaults to colorAccent)
â—Ź colorControlHighlight
90. Custom views - why?
â—ŹEncapsulating a specific functionality or attributes
â—ŹPerformance
https://developer.android.com/training/custom-views/create-view.html#subclassview
91. Custom views - How?
â—Ź Subclass a View or custom widget.
â—ŹDefine custom attributes.
â—ŹApply custom attributes.
â—ŹAdd properties and events.
92. Subclass a View
class PieChart extends View {
public PieChart(Context context, AttributeSet attrs) {
super(context, attrs);
}
}
99. Add Properties and Events
Attributes can only be read when the view is initialized.
public boolean isShowText() {
return mShowText;
}
public void setShowText(boolean showText) {
mShowText = showText;
invalidate();
requestLayout();
}
102. Which step should we re-do?
Re - Draw:
â—Źinvalidate()- change in view appearance
→ re-draw.
Notifying a Change
View View
103. Which step should we re-do?
Notifying a Change
View1 View2 View1 View2
104. Which step should we re-do?
Notifying a Change
View1 View2 View1 View2View2View1
105. Which step should we re-do?
re-measure → re-layout→ re-draw
â—ŹrequestLayout()
Notifying a Change
View1 View2 View1 View2View2View1
106. Design For Accessibility
Label your input fields using android:contentDescription
Call sendAccessibilityEvent() when appropriate.
Support alternate controllers, such as D-pad and trackball
More here: https://developer.android.com/guide/topics/ui/accessibility/custom-views.html
128. Fragments - What Are They?
“A Fragment represents
a behavior or a portion of user interface
in an Activity.”
https://developer.android.com/guide/components/fragments.html