SlideShare a Scribd company logo
Modern Android Development
Computas
24.09.2015
Khiem-Kim Ho Xuan
Agenda
• Code behind
• Material Design
• Pattern recommended to use
Code behind
• Libraries:
• ButterKnife
• Square Otto Event Bus
• Google Play Services
• Support libraries
• Material design
• Retrofit
• Dagger2
• Picasso
24.09.20153
ButterKnife v7.0.1
• Annotate fields with @Bind
• ButterKnife will find the binded ID to the component, layout or resource ids.
• Why?
• Slow reflection. ButterKnife makes sure that the code is generated to perform the view
lookups. Bind delegates to the generated code.
• Resource Binding
• Bind resources. You need to specify the Bind. For example @BindString,
@BindDrawable, @BindColor, @BindDimen
• Non-Activity Binding
• Use @Bind to connect the component or Array. But need to specify @Bind({,….})
• Listener
• Bind listeners for example annotate @OnClick({….}) or @OnItemSelected({…})
• Reset Bind
• Need to clean the bindings when destroying an Activity
or a Fragment using @UnBind.
24.09.20154
Square Otto Event Bus v1.3.8
• Decouple parts of the application for communication.
• Acts as a pub-sub.
• Publish
• Tell Subscribers that an action has occured
• Subscribe
• Receive notification that an event has occured
• Annotate method with @Subscribe
• Register to a bus
• Need to call bus.register(this). In order to receive events
24.09.20155
bus.post(new AnswerAvailableEvent(42));
@Subscribe public void answerAvailable(AnswerAvailableEvent event) { //
TODO: React to the event somehow! }
Retrofit v2.0
• Turns HTTP API into a Java interface
• Uses Annotations to describe HTTP request:
• URL parameter replacement and query parameter support
• Object convertsion to request body (JSON, protocol buffer)
• Multipart request body and file upload
• Request Method
• Request Body
• Multipart
• Header
24.09.20156
@GET("/group/{id}/users") List<User> groupList(@Path("id") int groupId);
@POST("/users/new") Call<User> createUser(@Body User user);
@Multipart @PUT("/user/photo") Call<User> updateUser(@Part("photo")
RequestBody photo, @Part("description") RequestBody description);
@Headers({ "Accept: application/vnd.github.v3.full+json", "User-Agent:
Retrofit-Sample-App" }) @GET("/users/{username}") Call<User>
getUser(@Path("username") String username);
Dagger2
24.09.20157
• Dependency Injection making application loosely coupled.
• Annotations:
• @Module: classes whose methods provide dependencies
• @Provides: methods within module classes
• @Inject: request a dependency (a constructor, field or a method)
• @Component: bridge interface between modules and injection
@Module
public class VehicleModule {
@Provides @Singleton
Motor provideMotor(){
return new Motor();
}
@Provides @Singleton
Vehicle provideVehicle(){
return new Vehicle(new Motor());
}
}
@Inject
public Vehicle(Motor motor){
this.motor = motor;
}
@Singleton
@Component(modules = {VehicleModule.class})
public interface VehicleComponent {
Vehicle provideVehicle();
} // connect @modules with @inject
Dagger2
24.09.20158
• When everything is ready
• Obtain instance of the interface and invoke its method.
• Do it inside onCreate method!
• Why Dagger2?
• No reflection: graph validation, configuration and precondition done at compile time.
• Performance gain
public class MainActivity extends ActionBarActivity {
Vehicle mVehicle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VehicleComponent component = Dagger_VehicleComponent.builder().vehicleModule(new VehicleModule()).build();
mVehicle = component.provideVehicle();
Toast.makeText(this, String.valueOf(vehicle.getSpeed()), Toast.LENGTH_SHORT).show();
}
}
Picasso v2.5.2
24.09.20159
• Load image into a view based on url or from memory
• Picasso handles:
• ImageView recycling and download cancelation in an adapter
• Complex image transformations with minimal memory usage
• Automatic memory and disk caching.
• Has placeholders in case of loading or failed loading image.
Picasso.with(context) .load(url)
.placeholder(R.drawable.user_placeholder)
.error(R.drawable.user_placeholder_error) .into(imageView);
Material Design
• Make all apps flat as paper,
• responsive animations!
• Right color and shadow depths
• Get inspired!
• http://www.materialup.com/
Material Design
• Use Androids Design library:
• com.android.support.design
• Snackbar!
• Like Toast, but shows a message at the bottom of
the screen
Snackbar.make(mDrawerLayout, "Your message", Snackbar.LENGTH_SHORT)
.setAction(getString(R.string.text_undo), this)
.show();
Shared Element Transition
24.09.201512
• Animate different UI states in an application.
• Built on
• Scene: Defines UI states in an application
• Transition: Defines the animated change between two scenes
• Need to define transition in style.xml and also
<transitionSet
xmlns:android="http://schemas.android.com/apk/res/android">
<changeBounds>
<targets>
<target android:targetId="@id/ivPosterImage" />
<target android:targetId="@id/detailed_image" />
</targets>
</changeBounds>
<changeImageTransform>
<targets>
<target android:targetId="@id/ivPosterImage" />
<target android:targetId="@id/detailed_image" />
</targets>
</changeImageTransform>
</transitionSet>
Shared Element Transition
24.09.201513
<style name="AppTheme" parent="AppTheme.Base">
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowIsTranslucent">true</item>
<!-- specify enter and exit transitions -->
<item name="android:windowEnterTransition">@transition/fade</item>
<item name="android:windowExitTransition">@transition/fade</item>
<!-- specify shared element transitions -->
<item name="android:windowSharedElementEnterTransition">
@transition/change_image_transform
</item><transitionSet xmlns:android="http://schemas.android.com/apk/res/android">
<changeBounds>
<targets>
<target android:targetId="@id/ivPosterImage" />
<target android:targetId="@id/detailed_image" />
</targets>
</changeBounds>
<changeImageTransform>
<targets>
<target android:targetId="@id/ivPosterImage" />
<target android:targetId="@id/detailed_image" />
</targets>
</changeImageTransform>
</transitionSet>
<item name="android:windowSharedElementExitTransition">
@transition/change_image_transform
</item>
</style>
Floating Action Button
24.09.201514
• fabSize: set the size of the button
• Normal: 56dp
• Mini: 40dp
• backgroundTint: set the background color of this instance
• rippleColor set color of the ripple effect when pressed
• src: set the icon displayed within the FAB
<android.support.design.widget.FloatingActionButton
android:id=”@+id/fab_normal”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:src=”@drawable/ic_plus”
app:fabSize=”normal” />
EditText Floating Labels
• Display floating labels above EditText fields.
• Gives focus or hint of float.
• Useful to use while data is being input
• You can also add Error message
24.09.201515
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/edit_text_email"
android:layout_width="match_parent"/>
</android.support.design.widget.TextInputLayout>
setErrorEnabled(true);
setError(getString(R.string.text_error_message));
Navigation View
• Placed within a DrawerLayout
24.09.201516
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<FrameLayout
android:id="@+id/main_content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/navigation_header"
app:menu="@menu/drawer" />
</android.support.v4.widget.DrawerLayout>
TabLayout
• tabMode: set the layout to fixed or scrollable
• tabGravity: set gravity of the tab, either filled (distributed to all available space
between individual tabs) or centre (position tabs in the center of the TabLayout)
• setText() and setIcon()
• Listeners:
• OnTabSelectedListener
• TabLayoutOnPageChangeListener
• ViewPagerOnTabSelectedListener
24.09.201517
<android.support.design.widget.TabLayout
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill" />
ViewPager pager = (ViewPager)
rootView.findViewById(R.id.viewPager);
pager.setAdapter(new MyPagerAdapter(getActivity().getSupportFragmentManager()));
TabLayout tabLayout = (TabLayout)
rootView.findViewById(R.id.sliding_tabs);tabLayout.addTab(tabLayout.newTab().setText("Tab One"));
tabLayout.addTab(tabLayout.newTab().setText("Tab Two"));
tabLayout.addTab(tabLayout.newTab().setText("Tab Three"));
tabLayout.setupWithViewPager(pager);
Coordinator Layout
• Super FrameLayout
• Adds transition view basedon motion of other components
• Lets us adapt layouts based on scroll events.
• Set the property layout_scrollFlags
• enterAlways – view will become visible when a downward scroll event occurs
• enterAlwaysCollapsed – if view has minHeight, it will only
enter at a that height and expand fully once the scrolling view
reached the top.
24.09.201518
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
app:layout_scrollFlags="scroll|enterAlways" />
<android.support.design.widget.TabLayout
/> </android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
Support Toolbar
• Use
• com.android.support.appcompat-v7:<versionnumber>
• Remember to style the toolbar!
24.09.201519
<android.support.v7.widget.Toolbar
android:id=”@+id/my_awesome_toolbar”
android:layout_height=”wrap_content”
android:layout_width=”match_parent”
android:minHeight=”?attr/actionBarSize”
android:background=”?attr/colorPrimary” />
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.blah);
Toolbar toolbar = (Toolbar)
findViewById(R.id.my_awesome_toolbar);
setSupportActionBar(toolbar);
}
<style name="Theme.MyTheme"
parent="Theme.AppCompat.Light">
<!-- Set AppCompat’s actionBarStyle -->
<item name="actionBarStyle">@style/MyActionBarStyle</item>
<!-- Set AppCompat’s color theming attrs -->
<item name="colorPrimary">@color/my_awesome_red</item>
<item
name="colorPrimaryDark">@color/my_awesome_darker_red</item>
<!-- The rest of your attributes -->
</style>
Pattern recommended to use
• Model-View-Presenter (MVP)
• User interacts with the View.
• There is one-to-one relationship between View and Presenter means one View is mapped to
only one Presenter.
• View has a reference to Presenter but View has not reference to Model.
• Provides two way communication between View and Presenter.
24.09.201520
Firmu – The Cinema Locator App
• Google Play Store
• (Later on Windows Store and IOS).
• Highly inspired by Material Design and modern
mobile development.
• Feedback on the app please 
24.09.201521
Pitch (Beta version)
• Google Play Store
• (Later on Windows Store and IOS).
• Highly inspired by Material Design and modern
mobile development.
• Feedback on the app please 
24.09.201522
23 © Computas AS 24.09.2015
Questions?
Computas AS Tel +47 67 83 10 00
Lysaker Torg 45, pb 482 Fax +47 67 83 10 01
1327 Lysaker Org.nr: NO 986 352 325 MVA
Norway www.computas.com
Khiem-Kim Ho Xuan

