Android Shadow Layout

Related tags

Layout shadow-layout
Overview

🔺 Before using this library, read information below 🔺

This library is not more supported. 
If you want to add new feature or fix a bug, grab source code and do it. If you think your
fix or feature would be useful to other developers, I can add link of your repository to
this README file. Use following e-mail to contact me: [email protected]
Thank you for using my libraries.

Description Maven Central

Android Shadow Layout - because CardView is not enough. [Why?] (https://github.com/dmytrodanylyk/shadow-layout/wiki#why-this-library-was-created)

Wiki

TODO

  • Lift on touch
  • Preview shadow position

Integration

The lib is available on Maven Central, you can find it with Gradle, please

dependencies {
    compile 'com.github.dmytrodanylyk.shadow-layout:library:1.0.3'
}

Contributions

If you want to contribute to this library make sure you send pull request to dev branch.

Used By

(In Progress)

License

The MIT License (MIT)

Copyright (c) 2015 Danylyk Dmytro

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Analytics

Comments
  • Recreating shadow when child gets smaller.

    Recreating shadow when child gets smaller.

    Hi, in current implementation of ShadowLayout it looks like it suppose to recreate its shadow background on every size change:

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        if(w > 0 && h > 0) {
            setBackgroundCompat(w, h);
        }
    }
    

    Lets say we have a TextView with string "Long label" inside the ShadowLayout, both measured as wrap_content. After child is measured ShadowLayout will generate shadow bitmap matching the size of text.

    When we change the text to "Very long label" measuring phase is triggered again so the onSizeChanged of ShadowLayout will be triggered. Bigger shadow background will be created for wider label and everything is fine. very_long_label

    However when we would change text to "Label", TextView will be smaller, but overall width of ShadowLayout is a maximum of "largest child's width" and "background width". Since there is already old background set (rendered for wider child) - ShadowLayout will keep the original size and won't recreate the shadow background for smaller child. label

    We need to override following methods to let ShadowLayout ignore its current background when measuring self:

    @Override
    protected int getSuggestedMinimumWidth() {
        return 0;
    }
    
    @Override
    protected int getSuggestedMinimumHeight() {
        return 0;
    }
    

    Here is the original implementation from View class:

    protected int getSuggestedMinimumWidth() {
        return (mBackground == null) ? mMinWidth : max(mMinWidth, mBackground.getMinimumWidth());
    }
    
    protected int getSuggestedMinimumHeight() {
        return (mBackground == null) ? mMinHeight : max(mMinHeight, mBackground.getMinimumHeight());
    }
    
    opened by MaciejCiemiega 5
  • Fixed constructor using xml resource defined style

    Fixed constructor using xml resource defined style

    It was not possible to create a new ShadowLayout programmatically passwing parameters built from an xml style. The constructor initView(Context context, AttributeSet attrs, int defStyledRes)

    was doing the same as

    initView(Context context, AttributeSet attrs)

    opened by Shyri 2
  • Setters and Getters for all parameters & Round attribute

    Setters and Getters for all parameters & Round attribute

    This pull request consists of:

    1. Setters and getters for all parameters (this also fixes issue #14)
    2. The ability to automatically create round shadow (instead of setting cornerRadius to the child's width/height). Now it can be easily set with sl_round attribute. It's especially usable for Views that have their dimensions set in runtime.
    3. Improved round shadow drawing (now it's possible to draw ellipse shadow).

    Additionally I corrected the improperly named xml file consisting of custom attributes.

    opened by blipinsk 1
  • Fixed constructor using style from xml definned style

    Fixed constructor using style from xml definned style

    @dmytrodanylyk I created a new pull_request of these changes but for de dev branch, is this what you meant?

    Thanks for this fantastic library btw.

    It was not possible to create a new ShadowLayout programmatically passwing parameters built from an xml style. The constructor initView(Context context, AttributeSet attrs, int defStyledRes)

    was doing the same as

    initView(Context context, AttributeSet attrs)

    opened by Shyri 1
  • Build tools update, added support annotations, missing constructor and NullPointerException fix.

    Build tools update, added support annotations, missing constructor and NullPointerException fix.

    Some notes:

    Updated build tools and target API versions.

    Added NonNull and Nullable annotations. Fixed NullPointerException when calling constructor without attributes.

    Added missing Lollipop constructor

    setBackground() is supported by 16+ while you used setBackgroundDrawable on <= 16 thus calling deprecated API on API level 16. So I inverted to >= 16 and swapped methods. Also added SuppressLint("NewApi") to avoid lint error.

    According to source code obtainStyledAttributes can't return null, so the method is annotated and NonNull and null check removed. Not sure why you need that proxy method anyway but I left it.

    opened by Doctoror 0
  • Some changes mainly include colorful shadows and enhanced preview experience

    Some changes mainly include colorful shadows and enhanced preview experience

    I just make two small change to this library:

    1. Bitmap.Config is ALPHA_8 before, this will make shadow color invalid, so I change it to ARGB_4444, and allow use opaque color draw shadow.
    2. Cause shadow layer can not preview in xml, so I directly set the background shadow color in edit mode.
    opened by RubiTree 1
Owner
Dmytro Danylyk
Hello. I am Android/Kotlin Google Developer Expert. I live in Sydney - a quaint and beautiful city. I am passionate about android and flat design.
Dmytro Danylyk
Responsive Layout Gird Configuration using Compose. An adaptive layout

ResponsiveGrid Responsive Grid is most followed layout system by the designer as it adapts to screen size and orientation, ensuring consistency across

null 4 Apr 12, 2022
An Android Layout which has a same function like https://github.com/romaonthego/RESideMenu

ResideLayout An Android Layout which has a same function like https://github.com/romaonthego/RESideMenu. Can be used on Android 1.6(I haven't try it.)

Yang Hui 392 Oct 12, 2022
A very simple arc layout library for Android

ArcLayout A very simple arc layout library for Android. Try out the sample application on the Play Store. Usage (For a working implementation of this

ogaclejapan 1.4k Dec 26, 2022
Android layout that simulates physics using JBox2D

PhysicsLayout Android layout that simulates physics using JBox2D. Simply add views, enable physics, and watch them fall! See it in action with the sam

John Carlson 689 Dec 29, 2022
An Android demo of a foldable layout implementation. Engineered by Vincent Brison.

Foldable Layout This code is a showcase of a foldable animation I created for Worldline. The code is fully written with java APIs from the Android SDK

Worldline 599 Dec 23, 2022
A 3D Layout for Android,When you use it warp other view,it can became a 3D view,一秒让你的view拥有3D效果!

ThreeDLayout A 3D Layout,When you use it warp other view,it can became a 3D view 中文文档 preview USAGE 1.compile library allprojects { repositories {

androidwing 490 Oct 27, 2022
It's an Android library that allows you to use Layout as RadioButton or CheckBox.

Android - CompoundLayout It's an Android library that allows you to use Layout as RadioButton or CheckBox. The librarie is Android 14+ compatible. Gra

null 483 Nov 25, 2022
A pull to refresh layout for android, the RecyclerRefreshLayout is based on the SwipeRefreshLayout. support all the views, highly customizable, code simplicity, etc. really a practical RefreshLayout!

RecyclerRefreshLayout English | 中文版 RecyclerRefreshLayout based on the {@link android.support.v4.widget.SwipeRefreshLayout} The RecyclerRefreshLayout

dinus_developer 1.7k Nov 10, 2022
Easy, flexible and powerful Swipe Layout for Android

SwipeRevealLayout A layout that you can swipe/slide to show another layout. Demo Overview Drag mode Drag mode normal: Drag mode same_level: Features F

Chau Thai 1.5k Jan 4, 2023
[UNMAINTAINED]: AndroidMosaicLayout is android layout to display group of views as grid consists of different asymmetric patterns (90 different patterns).

AndroidMosaicLayout AndroidMosaicLayout is android layout to display group of views in more that 90 different patterns. What is AndroidMosaicLayout? I

Adham Enaya 474 Nov 12, 2022
Scalable Layout For Android

ScalableLayout for Android. Class: com.ssomai.android.scalablelayout.ScalableLayout 한글버전 README.md: https://github.com/ssomai/ScalableLayout/blob/mast

Youngmann Kim 273 Nov 21, 2022
Android implementation of FlowLayout. Layout arranges its children in multiple rows depending on their width.

FlowLayout FlowLayout is an opensource Android library that alows developers to easily integrate flow layout into their app. FlowLayout is an layout t

Blaž Šolar 754 Dec 15, 2022
Circular layout for android

CircleLayout Circular layout for android. Installlation Add CircleLayout as Android Library to your project. How to add project as Android Library Usa

Dmitry Zaytsev 244 Nov 18, 2022
An Android layout for arranging children along a circle

CircleLayout An Android layout for arranging children along a circle You can customize the following options: cl_centerView: Set a specific view ID to

Francois Campbell 374 Nov 18, 2022
Android - A layout that arranges its children in relation to a background image

ImageLayout A layout that arranges its children in relation to a background image. The layout of each child is specified in image coordinates (pixels)

Manuel Peinado Gallego 419 Nov 14, 2022
null 2.4k Dec 30, 2022
An android layout to re-arrange child views via dragging

Android Rearrangeable Layout An android layout to re-arrange child views via dragging Screencast Demo Layout Usage All the child views are draggable o

Raja Sharan Mamidala 273 Nov 25, 2022
BlurView - A very fast and dynamic blur layout for Android

BlurView - A very fast and dynamic blur layout for Android

null 16 Jul 11, 2022