Compare commits

...

50 Commits

Author SHA1 Message Date
prmlf8pou 678438a6c9 Delete 'doc/第八组汇报.pptx'
2 years ago
prmlf8pou b5e48f69d8 ADD file via upload
2 years ago
Joker21a 49b9d55d9c ppt上传
2 years ago
Joker21a 2f42925c6a 讲评后略做改动
2 years ago
Joker21a caa2a8f2b2 自评报告
2 years ago
Joker21a 82c08bbfc5 最终版本
2 years ago
Joker21a 218b4ecef8 Merge branch 'main' of https://bdgit.educoder.net/pma2p6wf3/MIUInote
2 years ago
Joker21a 56b425a156 字体文件添加
2 years ago
Joker21a f5492ea663 添加更换字体功能
2 years ago
prmlf8pou 81b78d8158 Merge pull request '课程末期的合并请求' (#7) from zhoushiyu_br into main
2 years ago
Joker21a b272a08c45 功能完整版
2 years ago
Joker21a 873dccb3c5 Merge branch 'main' of https://bdgit.educoder.net/pma2p6wf3/MIUInote
2 years ago
Joker21a 50b9f26ebb 1.2
2 years ago
PickupRAIN c3b66b9ccc 更改了背景图片
2 years ago
prmlf8pou 29c5beaa38 Delete 'doc/开源软件的质量分析报告文档.docx'
2 years ago
prmlf8pou f8d6ec6bf1 Merge pull request '课程末期的合并请求' (#3) from zhoushiyu_br into main
2 years ago
PickupRAIN 2036f4ebd1 最终报告的提交
2 years ago
13365576176 83d1245b11 完成格式与内容整合
2 years ago
13365576176 3b3439e0fb 进行格式调整与内容整合
2 years ago
Joker21a bcf8d19e6b Merge branch 'main' of https://bdgit.educoder.net/pma2p6wf3/MIUInote
2 years ago
Joker21a 9119283e01 标注恢复
2 years ago
PickupRAIN 698f802163 修改了原本登陆免疫时间过长的问题,修改了引用的bug
2 years ago
PickupRAIN 2c8b5d5798 Merge branch 'main' of https://bdgit.educoder.net/pma2p6wf3/MIUInote into zhoushiyu_br
2 years ago
Joker21a 1aa3d2d970 try
2 years ago
Joker21a 881de8a614 Merge branch 'main' of https://bdgit.educoder.net/pma2p6wf3/MIUInote
2 years ago
Joker21a 559217e0ca 维护了目录栈
2 years ago
PickupRAIN df07081bfb 增加了字体文件
2 years ago
PickupRAIN 985aa477ef 11
2 years ago
Joker21a e524c032d9 无注释 功能完全版
2 years ago
Joker21a d33aed2988 1.7
2 years ago
Joker21a 89b6e50cdc 1.7
2 years ago
Joker21a 9f1064c718 1.7
2 years ago
Joker21a 9dee96731d 1.7
2 years ago
Joker21a 8ad2353fa5 1.2
2 years ago
Joker21a ce98f5822d 1.2
2 years ago
Joker21a ed3a624350 1.2
2 years ago
Joker21a eebddca62f 1.2
2 years ago
Joker21a 006bbb08df 1.2
2 years ago
Joker21a 4f9b53791b 包图更新2 by王毅
2 years ago
Joker21a dd473e2cff 泛读包图更正,by王毅
2 years ago
Joker21a f5fac3d441 泛读1.0
2 years ago
Joker21a 075f5cd4eb 泛读1
2 years ago
Joker21a 397eebb070 init
2 years ago
pma2p6wf3 50a1cedde1 Delete 'doc/泛读标注维护.0.0.docx'
2 years ago
Joker21a ae64cdda93 init
2 years ago
prmlf8pou 5c538c3cef Delete 'doc/泛读标注维护.0.0.docx'
2 years ago
prmlf8pou 6a1db28298 init
2 years ago
prmlf8pou 4dd32a3560 Delete 'doc/泛读标注维护.0.0.docx'
2 years ago
prmlf8pou 627e338f15 ADD file via upload
2 years ago
prmlf8pou ccad84f029 Delete 'doc/泛读标注维护.0.0.docx'
2 years ago

@ -1,2 +0,0 @@
# MIUInote

Binary file not shown.

@ -0,0 +1,435 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.model;
import android.appwidget.AppWidgetManager;
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.text.TextUtils;
import android.util.Log;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.CallNote;
import net.micode.notes.data.Notes.DataColumns;
import net.micode.notes.data.Notes.DataConstants;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.data.Notes.TextNote;
import net.micode.notes.tool.ResourceParser.NoteBgResources;
/**
*
* @ProjectName: xiaomibianqian
* @Package: model
* @ClassName: WorkingNote
* @Description: 便
* 便便
* NoteEditActivitiesNotesfrom dataNote NoteListActivity SqlData
* NoteSettingChangedListenerNoteEditActivities
*
* @Author: zhoushiyu_br
* @CreateDate: 2023.12.16
* @UpdateUser:
* @UpdateDate: 2023.12.21
* @UpdateRemark:
* @Version: PickupRAIN
*/
public class WorkingFolder {
// Note for the working note
private String mPassword;
private Note mNote;//这个在Note里面定义了Note类的基本类型
// Note Id
private long mNoteId;
// Note content
private String mContent;
// Note mode
private int mMode;
private long mAlertDate;
private long mModifiedDate;//最后的修改日期
private int mBgColorId;//定义的颜色的ID
private int mWidgetId;//定义了一个int类型用来定位到哪一个小组件被使用
private int mWidgetType;//定义了一个int类型用来区分使用了什么类型的小组件
private long mFolderId;//用来定位便签放在哪个文件夹
private Context mContext;
public boolean PRIVATE_MODE = false;
private static final String TAG = "WorkingNote"; //定义为静态变量,保证不能再被更改。防止数据出现异常
private boolean mIsDeleted; //定义一个布尔变量,用来保存是否要被删除。通过查看用法,发现在后面保存|修改的时候要进行判断。
private NoteSettingChangedListener mNoteSettingStatusListener;//定义了一个接口具体是在NoteEditActivities中实现实现对于便签是否修改的监听
/**
* DataColumnDataColumn
* DataColumn便
* loadNoteData
* 12.22getContentResolver()
* getContentResolverProjection
* 访访
*/
public static final String[] DATA_PROJECTION = new String[] {
DataColumns.ID,//在Note里面定义一个接口类型
DataColumns.CONTENT,
DataColumns.MIME_TYPE,
DataColumns.DATA1,
DataColumns.DATA2,
DataColumns.DATA3,
DataColumns.DATA4,
};
//这里的用法基本同上方,不过这些接口最后使用在数据库中
public static final String[] NOTE_PROJECTION = new String[] {
NoteColumns.PARENT_ID,
NoteColumns.ALERTED_DATE,
NoteColumns.BG_COLOR_ID,
NoteColumns.WIDGET_ID,
NoteColumns.WIDGET_TYPE,
NoteColumns.MODIFIED_DATE
};
/**
*
*/
private static final int DATA_ID_COLUMN = 0;
private static final int DATA_CONTENT_COLUMN = 1;
private static final int DATA_MIME_TYPE_COLUMN = 2;
private static final int DATA_MODE_COLUMN = 3;
private static final int NOTE_PARENT_ID_COLUMN = 0;
private static final int NOTE_ALERTED_DATE_COLUMN = 1;
private static final int NOTE_BG_COLOR_ID_COLUMN = 2;
private static final int NOTE_WIDGET_ID_COLUMN = 3;
private static final int NOTE_WIDGET_TYPE_COLUMN = 4;
private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
// New note construct
//初始化一个新的操作的Note
private WorkingFolder(Context context, long folderId) {
mContext = context;
mAlertDate = 0;//这里为什么是0还存疑
mModifiedDate = System.currentTimeMillis();//获取系统时间,保存给最后修改时间
mFolderId = folderId;
mNote = new Note();
mNoteId = 0;
mIsDeleted = false;
mMode = 0;
mWidgetType = Notes.TYPE_WIDGET_INVALIDE;
}
//由于传入了noteId,所以是对一个已经存在的便签进行操作。
//由于一些基本的已经定义,所以传入的变量很少。
// Existing note construct
private WorkingFolder(Context context, long noteId, long folderId) {
mContext = context;
mNoteId = noteId;
mFolderId = folderId;
mIsDeleted = false;
mNote = new Note();
loadNote();
}
/**
* @author: zhoushiyu_PickupRAIN
* @methodsName: loadNote
* @description: URI
* @param:
* ->Notes.CONTENT_NOTE_URI:URI
* ->NOTE_PROJECTION :
* ->NOTE_PROJECTION
* @return: String
* @throws: Nopes
*
*/
private void loadNote() {
//定义一个cursor游标用来操作数据。这里传入了很多量如URI、Id、和来自Projection的一系列。
Cursor cursor = mContext.getContentResolver().query(
ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mNoteId), NOTE_PROJECTION, null,
null, null);
//设置一个cursor按行提取各种信息保存到对应的变量中
if (cursor != null) {
if (cursor.moveToFirst()) {
mFolderId = cursor.getLong(NOTE_PARENT_ID_COLUMN);
mBgColorId = cursor.getInt(NOTE_BG_COLOR_ID_COLUMN);
mWidgetId = cursor.getInt(NOTE_WIDGET_ID_COLUMN);
mWidgetType = cursor.getInt(NOTE_WIDGET_TYPE_COLUMN);
mAlertDate = cursor.getLong(NOTE_ALERTED_DATE_COLUMN);
mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN);
}
cursor.close();
} else {
Log.e(TAG, "No note with id:" + mNoteId);
throw new IllegalArgumentException("Unable to find note with id " + mNoteId);
}
loadNoteData();
}
//基本同上一个函数。值得注意的是这里对数据进行了筛选通过selection,还对MIME进行了判断后加载
private void loadNoteData() {
Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION,
DataColumns.NOTE_ID + "=?", new String[] {
String.valueOf(mNoteId)
}, null);
if (cursor != null) {
if (cursor.moveToFirst()) {
do {
String type = cursor.getString(DATA_MIME_TYPE_COLUMN);
if (DataConstants.NOTE.equals(type)) {
mContent = cursor.getString(DATA_CONTENT_COLUMN);
mMode = cursor.getInt(DATA_MODE_COLUMN);
mNote.setTextDataId(cursor.getLong(DATA_ID_COLUMN));
} else if (DataConstants.CALL_NOTE.equals(type)) {
mNote.setCallDataId(cursor.getLong(DATA_ID_COLUMN));
} else {
Log.d(TAG, "Wrong note type with type:" + type);
}
} while (cursor.moveToNext());
}
cursor.close();
} else {
Log.e(TAG, "No data with id:" + mNoteId);
throw new IllegalArgumentException("Unable to find note's data with id " + mNoteId);
}
}
//简单的初始化函数,一会看一下用法
public static WorkingFolder createEmptyNote(Context context, long folderId, int widgetId,
int widgetType, int defaultBgColorId) {
WorkingFolder note = new WorkingFolder(context, folderId);
note.setBgColorId(defaultBgColorId);
note.setWidgetId(widgetId);
note.setWidgetType(widgetType);
return note;
}
public static WorkingFolder load(Context context, long id) {
return new WorkingFolder(context, id, 0);
}
//这里涉及了多线程的操作。
public synchronized boolean saveNote() {
if (isWorthSaving()) {
if (!existInDatabase()) {
if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) {
Log.e(TAG, "Create new note fail with id:" + mNoteId);
return false;
}
}
//由于没有这个便签所以报错并返回false
mNote.syncNote(mContext, mNoteId);//这一行是同步信息的操作
/**
* Update widget content if there exist any widget of this note
*/
//对小组件的各种属性进行判断,来确定是否有组件,进行保存
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE
&& mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onWidgetChanged();
}
return true;
} else {
return false;
}
}
/**
*
*
*/
public boolean existInDatabase() {
return mNoteId > 0;
}
private boolean isWorthSaving() {
if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent))
|| (existInDatabase() && !mNote.isLocalModified())) {
return false;
} else {
return true;
}
}
//这个变量设置是用来记录状态设定是否有发生过更改。
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {
mNoteSettingStatusListener = l;
}
public void setAlertDate(long date, boolean set) {
if (date != mAlertDate) {
mAlertDate = date;
mNote.setNoteValue(NoteColumns.ALERTED_DATE, String.valueOf(mAlertDate));
}
if (mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onClockAlertChanged(date, set);
}
}
public void markDeleted(boolean mark) {
mIsDeleted = mark;
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onWidgetChanged();
}
}
public void setBgColorId(int id) {
if (id != mBgColorId) {
mBgColorId = id;
if (mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onBackgroundColorChanged();
}
mNote.setNoteValue(NoteColumns.BG_COLOR_ID, String.valueOf(id));
}
}
//在EditActivities中使用用来设定在list时的状态
public void setCheckListMode(int mode) {
if (mMode != mode) {
if (mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode);
}
mMode = mode;
mNote.setTextData(TextNote.MODE, String.valueOf(mMode));
}
}
public void setWidgetType(int type) {
if (type != mWidgetType) {
mWidgetType = type;
mNote.setNoteValue(NoteColumns.WIDGET_TYPE, String.valueOf(mWidgetType));
}
}
public void setWidgetId(int id) {
if (id != mWidgetId) {
mWidgetId = id;
mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId));
}
}
public void setWorkingText(String text) {
if (!TextUtils.equals(mContent, text)) {
mContent = text;
mNote.setTextData(DataColumns.CONTENT, mContent);
}
}
/**
*
*
* 使onOptionsItemSelected NoteEditActivities
*/
//这里的callNote我没有搞懂
public void convertToCallNote(String phoneNumber, long callDate) {
mNote.setCallData(CallNote.CALL_DATE, String.valueOf(callDate));
mNote.setCallData(CallNote.PHONE_NUMBER, phoneNumber);
mNote.setNoteValue(NoteColumns.PARENT_ID, String.valueOf(Notes.ID_CALL_RECORD_FOLDER));
}
public void setPassword(String password){
// mPassword=password;
mNote.setNoteValue(NoteColumns.PASSWORD,password);
}
public boolean hasClockAlert() {
return (mAlertDate > 0 ? true : false);
}
public String getContent() {
return mContent;
}
public long getAlertDate() {
return mAlertDate;
}
public long getModifiedDate() {
return mModifiedDate;
}
public int getBgColorResId() {
return NoteBgResources.getNoteBgResource(mBgColorId);
}
public int getBgColorId() {
return mBgColorId;
}
public int getTitleBgResId() {
return NoteBgResources.getNoteTitleBgResource(mBgColorId);
}
public int getCheckListMode() {
return mMode;
}
public long getNoteId() {
return mNoteId;
}
public long getFolderId() {
return mFolderId;
}
public int getWidgetId() {
return mWidgetId;
}
public int getWidgetType() {
return mWidgetType;
}
public String getPassword() { return mPassword; }
//声明了一个接口具体都在EditActivies中进行实现。主要是一个监听listener来设置各个量的改变
public interface NoteSettingChangedListener {
/**
* Called when the background color of current note has just changed
*/
void onBackgroundColorChanged();
/**
* Called when user set clock
*/
void onClockAlertChanged(long date, boolean set);
/**
* Call when user create note from widget
*/
void onWidgetChanged();
/**
* Call when switch between check list mode and normal mode
* @param oldMode is previous mode before change
* @param newMode is new mode
*/
void onCheckListModeChanged(int oldMode, int newMode);
}
}