More Related Content

What's hot

Angular2 and TypeScript
Angular2 and TypeScriptAngular2 and TypeScript
Angular2 and TypeScript
David Giard
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
Elyse Kolker Gordon
 
Creating lightweight JS Apps w/ Web Components and lit-html
Creating lightweight JS Apps w/ Web Components and lit-htmlCreating lightweight JS Apps w/ Web Components and lit-html
Creating lightweight JS Apps w/ Web Components and lit-html
Ilia Idakiev
 
Angular 9
Angular 9 Angular 9
Angular 9
Raja Vishnu
 
GWT Training - Session 1/3
GWT Training - Session 1/3GWT Training - Session 1/3
GWT Training - Session 1/3
Faiz Bashir
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
Gaurav Agrawal
 
Angular Best Practices - Perfomatix
Angular Best Practices - PerfomatixAngular Best Practices - Perfomatix
Angular Best Practices - Perfomatix
Perfomatix Solutions
 
Angular js
Angular jsAngular js
Angular js
Knoldus Inc.
 
GWT Training - Session 2/3
GWT Training - Session 2/3GWT Training - Session 2/3
GWT Training - Session 2/3
Faiz Bashir
 
Working with AngularJS
Working with AngularJSWorking with AngularJS
Working with AngularJS
André Vala
 
