Skip to content

Commit

Permalink
Master update (#17)
Browse files Browse the repository at this point in the history
* Fix version publish issue

* Add boolean extension (#15)

* Add toast extension for fragment and refactor extension function naming (#16)
  • Loading branch information
akndmr authored Sep 12, 2023
1 parent c58e308 commit 8ad3d08
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk17
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ inline val Activity.className: String
* @param message The text message to be displayed in the toast.
* @param duration Optional duration of the toast.
*/
fun Activity.toast(message: String, duration: Int = Toast.LENGTH_SHORT) {
fun Activity.showToast(message: String, duration: Int = Toast.LENGTH_SHORT) {
Toast.makeText(this, message, duration).show()
}

Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.core.content.ContextCompat
import android.content.ClipData
import android.content.ClipDescription
import android.content.ClipboardManager
import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import android.os.PersistableBundle
Expand Down
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()
}
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ pluginManagement {
google()
mavenCentral()
gradlePluginPortal()
mavenCentral { url "https://jitpack.io" }
mavenLocal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
mavenCentral { url "https://jitpack.io" }
mavenLocal()
}
}
rootProject.name = "KlobalX"
Expand Down

0 comments on commit 8ad3d08

Please sign in to comment.