diff --git a/doc/泛读标注维护.0.0 (功能增强版).docx b/doc/泛读标注维护.0.0 (功能增强版).docx
new file mode 100644
index 0000000..69a6ea9
Binary files /dev/null and b/doc/泛读标注维护.0.0 (功能增强版).docx differ
diff --git a/doc/泛读标注维护.0.0.docx b/doc/泛读标注维护.0.0.docx
deleted file mode 100644
index 1833f4e..0000000
Binary files a/doc/泛读标注维护.0.0.docx and /dev/null differ
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index e5c7d47..4c482c1 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -36,12 +36,12 @@
android:icon="@drawable/icon_app"
android:label="@string/app_name" >
@@ -50,6 +50,36 @@
+
+
+
+
+
+
+
+
+
Type : INTEGER (long)
*/
public static final String VERSION = "version";
+
+ public static final String PASSWORD= "password";
}
public interface DataColumns {
diff --git a/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java b/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java
index ffe5d57..4e1fa12 100644
--- a/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java
+++ b/src/main/java/net/micode/notes/data/NotesDatabaseHelper.java
@@ -30,7 +30,7 @@ import net.micode.notes.data.Notes.NoteColumns;
public class NotesDatabaseHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "note.db";
- private static final int DB_VERSION = 4;
+ private static final int DB_VERSION = 5;
public interface TABLE {
public static final String NOTE = "note";
@@ -60,7 +60,8 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
NoteColumns.LOCAL_MODIFIED + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.ORIGIN_PARENT_ID + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," +
- NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0" +
+ NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0," +
+ NoteColumns.PASSWORD + " TEXT DEFAULT NULL " +
")";
private static final String CREATE_DATA_TABLE_SQL =
@@ -321,6 +322,10 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
upgradeToV4(db);
oldVersion++;
}
+ if(oldVersion == 4){
+ upgradeToV5(db);
+ oldVersion++;
+ }
if (reCreateTriggers) {
reCreateNoteTableTriggers(db);
@@ -359,4 +364,9 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
db.execSQL("ALTER TABLE " + TABLE.NOTE + " ADD COLUMN " + NoteColumns.VERSION
+ " INTEGER NOT NULL DEFAULT 0");
}
+ private void upgradeToV5(SQLiteDatabase db){
+ db.execSQL("ALTER TABLE " + TABLE.NOTE + " ADD COLUMN " + NoteColumns.PASSWORD
+ + " TEXT DEFAULT NULL ");
+ }
+
}
diff --git a/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java b/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java
index b3b61e7..0ea27b7 100644
--- a/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java
+++ b/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java
@@ -77,8 +77,8 @@ public class GTaskASyncTask extends AsyncTask {
pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,
NotesListActivity.class), 0);
}
- notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content,
- pendingIntent);
+// notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content,
+// pendingIntent);
mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification);
}
diff --git a/src/main/java/net/micode/notes/model/WorkingNote.java b/src/main/java/net/micode/notes/model/WorkingNote.java
index be081e4..7733b4b 100644
--- a/src/main/java/net/micode/notes/model/WorkingNote.java
+++ b/src/main/java/net/micode/notes/model/WorkingNote.java
@@ -31,10 +31,28 @@ 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: 创建了一个正在工作的便签类,其中有大量的参数,包括参量类、布尔值类、区分类的变量
+ * 另外,封装了一系列的函数,其中有返回私有变量的,与数据库进行操作的,在不同情况下操作的(如新建的便签与修改的便签)
+ * 主要交互的包、类:NoteEditActivities,Notes(from data)Note NoteListActivity SqlData
+ * 另外,有创建一些接口,比如NoteSettingChangedListener,在NoteEditActivities中具体实现
+ *
+ * @Author: zhoushiyu_br
+ * @CreateDate: 2023.12.16
+ * @UpdateUser: 更新者:
+ * @UpdateDate: 2023.12.21
+ * @UpdateRemark: 更新说明:
+ * @Version: 这次更新主要是修改了之前代码批注不够规范的问题,结合上课毛教员对于问题的指出,对格式进行了优化——PickupRAIN
+ */
public class WorkingNote {
// Note for the working note
- private Note mNote;
+
+ private String mPassword;
+ private Note mNote;//这个在Note里面定义了Note类的基本类型,
// Note Id
private long mNoteId;
// Note content
@@ -44,26 +62,34 @@ public class WorkingNote {
private long mAlertDate;
- private long mModifiedDate;
+ private long mModifiedDate;//最后的修改日期
- private int mBgColorId;
+ private int mBgColorId;//定义的颜色的ID
- private int mWidgetId;
+ private int mWidgetId;//定义了一个int类型,用来定位到哪一个小组件被使用
- private int mWidgetType;
+ private int mWidgetType;//定义了一个int类型,用来区分使用了什么类型的小组件
- private long mFolderId;
+ private long mFolderId;//用来定位便签放在哪个文件夹
private Context mContext;
- private static final String TAG = "WorkingNote";
+ public boolean PRIVATE_MODE = false;
+ private static final String TAG = "WorkingNote"; //定义为静态变量,保证不能再被更改。防止数据出现异常
- private boolean mIsDeleted;
-
- private NoteSettingChangedListener mNoteSettingStatusListener;
+ private boolean mIsDeleted; //定义一个布尔变量,用来保存是否要被删除。通过查看用法,发现在后面保存|修改的时候要进行判断。
+ private NoteSettingChangedListener mNoteSettingStatusListener;//定义了一个接口,具体是在NoteEditActivities中实现,实现对于便签是否修改的监听
+ /**
+ * 定义一个数组,保存DataColumn数组当中的一些列变量。关于DataColumn的注解我写在了定义处。
+ * 之所以用一个字符串数组来调用DataColumn接口,是为了“方便在进行数据库操作时可以一次性指定需要查询的列”?
+ * 这个数组只有在loadNoteData这个函数的时候进行了调用。将数据加载到
+ * 12.22更新,我学习了getContentResolver()的用法
+ * 实际上,getContentResolver是用来查询数据库的,这里定义的Projection是所有属性的集合。数据库查询,按列进行
+ * 在按列查询时,在数据库访问到底,只需要在数组中继续访问即可。关于函数详解我会写在函数的定义处;
+ */
public static final String[] DATA_PROJECTION = new String[] {
- DataColumns.ID,
+ DataColumns.ID,//在Note里面定义一个接口类型
DataColumns.CONTENT,
DataColumns.MIME_TYPE,
DataColumns.DATA1,
@@ -71,7 +97,7 @@ public class WorkingNote {
DataColumns.DATA3,
DataColumns.DATA4,
};
-
+//这里的用法基本同上方,不过这些接口最后使用在数据库中
public static final String[] NOTE_PROJECTION = new String[] {
NoteColumns.PARENT_ID,
NoteColumns.ALERTED_DATE,
@@ -80,7 +106,9 @@ public class WorkingNote {
NoteColumns.WIDGET_TYPE,
NoteColumns.MODIFIED_DATE
};
-
+ /**
+ * 定义了一系列的基础值。
+ */
private static final int DATA_ID_COLUMN = 0;
private static final int DATA_CONTENT_COLUMN = 1;
@@ -101,11 +129,15 @@ public class WorkingNote {
private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
+
+
+
// New note construct
+ //初始化一个新的操作的Note
private WorkingNote(Context context, long folderId) {
mContext = context;
- mAlertDate = 0;
- mModifiedDate = System.currentTimeMillis();
+ mAlertDate = 0;//这里为什么是0还存疑
+ mModifiedDate = System.currentTimeMillis();//获取系统时间,保存给最后修改时间
mFolderId = folderId;
mNote = new Note();
mNoteId = 0;
@@ -113,7 +145,8 @@ public class WorkingNote {
mMode = 0;
mWidgetType = Notes.TYPE_WIDGET_INVALIDE;
}
-
+ //由于传入了noteId,所以是对一个已经存在的便签进行操作。
+ //由于一些基本的已经定义,所以传入的变量很少。
// Existing note construct
private WorkingNote(Context context, long noteId, long folderId) {
mContext = context;
@@ -124,11 +157,24 @@ public class WorkingNote {
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);
@@ -145,7 +191,7 @@ public class WorkingNote {
}
loadNoteData();
}
-
+ //基本同上一个函数。值得注意的是这里对数据进行了筛选(通过selection),还对MIME进行了判断后加载
private void loadNoteData() {
Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION,
DataColumns.NOTE_ID + "=?", new String[] {
@@ -160,6 +206,7 @@ public class WorkingNote {
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 {
@@ -173,7 +220,7 @@ public class WorkingNote {
throw new IllegalArgumentException("Unable to find note's data with id " + mNoteId);
}
}
-
+//简单的初始化函数,一会看一下用法
public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId,
int widgetType, int defaultBgColorId) {
WorkingNote note = new WorkingNote(context, folderId);
@@ -186,7 +233,7 @@ public class WorkingNote {
public static WorkingNote load(Context context, long id) {
return new WorkingNote(context, id, 0);
}
-
+//这里涉及了多线程的操作。
public synchronized boolean saveNote() {
if (isWorthSaving()) {
if (!existInDatabase()) {
@@ -195,12 +242,14 @@ public class WorkingNote {
return false;
}
}
+//由于没有这个便签,所以报错,并返回false
- mNote.syncNote(mContext, mNoteId);
+ 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) {
@@ -212,6 +261,10 @@ public class WorkingNote {
}
}
+ /**
+ * 以下定义、封装了一系列的实用函数,用于一些私有量的设置与判断
+ *
+ */
public boolean existInDatabase() {
return mNoteId > 0;
}
@@ -224,7 +277,7 @@ public class WorkingNote {
return true;
}
}
-
+//这个变量设置是用来记录状态设定是否有发生过更改。
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {
mNoteSettingStatusListener = l;
}
@@ -256,7 +309,7 @@ public class WorkingNote {
mNote.setNoteValue(NoteColumns.BG_COLOR_ID, String.valueOf(id));
}
}
-
+//在EditActivities中使用,用来设定在list时的状态
public void setCheckListMode(int mode) {
if (mMode != mode) {
if (mNoteSettingStatusListener != null) {
@@ -288,11 +341,23 @@ public class WorkingNote {
}
}
+ /**
+ * 从这里一直向上大概的都是一些设置状态的函数。
+ * 原因是设置的私有量,保证数据的可靠性
+ * 具体使用在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);
@@ -342,6 +407,8 @@ public class WorkingNote {
return mWidgetType;
}
+ public String getPassword() { return mPassword; }
+//声明了一个接口,具体都在EditActivies中进行实现。主要是一个监听(listener),来设置各个量的改变
public interface NoteSettingChangedListener {
/**
* Called when the background color of current note has just changed
diff --git a/src/main/java/net/micode/notes/tool/ResourceParser.java b/src/main/java/net/micode/notes/tool/ResourceParser.java
index 1ad3ad6..6f8b4b0 100644
--- a/src/main/java/net/micode/notes/tool/ResourceParser.java
+++ b/src/main/java/net/micode/notes/tool/ResourceParser.java
@@ -30,6 +30,8 @@ public class ResourceParser {
public static final int GREEN = 3;
public static final int RED = 4;
+ public static final int DUCK = 5;
+
public static final int BG_DEFAULT_COLOR = YELLOW;
public static final int TEXT_SMALL = 0;
@@ -45,7 +47,10 @@ public class ResourceParser {
R.drawable.edit_blue,
R.drawable.edit_white,
R.drawable.edit_green,
- R.drawable.edit_red
+ R.drawable.edit_red,
+ R.drawable.note_bg_photo_wangyi
+
+
};
private final static int [] BG_EDIT_TITLE_RESOURCES = new int [] {
@@ -53,7 +58,9 @@ public class ResourceParser {
R.drawable.edit_title_blue,
R.drawable.edit_title_white,
R.drawable.edit_title_green,
- R.drawable.edit_title_red
+ R.drawable.edit_title_red,
+ R.drawable.note_bg_photo_wangyi
+
};
public static int getNoteBgResource(int id) {
@@ -80,7 +87,8 @@ public class ResourceParser {
R.drawable.list_blue_up,
R.drawable.list_white_up,
R.drawable.list_green_up,
- R.drawable.list_red_up
+ R.drawable.list_red_up,
+ R.drawable.note_bg_photo_wangyi
};
private final static int [] BG_NORMAL_RESOURCES = new int [] {
@@ -88,7 +96,8 @@ public class ResourceParser {
R.drawable.list_blue_middle,
R.drawable.list_white_middle,
R.drawable.list_green_middle,
- R.drawable.list_red_middle
+ R.drawable.list_red_middle,
+ R.drawable.note_bg_photo_wangyi
};
private final static int [] BG_LAST_RESOURCES = new int [] {
@@ -97,6 +106,7 @@ public class ResourceParser {
R.drawable.list_white_down,
R.drawable.list_green_down,
R.drawable.list_red_down,
+ R.drawable.note_bg_photo_wangyi
};
private final static int [] BG_SINGLE_RESOURCES = new int [] {
@@ -104,7 +114,8 @@ public class ResourceParser {
R.drawable.list_blue_single,
R.drawable.list_white_single,
R.drawable.list_green_single,
- R.drawable.list_red_single
+ R.drawable.list_red_single,
+ R.drawable.note_bg_photo_wangyi
};
public static int getNoteBgFirstRes(int id) {
diff --git a/src/main/java/net/micode/notes/ui/ChangeLoginPasswordActivity.java b/src/main/java/net/micode/notes/ui/ChangeLoginPasswordActivity.java
new file mode 100644
index 0000000..6925781
--- /dev/null
+++ b/src/main/java/net/micode/notes/ui/ChangeLoginPasswordActivity.java
@@ -0,0 +1,127 @@
+package net.micode.notes.ui;
+
+import android.app.Activity;
+import android.app.AlarmManager;
+import android.app.AlertDialog;
+import android.app.PendingIntent;
+import android.app.SearchManager;
+import android.appwidget.AppWidgetManager;
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.graphics.Paint;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.TextUtils;
+import android.text.format.DateUtils;
+import android.text.style.BackgroundColorSpan;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.WindowManager;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import net.micode.notes.R;
+import net.micode.notes.data.Notes;
+import net.micode.notes.data.Notes.TextNote;
+import net.micode.notes.model.WorkingNote;
+import net.micode.notes.model.WorkingNote.NoteSettingChangedListener;
+import net.micode.notes.tool.DataUtils;
+import net.micode.notes.tool.ResourceParser;
+import net.micode.notes.tool.ResourceParser.TextAppearanceResources;
+import net.micode.notes.ui.DateTimePickerDialog.OnDateTimeSetListener;
+import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener;
+import net.micode.notes.widget.NoteWidgetProvider_2x;
+import net.micode.notes.widget.NoteWidgetProvider_4x;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.Toast;
+
+public class ChangeLoginPasswordActivity extends Activity {
+ EditText OldPassword;
+ EditText NewPassword;
+ EditText ReWritePassword;
+ Button Acknowledged;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.change_login_password_activity);
+ getWindow().setSoftInputMode(
+ WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
+ | WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
+ OldPassword=(EditText) findViewById(R.id.old_password);
+ NewPassword=(EditText) findViewById(R.id.new_password);
+ ReWritePassword=(EditText) findViewById(R.id.ack_password);
+ Acknowledged=(Button)findViewById(R.id.Bt_Acknowledged);
+ Acknowledged.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String old_password = OldPassword.getText().toString();
+ String new_password = NewPassword.getText().toString();
+ String ack_password = ReWritePassword.getText().toString();
+
+ SharedPreferences pref=getSharedPreferences("user management",MODE_PRIVATE);
+
+ String login_password=pref.getString("password","");
+
+ if(old_password.equals("")==true || new_password.equals("")==true || ack_password.equals("")==true) {
+ Toast.makeText(ChangeLoginPasswordActivity.this, "密码不能为空", Toast.LENGTH_SHORT).show();
+ }else if (new_password.equals(ack_password) == false) {
+ Toast.makeText(ChangeLoginPasswordActivity.this, "新建密码与重复密码不匹配,请重新输入密码", Toast.LENGTH_SHORT).show();
+ ReWritePassword.setText("");
+ }else if(old_password.equals(login_password) == false){
+ Toast.makeText(ChangeLoginPasswordActivity.this, "原有密码错误,请重新输入密码", Toast.LENGTH_SHORT).show();
+ OldPassword.setText("");
+ }
+ else if (new_password.equals(ack_password) == true && old_password.equals(login_password) == true){
+ SharedPreferences.Editor editor=getSharedPreferences("user management", MODE_PRIVATE).edit();
+ editor.putString("password",new_password);
+ editor.apply();
+ Toast.makeText(ChangeLoginPasswordActivity.this, "修改密码成功", Toast.LENGTH_SHORT).show();
+ Intent intent=new Intent(ChangeLoginPasswordActivity.this, LoginActivity.class);
+ startActivity(intent);
+ finish();
+ }
+ }
+ });
+ }
+
+ @Override
+ public void onBackPressed() {
+ Intent intent=new Intent(ChangeLoginPasswordActivity.this, LoginActivity.class);
+ startActivity(intent);
+ finish();
+ }
+}
+
diff --git a/src/main/java/net/micode/notes/ui/LoginActivity.java b/src/main/java/net/micode/notes/ui/LoginActivity.java
new file mode 100644
index 0000000..caae81f
--- /dev/null
+++ b/src/main/java/net/micode/notes/ui/LoginActivity.java
@@ -0,0 +1,163 @@
+package net.micode.notes.ui;
+import android.app.Activity;
+import android.app.AlarmManager;
+import android.app.AlertDialog;
+import android.app.PendingIntent;
+import android.app.ProgressDialog;
+import android.app.SearchManager;
+import android.appwidget.AppWidgetManager;
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.graphics.Paint;
+import android.os.Bundle;
+import android.os.Handler;
+import android.preference.PreferenceManager;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.TextUtils;
+import android.text.format.DateUtils;
+import android.text.style.BackgroundColorSpan;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import net.micode.notes.R;
+import net.micode.notes.data.Notes;
+import net.micode.notes.data.Notes.TextNote;
+import net.micode.notes.model.WorkingNote;
+import net.micode.notes.model.WorkingNote.NoteSettingChangedListener;
+import net.micode.notes.tool.DataUtils;
+import net.micode.notes.tool.ResourceParser;
+import net.micode.notes.tool.ResourceParser.TextAppearanceResources;
+import net.micode.notes.ui.DateTimePickerDialog.OnDateTimeSetListener;
+import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener;
+import net.micode.notes.widget.NoteWidgetProvider_2x;
+import net.micode.notes.widget.NoteWidgetProvider_4x;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+public class LoginActivity extends Activity{
+ private EditText accountEdit;
+
+ private EditText passwordEdit;
+
+ private Button login;
+
+ private Button cancel;
+
+ private Button change;
+
+ private long last_login_time = 0 ;
+
+ public static final long MAX_LOGIN_TIME = 9999999;
+
+
+
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState){
+ super.onCreate(savedInstanceState);
+
+ SharedPreferences pref=getSharedPreferences("user management",MODE_PRIVATE);
+ boolean user_boolean = pref.getBoolean("user",false);//获取用户是否设置了密码
+ if(!user_boolean) //User_boolean = false时,(没有设置密码),直接跳转到便签主界面
+ {
+ SharedPreferences.Editor editor=getSharedPreferences("user management", MODE_PRIVATE).edit();
+ editor.putString("password","123456");
+ editor.putBoolean("user",true);
+ editor.apply();
+ }
+
+ SharedPreferences login_time_get = getSharedPreferences("login time",MODE_PRIVATE);
+ boolean is_first_login = login_time_get.getBoolean("is_first_login",false);
+
+ setContentView(R.layout.login_activity);
+ accountEdit = (EditText) findViewById(R.id.account);
+ passwordEdit = (EditText) findViewById(R.id.password);
+ login = (Button) findViewById(R.id.login);
+ cancel = (Button) findViewById(R.id.cancel);
+ change = (Button) findViewById(R.id.change_password);
+
+
+ long current_time = System.currentTimeMillis();
+
+ cancel.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ Toast.makeText(LoginActivity.this, R.string.app_already_quit, Toast.LENGTH_LONG).show();
+ finish();
+ }
+ });
+
+ Long current_login_time = login_time_get.getLong("current login time",0);
+ if((is_first_login)&&(current_time - current_login_time <= MAX_LOGIN_TIME)){
+ SharedPreferences.Editor editor=getSharedPreferences("login time", MODE_PRIVATE).edit();
+ editor.putLong("current login time",System.currentTimeMillis());
+ editor.apply();
+ Intent intent = new Intent(LoginActivity.this,NotesListActivity.class);
+ startActivity(intent);
+ finish();
+ }
+
+ else{
+ if(!is_first_login){
+ SharedPreferences.Editor editor=getSharedPreferences("login time", MODE_PRIVATE).edit();
+ editor.putLong("current login time",System.currentTimeMillis());
+ editor.putBoolean("is_first_login",true);
+ editor.apply();
+ }
+
+ login.setOnClickListener(new View.OnClickListener(){
+ public void onClick(View v) {
+ String account = accountEdit.getText().toString();
+ String password = passwordEdit.getText().toString();
+
+ SharedPreferences pref=getSharedPreferences("user management",MODE_PRIVATE);
+ String share_password=pref.getString("password","");
+
+ if(account.equals("hei") && password.equals(share_password)){
+ ProgressDialog progressDialog = new ProgressDialog(LoginActivity.this);
+ progressDialog.setTitle(R.string.Loading);
+ progressDialog.setMessage("Loading...");
+ progressDialog.setCancelable(true);
+ progressDialog.show();;
+ Intent intent = new Intent(LoginActivity.this,NotesListActivity.class);
+ startActivity(intent);
+ finish();
+ }else {
+ Toast.makeText(LoginActivity.this, R.string.invalid,Toast.LENGTH_SHORT).show();
+ }
+ }
+ });
+
+ change.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(LoginActivity.this,ChangeLoginPasswordActivity.class);
+ startActivity(intent);
+ finish();
+ }
+ });
+ }
+ }
+}
diff --git a/src/main/java/net/micode/notes/ui/LoginView.java b/src/main/java/net/micode/notes/ui/LoginView.java
new file mode 100644
index 0000000..deca847
--- /dev/null
+++ b/src/main/java/net/micode/notes/ui/LoginView.java
@@ -0,0 +1,76 @@
+package net.micode.notes.ui;
+
+import android.app.Activity;
+import android.app.AlarmManager;
+import android.app.AlertDialog;
+import android.app.PendingIntent;
+import android.app.SearchManager;
+import android.appwidget.AppWidgetManager;
+import android.content.ContentUris;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.graphics.Paint;
+import android.os.Bundle;
+import android.os.Handler;
+import android.preference.PreferenceManager;
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.TextUtils;
+import android.text.format.DateUtils;
+import android.text.style.BackgroundColorSpan;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.WindowManager;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import net.micode.notes.R;
+import net.micode.notes.data.Notes;
+import net.micode.notes.data.Notes.TextNote;
+import net.micode.notes.model.WorkingNote;
+import net.micode.notes.model.WorkingNote.NoteSettingChangedListener;
+import net.micode.notes.tool.DataUtils;
+import net.micode.notes.tool.ResourceParser;
+import net.micode.notes.tool.ResourceParser.TextAppearanceResources;
+import net.micode.notes.ui.DateTimePickerDialog.OnDateTimeSetListener;
+import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener;
+import net.micode.notes.widget.NoteWidgetProvider_2x;
+import net.micode.notes.widget.NoteWidgetProvider_4x;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+public class LoginView extends Activity
+{
+ Handler mHandler=new Handler();
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.login_view);
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ Intent intent = new Intent(LoginView.this, LoginActivity.class);
+ startActivity(intent);
+ finish();
+ }
+ },2000);
+ }
+}
diff --git a/src/main/java/net/micode/notes/ui/NoteEditActivity.java b/src/main/java/net/micode/notes/ui/NoteEditActivity.java
index 862883b..b640329 100644
--- a/src/main/java/net/micode/notes/ui/NoteEditActivity.java
+++ b/src/main/java/net/micode/notes/ui/NoteEditActivity.java
@@ -19,6 +19,7 @@ package net.micode.notes.ui;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.AlertDialog;
+import android.app.Dialog;
import android.app.PendingIntent;
import android.app.SearchManager;
import android.appwidget.AppWidgetManager;
@@ -27,7 +28,9 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.content.res.AssetManager;
import android.graphics.Paint;
+import android.graphics.Typeface;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.Spannable;
@@ -43,6 +46,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
+import android.view.inputmethod.InputMethodManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
@@ -68,6 +72,7 @@ import net.micode.notes.widget.NoteWidgetProvider_4x;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -91,6 +96,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
sBgSelectorBtnsMap.put(R.id.iv_bg_blue, ResourceParser.BLUE);
sBgSelectorBtnsMap.put(R.id.iv_bg_green, ResourceParser.GREEN);
sBgSelectorBtnsMap.put(R.id.iv_bg_white, ResourceParser.WHITE);
+ sBgSelectorBtnsMap.put(R.id.iv_ph_duck, ResourceParser.DUCK);
+
}
private static final Map sBgSelectorSelectionMap = new HashMap();
@@ -100,8 +107,10 @@ public class NoteEditActivity extends Activity implements OnClickListener,
sBgSelectorSelectionMap.put(ResourceParser.BLUE, R.id.iv_bg_blue_select);
sBgSelectorSelectionMap.put(ResourceParser.GREEN, R.id.iv_bg_green_select);
sBgSelectorSelectionMap.put(ResourceParser.WHITE, R.id.iv_bg_white_select);
- }
+ sBgSelectorSelectionMap.put(ResourceParser.DUCK, R.id.iv_ph_duck_select);
+ }//
+ //选择便签字体大小的界选择器的吧
private static final Map sFontSizeBtnsMap = new HashMap();
static {
sFontSizeBtnsMap.put(R.id.ll_font_large, ResourceParser.TEXT_LARGE);
@@ -269,11 +278,20 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
private void initNoteScreen() {
+
+ String defaultText = getIntent().getStringExtra(Notes.INTENT_EXTRA_TEMPLE_TEXT);
+ if(defaultText!=null){
+ saveNote();//否则会增加一个null的奇怪现象
+ mWorkingNote.setWorkingText(mWorkingNote.getContent()+defaultText);
+ mNoteEditor.setText(mWorkingNote.getContent()); // 将defaultText的值写入到笔记编辑器中
+ }
+// Toast.makeText(getApplicationContext(), defaultText, Toast.LENGTH_SHORT).show();
mNoteEditor.setTextAppearance(this, TextAppearanceResources
.getTexAppearanceResource(mFontSizeId));
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
switchToListMode(mWorkingNote.getContent());
} else {
+ ;
mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery));
mNoteEditor.setSelection(mNoteEditor.getText().length());
}
@@ -287,6 +305,43 @@ public class NoteEditActivity extends Activity implements OnClickListener,
mWorkingNote.getModifiedDate(), DateUtils.FORMAT_SHOW_DATE
| DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME
| DateUtils.FORMAT_SHOW_YEAR));
+// String mPassword=mWorkingNote.getPassword();
+// if (mWorkingNote.getPassword()!=null){
+// final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+// View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text, null);
+// //编辑Text
+// final EditText etName = (EditText) view.findViewById(R.id.et_foler_name);
+// etName.setText("");
+// etName.setHint("请输入密码");
+// builder.setTitle("密码检验");
+// builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
+// @Override
+// public void onClick(DialogInterface dialog, int which) {
+// //获取输入的字符串
+// String password = etName.getText().toString();
+// Log.d("mPassword: ", mPassword);
+// Log.d("password: ", password);
+// //判断密码正确性
+// if (!password.equals(mPassword)) {
+// Log.d("密码不正确,正确密码是:",mPassword);
+// dialog.dismiss();
+// onBackPressed();
+// }
+// }
+// });
+// builder.setNegativeButton("cancel", new DialogInterface.OnClickListener(){
+// @Override
+// public void onClick(DialogInterface dialog, int which) {
+// dialog.dismiss();
+// onBackPressed();
+// }
+// });
+// final Dialog dialog = builder.setView(view).show();
+// dialog.show();
+// }
+// else{
+// Toast.makeText(NoteEditActivity.this,"还没有设置密码", Toast.LENGTH_SHORT).show();
+// }
/**
* TODO: Add the menu for setting alert. Currently disable it because the DateTimePicker
@@ -540,6 +595,102 @@ public class NoteEditActivity extends Activity implements OnClickListener,
} else if (itemId == R.id.menu_delete_remind) {
mWorkingNote.setAlertDate(0, false);
}
+ else if (itemId == R.id.menu_enter_private_mode){
+ if(mWorkingNote.getPassword()==null){
+ final AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ View view = LayoutInflater.from(this).inflate(R.layout.dialog_edit_text,null);
+ final EditText etName = (EditText)view.findViewById(R.id.et_foler_name);
+ etName.setText("");
+ etName.setHint("请输入密码");
+ builder.setTitle("为便签设置新密码");
+ builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ String password = etName.getText().toString();
+ mWorkingNote.setPassword(password);
+ if ( mWorkingNote.getPassword() != null ){
+ Toast.makeText(NoteEditActivity.this,"密码设置成功", Toast.LENGTH_SHORT).show();
+ }
+ InputMethodManager inputMethodManager =(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+ inputMethodManager.hideSoftInputFromWindow(etName.getWindowToken(),0);
+ dialog.dismiss();
+ }
+ });
+ builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ InputMethodManager inputMethodManager = (InputMethodManager)
+ getSystemService(Context.INPUT_METHOD_SERVICE);
+ inputMethodManager.hideSoftInputFromWindow(etName.getWindowToken(),0);
+ }
+ });
+ final Dialog dialog = builder.setView(view).show();
+ }
+ } else if (itemId==R.id.menu_select_font) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+
+ builder.setTitle("选择字体")
+ .setItems(new CharSequence[]{"默认字体", "仿宋_GB2312", "姚体", "宋体","忍者体","楷体","黑体"}, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ switch (which) {
+ case 0:
+ // 创建空的模板
+// createEmptyTemplate();
+ mNoteEditor.setTypeface(Typeface.DEFAULT);
+ break;
+ case 1:
+ // 创建模板 1
+// createTemplate("模板 1");
+// AssetManager mgr = getAssets();
+ Typeface tf1=Typeface.createFromAsset(getAssets(),"font/fs.ttf");
+ mNoteEditor.setTypeface(tf1);
+ break;
+ case 2:
+ Typeface tf2=Typeface.createFromAsset(getAssets(),"font/fzytk.TTF");
+ mNoteEditor.setTypeface(tf2);
+ break;
+ case 3:
+ // 创建模板 3
+// createTemplate("模板 3");
+ Typeface tf3=Typeface.createFromAsset(getAssets(),"font/stsong.TTF");
+ mNoteEditor.setTypeface(tf3);
+ break;
+ case 4:
+ Typeface tf4=Typeface.createFromAsset(getAssets(),"font/fzrzt.TTF");
+ mNoteEditor.setTypeface(tf4);
+ break;
+ case 5:
+ Typeface tf5=Typeface.createFromAsset(getAssets(),"font/kt.ttf");
+ mNoteEditor.setTypeface(tf5);
+ break;
+ case 6:
+ Typeface tf6=Typeface.createFromAsset(getAssets(),"font/simhei.ttf");
+ mNoteEditor.setTypeface(tf6);
+ break;
+
+
+ }
+ }
+ });
+ builder.setPositiveButton("OK", new DialogInterface.OnClickListener(){
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ Toast.makeText(NoteEditActivity.this,"字体设置成功", Toast.LENGTH_SHORT).show();
+ dialog.dismiss();
+ }
+ });
+ builder.setNegativeButton("cancle", new DialogInterface.OnClickListener(){
+ public void onClick(DialogInterface dialog, int which) {
+ Toast.makeText(NoteEditActivity.this,"字体设置失败", Toast.LENGTH_SHORT).show();
+ dialog.dismiss();
+ } });
+ final Dialog dialog = builder.show();
+
+
+
+
+ }
+
return true;
}
diff --git a/src/main/java/net/micode/notes/ui/NoteItemData.java b/src/main/java/net/micode/notes/ui/NoteItemData.java
index 0f5a878..17cc5d4 100644
--- a/src/main/java/net/micode/notes/ui/NoteItemData.java
+++ b/src/main/java/net/micode/notes/ui/NoteItemData.java
@@ -39,7 +39,7 @@ public class NoteItemData {
NoteColumns.SNIPPET,
NoteColumns.TYPE,
NoteColumns.WIDGET_ID,
- NoteColumns.WIDGET_TYPE,
+ NoteColumns.WIDGET_TYPE, NoteColumns.PASSWORD
};
private static final int ID_COLUMN = 0;
@@ -54,6 +54,7 @@ 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 long mId;
private long mAlertDate;
@@ -70,6 +71,8 @@ public class NoteItemData {
private String mName;
private String mPhoneNumber;
+ private String mPassword;
+
private boolean mIsLastItem;
private boolean mIsFirstItem;
private boolean mIsOnlyOneItem;
@@ -91,6 +94,8 @@ 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);
+
mPhoneNumber = "";
if (mParentId == Notes.ID_CALL_RECORD_FOLDER) {
@@ -197,6 +202,9 @@ public class NoteItemData {
public int getType() {
return mType;
}
+ public String getmPassword(){
+ return mPassword;
+ }
public int getWidgetType() {
return mWidgetType;
@@ -221,4 +229,11 @@ public class NoteItemData {
public static int getNoteType(Cursor cursor) {
return cursor.getInt(TYPE_COLUMN);
}
+
+ public boolean hasPassword(){
+ if(mPassword.length()!=0&&mPassword!=null){
+ return true;
+ }
+ return false;
+ }
}
diff --git a/src/main/java/net/micode/notes/ui/NotesListActivity.java b/src/main/java/net/micode/notes/ui/NotesListActivity.java
index 6db3761..40f36ff 100644
--- a/src/main/java/net/micode/notes/ui/NotesListActivity.java
+++ b/src/main/java/net/micode/notes/ui/NotesListActivity.java
@@ -466,6 +466,18 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mCurrentFolderId);
this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE);
}
+ private void createTempelNote(int num){
+ String temple1="Time:\nClass:\nTeacher:\nScore:\n";
+ String temple2="Group:\nLeader:\nNumber:\nScore:\n";
+ String temple3="早操:\n早餐:\n第一节课:\n";
+ String[] temple= {temple1,temple2,temple2};
+ Intent intent = new Intent(this, NoteEditActivity.class);
+ intent.setAction(Intent.ACTION_INSERT_OR_EDIT);
+ intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mCurrentFolderId);
+ intent.putExtra(Notes.INTENT_EXTRA_TEMPLE_TEXT,temple[num-1]);
+ this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE);
+ }
+
private void batchDelete() {
new AsyncTask>() {
@@ -557,7 +569,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
public void onClick(View v) {
if (v.getId() == R.id.btn_new_note) {
- createNewNote();
+ selectCreatemode(this);
+// createNewNote();
}
}
@@ -622,11 +635,28 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
});
}
} else if (!TextUtils.isEmpty(name)) {
+ //如果在根文件夹中创建
+ if (mCurrentFolderId == Notes.ID_ROOT_FOLDER){
+ //创建一个ContentValues对象
ContentValues values = new ContentValues();
values.put(NoteColumns.SNIPPET, name);
values.put(NoteColumns.TYPE, Notes.TYPE_FOLDER);
mContentResolver.insert(Notes.CONTENT_NOTE_URI, values);
}
+ //如果在子文件夹中创建
+ else {
+ //创建一个ContentValues对象
+ ContentValues values = new ContentValues();
+ //将输入的文本添加到ContentValues对象中
+ values.put(NoteColumns.SNIPPET, name);
+ values.put(NoteColumns.TYPE, Notes.TYPE_FOLDER);
+ values.put(NoteColumns.PARENT_ID, String.valueOf(mCurrentFolderId));
+ //插入新记录
+ mContentResolver.insert(Notes.CONTENT_NOTE_URI, values);
+ }
+
+ }
+ //关闭对话框
dialog.dismiss();
}
});
@@ -877,7 +907,7 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
|| item.getType() == Notes.TYPE_SYSTEM) {
openFolder(item);
} else if (item.getType() == Notes.TYPE_NOTE) {
- openNode(item);
+ testNode(item);
} else {
Log.e(TAG, "Wrong note type in NOTE_LIST");
}
@@ -885,8 +915,12 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
case SUB_FOLDER:
case CALL_RECORD_FOLDER:
if (item.getType() == Notes.TYPE_NOTE) {
- openNode(item);
- } else {
+ testNode(item);
+// openNode(item);
+ }else if (item.getType() == Notes.TYPE_FOLDER
+ || item.getType() == Notes.TYPE_SYSTEM) {
+ openFolder(item);}
+ else {
Log.e(TAG, "Wrong note type in SUB_FOLDER");
}
break;
@@ -932,4 +966,99 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt
}
return false;
}
+ public void testNode(final NoteItemData item){
+ //if (!item.getmPassword().equals("1"))//判断是否有密码,如果没有密码,直接打开即可
+ if(item.getmPassword()!=null && !item.getmPassword().equals(""))
+ {
+ final AlertDialog.Builder builder = new AlertDialog.Builder(this);//初始化对话框
+ builder.setTitle("验证密码");
+ View view = LayoutInflater.from(this).inflate(R.layout.pwd, null);//加载对话框的布局文件
+ final EditText editPwd = (EditText) view.findViewById(R.id.set_password);//初始化对话框里的文本对象
+ editPwd.setHint("输入隐私密码");
+ builder.setPositiveButton(android.R.string.ok, null);//确定按钮
+ builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {//取消按钮
+ hideSoftInput(editPwd);//隐藏软键盘
+ }
+ });
+ showSoftInput();//显示软键盘
+ final Dialog dialog = builder.setView(view).show();//显示出来
+
+ final Button positive = (Button)dialog.findViewById(android.R.id.button1);//加载确定按钮布局文件
+ positive.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {//设置确定按钮的接收器
+ hideSoftInput(editPwd);//点击确定后收起软键盘
+ String Password = editPwd.getText().toString();//文本框里的输入值
+ String mPassword=item.getmPassword();
+ if (TextUtils.isEmpty(Password) || Password.equals(mPassword)) {//输入不为空
+// Toast.makeText(getApplicationContext(), Password, Toast.LENGTH_SHORT).show();
+ Toast.makeText(NotesListActivity.this,"密码正确", Toast.LENGTH_SHORT).show();
+// inputPwd = Password;
+ openNode(item);
+ dialog.dismiss();//撤销对话框
+ }else{
+ Toast.makeText(NotesListActivity.this,"密码错误", Toast.LENGTH_SHORT).show();
+ editPwd.setText("");
+ dialog.show();
+ }
+
+
+
+ }
+
+ });
+ if (TextUtils.isEmpty(editPwd.getText())) {//如果文件夹名称为空,则不能选择确定按钮
+ positive.setEnabled(false);
+ }
+
+ editPwd.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(editPwd.getText())) {//文本为空确定按键不可用,不为空则可用
+ positive.setEnabled(false);
+ } else {
+ positive.setEnabled(true);
+ }
+ }
+ public void afterTextChanged(Editable s) {//文本修改之后(未完成)
+ // TODO Auto-generated method stub
+ }
+ });
+ } else {
+ openNode(item);
+ }
+ }
+ public void selectCreatemode(Context context){
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle("选择模板")
+ .setItems(new CharSequence[]{"创建空新模板", "创建模板 1", "创建模板 2", "创建模板 3"}, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ switch (which) {
+ case 0:
+ // 创建空的模板
+ createNewNote();
+ break;
+ case 1:
+ // 创建模板 1
+ createTempelNote(1);
+// createTemplate("模板 1");
+ break;
+ case 2:
+ // 创建模板 2
+ createTempelNote(2);
+// break;
+ case 3:
+ // 创建模板 3
+ createTempelNote(3);
+ break;
+ }
+ }
+ })
+ .show();
+
+ }
}
+
diff --git a/src/main/java/net/micode/notes/ui/NotesListItem.java b/src/main/java/net/micode/notes/ui/NotesListItem.java
index 1221e80..9af4bd1 100644
--- a/src/main/java/net/micode/notes/ui/NotesListItem.java
+++ b/src/main/java/net/micode/notes/ui/NotesListItem.java
@@ -32,6 +32,7 @@ import net.micode.notes.tool.ResourceParser.NoteItemBgResources;
public class NotesListItem extends LinearLayout {
private ImageView mAlert;
+ private ImageView mLock;
private TextView mTitle;
private TextView mTime;
private TextView mCallName;
@@ -84,8 +85,16 @@ public class NotesListItem extends LinearLayout {
+ context.getString(R.string.format_folder_files_count,
data.getNotesCount()));
mAlert.setVisibility(View.GONE);
+// if(data.has)
} else {
- mTitle.setText(DataUtils.getFormattedSnippet(data.getSnippet()));
+ if(data.getmPassword()==null){
+ mTitle.setText(DataUtils.getFormattedSnippet(data.getSnippet()));
+ }else {
+
+ mTitle.setText("便签已加密");
+ }
+//
+// mTitle.setText("Jiami");
if (data.hasAlert()) {
mAlert.setImageResource(R.drawable.clock);
mAlert.setVisibility(View.VISIBLE);
diff --git a/src/main/res/drawable-hdpi/lock_private.png b/src/main/res/drawable-hdpi/lock_private.png
new file mode 100644
index 0000000..965c19d
Binary files /dev/null and b/src/main/res/drawable-hdpi/lock_private.png differ
diff --git a/src/main/res/drawable-hdpi/login_photo.png b/src/main/res/drawable-hdpi/login_photo.png
new file mode 100644
index 0000000..bb6b8c9
Binary files /dev/null and b/src/main/res/drawable-hdpi/login_photo.png differ
diff --git a/src/main/res/drawable-hdpi/login_view_photo.png b/src/main/res/drawable-hdpi/login_view_photo.png
new file mode 100644
index 0000000..c8897ea
Binary files /dev/null and b/src/main/res/drawable-hdpi/login_view_photo.png differ
diff --git a/src/main/res/drawable-hdpi/login_view_photo_2.jpg b/src/main/res/drawable-hdpi/login_view_photo_2.jpg
new file mode 100644
index 0000000..9447402
Binary files /dev/null and b/src/main/res/drawable-hdpi/login_view_photo_2.jpg differ
diff --git a/src/main/res/drawable-hdpi/note_background_photo_duck.jpg b/src/main/res/drawable-hdpi/note_background_photo_duck.jpg
new file mode 100644
index 0000000..b6f1ca3
Binary files /dev/null and b/src/main/res/drawable-hdpi/note_background_photo_duck.jpg differ
diff --git a/src/main/res/drawable-hdpi/note_background_photo_wangyi.png b/src/main/res/drawable-hdpi/note_background_photo_wangyi.png
new file mode 100644
index 0000000..8aadb9f
Binary files /dev/null and b/src/main/res/drawable-hdpi/note_background_photo_wangyi.png differ
diff --git a/src/main/res/drawable-hdpi/note_bg_photo_wangyi.png b/src/main/res/drawable-hdpi/note_bg_photo_wangyi.png
new file mode 100644
index 0000000..3af7855
Binary files /dev/null and b/src/main/res/drawable-hdpi/note_bg_photo_wangyi.png differ
diff --git a/src/main/res/drawable-hdpi/note_edit_color_selector_panel_test.png b/src/main/res/drawable-hdpi/note_edit_color_selector_panel_test.png
new file mode 100644
index 0000000..4a58b67
Binary files /dev/null and b/src/main/res/drawable-hdpi/note_edit_color_selector_panel_test.png differ
diff --git a/src/main/res/layout/change_login_password_activity.xml b/src/main/res/layout/change_login_password_activity.xml
new file mode 100644
index 0000000..b9e854f
--- /dev/null
+++ b/src/main/res/layout/change_login_password_activity.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/login_activity.xml b/src/main/res/layout/login_activity.xml
new file mode 100644
index 0000000..320b0c0
--- /dev/null
+++ b/src/main/res/layout/login_activity.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/login_view.xml b/src/main/res/layout/login_view.xml
new file mode 100644
index 0000000..0c1c3b4
--- /dev/null
+++ b/src/main/res/layout/login_view.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/model_insert.xml b/src/main/res/layout/model_insert.xml
new file mode 100644
index 0000000..fa98635
--- /dev/null
+++ b/src/main/res/layout/model_insert.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/note_edit.xml b/src/main/res/layout/note_edit.xml
index 10b2aa7..9fb5782 100644
--- a/src/main/res/layout/note_edit.xml
+++ b/src/main/res/layout/note_edit.xml
@@ -46,6 +46,12 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/title_alert" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/res/menu/note_edit.xml b/src/main/res/menu/note_edit.xml
index 35cacd1..f8b36ea 100644
--- a/src/main/res/menu/note_edit.xml
+++ b/src/main/res/menu/note_edit.xml
@@ -25,6 +25,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/menu/sub_folder.xml b/src/main/res/menu/sub_folder.xml
index b00de26..46eb577 100644
--- a/src/main/res/menu/sub_folder.xml
+++ b/src/main/res/menu/sub_folder.xml
@@ -21,4 +21,7 @@
-
\ No newline at end of file
+
+
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 55df868..f0cc981 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -132,4 +132,16 @@
- %1$s results for \"%2$s\"
+
+ 玛卡巴卡斗志昂扬
+ LoginView
+ 用户名:
+ 密码:
+ 登录
+ 取消
+ 程序已退出
+ 正在登录,你给我等着
+ 有人抢银行啦
+ Font mode change
+
diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml
index d750e65..8063060 100644
--- a/src/main/res/values/styles.xml
+++ b/src/main/res/values/styles.xml
@@ -63,7 +63,7 @@
-
\ No newline at end of file
+
diff --git a/实践模板-开源软件的质量分析报告文档.docx b/实践模板-开源软件的质量分析报告文档.docx
new file mode 100644
index 0000000..5202091
Binary files /dev/null and b/实践模板-开源软件的质量分析报告文档.docx differ