use of org.kymjs.blog.domain.NotebookData in project KJFrameForAndroid by kymjs.
the class NotebookAdapter method getView.
@Override
public View getView(int position, View v, ViewGroup parent) {
NotebookData data = datas.get(position);
ViewHolder holder = null;
if (v == null) {
holder = new ViewHolder();
v = View.inflate(aty, R.layout.item_notebook, null);
holder.titleBar = v.findViewById(R.id.item_note_titlebar);
holder.date = (TextView) v.findViewById(R.id.item_note_tv_date);
holder.state = (ImageView) v.findViewById(R.id.item_note_img_state);
holder.thumbtack = (ImageView) v.findViewById(R.id.item_note_img_thumbtack);
holder.content = (TextView) v.findViewById(R.id.item_note_content);
v.setTag(holder);
} else {
holder = (ViewHolder) v.getTag();
}
RelativeLayout.LayoutParams params = (LayoutParams) holder.content.getLayoutParams();
params.width = width;
params.height = (params.width - height);
holder.content.setLayoutParams(params);
holder.titleBar.setBackgroundColor(NoteEditFragment.sTitleBackGrounds[data.getColor()]);
holder.date.setText(data.getDate());
if (data.getId() > 0) {
holder.state.setVisibility(View.GONE);
} else {
holder.state.setVisibility(View.VISIBLE);
}
holder.thumbtack.setImageResource(NoteEditFragment.sThumbtackImgs[data.getColor()]);
holder.content.setText(Html.fromHtml(data.getContent()).toString());
holder.content.setBackgroundColor(NoteEditFragment.sBackGrounds[data.getColor()]);
if (position == currentHidePosition) {
v.setVisibility(View.GONE);
} else {
v.setVisibility(View.VISIBLE);
}
return v;
}
use of org.kymjs.blog.domain.NotebookData in project KJFrameForAndroid by kymjs.
the class NoteEditFragment method initData.
@Override
public void initData() {
Bundle bundle = ((SimpleBackActivity) getActivity()).getBundleData();
if (bundle != null) {
editData = (NotebookData) bundle.getSerializable(NOTE_KEY);
}
kjdb = KJDB.create(outsideAty, true);
if (editData == null) {
editData = new NotebookData();
}
if (StringUtils.isEmpty(editData.getDate())) {
editData.setDate(StringUtils.getDataTime("yyyy/MM/dd"));
}
}
use of org.kymjs.blog.domain.NotebookData in project KJFrameForAndroid by kymjs.
the class NotebookAdapter method reorderItems.
@Override
public void reorderItems(int oldPosition, int newPosition) {
dataChange = true;
if (oldPosition >= datas.size() || oldPosition < 0) {
return;
}
NotebookData temp = datas.get(oldPosition);
if (oldPosition < newPosition) {
for (int i = oldPosition; i < newPosition; i++) {
Collections.swap(datas, i, i + 1);
}
} else if (oldPosition > newPosition) {
for (int i = oldPosition; i > newPosition; i--) {
Collections.swap(datas, i, i - 1);
}
}
datas.set(newPosition, temp);
}
Aggregations