Vaadin Components @ Angular U
Vaadin Components @ Angular UVaadin Components @ Angular U
Vaadin Components @ Angular U
Joonas Lehtinen
 
Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...
Katy Slemon
 
Angular introduction students
Angular introduction studentsAngular introduction students
Angular introduction students
Christian John Felix
 
Start Developing Apps for Magnolia CMS
Start Developing Apps for Magnolia CMSStart Developing Apps for Magnolia CMS
Start Developing Apps for Magnolia CMS
Magnolia
 
Angular2 + rxjs
Angular2 + rxjsAngular2 + rxjs
Angular2 + rxjs
Christoffer Noring
 
Building maintainable app
Building maintainable appBuilding maintainable app
Building maintainable app
Kristijan Jurković
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed   nov 2014Angular js 1.3 presentation for fed   nov 2014
Angular js 1.3 presentation for fed nov 2014
Sarah Hudson
 
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
Rohit Gupta
 

What's hot (20)

Angular2 and TypeScript
Angular2 and TypeScriptAngular2 and TypeScript
Angular2 and TypeScript
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
 
Angular Workshop_Sarajevo2
Angular Workshop_Sarajevo2Angular Workshop_Sarajevo2
Angular Workshop_Sarajevo2
 
Creating lightweight JS Apps w/ Web Components and lit-html
Creating lightweight JS Apps w/ Web Components and lit-htmlCreating lightweight JS Apps w/ Web Components and lit-html
Creating lightweight JS Apps w/ Web Components and lit-html
 
Angular js
Angular jsAngular js
Angular js
 
Angular 9
Angular 9 Angular 9
Angular 9
 
GWT Training - Session 1/3
GWT Training - Session 1/3GWT Training - Session 1/3
GWT Training - Session 1/3
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
 
Angular Best Practices - Perfomatix
Angular Best Practices - PerfomatixAngular Best Practices - Perfomatix
Angular Best Practices - Perfomatix
 
Angular js
Angular jsAngular js
Angular js
 
GWT Training - Session 2/3
GWT Training - Session 2/3GWT Training - Session 2/3
GWT Training - Session 2/3
 
