@Override public void onClick(View v) { long span = System.currentTimeMillis() - mLastChangeStatus; if (span < 500) { return; } if (v.getTag(R.string.memo_first) != null && (Boolean) v.getTag(R.string.memo_first) == true) { mContext.startActivity(new Intent(mContext, MemoActivity.class)); } else { switch (v.getId()) { case R.id.bottom: if (mOutItemId != 0) { Memo memo = (Memo) v.getTag(R.string.memo_data); mDeleteRecoverPanelLisener.wakeRecoveryPanel(memo); setOpenerItem(0); mContext .getContentResolver() .delete( ContentUris.withAppendedId(MemoProvider.MEMO_URI, memo.getId()), null, null); } break; case R.id.hover: Intent intent = new Intent(mContext, MemoActivity.class); intent.putExtra("memo", (Memo) v.getTag(R.string.memo_data)); mContext.startActivity(intent); break; default: break; } } }
@Override public void bindView(View view, Context context, Cursor cursor) { int _id = cursor.getInt(cursor.getColumnIndex("_id")); if (cursor != null && view != null && _id != 0) { Memo memo = new Memo(cursor); TextView content = (TextView) view.findViewById(R.id.content); TextView date = (TextView) view.findViewById(R.id.date); content.setText(Html.fromHtml(memo.getContent())); date.setText(DateHelper.getGridDate(mContext, memo.getCreatedTime())); View bottomView = view.findViewById(R.id.bottom); View hoverView = view.findViewById(R.id.hover); bottomView.setTag(R.string.memo_data, memo); bottomView.setTag(R.string.memo_id, _id); hoverView.setTag(R.string.memo_data, memo); hoverView.setTag(R.string.memo_id, _id); } }