Skip to content

Commit

Permalink
releaseModuleToGithub:1.9.38
Browse files Browse the repository at this point in the history
  • Loading branch information
renetik committed Jul 23, 2022
1 parent 6ac60d0 commit e1fe3f3
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ <h2 class="">Functions</h2>
</span></span></div>
<div>
<div class="title">
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-depenent-content" data-active="" data-togglable=":renetik-android-ui:dokkaHtmlPartial/release"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="https://developer.android.com/reference/kotlin/android/widget/CompoundButton.html">CompoundButton</a><span class="token punctuation">.</span><a href="set-off.html"><span class="token function">setOff</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div></div></div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-depenent-content" data-active="" data-togglable=":renetik-android-ui:dokkaHtmlPartial/release"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="https://developer.android.com/reference/kotlin/android/widget/CompoundButton.html">CompoundButton</a><span class="token punctuation">.</span><a href="set-off.html"><span class="token function">setOff</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://developer.android.com/reference/kotlin/android/widget/CompoundButton.html">CompoundButton</a><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div></div></div>
</div>
</div>
</div>
Expand All @@ -763,7 +763,7 @@ <h2 class="">Functions</h2>
</span></span></div>
<div>
<div class="title">
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-depenent-content" data-active="" data-togglable=":renetik-android-ui:dokkaHtmlPartial/release"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="https://developer.android.com/reference/kotlin/android/widget/CompoundButton.html">CompoundButton</a><span class="token punctuation">.</span><a href="set-on.html"><span class="token function">setOn</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div></div></div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-depenent-content" data-active="" data-togglable=":renetik-android-ui:dokkaHtmlPartial/release"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="https://developer.android.com/reference/kotlin/android/widget/CompoundButton.html">CompoundButton</a><span class="token punctuation">.</span><a href="set-on.html"><span class="token function">setOn</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://developer.android.com/reference/kotlin/android/widget/CompoundButton.html">CompoundButton</a><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div></div></div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<div class="cover ">
<h1 class="cover"><span>set</span><wbr><span><span>Off</span></span></h1>
</div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-depenent-content" data-active="" data-togglable=":renetik-android-ui:dokkaHtmlPartial/release"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="https://developer.android.com/reference/kotlin/android/widget/CompoundButton.html">CompoundButton</a><span class="token punctuation">.</span><a href="set-off.html"><span class="token function">setOff</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div></div></div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-depenent-content" data-active="" data-togglable=":renetik-android-ui:dokkaHtmlPartial/release"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="https://developer.android.com/reference/kotlin/android/widget/CompoundButton.html">CompoundButton</a><span class="token punctuation">.</span><a href="set-off.html"><span class="token function">setOff</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://developer.android.com/reference/kotlin/android/widget/CompoundButton.html">CompoundButton</a><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div></div></div>
</div>
<div class="footer">
<span class="go-to-top-icon"><a href="#content" id="go-to-top-link"></a></span><span>© 2022 Copyright</span><span class="pull-right"><span>Generated by </span><a href="https://github.com/Kotlin/dokka"><span>dokka</span><span class="padded-icon"></span></a></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<div class="cover ">
<h1 class="cover"><span>set</span><wbr><span><span>On</span></span></h1>
</div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-depenent-content" data-active="" data-togglable=":renetik-android-ui:dokkaHtmlPartial/release"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="https://developer.android.com/reference/kotlin/android/widget/CompoundButton.html">CompoundButton</a><span class="token punctuation">.</span><a href="set-on.html"><span class="token function">setOn</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div></div></div>
<div class="platform-hinted " data-platform-hinted="data-platform-hinted"><div class="content sourceset-depenent-content" data-active="" data-togglable=":renetik-android-ui:dokkaHtmlPartial/release"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="https://developer.android.com/reference/kotlin/android/widget/CompoundButton.html">CompoundButton</a><span class="token punctuation">.</span><a href="set-on.html"><span class="token function">setOn</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://developer.android.com/reference/kotlin/android/widget/CompoundButton.html">CompoundButton</a><span class="top-right-position"><span class="copy-icon"></span><div class="copy-popup-wrapper popup-to-left"><span class="copy-popup-icon"></span><span>Content copied to clipboard</span></div></span></div></div></div>
</div>
<div class="footer">
<span class="go-to-top-icon"><a href="#content" id="go-to-top-link"></a></span><span>© 2022 Copyright</span><span class="pull-right"><span>Generated by </span><a href="https://github.com/Kotlin/dokka"><span>dokka</span><span class="padded-icon"></span></a></span>
Expand Down
2 changes: 1 addition & 1 deletion docs/scripts/pages.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ android.disableAutomaticComponentCreation=true

