同意
pull/9/head
pvqf6mep3 3 years ago
commit fee5ff4369

@ -36,6 +36,8 @@ public class DeletePasscodeActivity extends AppCompatActivity {
Toast.makeText(DeletePasscodeActivity.this, R.string.note_passcode_deleted, Toast.LENGTH_SHORT).show(); Toast.makeText(DeletePasscodeActivity.this, R.string.note_passcode_deleted, Toast.LENGTH_SHORT).show();
mWorkingNote.setPasscode(""); mWorkingNote.setPasscode("");
mWorkingNote.saveNote(); mWorkingNote.saveNote();
NoteEditActivity Activity = new NoteEditActivity();
Activity.NoteEditActivity.finish();
Intent intent = new Intent(DeletePasscodeActivity.this, NoteEditActivity.class); Intent intent = new Intent(DeletePasscodeActivity.this, NoteEditActivity.class);
intent.setAction(Intent.ACTION_VIEW); intent.setAction(Intent.ACTION_VIEW);
intent.putExtra(Intent.EXTRA_UID, noteId); intent.putExtra(Intent.EXTRA_UID, noteId);

@ -155,14 +155,14 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private Pattern mPattern; private Pattern mPattern;
private boolean Locked; /* 用以判断是否已解锁 */ private boolean Locked; /* 用以判断是否已解锁 */
private boolean verified = false;
static Activity NoteEditActivity;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.setContentView(R.layout.note_edit); this.setContentView(R.layout.note_edit);
NoteEditActivity = this;
if (savedInstanceState == null && !initActivityState(getIntent())) { if (savedInstanceState == null && !initActivityState(getIntent())) {
finish(); finish();
return; return;
@ -273,10 +273,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
if (intent.hasExtra("lock")) { if (intent.hasExtra("lock")) {
Locked = false; Locked = false;
} }
if (intent.hasExtra("verified")){
verified = true;
}
return true; return true;
} }
@ -575,6 +571,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
break; break;
case R.id.menu_set_star: case R.id.menu_set_star:
mWorkingNote.setStar(mWorkingNote.getStarId()==1? "0" : "1"); mWorkingNote.setStar(mWorkingNote.getStarId()==1? "0" : "1");
System.out.println(mWorkingNote.hasPasscode());
break; break;
//设置密码 //设置密码
case R.id.menu_set_passcode: case R.id.menu_set_passcode:
@ -582,6 +579,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
break; break;
//删除密码 //删除密码
case R.id.menu_delete_passcode: case R.id.menu_delete_passcode:
System.out.println(mWorkingNote.hasPasscode());
deletePasscode(); deletePasscode();
break; break;
case R.id.menu_delete: case R.id.menu_delete:
@ -953,7 +951,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
Intent intent = new Intent(this,DeletePasscodeActivity.class); Intent intent = new Intent(this,DeletePasscodeActivity.class);
intent.putExtra(Intent.EXTRA_UID, mWorkingNote.getNoteId()); intent.putExtra(Intent.EXTRA_UID, mWorkingNote.getNoteId());
startActivity(intent); startActivity(intent);
finish(); //finish();
saveNote();
} }
saveNote(); saveNote();
} }

@ -27,6 +27,7 @@ public class SetLockActivity extends AppCompatActivity {
*/ */
private boolean isFirst = true; private boolean isFirst = true;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -35,7 +36,17 @@ public class SetLockActivity extends AppCompatActivity {
initViews(); initViews();
initEvents(); 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() { private void initEvents() {
mLockPatternView.setLockListener(new LockPatternView.OnLockListener() { mLockPatternView.setLockListener(new LockPatternView.OnLockListener() {
@Override @Override

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -92,8 +92,8 @@
<ImageView <ImageView
android:id="@+id/iv_lock" android:id="@+id/iv_lock"
android:layout_width="17dp" android:layout_width="16dp"
android:layout_height="17dp" android:layout_height="16dp"
android:layout_gravity="top|left" android:layout_gravity="top|left"
android:layout_marginRight="15sp" /> android:layout_marginRight="15sp" />
</FrameLayout> </FrameLayout>

Loading…
Cancel
Save