项目作者: florent37

项目描述 :
Add some Depth to your fragments
高级语言: Java
项目地址: git://github.com/florent37/Depth.git
创建时间: 2017-03-02T15:27:00Z
项目社区:https://github.com/florent37/Depth

开源协议:MIT License

下载


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

  1. final Depth depth = DepthProvider.getDepth(container);
  2. depth
  3. .animate()
  4. .reduce(oldFragment)
  5. .exit(oldFragment)
  6. .enter(newFragment)
  7. .start();

In your fragment

  1. private Depth depth;
  2. @Override
  3. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  4. this.depth = DepthProvider.getDepth(container);
  5. return depth.setupFragment(10f, 10f, inflater.inflate(R.layout.fragment_1, container, false));
  6. }
  7. @Override
  8. public void onViewCreated(final View view, Bundle savedInstanceState) {
  9. super.onViewCreated(view, savedInstanceState);
  10. depth.onFragmentReady(this);
  11. }

Customize the animations

  1. depth
  2. .animate()
  3. .reduce(oldFragment, new ReduceConfiguration()
  4. .setRotationZ(0f)
  5. .setRotationX(30f)
  6. .setDuration(1000)
  7. )
  8. .exit(oldFragment, new ExitConfiguration()
  9. .setFinalXPercent(0f)
  10. .setFinalYPercent(-1f)
  11. )
  12. .enter(newFragment, new EnterConfiguration()
  13. .setInitialXPercent(0f)
  14. .setInitialYPercent(1f)
  15. .setInitialRotationZ(0f)
  16. .setInitialRotationX(30f)
  17. )
  18. .start();

gif
gif

Add multiples DepthLayouts

Don’t use depth.setupFragment(

But manually create your own layout with DepthRelativeLayoutContainerand DepthRelativeLayout

  1. <com.github.florent37.depth.DepthRelativeLayoutContainer xmlns:android="http://schemas.android.com/apk/res/android"
  2. xmlns:app="http://schemas.android.com/apk/res-auto"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent">
  5. <com.github.florent37.depth.DepthRelativeLayout
  6. android:layout_width="match_parent"
  7. android:layout_height="match_parent"
  8. android:layout_below="@+id/status_bar"
  9. android:background="@android:color/white"
  10. app:depth_value="2dp"
  11. app:depth_zIndex="0">
  12. <LinearLayout
  13. android:layout_width="wrap_content"
  14. android:layout_height="wrap_content"
  15. android:layout_centerHorizontal="true"
  16. android:layout_centerVertical="true"
  17. android:orientation="vertical">
  18. <View
  19. android:id="@+id/next"
  20. android:layout_width="40dp"
  21. android:layout_height="40dp"
  22. android:layout_centerInParent="true"
  23. android:layout_marginBottom="10dp"
  24. android:background="@drawable/circle_blue" ></View>
  25. <View
  26. android:id="@+id/open_reset"
  27. android:layout_width="40dp"
  28. android:layout_height="40dp"
  29. android:layout_centerInParent="true"
  30. android:background="@drawable/circle_blue" ></View>
  31. </LinearLayout>
  32. </com.github.florent37.depth.DepthRelativeLayout>
  33. <com.github.florent37.depth.DepthRelativeLayout
  34. android:layout_width="match_parent"
  35. android:layout_height="wrap_content"
  36. android:layout_below="@+id/status_bar"
  37. android:background="@android:color/white"
  38. app:depth_value="2dp"
  39. app:depth_zIndex="1">
  40. <View
  41. android:id="@+id/status_bar"
  42. android:layout_width="match_parent"
  43. android:layout_height="25dp"
  44. android:background="@color/colorPrimaryDark" ></View>
  45. <com.github.florent37.awesomebar.AwesomeBar
  46. android:layout_width="match_parent"
  47. android:layout_height="wrap_content"
  48. android:background="@android:color/white"
  49. android:layout_below="@+id/status_bar"
  50. app:bar_animatedIcons="false"
  51. app:bar_primaryColor="@color/colorPrimary"
  52. app:bar_primaryDarkColor="@color/colorPrimaryDark" ></com.github.florent37.awesomebar.AwesomeBar>
  53. </com.github.florent37.depth.DepthRelativeLayout>
  54. </com.github.florent37.depth.DepthRelativeLayoutContainer>

gif

Download

Buy Me a Coffee at ko-fi.com

In your module Download

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

  1. Copyright 2017 florent37, Inc.
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.