Working with AngularJS
Working with AngularJSWorking with AngularJS
Working with AngularJS
 
Vaadin Components @ Angular U
Vaadin Components @ Angular UVaadin Components @ Angular U
Vaadin Components @ Angular U
 
Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...Understanding router state in angular 7 passing data through angular router s...
Understanding router state in angular 7 passing data through angular router s...
 
Angular introduction students
Angular introduction studentsAngular introduction students
Angular introduction students
 
Start Developing Apps for Magnolia CMS
Start Developing Apps for Magnolia CMSStart Developing Apps for Magnolia CMS
Start Developing Apps for Magnolia CMS
 
Angular2 + rxjs
Angular2 + rxjsAngular2 + rxjs
Angular2 + rxjs
 
Building maintainable app
Building maintainable appBuilding maintainable app
Building maintainable app
 
Angular js 1.3 presentation for fed nov 2014
Angular js 1.3 presentation for fed   nov 2014Angular js 1.3 presentation for fed   nov 2014
Angular js 1.3 presentation for fed nov 2014
 
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
 

Viewers also liked

Poteri di autentica dell'avvocato - Cittadella 18.03.16
Poteri di autentica dell'avvocato - Cittadella 18.03.16Poteri di autentica dell'avvocato - Cittadella 18.03.16
Poteri di autentica dell'avvocato - Cittadella 18.03.16
Edoardo Ferraro
 
Trabajos de mates
Trabajos de matesTrabajos de mates
Trabajos de matesidasou
 
Rodriguez ruiz
Rodriguez ruizRodriguez ruiz
Rodriguez ruiz
Leonardo Rodriguez Ruiz
 
Trabajo 3
Trabajo 3Trabajo 3
Energia solar 01
Energia solar 01Energia solar 01
Energia solar 01
Lucelio Santos
 
4.Evaluación de Proyectos y Aplicaciones Computarizadas
4.Evaluación de Proyectos y Aplicaciones Computarizadas4.Evaluación de Proyectos y Aplicaciones Computarizadas
4.Evaluación de Proyectos y Aplicaciones Computarizadas
Selene Orozco
 
Mtaylor Get Acquainted Presentation 1 Safe One!
Mtaylor Get Acquainted Presentation 1 Safe One!Mtaylor Get Acquainted Presentation 1 Safe One!
Mtaylor Get Acquainted Presentation 1 Safe One!
morgan_taylor
 
Đèn LED chiếu sáng khu vực mua bán chung trong siêu thị, trung tâm thương mại
Đèn LED chiếu sáng khu vực mua bán chung trong siêu thị, trung tâm thương mạiĐèn LED chiếu sáng khu vực mua bán chung trong siêu thị, trung tâm thương mại
Đèn LED chiếu sáng khu vực mua bán chung trong siêu thị, trung tâm thương mại
RANGDONG LIGHT SOURCE & VACUUM FLASK JOINT STOCK COMPANY
 
Defolu Spot Buzdolabı Alanlar İstanbul
Defolu Spot Buzdolabı Alanlar İstanbulDefolu Spot Buzdolabı Alanlar İstanbul
Defolu Spot Buzdolabı Alanlar İstanbul
Eskici eşya alanlar
 
Trabajo 1
Trabajo 1Trabajo 1
Phobias A Presentation by Mr Allah Dad Khan Former DG Agri Extension /Visiti...
Phobias  A Presentation by Mr Allah Dad Khan Former DG Agri Extension /Visiti...Phobias  A Presentation by Mr Allah Dad Khan Former DG Agri Extension /Visiti...
Phobias A Presentation by Mr Allah Dad Khan Former DG Agri Extension /Visiti...
Mr.Allah Dad Khan
 
Sentenza su ammissione gratuito patrocinio per procedimenti mediazione
Sentenza su ammissione gratuito patrocinio per procedimenti mediazioneSentenza su ammissione gratuito patrocinio per procedimenti mediazione
Sentenza su ammissione gratuito patrocinio per procedimenti mediazione
GRATUITO PATROCINIO e ART 24. - Associazione per la Tutela del Diritto di Difesa
 

Viewers also liked (12)

Poteri di autentica dell'avvocato - Cittadella 18.03.16
Poteri di autentica dell'avvocato - Cittadella 18.03.16Poteri di autentica dell'avvocato - Cittadella 18.03.16
Poteri di autentica dell'avvocato - Cittadella 18.03.16
 
Trabajos de mates
Trabajos de matesTrabajos de mates
Trabajos de mates
 
Rodriguez ruiz
Rodriguez ruizRodriguez ruiz
Rodriguez ruiz
 
Trabajo 3
Trabajo 3Trabajo 3
Trabajo 3
 
