diff --git a/src/java/net/micode/notes/ui/DeletePasscodeActivity.java b/src/java/net/micode/notes/ui/DeletePasscodeActivity.java index ad2c6ba1..3bdd7cdc 100644 --- a/src/java/net/micode/notes/ui/DeletePasscodeActivity.java +++ b/src/java/net/micode/notes/ui/DeletePasscodeActivity.java @@ -36,6 +36,8 @@ public class DeletePasscodeActivity extends AppCompatActivity { Toast.makeText(DeletePasscodeActivity.this, R.string.note_passcode_deleted, Toast.LENGTH_SHORT).show(); mWorkingNote.setPasscode(""); mWorkingNote.saveNote(); + NoteEditActivity Activity = new NoteEditActivity(); + Activity.NoteEditActivity.finish(); Intent intent = new Intent(DeletePasscodeActivity.this, NoteEditActivity.class); intent.setAction(Intent.ACTION_VIEW); intent.putExtra(Intent.EXTRA_UID, noteId); diff --git a/src/java/net/micode/notes/ui/NoteEditActivity.java b/src/java/net/micode/notes/ui/NoteEditActivity.java index ffad76f3..fdc57304 100644 --- a/src/java/net/micode/notes/ui/NoteEditActivity.java +++ b/src/java/net/micode/notes/ui/NoteEditActivity.java @@ -155,14 +155,14 @@ public class NoteEditActivity extends Activity implements OnClickListener, private Pattern mPattern; private boolean Locked; /* 用以判断是否已解锁 */ - private boolean verified = false; + static Activity NoteEditActivity; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.note_edit); - + NoteEditActivity = this; if (savedInstanceState == null && !initActivityState(getIntent())) { finish(); return; @@ -273,10 +273,6 @@ public class NoteEditActivity extends Activity implements OnClickListener, if (intent.hasExtra("lock")) { Locked = false; } - if (intent.hasExtra("verified")){ - verified = true; - } - return true; } @@ -575,6 +571,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, break; case R.id.menu_set_star: mWorkingNote.setStar(mWorkingNote.getStarId()==1? "0" : "1"); + System.out.println(mWorkingNote.hasPasscode()); break; //设置密码 case R.id.menu_set_passcode: @@ -582,6 +579,7 @@ public class NoteEditActivity extends Activity implements OnClickListener, break; //删除密码 case R.id.menu_delete_passcode: + System.out.println(mWorkingNote.hasPasscode()); deletePasscode(); break; case R.id.menu_delete: @@ -953,7 +951,8 @@ public class NoteEditActivity extends Activity implements OnClickListener, Intent intent = new Intent(this,DeletePasscodeActivity.class); intent.putExtra(Intent.EXTRA_UID, mWorkingNote.getNoteId()); startActivity(intent); - finish(); + //finish(); + saveNote(); } saveNote(); } diff --git a/src/java/net/micode/notes/ui/SetLockActivity.java b/src/java/net/micode/notes/ui/SetLockActivity.java index a45109f7..a994a809 100644 --- a/src/java/net/micode/notes/ui/SetLockActivity.java +++ b/src/java/net/micode/notes/ui/SetLockActivity.java @@ -27,6 +27,7 @@ public class SetLockActivity extends AppCompatActivity { */ private boolean isFirst = true; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -35,7 +36,17 @@ public class SetLockActivity extends AppCompatActivity { initViews(); initEvents(); } - + public void onBackPressed() { + super.onBackPressed();//注释掉这行,back键不退出activity + Intent pre = getIntent(); + //将密码写入数据库 + long noteId = pre.getLongExtra(Intent.EXTRA_UID, 0); + Intent intent = new Intent(SetLockActivity.this, NoteEditActivity.class); + intent.setAction(Intent.ACTION_VIEW); + intent.putExtra("lock",0); + intent.putExtra(Intent.EXTRA_UID, noteId); + startActivity(intent); + } private void initEvents() { mLockPatternView.setLockListener(new LockPatternView.OnLockListener() { @Override diff --git a/src/java/net/micode/notes/ui/UnlockActivity.java b/src/java/net/micode/notes/ui/UnlockActivity.java index 48be72fb..3bba83e8 100644 --- a/src/java/net/micode/notes/ui/UnlockActivity.java +++ b/src/java/net/micode/notes/ui/UnlockActivity.java @@ -35,7 +35,7 @@ public class UnlockActivity extends AppCompatActivity { public boolean isPassword() { if (mPasswordStr.equals(password)) { Toast.makeText(UnlockActivity.this, "密码正确", Toast.LENGTH_SHORT).show(); - Intent intent = new Intent(UnlockActivity.this, NoteEditActivity.class); + Intent intent = new Intent(UnlockActivity.this,NoteEditActivity.class); intent.setAction(Intent.ACTION_VIEW); intent.putExtra("lock",0); intent.putExtra(Intent.EXTRA_UID, noteId); diff --git a/src/res/drawable-hdpi/lock.png b/src/res/drawable-hdpi/lock.png index bd517f36..2cb64d01 100644 Binary files a/src/res/drawable-hdpi/lock.png and b/src/res/drawable-hdpi/lock.png differ diff --git a/src/res/layout/note_item.xml b/src/res/layout/note_item.xml index ce3aa157..4fecec40 100644 --- a/src/res/layout/note_item.xml +++ b/src/res/layout/note_item.xml @@ -92,8 +92,8 @@