commit 96f689cf928f115324a8190068d211b919d19b62 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue Aug 19 07:59:07 2025 +0000 Deploy to GitHub pages diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..efede6e --- /dev/null +++ b/404.html @@ -0,0 +1,34 @@ + + +
+ + + + + +The PanguText config interface.
Configure the PanguText.
A TextWatcher that automatically applies PanguText to the text content.
You don't need to create it manually, use TextView.injectRealTimePanguText instead.
The PanguText config interface.
A TextWatcher that automatically applies PanguText to the text content.
Create a new instance of PanguTextConfig.
whether to copy the PanguText.globalConfig, default is true.
the configuration body.
Inject PanguText to the current text content once.
Inject PanguText to the current text content in real time.
Create a new instance of PanguTextConfig.
Use PanguText.format to format the hint text content.
Use PanguText.format to format the text content.
Inject PanguText to the current text content once.
whether to apply TextView.setHint, default is true.
the configuration of PanguText.
Inject PanguText to the current text content in real time.
Note: Repeated inject will be ignored unless the current TextView is detached.
whether to apply TextView.setHint, default is true.
the configuration of PanguText.
Use PanguText.format to format the hint text content.
the text content.
the configuration of PanguText.
Use PanguText.format to format the text content.
the text content.
the configuration of PanguText.
Inject PanguTextFactory2 to the current LayoutInflater of context.
Inject PanguTextFactory2 to the current LayoutInflater.
Inject PanguTextFactory2 to the current LayoutInflater of context.
Simple Usage:
class MainActivity : AppCompactActivity() {
val binding by lazy { ActivityMainBinding.inflate(layoutInflater) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Inject here.
PanguTextFactory2.inject(this)
setContentView(binding.root)
}
}
Traditional Usage:
class MainActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Inject here.
PanguTextFactory2.inject(this)
setContentView(R.layout.activity_main)
}
}
Usage with BetterAndroid's AppBindingActivity:
class MainActivity : AppBindingActivity<ActivityMainBinding>() {
override fun onPrepareContentView(savedInstanceState: Bundle?): LayoutInflater {
val inflater = super.onPrepareContentView(savedInstanceState)
// Inject here.
PanguTextFactory2.inject(inflater)
return inflater
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Your code here.
}
}
the current context.
Inject PanguTextFactory2 to the current LayoutInflater.
the current inflater.
Patcher for PanguText.
Patch PanguText to the view.
Pangu text factory 2 for LayoutInflater.Factory2.
Patcher for PanguText.
The CJK spacing ratio, default is DEFAULT_CJK_SPACING_RATIO.
The larger the value, the smaller the spacing, and cannot be less than 0.1f.
It is recommended to adjust with caution, it will only affect the spacing of CJK characters.
Copy the current configuration.
the configuration body.
The regular expression for text content that needs to be excluded. PanguText processing will be skipped after matching these texts.
Usage:
val config: PanguTextConfig
// Exclude all URLs.
config.excludePatterns.add("https?://\\S+".toRegex())
// Exclude emoji symbol placeholder like "[doge]".
config.excludePatterns.add("\\[.*?]".toRegex())
The PanguText configuration.
The CJK spacing ratio, default is DEFAULT_CJK_SPACING_RATIO.
The regular expression for text content that needs to be excluded. PanguText processing will be skipped after matching these texts.
Whether to automatically re-measure the text width after processing.
Processed Spanned text (experimental).
Whether to automatically re-measure the text width after processing.
Note: PanguText after injecting text and changing the text, the width of TextView will not be calculated automatically. At this time, this feature will call TextView.setText to re-execute the measurements, which can fix every time in some dynamic layouts (such as RecyclerView
) changes in text width, but may cause performance issues, you can choose to disable this feature. To prevent unnecessary performance overhead, this feature only takes effect on TextView with maxLines
set to 1 or singleLine
.
Processed Spanned text (experimental).
Note: This feature is in experimental stage and may not be fully supported, if the text is not processed correctly, please disable this feature.
Use PanguText to format specified text.
PanguText will automatically set PanguMarginSpan for some characters in the text to achieve white space typesetting effect without actually inserting any characters or changing the length of the original text.
This function will insert a style for the current given text without actually changing the string position in the text. If the current text is of type Spannable, it will return the original unmodified object, otherwise it will return the wrapped object SpannableString after.
Note: Processed Spanned text is in experimental stage and may not be fully supported, if the text is not processed correctly, please disable PanguTextConfig.isProcessedSpanned.
the current resources.
the text size (px).
text to be formatted.
the configuration of PanguText.
Use PanguText to format the current text content.
Using this function will add extra whiteSpace as character spacing to the text, changing the length of the original text.
Note: Processed Spanned text is in experimental stage and may not be fully supported, if the text is not processed correctly, please disable PanguTextConfig.isProcessedSpanned.
text to be formatted.
the spacing character, default is 'U+200A'.
the configuration of PanguText.
The global configuration of PanguText.
The global configuration of PanguText.
Use PanguText to format the current text content.
Use PanguText to format specified text.
This document is powered by VuePress.
Apache License Version 2.0
+
+Copyright (C) 2019 HighCapable
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
Copyright © 2019 HighCapable