-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix version publish issue * Add boolean extension (#15) * Add toast extension for fragment and refactor extension function naming (#16)
- Loading branch information
Showing
6 changed files
with
25 additions
and
4 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,2 @@ | ||
jdk: | ||
- openjdk17 |
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
9 changes: 9 additions & 0 deletions
9
klobalx/src/main/java/com/mobillium/klobalx/nativeext/BooleanExt.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 |
---|---|---|
@@ -1,4 +1,13 @@ | ||
package com.mobillium.klobalx.nativeext | ||
|
||
/** | ||
* If the incoming value is null, we get a false value | ||
* */ | ||
val Boolean?.orFalse: Boolean | ||
get() = this ?: false | ||
|
||
/** | ||
* If the incoming value is null, we get a true value | ||
* */ | ||
val Boolean?.orTrue: Boolean | ||
get() = this ?: true |
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
11 changes: 11 additions & 0 deletions
11
klobalx/src/main/java/com/mobillium/klobalx/nativeext/FragmentExt.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 |
---|---|---|
@@ -1,10 +1,21 @@ | ||
package com.mobillium.klobalx.nativeext | ||
|
||
import android.widget.Toast | ||
import androidx.fragment.app.Fragment | ||
import com.google.android.material.snackbar.Snackbar | ||
|
||
fun Fragment.showSnackBar(snackBarText: String, timeLength: Int = Snackbar.LENGTH_SHORT) { | ||
requireActivity().let { | ||
Snackbar.make(it.findViewById(android.R.id.content), snackBarText, timeLength).show() | ||
} | ||
} | ||
|
||
/** | ||
* Displays a toast message on the screen. | ||
* | ||
* @param message The text message to be displayed in the toast. | ||
* @param duration Optional duration of the toast. | ||
*/ | ||
fun Fragment.showToast(message: String, duration: Int = Toast.LENGTH_SHORT) { | ||
Toast.makeText(requireContext(), message, duration).show() | ||
} |
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