|
1 | | -# OmegaLayouts |
| 1 | +[](https://jitpack.io/#Omega-R/OmegaLayouts) |
| 2 | +[](https://opensource.org/licenses/MIT) |
| 3 | + |
| 4 | +# OmegaLayouts |
| 5 | +Several different layout to make your life easier. |
| 6 | + |
| 7 | +# Installation |
| 8 | +To get a Git project into your build: |
| 9 | + |
| 10 | +**Step 1.** Add the JitPack repository to your build file |
| 11 | +``` |
| 12 | +allprojects { |
| 13 | + repositories { |
| 14 | + ... |
| 15 | + maven { url 'https://jitpack.io' } |
| 16 | + } |
| 17 | +} |
| 18 | +``` |
| 19 | +**Step 2.** Add the dependency |
| 20 | +``` |
| 21 | +dependencies { |
| 22 | + implementation 'com.github.Omega-R:R:OmegaLayouts:0.0.1' |
| 23 | +} |
| 24 | +``` |
| 25 | + |
| 26 | +# Usage |
| 27 | + |
| 28 | +## Percents |
| 29 | +Layouts which support percentage based dimensions and margins. You can specify dimension or a margin of child by using attributes with "Percent" suffix. |
| 30 | + |
| 31 | +Supported classes: |
| 32 | +* com.omega_r.libs.layouts.percent.PercentLinearLayout |
| 33 | +* com.omega_r.libs.layouts.percent.PercentRelativeLayout |
| 34 | +* com.omega_r.libs.layouts.percent.PercentFrameLayout |
| 35 | + |
| 36 | +Follow this example: |
| 37 | +``` |
| 38 | +<com.omega_r.libs.layouts.percent.PercentFrameLayout |
| 39 | + android:layout_width="match_parent" |
| 40 | + android:layout_height="match_parent"> |
| 41 | + <ImageView |
| 42 | + app:layout_widthPercent="50%" |
| 43 | + app:layout_heightPercent="50%" |
| 44 | + app:layout_marginTopPercent="25%" |
| 45 | + app:layout_marginLeftPercent="25%"/> |
| 46 | + </com.omega_r.libs.layouts.percent.PercentFrameLayout> |
| 47 | +``` |
| 48 | + |
| 49 | +## Shadow |
| 50 | + |
| 51 | +Shadow layouts draw shadow inside your layout. |
| 52 | + |
| 53 | +Supported classes: |
| 54 | +* com.omega_r.libs.layouts.shadow.ShadowFrameLayout |
| 55 | +* com.omega_r.libs.layouts.shadow.ShadowLinearLayout |
| 56 | +* com.omega_r.libs.layouts.shadow.ShadowRelativeLayout |
| 57 | + |
| 58 | + |
| 59 | +<p align="left"> |
| 60 | + <img src="/images/shadow.png?raw=true" width="300" height="533" /> |
| 61 | +</p> |
| 62 | + |
| 63 | +``` |
| 64 | + <com.omega_r.libs.layouts.shadow.ShadowFrameLayout |
| 65 | + android:layout_width="match_parent" |
| 66 | + android:layout_height="wrap_content" |
| 67 | + android:layout_marginTop="10dp" |
| 68 | + android:background="@color/pale_grey_two" |
| 69 | + app:shadowTopHeight="10dp" |
| 70 | + app:shadowLeftHeight="10dp" |
| 71 | + app:shadowRightHeight="10dp" |
| 72 | + app:shadowBottomHeight="10dp" |
| 73 | + |
| 74 | + // If you want to use your own color use this parameters. |
| 75 | + app:startColor="@color/colorAccent" |
| 76 | + app:centerColor="@color/colorPrimary" |
| 77 | + app:endColor="@color/colorAccent"> |
| 78 | +``` |
| 79 | + |
| 80 | +## AutoOrientationLinearLayout |
| 81 | + |
| 82 | +AutoOrientationLinearLayout it's subclass of LinearLayoutCompat that change orientation automatically if you don't have necessary width for all views on small screens. |
| 83 | +Follow this example: |
| 84 | + |
| 85 | +<img src="/images/auto_orientation_vertical.png?raw=true" width="300" height="533" /> <img src="/images/auto_orientation_horizontal.png?raw=true" width="533" height="300" align="top"/> |
| 86 | + |
| 87 | +``` |
| 88 | + <com.omega_r.libs.layouts.AutoOrientationLinearLayout |
| 89 | + android:layout_width="wrap_content" |
| 90 | + android:layout_height="wrap_content"> |
| 91 | +
|
| 92 | + <TextView |
| 93 | + android:layout_width="wrap_content" |
| 94 | + android:layout_height="wrap_content" |
| 95 | + android:background="@color/colorPrimary" |
| 96 | + android:padding="10dp" |
| 97 | + android:text="This is first text" |
| 98 | + android:textColor="@android:color/white" |
| 99 | + android:textSize="24sp" /> |
| 100 | +
|
| 101 | + <TextView |
| 102 | + android:layout_width="wrap_content" |
| 103 | + android:layout_height="wrap_content" |
| 104 | + android:background="@color/colorAccent" |
| 105 | + android:padding="10dp" |
| 106 | + android:text="This is second text" |
| 107 | + android:textColor="@android:color/white" |
| 108 | + android:textSize="24sp" /> |
| 109 | +
|
| 110 | + </com.omega_r.libs.layouts.AutoOrientationLinearLayout> |
| 111 | +``` |
| 112 | + |
| 113 | + |
| 114 | +# License |
| 115 | +``` |
| 116 | +The MIT License |
| 117 | +
|
| 118 | +Copyright 2017 Omega-R |
| 119 | +
|
| 120 | +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and |
| 121 | +associated documentation files (the "Software"), to deal in the Software without restriction, |
| 122 | +including without limitation the rights to use, copy, modify, merge, publish, distribute, |
| 123 | +sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
| 124 | +furnished to do so, subject to the following conditions: |
| 125 | +
|
| 126 | +The above copyright notice and this permission notice shall be included in all copies or substantial |
| 127 | +portions of the Software. |
| 128 | +
|
| 129 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
| 130 | +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 131 | +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 132 | +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 133 | +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 134 | +``` |
0 commit comments