Skip to content

Commit 41f96cf

Browse files
committed
refactor: add withoutTextWatchers for injectPanguText function in PanguText
1 parent 86d000b commit 41f96cf

File tree

1 file changed

+6
-3
lines changed
  • pangutext-android/src/main/java/com/highcapable/pangutext/android/extension

1 file changed

+6
-3
lines changed

pangutext-android/src/main/java/com/highcapable/pangutext/android/extension/PanguText.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import com.highcapable.pangutext.android.PanguText
3333
import com.highcapable.pangutext.android.PanguTextConfig
3434
import com.highcapable.pangutext.android.R
3535
import com.highcapable.pangutext.android.core.PanguTextWatcher
36+
import com.highcapable.pangutext.android.core.TextViewDelegate.Companion.delegate
3637

3738
/**
3839
* Create a new instance of [PanguTextConfig].
@@ -57,9 +58,11 @@ fun PanguTextConfig(copyFromGlobal: Boolean = true, body: PanguTextConfig.() ->
5758
@JvmOverloads
5859
fun TextView.injectPanguText(injectHint: Boolean = true, config: PanguTextConfig = PanguText.globalConfig) {
5960
if (!config.isEnabled) return
60-
61-
setTextWithPangu(this.text, config)
62-
if (injectHint) setHintWithPangu(this.hint, config)
61+
62+
this.delegate.withoutTextWatchers {
63+
setTextWithPangu(this.text, config)
64+
if (injectHint) setHintWithPangu(this.hint, config)
65+
}
6366
}
6467

6568
/**

0 commit comments

Comments
 (0)