From d973ee4d06980502879ab7cf0b39362808640956 Mon Sep 17 00:00:00 2001 From: JackyMa <2433069615@qq.com> Date: Fri, 5 Nov 2021 08:44:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=94=A8=E6=88=B7=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E4=BD=93=E9=AA=8C=E4=B9=8BActivity=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notes/ui/DeletePasscodeActivity.java | 2 ++ .../net/micode/notes/ui/NoteEditActivity.java | 13 ++++++------- .../net/micode/notes/ui/SetLockActivity.java | 13 ++++++++++++- .../net/micode/notes/ui/UnlockActivity.java | 2 +- src/res/drawable-hdpi/lock.png | Bin 1221 -> 1304 bytes src/res/layout/note_item.xml | 4 ++-- 6 files changed, 23 insertions(+), 11 deletions(-) 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 bd517f36fb4dad41cd6056a5a43e2cb99e48ef23..2cb64d01c022a117c8180ab5b43205938ca66985 100644 GIT binary patch delta 1271 zcmVq?1Die@FI4nwZ(R}r9>?c#$bX` z>(7gcJ|HAwVwC!VXhMDSFTPn4e|QlzCZYj((8L#isss{=@d2<=+TB)K+u6z!V3a7k zGrM!lkk&Nanc3;xJ9g5{JfHKO?|gI4xp(f(5dO!fxB+XNtbcaDqF@IDokUm<#)j(@ z2$z^~nScq$!EvQ*eP>+4)u`!F)B#-liB>J|fc7%;69n88CME-a5YeX!_+aOZRS4rF zViTzVzivXNW@|5lu@}INA_M{a1;W9UYQ1sW1ylqveBB}w;AcJCuE9ADV5=n3XDlc? zwwUE9NqBReCw~)d4r^RbZ(}ImM*t0ib5EC9JuM4cdIc17t2ctGzsn-%iNonzjM6_B zWyFvwzz;20wNA+l1H3H+xiT?Em}mq92BR0?UI1$w`_kzvPNo0uSzK#u8*Cv}fTEsx zAK+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@8kY5H}R7{{6D z`21U7-pGWF0EUvpQNUZwnfB47acQ3`1Mt&IthjPeOcAgtJ~&M=b)Fugxt~{`!|XrD zon3{YSsuKZc;FR)$K!l3aO|%+fBcs7xR_RC!m6Xf4S$f>_l%D%&wn6IG+P%3LAXC| zECG|I>+ehBD`||93Ye}{Hg%Y$0IY}#n5B0U=8}s8#N#(M+sBdwCOuaIz^;iGz}OQN zOlJ1(SyhDnR?~kzNnp}*H2@5862RKU!H96gZ2Gq*CDH4-QxiWhV@t%CQ?NLe4oIh-y z$Dc9@IxBHC4~h#h0Je{M{ueU-r2#aI%5DO^-IWC4gw^yn$RxL5YuCgtV60#4i@}f9 z-Sz>Q81evg@f;EMcO}7i&+`0-Ws%U2|%WNLfbsw&O&Z^#waVGtN=*@jv@9k&~;FuVuD&oEzcOzEs$q&C4fr=@`PMg zfaDZ_Jl{^CTEN!Ds{kfISR)H9S9``80EaBke=1F!R4rh~e2b?Euw-LW?nM#-IJN3l zW`F)>$%IG*CZcU-v-NE+7l{CDqj~_~MmLi`LN}+ zZ!ZD#AduVwWd)QiP|g84O@ikLI2^Vo1K}jQD*J2~V_DQmFlwuuc(<5^P7whRc&F*M zKZ?@h7?m9i`Y?;uNSmSoNOMRMx4Fs$rGIb$n0M8^_6NPhH1x`YMD%_p!HbQG27n0n zm`y+O8twAdw)0`H(mdRUg8`>{Kmlb%M!pP zQJ-3_e_xb9+Yp}sxL1kz`45cZZic!bC>LL7010?2 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 @@