This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shadows etc...

Overview

Android L preview example

Description

This project is focused on the sample using the API's new preview version of Android-L, use of transitions, shadows etc...,

Alt text

UI

This app is aimed to use the new Material Design released at the Google I/0 14, to use the Material theme on your app, you only have to set the parent of your app style to @android:style/Theme.Material or @android:style/Theme.Material.Light and @android:style/Theme.Material.DarkActionBar.

Customize the Color Palette of your app

In the theme.xml of the MainActivity:

    <!-- App colors -->
    <color name="lollipop_theme_default_primary">#3F51B5</color>
    <color name="lollipop_theme_default_primary_dark">#303F9F</color>
    <color name="lollipop_theme_default_accent">#C5CAE9</color>
    <color name="fab_color">#FF4081</color>


    <!-- Main theme colors -->
    <style name="MainLollipopTheme" parent="android:Theme.Material.Light">
        <item name="android:colorPrimary">@color/lollipop_theme_default_primary</item>
        <item name="android:colorPrimaryDark">@color/lollipop_theme_default_primary</item>
        <item name="android:statusBarColor">@color/lollipop_theme_default_primary_dark</item>
        <item name="android:colorAccent">@color/lollipop_theme_default_accent</item>
        <item name="android:colorControlHighlight">@color/lollipop_theme_default_accent</item>
        <item name="android:navigationBarColor">@color/lollipop_theme_default_primary</item>

        <!-- Main theme action bar-->
        <item name="android:actionBarStyle">@style/MainActionBar</item>
        <item name="android:actionBarTheme">@style/MainActionBarThemeOverlay</item>


        <!-- lag indicating whether this window requests that content changes be performed
             as scene changes with transitions -->
        <item name="android:windowContentTransitions">true</item>

        <!-- Flag indicating whether this Window's transition should overlap with
             the exiting transition of the calling Activity. -->
        <item name="android:windowAllowEnterTransitionOverlap">true</item>

        <!--Flag indicating whether this Window's transition should overlap with
             the exiting transition of the called Activity when the called Activity
             finishes. -->
        <item name="android:windowAllowExitTransitionOverlap">true</item>

        <!-- Flag indicating whether this window's Action Bar should overlay -->
        <item name="android:windowActionBarOverlay">false</item>

        <!-- Flag indicating whether this window's Action Bar content should overlay -->
        <item name="android:windowContentOverlay">@null</item>
    </style>

Customizing the material theme <- This easy picture on Android Developers explains where are the attributes that of the previous code.

The FAB Button

Android-L introduces a new way to manage view with elevation and shadows, "Outlines represent the outer shape of a graphics object and define the ripple area for touch feedback." Android Developers, the fab button is defined as a ImageButton in the xml:

...
    <!-- fab button -->
    <ImageButton
        android:id="@+id/fab"
        android:layout_alignParentRight="true"
        android:layout_alignParentBottom="true"
        android:layout_width="@dimen/fab_size"
        android:layout_height="@dimen/fab_size"
        android:layout_gravity="bottom|right"
        android:layout_marginRight="16dp"
        android:layout_marginBottom="16dp"
        android:background="@drawable/fab_ripple"
        android:elevation="@dimen/button_elevation"
        android:onClick="onFabClicked"
        android:src="@drawable/ic_action_add"/>
...
        // Configure the FAB button
        int size = getResources().getDimensionPixelSize(R.dimen.fab_size);
        Outline outline = new Outline();
        outline.setOval(0, 0, size, size);
        findViewById(R.id.fab).setOutline(outline);

Activity transitions

Now, with Android-L you can specify custom animations for enter and exit transitions, and for transition of shared elements between activities, to do that, first, you have to enable the window content transitions, in my case, at themes.xml you can set this values from java code as well.

    <style name="MainLollipopTheme" parent="android:Theme.Material.Light">
        ...
        <!-- lag indicating whether this window requests that content changes be performed
       as scene changes with transitions -->
        <item name="android:windowContentTransitions">true</item>

        <!-- Flag indicating whether this Window's transition should overlap with
             the exiting transition of the calling Activity. -->
        <item name="android:windowAllowEnterTransitionOverlap">true</item>

        <!--Flag indicating whether this Window's transition should overlap with
             the exiting transition of the called Activity when the called Activity
             finishes. -->
        <item name="android:windowAllowExitTransitionOverlap">true</item>

        <!-- Flag indicating whether this window's Action Bar should overlay -->
        <item name="android:windowActionBarOverlay">false</item>

        <!-- Flag indicating whether this window's Action Bar content should overlay -->
        <item name="android:windowContentOverlay">@null</item>
        ...
    </style>
    
        // Setup the transition to the detail activity
        ActivityOptions options =  ActivityOptions.makeSceneTransitionAnimation(MainActivity.this, view, "photo" + i);
        startActivity(detailIntent, options.toBundle());

