SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
Getting Started with 
Material Design 
David Montiel Yasin Yıldırım 
eBay Kleinanzeigen
Who Are We? 
David Montiel 
● 3+ Years on Android Development 
● >1 Year @eBay Kleinanzeigen 
● Before worked at Google, LinkedIn, Xing. 
● Enjoy staying up to date with current Android design patterns.
Who Are We? 
Yasin Yıldırım 
● 4+ years on Android Development 
● 1,5 Year @eBay Kleinanzeigen 
● Before worked at couple of software agencies in Turkey 
● Passionate about Android
Android App 
● German Classifieds platform 
● >6 Mio downloads 
● 4,4 / 5 stars rating (68K ratings) 
● Got featured on Play Store
This presentation is a very general 
overview
In-App Navigation 
● Inside the app, Up button usually means back. (But not always!)
Where Up doesn’t mean Back?
Navigation Drawer 
● The common pattern for navigating between main parts of your app
Swipe Between Views 
● Provide easiest possible navigation between Views for the user
Pure Android 
● Do not mimic UI elements from other 
platforms 
● Do not carry over platform 
specific icons
Pure Android 
● No bottom tabs ● No labels on back 
buttons 
● No right-pointing 
carets on line items
Some Material Taste?
First thing to assume... 
● You will be spending much more time 
programming animations… 
● Most of the “new” animations are 
provided by android, but many others 
continue depending on AnimationUtils, 
TranslateAnimation, etc..
Material design focuses on... 
● Animations 
● Layers 
● Minimalism
Basic Items: List and Cards 
● Android provides 
new widgets for 
displaying cards 
and lists with 
material design 
styles and 
animations.
Basic Items: Animations! 
● There are a lot of new recommended animations
Floating Elements: The Z axis 
● Some items in material design elevate in a Z axis, occupying a 
space “closer” to the user. Use the shadow!
Floating Button: The basic example
Let’s get technical!
dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile 'com.android.support:appcompat-v7:+' 
compile 'com.android.support:cardview-v7:+' 
compile 'com.android.support:recyclerview-v7:+' 
compile 'com.android.support:palette-v7:+' 
} 
Add support libraries for backwards compatibility 
● AppCompat: Backport for ActionBar & Material Design UI implementations 
● RecyclerView: Includes RecyclerView, RecyclerView.Adapter & LayoutManagers 
● CardView: Contains CardView widget to have cards layout easily 
● Palette: Extracts prominent colors from an image
values/styles.xml 
<!-- Base application theme. --> 
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> 
<!-- Customize your theme here. → 
<!-- your app branding color for the app bar --> 
<item name="colorPrimary">@color/primary</item> 
<!-- darker variant for the status bar and contextual app bars --> 
<item name="colorPrimaryDark">@color/primary_dark</item> 
<!-- theme UI controls like checkboxes and text fields --> 
<item name="colorAccent">@color/accent</item> 
</style> 
Style your app
Cool new DrawerToggle 
Update your imports to get the latest version 
import android.support.v4.app.ActionBarDrawerToggle 
import android.support.v7.app.ActionBarDrawerToggle 
ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle( 
this, /* host Activity */ 
drawerLayout, /* DrawerLayout object */ 
R.string.drawer_open, /* "open drawer" description */ 
R.string.drawer_close /* "close drawer" description */ 
)
Cool new DrawerToggle - Getting the animation 
drawerToggle = new ActionBarDrawerToggle (this, drawerLayout, R.string .drawer_open, R.string .drawer_close) { 
@Override 
protected void onPostCreate(Bundle savedInstanceState) { 
super.onPostCreate(savedInstanceState); 
// Synchronize the indicator with the state of the linked DrawerLayout 
drawerToggle.syncState(); 
} 
@Override 
public void onDrawerOpened (View drawerView) { 
super .onDrawerOpened(drawerView); 
getSupportActionBar() .setTitle(getString( R.string .app_name)); 
} 
@Override 
public void onDrawerClosed (View drawerView) { 
super .onDrawerClosed(drawerView); 
getSupportActionBar() .setTitle(getString( R.string .activity_title)); 
} 
};
Cool new DrawerToggle - Style the hamburger 
<!-- Base application theme. --> 
<style name= "AppTheme.Base" parent= "Theme.AppCompat.Light.DarkActionBar" > 
<item name= "colorPrimary" >@color/primary</item> 
<item name= "colorPrimaryDark" >@color/primary_dark</item> 
<item name= "colorAccent" >@color/accent</item> 
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item> 
</style> 
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle"> 
<!--The size of the bars when they are parallel to each other--> 
<item name="barSize">20dp</item> 
<!--The max gap between the bars when they are parallel to each other--> 
<item name="gapBetweenBars">4dp</item> 
<!--The size of the middle bar when top and bottom bars merge into middle bar to form an arrow--> 
<item name="middleBarArrowSize">20dp</item> 
<!--The size of the top and bottom bars when they merge to the middle bar to form an arrow--> 
<item name="topBottomBarArrowSize">15dp</item> 
<!--The thickness (stroke size) for the bar paint--> 
<item name="thickness">2dp</item> 
<!--Whether bars should rotate or not during transition--> 
<item name="spinBars">true</item> 
<!--The drawing color for the bars--> 
<item name="color">@android:color/white</item> 
</style>
Cool new SwipeRefreshLayout 
● Looks better 
● Doesn’t move the content down & up again 
● More options to customize 
● Single or multiple colors for progress 
swipeRefreshLayout.setProgressBackgroundColor(R.color.accent_light); 
swipeRefreshLayout.setSize(SwipeRefreshLayout.DEFAULT); 
OR 
swipeRefreshLayout.setSize(SwipeRefreshLayout.LARGE); 
swipeRefreshLayout.setColorSchemeResources(R.color.red,R.color.blue,R.color.yellow,R.color.green); 
OR 
swipeRefreshLayout.setColorSchemeResources(R.color.red,R.color.yellow); 
OR 
swipeRefreshLayout.setColorSchemeResources(R.color.red);
RecyclerView 
● Advanced & more flexible version of ListView 
● Recycling is more efficient 
● Layout managers for positioning items 
● Item animators for adding / removing items 
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view); 
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this); 
recyclerView.setLayoutManager(layoutManager); 
recyclerView.setAdapter(adapter);
RecyclerView.Adapter<VH extends RecyclerView.ViewHolder> 
private static class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.ViewHolder> { 
@Override 
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 
// create a new view 
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false); 
// set the view's size, margins, paddings and layout parameters 
return new ViewHolder(v); 
} 
@Override 
public void onBindViewHolder(ViewHolder holder, int position) { 
holder.textView.setText(dataset.get(position)); 
} 
} 
● Using a ViewHolder is mandatory
RecyclerView.ViewHolder 
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { 
public final CardView wholeListItem; 
public final TextView textView; 
public ViewHolder (CardView v) { 
super(v); 
wholeListItem = (CardView ) v.findViewById( R.id.card_view); 
textView = (TextView ) v.findViewById( R.id.text_view); 
} 
@Override 
public void onClick (View v) { 
if (v.getId() == R.id.card_view) { 
// Clicked on list item at getPosition() 
} else if (v.getId() == R.id.text_view) { 
// Clicked on textView at getPosition() 
} 
} 
} 
} 
● There’s no OnItemClickListener for RecyclerView, ViewHolder takes care of all clicks
CardView 
<android.support.v7.widget.CardView 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/card_view" 
android:layout_width="match_parent" 
android:layout_height="100dp" 
android:foreground="?android:attr/selectableItemBackground" 
app:cardCornerRadius="2dip" 
app:cardElevation="1sp" 
app:cardUseCompatPadding="true" 
app:cardBackgroundColor="#fcfcfc"> 
</android.support.v7.widget.CardView>
Shared Elements & Activity Transitions 
● Only works with Lollipop (API Level 21) 
● Activity starting is made with ActivityCompat 
values-v21/styles.xml: 
<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:windowSharedElementEnterTransition">@android:transition/move</item> 
<item name="android:windowSharedElementExitTransition">@android:transition/move</item> 
</style>
Shared Elements & Activity Transitions 
First Activity: 
// Define transition options 
ActivityOptionsCompat options = ActivityOptionsCompat .makeSceneTransitionAnimation(this, 
Second Activity: 
@Override 
protected void onCreate( Bundle savedInstanceState) { 
super .onCreate(savedInstanceState); 
setContentView( R.layout .activity_planet_detail); 
image = (ImageView ) findViewById( R.id.planet_image); 
// Animate the shared element 
ViewCompat .setTransitionName(image, "SHARED_IMAGE" ); 
} 
new Pair<View, String> (view.findViewById( R.id.grid_item_planet_image), "SHARED_IMAGE" )); 
// Create intent 
Intent intent = new Intent (this, PlanetDetailActivity .class); 
// Start activity with defined options 
ActivityCompat .startActivity(this, intent, options .toBundle());
ToolBar as ActionBar 
In the activity.xml: 
<android.support.v7.widget.Toolbar 
android:id="@+id/toolbar" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:minHeight="?attr/actionBarSize" 
android:background="@android:color/transparent" 
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> 
In the activity use a theme with no action bar: 
<!-- Base application theme with no actionbar. --> 
<style name="AppTheme.Base.NoActionBar" parent=" 
AppTheme.Base"> 
<item name="android:windowNoTitle">true</item> 
<item name="windowActionBar">false</item> 
</style> 
private void setupToolBar() { 
toolbar = (Toolbar) findViewById(R.id.toolbar); 
setSupportActionBar(toolbar); 
getSupportActionBar().setDisplayHomeAsUpEnabled(true); 
}
Tangible Surfaces 
public void onScrollChanged(int deltaX, int deltaY) { 
int scrollY = scrollView.getScrollY(); 
// Move background photo (with parallax effect) 
imageContainer.setTranslationY(scrollY * 0.5f); 
float newTop = Math.max(imageHeightPixels, scrollY); 
if (imageHeightPixels - scrollY <= toolBarHeightPixels) { // We reached the ToolBar 
newTop = scrollY + toolBarHeightPixels; 
} 
// Reposition the name bar -- it's normally anchored to the top of the detail part, 
// but locks to the bottom of the ToolBar on scroll 
nameContainer.setTranslationY(newTop); 
float gapFillProgress = 1; 
if (imageHeightPixels != 0) { 
gapFillProgress = Math.min(Math.max(getProgress(scrollY, 0, imageHeightPixels), 0), 1); 
} 
ViewCompat.setElevation(nameContainer, gapFillProgress* mMaxHeaderElevation); 
toolbar.getBackground().setAlpha((int) (gapFillProgress * 255)); 
}
Color Palette 
// Get palette from an image 
Palette.generateAsync(bitmap, new PaletteListener()); 
private class PaletteListener implements Palette.PaletteAsyncListener { 
@Override 
public void onGenerated(Palette palette) { 
lightVibrantColorFromImage = 
palette.getLightVibrantColor(R.color.light_blue); 
textViewPlanetName.setBackgroundColor(lightVibrantColorFromImage); 
} 
}
Overlapping Motion 
private void expandAnimation(int position, View convertView) 
{ 
final View finalConvertView = convertView; 
convertView.postDelayed(new Runnable() { 
@Override 
public void run() { 
Animation a = AnimationUtils.loadAnimation 
(context, R.anim.scale_up_from_center); 
finalConvertView.setAnimation(a); 
finalConvertView.setVisibility(View.VISIBLE); 
} 
}, position * 30); 
} 
<scale android:interpolator="@android: 
anim/accelerate_decelerate_interpolator" 
android:duration="150" 
android:fillAfter="true" 
android:fromXScale="0.0" 
android:fromYScale="0.0" 
android:toXScale="1.0" 
android:toYScale="1.0" 
android:pivotX="50%" 
android:pivotY="50%" />
view.animate().translationZ(20f).setDuration(500).setListener(new Animator.AnimatorListener() { 
// ..... other overriden methods 
@Override 
public void onAnimationEnd(Animator animation) { 
view.animate().translationZ(1f).setDuration(500).start(); 
} 
}).start(); 
translationZ Animation
State List Animator 
<ImageButton android :layout_width ="@dimen/floating_button_height" 
android :layout_height ="@dimen/floating_button_height" 
android :layout_gravity ="bottom|end" 
android :elevation ="5sp" 
android :layout_margin ="25dip" 
android :background ="@drawable/floating_button_bg" 
android :src="@drawable/ic_plus" 
android :stateListAnimator ="@anim/floating_button_state_list_anim" 
android :contentDescription ="@string/floating_button" /> 
floating_button_state_list_anim: 
<selector xmlns :android ="http://schemas.android.com/apk/res/android" > 
<item 
android :state_enabled ="true" 
android :state_pressed ="true" > 
<set> 
<objectAnimator 
android :duration ="@android:integer/config_shortAnimTime" 
android :propertyName ="translationZ" 
android :valueTo ="15dp" 
android :valueType ="floatType" /> 
</set> 
</item> 
<item> 
<set> 
<objectAnimator 
android :duration ="@android:integer/config_shortAnimTime" 
android :propertyName ="translationZ" 
android :valueTo ="0dp" 
android :valueType ="floatType" /> 
</set> 
</item> 
</selector >
Last thought.. 
Developers can make it happen but… we still 
need a designer...
Code & Slides 
https://github.com/vudin/MaterialDesignDemo 
http://goo.gl/xKJRdu
Questions? 
+DavidMontiel +YasinYildirimm 
@davidmonti @vudin

