forked from coil-kt/coil
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move
coil.api
functions to coil
and move coil.extension
functio…
…ns to respective packages. (coil-kt#453) * Move extensions. * Add migration aids. * Add deprecated placeholders. * Update API. * Clean up. * Update API. * Re-add deprecated APIs. * Remove return types.
- Loading branch information
1 parent
6e8179f
commit a80c8da
Showing
22 changed files
with
297 additions
and
70 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
50 changes: 50 additions & 0 deletions
50
coil-base/src/main/java/coil/collection/SparseIntArraySetExt.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,50 @@ | ||
@file:JvmName("SparseIntArraySetKt") | ||
@file:Suppress("NOTHING_TO_INLINE", "unused") | ||
|
||
package coil.collection | ||
|
||
/** Returns the number of elements that this set currently stores. */ | ||
inline fun SparseIntArraySet.count(): Int = size | ||
|
||
/** Adds the element to the set. */ | ||
inline operator fun SparseIntArraySet.plusAssign(element: Int) { | ||
add(element) | ||
} | ||
|
||
/** Removes the element from the set. */ | ||
inline operator fun SparseIntArraySet.minusAssign(element: Int) { | ||
remove(element) | ||
} | ||
|
||
/** Return true when the set contains no elements. */ | ||
inline fun SparseIntArraySet.isEmpty(): Boolean = size == 0 | ||
|
||
/** Return true when the set contains elements. */ | ||
inline fun SparseIntArraySet.isNotEmpty(): Boolean = size != 0 | ||
|
||
/** Create and return a new set that contains the elements of [this] plus the elements of [other]. */ | ||
operator fun SparseIntArraySet.plus(other: SparseIntArraySet): SparseIntArraySet { | ||
val new = SparseIntArraySet(size + other.size) | ||
new.addAll(this) | ||
new.addAll(other) | ||
return new | ||
} | ||
|
||
/** Add all elements from [other] to [this]. */ | ||
fun SparseIntArraySet.addAll(other: SparseIntArraySet) { | ||
other.forEach { add(it) } | ||
} | ||
|
||
/** Performs the given [action] for each element in the set. */ | ||
inline fun SparseIntArraySet.forEach(action: (element: Int) -> Unit) { | ||
for (index in 0 until size) { | ||
action(elementAt(index)) | ||
} | ||
} | ||
|
||
/** Return an iterator over the set's values. */ | ||
operator fun SparseIntArraySet.iterator(): IntIterator = object : IntIterator() { | ||
var index = 0 | ||
override fun hasNext() = index < size | ||
override fun nextInt() = elementAt(index++) | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@file:JvmName("ParametersKt") | ||
@file:Suppress("NOTHING_TO_INLINE", "unused") | ||
|
||
package coil.request | ||
|
||
/** Returns the number of parameters in this object. */ | ||
inline fun Parameters.count(): Int = size | ||
|
||
/** Return true when the set contains elements. */ | ||
inline fun Parameters.isNotEmpty(): Boolean = !isEmpty() | ||
|
||
/** Returns the value associated with [key] or null if [key] has no mapping. */ | ||
inline operator fun Parameters.get(key: String): Any? = value(key) |
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
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,14 @@ | ||
@file:Suppress("unused") | ||
@file:JvmName("Gifs") | ||
|
||
package coil.extension | ||
|
||
import coil.request.ImageRequest | ||
import coil.request.Parameters | ||
import coil.request.repeatCount as _repeatCount | ||
|
||
@Deprecated("Replace `coil.extension.repeatCount` with `coil.request.repeatCount`.") | ||
fun ImageRequest.Builder.repeatCount(repeatCount: Int) = _repeatCount(repeatCount) | ||
|
||
@Deprecated("Replace `coil.extension.repeatCount` with `coil.request.repeatCount`.") | ||
fun Parameters.repeatCount() = _repeatCount() |
4 changes: 1 addition & 3 deletions
4
...-gif/src/main/java/coil/extension/Gifs.kt → coil-gif/src/main/java/coil/request/Gifs.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
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
4 changes: 1 addition & 3 deletions
4
...eton/src/main/java/coil/api/ImageViews.kt → ...ingleton/src/main/java/coil/ImageViews.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
Oops, something went wrong.