|
|
|
|
@ -49,6 +49,7 @@ public class NotesListItem extends LinearLayout {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void bind(Context context, NoteItemData data, boolean choiceMode, boolean checked) {
|
|
|
|
|
// 根据选择模式和笔记类型决定是否显示复选框
|
|
|
|
|
if (choiceMode && data.getType() == Notes.TYPE_NOTE) {
|
|
|
|
|
mCheckBox.setVisibility(View.VISIBLE);
|
|
|
|
|
mCheckBox.setChecked(checked);
|
|
|
|
|
@ -56,36 +57,49 @@ public class NotesListItem extends LinearLayout {
|
|
|
|
|
mCheckBox.setVisibility(View.GONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 保存笔记数据引用
|
|
|
|
|
mItemData = data;
|
|
|
|
|
|
|
|
|
|
// 处理通话记录文件夹
|
|
|
|
|
if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) {
|
|
|
|
|
mCallName.setVisibility(View.GONE);
|
|
|
|
|
mAlert.setVisibility(View.VISIBLE);
|
|
|
|
|
mTitle.setTextAppearance(context, R.style.TextAppearancePrimaryItem);
|
|
|
|
|
// 设置文件夹名称和包含的文件数量
|
|
|
|
|
mTitle.setText(context.getString(R.string.call_record_folder_name)
|
|
|
|
|
+ context.getString(R.string.format_folder_files_count, data.getNotesCount()));
|
|
|
|
|
mAlert.setImageResource(R.drawable.call_record);
|
|
|
|
|
} else if (data.getParentId() == Notes.ID_CALL_RECORD_FOLDER) {
|
|
|
|
|
}
|
|
|
|
|
// 处理通话记录子项
|
|
|
|
|
else if (data.getParentId() == Notes.ID_CALL_RECORD_FOLDER) {
|
|
|
|
|
mCallName.setVisibility(View.VISIBLE);
|
|
|
|
|
mCallName.setText(data.getCallName());
|
|
|
|
|
mTitle.setTextAppearance(context,R.style.TextAppearanceSecondaryItem);
|
|
|
|
|
mTitle.setText(DataUtils.getFormattedSnippet(data.getSnippet()));
|
|
|
|
|
// 根据是否有提醒设置提醒图标
|
|
|
|
|
if (data.hasAlert()) {
|
|
|
|
|
mAlert.setImageResource(R.drawable.clock);
|
|
|
|
|
mAlert.setVisibility(View.VISIBLE);
|
|
|
|
|
} else {
|
|
|
|
|
mAlert.setVisibility(View.GONE);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
// 处理普通笔记和文件夹
|
|
|
|
|
else {
|
|
|
|
|
mCallName.setVisibility(View.GONE);
|
|
|
|
|
mTitle.setTextAppearance(context, R.style.TextAppearancePrimaryItem);
|
|
|
|
|
|
|
|
|
|
// 处理文件夹
|
|
|
|
|
if (data.getType() == Notes.TYPE_FOLDER) {
|
|
|
|
|
mTitle.setText(data.getSnippet()
|
|
|
|
|
+ context.getString(R.string.format_folder_files_count,
|
|
|
|
|
data.getNotesCount()));
|
|
|
|
|
data.getNotesCount()));
|
|
|
|
|
mAlert.setVisibility(View.GONE);
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
// 处理普通笔记
|
|
|
|
|
else {
|
|
|
|
|
mTitle.setText(DataUtils.getFormattedSnippet(data.getSnippet()));
|
|
|
|
|
// 根据是否有提醒设置提醒图标
|
|
|
|
|
if (data.hasAlert()) {
|
|
|
|
|
mAlert.setImageResource(R.drawable.clock);
|
|
|
|
|
mAlert.setVisibility(View.VISIBLE);
|
|
|
|
|
@ -94,11 +108,13 @@ public class NotesListItem extends LinearLayout {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置修改时间,使用相对时间格式(如"1小时前")
|
|
|
|
|
mTime.setText(DateUtils.getRelativeTimeSpanString(data.getModifiedDate()));
|
|
|
|
|
|
|
|
|
|
// 根据笔记状态设置背景
|
|
|
|
|
setBackground(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setBackground(NoteItemData data) {
|
|
|
|
|
int id = data.getBgColorId();
|
|
|
|
|
if (data.getType() == Notes.TYPE_NOTE) {
|
|
|
|
|
|