docs: 添加代码注释

This commit is contained in:
Super12138 2026-02-05 20:43:29 +08:00
parent 5b87a17a82
commit 7f248802d5
4 changed files with 28 additions and 3 deletions

View file

@ -38,7 +38,7 @@ android {
applicationId = "cn.super12138.todo"
minSdk = 24
targetSdk = 36
versionCode = 951
versionCode = 952
versionName = "2.3.3"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

View file

@ -238,7 +238,8 @@ fun SettingsItem(
.padding(
horizontal = TodoDefaults.settingsItemHorizontalPadding,
vertical = TodoDefaults.settingsItemVerticalPadding
), verticalAlignment = Alignment.CenterVertically
),
verticalAlignment = Alignment.CenterVertically
) {
leadingIcon?.let { it() }

View file

@ -24,6 +24,13 @@ fun Priority.containerColor(): Color =
Priority.Urgent -> MaterialTheme.colorScheme.error
}
/**
* 获取部分圆角的形状
*
* @param topRounded 顶部是否圆角
* @param bottomRounded 底部是否圆角
* @param roundedShape 所需圆角形状
*/
@Composable
fun CornerBasedShape.getPartialRoundedShape(
topRounded: Boolean,
@ -37,7 +44,13 @@ fun CornerBasedShape.getPartialRoundedShape(
bottomStart = if (bottomRounded) roundedShape.bottomStart else this.bottomStart,
)
/**
* 绘制渐变边缘遮罩
*
* @param edgeWidth 渐变边缘宽度
* @param maskColor 遮罩颜色
* @param leftEdge 是否在左侧边缘添加遮罩否即在右侧边缘添加
*/
fun ContentDrawScope.drawFadedEdge(
edgeWidth: Dp,
maskColor: Color,

View file

@ -7,10 +7,21 @@ import cn.super12138.todo.constants.Constants
object VibrationUtils {
private var isEnabled: Boolean = Constants.PREF_HAPTIC_FEEDBACK_DEFAULT
/**
* 启用或禁用触感反馈
*/
fun setEnabled(enabled: Boolean) {
isEnabled = enabled
}
/**
* **依据触感反馈的启用状态**为用户提供当前视图的触感反馈
*
* 触感反馈 **当且仅当 `isHapticFeedbackEnabled()` `true` 须在系统设置中开启** 才会被出发
*
* @param view 触发触感反馈的视图
* @param feedbackConstants 触感反馈类型默认值为 `HapticFeedbackConstants.CONTEXT_CLICK`
*/
fun performHapticFeedback(
view: View,
feedbackConstants: Int = HapticFeedbackConstants.CONTEXT_CLICK