Weitere ähnliche Inhalte

Was ist angesagt?

Inside Flutter: Widgets, Elements, and RenderObjects
Inside Flutter: Widgets, Elements, and RenderObjectsInside Flutter: Widgets, Elements, and RenderObjects
Inside Flutter: Widgets, Elements, and RenderObjectsHansol Lee
 
jQuery for Sharepoint Dev
jQuery for Sharepoint DevjQuery for Sharepoint Dev
jQuery for Sharepoint DevZeddy Iskandar
 
EIA 2015 Creating Apps with Android Material Design
EIA 2015 Creating Apps with Android Material DesignEIA 2015 Creating Apps with Android Material Design
EIA 2015 Creating Apps with Android Material DesignEuropean Innovation Academy
 
Tips & Tricks to spice up your Android app
Tips & Tricks to spice up your Android appTips & Tricks to spice up your Android app
Tips & Tricks to spice up your Android appJérémie Laval
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android WearPeter Friese
 
4 coding101 fewd_lesson4_j_query_and_buttons 20210105
4 coding101 fewd_lesson4_j_query_and_buttons 202101054 coding101 fewd_lesson4_j_query_and_buttons 20210105
4 coding101 fewd_lesson4_j_query_and_buttons 20210105John Picasso
 
Flutter beyond Hello world talk
Flutter beyond Hello world talkFlutter beyond Hello world talk
Flutter beyond Hello world talkAhmed Abu Eldahab
 
