|
|
@ -42,8 +42,14 @@ public class NotesListItem extends LinearLayout {
|
|
|
|
private CheckBox mCheckBox;
|
|
|
|
private CheckBox mCheckBox;
|
|
|
|
|
|
|
|
|
|
|
|
public NotesListItem(Context context) {
|
|
|
|
public NotesListItem(Context context) {
|
|
|
|
super(context);
|
|
|
|
super(context);/**
|
|
|
|
inflate(context, R.layout.note_item, this);
|
|
|
|
super()它的主要作用是调整调用父类构造函数的顺序
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
inflate(context, R.layout.note_item, this);/**
|
|
|
|
|
|
|
|
Inflate可用于将一个xml中定义的布局控件找出来,这里的xml是r。layout
|
|
|
|
|
|
|
|
findViewById用于从contentView中查找指定ID的View,转换出来的形式根据需要而定;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
mAlert = (ImageView) findViewById(R.id.iv_alert_icon);
|
|
|
|
mAlert = (ImageView) findViewById(R.id.iv_alert_icon);
|
|
|
|
mTitle = (TextView) findViewById(R.id.tv_title);
|
|
|
|
mTitle = (TextView) findViewById(R.id.tv_title);
|
|
|
|
mTime = (TextView) findViewById(R.id.tv_time);
|
|
|
|
mTime = (TextView) findViewById(R.id.tv_time);
|
|
|
@ -59,7 +65,9 @@ public class NotesListItem extends LinearLayout {
|
|
|
|
mCheckBox.setVisibility(View.GONE);
|
|
|
|
mCheckBox.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
mItemData = data;
|
|
|
|
mItemData = data;/**
|
|
|
|
|
|
|
|
设置控件属性,一共三种情况,由data的id和父id是否与保存到文件夹的id一致来决定
|
|
|
|
|
|
|
|
*/
|
|
|
|
if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) {
|
|
|
|
if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) {
|
|
|
|
mCallName.setVisibility(View.GONE);
|
|
|
|
mCallName.setVisibility(View.GONE);
|
|
|
|
mAlert.setVisibility(View.VISIBLE);
|
|
|
|
mAlert.setVisibility(View.VISIBLE);
|
|
|
@ -97,6 +105,10 @@ public class NotesListItem extends LinearLayout {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 设置内容,获取相关时间,从data里编辑的日期中获取
|
|
|
|
|
|
|
|
*/
|
|
|
|
mTime.setText(DateUtils.getRelativeTimeSpanString(data.getModifiedDate()));
|
|
|
|
mTime.setText(DateUtils.getRelativeTimeSpanString(data.getModifiedDate()));
|
|
|
|
|
|
|
|
|
|
|
|
setBackground(data);
|
|
|
|
setBackground(data);
|
|
|
@ -119,6 +131,9 @@ public class NotesListItem extends LinearLayout {
|
|
|
|
setBackgroundResource(NoteItemBgResources.getNoteBgNormalRes(id));
|
|
|
|
setBackgroundResource(NoteItemBgResources.getNoteBgNormalRes(id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 若不是note直接调用文件夹的背景来源
|
|
|
|
|
|
|
|
*/
|
|
|
|
setBackgroundResource(NoteItemBgResources.getFolderBgRes());
|
|
|
|
setBackgroundResource(NoteItemBgResources.getFolderBgRes());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|