HINOTOR 2 years ago
parent e4162b3f71
commit 6b24d79105

@ -1,4 +1,4 @@
#Thu Jun 08 10:42:28 CST 2023
#Thu Jun 08 11:19:04 CST 2023
base.0=D\:\\programming\\gitProject1\\src\\Notes-master\\app\\build\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex
renamed.0=classes.dex
path.0=classes.dex

@ -204,7 +204,6 @@ public class SqlNote {
mWidgetId = c.getInt(WIDGET_ID_COLUMN);
mWidgetType = c.getInt(WIDGET_TYPE_COLUMN);
mVersion = c.getLong(VERSION_COLUMN);
mPassWord = c.getString(PASSWORD_COLUMN);
}
@ -398,7 +397,6 @@ public class SqlNote {
note.put(NoteColumns.WIDGET_ID, mWidgetId);
note.put(NoteColumns.WIDGET_TYPE, mWidgetType);
note.put(NoteColumns.ORIGIN_PARENT_ID, mOriginParent);
note.put(NoteColumns.PASSWORD, mPassWord);
js.put(GTaskStringUtils.META_HEAD_NOTE, note);

@ -155,39 +155,37 @@ public class DataUtils {
}
public static boolean visibleInNoteDatabase(ContentResolver resolver, long noteId, int type) {
//在数据库中是否可见
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),
null,
NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "<>" + Notes.ID_TRASH_FOLER,
new String [] {String.valueOf(type)},
null);//查询note是否可以找到
null);
boolean exist = false;
if (cursor != null) {
if (cursor.getCount() > 0) {
exist = true;//找到
exist = true;
}
cursor.close();
}
return exist;//可见
return exist;
}
//the new
public static boolean visibleInTrashNoteDatabase(ContentResolver resolver, long noteId, int type) {
//在数据库中是否存在此回收便签
Cursor cursor = resolver.query(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId),
null,
NoteColumns.TYPE + "=? AND " + NoteColumns.PARENT_ID + "=" + Notes.ID_TRASH_FOLER,
new String [] {String.valueOf(type)},
null);//查询note是否可以找到
null);
boolean exist = false;
if (cursor != null) {
if (cursor.getCount() > 0) {
exist = true;//找到
exist = true;
}
cursor.close();
}
return exist;//可见
return exist;
}
public static boolean existInNoteDatabase(ContentResolver resolver, long noteId) {

@ -264,7 +264,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN
| WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
} else if(TextUtils.equals(Intent.ACTION_INSERT_OR_EDIT, intent.getAction())) {
// New note
long folderId = intent.getLongExtra(Notes.INTENT_EXTRA_FOLDER_ID, 0);
int widgetId = intent.getIntExtra(Notes.INTENT_EXTRA_WIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID);
@ -312,9 +311,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
@Override
protected void onResume() {//能获得用户焦点:可以操作
protected void onResume() {
super.onResume();
initNoteScreen();//初始化便签屏幕
initNoteScreen();
}
private void initNoteScreen() {
@ -984,73 +983,58 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
private void setPwd() {//the new private
final AlertDialog.Builder builder = new AlertDialog.Builder(this);//初始化对话框
View view = LayoutInflater.from(this).inflate(R.layout.dialog_pwd, null);//加载对话框的布局文件
// 获取密码输入框和切换密码可见性按钮
final EditText etPwd = (EditText) view.findViewById(R.id.set_private_pwd);//初始化对话框里的文本对象
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
View view = LayoutInflater.from(this).inflate(R.layout.dialog_pwd, null);
final EditText etPwd = (EditText) view.findViewById(R.id.set_private_pwd);
final ToggleButton passwordVisibleToggleButton = (ToggleButton) view.findViewById(R.id.password_visible_toggle_button);
// 添加切换按钮的点击事件监听器
passwordVisibleToggleButton.setOnClickListener(v -> {
if (passwordVisibleToggleButton.isChecked()) {
// 如果切换按钮被选中,显示密码文本
etPwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
} else {
// 否则隐藏密码文本
etPwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
});
showSoftInput();//显示软键盘
builder.setPositiveButton(android.R.string.ok, null);//确定按钮
builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> {//取消按钮
hideSoftInput(etPwd);//隐藏软键盘
showSoftInput();
builder.setPositiveButton(android.R.string.ok, null);
builder.setNegativeButton(android.R.string.cancel, (dialog, which) -> {
hideSoftInput(etPwd);
});
// builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
// public void onClick(DialogInterface dialog, int which) {//取消按钮
// hideSoftInput();//隐藏软键盘
// }
// });
final Dialog dialog = builder.setView(view).show();//显示出来
final Button positive = (Button) dialog.findViewById(android.R.id.button1);//加载确定按钮布局文件
positive.setOnClickListener(v -> {//设置确定按钮的接收器
hideSoftInput(etPwd);//点击确定后收起软键盘
final Dialog dialog = builder.setView(view).show();
final Button positive = (Button) dialog.findViewById(android.R.id.button1);
positive.setOnClickListener(v -> {
hideSoftInput(etPwd);
String Password = etPwd.getText().toString();
String regex = "[a-zA-Z0-9]{5,8}";
if(Password.matches(regex)){
if (!TextUtils.isEmpty(Password)) {//输入不为空
//Toast.makeText(getApplicationContext(), Password, Toast.LENGTH_SHORT).show();
//加到数据库里
if (!TextUtils.isEmpty(Password)) {
mWorkingNote.setmPwd(Password);
// mWorkingNote.setPrivateType(mWorkingNote.getPrivateMode() == 0 ?//改workingnote的mPrivateMode的值对应上文的界面设置
// TextNote.MODE_PRIVATE_TYPE : 0);
//saveNote();
}
} else {
Toast.makeText(getApplicationContext(),"密码设置错误字母或数字5-8位",Toast.LENGTH_LONG).show();
}
dialog.dismiss();//撤销对话框
//显示钥匙图标
dialog.dismiss();
onPause();
});
if (TextUtils.isEmpty(etPwd.getText())) {//如果为空,则不能选择确定按钮
if (TextUtils.isEmpty(etPwd.getText())) {
positive.setEnabled(false);
}
etPwd.addTextChangedListener(new TextWatcher() {//添加文本更改监听器,即判断文本更改状态
public void beforeTextChanged(CharSequence s, int start, int count, int after) {//文本更改之前(未完成)
etPwd.addTextChangedListener(new TextWatcher() {
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// TODO Auto-generated method stub
}
public void onTextChanged(CharSequence s, int start, int before, int count) {//当前文本改变触发,
if (TextUtils.isEmpty(etPwd.getText())) {//文本为空确定按键不可用,不为空则可用
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (TextUtils.isEmpty(etPwd.getText())) {
positive.setEnabled(false);
} else {
positive.setEnabled(true);
}
}
public void afterTextChanged(Editable s) {//文本修改之后(未完成)
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});

@ -56,7 +56,6 @@ public class NoteItemData {
private static final int TYPE_COLUMN = 9;
private static final int WIDGET_ID_COLUMN = 10;
private static final int WIDGET_TYPE_COLUMN = 11;
private static final int PASSWORD_COLUMN = 12;
private static final int ORIGIN_PARENT_ID_COLUMN = 13;
@ -72,13 +71,10 @@ public class NoteItemData {
private int mType;
private int mWidgetId;
private int mWidgetType;
private String mPassWord;
private int mOriginParentId;
private String mName;
private String mPhoneNumber;
private boolean mIsLastItem;
private boolean mIsFirstItem;
private boolean mIsOnlyOneItem;
@ -100,7 +96,6 @@ public class NoteItemData {
mType = cursor.getInt(TYPE_COLUMN);
mWidgetId = cursor.getInt(WIDGET_ID_COLUMN);
mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN);
mPassWord = cursor.getString(PASSWORD_COLUMN);
mOriginParentId = cursor.getInt(ORIGIN_PARENT_ID_COLUMN);

@ -98,6 +98,7 @@ import java.util.HashSet;
public class NotesListActivity extends Activity implements OnClickListener, OnItemLongClickListener {
private int mode = -1;
private static final int FOLDER_NOTE_LIST_QUERY_TOKEN = 0;
private static final int FOLDER_LIST_QUERY_TOKEN = 1;
@ -1186,7 +1187,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
return true;
}
if (ids.size() == 0) {
Log.d(TAG, "no id is in the hashset");//无note删除
Log.d(TAG, "no id is in the hashset");
return true;
}
@ -1196,17 +1197,16 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
ContentProviderOperation.Builder builder = ContentProviderOperation
.newUpdate(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id));
if (DataUtils.existInNoteDatabase(resolver, mWorkingNote.getNoteOriginId())) {
builder.withValue(Notes.NoteColumns.PARENT_ID, mWorkingNote.getNoteOriginId());//设置父节点为原本的文件夹的id
builder.withValue(Notes.NoteColumns.PARENT_ID, mWorkingNote.getNoteOriginId());
} else {
builder.withValue(Notes.NoteColumns.PARENT_ID, Notes.ID_ROOT_FOLDER);//设置原本的父节点为默认文件夹id
builder.withValue(Notes.NoteColumns.PARENT_ID, Notes.ID_ROOT_FOLDER);
}
builder.withValue(NoteColumns.ORIGIN_PARENT_ID, Notes.ID_ROOT_FOLDER);//设置原本的父节点为默认文件夹id
builder.withValue(NoteColumns.ORIGIN_PARENT_ID, Notes.ID_ROOT_FOLDER);
builder.withValue(NoteColumns.LOCAL_MODIFIED, 1);
operationList.add(builder.build());
}
try {
//对于一些异常进行处理与汇报applyBatch一次性处理一个操作列表
ContentProviderResult[] results = resolver.applyBatch(Notes.AUTHORITY, operationList);
if (results == null || results.length == 0 || results[0] == null) {
Log.d(TAG, "update notes failed, ids:" + ids.toString());
@ -1221,29 +1221,27 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
return false;
}
//the new
private void testTime() {
long time = System.currentTimeMillis();
long keepTime = 30 * 24 * 60 * 60 * 1000L;//保留30天
long keepTime = 30 * 24 * 60 * 60 * 1000L;
Long deleteTime = time - keepTime;
NotesDatabaseHelper mHelper = new NotesDatabaseHelper(NotesListActivity.this);
SQLiteDatabase db = null;//数据库对象
SQLiteDatabase db = null;
try {
db = mHelper.getWritableDatabase();
} catch (Exception e) {
e.printStackTrace();
}
if (db != null) {
Cursor cursor = db.query("note", new String[]{NoteColumns.ID, NoteColumns.CREATED_DATE},//对数据库查询的光标
Cursor cursor = db.query("note", new String[]{NoteColumns.ID, NoteColumns.CREATED_DATE},
"parent_id = ?", new String[]{String.valueOf(Notes.ID_TRASH_FOLER)}, null, null, null);
final int ID_COLUMN = 0;
final int CREATE_DATE_COLUMN = 1;
if (cursor.moveToFirst()) {//防止遗漏,先把光标移到最上面
if (cursor.moveToFirst()) {
do {
long p = cursor.getLong(CREATE_DATE_COLUMN);
HashSet<Long> ids = new HashSet<Long>();
ids.add(cursor.getLong(ID_COLUMN));
//找对应的时间差
if (p < deleteTime) {
DataUtils.batchDeleteNotes(getContentResolver(), ids);
}
@ -1252,4 +1250,4 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
cursor.close();
}
}
}
}

@ -42,7 +42,7 @@ public class PasswordLockActivity extends Activity {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.passwordlock_note);
//the new 背景切换
getWindow().setBackgroundDrawableResource(R.drawable.password_lock_background);
long id = getIntent().getLongExtra(Intent.EXTRA_UID,0);
@ -57,7 +57,6 @@ public class PasswordLockActivity extends Activity {
mbutton.setOnClickListener((l)->{
testPassword(mWorkingNote.getNoteId());
});
//mWorkingNote = WorkingNote.load(this,);
}
@ -71,63 +70,57 @@ public class PasswordLockActivity extends Activity {
public void testPassword(long id){
final AlertDialog.Builder builder = new AlertDialog.Builder(this);//初始化对话框
View view = LayoutInflater.from(this).inflate(R.layout.dialog_pwd, null);//加载对话框的布局文件
final EditText etPwd = (EditText) view.findViewById(R.id.set_private_pwd);//初始化对话框里的文本对象
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
View view = LayoutInflater.from(this).inflate(R.layout.dialog_pwd, null);
final EditText etPwd = (EditText) view.findViewById(R.id.set_private_pwd);
final ToggleButton passwordVisibleToggleButton = (ToggleButton) view.findViewById(R.id.password_visible_toggle_button);
// 添加切换按钮的点击事件监听器
passwordVisibleToggleButton.setOnClickListener(v -> {
if (passwordVisibleToggleButton.isChecked()) {
// 如果切换按钮被选中,显示密码文本
etPwd.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
} else {
// 否则隐藏密码文本
etPwd.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
});
showSoftInput();//显示软键盘
builder.setPositiveButton(android.R.string.ok, null);//确定按钮
showSoftInput();
builder.setPositiveButton(android.R.string.ok, null);
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {//取消按钮
hideSoftInput(etPwd);//隐藏软键盘
public void onClick(DialogInterface dialog, int which) {
hideSoftInput(etPwd);
}
});
final Dialog dialog = builder.setView(view).show();//显示出来
final Dialog dialog = builder.setView(view).show();
final Button positive = (Button) dialog.findViewById(android.R.id.button1);//加载确定按钮布局文件
final Button positive = (Button) dialog.findViewById(android.R.id.button1);
positive.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {//设置确定按钮的接收器
hideSoftInput(etPwd);//点击确定后收起软键盘
String Password = etPwd.getText().toString();//文本框里的输入值
if (!TextUtils.isEmpty(Password)) {//输入不为空
//Toast.makeText(getApplicationContext(), Password, Toast.LENGTH_SHORT).show();
public void onClick(View v) {
hideSoftInput(etPwd);
String Password = etPwd.getText().toString();
if (!TextUtils.isEmpty(Password)) {
inputPwd = Password;
openNote(id);
}
dialog.dismiss();//撤销对话框
dialog.dismiss();
}
});
if (TextUtils.isEmpty(etPwd.getText())) {//如果文件夹名称为空,则不能选择确定按钮
if (TextUtils.isEmpty(etPwd.getText())) {
positive.setEnabled(false);
}
etPwd.addTextChangedListener(new TextWatcher() {//添加文本更改监听器,即判断文本更改状态
public void beforeTextChanged(CharSequence s, int start, int count, int after) {//文本更改之前(未完成)
etPwd.addTextChangedListener(new TextWatcher() {
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// TODO Auto-generated method stub
}
public void onTextChanged(CharSequence s, int start, int before, int count) {//当前文本改变触发,
if (TextUtils.isEmpty(etPwd.getText())) {//文本为空确定按键不可用,不为空则可用
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (TextUtils.isEmpty(etPwd.getText())) {
positive.setEnabled(false);
} else {
positive.setEnabled(true);
}
}
public void afterTextChanged(Editable s) {//文本修改之后(未完成)
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});
@ -135,7 +128,6 @@ public class PasswordLockActivity extends Activity {
public void onBackPressed() {
super.onBackPressed();
//返回到NotesListActivity
Intent intent = new Intent(this, NotesListActivity.class);
startActivity(intent);
}
@ -153,6 +145,4 @@ public class PasswordLockActivity extends Activity {
inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
}
}
}

@ -96,7 +96,7 @@ public class TrashNoteActivity extends Activity {
mUserQuery = intent.getStringExtra(SearchManager.USER_QUERY);
}
System.out.println("--------->>>>"+noteId);//方便查看
System.out.println("--------->>>>"+noteId);
if (!DataUtils.visibleInTrashNoteDatabase(getContentResolver(), noteId, Notes.TYPE_NOTE)) {
Intent jump = new Intent(this, NotesListActivity.class);
@ -146,13 +146,9 @@ public class TrashNoteActivity extends Activity {
if(mFontSizeId >= ResourceParser.TextAppearanceResources.getResourcesSize()) {
mFontSizeId = ResourceParser.BG_DEFAULT_FONT_SIZE;
}
//mNoteBgColorSelector = findViewById(R.id.note_bg_color_selector);
mEditTextList = (LinearLayout) findViewById(R.id.note_edit_list);
}
//Android生命周期中的一个方法用于表示当前Activity由暂停状态恢复到前台可见状态时调用的方法。
//也就是说当用户从后台返回到前台或者当前Activity从其他Activity返回时onResume()方法会被自动调用。
//onResume()方法可以用于处理相关的UI更新
protected void onResume() {
super.onResume();
initNoteScreen();
@ -160,17 +156,12 @@ public class TrashNoteActivity extends Activity {
}
private void initNoteScreen() {
//字体
mNoteEditor.setTextAppearance(this, ResourceParser.TextAppearanceResources
.getTexAppearanceResource(mFontSizeId));
//内容
mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery));
mNoteEditor.setSelection(mNoteEditor.getText().length());
//头部背景
mHeadViewPanel.setBackgroundResource(mWorkingNote.getTitleBgResId());
//背景颜色
mNoteEditorPanel.setBackgroundResource(mWorkingNote.getBgColorResId());
mNoteHeaderHolder.tvModified.setText(DateUtils.formatDateTime(this,
mWorkingNote.getModifiedDate(), DateUtils.FORMAT_SHOW_DATE
| DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME
@ -259,16 +250,16 @@ public class TrashNoteActivity extends Activity {
}
private void moveNoteToSrcFolder(ContentResolver resolver, long id) {
ContentValues values = new ContentValues();//获取note信息
ContentValues values = new ContentValues();
if(DataUtils.visibleInTrashNoteDatabase(getContentResolver(),
mWorkingNote.getNoteOriginId(), Notes.TYPE_NOTE)){
values.put(Notes.NoteColumns.PARENT_ID, mWorkingNote.getNoteOriginId());//设置父节点为原本的文件夹的id
values.put(Notes.NoteColumns.PARENT_ID, mWorkingNote.getNoteOriginId());
} else {
values.put(Notes.NoteColumns.PARENT_ID, Notes.ID_ROOT_FOLDER);//设置原本的父节点为默认文件夹id
values.put(Notes.NoteColumns.PARENT_ID, Notes.ID_ROOT_FOLDER);
}
values.put(Notes.NoteColumns.ORIGIN_PARENT_ID, Notes.ID_ROOT_FOLDER);//设置原本的父节点为默认文件夹id
values.put(Notes.NoteColumns.LOCAL_MODIFIED, 1);//设置修改符号为1
resolver.update(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id), values, null, null);//对移动过的便签进行数据的更新
values.put(Notes.NoteColumns.ORIGIN_PARENT_ID, Notes.ID_ROOT_FOLDER);
values.put(Notes.NoteColumns.LOCAL_MODIFIED, 1);
resolver.update(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, id), values, null, null);
}
private void showToast(int resId) {
@ -278,5 +269,4 @@ public class TrashNoteActivity extends Activity {
private void showToast(int resId, int duration) {
Toast.makeText(this, resId, duration).show();
}
}
}
Loading…
Cancel
Save