Android Accessibility
Android AccessibilityAndroid Accessibility
Android AccessibilityAscii Huang
 
A comprehensive guide on developing responsive and common react filter component
A comprehensive guide on developing responsive and common react filter componentA comprehensive guide on developing responsive and common react filter component
A comprehensive guide on developing responsive and common react filter componentKaty Slemon
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsEPAM Systems
 
Getting Ready For Android Wear
Getting Ready For Android WearGetting Ready For Android Wear
Getting Ready For Android WearRaveesh Bhalla
 
Google Play Services Rock
Google Play Services RockGoogle Play Services Rock
Google Play Services RockPeter Friese
 
Google Fit, Android Wear & Xamarin
Google Fit, Android Wear & XamarinGoogle Fit, Android Wear & Xamarin
Google Fit, Android Wear & XamarinPeter Friese
 
Violet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole TeamViolet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole TeamAnton Caceres
 
Design for succcess with react and storybook.js
Design for succcess with react and storybook.jsDesign for succcess with react and storybook.js
Design for succcess with react and storybook.jsChris Saylor
 

Was ist angesagt? (20)

Inside Flutter: Widgets, Elements, and RenderObjects
Inside Flutter: Widgets, Elements, and RenderObjectsInside Flutter: Widgets, Elements, and RenderObjects
Inside Flutter: Widgets, Elements, and RenderObjects
 
