Slide 1

Slide 1 text

Evolución Android Del framework a la supervivencia del más fuerte

Slide 2

Slide 2 text

1. Origen 2. Extinción 3. Evolución Agenda

Slide 3

Slide 3 text

1. Origen

Slide 4

Slide 4 text

Rubén Serrano Núñez (@Akelael) Lead Android Developer @RedboothHQ

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Redbooth Beta Redbooth

Slide 7

Slide 7 text

WTF!

Slide 8

Slide 8 text

Creacionista

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Evolucionista

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

¿Creacionistas vs Evolucionistas?

Slide 13

Slide 13 text

“It’s the maintenance!”

Slide 14

Slide 14 text

2. Extinción

Slide 15

Slide 15 text

All-in-one Application

Slide 16

Slide 16 text

public class Application extends android.app.Application {
 private static Gson gson; private Map mRoles; private Session mSession; private File mCacheDir; private NotificationManager mNotificationManager; private int mNumberNotifications; ! public static Session getSession() {
 return instance.mSession;
 }
 public static String getGCMToken() {
 AccountManager am = AccountManager.get(Application.getContext());
 return am.getUserData(Application.getSession().getUser(), AccountAuthenticator.GCM_TOKEN);
 }
 
 public static File getCacheDirectory() {
 return instance.mCacheDir;
 }

Slide 17

Slide 17 text

Lo puse todo en Application y … ¡Quita eso de ahí, guarro!

Slide 18

Slide 18 text

Ahora si, ahora no

Slide 19

Slide 19 text

Ahora si, ahora no: Relative Layout

Slide 20

Slide 20 text

Ahora si, ahora no: Enums vs Static Final Fields

Slide 21

Slide 21 text

Ahora si, ahora no: ViewHolder

Slide 22

Slide 22 text

private static class ViewHolder {
 public TextView textView;
 public ImageView imageView;
 } ! @Override
 public View getView(int position, View convertView, ViewGroup parent) {
 View view = convertView;
 ViewHolder viewHolder;
 if (view == null) {
 view = inflater.inflate(R.layout.item, parent, false);
 viewHolder = new ViewHolder();
 viewHolder.textView = (TextView) view.findViewById(R.id.text);
 viewHolder.imageView = (ImageView) view.findViewById(R.id.image);
 view.setTag(viewHolder);
 }
 viewHolder = (ViewHolder) view.getTag();
 viewHolder.textView.setText("Random string");
 viewHolder.imageView.setBackgroundColor(R.color.black);
 return view;
 } ViewHolder

Slide 23

Slide 23 text

@Override
 public View getView(int position, View convertView, ViewGroup parent) {
 View view = convertView;
 if (view == null) {
 view = inflater.inflate(R.layout.item, parent, false);
 }
 ((TextView) view.findViewById(R.id.text)).setText(“Random string");
 ((ImageView) view.findViewById(R.id.image)).setBackgroundColor(R.color.black);
 return view;
 } No Holder

Slide 24

Slide 24 text

Ahora… ActionBarCompat Nested Fragments Navigation drawer Native Pull-to-Refresh

Slide 25

Slide 25 text

Si lo recomienda

Slide 26

Slide 26 text

Juguemos… • Descargar datos de un servidor • Parser JSON • Guardar datos en la BBDD • Recuperar datos de la BBDD • Mostrar datos en la pantalla

Slide 27

Slide 27 text

• Descargar datos de un servidor • Parser JSON • Guardar datos en la BBDD • Recuperar datos de la BBDD • Mostrar datos en la pantalla Juguemos…

Slide 28

Slide 28 text

God Activity

Slide 29

Slide 29 text

startManagingCursor(Cursor c)

Slide 30

Slide 30 text

God Fragment

Slide 31

Slide 31 text

“Una Activity para gobernarlos a todos; una Activity para encontrarlos; una Activity para atraerlos a todos y atarlos a las tinieblas” - El Señor de los Fragments

Slide 32

Slide 32 text

SauronActivity

Slide 33

Slide 33 text

Clean code vs Lengua Oscura de Mordor

Slide 34

Slide 34 text

AsyncTask

Slide 35

Slide 35 text

AsyncTask + startManagingCursor

Slide 36

Slide 36 text

Loaders!

Slide 37

Slide 37 text

LoaderCallbacks callback = new LoaderCallbacks() {
 @Override
 public Loader onCreateLoader(int id, Bundle args) {
 return new CursorLoader(context, uri, null, null, null, null);
 }
 
 @Override
 public void onLoadFinished(Loader loader, Cursor data) { adapter.swapCursor(data);
 }
 
 @Override
 public void onLoaderReset(Loader loader) {
 
 }
 }; LoaderCallbacks

Slide 38

Slide 38 text

ContentProvider

Slide 39

Slide 39 text

SyncAdapter

Slide 40

Slide 40 text

¿Cuándo?

Slide 41

Slide 41 text

3. Evolución

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

SOLID

Slide 44

Slide 44 text

Model View Presenter

Slide 45

Slide 45 text

Unit testing

Slide 46

Slide 46 text

Test Driven Development

Slide 47

Slide 47 text

Ports & Adapters (Hexagonal Architecture)

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

It is not the strongest of the species that survives, nor the most intelligent, but rather the one most adaptable to change. Charles Darwin

Slide 50

Slide 50 text

It is not the strongest of the species that survives, nor the most intelligent, but rather the one most adaptable to change. Charles Darwin

Slide 51

Slide 51 text

Espíritu crítico

Slide 52

Slide 52 text

Código mantenible (y legible)

Slide 53

Slide 53 text

Remember!

Slide 54

Slide 54 text

¡Muchas gracias!

Slide 55

Slide 55 text

Q & A Rubén Serrano Núñez @Akelael plus.google.com/+RubénSerrano