Tools & References:

You might also like...
🛒A Minimal Expense E-Commerce App built to demonstrate the use of modern android architecture components [Navigation, Room, MotionLayout, etc..] with MVVM Architecture. ✔
🛒A Minimal Expense E-Commerce App built to demonstrate the use of modern android architecture components [Navigation, Room, MotionLayout, etc..] with MVVM Architecture. ✔

E-Store A Simple E-Commerce App 📱 built to demonstrate the use of modern android architecture component with MVVM Architecture 🏗 . Made with love ❤️

New-SplashScreen-API - SplashScreen API Implementation Sample

SplashScreen API Implementation Sample Installation - Usage style name="Theme.A

Project allowing to query products (languages, libraries, databases, etc) by their properties.

Products app This project allow to search products (mostly software products for now such as languages, libraries etc) based on their properties. For

A Mars Photos app for Android using NASA APIs with MVVM + Clean Architecture

Mars Photos App 🚀 Mars Photos App for Android that display a list of photos taken from cameras from different rovers - Made with Hilt, Coroutines, Re

A news app made using android studio in Java with features like favourite news, Location detector for local news, and especially made with HUAWEI APIs

HuaweiGlobalNewsApp A news app made using android studio in Java with features like favourite news, Location detector for local news, and especially m

FoldingNavigationDrawer-Android This is a sample project present how to use Folding-Android to add Folding Efect to Navigation Drawer.

FoldingNavigationDrawer-Android Sample (Play Store Demo) This is a sample project present how to use Folding-Android to add Folding Efect to Navigatio

 App which show comic and characters using marvel apis
App which show comic and characters using marvel apis

Marvel App App which show comic and characters using marvel apis ScreenShot Tech Room database MVVM Architecture Navigation Component How to run proje

GitHub application fetches events, repositories and profile using GitHub APIs
GitHub application fetches events, repositories and profile using GitHub APIs

GitHub application using GitHub REST API Dagger MVVM architecture Mockk Jetpack Compose Kotlin Coroutines Application pages Attention If you want to u

KotlinRoom - What is Android Room? (Use in Kotlin) is a sample project I created for my article
KotlinRoom - What is Android Room? (Use in Kotlin) is a sample project I created for my article

KotlinRoom Android Room Nedir? (Kotlin'de kullanımı) adlı yazım için oluşturduğu

Owner
Saul Molinero
Software engineer
Saul Molinero
🚀 Sample Android Clean Architecture on Rorty App focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack.

Android Clean Architecture Android Clean Architecture in Rorty is a sample project that presents modern, approach to Android application development u

Mr.Sanchez 0 Dec 28, 2021
New version of my Android app that shows you popular movies using themoviedb.org API.

New version of my Android app that shows you popular movies using themoviedb.org API. Using Modern Android Develpment skills like Kotlin, Room, Retrofit, Hilt, coroutines, Flow and Jetpack Compose.

Gemma Lara Savill 0 Apr 21, 2022
Social media app but with new features like translate messages and posts , support video & images as posts , chat and notifications , etc...

social-media-app Social media app but with new features like translate messages and posts , support video & images as posts , chat and notifications ,

Kareem Aboelatta 15 Dec 13, 2022
Is a new version of code for my (Social media app) with Clean Architecture

Is a new version of code for my Social media app with Clean Architecture. I used most of Clean code tips with android, SOLID principles and design-patterns..

Kareem Aboelatta 20 Dec 13, 2022
A simple weather application focused on material UI and API data calls.

YAWA-WeatherApp YAWA is a simple single screen, single activity weather app with material UI. This repository is mainly focused on people who want to

Debayan Ghosh Dastider 2 Sep 1, 2022
A minimalist but powerful productivity timer designed to keep you focused and free of distractions.

Goodtime A minimalist but powerful productivity timer designed to keep you focused and free of distractions. Alternate between focused work sessions a

Adrian Cotfas 692 Dec 27, 2022
Parsing and re-packing Android boot.img/vbmeta.img, supporting Android 12(preview)

Android_boot_image_editor A tool for reverse engineering Android ROM images. Getting Started install required packages Mac: brew install lz4 xz dtc Li

null 615 Dec 30, 2022
Turtle Graphics 🐢 implementation for Android Platform with Code Editor, Preview Screen and packages

Turtle Graphics Download Turtle is an Android Application inspired from the original Turtle Graphics and Logo, Logo is an educational programming lang

Amr Hesham 15 Dec 30, 2022
An android application that displays public apis' for developers to use

An android application that displays public apis' for developers to use. This application implements adaptive layout by use of a sliding pane layout

Samora Machel 3 Oct 17, 2022
CameraX- - CameraXbasic aims to demonstrate how to use CameraX APIs written in Kotlin

CameraXbasic CameraXbasic aims to demonstrate how to use CameraX APIs written in

null 0 Apr 21, 2022