Energia solar 01
Energia solar 01Energia solar 01
Energia solar 01
 
4.Evaluación de Proyectos y Aplicaciones Computarizadas
4.Evaluación de Proyectos y Aplicaciones Computarizadas4.Evaluación de Proyectos y Aplicaciones Computarizadas
4.Evaluación de Proyectos y Aplicaciones Computarizadas
 
Mtaylor Get Acquainted Presentation 1 Safe One!
Mtaylor Get Acquainted Presentation 1 Safe One!Mtaylor Get Acquainted Presentation 1 Safe One!
Mtaylor Get Acquainted Presentation 1 Safe One!
 
Đèn LED chiếu sáng khu vực mua bán chung trong siêu thị, trung tâm thương mại
Đèn LED chiếu sáng khu vực mua bán chung trong siêu thị, trung tâm thương mạiĐèn LED chiếu sáng khu vực mua bán chung trong siêu thị, trung tâm thương mại
Đèn LED chiếu sáng khu vực mua bán chung trong siêu thị, trung tâm thương mại
 
Defolu Spot Buzdolabı Alanlar İstanbul
Defolu Spot Buzdolabı Alanlar İstanbulDefolu Spot Buzdolabı Alanlar İstanbul
Defolu Spot Buzdolabı Alanlar İstanbul
 
Trabajo 1
Trabajo 1Trabajo 1
Trabajo 1
 
Phobias A Presentation by Mr Allah Dad Khan Former DG Agri Extension /Visiti...
Phobias  A Presentation by Mr Allah Dad Khan Former DG Agri Extension /Visiti...Phobias  A Presentation by Mr Allah Dad Khan Former DG Agri Extension /Visiti...
Phobias A Presentation by Mr Allah Dad Khan Former DG Agri Extension /Visiti...
 
Sentenza su ammissione gratuito patrocinio per procedimenti mediazione
Sentenza su ammissione gratuito patrocinio per procedimenti mediazioneSentenza su ammissione gratuito patrocinio per procedimenti mediazione
Sentenza su ammissione gratuito patrocinio per procedimenti mediazione
 

Similar to Modern android development

Introduction to Backbone.js for Rails developers
Introduction to Backbone.js for Rails developersIntroduction to Backbone.js for Rails developers
Introduction to Backbone.js for Rails developersAoteaStudios
 
Building Modern Websites with ASP.NET by Rachel Appel
Building Modern Websites with ASP.NET by Rachel AppelBuilding Modern Websites with ASP.NET by Rachel Appel
Building Modern Websites with ASP.NET by Rachel Appel
.NET Conf UY
 
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Nicolas HAAN
 
Unit 2 - Data Binding.pptx
Unit 2 - Data Binding.pptxUnit 2 - Data Binding.pptx
Unit 2 - Data Binding.pptx
Malla Reddy University
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
Matt Raible
 
Asp.Net MVC 5 in Arabic
Asp.Net MVC 5 in ArabicAsp.Net MVC 5 in Arabic
Asp.Net MVC 5 in Arabic
Haitham Shaddad
 
Spring first in Magnolia CMS - Spring I/O 2015
Spring first in Magnolia CMS - Spring I/O 2015Spring first in Magnolia CMS - Spring I/O 2015
Spring first in Magnolia CMS - Spring I/O 2015Tobias Mattsson
 
Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Oro Inc.
 
Using and contributing to the next Guice
Using and contributing to the next GuiceUsing and contributing to the next Guice
Using and contributing to the next Guice
Adrian Cole
 
Angular JS2 Training Session #2
Angular JS2 Training Session #2Angular JS2 Training Session #2
Angular JS2 Training Session #2
Paras Mendiratta
 
Developing maintainable Cordova applications
Developing maintainable Cordova applicationsDeveloping maintainable Cordova applications
Developing maintainable Cordova applications
Ivano Malavolta
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture Components
Hassan Abid
 
Android architecture
Android architecture Android architecture
Android architecture
Trong-An Bui
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
WebStackAcademy
 
Web Components v1
Web Components v1Web Components v1
Web Components v1
Mike Wilcox
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatiasapientindia
 
MVVM & Data Binding Library
MVVM & Data Binding Library MVVM & Data Binding Library
MVVM & Data Binding Library
10Clouds
 
MVP Community Camp 2014 - How to use enhanced features of Windows 8.1 Store ...
MVP Community Camp 2014 - How to useenhanced features of Windows 8.1 Store ...MVP Community Camp 2014 - How to useenhanced features of Windows 8.1 Store ...
MVP Community Camp 2014 - How to use enhanced features of Windows 8.1 Store ...
Akira Hatsune
 