jQuery for Sharepoint Dev
jQuery for Sharepoint DevjQuery for Sharepoint Dev
jQuery for Sharepoint Dev
 
EIA 2015 Creating Apps with Android Material Design
EIA 2015 Creating Apps with Android Material DesignEIA 2015 Creating Apps with Android Material Design
EIA 2015 Creating Apps with Android Material Design
 
Advance Android Layout Walkthrough
Advance Android Layout WalkthroughAdvance Android Layout Walkthrough
Advance Android Layout Walkthrough
 
Tips & Tricks to spice up your Android app
Tips & Tricks to spice up your Android appTips & Tricks to spice up your Android app
Tips & Tricks to spice up your Android app
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android Wear
 
4 coding101 fewd_lesson4_j_query_and_buttons 20210105
4 coding101 fewd_lesson4_j_query_and_buttons 202101054 coding101 fewd_lesson4_j_query_and_buttons 20210105
4 coding101 fewd_lesson4_j_query_and_buttons 20210105
 
Flutter beyond Hello world talk
Flutter beyond Hello world talkFlutter beyond Hello world talk
Flutter beyond Hello world talk
 
Android Accessibility
Android AccessibilityAndroid Accessibility
Android Accessibility
 
A comprehensive guide on developing responsive and common react filter component
A comprehensive guide on developing responsive and common react filter componentA comprehensive guide on developing responsive and common react filter component
A comprehensive guide on developing responsive and common react filter component
 
Continuous Quality
Continuous QualityContinuous Quality
Continuous Quality
 
Android
AndroidAndroid
Android
 
Jquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript BasicsJquery Complete Presentation along with Javascript Basics
Jquery Complete Presentation along with Javascript Basics
 
Getting Ready For Android Wear
Getting Ready For Android WearGetting Ready For Android Wear
Getting Ready For Android Wear
 
