|
|
|
@ -289,8 +289,43 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
mWorkingNote.getModifiedDate(), DateUtils.FORMAT_SHOW_DATE
|
|
|
|
|
| DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME
|
|
|
|
|
| DateUtils.FORMAT_SHOW_YEAR));
|
|
|
|
|
// mPasword=mWorkingNote.getPassword();
|
|
|
|
|
// if(mPassword)
|
|
|
|
|
// String mPassword=mWorkingNote.getPassword();
|
|
|
|
|
// if (mWorkingNote.getPassword()!=null){
|
|
|
|
|
// final AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
|
|
|
// View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text, null);
|
|
|
|
|
// //编辑Text
|
|
|
|
|
// final EditText etName = (EditText) view.findViewById(R.id.et_foler_name);
|
|
|
|
|
// etName.setText("");
|
|
|
|
|
// etName.setHint("请输入密码");
|
|
|
|
|
// builder.setTitle("密码检验");
|
|
|
|
|
// builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
|
|
// @Override
|
|
|
|
|
// public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
// //获取输入的字符串
|
|
|
|
|
// String password = etName.getText().toString();
|
|
|
|
|
// Log.d("mPassword: ", mPassword);
|
|
|
|
|
// Log.d("password: ", password);
|
|
|
|
|
// //判断密码正确性
|
|
|
|
|
// if (!password.equals(mPassword)) {
|
|
|
|
|
// Log.d("密码不正确,正确密码是:",mPassword);
|
|
|
|
|
// dialog.dismiss();
|
|
|
|
|
// onBackPressed();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// builder.setNegativeButton("cancel", new DialogInterface.OnClickListener(){
|
|
|
|
|
// @Override
|
|
|
|
|
// public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
// dialog.dismiss();
|
|
|
|
|
// onBackPressed();
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// final Dialog dialog = builder.setView(view).show();
|
|
|
|
|
// dialog.show();
|
|
|
|
|
// }
|
|
|
|
|
// else{
|
|
|
|
|
// Toast.makeText(NoteEditActivity.this,"还没有设置密码", Toast.LENGTH_SHORT).show();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* TODO: Add the menu for setting alert. Currently disable it because the DateTimePicker
|
|
|
|
@ -545,33 +580,38 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|
|
|
|
|
mWorkingNote.setAlertDate(0, false);
|
|
|
|
|
}
|
|
|
|
|
else if (itemId == R.id.menu_enter_private_mode){
|
|
|
|
|
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
|
|
|
View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text,null);
|
|
|
|
|
final EditText etName = (EditText)view.findViewById(R.id.et_foler_name);
|
|
|
|
|
etName.setText("");
|
|
|
|
|
etName.setHint("请输入密码");
|
|
|
|
|
builder.setTitle("为便签设置新密码");
|
|
|
|
|
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
String password = etName.getText().toString();
|
|
|
|
|
mWorkingNote.setPassword(password);
|
|
|
|
|
Toast.makeText(NoteEditActivity.this,"密码设置成功", Toast.LENGTH_SHORT).show();
|
|
|
|
|
InputMethodManager inputMethodManager =(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
|
|
inputMethodManager.hideSoftInputFromWindow(etName.getWindowToken(),0);
|
|
|
|
|
dialog.dismiss();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
InputMethodManager inputMethodManager = (InputMethodManager)
|
|
|
|
|
getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
|
|
inputMethodManager.hideSoftInputFromWindow(etName.getWindowToken(),0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
final Dialog dialog = builder.setView(view).show();
|
|
|
|
|
}
|
|
|
|
|
if(mWorkingNote.getPassword()==null){
|
|
|
|
|
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
|
|
|
|
View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text,null);
|
|
|
|
|
final EditText etName = (EditText)view.findViewById(R.id.et_foler_name);
|
|
|
|
|
etName.setText("");
|
|
|
|
|
etName.setHint("请输入密码");
|
|
|
|
|
builder.setTitle("为便签设置新密码");
|
|
|
|
|
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
String password = etName.getText().toString();
|
|
|
|
|
mWorkingNote.setPassword(password);
|
|
|
|
|
if ( mWorkingNote.getPassword() != null ){
|
|
|
|
|
Toast.makeText(NoteEditActivity.this,"密码设置成功", Toast.LENGTH_SHORT).show();
|
|
|
|
|
}
|
|
|
|
|
InputMethodManager inputMethodManager =(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
|
|
inputMethodManager.hideSoftInputFromWindow(etName.getWindowToken(),0);
|
|
|
|
|
dialog.dismiss();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
InputMethodManager inputMethodManager = (InputMethodManager)
|
|
|
|
|
getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
|
|
inputMethodManager.hideSoftInputFromWindow(etName.getWindowToken(),0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
final Dialog dialog = builder.setView(view).show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|