GithubHelp home page GithubHelp logo

florent37 / depth Goto Github PK

View Code? Open in Web Editor NEW
779.0 27.0 95.0 11.1 MB

Add some Depth to your fragments

License: MIT License

Java 100.00%
android fragment depth 3d material design animation transition translation scale

depth's Introduction

Depth

Add some Depth to your fragments

Android app on Google Play

gif gif

The blue comes from the activity background color

In your activity

final Depth depth = DepthProvider.getDepth(container);
depth
      .animate()
      .reduce(oldFragment)

      .exit(oldFragment)

      .enter(newFragment)
      .start();

In your fragment

private Depth depth;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    this.depth = DepthProvider.getDepth(container);
    return depth.setupFragment(10f, 10f, inflater.inflate(R.layout.fragment_1, container, false));
}

@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    depth.onFragmentReady(this);
}

Customize the animations

depth
     .animate()
     .reduce(oldFragment, new ReduceConfiguration()
             .setRotationZ(0f)
             .setRotationX(30f)
             .setDuration(1000)
     )

     .exit(oldFragment, new ExitConfiguration()
             .setFinalXPercent(0f)
             .setFinalYPercent(-1f)
     )
     .enter(newFragment, new EnterConfiguration()
             .setInitialXPercent(0f)
             .setInitialYPercent(1f)
             .setInitialRotationZ(0f)
             .setInitialRotationX(30f)
     )
     .start();

gif gif

Add multiples DepthLayouts

Don't use depth.setupFragment(

But manually create your own layout with DepthRelativeLayoutContainerand DepthRelativeLayout

<com.github.florent37.depth.DepthRelativeLayoutContainer 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">

    <com.github.florent37.depth.DepthRelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/status_bar"
        android:background="@android:color/white"
        app:depth_value="2dp"
        app:depth_zIndex="0">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:orientation="vertical">

            <View
                android:id="@+id/next"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_centerInParent="true"
                android:layout_marginBottom="10dp"
                android:background="@drawable/circle_blue" />

            <View
                android:id="@+id/open_reset"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_centerInParent="true"
                android:background="@drawable/circle_blue" />

        </LinearLayout>

    </com.github.florent37.depth.DepthRelativeLayout>

    <com.github.florent37.depth.DepthRelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/status_bar"
        android:background="@android:color/white"
        app:depth_value="2dp"
        app:depth_zIndex="1">

        <View
            android:id="@+id/status_bar"
            android:layout_width="match_parent"
            android:layout_height="25dp"
            android:background="@color/colorPrimaryDark" />

        <com.github.florent37.awesomebar.AwesomeBar
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/white"
            android:layout_below="@+id/status_bar"
            app:bar_animatedIcons="false"
            app:bar_primaryColor="@color/colorPrimary"
            app:bar_primaryDarkColor="@color/colorPrimaryDark" />

    </com.github.florent37.depth.DepthRelativeLayout>

</com.github.florent37.depth.DepthRelativeLayoutContainer>

gif

#Download

Buy Me a Coffee at ko-fi.com

In your module Download

compile 'com.github.florent37:depth:1.0.0'

Changelog

1.0.0

Initial import

Community

Forked from danielzeller/Depth-LIB-Android- Thanks for their amazing work !

Credits

Author: Florent Champigny

Fiches Plateau Moto : https://www.fiches-plateau-moto.fr/

Android app on Google Play Follow me on Google+ Follow me on Twitter Follow me on LinkedIn

License

Copyright 2017 florent37, Inc.

Licensed 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.

depth's People

Contributors

florent37 avatar vjubert 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

depth's Issues

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.