同意
pull/9/head
pvqf6mep3 3 years ago
commit 8f76320fef

@ -303,7 +303,7 @@ public class NotesProvider extends ContentProvider {
return null;
}
public static boolean isStarNote(Long id) {
public static boolean isStarNoteOrLockedNote(Long id) {
SQLiteDatabase db;
db = mHelper.getReadableDatabase();
Cursor cursor = null;
@ -313,7 +313,7 @@ public class NotesProvider extends ContentProvider {
//遍历游标
for (int index = 1; index < cursor.getCount(); index++) {
cursor.moveToNext();
if (cursor.getLong(SqlNote.ID_COLUMN) == id && !cursor.getString(SqlNote.STAR_COLUMN).equals("0")) {
if (cursor.getLong(SqlNote.ID_COLUMN) == id && !cursor.getString(SqlNote.STAR_COLUMN).equals("0") && !cursor.getString(SqlNote.PASSCODE_COLUMN).equals("")) {
cursor.close();
return true;
}

@ -49,7 +49,7 @@ public class SqlNote {
NoteColumns.NOTES_COUNT, NoteColumns.PARENT_ID, NoteColumns.SNIPPET, NoteColumns.TYPE,
NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE, NoteColumns.SYNC_ID,
NoteColumns.LOCAL_MODIFIED, NoteColumns.ORIGIN_PARENT_ID, NoteColumns.GTASK_ID,
NoteColumns.VERSION,NoteColumns.TOP,NoteColumns.STAR,
NoteColumns.VERSION,NoteColumns.TOP,NoteColumns.STAR,NoteColumns.PASSCODE,
};
public static final int ID_COLUMN = 0;
@ -90,6 +90,8 @@ public class SqlNote {
public static final int STAR_COLUMN = 18;
public static final int PASSCODE_COLUMN = 18;
private Context mContext;
private ContentResolver mContentResolver;

@ -65,7 +65,7 @@ public class DataUtils {
/**
* if can delete
*/
if (NotesProvider.isStarNote(id)){
if (NotesProvider.isStarNoteOrLockedNote(id)){
continue;
}
ContentProviderOperation.Builder builder = ContentProviderOperation

@ -143,6 +143,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private static final int SHORTCUT_ICON_TITLE_MAX_LEN = 10;
private static final int REQUEST_SET_PASSCODE = 0;
private static final int REQUEST_UNLOCK = 1;
public static final String TAG_CHECKED = String.valueOf('\u221A');
public static final String TAG_UNCHECKED = String.valueOf('\u25A1');
@ -151,6 +154,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private String mUserQuery;
private Pattern mPattern;
private boolean Locked; /* 用以判断是否已解锁 */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -261,6 +266,12 @@ public class NoteEditActivity extends Activity implements OnClickListener,
return false;
}
mWorkingNote.setOnSettingStatusChangedListener(this);
Locked = mWorkingNote.hasPasscode();//设置便签解锁状态;
if (intent.hasExtra("lock")) {
Locked = false;
}
return true;
}
@ -296,6 +307,14 @@ public class NoteEditActivity extends Activity implements OnClickListener,
*/
showAlertHeader();
showTopHeader();
//如果设置了密码,启动输入密码页面
if (mWorkingNote.hasPasscode() && Locked) {
saveNote();
Intent intent = new Intent(this,UnlockActivity.class);
intent.putExtra(Intent.EXTRA_UID, mWorkingNote.getNoteId());
startActivityForResult(intent,REQUEST_SET_PASSCODE);
finish();
}
}
private void showAlertHeader() {

Loading…
Cancel
Save