@ -669,7 +669,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
break;
}
}
}
});
builder.setPositiveButton("OK", new DialogInterface.OnClickListener(){

@ -71,12 +71,14 @@ import net.micode.notes.tool.ResourceParser;
import net.micode.notes.ui.NotesListAdapter.AppWidgetAttribute;
import net.micode.notes.widget.NoteWidgetProvider_2x;
import net.micode.notes.widget.NoteWidgetProvider_4x;
import net.micode.notes.model.WorkingFolder;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Stack;
public class NotesListActivity extends Activity implements OnClickListener, OnItemLongClickListener {
private static final int FOLDER_NOTE_LIST_QUERY_TOKEN = 0;
@ -115,6 +117,9 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
private long mCurrentFolderId;
private Stack<Long> mFolderIdStack=new Stack<Long>();
private ContentResolver mContentResolver;
private ModeCallback mModeCallBack;
@ -551,6 +556,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}
private void openFolder(NoteItemData data) {
Long TempId=new Long(mCurrentFolderId);
mFolderIdStack.add(TempId);
mCurrentFolderId = data.getId();
startAsyncNotesListQuery();
if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) {
@ -692,8 +699,14 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
public void onBackPressed() {
switch (mState) {
case SUB_FOLDER:
mCurrentFolderId = Notes.ID_ROOT_FOLDER;
mState = ListEditState.NOTE_LIST;
mCurrentFolderId = mFolderIdStack.pop().longValue();
//mCurrentFolderId = Notes.ID_ROOT_FOLDER;
if(mCurrentFolderId == Notes.ID_ROOT_FOLDER){
mState = ListEditState.NOTE_LIST;
}
else{
mState = ListEditState.SUB_FOLDER;
}
startAsyncNotesListQuery();
mTitleBar.setVisibility(View.GONE);
break;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 19 KiB

@ -25,9 +25,6 @@
<item
android:id="@+id/menu_delete"
android:title="@string/menu_delete"/>
<item
android:id="@+id/menu_select_font"
android:title="Select font"/>
<item
android:id="@+id/menu_font_size"
@ -57,5 +54,4 @@
android:title="Enter private mode"/>
</menu>
Loading…
Cancel
Save