|
|
|
@ -121,6 +121,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
|
|
|
|
|
private static final String TAG = "NotesListActivity";
|
|
|
|
|
|
|
|
|
|
public static int secret_mode = 0;
|
|
|
|
|
|
|
|
|
|
public static final int NOTES_LISTVIEW_SCROLL_RATE = 30;
|
|
|
|
|
|
|
|
|
|
private NoteItemData mFocusNoteDataItem;
|
|
|
|
@ -409,6 +411,29 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
private void startAsyncNotesListQuery() {
|
|
|
|
|
String selection = (mCurrentFolderId == Notes.ID_ROOT_FOLDER) ? ROOT_FOLDER_SELECTION
|
|
|
|
|
: NORMAL_SELECTION;
|
|
|
|
|
if(secret_mode == 0) {
|
|
|
|
|
mBackgroundQueryHandler.startQuery(FOLDER_NOTE_LIST_QUERY_TOKEN, null,
|
|
|
|
|
Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[]{
|
|
|
|
|
String.valueOf(mCurrentFolderId)
|
|
|
|
|
}, NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC");
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
String str1 = "520";
|
|
|
|
|
String [] PROJECTION = new String [] { //定义一个新的PROJECTION数组,只换掉SNIPPET
|
|
|
|
|
NoteColumns.ID,
|
|
|
|
|
NoteColumns.ALERTED_DATE,
|
|
|
|
|
NoteColumns.BG_COLOR_ID,
|
|
|
|
|
NoteColumns.CREATED_DATE,
|
|
|
|
|
NoteColumns.HAS_ATTACHMENT,
|
|
|
|
|
NoteColumns.MODIFIED_DATE,
|
|
|
|
|
NoteColumns.NOTES_COUNT,
|
|
|
|
|
NoteColumns.PARENT_ID,
|
|
|
|
|
// NoteColumns.SNIPPET,
|
|
|
|
|
str1,
|
|
|
|
|
NoteColumns.TYPE,
|
|
|
|
|
NoteColumns.WIDGET_ID,
|
|
|
|
|
NoteColumns.WIDGET_TYPE,
|
|
|
|
|
};
|
|
|
|
|
mBackgroundQueryHandler.startQuery(FOLDER_NOTE_LIST_QUERY_TOKEN, null,
|
|
|
|
|
Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[] {
|
|
|
|
|
String.valueOf(mCurrentFolderId)
|
|
|
|
@ -757,6 +782,10 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
|
|
|
|
menu.clear();
|
|
|
|
|
if(secret_mode == 1)
|
|
|
|
|
menu.findItem(R.id.menu_secret).setVisible(false);
|
|
|
|
|
else
|
|
|
|
|
menu.findItem(R.id.menu_quit_secret).setVisible(false);
|
|
|
|
|
if (mState == ListEditState.NOTE_LIST) {
|
|
|
|
|
getMenuInflater().inflate(R.menu.note_list, menu);
|
|
|
|
|
// set sync or sync_cancel
|
|
|
|
@ -796,6 +825,48 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
} else if (itemId == R.id.menu_search) {
|
|
|
|
|
onSearchRequested();
|
|
|
|
|
}
|
|
|
|
|
else if (itemId == R.id.menu_secret){
|
|
|
|
|
secret_mode = 1;
|
|
|
|
|
AlertDialog.Builder dialog = new AlertDialog.Builder(NotesListActivity.this);
|
|
|
|
|
dialog.setTitle("重要提醒");
|
|
|
|
|
dialog.setMessage("您确认进入私密模式吗?");
|
|
|
|
|
dialog.setCancelable(false);
|
|
|
|
|
dialog.setPositiveButton("确认", new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
startAsyncNotesListQuery();
|
|
|
|
|
Toast.makeText(NotesListActivity.this,"您已进入私密模式",Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which){}
|
|
|
|
|
});
|
|
|
|
|
dialog.show();
|
|
|
|
|
startAsyncNotesListQuery();
|
|
|
|
|
Toast.makeText(this,"您已进入私密模式",Toast.LENGTH_SHORT).show();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (itemId == R.id.menu_quit_secret){
|
|
|
|
|
secret_mode = 0;
|
|
|
|
|
AlertDialog.Builder dialog = new AlertDialog.Builder(NotesListActivity.this);
|
|
|
|
|
dialog.setTitle("重要提醒");
|
|
|
|
|
dialog.setMessage("您确认退出私密模式吗?");
|
|
|
|
|
dialog.setCancelable(false);
|
|
|
|
|
dialog.setPositiveButton("确认", new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
startAsyncNotesListQuery();
|
|
|
|
|
Toast.makeText(NotesListActivity.this,"您已退出私密模式",Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
dialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which){}
|
|
|
|
|
});
|
|
|
|
|
dialog.show();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|