Google Play Services Rock
Google Play Services RockGoogle Play Services Rock
Google Play Services Rock
 
Google Fit, Android Wear & Xamarin
Google Fit, Android Wear & XamarinGoogle Fit, Android Wear & Xamarin
Google Fit, Android Wear & Xamarin
 
Violet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole TeamViolet Peña - Storybook: A React Tool For Your Whole Team
Violet Peña - Storybook: A React Tool For Your Whole Team
 
Android 2
Android 2Android 2
Android 2
 
Design for succcess with react and storybook.js
Design for succcess with react and storybook.jsDesign for succcess with react and storybook.js
Design for succcess with react and storybook.js
 
Modular and Event-Driven JavaScript
Modular and Event-Driven JavaScriptModular and Event-Driven JavaScript
Modular and Event-Driven JavaScript
 

Andere mochten auch

Android Lollipop - Webinar am 11.12.2014
Android Lollipop - Webinar am 11.12.2014Android Lollipop - Webinar am 11.12.2014
Android Lollipop - Webinar am 11.12.2014inovex GmbH
 
Infinum android talks_10_implementing material design
Infinum android talks_10_implementing material designInfinum android talks_10_implementing material design
Infinum android talks_10_implementing material designInfinum
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & viewsma-polimi
 
Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycleSoham Patel
 

Andere mochten auch (6)

Android Lollipop - Webinar am 11.12.2014
Android Lollipop - Webinar am 11.12.2014Android Lollipop - Webinar am 11.12.2014
Android Lollipop - Webinar am 11.12.2014
 
Infinum android talks_10_implementing material design
Infinum android talks_10_implementing material designInfinum android talks_10_implementing material design
Infinum android talks_10_implementing material design
 
Android activities & views
Android activities & viewsAndroid activities & views
Android activities & views
 
Android development session 2 - intent and activity
Android development   session 2 - intent and activityAndroid development   session 2 - intent and activity
Android development session 2 - intent and activity
 
Android activity lifecycle
Android activity lifecycleAndroid activity lifecycle
Android activity lifecycle
 
RSpec 2 Best practices
RSpec 2 Best practicesRSpec 2 Best practices
RSpec 2 Best practices
 

Ähnlich wie Getting Started With Material Design

Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recieversUtkarsh Mankad
 
Fernando F. Gallego - Efficient Android Resources 101
Fernando F. Gallego - Efficient Android Resources 101Fernando F. Gallego - Efficient Android Resources 101
Fernando F. Gallego - Efficient Android Resources 101Fernando Gallego
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentanistar sung
 
android layouts
android layoutsandroid layouts
android layoutsDeepa Rani
 
Application Development - Overview on Android OS
Application Development - Overview on Android OSApplication Development - Overview on Android OS
Application Development - Overview on Android OSPankaj Maheshwari
 
21 android2 updated
21 android2 updated21 android2 updated
21 android2 updatedGhanaGTUG
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgetsSiva Kumar reddy Vasipally
 
Material design basics
Material design basicsMaterial design basics
Material design basicsJorge Barroso
 
Embracing the Lollipop
Embracing the LollipopEmbracing the Lollipop
Embracing the LollipopSonja Kesic
 
Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsRomain Guy
 
Android JetPack: easy navigation with the new Navigation Controller
Android JetPack: easy navigation with the new Navigation ControllerAndroid JetPack: easy navigation with the new Navigation Controller
Android JetPack: easy navigation with the new Navigation ControllerLeonardo Pirro
 
Lecture #1 Creating your first android project
Lecture #1  Creating your first android projectLecture #1  Creating your first android project
Lecture #1 Creating your first android projectVitali Pekelis
 
Android UI Reference
Android UI ReferenceAndroid UI Reference
Android UI ReferenceGauntFace
 
CS6611 Mobile Application Development Lab Manual-2018-19
CS6611 Mobile Application Development Lab Manual-2018-19CS6611 Mobile Application Development Lab Manual-2018-19
CS6611 Mobile Application Development Lab Manual-2018-19Gobinath Subramaniam
 
Android accessibility for developers and QA
Android accessibility for developers and QAAndroid accessibility for developers and QA
Android accessibility for developers and QATed Drake
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?Brenda Cook
 

Ähnlich wie Getting Started With Material Design (20)

Android 3
Android 3Android 3
Android 3
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
Fernando F. Gallego - Efficient Android Resources 101
Fernando F. Gallego - Efficient Android Resources 101Fernando F. Gallego - Efficient Android Resources 101
Fernando F. Gallego - Efficient Android Resources 101
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
android layouts
android layoutsandroid layouts
android layouts
 
