study jam: android for beginners, summary
TRANSCRIPT
Google Developers Study Jam
Android for Beginners. Final Projects
Constantine MarsCo-Organizer @ GDG Dnipropetrovs’kSenior Developer @ DataArt
[email protected]+ConstantineMars
Agenda
● Summary● Common mistakes and issues● Best examples ● Certificates ceremony● Group photo :)
Stats
Started Jam: 62Final projects completed: 22Discussion projects: 8
Common mistakes
UX
● Mixing different languages (i.e. English + Latin)● Mixing color styles● Making too many elements in UI● Adding extra controls
XML
● Auto-indent, rearrange code before commit● Don’t left empty tags● Don’t mix +id and onClick method name in the same tag● Keep single color and size style for icons● Don’t use Layout.background to display images, use ImageView with ScaleType● Use Styles
Code duplication, copy-paste
Thing thing = new Thing();thing.setPrice(20);thing.setColor(RED);Thing thing2 = new Thing();thing2.setPrice(25);thing.setColor(GREEN);
Better:Thing thing = new Thing(20, RED);Thing thing2 = new Thing(25, GREEN);
OrThing thing = Thing.newInstance(20, RED);Thing thing2 = Thing.newInstance(25, GREEN);
Long chain of calls
adapter.addFragment(SomeFragment.newInstance(list.get(i)),list.get(i).getName());
Better:
adapter.addFragment( SomeFragment.newInstance(list.get(i)), list.get(i).getName());
*use:● Spaces● New line● Auto-indent● Rearrange code
Usage of design patterns
public class ClassicSingleton { private static ClassicSingleton instance = null; protected ClassicSingleton() { // Exists only to defeat instantiation. } public static ClassicSingleton getInstance() { if(instance == null) { instance = new ClassicSingleton(); } return instance; }}
Fragments
● Pattern Fragment.newInstance()● .onCreateView() - don’t load assets here● Interaction with Activity - get callback in .onAttach()● Flexible UI, master-detail
Common sense
● Unused folders, “test”, “androidTest”● Don’t put apk to github code, use Github Release feature● Don’t put different projects in one repo
Best examples
Good practices
● Spanned text, Html.fromHtml()● Menu.setShadowLayer()● Fragments● RecyclerView with CardView● Animations with alpha, translate● Real names for .apk● Be on Discussion Forum● Getting Real - making cool app, using only what you really know
Cool design, true OOP, ViewPager
OOP, Design, Database, ORM
Transparent, original design
RecyclerView withCardView
Good OOP and Design
First in discussion
San Francisco
AnimationWith alpha
Getting RealDiscussion, simple, but robust
И еще много проектов, которые мы не успеем сегодня посмотреть и обсудить...
Но они наверняка будут скоро на Discussion
- И их увидит весь мир :)
Certificates
Let’s take photo :)+ConstantineMars