Descubre Android

41
Antonio López Marín Estudiante de la Universidad Politécnica de Valencia Software developer en @Meetizer Descubre Android @tonilopezmr [email protected]

Transcript of Descubre Android

Page 1: Descubre Android

Antonio López Marín Estudiante de la Universidad Politécnica de Valencia Software developer en @Meetizer

Descubre Android

@[email protected]

Page 2: Descubre Android

@tonilopezmr

Page 3: Descubre Android

The Solution

Page 4: Descubre Android

Calcula Notas

@tonilopezmrhttp://tonilopezmr.github.io/calculanotas/

Page 5: Descubre Android

Android

Jelly Bean

KitKat

Marshmallow

Lollipop

@tonilopezmr

Page 6: Descubre Android

Entorno de desarrollo

http://developer.android.com/intl/es/sdk/index.html

@tonilopezmr

2.0

Page 7: Descubre Android

@tonilopezmr

Page 8: Descubre Android

AndroidEmulator 2.0

Android Studio 2.0 or higher

SDK Tools 25.0.10 or higher

http://developer.android.com/intl/es/tools/devices/emulator.html

@tonilopezmr

Page 9: Descubre Android

Estructura de un proyecto Android Studio

Proyecto- Modulo1 (app)

- src/main/java- Modulo2 (android Wear app)

@tonilopezmr

Page 10: Descubre Android

@tonilopezmr

Page 11: Descubre Android

Gradle es una herramienta para automatizar la construcción de nuestros proyectos, build.gradle

@tonilopezmr

compileSdkVersion 23buildToolsVersion "23.0.3"

http://gradle.org/

Page 12: Descubre Android

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.3.0'}

Gradle

@tonilopezmr

Page 13: Descubre Android

Componentes de una aplicaciónActivity {

ImageViewButtonTextViewFragment}

LinearLayoutRelativeLayoutGridLayoutFrameLayout

@tonilopezmr

Page 14: Descubre Android

Activity Lifecycle

@tonilopezmr

Page 15: Descubre Android

Fragments

@tonilopezmr

Page 16: Descubre Android

@tonilopezmr

Page 17: Descubre Android

@tonilopezmr

Page 18: Descubre Android

public class MainActivity extends AppCompatActivity {

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); }}

@tonilopezmr

Page 19: Descubre Android

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">

<TextView

android:id="@+id/text_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:text="Hello GeeksHubs!" />

<FrameLayout android:id="@+id/frame_layout" android:layout_width="match_parent" android:layout_height="match_parent" /></LinearLayout>

@tonilopezmr

Page 20: Descubre Android

public class MainActivity extends AppCompatActivity {

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

textView textView = (TextView) findViewById(R.id.text_view); textView.setText(“Cambiando el texto”); }

}

@tonilopezmr

Page 21: Descubre Android

public class DescriptionFragment extends Fragment {

@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_description, container, false); TextView desc = (TextView) rootView.findViewById(R.id.text_view); desc.setText(“My description”);

return rootView; }}

@tonilopezmr

Page 22: Descubre Android

public class MainActivity extends AppCompatActivity {

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

...

getSupportFragmentManager().beginTransaction() .replace(R.id.frame_layout, new DescriptionFragment(), "f_name") .commit(); }} @tonilopezmr

Page 23: Descubre Android

@tonilopezmr

Page 24: Descubre Android

Android Llolipop● Material Design● Notificaciones● Batería● Otras mejoras: CPU 64 bits, Vectores

dibujables..@tonilopezmr

Page 25: Descubre Android

Android Marshmallow● Administración de permisos● Google Now on Tap● Android Pay● Direct Share● Soporte oficial para tarjetas SD y USB

@tonilopezmr

Page 26: Descubre Android

Material Design

https://www.google.com/design/spec/material-design/introduction.html@tonilopezmr

Page 27: Descubre Android

Material Design

https://www.google.com/design/spec/material-design/introduction.html@tonilopezmr

Page 28: Descubre Android

Material Design

@tonilopezmr

Page 29: Descubre Android

● Material Theme a partir de 5.0● Design Support Library● Otras librerías: CardView, RecyclerView

compile 'com.android.support:appcompat-v7:23.3.0'compile 'com.android.support:design:23.3.0'

Material Design

https://www.google.com/design/spec/material-design/introduction.html@tonilopezmr

Page 30: Descubre Android

colorPrimaryDark

colorPrimary

colorAccent<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">#234234</item> <item name="colorPrimaryDark">#02342</item> <item name="colorAccent">#23423</item> </style>

https://www.google.com/design/spec/material-design/introduction.html@tonilopezmr

Page 31: Descubre Android

Toast vs SnackBarToast

●Mostrar mensajes o errores

●Un tiempo de duración (largo o corto)

SnackBar

●Mostrar mensajes o errores

●Puedes añadir una acción

●Permanente o con tiempo de duraciónhttps://www.google.com/design/spec/components/snackbars-toasts.html @tonilopezmr

Page 32: Descubre Android

Toast vs SnackBarToast.makeText(context, "Esto es un mensaje", Toast.LENGTH_SHORT).show();

Snackbar .make(context, "Esto es un mensaje más guay",Snackbar.LENGTH_INDEFINITE) .setAction(...) .show();

@tonilopezmr

Page 33: Descubre Android

FloatingButton

app:fabSize = “normal” app:fabSize = “mini”

https://www.google.com/design/spec/components/buttons-floating-action-button.html @tonilopezmr

Page 34: Descubre Android

Toolbar

<android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay">

https://www.google.com/design/spec/layout/structure.html#structure-toolbars

toolbar = (Toolbar) findViewById(R.id.toolbar);setSupportActionBar(toolbar);

@tonilopezmr

Page 35: Descubre Android

CoordinatorLayout● Nuevo layout que coordina sus vistas

hijas entre ellas mediante comportamientos

● Behaviours

@tonilopezmr

Page 36: Descubre Android

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent">

<android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" android:src="@android:drawable/icon" />

<android.support.design.widget.CoordinatorLayout/>

@tonilopezmr

Page 37: Descubre Android

AppBarLayout y CoordinatorLayout

@tonilopezmr@tonilopezmr

Page 38: Descubre Android

@tonilopezmr

<android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="@dimen/detail_header_height" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<android.support.design.widget.CollapsingToolbarLayout android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollFlags="scroll|exitUntilCollapsed" app:expandedTitleMarginStart="48dp" app:expandedTitleMarginEnd="64dp">

<android.support.v7.widget.Toolbar … /> <ImageView

… app:layout_collapseMode="parallax" />

...

</android.support.design.widget.CollapsingToolbarLayout>@tonilopezmr

● scroll

● enterAlways

● enterAlwaysCollapsed

● exitUntilCollapsed

Page 39: Descubre Android

http://www.materialdoc.com/@tonilopezmr

Page 40: Descubre Android

https://github.com/tonilopezmr/android-community

@tonilopezmr

Page 41: Descubre Android

¿Preguntas?

@[email protected]