Application Development - Overview on Android OS
Application Development - Overview on Android OSApplication Development - Overview on Android OS
Application Development - Overview on Android OS
 
21 android2 updated
21 android2 updated21 android2 updated
21 android2 updated
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgets
 
Android programming basics
Android programming basicsAndroid programming basics
Android programming basics
 
Material design basics
Material design basicsMaterial design basics
Material design basics
 
Ap quiz app
Ap quiz appAp quiz app
Ap quiz app
 
Embracing the Lollipop
Embracing the LollipopEmbracing the Lollipop
Embracing the Lollipop
 
Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb Highlights
 
Android JetPack: easy navigation with the new Navigation Controller
Android JetPack: easy navigation with the new Navigation ControllerAndroid JetPack: easy navigation with the new Navigation Controller
Android JetPack: easy navigation with the new Navigation Controller
 
Geekcamp Android
Geekcamp AndroidGeekcamp Android
Geekcamp Android
 
Lecture #1 Creating your first android project
Lecture #1  Creating your first android projectLecture #1  Creating your first android project
Lecture #1 Creating your first android project
 
Android UI Reference
Android UI ReferenceAndroid UI Reference
Android UI Reference
 
CS6611 Mobile Application Development Lab Manual-2018-19
CS6611 Mobile Application Development Lab Manual-2018-19CS6611 Mobile Application Development Lab Manual-2018-19
CS6611 Mobile Application Development Lab Manual-2018-19
 
Android accessibility for developers and QA
Android accessibility for developers and QAAndroid accessibility for developers and QA
Android accessibility for developers and QA
 
Fragments: Why, How, What For?
Fragments: Why, How, What For?Fragments: Why, How, What For?
Fragments: Why, How, What For?
 

Kürzlich hochgeladen

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 

