Compare commits
No commits in common. "adbf5b4a05c3b5c4b9c0a848253ad0eebef7f292" and "874b83b5a20614dab558bc3a17aa01ced635c716" have entirely different histories.
adbf5b4a05
...
874b83b5a2
@ -24,14 +24,7 @@
|
|||||||
"Bash(magick:*)",
|
"Bash(magick:*)",
|
||||||
"Bash(convert:*)",
|
"Bash(convert:*)",
|
||||||
"Bash(python:*)",
|
"Bash(python:*)",
|
||||||
"Bash(rm:*)",
|
"Bash(rm:*)"
|
||||||
"Bash(cp:*)",
|
|
||||||
"Bash(robocopy:*)",
|
|
||||||
"Bash(dir:*)",
|
|
||||||
"Bash(copy:*)",
|
|
||||||
"Bash(.gradlew:*)",
|
|
||||||
"Bash(gradlew.bat assembleDebug:*)",
|
|
||||||
"Bash(mv:*)"
|
|
||||||
],
|
],
|
||||||
"deny": [],
|
"deny": [],
|
||||||
"ask": []
|
"ask": []
|
||||||
|
|||||||
@ -4,26 +4,15 @@ import android.view.LayoutInflater
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.chick_mood.data.model.Emotion
|
import com.chick_mood.data.model.Emotion
|
||||||
import com.chick_mood.utils.EmotionResourceManager
|
|
||||||
import com.daodaoshi.chick_mood.databinding.ItemChickImageBinding
|
import com.daodaoshi.chick_mood.databinding.ItemChickImageBinding
|
||||||
|
|
||||||
/**
|
|
||||||
* 小鸡形象数据类
|
|
||||||
* @param emotion 情绪类型
|
|
||||||
* @param moodValue 心情值 (0-100)
|
|
||||||
*/
|
|
||||||
data class ChickEmotionData(
|
|
||||||
val emotion: Emotion,
|
|
||||||
val moodValue: Int = 50 // 默认值
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小鸡形象适配器
|
* 小鸡形象适配器
|
||||||
* 用于展示不同情绪和心情值对应的小鸡图标
|
* 用于展示不同情绪对应的小鸡图标
|
||||||
*/
|
*/
|
||||||
class ChickImageAdapter : RecyclerView.Adapter<ChickImageAdapter.ChickImageViewHolder>() {
|
class ChickImageAdapter : RecyclerView.Adapter<ChickImageAdapter.ChickImageViewHolder>() {
|
||||||
|
|
||||||
private var chickEmotions: List<ChickEmotionData> = emptyList()
|
private var emotions: List<Emotion> = emptyList()
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChickImageViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChickImageViewHolder {
|
||||||
val binding = ItemChickImageBinding.inflate(
|
val binding = ItemChickImageBinding.inflate(
|
||||||
@ -33,24 +22,16 @@ class ChickImageAdapter : RecyclerView.Adapter<ChickImageAdapter.ChickImageViewH
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ChickImageViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ChickImageViewHolder, position: Int) {
|
||||||
holder.bind(chickEmotions[position])
|
holder.bind(emotions[position])
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount(): Int = chickEmotions.size
|
override fun getItemCount(): Int = emotions.size
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新数据
|
* 更新数据
|
||||||
*/
|
*/
|
||||||
fun updateData(newChickEmotions: List<ChickEmotionData>) {
|
fun updateData(newEmotions: List<Emotion>) {
|
||||||
chickEmotions = newChickEmotions
|
emotions = newEmotions
|
||||||
notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新数据(兼容旧版本,只提供情绪类型)
|
|
||||||
*/
|
|
||||||
fun updateDataFromEmotions(newEmotions: List<Emotion>) {
|
|
||||||
chickEmotions = newEmotions.map { ChickEmotionData(it) }
|
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,14 +39,18 @@ class ChickImageAdapter : RecyclerView.Adapter<ChickImageAdapter.ChickImageViewH
|
|||||||
private val binding: ItemChickImageBinding
|
private val binding: ItemChickImageBinding
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
|
||||||
fun bind(chickEmotionData: ChickEmotionData) {
|
fun bind(emotion: Emotion) {
|
||||||
// 直接使用新的表情资源,自动处理找不到资源的情况
|
// 根据情绪类型设置对应的小鸡图标
|
||||||
val resourceId = EmotionResourceManager.getEmotionResourceId(
|
val chickDrawable = when (emotion) {
|
||||||
chickEmotionData.emotion,
|
Emotion.HAPPY -> com.daodaoshi.chick_mood.R.drawable.ic_placeholder_chick_happy
|
||||||
chickEmotionData.moodValue
|
Emotion.SAD -> com.daodaoshi.chick_mood.R.drawable.ic_placeholder_chick_sad
|
||||||
)
|
Emotion.ANGRY -> com.daodaoshi.chick_mood.R.drawable.ic_placeholder_chick_angry
|
||||||
|
Emotion.WORRIED -> com.daodaoshi.chick_mood.R.drawable.ic_placeholder_chick_worried
|
||||||
|
Emotion.LONELY -> com.daodaoshi.chick_mood.R.drawable.ic_placeholder_chick_lonely
|
||||||
|
Emotion.SCARED -> com.daodaoshi.chick_mood.R.drawable.ic_placeholder_chick_scared
|
||||||
|
}
|
||||||
|
|
||||||
binding.ivChick.setImageResource(resourceId)
|
binding.ivChick.setImageResource(chickDrawable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,12 +6,9 @@ import android.view.ViewGroup
|
|||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import android.util.Log
|
|
||||||
import com.chick_mood.data.model.MoodRecord
|
import com.chick_mood.data.model.MoodRecord
|
||||||
import com.chick_mood.utils.MoodDescriptionGenerator
|
import com.chick_mood.utils.MoodDescriptionGenerator
|
||||||
import com.chick_mood.utils.FontUtils
|
|
||||||
import com.daodaoshi.chick_mood.databinding.ItemMoodCardBinding
|
import com.daodaoshi.chick_mood.databinding.ItemMoodCardBinding
|
||||||
import com.daodaoshi.chick_mood.ImageUtils
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 心情卡片适配器
|
* 心情卡片适配器
|
||||||
@ -63,34 +60,40 @@ class MoodCardAdapter(
|
|||||||
)
|
)
|
||||||
binding.tvMoodDescription.text = moodDescription
|
binding.tvMoodDescription.text = moodDescription
|
||||||
|
|
||||||
// 应用阿里妈妈数黑体字体到心情文案
|
|
||||||
FontUtils.applyAlimamaShuHeiBold(binding.tvMoodDescription, binding.root.context)
|
|
||||||
|
|
||||||
// 设置收藏状态
|
// 设置收藏状态
|
||||||
updateFavoriteIcon(record.isFavorite)
|
updateFavoriteIcon(record.isFavorite)
|
||||||
|
|
||||||
// 处理文本和图片内容的显示逻辑 - 使用固定布局:左侧100x100dp配图 + 右侧自适应文本
|
// 处理文本和图片内容的显示逻辑
|
||||||
val hasText = !record.textContent.isNullOrEmpty()
|
val hasText = !record.textContent.isNullOrEmpty()
|
||||||
val hasImage = !record.imagePath.isNullOrEmpty()
|
val hasImage = !record.imagePath.isNullOrEmpty()
|
||||||
|
|
||||||
if (hasText && hasImage) {
|
if (hasText && hasImage) {
|
||||||
// 有图有文:图片在左(100x100dp),文本在右(自适应)
|
// 有图有文:图片在左,文本在右
|
||||||
binding.ivImage.visibility = View.VISIBLE
|
binding.ivImage.visibility = View.VISIBLE
|
||||||
binding.tvTextContent.visibility = View.VISIBLE
|
binding.tvTextContent.visibility = View.VISIBLE
|
||||||
|
binding.llMainContent.orientation = LinearLayout.HORIZONTAL
|
||||||
|
binding.ivImage.layoutParams = LinearLayout.LayoutParams(80, 80).apply {
|
||||||
|
marginEnd = 12
|
||||||
|
}
|
||||||
binding.tvTextContent.text = record.textContent
|
binding.tvTextContent.text = record.textContent
|
||||||
// 加载真实图片
|
// TODO: 加载真实图片
|
||||||
Log.d("MoodCardAdapter", "Loading image path: ${record.imagePath}")
|
binding.ivImage.setImageResource(com.daodaoshi.chick_mood.R.drawable.placeholder_background)
|
||||||
ImageUtils.loadImage(binding.ivImage, record.imagePath)
|
|
||||||
} else if (hasImage && !hasText) {
|
} else if (hasImage && !hasText) {
|
||||||
// 有图无文:图片在左(100x100dp),右侧空白
|
// 有图无文:图片居中显示
|
||||||
binding.ivImage.visibility = View.VISIBLE
|
binding.ivImage.visibility = View.VISIBLE
|
||||||
binding.tvTextContent.visibility = View.GONE
|
binding.tvTextContent.visibility = View.GONE
|
||||||
// 加载真实图片
|
binding.llMainContent.orientation = LinearLayout.VERTICAL
|
||||||
ImageUtils.loadImage(binding.ivImage, record.imagePath)
|
binding.llMainContent.gravity = android.view.Gravity.CENTER
|
||||||
|
binding.ivImage.layoutParams = LinearLayout.LayoutParams(120, 120).apply {
|
||||||
|
marginEnd = 0
|
||||||
|
}
|
||||||
|
// TODO: 加载真实图片
|
||||||
|
binding.ivImage.setImageResource(com.daodaoshi.chick_mood.R.drawable.placeholder_background)
|
||||||
} else if (hasText && !hasImage) {
|
} else if (hasText && !hasImage) {
|
||||||
// 无图有文:左侧空白,文本在右(占满右侧)
|
// 无图有文:文本占满整个内容区域
|
||||||
binding.ivImage.visibility = View.GONE
|
binding.ivImage.visibility = View.GONE
|
||||||
binding.tvTextContent.visibility = View.VISIBLE
|
binding.tvTextContent.visibility = View.VISIBLE
|
||||||
|
binding.llMainContent.orientation = LinearLayout.VERTICAL
|
||||||
binding.tvTextContent.text = record.textContent
|
binding.tvTextContent.text = record.textContent
|
||||||
} else {
|
} else {
|
||||||
// 无图无文:隐藏内容区域
|
// 无图无文:隐藏内容区域
|
||||||
|
|||||||
@ -1,152 +0,0 @@
|
|||||||
package com.chick_mood.utils
|
|
||||||
|
|
||||||
import com.chick_mood.data.model.Emotion
|
|
||||||
import com.daodaoshi.chick_mood.R
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 心情表情资源映射器
|
|
||||||
* 根据情绪类型和心情值动态选择对应的表情图片
|
|
||||||
*/
|
|
||||||
object EmotionResourceManager {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据情绪类型和心情值获取对应的表情资源名称
|
|
||||||
* @param emotion 情绪类型
|
|
||||||
* @param moodValue 心情值 (0-100)
|
|
||||||
* @return 表情资源名称(英文名称)
|
|
||||||
*/
|
|
||||||
fun getEmotionResourceName(emotion: Emotion, moodValue: Int): String {
|
|
||||||
val degreeLevel = getDegreeLevel(moodValue)
|
|
||||||
val emotionPrefix = getEmotionEnglishPrefix(emotion)
|
|
||||||
|
|
||||||
return "${emotionPrefix}_${degreeLevel}"
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据心情值获取程度级别
|
|
||||||
* @param moodValue 心情值 (0-100)
|
|
||||||
* @return 程度级别描述
|
|
||||||
*/
|
|
||||||
private fun getDegreeLevel(moodValue: Int): String {
|
|
||||||
return when (moodValue) {
|
|
||||||
in 0..20 -> "level1" // 有些
|
|
||||||
in 21..40 -> "level2" // 非常
|
|
||||||
in 41..60 -> "level3" // 超级
|
|
||||||
in 61..80 -> "level4" // 超级非常
|
|
||||||
in 81..100 -> "level5" // 无法控制
|
|
||||||
else -> "level1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据情绪类型获取对应的英文前缀
|
|
||||||
* @param emotion 情绪类型
|
|
||||||
* @return 英文前缀
|
|
||||||
*/
|
|
||||||
private fun getEmotionEnglishPrefix(emotion: Emotion): String {
|
|
||||||
return when (emotion) {
|
|
||||||
Emotion.HAPPY -> "happy"
|
|
||||||
Emotion.SAD -> "sad"
|
|
||||||
Emotion.ANGRY -> "angry"
|
|
||||||
Emotion.WORRIED -> "worried"
|
|
||||||
Emotion.LONELY -> "lonely"
|
|
||||||
Emotion.SCARED -> "scared"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取情绪选择弹窗中使用的表情资源(基础表情)
|
|
||||||
* 在心情选择界面使用统一的基础表情
|
|
||||||
* @param emotion 情绪类型
|
|
||||||
* @return 基础表情资源ID
|
|
||||||
*/
|
|
||||||
fun getEmotionSelectionResource(emotion: Emotion): String {
|
|
||||||
return when (emotion) {
|
|
||||||
Emotion.HAPPY -> "ic_emotion_happy"
|
|
||||||
Emotion.SAD -> "ic_emotion_sad"
|
|
||||||
Emotion.ANGRY -> "ic_emotion_angry"
|
|
||||||
Emotion.WORRIED -> "ic_emotion_worried"
|
|
||||||
Emotion.LONELY -> "ic_emotion_lonely"
|
|
||||||
Emotion.SCARED -> "ic_emotion_scared"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取基于心情值的表情资源ID
|
|
||||||
* @param emotion 情绪类型
|
|
||||||
* @param moodValue 心情值 (0-100)
|
|
||||||
* @return 表情资源ID,如果找不到则返回占位符资源
|
|
||||||
*/
|
|
||||||
fun getEmotionResourceId(emotion: Emotion, moodValue: Int): Int {
|
|
||||||
val degreeLevel = getDegreeLevel(moodValue)
|
|
||||||
val emotionPrefix = getEmotionEnglishPrefix(emotion)
|
|
||||||
val resourceName = "${emotionPrefix}_${degreeLevel}"
|
|
||||||
|
|
||||||
return try {
|
|
||||||
// 使用反射获取资源ID
|
|
||||||
val resourceIdField = R.drawable::class.java.getDeclaredField(resourceName)
|
|
||||||
resourceIdField.getInt(null)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
// 如果找不到对应的表情资源,返回占位符资源
|
|
||||||
getPlaceholderResourceId(emotion)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取占位符资源ID
|
|
||||||
* @param emotion 情绪类型
|
|
||||||
* @return 占位符资源ID
|
|
||||||
*/
|
|
||||||
private fun getPlaceholderResourceId(emotion: Emotion): Int {
|
|
||||||
return when (emotion) {
|
|
||||||
Emotion.HAPPY -> R.drawable.ic_placeholder_chick_happy
|
|
||||||
Emotion.SAD -> R.drawable.ic_placeholder_chick_sad
|
|
||||||
Emotion.ANGRY -> R.drawable.ic_placeholder_chick_angry
|
|
||||||
Emotion.WORRIED -> R.drawable.ic_placeholder_chick_worried
|
|
||||||
Emotion.LONELY -> R.drawable.ic_placeholder_chick_lonely
|
|
||||||
Emotion.SCARED -> R.drawable.ic_placeholder_chick_scared
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取占位符小鸡表情资源
|
|
||||||
* 在没有心情值数据时使用的默认表情
|
|
||||||
* @param emotion 情绪类型
|
|
||||||
* @return 占位符资源ID
|
|
||||||
*/
|
|
||||||
fun getPlaceholderEmotionResource(emotion: Emotion): String {
|
|
||||||
return when (emotion) {
|
|
||||||
Emotion.HAPPY -> "ic_placeholder_chick_happy"
|
|
||||||
Emotion.SAD -> "ic_placeholder_chick_sad"
|
|
||||||
Emotion.ANGRY -> "ic_placeholder_chick_angry"
|
|
||||||
Emotion.WORRIED -> "ic_placeholder_chick_worried"
|
|
||||||
Emotion.LONELY -> "ic_placeholder_chick_lonely"
|
|
||||||
Emotion.SCARED -> "ic_placeholder_chick_scared"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据心情值和情绪类型获取表情图片文件的完整路径
|
|
||||||
* 这个方法用于后续直接复制文件到drawable目录后的资源引用
|
|
||||||
*/
|
|
||||||
fun getEmotionImagePath(emotion: Emotion, moodValue: Int): String {
|
|
||||||
val degreeLevel = when {
|
|
||||||
moodValue <= 20 -> "有些"
|
|
||||||
moodValue <= 40 -> "非常"
|
|
||||||
moodValue <= 60 -> "超级"
|
|
||||||
moodValue <= 80 -> "这也太"
|
|
||||||
else -> "无法控制"
|
|
||||||
}
|
|
||||||
|
|
||||||
val emotionName = when (emotion) {
|
|
||||||
Emotion.HAPPY -> "开心"
|
|
||||||
Emotion.SAD -> "悲伤"
|
|
||||||
Emotion.ANGRY -> "生气"
|
|
||||||
Emotion.WORRIED -> "烦恼"
|
|
||||||
Emotion.LONELY -> "孤单"
|
|
||||||
Emotion.SCARED -> "害怕"
|
|
||||||
}
|
|
||||||
|
|
||||||
return "${emotionName}${degreeLevel}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
package com.chick_mood.utils
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Typeface
|
|
||||||
import android.util.Log
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字体工具类
|
|
||||||
* 用于从assets目录加载字体
|
|
||||||
*/
|
|
||||||
object FontUtils {
|
|
||||||
|
|
||||||
private var alimamaTypeface: Typeface? = null
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取阿里妈妈数黑体
|
|
||||||
* @param context 上下文
|
|
||||||
* @return Typeface对象
|
|
||||||
*/
|
|
||||||
fun getAlimamaShuHeiBoldTypeface(context: Context): Typeface {
|
|
||||||
if (alimamaTypeface == null) {
|
|
||||||
try {
|
|
||||||
alimamaTypeface = Typeface.createFromAsset(context.assets, "fonts/alimama_shuhei_bold.ttf")
|
|
||||||
if (alimamaTypeface != null) {
|
|
||||||
Log.d("FontUtils", "阿里妈妈数黑体加载成功")
|
|
||||||
} else {
|
|
||||||
Log.w("FontUtils", "阿里妈妈数黑体加载失败,使用默认字体")
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e("FontUtils", "加载字体时出错: ${e.message}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return alimamaTypeface ?: Typeface.DEFAULT
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取系统默认粗体字体
|
|
||||||
* @param context 上下文
|
|
||||||
* @return Typeface对象
|
|
||||||
*/
|
|
||||||
fun getSystemBoldTypeface(context: Context): Typeface {
|
|
||||||
return Typeface.create("sans-serif", Typeface.BOLD)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用阿里妈妈数黑体到TextView
|
|
||||||
* @param textView 目标TextView
|
|
||||||
* @param context 上下文
|
|
||||||
*/
|
|
||||||
fun applyAlimamaShuHeiBold(textView: android.widget.TextView, context: Context) {
|
|
||||||
val typeface = getAlimamaShuHeiBoldTypeface(context)
|
|
||||||
textView.typeface = typeface
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用阿里妈妈数黑体到多个TextView
|
|
||||||
* @param textViews 目标TextView数组
|
|
||||||
* @param context 上下文
|
|
||||||
*/
|
|
||||||
fun applyAlimamaShuHeiBold(textViews: Array<android.widget.TextView>, context: Context) {
|
|
||||||
val typeface = getAlimamaShuHeiBoldTypeface(context)
|
|
||||||
textViews.forEach { it.typeface = typeface }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -24,7 +24,6 @@ import androidx.core.content.ContextCompat
|
|||||||
import android.os.Vibrator
|
import android.os.Vibrator
|
||||||
import android.os.VibrationEffect
|
import android.os.VibrationEffect
|
||||||
import com.chick_mood.data.model.Emotion
|
import com.chick_mood.data.model.Emotion
|
||||||
import com.chick_mood.utils.EmotionResourceManager
|
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -253,9 +252,6 @@ class AddActivity : AppCompatActivity(), SensorEventListener {
|
|||||||
tvMoodText.text = "开始!"
|
tvMoodText.text = "开始!"
|
||||||
tvMoodValue.text = moodValueFormatter.format(currentMoodValue)
|
tvMoodValue.text = moodValueFormatter.format(currentMoodValue)
|
||||||
progressBar.progress = 0
|
progressBar.progress = 0
|
||||||
|
|
||||||
// 更新小鸡表情(使用基础表情,因为心情值为0)
|
|
||||||
updateChickExpression()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -288,24 +284,10 @@ class AddActivity : AppCompatActivity(), SensorEventListener {
|
|||||||
tvMoodValue.text = moodValueFormatter.format(currentMoodValue)
|
tvMoodValue.text = moodValueFormatter.format(currentMoodValue)
|
||||||
progressBar.progress = currentMoodValue
|
progressBar.progress = currentMoodValue
|
||||||
|
|
||||||
// 更新小鸡表情(基于心情值和情绪类型)
|
|
||||||
updateChickExpression()
|
|
||||||
|
|
||||||
// 更新心情文案
|
// 更新心情文案
|
||||||
updateMoodText()
|
updateMoodText()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新小鸡表情
|
|
||||||
*/
|
|
||||||
private fun updateChickExpression() {
|
|
||||||
selectedEmotion?.let { emotion ->
|
|
||||||
// 直接使用新的表情资源,自动处理找不到资源的情况
|
|
||||||
val resourceId = EmotionResourceManager.getEmotionResourceId(emotion, currentMoodValue)
|
|
||||||
ivChick.setImageResource(resourceId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新心情文案
|
* 更新心情文案
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -14,8 +14,6 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import com.chick_mood.data.database.SimpleDatabaseManager
|
import com.chick_mood.data.database.SimpleDatabaseManager
|
||||||
import com.chick_mood.data.model.Emotion
|
import com.chick_mood.data.model.Emotion
|
||||||
import com.chick_mood.data.model.MoodRecord
|
import com.chick_mood.data.model.MoodRecord
|
||||||
import com.chick_mood.utils.FontUtils
|
|
||||||
import com.chick_mood.utils.EmotionResourceManager
|
|
||||||
import com.daodaoshi.chick_mood.ImageUtils
|
import com.daodaoshi.chick_mood.ImageUtils
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@ -90,17 +88,13 @@ class DetailActivity : AppCompatActivity() {
|
|||||||
// 设置时间显示
|
// 设置时间显示
|
||||||
timeText.text = formatTime(record.timestamp)
|
timeText.text = formatTime(record.timestamp)
|
||||||
|
|
||||||
// 设置小鸡形象(基于心情值和情绪类型)
|
// 设置小鸡形象
|
||||||
val resourceId = EmotionResourceManager.getEmotionResourceId(record.emotion, record.moodIntensity)
|
chickImage.setImageResource(getEmotionIconResource(record.emotion))
|
||||||
chickImage.setImageResource(resourceId)
|
|
||||||
|
|
||||||
// 设置心情值和文案
|
// 设置心情值和文案
|
||||||
moodValueText.text = record.moodIntensity.toString()
|
moodValueText.text = record.moodIntensity.toString()
|
||||||
moodText.text = generateMoodText(record.moodIntensity, record.emotion)
|
moodText.text = generateMoodText(record.moodIntensity, record.emotion)
|
||||||
|
|
||||||
// 应用阿里妈妈数黑体字体到心情文案
|
|
||||||
FontUtils.applyAlimamaShuHeiBold(moodText, this)
|
|
||||||
|
|
||||||
// 设置图片内容(如果有)
|
// 设置图片内容(如果有)
|
||||||
if (record.imagePath != null) {
|
if (record.imagePath != null) {
|
||||||
imageContent.visibility = View.VISIBLE
|
imageContent.visibility = View.VISIBLE
|
||||||
|
|||||||
@ -16,8 +16,6 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import com.chick_mood.data.database.SimpleDatabaseManager
|
import com.chick_mood.data.database.SimpleDatabaseManager
|
||||||
import com.chick_mood.data.model.Emotion
|
import com.chick_mood.data.model.Emotion
|
||||||
import com.chick_mood.data.model.MoodRecord
|
import com.chick_mood.data.model.MoodRecord
|
||||||
import com.chick_mood.utils.FontUtils
|
|
||||||
import com.chick_mood.utils.EmotionResourceManager
|
|
||||||
import com.daodaoshi.chick_mood.ImageUtils
|
import com.daodaoshi.chick_mood.ImageUtils
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@ -251,17 +249,13 @@ class EditActivity : AppCompatActivity() {
|
|||||||
// 设置时间显示
|
// 设置时间显示
|
||||||
timeText.text = formatTime(record.timestamp)
|
timeText.text = formatTime(record.timestamp)
|
||||||
|
|
||||||
// 设置小鸡形象(基于心情值和情绪类型)
|
// 设置小鸡形象
|
||||||
val resourceId = EmotionResourceManager.getEmotionResourceId(record.emotion, record.moodIntensity)
|
chickImage.setImageResource(getEmotionIconResource(record.emotion))
|
||||||
chickImage.setImageResource(resourceId)
|
|
||||||
|
|
||||||
// 设置心情值和文案
|
// 设置心情值和文案
|
||||||
moodValueText.text = record.moodIntensity.toString()
|
moodValueText.text = record.moodIntensity.toString()
|
||||||
moodText.text = generateMoodText(record.moodIntensity, record.emotion)
|
moodText.text = generateMoodText(record.moodIntensity, record.emotion)
|
||||||
|
|
||||||
// 应用阿里妈妈数黑体字体到心情文案
|
|
||||||
FontUtils.applyAlimamaShuHeiBold(moodText, this)
|
|
||||||
|
|
||||||
// 设置文本内容
|
// 设置文本内容
|
||||||
textInput.setText(record.textContent ?: "")
|
textInput.setText(record.textContent ?: "")
|
||||||
updateCharCount()
|
updateCharCount()
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import android.graphics.BitmapFactory
|
|||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.widget.ImageView
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@ -67,34 +66,6 @@ object ImageUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 从文件路径加载图片到ImageView(简化版本)
|
|
||||||
*/
|
|
||||||
fun loadImage(imageView: ImageView, imagePath: String?) {
|
|
||||||
if (!imagePath.isNullOrEmpty()) {
|
|
||||||
imageView.setImageResource(com.daodaoshi.chick_mood.R.drawable.placeholder_background)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
val file = File(imagePath)
|
|
||||||
if (file.exists()) {
|
|
||||||
val bitmap = BitmapFactory.decodeFile(file.absolutePath)
|
|
||||||
if (bitmap != null) {
|
|
||||||
imageView.setImageBitmap(bitmap)
|
|
||||||
} else {
|
|
||||||
imageView.setImageResource(com.daodaoshi.chick_mood.R.drawable.placeholder_background)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "图片文件不存在: $imagePath")
|
|
||||||
imageView.setImageResource(com.daodaoshi.chick_mood.R.drawable.placeholder_background)
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e(TAG, "加载图片失败", e)
|
|
||||||
imageView.setImageResource(com.daodaoshi.chick_mood.R.drawable.placeholder_background)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从文件路径加载Bitmap
|
* 从文件路径加载Bitmap
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import com.chick_mood.data.database.SimpleDatabaseManager
|
|||||||
import com.chick_mood.ui.emotion.EmotionSelectorDialog
|
import com.chick_mood.ui.emotion.EmotionSelectorDialog
|
||||||
import com.chick_mood.ui.adapter.MoodCardAdapter
|
import com.chick_mood.ui.adapter.MoodCardAdapter
|
||||||
import com.chick_mood.ui.adapter.ChickImageAdapter
|
import com.chick_mood.ui.adapter.ChickImageAdapter
|
||||||
import com.chick_mood.ui.adapter.ChickEmotionData
|
|
||||||
import com.chick_mood.data.model.Emotion
|
import com.chick_mood.data.model.Emotion
|
||||||
import com.chick_mood.data.model.MoodRecord
|
import com.chick_mood.data.model.MoodRecord
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
@ -23,7 +22,6 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import com.chick_mood.utils.MoodDescriptionGenerator
|
import com.chick_mood.utils.MoodDescriptionGenerator
|
||||||
import com.chick_mood.utils.FontUtils
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 简化的首页Activity - 主要用于展示历史心情记录和创建新记录的入口
|
* 简化的首页Activity - 主要用于展示历史心情记录和创建新记录的入口
|
||||||
@ -244,9 +242,6 @@ class MainActivitySimple : AppCompatActivity() {
|
|||||||
|
|
||||||
binding.tvWeekday.text = weekdayText
|
binding.tvWeekday.text = weekdayText
|
||||||
binding.tvTime.text = time
|
binding.tvTime.text = time
|
||||||
|
|
||||||
// 应用阿里妈妈数黑体字体
|
|
||||||
FontUtils.applyAlimamaShuHeiBold(binding.tvWeekday, this)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,10 +396,8 @@ class MainActivitySimple : AppCompatActivity() {
|
|||||||
moodCardAdapter.updateData(records)
|
moodCardAdapter.updateData(records)
|
||||||
|
|
||||||
// 更新小鸡形象适配器
|
// 更新小鸡形象适配器
|
||||||
val chickEmotions = records.map {
|
val emotions = records.map { it.emotion }
|
||||||
ChickEmotionData(it.emotion, it.moodIntensity)
|
chickImageAdapter.updateData(emotions)
|
||||||
}
|
|
||||||
chickImageAdapter.updateData(chickEmotions)
|
|
||||||
|
|
||||||
// 更新时间信息(显示第一条记录的时间)
|
// 更新时间信息(显示第一条记录的时间)
|
||||||
updateTimeInfo(0)
|
updateTimeInfo(0)
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 155 KiB |
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:shape="rectangle">
|
|
||||||
<corners android:radius="8dp" />
|
|
||||||
<solid android:color="#FFAC46" />
|
|
||||||
</shape>
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:state_pressed="true">
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<solid android:color="#1A000000" />
|
|
||||||
<corners android:radius="16dp" />
|
|
||||||
<stroke android:width="2dp" android:color="#FFAC46" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<shape android:shape="rectangle">
|
|
||||||
<solid android:color="@android:color/transparent" />
|
|
||||||
<corners android:radius="16dp" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</selector>
|
|
||||||
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 155 KiB |
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:color="#33FFFFFF">
|
|
||||||
<item android:id="@android:id/background">
|
|
||||||
<shape android:shape="oval">
|
|
||||||
<solid android:color="@android:color/transparent" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</ripple>
|
|
||||||
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 155 KiB |
@ -91,6 +91,7 @@
|
|||||||
android:id="@+id/mood_text"
|
android:id="@+id/mood_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:text="完全无法控制 开心"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textColor="@color/text_secondary" />
|
android:textColor="@color/text_secondary" />
|
||||||
|
|
||||||
|
|||||||
@ -89,6 +89,7 @@
|
|||||||
android:id="@+id/mood_text"
|
android:id="@+id/mood_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:text="完全无法控制 开心"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textColor="@color/text_secondary" />
|
android:textColor="@color/text_secondary" />
|
||||||
|
|
||||||
|
|||||||
@ -164,8 +164,6 @@
|
|||||||
android:layout_marginBottom="24dp"
|
android:layout_marginBottom="24dp"
|
||||||
android:elevation="4dp"
|
android:elevation="4dp"
|
||||||
android:stateListAnimator="@null"
|
android:stateListAnimator="@null"
|
||||||
android:drawableStart="@drawable/ic_add_mood"
|
|
||||||
android:drawablePadding="8dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|||||||
@ -4,82 +4,77 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_margin="4dp"
|
app:cardCornerRadius="12dp"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardElevation="2dp"
|
||||||
app:cardElevation="3dp"
|
app:cardBackgroundColor="@color/white">
|
||||||
app:cardBackgroundColor="@color/white"
|
|
||||||
android:foreground="@drawable/card_selector">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:padding="20dp">
|
android:padding="16dp">
|
||||||
|
|
||||||
<!-- 顶部区域:心情文案标题 + 查看详情按钮 -->
|
<!-- 心情文案 - 左上角 -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_mood_description"
|
android:id="@+id/tv_mood_description"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="18sp"
|
android:textSize="16sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="@color/text_primary"
|
android:textColor="@color/text_primary"
|
||||||
android:maxLines="2"
|
android:maxLines="2"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toStartOf="@id/btn_detail"
|
app:layout_constraintEnd_toStartOf="@id/btn_detail"
|
||||||
tools:text="有些 开心" />
|
tools:text="完全无法控制 开心" />
|
||||||
|
|
||||||
<!-- 查看详情按钮 - 右上角,橙色 -->
|
<!-- 查看详情按钮 - 右上角 -->
|
||||||
<TextView
|
<ImageView
|
||||||
android:id="@+id/btn_detail"
|
android:id="@+id/btn_detail"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="20dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="20dp"
|
||||||
android:text="查看详情"
|
android:src="@drawable/ic_more_info"
|
||||||
android:textSize="13sp"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:textColor="@color/white"
|
android:tint="@color/text_secondary"
|
||||||
android:textStyle="bold"
|
android:padding="2dp"
|
||||||
android:background="@drawable/bg_detail_button"
|
|
||||||
android:paddingHorizontal="14dp"
|
|
||||||
android:paddingVertical="8dp"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:contentDescription="查看详情"
|
android:contentDescription="查看详情"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
<!-- 中间内容区域:固定尺寸,左侧配图 + 右侧文本 -->
|
<!-- 主要内容区域 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_main_content"
|
android:id="@+id/ll_main_content"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="100dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="top"
|
android:gravity="top"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_mood_description"
|
app:layout_constraintTop_toBottomOf="@id/tv_mood_description"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent">
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
<!-- 左侧图片区域 - 1:1比例,100x100dp -->
|
<!-- 左侧图片区域 -->
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_image"
|
android:id="@+id/iv_image"
|
||||||
android:layout_width="100dp"
|
android:layout_width="80dp"
|
||||||
android:layout_height="100dp"
|
android:layout_height="80dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="12dp"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:background="@drawable/shape_image_background"
|
android:background="@drawable/placeholder_background"
|
||||||
android:contentDescription="心情配图" />
|
android:contentDescription="心情图片" />
|
||||||
|
|
||||||
<!-- 右侧文本区域 - 自适应宽度,超出显示... -->
|
<!-- 右侧文本区域 -->
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_text_content"
|
android:id="@+id/tv_text_content"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:textSize="14sp"
|
||||||
android:textSize="15sp"
|
|
||||||
android:textColor="@color/text_secondary"
|
android:textColor="@color/text_secondary"
|
||||||
android:lineSpacingExtra="3dp"
|
android:lineSpacingExtra="2dp"
|
||||||
android:maxLines="4"
|
android:maxLines="4"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="top"
|
android:gravity="top"
|
||||||
@ -88,35 +83,35 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- 底部操作区域:收藏和分享按钮,居右下角 -->
|
<!-- 操作按钮区域 - 右下角 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_marginTop="16dp"
|
android:layout_marginBottom="4dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent">
|
app:layout_constraintEnd_toEndOf="parent">
|
||||||
|
|
||||||
<!-- 收藏按钮 -->
|
<!-- 收藏按钮 -->
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/btn_favorite"
|
android:id="@+id/btn_favorite"
|
||||||
android:layout_width="24dp"
|
android:layout_width="20dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="20dp"
|
||||||
android:src="@drawable/ic_favorite_border"
|
android:src="@drawable/ic_card_favorite_border"
|
||||||
android:background="@drawable/shape_button_ripple"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:padding="4dp"
|
android:padding="2dp"
|
||||||
android:contentDescription="收藏" />
|
android:contentDescription="收藏" />
|
||||||
|
|
||||||
<!-- 分享按钮 -->
|
<!-- 分享按钮 -->
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/btn_share"
|
android:id="@+id/btn_share"
|
||||||
android:layout_width="24dp"
|
android:layout_width="20dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="20dp"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:src="@drawable/ic_share"
|
android:src="@drawable/ic_card_share"
|
||||||
android:background="@drawable/shape_button_ripple"
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
android:padding="4dp"
|
android:padding="2dp"
|
||||||
android:contentDescription="分享" />
|
android:contentDescription="分享" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
22
claude.md
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
**项目名称:** 别摇小鸡心情记录App
|
**项目名称:** 别摇小鸡心情记录App
|
||||||
**开发平台:** Android原生(Kotlin)
|
**开发平台:** Android原生(Kotlin)
|
||||||
**当前版本:** V1.4.1
|
**当前版本:** V1.4.0
|
||||||
**更新日期:** 2025-10-27
|
**更新日期:** 2025-10-24
|
||||||
**开发状态:** ✅ UI和字体优化完成,等待下一步开发安排
|
**开发状态:** ✅ 添加心情功能完成,摇晃检测和震动反馈集成
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -628,22 +628,6 @@ Chick_Mood/
|
|||||||
3. **用户体验:** 摇晃检测灵敏度需要平衡,既不能太敏感也不能太迟钝
|
3. **用户体验:** 摇晃检测灵敏度需要平衡,既不能太敏感也不能太迟钝
|
||||||
4. **数据一致性:** 确保整个流程中数据传递的准确性和完整性
|
4. **数据一致性:** 确保整个流程中数据传递的准确性和完整性
|
||||||
|
|
||||||
**2025-10-27 (V1.4.1 UI和字体优化)**
|
|
||||||
- ✅ **心情卡片UI重设计**:简洁清新风格,白色底色,三部分信息区域划分
|
|
||||||
- ✅ **顶部设计优化**:心情文案标题 + 橙色"查看详情"文本按钮,醒目位置
|
|
||||||
- ✅ **中间布局优化**:左侧1:1配图(100x100dp) + 右侧自适应文本(最多4行,超出显示"...")
|
|
||||||
- ✅ **底部设计简化**:只保留收藏和分享按钮,居右下角,符合用户习惯
|
|
||||||
- ✅ **交互反馈增强**:按钮涟漪效果,选中卡片有主题色边框高亮
|
|
||||||
- ✅ **卡片样式优化**:16dp圆角,3dp细腻阴影,4dp边距避免拥挤
|
|
||||||
- ✅ **配图显示修复**:真实图片加载和显示,完善异常处理和回退机制
|
|
||||||
- ✅ **阿里妈妈数黑体集成**:
|
|
||||||
- 字体文件配置:从font/阿里妈妈数黑体/目录复制AlimamaShuHeiTi-Bold.ttf到assets/fonts/
|
|
||||||
- FontUtils工具类:assets方式字体加载,单例模式,完善异常处理
|
|
||||||
- 应用范围:首页星期数文本、心情卡片文案、详情页心情文案、编辑页心情文案
|
|
||||||
- 降级机制:字体加载失败时自动回退到系统默认字体
|
|
||||||
- ✅ **构建和部署成功**:所有UI优化和字体配置已完成,APK成功构建并安装
|
|
||||||
- ✅ **当前版本**:V1.4.1 UI和字体优化完成,等待下一步开发安排
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
*此文档将随着开发进展持续更新,记录重要的技术决策和进度变化。*
|
*此文档将随着开发进展持续更新,记录重要的技术决策和进度变化。*
|
||||||
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 124 KiB |
|
Before Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 142 KiB |