Giter VIP home page Giter VIP logo

rajagrawal1 / android-material-design-in-practice Goto Github PK

View Code? Open in Web Editor NEW
69.0 5.0 8.0 3.6 MB

A project to demonstrate the latest material design principles with simple examples. It has additional examples on how to easily scale texts on different screen sizes without extra effort.

License: Apache License 2.0

Kotlin 100.00%
android material-design material-ui kotlin-android kotlin font-scaling textview

android-material-design-in-practice's Introduction

Material Design in Practice.

Purpose

  • Intended to be simple and practical - A project to demonstrate the usage of color palette, typography and shapes as per the material design guidelines. Also shares a method to properly scale text sizes.

Configuration

  • Uses both app wide and view level theming.
  • Min SDK support is API 16.

Usage

  • themes.xml - The app automatically looks into this file during runtime to skin itself - this is an important step to setup day/ night mode.

  • styles.xml - All view specific styles are neatly declared in this file.

  • Scaling typography - This section contains 4 sizing variants for the text - sp, ssp, dp, sdp.

    • "ssp and sdp" are good alternatives over "sp and dp" if you do not wish to manage varying dimens.xml. The intuit library has a bundle of pre-defined dimens.xml that handles it for you. Note that while developing for tablets, this may not be the best idea.
    • The main difference you can see is that "sp and ssp" respond when user changes the font size from system settings. However, "dp and sdp" do not. Run the MDIP app, switch to typography tab and test it out yourself.
  • Easy color management - Use color palette generator tool for preparing a new color scheme, export to the Android format (color.xml) and use the color variables to replace the existing set in the project.

  • For applying app-wide default colors, you will be largely dealing with:

    * colorPrimary
    * colorPrimaryDark/ colorPrimaryVariant
    * colorSecondary
    * colorSecondaryVariant
    * android:textColorPrimary
    * android:textColorSecondary
    * android:colorBackground
    
  • If you wish to try different new schemes - simply replace the colors under "Base Color Scheme" and above "Other colors" in color.xml. You can leave 'Other colors' as it is, since they can be suitable for most cases.

  • Day/ Night mode - The app auto-switches to appropriate mode depending on system settings. You can override this by clicking the top right icon on toolbar. The widgets depend on ?colorName to look proper on day/ night mode. For instance, widget styles have colors defined with ?colorPrimary instead of a hard-coded @color/primaryColor. This means you're instructing the app to pick the defined color for ?colorPrimary in themes.xml (of day or night version) at runtime. And each of these files will contain different colors to suit day/ night mode.

  • App-wide widget theming - Take advantage of a new feature in the latest material design library that allows app-wide application of common styling for views from a single place - Refer to the base theme for an example.

Concept

Concept applied:


(Slightly modified and sourced from: https://speakerdeck.com/anitas3791/styles-themes-material-theming-oh-my/em)

For reference only. The demo app in the project is different.

App screenshots - On Pixel 2, Android 10 (API 29), Day mode.

Default font scaling Typogtraphy with default font scaling Increased font scaling Typography with increased font scaling Material Buttons Material Text Input Layouts Material Cards Material Bottom Sheet Miscellaneous widgets Search View

Caveats

What's coming soon

  • Material motion.

Try the demo app

Visit the releases section to download the latest iterations of the app.

References

android-material-design-in-practice's People

Contributors

rajagrawal1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

android-material-design-in-practice's Issues

Styling for SearchView

Hi, awesome example btw, but I was trying to theme the search view but couldn't get it working, can you help me with this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.