|
|
|
@ -40,7 +40,7 @@ public class NotesListAdapter extends CursorAdapter {
|
|
|
|
|
private HashMap<Integer, String> mSnippetPosition;
|
|
|
|
|
private int mNotesCount;
|
|
|
|
|
private boolean mChoiceMode;
|
|
|
|
|
private String mQuery;
|
|
|
|
|
private String mQuery; // 搜索串
|
|
|
|
|
|
|
|
|
|
public static class AppWidgetAttribute {
|
|
|
|
|
public int widgetId;
|
|
|
|
@ -59,6 +59,7 @@ public class NotesListAdapter extends CursorAdapter {
|
|
|
|
|
@Override
|
|
|
|
|
public View getView(int position, View convertView, ViewGroup parent) {
|
|
|
|
|
View view = super.getView(position, convertView, parent);
|
|
|
|
|
// 仅显示便签项中包含搜索串的便签
|
|
|
|
|
if(!TextUtils.isEmpty(mQuery) && !mSnippetPosition.get(position).contains(mQuery)) {
|
|
|
|
|
view.setVisibility(View.GONE);
|
|
|
|
|
LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(0,1);
|
|
|
|
@ -180,13 +181,14 @@ public class NotesListAdapter extends CursorAdapter {
|
|
|
|
|
protected void onContentChanged() {
|
|
|
|
|
super.onContentChanged();
|
|
|
|
|
calcNotesCount();
|
|
|
|
|
updateSnippetMap(); // 在数据发生改变时更新 Snippet 到 Position 的映射
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void changeCursor(Cursor cursor) {
|
|
|
|
|
super.changeCursor(cursor);
|
|
|
|
|
calcNotesCount();
|
|
|
|
|
updateSnippetMap();
|
|
|
|
|
updateSnippetMap(); // 在数据发生改变时更新 Snippet 到 Position 的映射
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateSnippetMap() {
|
|
|
|
|