-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
93 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [mikepenz] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
library/src/main/java/com/mikepenz/materialdrawer/util/Extensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.mikepenz.materialdrawer.util | ||
|
||
/** | ||
* Does an action if it is not null | ||
*/ | ||
public inline infix fun <T> T?.ifNotNull(block: (T) -> Unit): Unit? { | ||
return if (this != null) { | ||
block(this) | ||
} else { | ||
null | ||
} | ||
} | ||
|
||
/** | ||
* Does an action if it is null | ||
*/ | ||
public inline infix fun <T> T?.otherwise(block: () -> Unit): Unit = ifNull(block) | ||
|
||
/** | ||
* Does an action if it is null | ||
*/ | ||
public inline infix fun <T> T?.ifNull(block: () -> Unit): Unit { | ||
if (this == null) { | ||
block() | ||
} | ||
} |