Introduction to Polymer and Firebase - Simon Gauvin
Introduction to Polymer and Firebase - Simon GauvinIntroduction to Polymer and Firebase - Simon Gauvin
Introduction to Polymer and Firebase - Simon Gauvin
Simon Gauvin
 
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Red Hat JBoss BRMS and BPMS Workbench and Rich Client TechnologyRed Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Mark Proctor
 

Similar to Modern android development (20)

Introduction to Backbone.js for Rails developers
Introduction to Backbone.js for Rails developersIntroduction to Backbone.js for Rails developers
Introduction to Backbone.js for Rails developers
 
Building Modern Websites with ASP.NET by Rachel Appel
Building Modern Websites with ASP.NET by Rachel AppelBuilding Modern Websites with ASP.NET by Rachel Appel
Building Modern Websites with ASP.NET by Rachel Appel
 
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
 
Unit 2 - Data Binding.pptx
Unit 2 - Data Binding.pptxUnit 2 - Data Binding.pptx
Unit 2 - Data Binding.pptx
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
 
Asp.Net MVC 5 in Arabic
Asp.Net MVC 5 in ArabicAsp.Net MVC 5 in Arabic
Asp.Net MVC 5 in Arabic
 
Spring first in Magnolia CMS - Spring I/O 2015
Spring first in Magnolia CMS - Spring I/O 2015Spring first in Magnolia CMS - Spring I/O 2015
Spring first in Magnolia CMS - Spring I/O 2015
 
Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)Adding custom ui controls to your application (1)
Adding custom ui controls to your application (1)
 
Using and contributing to the next Guice
Using and contributing to the next GuiceUsing and contributing to the next Guice
Using and contributing to the next Guice
 
Angular JS2 Training Session #2
Angular JS2 Training Session #2Angular JS2 Training Session #2
Angular JS2 Training Session #2
 
Developing maintainable Cordova applications
Developing maintainable Cordova applicationsDeveloping maintainable Cordova applications
Developing maintainable Cordova applications
 
Building Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture ComponentsBuilding Modern Apps using Android Architecture Components
Building Modern Apps using Android Architecture Components
 
Android architecture
Android architecture Android architecture
Android architecture
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Web Components v1
Web Components v1Web Components v1
Web Components v1
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatia
 
MVVM & Data Binding Library
MVVM & Data Binding Library MVVM & Data Binding Library
MVVM & Data Binding Library
 
MVP Community Camp 2014 - How to use enhanced features of Windows 8.1 Store ...
MVP Community Camp 2014 - How to useenhanced features of Windows 8.1 Store ...MVP Community Camp 2014 - How to useenhanced features of Windows 8.1 Store ...
MVP Community Camp 2014 - How to use enhanced features of Windows 8.1 Store ...
 
Introduction to Polymer and Firebase - Simon Gauvin
Introduction to Polymer and Firebase - Simon GauvinIntroduction to Polymer and Firebase - Simon Gauvin
Introduction to Polymer and Firebase - Simon Gauvin
 
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Red Hat JBoss BRMS and BPMS Workbench and Rich Client TechnologyRed Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
Red Hat JBoss BRMS and BPMS Workbench and Rich Client Technology
 

Recently uploaded

Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
Mukeshwaran Balu
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
zwunae
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
AIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdfAIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdf
RicletoEspinosa1
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 

Recently uploaded (20)

Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
AIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdfAIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdf
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 

