Top Banner
KAMAL K KISHORE 29-Apr-2015 & What’s new in
24

What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Jul 17, 2015

Download

Technology

Deepu S Nath
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

KAMAL K KISHORE

29-Apr-2015

&

What’s new in

Page 2: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Material Design

Page 3: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Material Theme

• @android:style/Theme.Material (dark version)

• @android:style/Theme.Material.Light (light version)

• @android:style/Theme.Material.Light.DarkActionBar

Page 4: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Customizing

• colorPrimary

• textColorPrimary

• colorPrimaryDark

• windowBackground

• navigationBarColor

Page 5: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Customizing<?xml version="1.0" encoding="UTF-8"?>

<resources>

<!-- inherit from the material theme -->

<style name="AppTheme" parent="android:Theme.Material“>

<!-- Main theme colors --> <!-- your app branding color for the

app bar -->

<item name="android:colorPrimary">@color/primary</item>

<!-- darker variant for the status bar and contextual app bars

<item

name="android:colorPrimaryDark">@color/primary_dark</item>

<!-- theme UI controls like checkboxes and text fields

<item name="android:colorAccent">@color/accent</item>

</style>

</resources>

Page 6: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

• A different theme

• New widgets for complex views

• New API’s for Custom shadows and

animations

Elements of Material Design

Page 7: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Lists <!-- A RecyclerView with some

commonly used attributes -->

<android.support.v7.widget.RecyclerVie

w

android:id="@+id/my_recycler_view“

android:scrollbars="vertical“

android:layout_width="match_parent"

android:layout_height="match_parent"/

>

public class MyAdapter extends

RecyclerView.Adapter<MyAdapter.ViewH

older>

dependencies {

compile

'com.android.support:recyclerview-

v7:21.0.+‘ }

Page 8: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Cards <android.support.v7.widget.CardView

xmlns:card_view="http://schemas.andr

oid.com/apk/res-auto"

android:id="@+id/card_view"

android:layout_gravity="center"

android:layout_width="200dp"

android:layout_height="200dp"

card_view:cardCornerRadius="4dp">

card_view:cardCornerRadius

card_view:cardBackgroundColor

dependencies {

compile

'com.android.support:cardview-

v7:21.0.+'

}

Page 9: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

View Shadows• The Z property

– android:elevation attribute

Page 10: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Clip Views• Transforming shape of a view

– android:clipToOutline

Page 11: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Animations

Page 12: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Vector Drawables

• Drawable tinting

– android:tint

– android:tintMode

• Prominent color extraction

– Palette.getVibrantColor

• Vector drawables

– <vector >

– <path android:fillColor="#8fff"

– android:pathData=….

– </vector >

Page 13: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Defining Custom Animations• Touch feedback

• Circular Reveal

• Activity transitions

• Curved motion

• View state changes

Page 14: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Reveal Effect

• create the animator for this view (the

start radius is zero)

• Animator anim =

ViewAnimationUtils.createCircularRev

eal(myView, cx, cy, 0, finalRadius);

• make the view visible and start the

animation

• myView.setVisibility(View.VISIBLE);

• anim.start();

Page 15: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Compatibility

• Using styles

– Define a theme that inherits from an older

theme (like Holo) in res/values/styles.xml.

– Define a theme with the same name that

inherits from the material theme in

res/values-v21/styles.xml.

– Set this theme as your app's theme in the

manifest file.

Page 16: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Compatibility• Using layouts

– res/layout-v21/

– res/layout/

• Using Support Library v7-21

– Some system widgets when you apply one of

the Theme.AppCompat themes.

– Color palette theme attributes in the

Theme.AppCompat themes.

– The RecyclerView widget to display data

collections.

– The CardView widget to create cards.

– The Palette class to extract prominent colors

from images.

Page 17: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

google.com/design

Page 18: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle
Page 19: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

What is Gradle?

• Gradle is an advanced build toolkit that

manages dependencies and allows you to

define custom build logic.

• This means that you can build your Android

apps from which Android Studio and from the

command line on your machine or on

machines where Android Studio is not

installed.

• The build files are called build.gradle, and

they are plain text files that

use Groovy syntax

Page 20: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Why Gradle?

• The Gradle build system is designed to

support complex scenarios in creating

Android applications.

– Multi-distribution: the same application must

be customized for several clients or companies

– Multi-apk: supporting the creation of multiple

apk for different device types while reusing

parts of the the code

Page 21: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Using Gradle to build different variants

• applying plugin

– apply plugin: 'com.android.application‘

• setting defaultConfig

– applicationId, minSdkVersion,

targetSdkVersion, versionCode,

versionName

• setting buildTypes

– proguardFiles, minifyEnabled

Page 22: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Using Gradle to build different variants

• adding productFlavors– sets applicationId & versionName for different

flavors (like paid, free etc.)

• adding dependencies– Module dependency - compile project(":lib")

– Remote binary dependency - compile

'com.android.support:appcompat-v7:19.0.1'

– Local binary dependency - compile fileTree(dir:

'libs', include: ['*.jar'])

Page 23: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

gradle.org

Page 24: What’s new for Android Developers in 2015 - Material Design, Android Studio, Gradle

Thank you