docs: 添加代码注释
This commit is contained in:
parent
5b87a17a82
commit
7f248802d5
4 changed files with 28 additions and 3 deletions
|
|
@ -38,7 +38,7 @@ android {
|
||||||
applicationId = "cn.super12138.todo"
|
applicationId = "cn.super12138.todo"
|
||||||
minSdk = 24
|
minSdk = 24
|
||||||
targetSdk = 36
|
targetSdk = 36
|
||||||
versionCode = 951
|
versionCode = 952
|
||||||
versionName = "2.3.3"
|
versionName = "2.3.3"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,8 @@ fun SettingsItem(
|
||||||
.padding(
|
.padding(
|
||||||
horizontal = TodoDefaults.settingsItemHorizontalPadding,
|
horizontal = TodoDefaults.settingsItemHorizontalPadding,
|
||||||
vertical = TodoDefaults.settingsItemVerticalPadding
|
vertical = TodoDefaults.settingsItemVerticalPadding
|
||||||
), verticalAlignment = Alignment.CenterVertically
|
),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
leadingIcon?.let { it() }
|
leadingIcon?.let { it() }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,13 @@ fun Priority.containerColor(): Color =
|
||||||
Priority.Urgent -> MaterialTheme.colorScheme.error
|
Priority.Urgent -> MaterialTheme.colorScheme.error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部分圆角的形状
|
||||||
|
*
|
||||||
|
* @param topRounded 顶部是否圆角
|
||||||
|
* @param bottomRounded 底部是否圆角
|
||||||
|
* @param roundedShape 所需圆角形状
|
||||||
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun CornerBasedShape.getPartialRoundedShape(
|
fun CornerBasedShape.getPartialRoundedShape(
|
||||||
topRounded: Boolean,
|
topRounded: Boolean,
|
||||||
|
|
@ -37,7 +44,13 @@ fun CornerBasedShape.getPartialRoundedShape(
|
||||||
bottomStart = if (bottomRounded) roundedShape.bottomStart else this.bottomStart,
|
bottomStart = if (bottomRounded) roundedShape.bottomStart else this.bottomStart,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绘制渐变边缘遮罩
|
||||||
|
*
|
||||||
|
* @param edgeWidth 渐变边缘宽度
|
||||||
|
* @param maskColor 遮罩颜色
|
||||||
|
* @param leftEdge 是否在左侧边缘添加遮罩(否即在右侧边缘添加)
|
||||||
|
*/
|
||||||
fun ContentDrawScope.drawFadedEdge(
|
fun ContentDrawScope.drawFadedEdge(
|
||||||
edgeWidth: Dp,
|
edgeWidth: Dp,
|
||||||
maskColor: Color,
|
maskColor: Color,
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,21 @@ import cn.super12138.todo.constants.Constants
|
||||||
object VibrationUtils {
|
object VibrationUtils {
|
||||||
private var isEnabled: Boolean = Constants.PREF_HAPTIC_FEEDBACK_DEFAULT
|
private var isEnabled: Boolean = Constants.PREF_HAPTIC_FEEDBACK_DEFAULT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用或禁用触感反馈
|
||||||
|
*/
|
||||||
fun setEnabled(enabled: Boolean) {
|
fun setEnabled(enabled: Boolean) {
|
||||||
isEnabled = enabled
|
isEnabled = enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* **依据触感反馈的启用状态**为用户提供当前视图的触感反馈
|
||||||
|
*
|
||||||
|
* 注:触感反馈 **当且仅当 `isHapticFeedbackEnabled()` 为 `true` 时(须在系统设置中开启)** 才会被出发
|
||||||
|
*
|
||||||
|
* @param view 触发触感反馈的视图
|
||||||
|
* @param feedbackConstants 触感反馈类型,默认值为 `HapticFeedbackConstants.CONTEXT_CLICK`
|
||||||
|
*/
|
||||||
fun performHapticFeedback(
|
fun performHapticFeedback(
|
||||||
view: View,
|
view: View,
|
||||||
feedbackConstants: Int = HapticFeedbackConstants.CONTEXT_CLICK
|
feedbackConstants: Int = HapticFeedbackConstants.CONTEXT_CLICK
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue