Giter Club home page Giter Club logo

insetter's Introduction

Insetter

Maven Central CircleCI

Insetter is a library to help apps handle WindowInsets more easily. The library contains implementations of many of the concepts described in our "Listeners to Layouts" blog post.

There are a number of libraries available:

insetter

javadoc.io

The base library which is written in Java.

insetter-ktx

javadoc.io

A Kotlin extension library, providing Kotlin-specific functionality. This library contains extension functions allowing easy access to the helper functions from the base library.

bottomNav.doOnApplyWindowInsets { view, insets, initialPadding, initialMargins ->
    // padding contains the original padding values after inflation
    view.updatePadding(
        bottom = initialPadding.bottom + insets.systemWindowInsetBottom
    )
}

A Data Binding extension library, providing Data Binding specific functionality. This primarily contains binding adapters, which allow access to the helper functions from your layouts:

<BottomNavigationView
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:paddingVertical="24dp"
    app:paddingBottomSystemWindowInsets="@{true}"
    app:paddingLeftSystemWindowInsets="@{true}" />

๐Ÿ“– You can read more information here.

An extension library which provides versions of commonly used ViewGroups with enhanced inset handling. Currently this library is focusing on building upon ConstraintLayout.

A example of a widget is InsetterConstraintLayout, which enables new attributes to define inset behavior on child views. The behavior enabled through InsetterConstraintLayout is similar to that provided by the insetter-dbx library, but without the requirement of using data-binding.

<dev.chrisbanes.insetter.widgets.constraintlayout.InsetterConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:paddingSystemWindowInsets="left|top|right|bottom"
        android:src="@drawable/rectangle" />

</dev.chrisbanes.insetter.widgets.constraintlayout.InsetterConstraintLayout>

๐Ÿ“– You can read more information here.

โš ๏ธ Attention ๐Ÿšง

The library is being written to production quality, but it is not adhering to semantic versioning, mean we may change the API if needed, though we'll try not to. We're using this repository to allow quick and easy prototyping. The contents of this library may eventually be moved into Android Jetpack at a later date.

Download

repositories {
    mavenCentral()
}

dependencies {
    // The base library. If you're using either the dbx and/or ktx libraries, you don't need this
    implementation "dev.chrisbanes:insetter:0.2.0"

    // If you're using data-binding use this
    implementation "dev.chrisbanes:insetter-dbx:0.2.0"

    // If you're using Kotlin use this too
    implementation "dev.chrisbanes:insetter-ktx:0.2.0"
  
    // If you would like to use the enhanced widget set, use this
    implementation "dev.chrisbanes:insetter-widgets:0.2.0"
}

Snapshots of the development version are available in Sonatype's snapshots repository. These are updated on every commit.

Contributions

Please contribute! We will gladly review any pull requests. Make sure to read the Contributing page first though.

License

Copyright 2019 Google LLC.

Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for
additional information regarding copyright ownership. The ASF licenses this
file to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.

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.