|
|
|
@ -693,18 +693,6 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
builder.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 创建新的笔记。
|
|
|
|
|
* 启动一个活动用于编辑新笔记或编辑现有笔记。
|
|
|
|
|
*/
|
|
|
|
|
private void createNewNote() {
|
|
|
|
|
// 构造意图并指定动作为插入或编辑,以及初始文件夹ID
|
|
|
|
|
Intent intent = new Intent(this, NoteEditActivity.class);//this-当前activity的上下文,NoteEditActivity.class-要启动的activity的类
|
|
|
|
|
intent.setAction(Intent.ACTION_INSERT_OR_EDIT);//设置意图的动作
|
|
|
|
|
intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mCurrentFolderId);//传递参数
|
|
|
|
|
// 启动该意图并期待返回结果
|
|
|
|
|
this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -848,13 +836,47 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
// 根据视图ID执行相应的操作
|
|
|
|
|
switch (v.getId()) {
|
|
|
|
|
case R.id.btn_new_note:
|
|
|
|
|
createNewNote();
|
|
|
|
|
//createNewNote();
|
|
|
|
|
showNoteType();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 创建新的笔记。
|
|
|
|
|
* 启动一个活动用于编辑新笔记或编辑现有笔记。
|
|
|
|
|
*/
|
|
|
|
|
private void createNewNote(int openMode) {
|
|
|
|
|
// 构造意图并指定动作为插入或编辑,以及初始文件夹ID
|
|
|
|
|
Intent intent = new Intent(this, NoteEditActivity.class);//this-当前activity的上下文,NoteEditActivity.class-要启动的activity的类
|
|
|
|
|
intent.setAction(Intent.ACTION_INSERT_OR_EDIT);//设置意图的动作
|
|
|
|
|
intent.putExtra("open_mode", openMode);//打开不同模板
|
|
|
|
|
intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mCurrentFolderId);//传递参数
|
|
|
|
|
// 启动该意图并期待返回结果
|
|
|
|
|
this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AlertDialog alertDialog1;
|
|
|
|
|
public void showNoteType(){//mine 12
|
|
|
|
|
final String[] items = {"普通便签", "事件便签", "联系人便签", "密码便签"};
|
|
|
|
|
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
|
|
|
|
|
alertBuilder.setTitle("选择创建的便签");
|
|
|
|
|
alertBuilder.setItems(items, new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
|
|
//对createNewNote方法进行了调用
|
|
|
|
|
// 参数i即使代表所选单选按钮的排列次序,也代表打开便签模板的类型
|
|
|
|
|
createNewNote(i);
|
|
|
|
|
Toast.makeText(NotesListActivity.this, items[i], Toast.LENGTH_SHORT).show();
|
|
|
|
|
alertDialog1.dismiss();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
alertDialog1 = alertBuilder.create();
|
|
|
|
|
alertDialog1.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 显示软键盘。
|
|
|
|
@ -1211,7 +1233,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case R.id.menu_new_note: {
|
|
|
|
|
createNewNote(); // 创建新笔记
|
|
|
|
|
//createNewNote(); //qxq:创建新笔记
|
|
|
|
|
//showNoteType();
|
|
|
|
|
createNewNote(0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case R.id.menu_search: {//qxq:为什么这里源代码没有加入{}
|
|
|
|
|