renetik_library_release=true
# master-SNAPSHOT or version
renetik_library_version=master-SNAPSHOT
renetik_library_version=1.9.38
3 changes: 1 addition & 2 deletions library/renetik-android-imaging/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ dependencies {
if (rootProject.ext.is_renetik_library_release) implementation "$renetik_android_event"
else implementation project(':renetik-android-event')

if (rootProject.ext.is_renetik_library_release) implementation "$renetik_android_ui"
else implementation project(':renetik-android-ui')
implementation project(':renetik-android-ui')

implementation "androidx.exifinterface:exifinterface:1.3.3"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package renetik.android.ui.extensions.widget

import android.content.res.ColorStateList
import android.content.res.ColorStateList.valueOf
import android.widget.CompoundButton
import android.widget.CompoundButton.OnCheckedChangeListener
import androidx.annotation.ColorInt
import renetik.android.event.property.CSProperty
import renetik.android.event.property.action
Expand All @@ -12,27 +11,19 @@ import renetik.android.event.registration.CSRegistration.Companion.CSRegistratio
import renetik.android.event.registration.paused
import renetik.android.event.registration.start

fun CompoundButton.onChange(function: (CompoundButton) -> Unit): CSRegistration {
val listener = OnCheckedChangeListener { buttonView, _ -> function(buttonView) }
return CSRegistration(onResume = { setOnCheckedChangeListener(listener) },
onPause = { setOnCheckedChangeListener(null) }).start()
}
fun CompoundButton.onChange(function: (CompoundButton) -> Unit) = CSRegistration(onResume = {
setOnCheckedChangeListener { buttonView, _ -> if (it.isActive) function(buttonView) }
}, onPause = { setOnCheckedChangeListener(null) }).start()

fun CompoundButton.buttonTint(@ColorInt value: Int?) = apply {
buttonTintList = if (value != null) ColorStateList.valueOf(value) else null
}

fun CompoundButton.checked(condition: Boolean = true) = apply {
isChecked = condition
}

fun CompoundButton.isCheckedIf(condition: Boolean) = apply {
isChecked = condition
buttonTintList = value?.let(::valueOf)
}

fun CompoundButton.isCheckedIfNot(condition: Boolean) = apply {
isChecked = !condition
}
fun CompoundButton.checked(condition: Boolean = true) = apply { isChecked = condition }
fun CompoundButton.isCheckedIf(condition: Boolean) = apply { isChecked = condition }
fun CompoundButton.isCheckedIfNot(condition: Boolean) = apply { isChecked = !condition }
fun CompoundButton.setOn() = apply { isChecked = true }
fun CompoundButton.setOff() = apply { isChecked = false }

fun CompoundButton.isCheckedIfNot(property: CSProperty<Boolean>): CSRegistration {
lateinit var propertyRegistration: CSRegistration
Expand All @@ -48,21 +39,14 @@ fun CompoundButton.isCheckedIf(property: CSProperty<Boolean>): CSRegistration {
return CSRegistration(propertyRegistration, buttonRegistration)
}

fun <T> CompoundButton.isCheckedIf(property1: CSProperty<T>, property2: CSProperty<*>,
condition: (T) -> Boolean) =
isCheckedIf(property1, property2) { first, _ -> condition(first) }
fun <T> CompoundButton.isCheckedIf(
property1: CSProperty<T>, property2: CSProperty<*>, condition: (T) -> Boolean)
: CSRegistration = isCheckedIf(property1, property2) { first, _ -> condition(first) }

fun <T, V> CompoundButton.isCheckedIf(property1: CSProperty<T>, property2: CSProperty<V>,
condition: (T, V) -> Boolean): CSRegistration {
fun <T, V> CompoundButton.isCheckedIf(
property1: CSProperty<T>, property2: CSProperty<V>,
condition: (T, V) -> Boolean): CSRegistration {
fun update() = isCheckedIf(condition(property1.value, property2.value))
update()
return CSRegistration(property1.onChange(::update), property2.onChange(::update))
}

fun CompoundButton.setOn() {
isChecked = true
}

fun CompoundButton.setOff() {
isChecked = false
}

0 comments on commit e1fe3f3

Please sign in to comment.