Modern android development

  • 2. Agenda • Code behind • Material Design • Pattern recommended to use
  • 3. Code behind • Libraries: • ButterKnife • Square Otto Event Bus • Google Play Services • Support libraries • Material design • Retrofit • Dagger2 • Picasso 24.09.20153
  • 4. ButterKnife v7.0.1 • Annotate fields with @Bind • ButterKnife will find the binded ID to the component, layout or resource ids. • Why? • Slow reflection. ButterKnife makes sure that the code is generated to perform the view lookups. Bind delegates to the generated code. • Resource Binding • Bind resources. You need to specify the Bind. For example @BindString, @BindDrawable, @BindColor, @BindDimen • Non-Activity Binding • Use @Bind to connect the component or Array. But need to specify @Bind({,….}) • Listener • Bind listeners for example annotate @OnClick({….}) or @OnItemSelected({…}) • Reset Bind • Need to clean the bindings when destroying an Activity or a Fragment using @UnBind. 24.09.20154
  • 5. Square Otto Event Bus v1.3.8 • Decouple parts of the application for communication. • Acts as a pub-sub. • Publish • Tell Subscribers that an action has occured • Subscribe • Receive notification that an event has occured • Annotate method with @Subscribe • Register to a bus • Need to call bus.register(this). In order to receive events 24.09.20155 bus.post(new AnswerAvailableEvent(42)); @Subscribe public void answerAvailable(AnswerAvailableEvent event) { // TODO: React to the event somehow! }
  • 6. Retrofit v2.0 • Turns HTTP API into a Java interface • Uses Annotations to describe HTTP request: • URL parameter replacement and query parameter support • Object convertsion to request body (JSON, protocol buffer) • Multipart request body and file upload • Request Method • Request Body • Multipart • Header 24.09.20156 @GET("/group/{id}/users") List<User> groupList(@Path("id") int groupId); @POST("/users/new") Call<User> createUser(@Body User user); @Multipart @PUT("/user/photo") Call<User> updateUser(@Part("photo") RequestBody photo, @Part("description") RequestBody description); @Headers({ "Accept: application/vnd.github.v3.full+json", "User-Agent: Retrofit-Sample-App" }) @GET("/users/{username}") Call<User> getUser(@Path("username") String username);
  • 7. Dagger2 24.09.20157 • Dependency Injection making application loosely coupled. • Annotations: • @Module: classes whose methods provide dependencies • @Provides: methods within module classes • @Inject: request a dependency (a constructor, field or a method) • @Component: bridge interface between modules and injection @Module public class VehicleModule { @Provides @Singleton Motor provideMotor(){ return new Motor(); } @Provides @Singleton Vehicle provideVehicle(){ return new Vehicle(new Motor()); } } @Inject public Vehicle(Motor motor){ this.motor = motor; } @Singleton @Component(modules = {VehicleModule.class}) public interface VehicleComponent { Vehicle provideVehicle(); } // connect @modules with @inject
  • 8. Dagger2 24.09.20158 • When everything is ready • Obtain instance of the interface and invoke its method. • Do it inside onCreate method! • Why Dagger2? • No reflection: graph validation, configuration and precondition done at compile time. • Performance gain public class MainActivity extends ActionBarActivity { Vehicle mVehicle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); VehicleComponent component = Dagger_VehicleComponent.builder().vehicleModule(new VehicleModule()).build(); mVehicle = component.provideVehicle(); Toast.makeText(this, String.valueOf(vehicle.getSpeed()), Toast.LENGTH_SHORT).show(); } }
  • 9. Picasso v2.5.2 24.09.20159 • Load image into a view based on url or from memory • Picasso handles: • ImageView recycling and download cancelation in an adapter • Complex image transformations with minimal memory usage • Automatic memory and disk caching. • Has placeholders in case of loading or failed loading image. Picasso.with(context) .load(url) .placeholder(R.drawable.user_placeholder) .error(R.drawable.user_placeholder_error) .into(imageView);
  • 10. Material Design • Make all apps flat as paper, • responsive animations! • Right color and shadow depths • Get inspired! • http://www.materialup.com/
  • 11. Material Design • Use Androids Design library: • com.android.support.design • Snackbar! • Like Toast, but shows a message at the bottom of the screen Snackbar.make(mDrawerLayout, "Your message", Snackbar.LENGTH_SHORT) .setAction(getString(R.string.text_undo), this) .show();
  • 12. Shared Element Transition 24.09.201512 • Animate different UI states in an application. • Built on • Scene: Defines UI states in an application • Transition: Defines the animated change between two scenes • Need to define transition in style.xml and also <transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> <changeBounds> <targets> <target android:targetId="@id/ivPosterImage" /> <target android:targetId="@id/detailed_image" /> </targets> </changeBounds> <changeImageTransform> <targets> <target android:targetId="@id/ivPosterImage" /> <target android:targetId="@id/detailed_image" /> </targets> </changeImageTransform> </transitionSet>
  • 13. Shared Element Transition 24.09.201513 <style name="AppTheme" parent="AppTheme.Base"> <item name="android:windowContentTransitions">true</item> <item name="android:windowAllowEnterTransitionOverlap">true</item> <item name="android:windowAllowReturnTransitionOverlap">true</item> <item name="android:windowIsTranslucent">true</item> <!-- specify enter and exit transitions --> <item name="android:windowEnterTransition">@transition/fade</item> <item name="android:windowExitTransition">@transition/fade</item> <!-- specify shared element transitions --> <item name="android:windowSharedElementEnterTransition"> @transition/change_image_transform </item><transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> <changeBounds> <targets> <target android:targetId="@id/ivPosterImage" /> <target android:targetId="@id/detailed_image" /> </targets> </changeBounds> <changeImageTransform> <targets> <target android:targetId="@id/ivPosterImage" /> <target android:targetId="@id/detailed_image" /> </targets> </changeImageTransform> </transitionSet> <item name="android:windowSharedElementExitTransition"> @transition/change_image_transform </item> </style>
  • 14. Floating Action Button 24.09.201514 • fabSize: set the size of the button • Normal: 56dp • Mini: 40dp • backgroundTint: set the background color of this instance • rippleColor set color of the ripple effect when pressed • src: set the icon displayed within the FAB <android.support.design.widget.FloatingActionButton android:id=”@+id/fab_normal” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:src=”@drawable/ic_plus” app:fabSize=”normal” />
  • 15. EditText Floating Labels • Display floating labels above EditText fields. • Gives focus or hint of float. • Useful to use while data is being input • You can also add Error message 24.09.201515 <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/edit_text_email" android:layout_width="match_parent"/> </android.support.design.widget.TextInputLayout> setErrorEnabled(true); setError(getString(R.string.text_error_message));
  • 16. Navigation View • Placed within a DrawerLayout 24.09.201516 <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <FrameLayout android:id="@+id/main_content_frame" android:layout_width="match_parent" android:layout_height="match_parent" /> <android.support.design.widget.NavigationView android:id="@+id/navigation_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerLayout="@layout/navigation_header" app:menu="@menu/drawer" /> </android.support.v4.widget.DrawerLayout>
  • 17. TabLayout • tabMode: set the layout to fixed or scrollable • tabGravity: set gravity of the tab, either filled (distributed to all available space between individual tabs) or centre (position tabs in the center of the TabLayout) • setText() and setIcon() • Listeners: • OnTabSelectedListener • TabLayoutOnPageChangeListener • ViewPagerOnTabSelectedListener 24.09.201517 <android.support.design.widget.TabLayout android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabMode="fixed" app:tabGravity="fill" /> ViewPager pager = (ViewPager) rootView.findViewById(R.id.viewPager); pager.setAdapter(new MyPagerAdapter(getActivity().getSupportFragmentManager())); TabLayout tabLayout = (TabLayout) rootView.findViewById(R.id.sliding_tabs);tabLayout.addTab(tabLayout.newTab().setText("Tab One")); tabLayout.addTab(tabLayout.newTab().setText("Tab Two")); tabLayout.addTab(tabLayout.newTab().setText("Tab Three")); tabLayout.setupWithViewPager(pager);
  • 18. Coordinator Layout • Super FrameLayout • Adds transition view basedon motion of other components • Lets us adapt layouts based on scroll events. • Set the property layout_scrollFlags • enterAlways – view will become visible when a downward scroll event occurs • enterAlwaysCollapsed – if view has minHeight, it will only enter at a that height and expand fully once the scrolling view reached the top. 24.09.201518 <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.RecyclerView android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior= "@string/appbar_scrolling_view_behavior" /> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.Toolbar app:layout_scrollFlags="scroll|enterAlways" /> <android.support.design.widget.TabLayout /> </android.support.design.widget.AppBarLayout> </android.support.design.widget.CoordinatorLayout>
  • 19. Support Toolbar • Use • com.android.support.appcompat-v7:<versionnumber> • Remember to style the toolbar! 24.09.201519 <android.support.v7.widget.Toolbar android:id=”@+id/my_awesome_toolbar” android:layout_height=”wrap_content” android:layout_width=”match_parent” android:minHeight=”?attr/actionBarSize” android:background=”?attr/colorPrimary” /> @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.blah); Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar); setSupportActionBar(toolbar); } <style name="Theme.MyTheme" parent="Theme.AppCompat.Light"> <!-- Set AppCompat’s actionBarStyle --> <item name="actionBarStyle">@style/MyActionBarStyle</item> <!-- Set AppCompat’s color theming attrs --> <item name="colorPrimary">@color/my_awesome_red</item> <item name="colorPrimaryDark">@color/my_awesome_darker_red</item> <!-- The rest of your attributes --> </style>
  • 20. Pattern recommended to use • Model-View-Presenter (MVP) • User interacts with the View. • There is one-to-one relationship between View and Presenter means one View is mapped to only one Presenter. • View has a reference to Presenter but View has not reference to Model. • Provides two way communication between View and Presenter. 24.09.201520
  • 21. Firmu – The Cinema Locator App • Google Play Store • (Later on Windows Store and IOS). • Highly inspired by Material Design and modern mobile development. • Feedback on the app please  24.09.201521
  • 22. Pitch (Beta version) • Google Play Store • (Later on Windows Store and IOS). • Highly inspired by Material Design and modern mobile development. • Feedback on the app please  24.09.201522
  • 23. 23 © Computas AS 24.09.2015 Questions? Computas AS Tel +47 67 83 10 00 Lysaker Torg 45, pb 482 Fax +47 67 83 10 01 1327 Lysaker Org.nr: NO 986 352 325 MVA Norway www.computas.com Khiem-Kim Ho Xuan