Kürzlich hochgeladen (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Getting Started With Material Design

  • 1. Getting Started with Material Design David Montiel Yasin Yıldırım eBay Kleinanzeigen
  • 2. Who Are We? David Montiel ● 3+ Years on Android Development ● >1 Year @eBay Kleinanzeigen ● Before worked at Google, LinkedIn, Xing. ● Enjoy staying up to date with current Android design patterns.
  • 3. Who Are We? Yasin Yıldırım ● 4+ years on Android Development ● 1,5 Year @eBay Kleinanzeigen ● Before worked at couple of software agencies in Turkey ● Passionate about Android
  • 4. Android App ● German Classifieds platform ● >6 Mio downloads ● 4,4 / 5 stars rating (68K ratings) ● Got featured on Play Store
  • 5. This presentation is a very general overview
  • 6. In-App Navigation ● Inside the app, Up button usually means back. (But not always!)
  • 7. Where Up doesn’t mean Back?
  • 8. Navigation Drawer ● The common pattern for navigating between main parts of your app
  • 9. Swipe Between Views ● Provide easiest possible navigation between Views for the user
  • 10. Pure Android ● Do not mimic UI elements from other platforms ● Do not carry over platform specific icons
  • 11. Pure Android ● No bottom tabs ● No labels on back buttons ● No right-pointing carets on line items
  • 13. First thing to assume... ● You will be spending much more time programming animations… ● Most of the “new” animations are provided by android, but many others continue depending on AnimationUtils, TranslateAnimation, etc..
  • 14. Material design focuses on... ● Animations ● Layers ● Minimalism
  • 15. Basic Items: List and Cards ● Android provides new widgets for displaying cards and lists with material design styles and animations.
  • 16. Basic Items: Animations! ● There are a lot of new recommended animations
  • 17. Floating Elements: The Z axis ● Some items in material design elevate in a Z axis, occupying a space “closer” to the user. Use the shadow!
  • 18. Floating Button: The basic example
  • 20. dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:+' compile 'com.android.support:cardview-v7:+' compile 'com.android.support:recyclerview-v7:+' compile 'com.android.support:palette-v7:+' } Add support libraries for backwards compatibility ● AppCompat: Backport for ActionBar & Material Design UI implementations ● RecyclerView: Includes RecyclerView, RecyclerView.Adapter & LayoutManagers ● CardView: Contains CardView widget to have cards layout easily ● Palette: Extracts prominent colors from an image
  • 21. values/styles.xml <!-- Base application theme. --> <style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. → <!-- your app branding color for the app bar --> <item name="colorPrimary">@color/primary</item> <!-- darker variant for the status bar and contextual app bars --> <item name="colorPrimaryDark">@color/primary_dark</item> <!-- theme UI controls like checkboxes and text fields --> <item name="colorAccent">@color/accent</item> </style> Style your app
  • 22. Cool new DrawerToggle Update your imports to get the latest version import android.support.v4.app.ActionBarDrawerToggle import android.support.v7.app.ActionBarDrawerToggle ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle( this, /* host Activity */ drawerLayout, /* DrawerLayout object */ R.string.drawer_open, /* "open drawer" description */ R.string.drawer_close /* "close drawer" description */ )
  • 23. Cool new DrawerToggle - Getting the animation drawerToggle = new ActionBarDrawerToggle (this, drawerLayout, R.string .drawer_open, R.string .drawer_close) { @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Synchronize the indicator with the state of the linked DrawerLayout drawerToggle.syncState(); } @Override public void onDrawerOpened (View drawerView) { super .onDrawerOpened(drawerView); getSupportActionBar() .setTitle(getString( R.string .app_name)); } @Override public void onDrawerClosed (View drawerView) { super .onDrawerClosed(drawerView); getSupportActionBar() .setTitle(getString( R.string .activity_title)); } };
  • 24. Cool new DrawerToggle - Style the hamburger <!-- Base application theme. --> <style name= "AppTheme.Base" parent= "Theme.AppCompat.Light.DarkActionBar" > <item name= "colorPrimary" >@color/primary</item> <item name= "colorPrimaryDark" >@color/primary_dark</item> <item name= "colorAccent" >@color/accent</item> <item name="drawerArrowStyle">@style/DrawerArrowStyle</item> </style> <style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle"> <!--The size of the bars when they are parallel to each other--> <item name="barSize">20dp</item> <!--The max gap between the bars when they are parallel to each other--> <item name="gapBetweenBars">4dp</item> <!--The size of the middle bar when top and bottom bars merge into middle bar to form an arrow--> <item name="middleBarArrowSize">20dp</item> <!--The size of the top and bottom bars when they merge to the middle bar to form an arrow--> <item name="topBottomBarArrowSize">15dp</item> <!--The thickness (stroke size) for the bar paint--> <item name="thickness">2dp</item> <!--Whether bars should rotate or not during transition--> <item name="spinBars">true</item> <!--The drawing color for the bars--> <item name="color">@android:color/white</item> </style>
  • 25. Cool new SwipeRefreshLayout ● Looks better ● Doesn’t move the content down & up again ● More options to customize ● Single or multiple colors for progress swipeRefreshLayout.setProgressBackgroundColor(R.color.accent_light); swipeRefreshLayout.setSize(SwipeRefreshLayout.DEFAULT); OR swipeRefreshLayout.setSize(SwipeRefreshLayout.LARGE); swipeRefreshLayout.setColorSchemeResources(R.color.red,R.color.blue,R.color.yellow,R.color.green); OR swipeRefreshLayout.setColorSchemeResources(R.color.red,R.color.yellow); OR swipeRefreshLayout.setColorSchemeResources(R.color.red);
  • 26. RecyclerView ● Advanced & more flexible version of ListView ● Recycling is more efficient ● Layout managers for positioning items ● Item animators for adding / removing items RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(layoutManager); recyclerView.setAdapter(adapter);
  • 27. RecyclerView.Adapter<VH extends RecyclerView.ViewHolder> private static class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.ViewHolder> { @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // create a new view View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false); // set the view's size, margins, paddings and layout parameters return new ViewHolder(v); } @Override public void onBindViewHolder(ViewHolder holder, int position) { holder.textView.setText(dataset.get(position)); } } ● Using a ViewHolder is mandatory
  • 28. RecyclerView.ViewHolder public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { public final CardView wholeListItem; public final TextView textView; public ViewHolder (CardView v) { super(v); wholeListItem = (CardView ) v.findViewById( R.id.card_view); textView = (TextView ) v.findViewById( R.id.text_view); } @Override public void onClick (View v) { if (v.getId() == R.id.card_view) { // Clicked on list item at getPosition() } else if (v.getId() == R.id.text_view) { // Clicked on textView at getPosition() } } } } ● There’s no OnItemClickListener for RecyclerView, ViewHolder takes care of all clicks
  • 29. CardView <android.support.v7.widget.CardView xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="100dp" android:foreground="?android:attr/selectableItemBackground" app:cardCornerRadius="2dip" app:cardElevation="1sp" app:cardUseCompatPadding="true" app:cardBackgroundColor="#fcfcfc"> </android.support.v7.widget.CardView>
  • 30. Shared Elements & Activity Transitions ● Only works with Lollipop (API Level 21) ● Activity starting is made with ActivityCompat values-v21/styles.xml: <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:windowSharedElementEnterTransition">@android:transition/move</item> <item name="android:windowSharedElementExitTransition">@android:transition/move</item> </style>
  • 31. Shared Elements & Activity Transitions First Activity: // Define transition options ActivityOptionsCompat options = ActivityOptionsCompat .makeSceneTransitionAnimation(this, Second Activity: @Override protected void onCreate( Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView( R.layout .activity_planet_detail); image = (ImageView ) findViewById( R.id.planet_image); // Animate the shared element ViewCompat .setTransitionName(image, "SHARED_IMAGE" ); } new Pair<View, String> (view.findViewById( R.id.grid_item_planet_image), "SHARED_IMAGE" )); // Create intent Intent intent = new Intent (this, PlanetDetailActivity .class); // Start activity with defined options ActivityCompat .startActivity(this, intent, options .toBundle());
  • 32. ToolBar as ActionBar In the activity.xml: <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="?attr/actionBarSize" android:background="@android:color/transparent" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> In the activity use a theme with no action bar: <!-- Base application theme with no actionbar. --> <style name="AppTheme.Base.NoActionBar" parent=" AppTheme.Base"> <item name="android:windowNoTitle">true</item> <item name="windowActionBar">false</item> </style> private void setupToolBar() { toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
  • 33. Tangible Surfaces public void onScrollChanged(int deltaX, int deltaY) { int scrollY = scrollView.getScrollY(); // Move background photo (with parallax effect) imageContainer.setTranslationY(scrollY * 0.5f); float newTop = Math.max(imageHeightPixels, scrollY); if (imageHeightPixels - scrollY <= toolBarHeightPixels) { // We reached the ToolBar newTop = scrollY + toolBarHeightPixels; } // Reposition the name bar -- it's normally anchored to the top of the detail part, // but locks to the bottom of the ToolBar on scroll nameContainer.setTranslationY(newTop); float gapFillProgress = 1; if (imageHeightPixels != 0) { gapFillProgress = Math.min(Math.max(getProgress(scrollY, 0, imageHeightPixels), 0), 1); } ViewCompat.setElevation(nameContainer, gapFillProgress* mMaxHeaderElevation); toolbar.getBackground().setAlpha((int) (gapFillProgress * 255)); }
  • 34. Color Palette // Get palette from an image Palette.generateAsync(bitmap, new PaletteListener()); private class PaletteListener implements Palette.PaletteAsyncListener { @Override public void onGenerated(Palette palette) { lightVibrantColorFromImage = palette.getLightVibrantColor(R.color.light_blue); textViewPlanetName.setBackgroundColor(lightVibrantColorFromImage); } }
  • 35. Overlapping Motion private void expandAnimation(int position, View convertView) { final View finalConvertView = convertView; convertView.postDelayed(new Runnable() { @Override public void run() { Animation a = AnimationUtils.loadAnimation (context, R.anim.scale_up_from_center); finalConvertView.setAnimation(a); finalConvertView.setVisibility(View.VISIBLE); } }, position * 30); } <scale android:interpolator="@android: anim/accelerate_decelerate_interpolator" android:duration="150" android:fillAfter="true" android:fromXScale="0.0" android:fromYScale="0.0" android:toXScale="1.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" />
  • 36. view.animate().translationZ(20f).setDuration(500).setListener(new Animator.AnimatorListener() { // ..... other overriden methods @Override public void onAnimationEnd(Animator animation) { view.animate().translationZ(1f).setDuration(500).start(); } }).start(); translationZ Animation
  • 37. State List Animator <ImageButton android :layout_width ="@dimen/floating_button_height" android :layout_height ="@dimen/floating_button_height" android :layout_gravity ="bottom|end" android :elevation ="5sp" android :layout_margin ="25dip" android :background ="@drawable/floating_button_bg" android :src="@drawable/ic_plus" android :stateListAnimator ="@anim/floating_button_state_list_anim" android :contentDescription ="@string/floating_button" /> floating_button_state_list_anim: <selector xmlns :android ="http://schemas.android.com/apk/res/android" > <item android :state_enabled ="true" android :state_pressed ="true" > <set> <objectAnimator android :duration ="@android:integer/config_shortAnimTime" android :propertyName ="translationZ" android :valueTo ="15dp" android :valueType ="floatType" /> </set> </item> <item> <set> <objectAnimator android :duration ="@android:integer/config_shortAnimTime" android :propertyName ="translationZ" android :valueTo ="0dp" android :valueType ="floatType" /> </set> </item> </selector >
  • 38. Last thought.. Developers can make it happen but… we still need a designer...
  • 39. Code & Slides https://github.com/vudin/MaterialDesignDemo http://goo.gl/xKJRdu