Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
alibardide5124 committed Apr 22, 2020
1 parent 1d40358 commit 430597f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
51 changes: 28 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ allprojects {
Add the dependency
```groovy
dependencies {
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.alibardide5124:CardViewPlus:1.0.5'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.alibardide5124:CardViewPlus:1.0.6'
}
```

Expand All @@ -48,30 +48,34 @@ You can use CardViewPlus just like a normal CardView

But it gives you some more attributes

| Properties | Type | Default |
| ------------------------------- | ------------------------------------------------------------ | --------------- |
| `app:normalElevation` | Dimension - Float (in code) | 2dp |
| `app:pressedElevation` | Dimension - Float (in code) | 5dp |
| `app:pressedColor` | Color | #e0e0e0 |
| `app:animationEnabled` | Boolean | true |
| `app:clickDelay` | Int (milli second) | 150 |
| Properties | Type | Default |
| ------------------------------- | ---------------------------------------------- | ----------------------- |
| `normalCardElevation` | Dimension - Float (in code) | 2dp |
| `pressedCardElevation` | Dimension - Float (in code) | 5dp |
| `cardPressedColor` | Color | `cardBackgroundColor` |
| `animationEnabled` | Boolean | true |
| `clickDelay` | Int (milli second) | 150 |

`app:normalElevation` : set CardViewPlus elevation in noraml state. Default: 2dp.
`normalCardElevation` : set CardViewPlus elevation in noraml state. Default: 2dp.

`app:maxElevation`: set CardViewPlus elevation in pressed state. Default: 5dp.
`pressedCardElevation`: set CardViewPlus elevation in pressed state. Default: 5dp.

If you want to disable elevation animation, set the same value for normalElevation and maxElevation.

`app:pressedColor`: set color for onTouch color animation. Default: #e0e0e0.
`cardPressedColor`: set color for onTouch color animation. Default: #e0e0e0.

If you want to disable color animation, set the same value for pressedColor and cardBackgroundColor.

`app:animationEnabled`: enable or Disable CardViewPlus shadow and color animations. Default: true.
`animationEnabled`: enable or Disable CardViewPlus shadow and color animations. Default: true.

`app:clickDelay`: set a delay for click after release the CardViewPlus. Default: 150ms.
`clickDelay`: set a delay for click after release the CardViewPlus. Default: 150ms.

Suggest setting click delay more than 150ms.

<br/>

Please use `normalCardElevation` and `pressedCardElevation` instead of `cardElevation` and `maxCardElevation`.

<br/>

XML
Expand All @@ -80,22 +84,23 @@ XML
<com.alibardide5124.cardviewplus.CardViewPlus
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:normalElevation="2dp"
app:maxElevation="5dp"
app:pressedColor="#ffe0e0e0"
app:normalCardElevation="2dp"
app:pressedCardElevation="5dp"
app:cardPressedColor="#ffe0e0e0"
app:animationEnabled="true"
app:clickDelay="150">


</com.alibardide5124.cardviewplus.CardViewPlus>
```

Kotlin
----
```kotlin
cardViewPlus.apply {
normalElevation = 4
pessedElevation = 10
pressedColor = Color.parseColor("#e0e0e0")
normalCardElevation = 4
pessedCardElevation = 10
cardPressedColor = Color.parseColor("#e0e0e0")
isAnimationEnabled = true
clickDelay = 150
}
Expand All @@ -105,9 +110,9 @@ Java
-----
```java
CardViewPlus cardViewPlus = findViewById(R.id.cardViewPlus);
cardViewPlus.setNormalElevation(4);
cardViewPlus.setPressedElevation(10);
cardViewPlus.setPressedColor(Color.parseColor("#e0e0e0"));
cardViewPlus.setNormalCardElevation(4);
cardViewPlus.setPressedCardElevation(10);
cardViewPlus.setCardPressedColor(Color.parseColor("#e0e0e0"));
cardViewPlus.setAnimationEnabled(true);
cardViewPlus.setClickDelay(150);
```
Expand Down
Binary file modified readme.files/app-debug.apk
Binary file not shown.

0 comments on commit 430597f

Please sign in to comment.