Compare commits

...

27 Commits

Author SHA1 Message Date
“jwj” ba8182c288 Merge branch 'main' of https://bdgit.educoder.net/p873bi2r9/minoteGPZ
2 years ago
“jwj” d701800cc5 Merge branch 'main' of https://bdgit.educoder.net/p873bi2r9/minoteGPZ
2 years ago
zyc 19619f1513 关于代码维护zyc
2 years ago
GHN 89a4864540 Merge branch 'main' of https://bdgit.educoder.net/p873bi2r9/minoteGPZ
2 years ago
“jwj” c08e583c3a Merge branch 'main' of https://bdgit.educoder.net/p873bi2r9/minoteGPZ
2 years ago
“jwj” 30ba5149c6 Merge branch 'main' of https://bdgit.educoder.net/p873bi2r9/minoteGPZ
2 years ago
GHN c20ef7ad39 Merge branch 'main' of https://bdgit.educoder.net/p873bi2r9/minoteGPZ
2 years ago
GHN f22c313e34 Merge branch 'main' of https://bdgit.educoder.net/p873bi2r9/minoteGPZ
2 years ago
GHN cf6b7da8c9 Merge branch 'main' of https://bdgit.educoder.net/p873bi2r9/minoteGPZ
2 years ago
GHN f46a8734e6 Merge branch 'main' of https://bdgit.educoder.net/p873bi2r9/minoteGPZ
2 years ago
GHN a2a9268eaf Merge branch 'main' of https://bdgit.educoder.net/p873bi2r9/minoteGPZ
2 years ago
GHN 4ff1a6455c Merge branch 'main' of https://bdgit.educoder.net/p873bi2r9/minoteGPZ
2 years ago
p873bi2r9 fd96fdaa94 Merge pull request '完善了质量分析报告' (#9) from jwj_branch into main
2 years ago
p873bi2r9 395086d977 Merge pull request '完善了质量分析报告' (#9) from jwj_branch into main
2 years ago
“jwj” d64427cbb9 ui
2 years ago
“jwj” 3bd0a81eaf 完善
2 years ago
p873bi2r9 00ed1503cd 3
2 years ago
“jwj” 15aa6e7f52 1
2 years ago
“jwj” ccaacca331 have a try
2 years ago
“jwj” 472102ea7f 我好像修好了
2 years ago
“jwj” 2471e68e72 change
2 years ago
p873bi2r9 9a6f6a450a Merge pull request '第二次修改' (#4) from zyc_branch into main
2 years ago
zyc c28c03cd50 1
2 years ago
zyc f98b91d84d 格式调整
2 years ago
zyc 038fa79824 格式调整
2 years ago
GHN 0f8d81fbb5 Merge branch 'main' of https://bdgit.educoder.net/p873bi2r9/minoteGPZ
2 years ago
GHN 7a3dbc43c0 sonar分析
2 years ago

@ -0,0 +1,3 @@
# 默认忽略的文件
/shelf/
/workspace.xml

@ -0,0 +1,5 @@
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="20" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/main.iml" filepath="$PROJECT_DIR$/main.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
projectKey=myNotes
serverUrl=http://127.0.0.1:9000
serverVersion=9.5.0.56709
dashboardUrl=http://127.0.0.1:9000/dashboard?id=myNotes
ceTaskId=AYRIh5EzuqDImpFV-sUP
ceTaskUrl=http://127.0.0.1:9000/api/ce/task?id=AYRIh5EzuqDImpFV-sUP

@ -20,44 +20,107 @@
android:versionCode="1"
android:versionName="0.1" >
<uses-sdk android:minSdkVersion="14" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="andro id.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!-- 粗略的位置权限 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<!-- 精确的位置权限 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:icon="@drawable/icon_app"
android:label="@string/app_name" >
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<activity
android:name=".ui.NotesListActivity"
android:name=".ui.SplashActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.LoginActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/NoteTheme"
android:windowSoftInputMode="adjustPan" >
<!--android:uiOptions="splitActionBarWhenNarrow"-->
<!--<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>-->
</activity>
<activity
android:name=".ui.ChangingPassword"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/NoteTheme"
android:windowSoftInputMode="adjustPan" >
</activity>
<activity
android:name=".ui.SettingPassword"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/NoteTheme"
android:windowSoftInputMode="adjustPan" >
</activity>
<activity
android:name=".ui.DeletingPassword"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/NoteTheme"
android:windowSoftInputMode="adjustPan" >
</activity>
<activity
android:name=".ui.NotesListActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
android:uiOptions="splitActionBarWhenNarrow"
android:windowSoftInputMode="adjustPan" >
<intent-filter>
<!--<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</intent-filter>-->
</activity>
<activity
android:name=".ui.WeatherActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTop"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
android:uiOptions="splitActionBarWhenNarrow"
android:windowSoftInputMode="adjustPan" >
</activity>
<activity
android:name=".ui.NoteEditActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTop"
android:theme="@style/NoteTheme" >
android:theme="@style/Theme.AppCompat.Light.DarkActionBar" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -23,14 +23,11 @@ import android.provider.ContactsContract.Data;
import android.telephony.PhoneNumberUtils;
import android.util.Log;
import java.util.HashMap;//hash接口存储键值映射<string,Integer>
import java.util.HashMap;
//private表示该常量仅在本类中可见不允许在其他类中访问。
//static表示该常量属于类级别的可以通过类名直接访问无需创建类的实例。
//final表示该常量的值在初始化之后不可修改是一个常量。
public class Contact {//申明公有类Contact可以在其他类中被访问
private static HashMap<String, String> sContactCache;//私有的静态HashMap类型变量
private static final String TAG = "Contact";//私有的静态字符型常量final表示只可以被赋值一次之后不能在被修改
public class Contact {
private static HashMap<String, String> sContactCache;
private static final String TAG = "Contact";
private static final String CALLER_ID_SELECTION = "PHONE_NUMBERS_EQUAL(" + Phone.NUMBER
+ ",?) AND " + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'"
@ -39,19 +36,19 @@ public class Contact {//申明公有类Contact可以在其他类中被访问
+ " FROM phone_lookup"
+ " WHERE min_match = '+')";
private Contact(){}
public static String getContact(Context context, String phoneNumber) {
// 创建联系人缓存 HashMap
if(sContactCache == null) {
sContactCache = new HashMap<String, String>();
sContactCache = new HashMap<>();
}
// 如果缓存中已存在对应号码的联系人姓名,则直接返回
if(sContactCache.containsKey(phoneNumber)) {
return sContactCache.get(phoneNumber);
}
// 替换查询条件中的占位符,构建具体的查询条件
String selection = CALLER_ID_SELECTION.replace("+",
PhoneNumberUtils.toCallerIDMinMatch(phoneNumber));
// 查询联系人数据库,获取匹配的联系人信息
Cursor cursor = context.getContentResolver().query(
Data.CONTENT_URI,
new String [] { Phone.DISPLAY_NAME },
@ -61,22 +58,16 @@ public class Contact {//申明公有类Contact可以在其他类中被访问
if (cursor != null && cursor.moveToFirst()) {
try {
// 获取第一个匹配结果的联系人姓名
String name = cursor.getString(0);
// 将联系人姓名添加到缓存中
sContactCache.put(phoneNumber, name);
//返回联系人姓名
return name;
} catch (IndexOutOfBoundsException e) {
// 处理异常情况,并打印错误日志
Log.e(TAG, " Cursor get string error " + e.toString());
return null;
} finally {
//关闭游标
cursor.close();
}
} else {
// 没有匹配到联系人,打印调试日志,并返回 null
Log.d(TAG, "No contact matched with number:" + phoneNumber);
return null;
}

@ -15,16 +15,15 @@
*/
package net.micode.notes.data;
//public表示该成员可以被任何其他类访问。
//static表示该成员属于类本身而不是类的实例。可以通过类名直接访问而不需要创建对象。
//final表示该成员的值在初始化后不能被修改。一旦赋值其值就不能再改变。
import android.net.Uri;
public class Notes {
public static final String AUTHORITY = "micode_notes";//笔记提供程序的权限
public static final String TAG = "Notes";//用于在日志中标记笔记的标签
public static final int TYPE_NOTE = 0;//普通笔记
public static final int TYPE_FOLDER = 1;//文件夹
public static final int TYPE_SYSTEM = 2;//系统文件夹
public static final String AUTHORITY = "micode_notes";
public static final String TAG = "Notes";
public static final String CONTENT_ = "content://";
public static final int TYPE_NOTE = 0;
public static final int TYPE_FOLDER = 1;
public static final int TYPE_SYSTEM = 2;
/**
* Following IDs are system folders' identifiers
@ -32,10 +31,10 @@ public class Notes {
* {@link Notes#ID_TEMPARAY_FOLDER } is for notes belonging no folder
* {@link Notes#ID_CALL_RECORD_FOLDER} is to store call records
*/
public static final int ID_ROOT_FOLDER = 0;//默认文件夹
public static final int ID_TEMPARAY_FOLDER = -1;//未归类的临时文件夹
public static final int ID_CALL_RECORD_FOLDER = -2;//用于存储通话记录的文件夹
public static final int ID_TRASH_FOLER = -3;//垃圾文件夹
public static final int ID_ROOT_FOLDER = 0;
public static final int ID_TEMPARAY_FOLDER = -1;
public static final int ID_CALL_RECORD_FOLDER = -2;
public static final int ID_TRASH_FOLER = -3;
public static final String INTENT_EXTRA_ALERT_DATE = "net.micode.notes.alert_date";
public static final String INTENT_EXTRA_BACKGROUND_ID = "net.micode.notes.background_color_id";
@ -49,21 +48,22 @@ public class Notes {
public static final int TYPE_WIDGET_4X = 1;
public static class DataConstants {
public static final String NOTE = TextNote.CONTENT_ITEM_TYPE;//文本笔记的数据类型
public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE;//通话记录的数据类型
private DataConstants(){}
public static final String NOTE = TextNote.CONTENT_ITEM_TYPE;
public static final String CALL_NOTE = CallNote.CONTENT_ITEM_TYPE;
}
/**
* Uri to query all notes and folders
*/
public static final Uri CONTENT_NOTE_URI = Uri.parse("content://" + AUTHORITY + "/note");
//查询所以文件笔记的URI
public static final Uri CONTENT_NOTE_URI = Uri.parse(CONTENT_ + AUTHORITY + "/note");
/**
* Uri to query data
*/
public static final Uri CONTENT_DATA_URI = Uri.parse("content://" + AUTHORITY + "/data");
//
public interface NoteColumns {//接口,定义接口的关键字,接口定义方法签名,但是不提供方法实现,其他类可以提供接口实现
public static final Uri CONTENT_DATA_URI = Uri.parse(CONTENT_ + AUTHORITY + "/data");
public interface NoteColumns {
/**
* The unique ID for a row
* <P> Type: INTEGER (long) </P>
@ -167,6 +167,8 @@ public class Notes {
* <P> Type : INTEGER (long) </P>
*/
public static final String VERSION = "version";
public static final String TOP = "top";
}
public interface DataColumns {
@ -206,6 +208,8 @@ public class Notes {
*/
public static final String CONTENT = "content";
public static final String LOCATION = "location";
/**
* Generic data column, the meaning is {@link #MIMETYPE} specific, used for
@ -243,11 +247,13 @@ public class Notes {
public static final String DATA5 = "data5";
}
public static final class TextNote implements DataColumns {//TextNote 是 DataColumns 的一个特定实现类,它表示文本笔记的数据类型
public static final class TextNote implements DataColumns {
/**
* Mode to indicate the text in check list mode or not
* <P> Type: Integer 1:check list mode 0: normal mode </P>
*/
private TextNote(){}
public static final String MODE = DATA1;
public static final int MODE_CHECK_LIST = 1;
@ -256,14 +262,17 @@ public class Notes {
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/text_note";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/text_note");
public static final Uri CONTENT_URI = Uri.parse(CONTENT_ + AUTHORITY + "/text_note");
}
public static final class CallNote implements DataColumns {//CallNote 是 DataColumns 的另一个特定实现类,表示电话笔记的数据类型
public static final class CallNote implements DataColumns {
/**
* Call date for this record
* <P> Type: INTEGER (long) </P>
*/
private CallNote(){}
public static final String CALL_DATE = DATA1;
/**
@ -276,6 +285,6 @@ public class Notes {
public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/call_note";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/call_note");
public static final Uri CONTENT_URI = Uri.parse(CONTENT_ + AUTHORITY + "/call_note");
}
}

@ -59,8 +59,9 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
NoteColumns.SYNC_ID + " INTEGER NOT NULL DEFAULT 0," +
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.GTASK_ID + " TEXT NOT NULL DEFAULT 1," +
NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.TOP + " INTEGER NOT NULL DEFAULT 0" +
")";
private static final String CREATE_DATA_TABLE_SQL =
@ -75,7 +76,8 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
DataColumns.DATA2 + " INTEGER," +
DataColumns.DATA3 + " TEXT NOT NULL DEFAULT ''," +
DataColumns.DATA4 + " TEXT NOT NULL DEFAULT ''," +
DataColumns.DATA5 + " TEXT NOT NULL DEFAULT ''" +
DataColumns.DATA5 + " TEXT NOT NULL DEFAULT ''," +
DataColumns.LOCATION + " TEXT NOT NULL DEFAULT ''" +
")";
private static final String CREATE_DATA_NOTE_ID_INDEX_SQL =
@ -322,6 +324,16 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
oldVersion++;
}
if (oldVersion == 4) {
upgradeToV5(db);
oldVersion++;
}
if (oldVersion == 5) {
upgradeToV6(db);
oldVersion++;
}
if (reCreateTriggers) {
reCreateNoteTableTriggers(db);
reCreateDataTableTriggers(db);
@ -359,4 +371,14 @@ 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.TOP
+ " INTEGER NOT NULL DEFAULT 0");
}
private void upgradeToV6(SQLiteDatabase db) {
db.execSQL("ALTER TABLE " + TABLE.DATA + " ADD COLUMN " + DataColumns.LOCATION
+ "TEXT NOT NULL DEFAULT ''");
}
}

@ -33,12 +33,18 @@ import net.micode.notes.R;
import net.micode.notes.data.Notes.DataColumns;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.data.NotesDatabaseHelper.TABLE;
import net.micode.notes.gtask.data.SqlNote;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Iterator;
public class NotesProvider extends ContentProvider {
private static final UriMatcher mMatcher;
private NotesDatabaseHelper mHelper;
private static NotesDatabaseHelper mHelper;
private static final String TAG = "NotesProvider";
@ -302,4 +308,147 @@ public class NotesProvider extends ContentProvider {
return null;
}
public static JSONObject uploadnote()throws JSONException {
JSONObject js = new JSONObject();
SQLiteDatabase db;
db = mHelper.getReadableDatabase();
Cursor cursor = null;
cursor = db.query(NotesDatabaseHelper.TABLE.NOTE,
null, null, null, null, null, null);
//判断游标是否为空
if (cursor.moveToFirst()) {
for (int index = 1; index <= cursor.getCount(); index++) {
JSONObject note = new JSONObject();
note.put(NoteColumns.PARENT_ID,cursor.getString(1));
note.put(NoteColumns.ALERTED_DATE,cursor.getString(2));
note.put(NoteColumns.BG_COLOR_ID,cursor.getString(3));
note.put(NoteColumns.CREATED_DATE,cursor.getString(4));
note.put(NoteColumns.HAS_ATTACHMENT,cursor.getString(5));
note.put(NoteColumns.MODIFIED_DATE,cursor.getString(6));
note.put(NoteColumns.NOTES_COUNT,cursor.getString(7));
note.put(NoteColumns.SNIPPET,cursor.getString(8));
note.put(NoteColumns.TYPE,cursor.getString(9));
note.put(NoteColumns.WIDGET_ID,cursor.getString(10));
note.put(NoteColumns.WIDGET_TYPE,cursor.getString(11));
note.put(NoteColumns.SYNC_ID,cursor.getString(12));
note.put(NoteColumns.LOCAL_MODIFIED,cursor.getString(13));
note.put(NoteColumns.ORIGIN_PARENT_ID,cursor.getString(14));
note.put(NoteColumns.GTASK_ID,cursor.getString(15));
note.put(NoteColumns.VERSION,cursor.getString(16));
note.put(NoteColumns.TOP,cursor.getString(17));
js.put(cursor.getString(0),note);
if(!cursor.isLast()){
cursor.moveToNext();
}
}
}
System.out.println(js);
return js;
}
public static JSONObject uploaddata()throws JSONException {
JSONObject js = new JSONObject();
SQLiteDatabase db;
db = mHelper.getReadableDatabase();
Cursor cursor = null;
cursor = db.query(NotesDatabaseHelper.TABLE.DATA,
null, null, null, null, null, null);
//判断游标是否为空
if (cursor.moveToFirst()) {
for (int index = 1; index <= cursor.getCount(); index++) {
JSONObject data = new JSONObject();
data.put(DataColumns.MIME_TYPE,cursor.getString(1));
data.put(DataColumns.NOTE_ID,cursor.getString(2));
data.put(DataColumns.CREATED_DATE,cursor.getString(3));
data.put(DataColumns.MODIFIED_DATE,cursor.getString(4));
data.put(DataColumns.CONTENT,cursor.getString(5));
data.put(DataColumns.DATA1,cursor.getString(6));
data.put(DataColumns.DATA2,cursor.getString(7));
data.put(DataColumns.DATA3,cursor.getString(8));
data.put(DataColumns.DATA4,cursor.getString(9));
data.put(DataColumns.DATA5,cursor.getString(10));
js.put(cursor.getString(0),data);
if(!cursor.isLast()){
cursor.moveToNext();
}
}
}
System.out.println(js);
return js;
}
public static void syncTABLE(JSONObject JSONInfo) throws JSONException {
SQLiteDatabase db;
db = mHelper.getReadableDatabase();
String sql;
JSONObject NOTE = null;
JSONObject DATA = null;
try {
NOTE = (JSONObject) JSONInfo.get("NOTE");
DATA = (JSONObject) JSONInfo.get("DATA");
} catch (Exception e) {
e.printStackTrace();
}
sql = "DELETE FROM" + " " + TABLE.NOTE;
db.execSQL(sql);
assert NOTE != null;
Iterator<String> NOTEKeys = NOTE.keys();
while (NOTEKeys.hasNext()){
String NOTEKey = NOTEKeys.next();
JSONObject NOTEInfo = (JSONObject) NOTE.get(NOTEKey);
sql = "INSERT INTO note(_id,parent_id,alert_date,bg_color_id,created_date,has_attachment,modified_date," +
"notes_count,snippet,type,widget_id,widget_type,sync_id,local_modified,origin_parent_id,gtask_id," +
"version,top,star,passcode) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
Object bindArgs[] = new Object[] {
NOTEKey,
NOTEInfo.getString("parent_id"),
NOTEInfo.getString("alert_date"),
NOTEInfo.getString("bg_color_id"),
NOTEInfo.getString("created_date"),
NOTEInfo.getString("has_attachment"),
NOTEInfo.getString("modified_date"),
"0",//NOTEInfo.getString("notes_count")
"0",
NOTEInfo.getString("snippet"),
NOTEInfo.getString("type"),
NOTEInfo.getString("widget_id"),
NOTEInfo.getString("widget_type"),
NOTEInfo.getString("sync_id"),
NOTEInfo.getString("local_modified"),
NOTEInfo.getString("origin_parent_id"),
NOTEInfo.getString("gtask_id"),
NOTEInfo.getString("version"),
NOTEInfo.getString("top"),
NOTEInfo.getString("star"),
NOTEInfo.getString("passcode")
};
db.execSQL(sql,bindArgs);
}
assert DATA != null;
Iterator<String> DATAKeys = DATA.keys();
while (DATAKeys.hasNext()){
String DATAKey = DATAKeys.next();
JSONObject DATAInfo = (JSONObject) DATA.get(DATAKey);
sql = "INSERT INTO data(_id,mime_type,note_id,created_date,modified_date,content,data3,data4,data5)" +
"values (?,?,?,?,?,?,?,?,?)";
Object bindArgs[] = new Object[] {
DATAKey,
DATAInfo.getString("mime_type"),
DATAInfo.getString("note_id"),
DATAInfo.getString("created_date"),
DATAInfo.getString("modified_date"),
DATAInfo.getString("content"),
DATAInfo.getString("data3"),
DATAInfo.getString("data4"),
DATAInfo.getString("data5")
};
db.execSQL(sql,bindArgs);
}
}
}

@ -0,0 +1,15 @@
package net.micode.notes.data;
public class WeatherBean {
public int code;
public Result result;
public class Result{
public String province;
public String area;
public String real;
public String weather;
public String tips="";
public String wind="";
}
}

@ -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.VERSION,NoteColumns.TOP,
};
public static final int ID_COLUMN = 0;
@ -86,6 +86,8 @@ public class SqlNote {
public static final int VERSION_COLUMN = 16;
public static final int Top_COLUMN = 17;
private Context mContext;
private ContentResolver mContentResolver;
@ -118,6 +120,8 @@ public class SqlNote {
private long mVersion;
private String mTop;
private ContentValues mDiffNoteValues;
private ArrayList<SqlData> mDataList;
@ -139,6 +143,7 @@ public class SqlNote {
mWidgetType = Notes.TYPE_WIDGET_INVALIDE;
mOriginParent = 0;
mVersion = 0;
mTop = getmTop();
mDiffNoteValues = new ContentValues();
mDataList = new ArrayList<SqlData>();
}
@ -152,6 +157,7 @@ public class SqlNote {
if (mType == Notes.TYPE_NOTE)
loadDataContent();
mDiffNoteValues = new ContentValues();
mTop = getmTop();
}
public SqlNote(Context context, long id) {
@ -163,7 +169,12 @@ public class SqlNote {
if (mType == Notes.TYPE_NOTE)
loadDataContent();
mDiffNoteValues = new ContentValues();
mTop = getmTop();
}
public String getmTop(){
return mTop;
}
private void loadFromCursor(long id) {
@ -198,6 +209,7 @@ public class SqlNote {
mWidgetId = c.getInt(WIDGET_ID_COLUMN);
mWidgetType = c.getInt(WIDGET_TYPE_COLUMN);
mVersion = c.getLong(VERSION_COLUMN);
mTop = c.getString(Top_COLUMN);
}
private void loadDataContent() {

@ -77,8 +77,7 @@ public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,
NotesListActivity.class), 0);
}
notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content,
pendingIntent);
mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification);
}

@ -47,6 +47,7 @@ public class Note {
long createdTime = System.currentTimeMillis();
values.put(NoteColumns.CREATED_DATE, createdTime);
values.put(NoteColumns.MODIFIED_DATE, createdTime);
//values.put(NoteColumns.TOP,"1");
values.put(NoteColumns.TYPE, Notes.TYPE_NOTE);
values.put(NoteColumns.LOCAL_MODIFIED, 1);
values.put(NoteColumns.PARENT_ID, folderId);
@ -76,6 +77,10 @@ public class Note {
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());
}
public void setTopValue(String key, String value) {
mNoteDiffValues.put(key, value);
}
public void setTextData(String key, String value) {
mNoteData.setTextData(key, value);
}
@ -135,6 +140,8 @@ public class Note {
private ContentValues mTextDataValues;
private ContentValues mTopValues;
private long mCallDataId;
private ContentValues mCallDataValues;
@ -144,6 +151,7 @@ public class Note {
public NoteData() {
mTextDataValues = new ContentValues();
mCallDataValues = new ContentValues();
mTopValues = new ContentValues();
mTextDataId = 0;
mCallDataId = 0;
}

@ -29,6 +29,7 @@ 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.data.NotesProvider;
import net.micode.notes.tool.ResourceParser.NoteBgResources;
@ -60,6 +61,14 @@ public class WorkingNote {
private boolean mIsDeleted;
/**记录已置顶便签*/
private String mTop = "0";
/**记录便签所属类别*/
private int mClass;
private NoteSettingChangedListener mNoteSettingStatusListener;
public static final String[] DATA_PROJECTION = new String[] {
@ -78,7 +87,8 @@ public class WorkingNote {
NoteColumns.BG_COLOR_ID,
NoteColumns.WIDGET_ID,
NoteColumns.WIDGET_TYPE,
NoteColumns.MODIFIED_DATE
NoteColumns.MODIFIED_DATE,
NoteColumns.TOP,
};
private static final int DATA_ID_COLUMN = 0;
@ -101,6 +111,8 @@ public class WorkingNote {
private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
private static final int NOTE_TOP_COLUMN = 6;
// New note construct
private WorkingNote(Context context, long folderId) {
mContext = context;
@ -112,6 +124,7 @@ public class WorkingNote {
mIsDeleted = false;
mMode = 0;
mWidgetType = Notes.TYPE_WIDGET_INVALIDE;
mTop = String.valueOf(getTopId());
}
// Existing note construct
@ -137,6 +150,7 @@ public class WorkingNote {
mWidgetType = cursor.getInt(NOTE_WIDGET_TYPE_COLUMN);
mAlertDate = cursor.getLong(NOTE_ALERTED_DATE_COLUMN);
mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN);
mTop = cursor.getString(NOTE_TOP_COLUMN);
}
cursor.close();
} else {
@ -229,6 +243,16 @@ public class WorkingNote {
mNoteSettingStatusListener = l;
}
public void setTop(String Top){
if (!mTop.equals(Top)) {
mTop = Top;
mNote.setTopValue(NoteColumns.TOP,mTop);
}
if (mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onTopChanged(Top);
}
}
public void setAlertDate(long date, boolean set) {
if (date != mAlertDate) {
mAlertDate = date;
@ -288,6 +312,10 @@ public class WorkingNote {
}
}
public void setmContent(String text){
mContent = text;
}
public void convertToCallNote(String phoneNumber, long callDate) {
mNote.setCallData(CallNote.CALL_DATE, String.valueOf(callDate));
mNote.setCallData(CallNote.PHONE_NUMBER, phoneNumber);
@ -298,6 +326,14 @@ public class WorkingNote {
return (mAlertDate > 0 ? true : false);
}
public int getTopId() {
if (mTop.equals("1")) {
return 1;
} else {
return 0;
}
}
public String getContent() {
return mContent;
}
@ -348,6 +384,12 @@ public class WorkingNote {
*/
void onBackgroundColorChanged();
/**
* Called when user set top
*/
void onTopChanged(String Top);
/**
* Called when user set clock
*/

@ -16,6 +16,7 @@
package net.micode.notes.tool;
import android.app.Activity;
import android.content.ContentProviderOperation;
import android.content.ContentProviderResult;
import android.content.ContentResolver;
@ -25,14 +26,23 @@ import android.content.OperationApplicationException;
import android.database.Cursor;
import android.os.RemoteException;
import android.util.Log;
import android.database.sqlite.SQLiteDatabase;
import android.widget.Toast;
import net.micode.notes.R;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.CallNote;
import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.data.NotesDatabaseHelper;
import net.micode.notes.data.NotesProvider;
import net.micode.notes.gtask.data.SqlNote;
import net.micode.notes.model.Note;
import net.micode.notes.ui.NoteEditActivity;
import net.micode.notes.ui.NotesListAdapter.AppWidgetAttribute;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.TreeSet;
public class DataUtils {

@ -1,3 +1,4 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
@ -41,79 +42,118 @@ import java.io.IOException;
public class AlarmAlertActivity extends Activity implements OnClickListener, OnDismissListener {
private long mNoteId;
private String mSnippet;
private long mNoteId; //文本在数据库存储中的ID号
private String mSnippet; //闹钟提示时出现的文本片段
private static final int SNIPPET_PREW_MAX_LEN = 60;
MediaPlayer mPlayer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
final Window win = getWindow();
//这一行代码是Activity的onCreate方法声明这是一个受保护的方法当Activity被创建的时候此方法会被调用
//其中Bundle类型的变量savedInstanceState用来传递Activity的保存状态信息
super.onCreate(savedInstanceState); //调用父类的onCreate方法传递保存的状态信息。确保Activity的基本初始化得以执行
requestWindowFeature(Window.FEATURE_NO_TITLE); //请求在Activity的窗口上禁用标题
//括号中的Window.FEATURE_NO_TITLE是一个标志设置以后Activity的窗口将不再显示标题栏
final Window win = getWindow(); //获取当前Activity的窗口对象。通过此对象我们可以对窗口进行各种设置和操作
win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
//此处表示为Activity的窗口添加了一个标志。括号中为标志的内容表示即使设备锁屏该Activity窗口
//仍然可以显示内容。这样用户就可以在锁屏的情况下看到Activity的内容
/*
iffalse
Activity
*/
if (!isScreenOn()) {
win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
}
Intent intent = getIntent();
win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON //保持窗体点亮
//这个标志意味着屏幕在Activity可见时保持点亮即使无用户交互的情况下也不会关闭
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON //将窗体点亮
//这个标志表示会在Activity需要显示时打开屏幕
| WindowManager.LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON //允许窗体点亮时锁屏
//这个标志表示允许屏幕在亮起的状态下进行锁定,即无操作时自动锁屏
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR); //手机锁屏后如果到了闹钟提示时间则点亮屏幕
} //这个标志表示允许Activity的窗口在锁屏后仍然可以显示某些内容(如闹钟)
Intent intent = getIntent(); //getIntent()是Android中Activity类的一个方法返回启动的Activity的intent对象
//这行代码即获取启动的Activity的intent对象
/*
*ActivityintentmNoteIdintent
*使mNoteIdgetContentResolver()ID
*SNIPPET_PREW_MAX_LEN
*IllegalArgumentException
*/
try {
mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1));
mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId);
mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0,
SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info)
: mSnippet;
: mSnippet; //判断标签片段是否达到符合长度
} catch (IllegalArgumentException e) {
e.printStackTrace();
return;
}
mPlayer = new MediaPlayer();
/*
ID
Activity
*/
//MediaPlayer是Android中用于播放音频和视频的一个类
mPlayer = new MediaPlayer(); //创建一个新的MediaPlayer对象实例并将其赋值给变量mPlayer
//这里调用了DataUtils.visibleInNoteDatabase()方法会返回一个布尔值表示给定的ID是否在笔记数据库中可见
if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) {
showActionDialog();
playAlarmSound();
//getContentResolver()是Android的一个方法获取当前Activity的内容解析器用于访问数据
showActionDialog();//弹出对话框
playAlarmSound(); //闹钟提示音激发
} else {
finish();
finish(); //完成闹钟动作
}
}
/*
isScreenOn()
*/
private boolean isScreenOn() {
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
//getSystemService()是Context类的一个方法它返回一个特定服务的实例这里我们获取的是电源管理服务
return pm.isScreenOn();
}
/*
*/
private void playAlarmSound() {
Uri url = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_ALARM);
//调用系统的铃声管理URI得到闹钟提示音
int silentModeStreams = Settings.System.getInt(getContentResolver(),
Settings.System.MODE_RINGER_STREAMS_AFFECTED, 0);
//这两行代码从系统设置中获取静音模式影响的音频流
// Settings.System.MODE_RINGER_STREAMS_AFFECTED是一个系统设置指示哪些音频流受到静音模式的影响
/*
*/
if ((silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0) {
mPlayer.setAudioStreamType(silentModeStreams);
} else {
mPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
}
try {
mPlayer.setDataSource(this, url);
mPlayer.prepare();
mPlayer.setLooping(true);
mPlayer.start();
} catch (IllegalArgumentException e) {
mPlayer.setDataSource(this, url); //设置音频的数据源为闹钟铃声的URI
mPlayer.prepare(); //调用prepare方法准备播放器使其处于可以播放的状态
mPlayer.setLooping(true); //设置音频为循环播放
mPlayer.start(); //开始播放音频
/*
使try-catch
IO
*/
} catch (IllegalArgumentException e) { //非法参数
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace(); //抛出异常并显示出更深的调用信息,下同
} catch (SecurityException e) { //安全异常
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalStateException e) {
} catch (IllegalStateException e) { //非法状态
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
} catch (IOException e) { //IO异常
// TODO Auto-generated catch block
e.printStackTrace();
}
@ -121,22 +161,27 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
private void showActionDialog() {
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle(R.string.app_name);
dialog.setMessage(mSnippet);
dialog.setPositiveButton(R.string.notealert_ok, this);
//用AlertDialog.Builder中的create()方法新建了一个AlertDialog对象
dialog.setTitle(R.string.app_name); //为对话框设置标题
dialog.setMessage(mSnippet); //为对话框设置内容
dialog.setPositiveButton(R.string.notealert_ok, this); //给对话框添加"确定(Positive)"按钮
if (isScreenOn()) {
dialog.setNegativeButton(R.string.notealert_enter, this);
}
dialog.show().setOnDismissListener(this);
}
} //给对话框添加"取消(Negative)"按钮
dialog.show().setOnDismissListener(this); //设置对话框消失时的监听器为this
} //点击按钮时会调用下面的OnClick方法
/*
Activity ID Activity
*/
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_NEGATIVE:
switch (which) { //用which来选择click后的下一步操作
case DialogInterface.BUTTON_NEGATIVE: //取消按钮被点击
Intent intent = new Intent(this, NoteEditActivity.class);
intent.setAction(Intent.ACTION_VIEW);
//创建一个新的intent对象
intent.setAction(Intent.ACTION_VIEW); //设置动作属性为查看
//向intent中添加一个数据Intent.EXTRA_UID为键mNoteId为值
intent.putExtra(Intent.EXTRA_UID, mNoteId);
startActivity(intent);
startActivity(intent); //启动新的Activity
break;
default:
break;
@ -144,14 +189,14 @@ public class AlarmAlertActivity extends Activity implements OnClickListener, OnD
}
public void onDismiss(DialogInterface dialog) {
stopAlarmSound();
stopAlarmSound(); //停止闹钟的声音
finish();
}
private void stopAlarmSound() {
if (mPlayer != null) {
mPlayer.stop();
mPlayer.release();
mPlayer.stop(); //停止播放
mPlayer.release(); //释放MediaPlayer对象
mPlayer = null;
}
}

@ -31,28 +31,40 @@ import net.micode.notes.data.Notes.NoteColumns;
public class AlarmInitReceiver extends BroadcastReceiver {
private static final String [] PROJECTION = new String [] {
//这行代码定义了一个PROJECTION字符串数组它是私有(private)的,静态(static)的,不可变(final)的
NoteColumns.ID,
NoteColumns.ALERTED_DATE
};
private static final int COLUMN_ID = 0;
private static final int COLUMN_ALERTED_DATE = 1;
private static final int COLUMN_ALERTED_DATE = 1;//设定ID和闹钟信息的初始值
@Override
/*
onReceive广广
*/
public void onReceive(Context context, Intent intent) {
//获取当前时间的毫秒数,目的是获取当前的系统时间
long currentDate = System.currentTimeMillis();
//光标c遍历数据库寻找出所有提醒时间大于现在时间的便签
Cursor c = context.getContentResolver().query(Notes.CONTENT_NOTE_URI,
PROJECTION,
//类型转换将long类型的currentDate转变为String类
NoteColumns.ALERTED_DATE + ">? AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE,
new String[] { String.valueOf(currentDate) },
null);
if (c != null) {
if (c.moveToFirst()) {
/*
*/
do {
long alertDate = c.getLong(COLUMN_ALERTED_DATE);
long alertDate = c.getLong(COLUMN_ALERTED_DATE); //获取提醒日期
Intent sender = new Intent(context, AlarmReceiver.class);
//通过定义一个Intent方法与AlarmReceiver类建立连接
sender.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, c.getLong(COLUMN_ID)));
//进行数据地址的设置设置为Notes.CONTENT_NOTE_URI + 之前获取的便签Id号
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, sender, 0);
AlarmManager alermManager = (AlarmManager) context
.getSystemService(Context.ALARM_SERVICE);

@ -21,7 +21,13 @@ import android.content.Context;
import android.content.Intent;
public class AlarmReceiver extends BroadcastReceiver {
//声明了一个名为AlarmReceiver的公共类该类继承自BroadcastReceiver
//BroadcastReceiver是Android系统提供的一个用于接收广播的组件
@Override
/*
广
(context)广(intent)
*/
public void onReceive(Context context, Intent intent) {
intent.setClass(context, AlarmAlertActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

@ -0,0 +1,69 @@
package net.micode.notes.ui;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import net.micode.notes.R;
public class ChangingPassword extends Activity {
EditText OldPassword;
EditText NewPassword;
EditText AckPassword;
Button Acknowledged;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_change_password);
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);
AckPassword=(EditText) findViewById(R.id.ack_password);
Acknowledged=(Button)findViewById(R.id.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 = AckPassword.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(ChangingPassword.this, "密码不能为空", Toast.LENGTH_SHORT).show();
}else if (new_password.equals(ack_password) == false) {
Toast.makeText(ChangingPassword.this, "新建密码与重复密码不匹配,请重新输入密码", Toast.LENGTH_SHORT).show();
AckPassword.setText("");
}else if(old_password.equals(login_password) == false){
Toast.makeText(ChangingPassword.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(ChangingPassword.this, "修改密码成功", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(ChangingPassword.this,NotesListActivity.class);
startActivity(intent);
finish();
}
}
});
}
@Override
public void onBackPressed() {
Intent intent=new Intent(ChangingPassword.this,NotesListActivity.class);
startActivity(intent);
finish();
}
}

@ -29,7 +29,8 @@ import android.widget.FrameLayout;
import android.widget.NumberPicker;
public class DateTimePicker extends FrameLayout {
//FrameLayout是布局模板之一
//所有的子元素全部在屏幕的右上方
private static final boolean DEFAULT_ENABLE_STATE = true;
private static final int HOURS_IN_HALF_DAY = 12;
@ -45,13 +46,15 @@ public class DateTimePicker extends FrameLayout {
private static final int MINUT_SPINNER_MAX_VAL = 59;
private static final int AMPM_SPINNER_MIN_VAL = 0;
private static final int AMPM_SPINNER_MAX_VAL = 1;
//初始化控件
private final NumberPicker mDateSpinner;
private final NumberPicker mHourSpinner;
private final NumberPicker mMinuteSpinner;
private final NumberPicker mAmPmSpinner;
//NumberPicker是数字选择器
//这里定义的四个变量全部是在设置闹钟时需要选择的变量(如日期、时、分、上午或者下午)
private Calendar mDate;
//定义了Calendar类型的变量mDate用于操作时间
private String[] mDateDisplayValues = new String[DAYS_IN_ALL_WEEK];
private boolean mIsAm;
@ -71,40 +74,49 @@ public class DateTimePicker extends FrameLayout {
updateDateControl();
onDateTimeChanged();
}
};
};//OnValueChangeListener这是时间改变监听器这里主要是对日期的监听
//将现在日期的值传递给mDateupdateDateControl是同步操作
private NumberPicker.OnValueChangeListener mOnHourChangedListener = new NumberPicker.OnValueChangeListener() {
//这里是对 小时Hour 的监听
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
boolean isDateChanged = false;
Calendar cal = Calendar.getInstance();
//声明一个Calendar的变量cal便于后续的操作
if (!mIs24HourView) {
if (!mIsAm && oldVal == HOURS_IN_HALF_DAY - 1 && newVal == HOURS_IN_HALF_DAY) {
cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, 1);
isDateChanged = true;
//这里是对于12小时制时晚上11点和12点交替时对日期的更改
} else if (mIsAm && oldVal == HOURS_IN_HALF_DAY && newVal == HOURS_IN_HALF_DAY - 1) {
cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, -1);
isDateChanged = true;
}
//这里是对于12小时制时凌晨11点和12点交替时对日期的更改
if (oldVal == HOURS_IN_HALF_DAY - 1 && newVal == HOURS_IN_HALF_DAY ||
oldVal == HOURS_IN_HALF_DAY && newVal == HOURS_IN_HALF_DAY - 1) {
mIsAm = !mIsAm;
updateAmPmControl();
}
//这里是对于12小时制时中午11点和12点交替时对AM和PM的更改
} else {
if (oldVal == HOURS_IN_ALL_DAY - 1 && newVal == 0) {
cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, 1);
isDateChanged = true;
//这里是对于24小时制时晚上11点和12点交替时对日期的更改
} else if (oldVal == 0 && newVal == HOURS_IN_ALL_DAY - 1) {
cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, -1);
isDateChanged = true;
}
//这里是对于12小时制时凌晨11点和12点交替时对日期的更改
}
//通过数字选择器对newHour的赋值
int newHour = mHourSpinner.getValue() % HOURS_IN_HALF_DAY + (mIsAm ? 0 : HOURS_IN_HALF_DAY);
//通过set函数将新的Hour值传给mDate
mDate.set(Calendar.HOUR_OF_DAY, newHour);
onDateTimeChanged();
if (isDateChanged) {
@ -117,15 +129,19 @@ public class DateTimePicker extends FrameLayout {
private NumberPicker.OnValueChangeListener mOnMinuteChangedListener = new NumberPicker.OnValueChangeListener() {
@Override
//这里是对 分钟Minute改变的监听
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
int minValue = mMinuteSpinner.getMinValue();
int maxValue = mMinuteSpinner.getMaxValue();
//设置offset作为小时改变的一个记录数据
int offset = 0;
if (oldVal == maxValue && newVal == minValue) {
offset += 1;
} else if (oldVal == minValue && newVal == maxValue) {
offset -= 1;
}
//如果原值为59新值为0则offset加1
//如果原值为0新值为59则offset减1
if (offset != 0) {
mDate.add(Calendar.HOUR_OF_DAY, offset);
mHourSpinner.setValue(getCurrentHour());
@ -146,6 +162,7 @@ public class DateTimePicker extends FrameLayout {
private NumberPicker.OnValueChangeListener mOnAmPmChangedListener = new NumberPicker.OnValueChangeListener() {
@Override
//对AM和PM的监听
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
mIsAm = !mIsAm;
if (mIsAm) {
@ -162,21 +179,26 @@ public class DateTimePicker extends FrameLayout {
void onDateTimeChanged(DateTimePicker view, int year, int month,
int dayOfMonth, int hourOfDay, int minute);
}
//通过对数据库的访问,获取当前的系统时间
public DateTimePicker(Context context) {
this(context, System.currentTimeMillis());
}
//上面函数的得到的是一个天文数字1970至今的秒数需要DateFormat将其变得有意义
public DateTimePicker(Context context, long date) {
this(context, date, DateFormat.is24HourFormat(context));
}
public DateTimePicker(Context context, long date, boolean is24HourView) {
super(context);
//获取系统时间
mDate = Calendar.getInstance();
mInitialising = true;
mIsAm = getCurrentHourOfDay() >= HOURS_IN_HALF_DAY;
inflate(context, R.layout.datetime_picker, this);
//如果当前Activity里用到别的layout比如对话框layout
//还要设置这个layout上的其他组件的内容就必须用inflate()方法先将对话框的layout找出来
//然后再用findViewById()找到它上面的其它组件
mDateSpinner = (NumberPicker) findViewById(R.id.date);
mDateSpinner.setMinValue(DATE_SPINNER_MIN_VAL);
@ -226,7 +248,8 @@ public class DateTimePicker extends FrameLayout {
mAmPmSpinner.setEnabled(enabled);
mIsEnabled = enabled;
}
//下面的代码通过原程序的注释已经比较清晰,另外可以通过函数名来判断
//下面的各函数主要是对上面代码引用到的各函数功能的实现
@Override
public boolean isEnabled() {
return mIsEnabled;
@ -446,6 +469,7 @@ public class DateTimePicker extends FrameLayout {
mDateSpinner.setDisplayedValues(mDateDisplayValues);
mDateSpinner.setValue(DAYS_IN_ALL_WEEK / 2);
mDateSpinner.invalidate();
// 对于星期几的算法
}
private void updateAmPmControl() {
@ -456,6 +480,7 @@ public class DateTimePicker extends FrameLayout {
mAmPmSpinner.setValue(index);
mAmPmSpinner.setVisibility(View.VISIBLE);
}
// 对于上下午操作的算法
}
private void updateHourControl() {
@ -466,6 +491,7 @@ public class DateTimePicker extends FrameLayout {
mHourSpinner.setMinValue(HOUR_SPINNER_MIN_VAL_12_HOUR_VIEW);
mHourSpinner.setMaxValue(HOUR_SPINNER_MAX_VAL_12_HOUR_VIEW);
}
// 对于小时的算法
}
/**

@ -71,14 +71,22 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener
public void setOnDateTimeSetListener(OnDateTimeSetListener callBack) {
mOnDateTimeSetListener = callBack;
}
/*
updateTitle date
ActivityFragment
*/
private void updateTitle(long date) {
//定义了一个私有方法 updateTitle它接受一个 long 类型的参数 date
int flag =
DateUtils.FORMAT_SHOW_YEAR |
//初始化一个整数变量 flag它通过按位或操作符|)组合了三个常量。
//这些常量可能来自 DateUtils 类,用于指示日期和时间的显示格式
DateUtils.FORMAT_SHOW_DATE |
DateUtils.FORMAT_SHOW_TIME;
flag |= mIs24HourView ? DateUtils.FORMAT_24HOUR : DateUtils.FORMAT_24HOUR;
setTitle(DateUtils.formatDateTime(this.getContext(), date, flag));
//使用 DateUtils.formatDateTime 方法来格式化日期和时间并将其设置为当前视图可能是Activity或Fragment的标题。
// 该方法接受三个参数:上下文、日期和格式标志。
}
public void onClick(DialogInterface arg0, int arg1) {

@ -0,0 +1,63 @@
package net.micode.notes.ui;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import net.micode.notes.R;
public class DeletingPassword extends Activity {
EditText Dt_password;
Button Acknowledged;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_delete_password);
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
| WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
Dt_password=(EditText) findViewById(R.id.thepassword);
Acknowledged=(Button)findViewById(R.id.Dt_Acknowledged);
Acknowledged.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String text02 = Dt_password.getText().toString();
if(text02.equals("")==true)
Toast.makeText(DeletingPassword.this, "密码不能为空", Toast.LENGTH_SHORT).show();
SharedPreferences pref=getSharedPreferences("user management",MODE_PRIVATE);
String password = pref.getString("password","");
if(password.equals("")==false&&password.equals(text02)==true){
SharedPreferences.Editor editor=getSharedPreferences("user management",
MODE_PRIVATE).edit();
editor.putBoolean("user",false);//false表示已经设置登录密码
editor.putString("password","");
editor.apply();
Toast.makeText(DeletingPassword.this, "已经删除登录密码", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(DeletingPassword.this,NotesListActivity.class);
startActivity(intent);
finish();
}
else{
Toast.makeText(DeletingPassword.this, "密码错误", Toast.LENGTH_SHORT).show();
Dt_password.setText("");//把密码框内输入过的错误密码清空
}
}
});
}
@Override
public void onBackPressed() {
Intent intent=new Intent(DeletingPassword.this,NotesListActivity.class);
startActivity(intent);
finish();
}
}

@ -0,0 +1,43 @@
package net.micode.notes.ui;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import net.micode.notes.R;
public class GetLocation extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.local);
Toast.makeText(GetLocation.this,"init",Toast.LENGTH_SHORT).show();
Button local_1 = new Button(this);
Button local_2 = new Button(this);
local_1.setOnClickListener(new View.OnClickListener() {
private static final String TAG = "GetLocation";
@Override
public void onClick(View v) {
Log.i(TAG, "onClick: button1");
Toast.makeText(GetLocation.this,"button1",Toast.LENGTH_SHORT).show();
}
});
local_2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(GetLocation.this, "button2", Toast.LENGTH_SHORT).show();
}
});
}
}

@ -0,0 +1,57 @@
package net.micode.notes.ui;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import net.micode.notes.R;
public class LoginActivity extends Activity {
EditText lg_password;
Button lg_login;
@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时没有设置密码直接跳转到便签主界面
{
Intent intent=new Intent(LoginActivity.this,NotesListActivity.class);
startActivity(intent);
finish();
}
setContentView(R.layout.activity_login);
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE
| WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
lg_password=(EditText) findViewById(R.id.lg_password);
lg_login=(Button)findViewById(R.id.login);
lg_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences pref=getSharedPreferences("user management",MODE_PRIVATE);
String password=pref.getString("password","");
if(password.equals("")==false&&password.equals(lg_password.getText().toString())==true){
Intent intent=new Intent(LoginActivity.this,NotesListActivity.class);
startActivity(intent);
finish();
}
else{
Toast.makeText(LoginActivity.this, "密码错误", Toast.LENGTH_SHORT).show();
lg_password.setText("");//把密码框内输入过的错误密码清空
}
}
}
);
}
}

File diff suppressed because it is too large Load Diff

@ -37,7 +37,7 @@ import net.micode.notes.R;
import java.util.HashMap;
import java.util.Map;
public class NoteEditText extends EditText {
public class NoteEditText extends android.support.v7.widget.AppCompatEditText {
private static final String TAG = "NoteEditText";
private int mIndex;
private int mSelectionStartBeforeDelete;
@ -45,7 +45,7 @@ public class NoteEditText extends EditText {
private static final String SCHEME_TEL = "tel:" ;
private static final String SCHEME_HTTP = "http:" ;
private static final String SCHEME_EMAIL = "mailto:" ;
// 存储不同 schema 对应的资源 ID 映射关系
private static final Map<String, Integer> sSchemaActionResMap = new HashMap<String, Integer>();
static {
sSchemaActionResMap.put(SCHEME_TEL, R.string.note_link_tel);
@ -81,11 +81,15 @@ public class NoteEditText extends EditText {
super(context, null);
mIndex = 0;
}
/**
*
*/
public void setIndex(int index) {
mIndex = index;
}
/**
*
*/
public void setOnTextViewChangeListener(OnTextViewChangeListener listener) {
mOnTextViewChangeListener = listener;
}
@ -99,21 +103,27 @@ public class NoteEditText extends EditText {
// TODO Auto-generated constructor stub
}
/**
*
*/
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
// 获取点击位置的坐标
int x = (int) event.getX();
int y = (int) event.getY();
// 调整坐标位置
x -= getTotalPaddingLeft();
y -= getTotalPaddingTop();
x += getScrollX();
y += getScrollY();
// 获取布局信息
Layout layout = getLayout();
int line = layout.getLineForVertical(y);
int off = layout.getOffsetForHorizontal(line, x);
// 设置选中文本的位置
Selection.setSelection(getText(), off);
break;
}
@ -125,11 +135,13 @@ public class NoteEditText extends EditText {
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_ENTER:
// 当按下回车键时,如果存在文本视图变化监听器,则返回 false
if (mOnTextViewChangeListener != null) {
return false;
}
break;
case KeyEvent.KEYCODE_DEL:
// 当按下删除键时,记录删除前光标位置
mSelectionStartBeforeDelete = getSelectionStart();
break;
default:
@ -138,10 +150,14 @@ public class NoteEditText extends EditText {
return super.onKeyDown(keyCode, event);
}
/**
*
*/
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
switch(keyCode) {
case KeyEvent.KEYCODE_DEL:
// 当按下删除键时如果存在文本视图变化监听器并且删除前光标位置为0且索引不为0则通知监听器文本删除事件
if (mOnTextViewChangeListener != null) {
if (0 == mSelectionStartBeforeDelete && mIndex != 0) {
mOnTextViewChangeListener.onEditTextDelete(mIndex, getText().toString());
@ -152,6 +168,7 @@ public class NoteEditText extends EditText {
}
break;
case KeyEvent.KEYCODE_ENTER:
// 当按下回车键时,如果存在文本视图变化监听器,则通知监听器文本回车事件
if (mOnTextViewChangeListener != null) {
int selectionStart = getSelectionStart();
String text = getText().subSequence(selectionStart, length()).toString();
@ -167,9 +184,13 @@ public class NoteEditText extends EditText {
return super.onKeyUp(keyCode, event);
}
/**
*
*/
@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
if (mOnTextViewChangeListener != null) {
// 如果失去焦点且文本为空,则通知监听器文本变化事件为 false否则为 true
if (!focused && TextUtils.isEmpty(getText())) {
mOnTextViewChangeListener.onTextChange(mIndex, false);
} else {
@ -179,29 +200,35 @@ public class NoteEditText extends EditText {
super.onFocusChanged(focused, direction, previouslyFocusedRect);
}
/**
*
*/
@Override
protected void onCreateContextMenu(ContextMenu menu) {
if (getText() instanceof Spanned) {
// 获取选中文本的起始和结束位置
int selStart = getSelectionStart();
int selEnd = getSelectionEnd();
// 确保 min 表示选中文本的起始位置max 表示结束位置
int min = Math.min(selStart, selEnd);
int max = Math.max(selStart, selEnd);
// 获取选中文本中的URLSpan对象数组
final URLSpan[] urls = ((Spanned) getText()).getSpans(min, max, URLSpan.class);
// 如果选中的文本中包含一个URLSpan对象
if (urls.length == 1) {
int defaultResId = 0;
for(String schema: sSchemaActionResMap.keySet()) {
// 如果URL中包含当前模式则获取对应的资源ID
if(urls[0].getURL().indexOf(schema) >= 0) {
defaultResId = sSchemaActionResMap.get(schema);
break;
}
}
// 如果没有找到匹配的模式则使用默认资源ID
if (defaultResId == 0) {
defaultResId = R.string.note_link_other;
}
// 在上下文菜单中添加一个菜单项显示默认资源ID并设置点击监听器
menu.add(0, 0, 0, defaultResId).setOnMenuItemClickListener(
new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {

@ -28,35 +28,35 @@ import net.micode.notes.tool.DataUtils;
public class NoteItemData {
//一个静态的投影数组 PROJECTION用于在数据库查询时指定返回的列
static final String[] PROJECTION = new String[]{
NoteColumns.ID,
NoteColumns.ALERTED_DATE,
NoteColumns.BG_COLOR_ID,
NoteColumns.CREATED_DATE,
NoteColumns.HAS_ATTACHMENT,
NoteColumns.MODIFIED_DATE,
NoteColumns.NOTES_COUNT,
NoteColumns.PARENT_ID,
NoteColumns.SNIPPET,
NoteColumns.TYPE,
NoteColumns.WIDGET_ID,
NoteColumns.WIDGET_TYPE,
static final String [] PROJECTION = new String [] {
NoteColumns.ID,
NoteColumns.ALERTED_DATE,
NoteColumns.BG_COLOR_ID,
NoteColumns.CREATED_DATE,
NoteColumns.HAS_ATTACHMENT,
NoteColumns.MODIFIED_DATE,
NoteColumns.NOTES_COUNT,
NoteColumns.PARENT_ID,
NoteColumns.SNIPPET,
NoteColumns.TYPE,
NoteColumns.WIDGET_ID,
NoteColumns.WIDGET_TYPE,
NoteColumns.TOP,
};
//定义了一系列静态常量,表示 PROJECTION 中对应列的索引位置。
private static final int ID_COLUMN = 0;
private static final int ALERTED_DATE_COLUMN = 1;
private static final int BG_COLOR_ID_COLUMN = 2;
private static final int CREATED_DATE_COLUMN = 3;
private static final int HAS_ATTACHMENT_COLUMN = 4;
private static final int MODIFIED_DATE_COLUMN = 5;
private static final int NOTES_COUNT_COLUMN = 6;
private static final int PARENT_ID_COLUMN = 7;
private static final int SNIPPET_COLUMN = 8;
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 ID_COLUMN = 0;
private static final int ALERTED_DATE_COLUMN = 1;
private static final int BG_COLOR_ID_COLUMN = 2;
private static final int CREATED_DATE_COLUMN = 3;
private static final int HAS_ATTACHMENT_COLUMN = 4;
private static final int MODIFIED_DATE_COLUMN = 5;
private static final int NOTES_COUNT_COLUMN = 6;
private static final int PARENT_ID_COLUMN = 7;
private static final int SNIPPET_COLUMN = 8;
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 TOP_ID_COLUMN = 12;
//用于存储笔记项各种属性的成员变量
private long mId; // 笔记ID
@ -73,6 +73,7 @@ public class NoteItemData {
private int mWidgetType; // 小部件类型
private String mName; // 笔记名称
private String mPhoneNumber; // 电话号码
private String mTop;
private boolean mIsLastItem; // 是否为列表中的最后一项
private boolean mIsFirstItem; // 是否为列表中的第一项
@ -103,6 +104,7 @@ public class NoteItemData {
mType = cursor.getInt(TYPE_COLUMN); // 笔记类型
mWidgetId = cursor.getInt(WIDGET_ID_COLUMN); // 笔记关联的小部件ID
mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN); // 小部件类型
mTop = cursor.getString(TOP_ID_COLUMN);
mPhoneNumber = "";
// 如果笔记所属文件夹为通话记录文件夹,则获取通话号码并设置笔记名称
@ -115,17 +117,14 @@ public class NoteItemData {
}
}
}
// 如果笔记名称为null则设置为空字符串
if (mName == null) {
mName = "";
}
// 检查笔记在列表中的位置
checkPostion(cursor);
}
/**
*
*
@ -133,30 +132,27 @@ public class NoteItemData {
*/
private void checkPostion(Cursor cursor) {
// 判断当前笔记是否为最后一项
mIsLastItem = cursor.isLast();
mIsLastItem = cursor.isLast() ? true : false;
// 判断当前笔记是否为第一项
mIsFirstItem = cursor.isFirst();
mIsFirstItem = cursor.isFirst() ? true : false;
// 判断列表中是否只有一项笔记
mIsOnlyOneItem = (cursor.getCount() == 1);
// 初始化位置相关标识为false
mIsMultiNotesFollowingFolder = false;
mIsOneNoteFollowingFolder = false;
// 如果笔记类型为普通笔记且不是第一项笔记
if (mType == Notes.TYPE_NOTE && !mIsFirstItem) {
int position = cursor.getPosition(); // 获取当前位置
if (cursor.moveToPrevious()) { // 移动Cursor到上一项
int position = cursor.getPosition();// 获取当前位置
if (cursor.moveToPrevious()) {// 移动Cursor到上一项
// 如果上一项为文件夹或系统类型
if (cursor.getInt(TYPE_COLUMN) == Notes.TYPE_FOLDER
|| cursor.getInt(TYPE_COLUMN) == Notes.TYPE_SYSTEM) {
// 判断当前位置后是否还有多个笔记
// 判断当前位置后是否还有多个笔记
if (cursor.getCount() > (position + 1)) {
mIsMultiNotesFollowingFolder = true; // 当前文件夹后有多个笔记
mIsMultiNotesFollowingFolder = true;// 当前文件夹后有多个笔记
} else {
mIsOneNoteFollowingFolder = true; // 当前文件夹后只有一个笔记
mIsOneNoteFollowingFolder = true;// 当前文件夹后只有一个笔记
}
}
// 如果无法移动到下一项,抛出异常
@ -167,7 +163,13 @@ public class NoteItemData {
}
}
public boolean isTOP() {
if(mTop.equals("1")) {
return true;
}else {
return false;
}
}
//以下函数用于返回笔记项各种属性对应的成员变量
public boolean isOneFollowingFolder() {
return mIsOneNoteFollowingFolder;
@ -225,7 +227,7 @@ public class NoteItemData {
return mNotesCount;
}
public long getFolderId() {
public long getFolderId () {
return mParentId;
}

File diff suppressed because it is too large Load Diff

@ -30,90 +30,56 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
/*
* 便CursorAdaptercursorListView
* NotesListAdapter便
*/
public class NotesListAdapter extends CursorAdapter {
private static final String TAG = "NotesListAdapter";
private Context mContext;
private HashMap<Integer, Boolean> mSelectedIndex;
private int mNotesCount;//便签数量
private boolean mChoiceMode;//选择模式标记
private int mNotesCount;
private boolean mChoiceMode;
/*
* widget
*/
public static class AppWidgetAttribute {
public int widgetId;
public int widgetType;
};
/*
* 便
*
*/
public NotesListAdapter(Context context) {
super(context, null);//调用父类的构造方法并传入context和null作为参数
mSelectedIndex = new HashMap<Integer, Boolean>();// 初始化一个HashMap用于跟踪每个便签项是否被选中
mContext = context; // 存储上下文引用,通常用于后续的操作,比如访问资源
mNotesCount = 0;//初始化便签的数量为0
super(context, null);
mSelectedIndex = new HashMap<Integer, Boolean>();
mContext = context;
mNotesCount = 0;
}
/*
*
* 使NotesListItem
*/
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
return new NotesListItem(context);//NoteListItem就是下一个类
return new NotesListItem(context);
}
/*
*
*
*/
@Override
public void bindView(View view, Context context, Cursor cursor) {
if (view instanceof NotesListItem) {//如果view是NotesListItem的一个实例
if (view instanceof NotesListItem) {
NoteItemData itemData = new NoteItemData(context, cursor);
((NotesListItem) view).bind(context, itemData, mChoiceMode,
isSelectedItem(cursor.getPosition()));
//则新建一个项目选项并且用bind跟将view和鼠标内容便签数据捆绑在一起
}
}
/*
*
*
*/
public void setCheckedItem(final int position, final boolean checked) {
mSelectedIndex.put(position, checked);//根据定位和是否勾选设置下标
notifyDataSetChanged();//在修改后刷新activity
mSelectedIndex.put(position, checked);
notifyDataSetChanged();
}
/*
*
*/
public boolean isInChoiceMode() {
return mChoiceMode;
}
/*
*
* mode
*/
public void setChoiceMode(boolean mode) {
mSelectedIndex.clear();
mChoiceMode = mode;
}
/*
*
*
*/
public void selectAll(boolean checked) {
Cursor cursor = getCursor();//获取光标位置
Cursor cursor = getCursor();
for (int i = 0; i < getCount(); i++) {
if (cursor.moveToPosition(i)) {
if (NoteItemData.getNoteType(cursor) == Notes.TYPE_NOTE) {
@ -121,25 +87,17 @@ public class NotesListAdapter extends CursorAdapter {
}
}
}
//遍历所有光标可用的位置在判断为便签类型之后勾选单项框
}
/*
*
*
*/
public HashSet<Long> getSelectedItemIds() {
HashSet<Long> itemSet = new HashSet<Long>();//建立hash表
HashSet<Long> itemSet = new HashSet<Long>();
for (Integer position : mSelectedIndex.keySet()) {
//遍历所有的关键
if (mSelectedIndex.get(position) == true) {
//若光标位置可用
Long id = getItemId(position);
if (id == Notes.ID_ROOT_FOLDER) {
//原文件不需要添加
Log.d(TAG, "Wrong item id, should not happen");
} else {
itemSet.add(id);//将id该下标加入到选项集合中
itemSet.add(id);
}
}
}
@ -147,17 +105,12 @@ public class NotesListAdapter extends CursorAdapter {
return itemSet;
}
/*
* Widget
*
*/
public HashSet<AppWidgetAttribute> getSelectedWidget() {
HashSet<AppWidgetAttribute> itemSet = new HashSet<AppWidgetAttribute>();//建立hash表
for (Integer position : mSelectedIndex.keySet()) {//遍历所有关键
if (mSelectedIndex.get(position) == true) {//若光标位置可用
HashSet<AppWidgetAttribute> itemSet = new HashSet<AppWidgetAttribute>();
for (Integer position : mSelectedIndex.keySet()) {
if (mSelectedIndex.get(position) == true) {
Cursor c = (Cursor) getItem(position);
if (c != null) {
//光标位置可用的话就建立新的Widget属性并编辑下标和类型最后添加到选项集中
AppWidgetAttribute widget = new AppWidgetAttribute();
NoteItemData item = new NoteItemData(mContext, c);
widget.widgetId = item.getWidgetId();
@ -175,41 +128,26 @@ public class NotesListAdapter extends CursorAdapter {
return itemSet;
}
/*
*
*
*/
public int getSelectedCount() {
Collection<Boolean> values = mSelectedIndex.values();
//获取选项下标的值
if (null == values) {
return 0;
}
Iterator<Boolean> iter = values.iterator();
//初始化叠加器
int count = 0;
while (iter.hasNext()) {
if (true == iter.next()) {//如果value的值为真计数器+1
if (true == iter.next()) {
count++;
}
}
return count;
}
/*
*
*
*/
public boolean isAllSelected() {
int checkedCount = getSelectedCount();
return (checkedCount != 0 && checkedCount == mNotesCount);
//获取选项数看是否等于便签的个数
}
/*
*
*
*/
public boolean isSelectedItem(final int position) {
if (null == mSelectedIndex.get(position)) {
return false;
@ -217,45 +155,30 @@ public class NotesListAdapter extends CursorAdapter {
return mSelectedIndex.get(position);
}
/*
* activity便
*
*/
@Override
protected void onContentChanged() {
super.onContentChanged();
//执行基类函数
calcNotesCount();
}
/*
* activity便
*/
@Override
public void changeCursor(Cursor cursor) {
super.changeCursor(cursor);//执行基类函数
super.changeCursor(cursor);
calcNotesCount();
}
/*
* 便
*
*/
private void calcNotesCount() {
mNotesCount = 0;
for (int i = 0; i < getCount(); i++) {
//获取总数同时遍历
Cursor c = (Cursor) getItem(i);
if (c != null) {
if (NoteItemData.getNoteType(c) == Notes.TYPE_NOTE) {
mNotesCount++;
//若该位置不为空并且文本类型为便签就+1
}
} else {
Log.e(TAG, "Invalid cursor");
return;
}
//否则报错
}
}
}

@ -30,44 +30,39 @@ import net.micode.notes.tool.DataUtils;
import net.micode.notes.tool.ResourceParser.NoteItemBgResources;
//创建便签列表项目选项
public class NotesListItem extends LinearLayout {
private ImageView mAlert;//闹钟图片
private TextView mTitle;//标题
private TextView mTime;//时间
private ImageView mAlert;
private TextView mTitle;
private TextView mTime;
private TextView mCallName;
private NoteItemData mItemData;//标签数据
private CheckBox mCheckBox;//打钩框
private NoteItemData mItemData;
private CheckBox mCheckBox;
private ImageView mTop;
/*初始化基本信息*/
public NotesListItem(Context context) {
super(context); //super()它的主要作用是调整调用父类构造函数的顺序
inflate(context, R.layout.note_item, this);//Inflate可用于将一个xml中定义的布局控件找出来,这里的xml是r。layout
//findViewById用于从contentView中查找指定ID的View转换出来的形式根据需要而定;
super(context);
inflate(context, R.layout.note_item, this);
mAlert = (ImageView) findViewById(R.id.iv_alert_icon);
mTitle = (TextView) findViewById(R.id.tv_title);
mTime = (TextView) findViewById(R.id.tv_time);
mCallName = (TextView) findViewById(R.id.tv_name);
mCheckBox = (CheckBox) findViewById(android.R.id.checkbox);
mTop = (ImageView) findViewById(R.id.iv_top_icon);
}
///根据data的属性对各个控件的属性的控制主要是可见性Visibility内容setText格式setTextAppearance
public void bind(Context context, NoteItemData data, boolean choiceMode, boolean checked) {
if (choiceMode && data.getType() == Notes.TYPE_NOTE) {
mCheckBox.setVisibility(View.VISIBLE);//设置可见行为可见
mCheckBox.setChecked(checked);//格子打勾
mCheckBox.setVisibility(View.VISIBLE);
mCheckBox.setChecked(checked);
} else {
mCheckBox.setVisibility(View.GONE);
}
mItemData = data;
///设置控件属性一共三种情况由data的id和父id是否与保存到文件夹的id一致来决定
if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) {
mCallName.setVisibility(View.GONE);
mAlert.setVisibility(View.VISIBLE);
//设置该textview的style
mTitle.setTextAppearance(context, R.style.TextAppearancePrimaryItem);
//settext为设置内容
mTitle.setText(context.getString(R.string.call_record_folder_name)
+ context.getString(R.string.format_folder_files_count, data.getNotesCount()));
mAlert.setImageResource(R.drawable.call_record);
@ -76,9 +71,8 @@ public class NotesListItem extends LinearLayout {
mCallName.setText(data.getCallName());
mTitle.setTextAppearance(context,R.style.TextAppearanceSecondaryItem);
mTitle.setText(DataUtils.getFormattedSnippet(data.getSnippet()));
//关于闹钟的设置
if (data.hasAlert()) {
mAlert.setImageResource(R.drawable.clock);//图片来源设置
mAlert.setImageResource(R.drawable.clock);
mAlert.setVisibility(View.VISIBLE);
} else {
mAlert.setVisibility(View.GONE);
@ -86,7 +80,7 @@ public class NotesListItem extends LinearLayout {
} else {
mCallName.setVisibility(View.GONE);
mTitle.setTextAppearance(context, R.style.TextAppearancePrimaryItem);
//设置title格式
if (data.getType() == Notes.TYPE_FOLDER) {
mTitle.setText(data.getSnippet()
+ context.getString(R.string.format_folder_files_count,
@ -96,37 +90,38 @@ public class NotesListItem extends LinearLayout {
mTitle.setText(DataUtils.getFormattedSnippet(data.getSnippet()));
if (data.hasAlert()) {
mAlert.setImageResource(R.drawable.clock);
//设置图片来源
mAlert.setVisibility(View.VISIBLE);
} else {
mAlert.setVisibility(View.GONE);
}
}
if(data.isTOP()){
mTop.setImageResource(R.drawable.menu_top);
mTop.setVisibility(View.VISIBLE);
} else{
mTop.setVisibility((View.GONE));
}
}
///设置内容获取相关时间从data里编辑的日期中获取
mTime.setText(DateUtils.getRelativeTimeSpanString(data.getModifiedDate()));
setBackground(data);
}
//根据data的文件属性来设置背景
private void setBackground(NoteItemData data) {
int id = data.getBgColorId();
//若是note型文件则4种情况对于4种不同情况的背景来源
if (data.getType() == Notes.TYPE_NOTE) {
//单个数据并且只有一个子文件夹
if (data.isSingle() || data.isOneFollowingFolder()) {
setBackgroundResource(NoteItemBgResources.getNoteBgSingleRes(id));
} else if (data.isLast()) {//是最后一个数据
} else if (data.isLast()) {
setBackgroundResource(NoteItemBgResources.getNoteBgLastRes(id));
} else if (data.isFirst() || data.isMultiFollowingFolder()) {
//是一个数据并有多个子文件夹
setBackgroundResource(NoteItemBgResources.getNoteBgFirstRes(id));
} else {
setBackgroundResource(NoteItemBgResources.getNoteBgNormalRes(id));
}
} else {
//若不是note直接调用文件夹的背景来源
setBackgroundResource(NoteItemBgResources.getFolderBgRes());
}
}

@ -0,0 +1,67 @@
package net.micode.notes.ui;
import static android.content.Context.MODE_PRIVATE;
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;
import net.micode.notes.R;
public class SettingPassword extends Activity {
EditText password;
EditText password_ack;
Button acknowledge;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_set_loginpassword);
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
| WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
password=(EditText) findViewById(R.id.password);
password_ack=(EditText) findViewById(R.id.password_ack);
acknowledge=(Button)findViewById(R.id.acknowledge);
acknowledge.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String text02 = password.getText().toString();
String text03 = password_ack.getText().toString();
if(text02.equals("")==true) {
Toast.makeText(SettingPassword.this, "密码不能为空", Toast.LENGTH_SHORT).show();
}else if (text02.equals(text03) == false) {
Toast.makeText(SettingPassword.this, "密码不匹配,请重新输入密码", Toast.LENGTH_SHORT).show();
password_ack.setText("");
}else if (text02.equals(text03) == true){
SharedPreferences.Editor editor=getSharedPreferences("user management",
MODE_PRIVATE).edit();
editor.putBoolean("user",true);//true表示已经设置登录密码
editor.putString("password",text02);
editor.apply();
Log.d("RegisterLoginPassword","password is "+text02);
Toast.makeText(SettingPassword.this, "设置密码成功", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(SettingPassword.this,NotesListActivity.class);
startActivity(intent);
finish();
}
}
});
}
@Override
public void onBackPressed() {
Intent intent=new Intent(SettingPassword.this,NotesListActivity.class);
startActivity(intent);
finish();
}
}

@ -0,0 +1,31 @@
package net.micode.notes.ui;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowInsets;
import net.micode.notes.R;
public class SplashActivity extends AppCompatActivity {
Handler mHandler=new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); //加载启动界面
setContentView(R.layout.activity_splash); //加载启动
// 当计时结束时跳转至NotesListActivity
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
Intent intent=new Intent();
intent.setClass(SplashActivity.this, LoginActivity.class);
startActivity(intent);
finish(); //销毁欢迎页面
}}, 2000); // 2 秒后跳转}
}
}

@ -0,0 +1,95 @@
package net.micode.notes.ui;
import android.app.Activity;
import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import net.micode.notes.R;
import net.micode.notes.data.WeatherBean;
import java.io.IOException;
import java.lang.reflect.Type;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class WeatherActivity extends Activity {
EditText et_search;
TextView tv_search,city,weather;
String content;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_weather);
et_search = (EditText) findViewById(R.id.et_search);
tv_search = (TextView) findViewById(R.id.tv_search);
weather = (TextView) findViewById(R.id.weather);
city = (TextView) findViewById(R.id.content);
tv_search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
content = et_search.getText().toString();
request();
}
});
}
private void request() {
//通过okhttp访问servlet
String strURL = "https://apis.tianapi.com/tianqi/index?key=46b609e64712e310beaabd3901fce265&city=101020100&city="+content+"&type=1";
Request request = new Request.Builder()
.url(strURL)
.build();
OkHttpClient okHttpClient = new OkHttpClient();
Call call = okHttpClient.newCall(request);
//接收相应,进入子线程
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
Message message = new Message();
message.what = 2;
message.obj = e.getMessage();
//通过handler向主线程发生json数据
}
@Override
public void onResponse(Call call, Response response) throws IOException {
String json = response.body().string();
Log.d("weather","weather"+json);
Gson gson = new Gson();
Type type = new TypeToken<WeatherBean>(){}.getType();
WeatherBean weatherObject = gson.fromJson(json, type);
if (weatherObject.code == 200) {
runOnUiThread(new Runnable() {
@Override
public void run() {
city.setText("城市:"+weatherObject.result.area);
weather.setText(weatherObject.result.weather+weatherObject.result.real);
}
});
}
}
});
}
}

@ -0,0 +1,13 @@
package net.micode.notes.ui.translate_demo;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
public interface BaiduTranslateService {
@POST("translate")
@FormUrlEncoded
Call<RespondBean> translate(@Field("q") String q, @Field("from") String from, @Field("to") String to, @Field("appid") String appid, @Field("salt") String salt,
@Field("sign") String sign);
}

@ -0,0 +1,35 @@
package net.micode.notes.ui.translate_demo;
import java.security.MessageDigest;
/**
* () MD5
*/
public class MD5Utils {
/**
* MD5使
*
* @param info String
* @return String
*/
public static String getMD5Code(String info) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(info.getBytes("utf-8"));//设置编码格式
byte[] encryption = md5.digest();
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < encryption.length; i++) {
if (Integer.toHexString(0xff & encryption[i]).length() == 1) {
stringBuffer.append("0").append(Integer.toHexString(0xff & encryption[i]));
} else {
stringBuffer.append(Integer.toHexString(0xff & encryption[i]));
}
}
return stringBuffer.toString();
} catch (Exception e) {
return "MD5加密异常";
}
}
}

@ -0,0 +1,66 @@
package net.micode.notes.ui.translate_demo;
import java.util.List;
public class RespondBean {
/**
* from : zh
* to : en
* trans_result : [{"src":"你好","dst":"Hello"}]
*/
private String from;
private String to;
private List<TransResultBean> trans_result;
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public List<TransResultBean> getTrans_result() {
return trans_result;
}
public void setTrans_result(List<TransResultBean> trans_result) {
this.trans_result = trans_result;
}
public static class TransResultBean {
/**
* src :
* dst : Hello
*/
private String src;
private String dst;
public String getSrc() {
return src;
}
public void setSrc(String src) {
this.src = src;
}
public String getDst() {
return dst;
}
public void setDst(String dst) {
this.dst = dst;
}
}
}

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -19,4 +19,4 @@
<item android:state_pressed="true" android:color="#88555555" />
<item android:state_selected="true" android:color="#ff999999" />
<item android:color="#ff000000" />
</selector>
</selector>

@ -17,4 +17,6 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#50000000" />
</selector>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

@ -15,22 +15,22 @@
limitations under the License.
-->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/account_dialog_title"
style="?android:attr/textAppearanceMedium"
android:singleLine="true"
android:ellipsize="end"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-2.7dip"
android:layout_marginBottom="-2.7dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
android:ellipsize="end"
android:gravity="center"
android:singleLine="true" />
<TextView
android:id="@+id/account_dialog_subtitle"
@ -38,6 +38,6 @@
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:layout_marginBottom="1dip"
android:gravity="center"/>
android:gravity="center" />
</LinearLayout>

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="旧密码:"/>
<EditText
android:id="@+id/old_password"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="新密码:"/>
<EditText
android:id="@+id/new_password"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="确认密码:"/>
<EditText
android:id="@+id/ack_password"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<Button
android:id="@+id/Acknowledged"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="确认"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="输入密码:"/>
<EditText
android:id="@+id/thepassword"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<Button
android:id="@+id/Dt_Acknowledged"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="确认"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密码:"/>
<EditText
android:id="@+id/lg_password"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<Button
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="登录"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="新建密码:"/>
<EditText
android:id="@+id/password"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="确认密码:"/>
<EditText
android:id="@+id/password_ack"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:password="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<Button
android:id="@+id/acknowledge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="确认"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0099cc"
tools:context=".ui.SplashActivity">
<!-- The primary full-screen view. This can be replaced with whatever view
is needed to present your content, e.g. VideoView, SurfaceView,
TextureView, etc. -->
<TextView
android:id="@+id/fullscreen_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:keepScreenOn="true"
android:text="@string/dummy_content"
android:textColor="#33b5e5"
android:textSize="50sp"
android:textStyle="bold" />
<!-- This FrameLayout insets its children based on system windows using
android:fitsSystemWindows. -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:id="@+id/fullscreen_content_controls"
style="?metaButtonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/black_overlay"
android:orientation="horizontal"
tools:ignore="UselessParent">
<Button
android:id="@+id/dummy_button"
style="?metaButtonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/dummy_button" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/cloudsky"
android:gravity="top"
android:keepScreenOn="true"
android:text="@string/dummy_content"
android:textSize="50dp"
android:textStyle="bold"
/>
</FrameLayout>
</FrameLayout>

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/et_search"
android:layout_width="match_parent"
android:layout_height="60dp" />
<TextView
android:id="@+id/tv_search"
android:layout_width="80dp"
android:layout_height="60dp"
android:gravity="center"
android:text="搜索"
android:textSize="28sp"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
android:background="#1296db"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="320dp"
android:gravity="center_vertical"
android:padding="20dp"
android:layout_margin="20dp"
android:background="#1296db">
<TextView
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp" />
<TextView
android:id="@+id/weather"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="60dp"
android:textColor="#d4237a"
android:textSize="28sp" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"/>
</LinearLayout>

@ -15,7 +15,7 @@
limitations under the License.
-->
<FrameLayout
<FrameLayout xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/list_background"
@ -26,11 +26,44 @@
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/local_sel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<LinearLayout
android:id="@+id/note_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/iatBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#6AE48E8E"
android:text="朗读"
android:visibility="visible" />
<Button
android:id="@+id/translate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#61B8F1F8"
android:text="翻译" />
<ImageButton
android:id="@+id/add_img_btn"
android:layout_width="45dp"
android:layout_height="match_parent"
android:src="@android:drawable/ic_menu_gallery" />
<TextView
android:id="@+id/tv_modified_date"
android:layout_width="0dip"
@ -56,11 +89,23 @@
android:layout_marginRight="8dip"
android:textAppearance="@style/TextAppearanceSecondaryItem" />
<ImageButton
<ImageView
android:id="@+id/btn_set_bg_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="10dp"
android:background="@drawable/bg_btn_set_color" />
<TextView
android:id="@+id/tv_set_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="2dip"
android:layout_marginRight="8dip"
android:textAppearance="@style/TextAppearanceSecondaryItem" />
</LinearLayout>
<LinearLayout
@ -85,7 +130,8 @@
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
android:layout_height="fill_parent"
android:orientation="horizontal">
<net.micode.notes.ui.NoteEditText
android:id="@+id/note_edit_view"
@ -109,6 +155,19 @@
</LinearLayout>
</ScrollView>
<TextView
android:id="@+id/num_word"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="点击获得地理信息"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="7dip"
@ -117,7 +176,6 @@
</LinearLayout>
<ImageView
android:id="@+id/btn_set_bg_color"
android:layout_height="43dip"
android:layout_width="wrap_content"
android:background="@drawable/bg_color_btn_mask"

@ -75,4 +75,12 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"/>
<ImageView
android:id="@+id/iv_top_icon"
android:layout_width="17dp"
android:layout_height="17dp"
android:layout_gravity="top|right"
android:layout_marginRight="40sp" />
</FrameLayout>

@ -18,8 +18,8 @@
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/list_background">
android:layout_height="fill_parent">
<!--android:background="@drawable/list_background"-->
<LinearLayout
android:layout_width="fill_parent"
@ -39,20 +39,20 @@
<ListView
android:id="@+id/notes_list"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:cacheColorHint="@null"
android:listSelector="@android:color/transparent"
android:divider="@null"
android:fadingEdge="@null" />
android:fadingEdge="@null"
android:listSelector="@android:color/transparent" />
</LinearLayout>
<Button
android:id="@+id/btn_new_note"
android:background="@drawable/new_note"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:layout_gravity="bottom" />
android:layout_gravity="bottom"
android:background="@drawable/new_note"
android:focusable="false" />
</FrameLayout>

@ -45,4 +45,8 @@
<item
android:id="@+id/menu_delete_remind"
android:title="@string/menu_remove_remind" />
<item
android:id="@+id/menu_make_password"
android:title="@string/menu_set_password" />
</menu>

@ -22,12 +22,24 @@
android:id="@+id/menu_new_note"
android:title="@string/notelist_menu_new"/>
<item
android:id="@+id/menu_revoke"
android:title="@string/menu_revoke"/>
<item
android:id="@+id/menu_set_top"
android:title="@string/menu_set_top"/>
<item
android:id="@+id/menu_cancel_top"
android:title="@string/menu_cancel_top"/>
<item
android:id="@+id/menu_delete"
android:title="@string/menu_delete"/>
<item
android:id="@+id/menu_font_size"
android:id="@+id/menu_setFont_size"
android:title="@string/menu_font_size"/>
<item
@ -49,4 +61,12 @@
<item
android:id="@+id/menu_delete_remind"
android:title="@string/menu_remove_remind" />
<item
android:id="@+id/menu_font_select"
android:title="@string/menu_font_style" />
<item
android:id="@+id/menu_count_word"
android:title="@string/menu_count_word" />
</menu>

@ -36,4 +36,39 @@
<item
android:id="@+id/menu_search"
android:title="@string/menu_search"/>
<item
android:id="@+id/LoginSetting"
android:title="@string/LoginSetting"/>
<item
android:id="@+id/delete_password"
android:title="@string/delete_password"/>
<item
android:id="@+id/menu_secret"
android:title="@string/menu_secret"/>
<item
android:id="@+id/menu_quit_secret"
android:title="@string/menu_quit_secret"/>
<item
android:id="@+id/menu_naxida"
android:title="Bg:naxida"/>
<item
android:id="@+id/menu_keqing"
android:title="Bg:keiqng"/>
<item
android:id="@+id/menu_lingren"
android:title="Bg:lingren"/>
<item
android:id="@+id/menu_linghua"
android:title="Bg:linghua"/>
<item
android:id="@+id/weather_show"
android:title="Weather"/>
</menu>

@ -16,12 +16,12 @@
-->
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/move"
android:title="@string/menu_move"
android:icon="@drawable/menu_move"
android:showAsAction="always|withText" />
app:showAsAction="always|withText" />
<item
android:id="@+id/delete"

@ -21,4 +21,16 @@
<item
android:id="@+id/menu_new_note"
android:title="@string/notelist_menu_new"/>
<item
android:id="@+id/menu_key"
android:title="@string/notelist_menu_key"/>
<item
android:id="@+id/menu_secret"
android:title="@string/menu_secret"/>
<item
android:id="@+id/menu_quit_secret"
android:title="@string/menu_quit_secret"/>
</menu>

@ -24,6 +24,9 @@
<string name="widget_under_visit_mode">访客模式下,便签内容不可见</string>
<string name="notelist_string_info">...</string>
<string name="notelist_menu_new">新建便签</string>
<string name="menu_revoke">撤销</string>
<string name="menu_set_top">置顶签</string>
<string name="menu_cancel_top">取消置顶</string>
<string name="delete_remind_time_message">成功删除提醒</string>
<string name="set_remind_time_message">创建提醒</string>
<string name="note_alert_expired">已过期</string>
@ -42,6 +45,9 @@
<string name="menu_sync_cancel">取消同步</string>
<string name="menu_setting">设置</string>
<string name="menu_search">搜索</string>
<string name="LoginSetting">设置登陆密码</string>
<string name="delete_password">删除登陆密码</string>
<string name="menu_delete">删除</string>
<string name="menu_move">移动到文件夹</string>
<string name="menu_select_title">选中了 %d 项</string>
@ -63,10 +69,15 @@
<string name="menu_send_to_desktop">发送到桌面</string>
<string name="menu_alert">提醒我</string>
<string name="menu_remove_remind">删除提醒</string>
<string name="menu_font_style">设置字体</string>
<string name="menu_count_word">统计字数</string>
<string name="menu_set_password">删设置密码</string>
<string name="menu_title_select_folder">选择文件夹</string>
<string name="menu_move_parent_folder">上一级文件夹</string>
<string name="info_note_enter_desktop">已添加到桌面</string>
<string name="alert_title_delete">删除</string>
<string name="menu_secret">私密模式</string>
<string name="menu_quit_secret">退出私密模式</string>
<string name="alert_message_delete_notes">确认要删除所选的 %d 条便签吗?</string>
<string name="alert_message_delete_note">确认要删除该条便签吗?</string>
<string name="alert_message_delete_folder">确认删除文件夹及所包含的便签吗?</string>
@ -75,6 +86,7 @@
<string name="error_sdcard_unmounted">SD卡被占用不能操作</string>
<string name="error_sdcard_export">导出文本时发生错误请检查SD卡</string>
<string name="error_note_not_exist">要查看的便签不存在</string>
<string name="error_note_empty_for_top">不能置顶空便签</string>
<string name="error_note_empty_for_clock">不能为空便签设置闹钟提醒</string>
<string name="error_note_empty_for_send_to_desktop">不能将空便签发送到桌面</string>
<string name="success_sdcard_export">导出成功</string>
@ -119,6 +131,12 @@
<string name="search">便签</string>
<string name="datetime_dialog_ok">设置</string>
<string name="datetime_dialog_cancel">取消</string>
<string name="notelist_menu_key" >关键</string>
<string name="dummy_content" >记录生活</string>
<string name="dummy_button" >DUMMY_BUTTON</string>
<string name="tips_of_revoke">提示</string>
<string name="can_not_revoke">您不能再执行撤销了</string>
<string name="have_not_input_anything">您还没有输入任何内容</string>
<plurals name="search_results_title">
<item quantity="other"><xliff:g id="NUMBER">%1$s</xliff:g> 条符合“<xliff:g id="SEARCH">%2$s</xliff:g>”的搜索结果</item>
</plurals>

@ -24,6 +24,9 @@
<string name="widget_under_visit_mode">訪客模式下,便籤內容不可見</string>
<string name="notelist_string_info">...</string>
<string name="notelist_menu_new">新建便簽</string>
<string name="menu_revoke">撤销</string>
<string name="menu_set_top">置顶</string>
<string name="menu_cancel_top">取消置顶</string>
<string name="delete_remind_time_message">成功刪除提醒</string>
<string name="set_remind_time_message">創建提醒</string>
<string name="note_alert_expired">已過期</string>
@ -37,12 +40,15 @@
<string name="note_link_other">打開地圖</string>
<string name="format_move_notes_to_folder">已將所選 %1$d 便籤移到 %2$s 文件夾</string>
<!-- note list string -->
<string name="menu_create_folder">新建文件夾</string>
<string name="menu_export_text">導出文本</string>
<string name="menu_sync">同步</string>
<string name="menu_sync_cancel">取消同步</string>
<string name="menu_setting">設置</string>
<string name="menu_search">搜尋</string>
<string name="LoginSetting">设置登陆密码</string>
<string name="delete_password">删除登陆密码</string>
<string name="menu_delete">刪除</string>
<string name="menu_move">移動到文件夾</string>
<string name="menu_select_title">選中了 %d 項</string>
@ -64,16 +70,22 @@
<string name="menu_send_to_desktop">發送到桌面</string>
<string name="menu_alert">提醒我</string>
<string name="menu_remove_remind">刪除提醒</string>
<string name="menu_font_style">设置字体</string>
<string name="menu_count_word">统计字数</string>
<string name="menu_set_password">设置密码</string>
<string name="menu_title_select_folder">選擇文件夾</string>
<string name="menu_move_parent_folder">上一級文件夾</string>
<string name="info_note_enter_desktop">已添加到桌面</string>
<string name="alert_title_delete">刪除</string>
<string name="menu_secret">私密模式</string>
<string name="menu_quit_secret">退出私密模式</string>
<string name="alert_message_delete_notes">确认要刪除所選的 %d 條便籤嗎?</string>
<string name="alert_message_delete_note">确认要删除該條便籤嗎?</string>
<string name="alert_message_delete_folder">確認刪除檔夾及所包含的便簽嗎?</string>
<string name="error_sdcard_unmounted">SD卡被佔用不能操作</string>
<string name="error_sdcard_export">導出TXT時發生錯誤請檢查SD卡</string>
<string name="error_note_not_exist">要查看的便籤不存在</string>
<string name="error_note_empty_for_top">不能置顶空便籤</string>
<string name="error_note_empty_for_clock">不能爲空便籤設置鬧鐘提醒</string>
<string name="error_note_empty_for_send_to_desktop">不能將空便籤發送到桌面</string>
<string name="success_sdcard_export">導出成功</string>
@ -120,6 +132,12 @@
<string name="search">便籤</string>
<string name="datetime_dialog_ok">設置</string>
<string name="datetime_dialog_cancel">取消</string>
<string name="notelist_menu_key" >关键</string>
<string name="dummy_content" >记录生活</string>
<string name="dummy_button" >DUMMY_BUTTON</string>
<string name="tips_of_revoke">提示</string>
<string name="can_not_revoke">您不能再执行撤销了</string>
<string name="have_not_input_anything">您还没有输入任何内容</string>
<plurals name="search_results_title">
<item quantity="other"><xliff:g id="NUMBER">%1$s</xliff:g> 條符合”<xliff:g id="SEARCH">%2$s</xliff:g>“的搜尋結果</item>
</plurals>

@ -0,0 +1,12 @@
<resources>
<!-- Declare custom theme attributes that allow changing which styles are
used for button bars depending on the API level.
?android:attr/buttonBarStyle is new as of API 11 so this is
necessary to support previous API levels. -->
<declare-styleable name="ButtonBarContainerTheme">
<attr name="metaButtonBarStyle" format="reference" />
<attr name="metaButtonBarButtonStyle" format="reference" />
</declare-styleable>
</resources>

@ -17,4 +17,6 @@
<resources>
<color name="user_query_highlight">#335b5b5b</color>
<color name="black_overlay">#66000000</color>
</resources>

@ -24,6 +24,9 @@
<string name="widget_under_visit_mode">Privacy modecan not see note content</string>
<string name="notelist_string_info">...</string>
<string name="notelist_menu_new">Add note</string>
<string name="menu_revoke">Revoke</string>
<string name="menu_set_top">Set top</string>
<string name="menu_cancel_top">Cancel top</string>
<string name="delete_remind_time_message">Delete reminder successfully</string>
<string name="set_remind_time_message">Set reminder</string>
<string name="note_alert_expired">Expired</string>
@ -39,6 +42,12 @@
<string name="file_path">/MIUI/notes/</string>
<string name="file_name_txt_format">notes_%s.txt</string>
<!-- notes list string -->
<!--背景图片切换-->
<string name="menu_naxida">Bg:naxida</string>
<string name="menu_keqing">Bg:keqing</string>
<string name="menu_lingren">Bg:lingren</string>
<string name="menu_linghua">Bg:linghua</string>
<string name="format_folder_files_count">(%d)</string>
<string name="menu_create_folder">New Folder</string>
<string name="menu_export_text">Export text</string>
@ -46,6 +55,8 @@
<string name="menu_sync_cancel">Cancel syncing</string>
<string name="menu_setting">Settings</string>
<string name="menu_search">Search</string>
<string name="LoginSetting">LoginSetting</string>
<string name="delete_password">delete password</string>
<string name="menu_delete">Delete</string>
<string name="menu_move">Move to folder</string>
<string name="menu_select_title">%d selected</string>
@ -67,6 +78,11 @@
<string name="menu_send_to_desktop">Send to home</string>
<string name="menu_alert">Remind me</string>
<string name="menu_remove_remind">Delete reminder</string>
<string name="menu_font_style">Set font</string>
<string name="menu_count_word">Count word</string>
<string name="menu_set_password">Set password</string>
<string name="menu_secret">secret model</string>
<string name="menu_quit_secret">quit secret model</string>
<string name="menu_title_select_folder">Select folder</string>
<string name="menu_move_parent_folder">Parent folder</string>
<string name="info_note_enter_desktop">Note added to home</string>
@ -79,6 +95,7 @@
<string name="error_sdcard_unmounted">SD card busy, not available now</string>
<string name="error_sdcard_export">Export failed, please check SD card</string>
<string name="error_note_not_exist">The note is not exist</string>
<string name="error_note_empty_for_top">Sorry, can not set top on empty note</string>
<string name="error_note_empty_for_clock">Sorry, can not set clock on empty note</string>
<string name="error_note_empty_for_send_to_desktop">Sorry, can not send and empty note to home</string>
<string name="success_sdcard_export">Export successful</string>
@ -126,6 +143,12 @@
<string name="search">Notes</string>
<string name="datetime_dialog_ok">set</string>
<string name="datetime_dialog_cancel">cancel</string>
<string name="notelist_menu_key" >key</string>
<string name="dummy_content" >LoveYourself</string>
<string name="dummy_button" >DUMMY_BUTTON</string>
<string name="tips_of_revoke">Tips</string>
<string name="can_not_revoke">You can not revoke any more</string>
<string name="have_not_input_anything">You haven not input anything</string>
<plurals name="search_results_title">
<item quantity="one"><xliff:g id="number" example="1">%1$s</xliff:g> result for \"<xliff:g id="search" example="???">%2$s</xliff:g>\"</item>
<!-- Case of 0 or 2 or more results. -->

@ -66,4 +66,19 @@
<item name="android:displayOptions" />
<item name="android:visibility">gone</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.Light" />
<style name="FullscreenTheme" parent="AppTheme">
<item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowBackground">@null</item>
<item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
<item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
</style>
<style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar">
<item name="android:background">@color/black_overlay</item>
</style>
</resources>

@ -0,0 +1,17 @@
# 配置代码扫描的项目信息每个项目有唯一的key可以自己定
# must be unique in a given SonarQube instance
sonar.projectKey=myNotes
# this is the name displayed in the SonarQube UI
# 名称自己定
sonar.projectName=myNotes
sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# If not set, SonarQube starts looking for source code from the directory containing
# 配置扫描的代码目录目录一般就是项目的src文件夹
sonar.sources=java
# classes文件目录不加会报错。在代码根目录添加target文件夹
# 如果还是报错在target中添加classes文件夹之后下列等号右边改为target/classes
sonar.java.binaries=target
Loading…
Cancel
Save