master
陈@jkccchen123 2 years ago committed by lyt
parent b34e301b03
commit d4187ee4d7

@ -1,4 +1,4 @@
#Tue Nov 07 09:00:46 CST 2023
#Fri Dec 29 11:13:38 CST 2023
net.micode.notes.app-main-6\:/color/primary_text_dark.xml=D\:\\anzhuo studio\\2\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\color_primary_text_dark.xml.flat
net.micode.notes.app-main-6\:/color/secondary_text_dark.xml=D\:\\anzhuo studio\\2\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\color_secondary_text_dark.xml.flat
net.micode.notes.app-main-6\:/drawable-hdpi/bg_btn_set_color.png=D\:\\anzhuo studio\\2\\Notes-master1\\app\\build\\intermediates\\merged_res\\debug\\drawable-hdpi_bg_btn_set_color.png.flat

@ -133,7 +133,7 @@
</style>
<style name="NoteActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:displayOptions"/>
<item name="android:visibility">gone</item>
<item name="android:visibility">visible</item>
</style>
<style name="NoteTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/NoteActionBarStyle</item>

@ -42,7 +42,7 @@
<item name="android:actionBarStyle">@style/NoteActionBarStyle</item>
</style><style name="NoteActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:displayOptions"/>
<item name="android:visibility">gone</item>
<item name="android:visibility">visible</item>
</style></file><file path="D:\anzhuo studio\2\Notes-master1\app\src\main\res\values-zh-rCN\arrays.xml" qualifiers="zh-rCN"><string-array name="menu_share_ways">
<item>短信</item>
<item>邮件</item>

@ -1,4 +1,4 @@
#Tue Nov 07 09:00:49 CST 2023
#Fri Dec 29 11:13:38 CST 2023
net.micode.notes.app-main-5\:/color/primary_text_dark.xml=D\:\\anzhuo studio\\2\\Notes-master1\\app\\build\\intermediates\\packaged_res\\debug\\color\\primary_text_dark.xml
net.micode.notes.app-main-5\:/color/secondary_text_dark.xml=D\:\\anzhuo studio\\2\\Notes-master1\\app\\build\\intermediates\\packaged_res\\debug\\color\\secondary_text_dark.xml
net.micode.notes.app-main-5\:/drawable-hdpi/bg_btn_set_color.png=D\:\\anzhuo studio\\2\\Notes-master1\\app\\build\\intermediates\\packaged_res\\debug\\drawable-hdpi-v4\\bg_btn_set_color.png

@ -133,7 +133,7 @@
</style>
<style name="NoteActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:displayOptions"/>
<item name="android:visibility">gone</item>
<item name="android:visibility">visible</item>
</style>
<style name="NoteTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/NoteActionBarStyle</item>

@ -42,7 +42,7 @@
<item name="android:actionBarStyle">@style/NoteActionBarStyle</item>
</style><style name="NoteActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:displayOptions"/>
<item name="android:visibility">gone</item>
<item name="android:visibility">visible</item>
</style></file><file path="D:\anzhuo studio\2\Notes-master1\app\src\main\res\values-zh-rCN\arrays.xml" qualifiers="zh-rCN"><string-array name="menu_share_ways">
<item>短信</item>
<item>邮件</item>

@ -1,4 +1,4 @@
#Thu Dec 14 11:08:34 CST 2023
#Fri Dec 29 11:13:41 CST 2023
base.0=D\:\\anzhuo studio\\2\\Notes-master1\\app\\build\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex
path.0=classes.dex
renamed.0=classes.dex

@ -1,7 +1,7 @@
{
"logs": [
{
"outputFile": "net.micode.notes.app-merged_res-4:/values-zh-rCN_values-zh-rCN.arsc.flat",
"outputFile": "C:\\Users\\陈\\.gradle\\daemon\\8.0\\net.micode.notes.app-merged_res-4:\\values-zh-rCN_values-zh-rCN.arsc.flat",
"map": [
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values-zh-rCN\\arrays.xml",
@ -45,6 +45,92 @@
},
{
"outputFile": "net.micode.notes.app-merged_res-4:/values_values.arsc.flat",
"map": [
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values\\dimens.xml",
"from": {
"startLines": "-1,-1,-1,-1,-1",
"startColumns": "-1,-1,-1,-1,-1",
"startOffsets": "-1,-1,-1,-1,-1"
},
"to": {
"startLines": "13,14,15,16,17",
"startColumns": "4,4,4,4,4",
"startOffsets": "477,529,582,635,687",
"endColumns": "51,52,52,51,51",
"endOffsets": "524,577,630,682,734"
}
},
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values\\strings.xml",
"from": {
"startLines": "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1",
"startColumns": "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1",
"startOffsets": "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1"
},
"to": {
"startLines": "18,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124",
"startColumns": "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4",
"startOffsets": "739,1092,1188,1271,1367,1436,1479,1531,1583,1632,1695,1753,1804,1888,1982,2090,2161,2245,2328,2394,2477,2579,2640,2702,2753,2831,2884,2944,3049,3108,3210,3265,3336,3385,3443,3490,3549,3606,3677,3738,3795,3845,3897,3950,4000,4050,4110,4163,4229,4291,4354,4401,4456,4544,4602,4664,4714,4759,4802,4862,4929,4984,5039,5092,5139,5192,5248,5296,5351,5404,5488,5555,5619,5715,5789,5870,5959,6122,6266,6345,6420,6502,6561,6641,6721,6776,6898,7001,7042,7095,7152,7226,7291,7359,7445,7525,7594,7688,7747,7802,7864,7924,8034",
"endLines": "22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124",
"endColumns": "14,95,82,95,68,42,51,51,48,62,57,50,83,93,107,70,83,82,65,82,101,60,61,50,77,52,59,104,58,101,54,70,48,57,46,58,56,70,60,56,49,51,52,49,49,59,52,65,61,62,46,54,87,57,61,49,44,42,59,66,54,54,52,46,52,55,47,54,52,83,66,63,95,73,80,88,162,143,78,74,81,58,79,79,54,121,102,40,52,56,73,64,67,85,79,68,93,58,54,61,59,109,89",
"endOffsets": "1087,1183,1266,1362,1431,1474,1526,1578,1627,1690,1748,1799,1883,1977,2085,2156,2240,2323,2389,2472,2574,2635,2697,2748,2826,2879,2939,3044,3103,3205,3260,3331,3380,3438,3485,3544,3601,3672,3733,3790,3840,3892,3945,3995,4045,4105,4158,4224,4286,4349,4396,4451,4539,4597,4659,4709,4754,4797,4857,4924,4979,5034,5087,5134,5187,5243,5291,5346,5399,5483,5550,5614,5710,5784,5865,5954,6117,6261,6340,6415,6497,6556,6636,6716,6771,6893,6996,7037,7090,7147,7221,7286,7354,7440,7520,7589,7683,7742,7797,7859,7919,8029,8119"
}
},
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values\\styles.xml",
"from": {
"startLines": "-1,-1,64,-1,-1,-1,-1,-1,-1,-1,-1",
"startColumns": "-1,-1,4,-1,-1,-1,-1,-1,-1,-1,-1",
"startOffsets": "-1,-1,2640,-1,-1,-1,-1,-1,-1,-1,-1",
"endLines": "-1,-1,67,-1,-1,-1,-1,-1,-1,-1,-1",
"endColumns": "-1,-1,12,-1,-1,-1,-1,-1,-1,-1,-1",
"endOffsets": "-1,-1,2846,-1,-1,-1,-1,-1,-1,-1,-1"
},
"to": {
"startLines": "125,129,133,137,140,144,148,152,156,160,164",
"startColumns": "4,4,4,4,4,4,4,4,4,4,4",
"startOffsets": "8124,8328,8539,8749,8909,9092,9277,9462,9665,9871,10054",
"endLines": "128,132,136,139,143,147,151,155,159,163,167",
"endColumns": "12,12,12,12,12,12,12,12,12,12,12",
"endOffsets": "8323,8534,8744,8904,9087,9272,9457,9660,9866,10049,10250"
}
},
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values\\arrays.xml",
"from": {
"startLines": "-1,-1",
"startColumns": "-1,-1",
"startOffsets": "-1,-1"
},
"to": {
"startLines": "2,8",
"startColumns": "4,4",
"startOffsets": "105,300",
"endLines": "7,11",
"endColumns": "19,19",
"endOffsets": "295,415"
}
},
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values\\colors.xml",
"from": {
"startLines": "-1",
"startColumns": "-1",
"startOffsets": "-1"
},
"to": {
"startLines": "12",
"startColumns": "4",
"startOffsets": "420",
"endColumns": "56",
"endOffsets": "472"
}
}
]
},
{
"outputFile": "C:\\Users\\陈\\.gradle\\daemon\\8.0\\net.micode.notes.app-merged_res-4:\\values_values.arsc.flat",
"map": [
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values\\dimens.xml",
@ -140,7 +226,7 @@
]
},
{
"outputFile": "net.micode.notes.app-merged_res-4:/values-zh-rTW_values-zh-rTW.arsc.flat",
"outputFile": "C:\\Users\\陈\\.gradle\\daemon\\8.0\\net.micode.notes.app-merged_res-4:\\values-zh-rTW_values-zh-rTW.arsc.flat",
"map": [
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values-zh-rTW\\strings.xml",

@ -2,6 +2,92 @@
"logs": [
{
"outputFile": "net.micode.notes.app-mergeDebugResources-2:/values/values.xml",
"map": [
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values\\dimens.xml",
"from": {
"startLines": "-1,-1,-1,-1,-1",
"startColumns": "-1,-1,-1,-1,-1",
"startOffsets": "-1,-1,-1,-1,-1"
},
"to": {
"startLines": "13,14,15,16,17",
"startColumns": "4,4,4,4,4",
"startOffsets": "477,529,582,635,687",
"endColumns": "51,52,52,51,51",
"endOffsets": "524,577,630,682,734"
}
},
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values\\strings.xml",
"from": {
"startLines": "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1",
"startColumns": "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1",
"startOffsets": "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1"
},
"to": {
"startLines": "18,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124",
"startColumns": "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4",
"startOffsets": "739,1092,1188,1271,1367,1436,1479,1531,1583,1632,1695,1753,1804,1888,1982,2090,2161,2245,2328,2394,2477,2579,2640,2702,2753,2831,2884,2944,3049,3108,3210,3265,3336,3385,3443,3490,3549,3606,3677,3738,3795,3845,3897,3950,4000,4050,4110,4163,4229,4291,4354,4401,4456,4544,4602,4664,4714,4759,4802,4862,4929,4984,5039,5092,5139,5192,5248,5296,5351,5404,5488,5555,5619,5715,5789,5870,5959,6122,6266,6345,6420,6502,6561,6641,6721,6776,6898,7001,7042,7095,7152,7226,7291,7359,7445,7525,7594,7688,7747,7802,7864,7924,8034",
"endLines": "22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124",
"endColumns": "14,95,82,95,68,42,51,51,48,62,57,50,83,93,107,70,83,82,65,82,101,60,61,50,77,52,59,104,58,101,54,70,48,57,46,58,56,70,60,56,49,51,52,49,49,59,52,65,61,62,46,54,87,57,61,49,44,42,59,66,54,54,52,46,52,55,47,54,52,83,66,63,95,73,80,88,162,143,78,74,81,58,79,79,54,121,102,40,52,56,73,64,67,85,79,68,93,58,54,61,59,109,89",
"endOffsets": "1087,1183,1266,1362,1431,1474,1526,1578,1627,1690,1748,1799,1883,1977,2085,2156,2240,2323,2389,2472,2574,2635,2697,2748,2826,2879,2939,3044,3103,3205,3260,3331,3380,3438,3485,3544,3601,3672,3733,3790,3840,3892,3945,3995,4045,4105,4158,4224,4286,4349,4396,4451,4539,4597,4659,4709,4754,4797,4857,4924,4979,5034,5087,5134,5187,5243,5291,5346,5399,5483,5550,5614,5710,5784,5865,5954,6117,6261,6340,6415,6497,6556,6636,6716,6771,6893,6996,7037,7090,7147,7221,7286,7354,7440,7520,7589,7683,7742,7797,7859,7919,8029,8119"
}
},
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values\\styles.xml",
"from": {
"startLines": "-1,-1,64,-1,-1,-1,-1,-1,-1,-1,-1",
"startColumns": "-1,-1,4,-1,-1,-1,-1,-1,-1,-1,-1",
"startOffsets": "-1,-1,2640,-1,-1,-1,-1,-1,-1,-1,-1",
"endLines": "-1,-1,67,-1,-1,-1,-1,-1,-1,-1,-1",
"endColumns": "-1,-1,12,-1,-1,-1,-1,-1,-1,-1,-1",
"endOffsets": "-1,-1,2846,-1,-1,-1,-1,-1,-1,-1,-1"
},
"to": {
"startLines": "125,129,133,137,140,144,148,152,156,160,164",
"startColumns": "4,4,4,4,4,4,4,4,4,4,4",
"startOffsets": "8124,8328,8539,8749,8909,9092,9277,9462,9665,9871,10054",
"endLines": "128,132,136,139,143,147,151,155,159,163,167",
"endColumns": "12,12,12,12,12,12,12,12,12,12,12",
"endOffsets": "8323,8534,8744,8904,9087,9272,9457,9660,9866,10049,10250"
}
},
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values\\arrays.xml",
"from": {
"startLines": "-1,-1",
"startColumns": "-1,-1",
"startOffsets": "-1,-1"
},
"to": {
"startLines": "2,8",
"startColumns": "4,4",
"startOffsets": "105,300",
"endLines": "7,11",
"endColumns": "19,19",
"endOffsets": "295,415"
}
},
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values\\colors.xml",
"from": {
"startLines": "-1",
"startColumns": "-1",
"startOffsets": "-1"
},
"to": {
"startLines": "12",
"startColumns": "4",
"startOffsets": "420",
"endColumns": "56",
"endOffsets": "472"
}
}
]
},
{
"outputFile": "C:\\Users\\陈\\.gradle\\daemon\\8.0\\net.micode.notes.app-mergeDebugResources-2:\\values\\values.xml",
"map": [
{
"source": "D:\\anzhuo studio\\2\\Notes-master1\\app\\src\\main\\res\\values\\dimens.xml",

@ -133,7 +133,7 @@
</style>
<style name="NoteActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:displayOptions"/>
<item name="android:visibility">gone</item>
<item name="android:visibility">visible</item>
</style>
<style name="NoteTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/NoteActionBarStyle</item>

@ -1,109 +1,125 @@
net.micode.notes:xml/searchable = 0x7f0c0001
net.micode.notes:xml/preferences = 0x7f0c0000
net.micode.notes:string/error_sdcard_unmounted = 0x7f0a0010
net.micode.notes:style/TextAppearanceUnderMenuIcon = 0x7f0b000a
net.micode.notes:style/TextAppearanceSuper = 0x7f0b0009
net.micode.notes:xml/widget_2x_info = 0x7f0c0002
net.micode.notes:style/TextAppearancePrimaryItem = 0x7f0b0007
net.micode.notes:style/TextAppearanceMedium = 0x7f0b0005
net.micode.notes:style/HighlightTextAppearanceSecondary = 0x7f0b0001
net.micode.notes:string/widget_under_visit_mode = 0x7f0a0065
net.micode.notes:string/sync_progress_login = 0x7f0a005e
net.micode.notes:string/success_sync_account = 0x7f0a005c
net.micode.notes:string/search_setting_description = 0x7f0a0059
net.micode.notes:string/search_hint = 0x7f0a0057
net.micode.notes:string/menu_deselect_all = 0x7f0a0022
net.micode.notes:string/search = 0x7f0a0056
net.micode.notes:string/preferences_toast_success_set_accout = 0x7f0a0055
net.micode.notes:string/search_setting_description = 0x7f0a0059
net.micode.notes:style/TextAppearanceSuper = 0x7f0b0009
net.micode.notes:string/preferences_title = 0x7f0a0053
net.micode.notes:string/preferences_menu_change_account = 0x7f0a0051
net.micode.notes:style/HighlightTextAppearanceSecondary = 0x7f0b0001
net.micode.notes:string/preferences_last_sync_time = 0x7f0a004e
net.micode.notes:string/preferences_dialog_change_account_title = 0x7f0a004a
net.micode.notes:string/preferences_bg_random_appear_title = 0x7f0a0047
net.micode.notes:string/preferences_add_account = 0x7f0a0046
net.micode.notes:string/preferences_account_title = 0x7f0a0045
net.micode.notes:string/preferences_menu_change_account = 0x7f0a0051
net.micode.notes:xml/widget_4x_info = 0x7f0c0003
net.micode.notes:string/set_remind_time_message = 0x7f0a005a
net.micode.notes:string/notealert_enter = 0x7f0a0040
net.micode.notes:string/note_link_web = 0x7f0a003f
net.micode.notes:string/note_link_tel = 0x7f0a003e
net.micode.notes:string/set_remind_time_message = 0x7f0a005a
net.micode.notes:string/menu_send_to_desktop = 0x7f0a0035
net.micode.notes:id/account_dialog_subtitle = 0x7f050000
net.micode.notes:menu/note_list = 0x7f070003
net.micode.notes:string/sync_progress_login = 0x7f0a005e
net.micode.notes:string/note_link_other = 0x7f0a003d
net.micode.notes:string/preferences_dialog_change_account_warn_msg = 0x7f0a004b
net.micode.notes:string/note_link_email = 0x7f0a003c
net.micode.notes:string/preferences_toast_success_set_accout = 0x7f0a0055
net.micode.notes:string/search_hint = 0x7f0a0057
net.micode.notes:string/menu_normal_mode = 0x7f0a002f
net.micode.notes:string/menu_setting = 0x7f0a0036
net.micode.notes:string/preferences_bg_random_appear_title = 0x7f0a0047
net.micode.notes:string/preferences_dialog_change_account_title = 0x7f0a004a
net.micode.notes:id/navigation_bar = 0x7f05002f
net.micode.notes:string/note_alert_expired = 0x7f0a003b
net.micode.notes:string/menu_sync_cancel = 0x7f0a0039
net.micode.notes:string/menu_sync = 0x7f0a0038
net.micode.notes:id/ll_font_super = 0x7f05001f
net.micode.notes:dimen/text_font_size_large = 0x7f030000
net.micode.notes:string/menu_share = 0x7f0a0037
net.micode.notes:string/menu_setting = 0x7f0a0036
net.micode.notes:string/menu_send_to_desktop = 0x7f0a0035
net.micode.notes:string/error_sync_network = 0x7f0a0013
net.micode.notes:id/notes_list = 0x7f050035
net.micode.notes:string/widget_under_visit_mode = 0x7f0a0065
net.micode.notes:string/menu_font_small = 0x7f0a002a
net.micode.notes:string/menu_font_normal = 0x7f0a0028
net.micode.notes:string/note_link_tel = 0x7f0a003e
net.micode.notes:string/menu_select_title = 0x7f0a0034
net.micode.notes:style/TextAppearanceLarge = 0x7f0b0004
net.micode.notes:string/menu_select_all = 0x7f0a0032
net.micode.notes:style/TextAppearanceMedium = 0x7f0b0005
net.micode.notes:id/menu_send_to_desktop = 0x7f050029
net.micode.notes:string/preferences_last_sync_time_format = 0x7f0a004f
net.micode.notes:menu/call_note_edit = 0x7f070000
net.micode.notes:id/preference_sync_button = 0x7f050037
net.micode.notes:string/menu_search = 0x7f0a0031
net.micode.notes:string/menu_normal_mode = 0x7f0a002f
net.micode.notes:string/menu_font_size = 0x7f0a0029
net.micode.notes:string/menu_font_small = 0x7f0a002a
net.micode.notes:string/menu_font_normal = 0x7f0a0028
net.micode.notes:string/menu_remove_remind = 0x7f0a0030
net.micode.notes:string/menu_font_large = 0x7f0a0027
net.micode.notes:string/info_note_enter_desktop = 0x7f0a001e
net.micode.notes:style/TextAppearanceLarge = 0x7f0b0004
net.micode.notes:string/menu_select_all = 0x7f0a0032
net.micode.notes:string/note_link_email = 0x7f0a003c
net.micode.notes:string/preferences_dialog_change_account_warn_msg = 0x7f0a004b
net.micode.notes:xml/searchable = 0x7f0c0001
net.micode.notes:string/menu_folder_change_name = 0x7f0a0024
net.micode.notes:string/menu_sync_cancel = 0x7f0a0039
net.micode.notes:string/menu_export_text = 0x7f0a0023
net.micode.notes:string/menu_deselect_all = 0x7f0a0022
net.micode.notes:string/menu_remove_remind = 0x7f0a0030
net.micode.notes:string/menu_font_large = 0x7f0a0027
net.micode.notes:menu/sub_folder = 0x7f070006
net.micode.notes:layout/note_item = 0x7f060007
net.micode.notes:string/datetime_dialog_cancel = 0x7f0a0009
net.micode.notes:string/menu_create_folder = 0x7f0a0020
net.micode.notes:string/info_note_enter_desktop = 0x7f0a001e
net.micode.notes:drawable/widget_2x_red = 0x7f04003a
net.micode.notes:drawable/widget_4x_yellow = 0x7f040041
net.micode.notes:string/format_date_ymd = 0x7f0a0018
net.micode.notes:string/preferences_account_summary = 0x7f0a0044
net.micode.notes:string/success_sdcard_export = 0x7f0a005b
net.micode.notes:string/format_move_notes_to_folder = 0x7f0a001c
net.micode.notes:string/preferences_account_summary = 0x7f0a0044
net.micode.notes:string/format_date_ymd = 0x7f0a0018
net.micode.notes:string/delete_remind_time_message = 0x7f0a000b
net.micode.notes:string/file_name_txt_format = 0x7f0a0015
net.micode.notes:id/note_edit_list = 0x7f050031
net.micode.notes:drawable/new_note = 0x7f04002f
net.micode.notes:string/folder_exist = 0x7f0a0017
net.micode.notes:string/menu_select_none = 0x7f0a0033
net.micode.notes:id/note_edit_list = 0x7f050031
net.micode.notes:string/failed_sdcard_export = 0x7f0a0014
net.micode.notes:string/ticker_cancel = 0x7f0a0060
net.micode.notes:drawable/list_red_single = 0x7f040023
net.micode.notes:layout/note_list_dropdown_menu = 0x7f060009
net.micode.notes:string/menu_select_none = 0x7f0a0033
net.micode.notes:layout/widget_4x = 0x7f06000d
net.micode.notes:string/error_sync_cancelled = 0x7f0a0011
net.micode.notes:string/error_sdcard_unmounted = 0x7f0a0010
net.micode.notes:layout/note_list_dropdown_menu = 0x7f060009
net.micode.notes:drawable/list_red_single = 0x7f040023
net.micode.notes:string/ticker_cancel = 0x7f0a0060
net.micode.notes:style/TextAppearanceSecondaryItem = 0x7f0b0008
net.micode.notes:drawable/widget_4x_green = 0x7f04003e
net.micode.notes:string/error_sdcard_export = 0x7f0a000f
net.micode.notes:string/notealert_ok = 0x7f0a0041
net.micode.notes:string/menu_move_parent_folder = 0x7f0a002e
net.micode.notes:id/tv_title = 0x7f05003f
net.micode.notes:string/note_link_web = 0x7f0a003f
net.micode.notes:id/menu_sync = 0x7f05002c
net.micode.notes:style/TextAppearancePrimaryItem = 0x7f0b0007
net.micode.notes:xml/widget_2x_info = 0x7f0c0002
net.micode.notes:string/error_note_empty_for_clock = 0x7f0a000c
net.micode.notes:string/delete_remind_time_message = 0x7f0a000b
net.micode.notes:id/tv_title = 0x7f05003f
net.micode.notes:string/menu_move_parent_folder = 0x7f0a002e
net.micode.notes:string/notealert_ok = 0x7f0a0041
net.micode.notes:id/iv_bg_yellow_select = 0x7f050017
net.micode.notes:style/TextAppearanceNormal = 0x7f0b0006
net.micode.notes:string/preferences_menu_remove_account = 0x7f0a0052
net.micode.notes:string/button_delete = 0x7f0a0007
net.micode.notes:string/preferences_menu_remove_account = 0x7f0a0052
net.micode.notes:id/menu_list_mode = 0x7f050025
net.micode.notes:string/app_widget2x2 = 0x7f0a0005
net.micode.notes:string/ticker_fail = 0x7f0a0061
net.micode.notes:string/app_name = 0x7f0a0004
net.micode.notes:string/search_label = 0x7f0a0058
net.micode.notes:string/preferences_dialog_select_account_tips = 0x7f0a004c
net.micode.notes:string/app_widget2x2 = 0x7f0a0005
net.micode.notes:string/app_name = 0x7f0a0004
net.micode.notes:string/menu_title_select_folder = 0x7f0a003a
net.micode.notes:drawable/list_red_down = 0x7f040021
net.micode.notes:id/menu_delete = 0x7f050021
net.micode.notes:string/hint_foler_name = 0x7f0a001d
net.micode.notes:string/widget_havenot_content = 0x7f0a0064
net.micode.notes:string/success_sync_account = 0x7f0a005c
net.micode.notes:drawable/widget_2x_yellow = 0x7f04003c
net.micode.notes:id/amPm = 0x7f050003
net.micode.notes:string/preferences_account_title = 0x7f0a0045
net.micode.notes:string/alert_title_delete = 0x7f0a0003
net.micode.notes:string/widget_havenot_content = 0x7f0a0064
net.micode.notes:string/hint_foler_name = 0x7f0a001d
net.micode.notes:id/menu_delete = 0x7f050021
net.micode.notes:drawable/list_red_down = 0x7f040021
net.micode.notes:string/menu_title_select_folder = 0x7f0a003a
net.micode.notes:string/alert_message_delete_note = 0x7f0a0001
net.micode.notes:string/format_datetime_mdhm = 0x7f0a0019
net.micode.notes:string/alert_message_delete_folder = 0x7f0a0000
net.micode.notes:string/datetime_dialog_cancel = 0x7f0a0009
net.micode.notes:layout/note_item = 0x7f060007
net.micode.notes:menu/sub_folder = 0x7f070006
net.micode.notes:menu/note_list = 0x7f070003
net.micode.notes:string/preferences_add_account = 0x7f0a0046
net.micode.notes:string/menu_sync = 0x7f0a0038
net.micode.notes:id/move = 0x7f05002e
net.micode.notes:string/datetime_dialog_ok = 0x7f0a000a
net.micode.notes:string/ticker_syncing = 0x7f0a0063
net.micode.notes:drawable/menu_move = 0x7f04002e
net.micode.notes:id/menu_search = 0x7f050028
net.micode.notes:string/datetime_dialog_ok = 0x7f0a000a
net.micode.notes:drawable/menu_move = 0x7f04002e
net.micode.notes:raw/introduction = 0x7f090000
net.micode.notes:menu/call_record_folder = 0x7f070001
net.micode.notes:string/preferences_last_sync_time_format = 0x7f0a004f
net.micode.notes:menu/call_note_edit = 0x7f070000
net.micode.notes:drawable/list_red_middle = 0x7f040022
net.micode.notes:layout/widget_2x = 0x7f06000c
net.micode.notes:layout/widget_4x = 0x7f06000d
net.micode.notes:drawable/icon_app = 0x7f040015
net.micode.notes:layout/note_list = 0x7f060008
net.micode.notes:layout/note_edit = 0x7f060005
@ -112,8 +128,8 @@ net.micode.notes:string/alert_message_delete_notes = 0x7f0a0002
net.micode.notes:drawable/widget_2x_blue = 0x7f040038
net.micode.notes:layout/folder_list_item = 0x7f060004
net.micode.notes:string/sync_progress_init_list = 0x7f0a005d
net.micode.notes:id/btn_new_note = 0x7f050004
net.micode.notes:layout/add_account_text = 0x7f060001
net.micode.notes:id/btn_new_note = 0x7f050004
net.micode.notes:id/widget_text = 0x7f050042
net.micode.notes:id/widget_bg_image = 0x7f050041
net.micode.notes:string/menu_folder_delete = 0x7f0a0025
@ -124,49 +140,38 @@ net.micode.notes:id/tv_alert_date = 0x7f05003a
net.micode.notes:color/primary_text_dark = 0x7f020000
net.micode.notes:id/tv_time = 0x7f05003e
net.micode.notes:id/selection_menu = 0x7f050038
net.micode.notes:id/preference_sync_button = 0x7f050037
net.micode.notes:string/error_sync_network = 0x7f0a0013
net.micode.notes:id/notes_list = 0x7f050035
net.micode.notes:id/ll_font_small = 0x7f05001e
net.micode.notes:id/note_title = 0x7f050034
net.micode.notes:string/format_exported_file_location = 0x7f0a001a
net.micode.notes:id/note_bg_color_selector = 0x7f050030
net.micode.notes:id/navigation_bar = 0x7f05002f
net.micode.notes:id/move = 0x7f05002e
net.micode.notes:id/menu_sync = 0x7f05002c
net.micode.notes:id/menu_share = 0x7f05002b
net.micode.notes:string/format_folder_files_count = 0x7f0a001b
net.micode.notes:id/menu_setting = 0x7f05002a
net.micode.notes:string/menu_move = 0x7f0a002d
net.micode.notes:id/date = 0x7f050007
net.micode.notes:id/note_item = 0x7f050033
net.micode.notes:id/menu_setting = 0x7f05002a
net.micode.notes:id/menu_send_to_desktop = 0x7f050029
net.micode.notes:style/HighlightTextAppearancePrimary = 0x7f0b0000
net.micode.notes:drawable/font_size_selector_bg = 0x7f040012
net.micode.notes:id/note_edit_view = 0x7f050032
net.micode.notes:id/menu_list_mode = 0x7f050025
net.micode.notes:style/HighlightTextAppearancePrimary = 0x7f0b0000
net.micode.notes:string/preferences_dialog_select_account_title = 0x7f0a004d
net.micode.notes:id/menu_font_size = 0x7f050024
net.micode.notes:string/preferences_button_sync_cancel = 0x7f0a0048
net.micode.notes:id/menu_alert = 0x7f050020
net.micode.notes:dimen/text_font_size_large = 0x7f030000
net.micode.notes:id/ll_font_super = 0x7f05001f
net.micode.notes:id/ll_font_small = 0x7f05001e
net.micode.notes:string/error_note_not_exist = 0x7f0a000e
net.micode.notes:string/error_note_empty_for_send_to_desktop = 0x7f0a000d
net.micode.notes:id/minute = 0x7f05002d
net.micode.notes:id/ll_font_normal = 0x7f05001d
net.micode.notes:id/ll_font_large = 0x7f05001c
net.micode.notes:string/preferences_button_sync_immediately = 0x7f0a0049
net.micode.notes:id/iv_super_select = 0x7f05001b
net.micode.notes:string/ticker_success = 0x7f0a0062
net.micode.notes:string/preferences_button_sync_immediately = 0x7f0a0049
net.micode.notes:drawable/bg_color_btn_mask = 0x7f040001
net.micode.notes:drawable/list_yellow_up = 0x7f04002c
net.micode.notes:id/iv_bg_white = 0x7f050014
net.micode.notes:id/iv_medium_select = 0x7f050019
net.micode.notes:string/ticker_success = 0x7f0a0062
net.micode.notes:id/iv_large_select = 0x7f050018
net.micode.notes:id/iv_bg_yellow_select = 0x7f050017
net.micode.notes:drawable/bg_btn_set_color = 0x7f040000
net.micode.notes:id/iv_bg_yellow = 0x7f050016
net.micode.notes:drawable/bg_color_btn_mask = 0x7f040001
net.micode.notes:drawable/list_yellow_up = 0x7f04002c
net.micode.notes:id/iv_bg_white = 0x7f050014
net.micode.notes:menu/note_edit = 0x7f070002
net.micode.notes:drawable/list_white_down = 0x7f040025
net.micode.notes:drawable/list_white_up = 0x7f040028
@ -177,23 +182,18 @@ net.micode.notes:drawable/list_green_single = 0x7f04001f
net.micode.notes:id/iv_alert_icon = 0x7f05000d
net.micode.notes:drawable/list_yellow_single = 0x7f04002b
net.micode.notes:id/cb_edit_item = 0x7f050006
net.micode.notes:id/font_size_selector = 0x7f05000b
net.micode.notes:color/user_query_highlight = 0x7f020002
net.micode.notes:drawable/font_super = 0x7f040014
net.micode.notes:drawable/edit_title_blue = 0x7f040009
net.micode.notes:color/user_query_highlight = 0x7f020002
net.micode.notes:id/font_size_selector = 0x7f05000b
net.micode.notes:string/preferences_toast_cannot_change_account = 0x7f0a0054
net.micode.notes:id/et_edit_text = 0x7f050009
net.micode.notes:drawable/widget_2x_yellow = 0x7f04003c
net.micode.notes:id/amPm = 0x7f050003
net.micode.notes:id/account_dialog_subtitle = 0x7f050000
net.micode.notes:id/menu_new_note = 0x7f050027
net.micode.notes:string/preferences_toast_cannot_change_account = 0x7f0a0054
net.micode.notes:id/iv_bg_green_select = 0x7f050011
net.micode.notes:drawable/widget_2x_red = 0x7f04003a
net.micode.notes:drawable/widget_4x_yellow = 0x7f040041
net.micode.notes:id/menu_new_note = 0x7f050027
net.micode.notes:drawable/clock = 0x7f040003
net.micode.notes:array/menu_share_ways = 0x7f010001
net.micode.notes:drawable/font_small = 0x7f040013
net.micode.notes:id/btn_set_bg_color = 0x7f050005
net.micode.notes:array/menu_share_ways = 0x7f010001
net.micode.notes:style/NoteTheme = 0x7f0b0003
net.micode.notes:drawable/notification = 0x7f040033
net.micode.notes:id/iv_bg_blue_select = 0x7f05000f

@ -35,14 +35,14 @@ import java.util.ArrayList;
public class Note {
private ContentValues mNoteDiffValues;
private NoteData mNoteData;
private static final String TAG = "Note";
private ContentValues mNoteDiffValues;// 存储笔记变更的内容值
private NoteData mNoteData;// 笔记数据
private static final String TAG = "Note";// 日志标签
/**
* Create a new note id for adding a new note to databases
* Create a new note id for adding a new note to databasesID
*/
public static synchronized long getNewNoteId(Context context, long folderId) {
// Create a new note in the database
// Create a new note in the database在数据库中创建一个新的笔记
ContentValues values = new ContentValues();
long createdTime = System.currentTimeMillis();
values.put(NoteColumns.CREATED_DATE, createdTime);
@ -113,12 +113,14 @@ public class Note {
* In theory, once data changed, the note should be updated on {@link NoteColumns#LOCAL_MODIFIED} and
* {@link NoteColumns#MODIFIED_DATE}. For data safety, though update note fails, we also update the
* note data info
* {@link NoteColumns#LOCAL_MODIFIED}{@link NoteColumns#MODIFIED_DATE}
* 使
*/
if (context.getContentResolver().update(
ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, noteId), mNoteDiffValues, null,
null) == 0) {
Log.e(TAG, "Update note error, should not happen");
// Do not return, fall through
// Do not return, fall through不要返回,继续执行
}
mNoteDiffValues.clear();
@ -131,16 +133,21 @@ public class Note {
}
private class NoteData {
private long mTextDataId;
private long mTextDataId;// 文本数据ID
private ContentValues mTextDataValues;
private ContentValues mTextDataValues;// 文本数据内容值
private long mCallDataId;
private long mCallDataId;// 通话数据ID
private ContentValues mCallDataValues;
private ContentValues mCallDataValues; // 通话数据内容值
private static final String TAG = "NoteData";
private static final String TAG = "NoteData"; // 日志标签
/**
*
* `mTextDataValues` `mCallDataValues`
* ID `mTextDataId` `mCallDataId`
*/
public NoteData() {
mTextDataValues = new ContentValues();
mCallDataValues = new ContentValues();
@ -148,10 +155,20 @@ public class Note {
mCallDataId = 0;
}
/**
*
* `mTextDataValues` `mCallDataValues`
* @return
*/
boolean isLocalModified() {
return mTextDataValues.size() > 0 || mCallDataValues.size() > 0;
}
/**
* ID
* ID 0
* @param id
*/
void setTextDataId(long id) {
if(id <= 0) {
throw new IllegalArgumentException("Text data id should larger than 0");
@ -159,6 +176,11 @@ public class Note {
mTextDataId = id;
}
/**
* ID
* ID 0
* @param id
*/
void setCallDataId(long id) {
if (id <= 0) {
throw new IllegalArgumentException("Call data id should larger than 0");
@ -166,12 +188,24 @@ public class Note {
mCallDataId = id;
}
/**
*
* `mCallDataValues`
* @param key
* @param value
*/
void setCallData(String key, String value) {
mCallDataValues.put(key, value);
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());
}
/**
*
* `mTextDataValues`
* @param key
* @param value
*/
void setTextData(String key, String value) {
mTextDataValues.put(key, value);
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);
@ -182,16 +216,16 @@ public class Note {
/**
* Check for safety
*/
if (noteId <= 0) {
if (noteId <= 0) {// 检查 noteId 是否合法
throw new IllegalArgumentException("Wrong note id:" + noteId);
}
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();// 创建一个操作列表
ContentProviderOperation.Builder builder = null;
if(mTextDataValues.size() > 0) {
mTextDataValues.put(DataColumns.NOTE_ID, noteId);
if (mTextDataId == 0) {
if(mTextDataValues.size() > 0) {// 如果有文本数据
mTextDataValues.put(DataColumns.NOTE_ID, noteId);// 设置笔记 ID
if (mTextDataId == 0) {// 如果文本数据 ID 为 0表示需要插入新数据
mTextDataValues.put(DataColumns.MIME_TYPE, TextNote.CONTENT_ITEM_TYPE);
Uri uri = context.getContentResolver().insert(Notes.CONTENT_DATA_URI,
mTextDataValues);
@ -202,7 +236,7 @@ public class Note {
mTextDataValues.clear();
return null;
}
} else {
} else {// 否则,表示需要更新数据
builder = ContentProviderOperation.newUpdate(ContentUris.withAppendedId(
Notes.CONTENT_DATA_URI, mTextDataId));
builder.withValues(mTextDataValues);
@ -211,9 +245,9 @@ public class Note {
mTextDataValues.clear();
}
if(mCallDataValues.size() > 0) {
mCallDataValues.put(DataColumns.NOTE_ID, noteId);
if (mCallDataId == 0) {
if(mCallDataValues.size() > 0) { // 如果有通话数据
mCallDataValues.put(DataColumns.NOTE_ID, noteId); // 设置笔记 ID
if (mCallDataId == 0) {// 如果通话数据 ID 为 0表示需要插入新数据
mCallDataValues.put(DataColumns.MIME_TYPE, CallNote.CONTENT_ITEM_TYPE);
Uri uri = context.getContentResolver().insert(Notes.CONTENT_DATA_URI,
mCallDataValues);
@ -224,7 +258,7 @@ public class Note {
mCallDataValues.clear();
return null;
}
} else {
} else {// 否则,表示需要更新数据
builder = ContentProviderOperation.newUpdate(ContentUris.withAppendedId(
Notes.CONTENT_DATA_URI, mCallDataId));
builder.withValues(mCallDataValues);
@ -234,8 +268,7 @@ public class Note {
}
if (operationList.size() > 0) {
try {
//
try {// 应用操作列表到内容提供程序
ContentProviderResult[] results = context.getContentResolver().applyBatch(
Notes.AUTHORITY, operationList);
return (results == null || results.length == 0 || results[0] == null) ? null
@ -252,3 +285,6 @@ public class Note {
}
}
}
/**
*
*/

@ -13,7 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
* - 使
*/
package net.micode.notes.model;
import android.appwidget.AppWidgetManager;
@ -32,36 +35,43 @@ import net.micode.notes.data.Notes.TextNote;
import net.micode.notes.tool.ResourceParser.NoteBgResources;
public class WorkingNote {
/**
*
*/
public class WorkingNote {//`WorkingNote` 类用于管理笔记数据,包含了一些成员变量和方法。
// Note for the working note
private Note mNote;
private Note mNote;//用于存储笔记对象
// Note Id
private long mNoteId;
private long mNoteId;//笔记的 ID
// Note content
private String mContent;
private String mContent;//笔记的内容
// Note mode
private int mMode;
private int mMode;//笔记的模式
private long mAlertDate;
private long mAlertDate;//提醒日期
private long mModifiedDate;
private long mModifiedDate;//最后修改日期
private int mBgColorId;
private int mBgColorId;//背景颜色的 ID
private int mWidgetId;
private int mWidgetId;//小部件的 ID
private int mWidgetType;
private int mWidgetType;//小部件的类型
private long mFolderId;
private long mFolderId;//文件夹的 ID
private Context mContext;
private Context mContext;//上下文对象
private static final String TAG = "WorkingNote";
private boolean mIsDeleted;
private boolean mIsDeleted;//笔记是否被删除
private NoteSettingChangedListener mNoteSettingStatusListener;
private NoteSettingChangedListener mNoteSettingStatusListener;//笔记设置状态的监听器
/**
*
* projection
*/
public static final String[] DATA_PROJECTION = new String[] {
DataColumns.ID,
DataColumns.CONTENT,
@ -115,6 +125,14 @@ public class WorkingNote {
}
// Existing note construct
/**
*
* -
* @param context
* @param noteId
* @param folderId
*/
private WorkingNote(Context context, long noteId, long folderId) {
mContext = context;
mNoteId = noteId;
@ -124,6 +142,11 @@ public class WorkingNote {
loadNote();
}
/**
* `loadNote`
*
* ID ID
*/
private void loadNote() {
Cursor cursor = mContext.getContentResolver().query(
ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mNoteId), NOTE_PROJECTION, null,
@ -146,6 +169,10 @@ public class WorkingNote {
loadNoteData();
}
/**
* `loadNoteData`
*
*/
private void loadNoteData() {
Cursor cursor = mContext.getContentResolver().query(Notes.CONTENT_DATA_URI, DATA_PROJECTION,
DataColumns.NOTE_ID + "=?", new String[] {
@ -174,7 +201,7 @@ public class WorkingNote {
}
}
public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId,
public static WorkingNote createEmptyNote(Context context, long folderId, int widgetId,//创建新笔记的私有构造方法
int widgetType, int defaultBgColorId) {
WorkingNote note = new WorkingNote(context, folderId);
note.setBgColorId(defaultBgColorId);
@ -183,10 +210,17 @@ public class WorkingNote {
return note;
}
public static WorkingNote load(Context context, long id) {
public static WorkingNote load(Context context, long id) {//这是一个静态方法用于加载现有笔记。它返回一个WorkingNote对象。
return new WorkingNote(context, id, 0);
}
/**
*
* `isWorthSaving()`
*
* @return
*/
public synchronized boolean saveNote() {
if (isWorthSaving()) {
if (!existInDatabase()) {
@ -212,11 +246,11 @@ public class WorkingNote {
}
}
public boolean existInDatabase() {
public boolean existInDatabase() {//这个方法用于判断笔记是否存在于数据库中
return mNoteId > 0;
}
private boolean isWorthSaving() {
private boolean isWorthSaving() {//这个方法用于判断笔记是否值得保存
if (mIsDeleted || (!existInDatabase() && TextUtils.isEmpty(mContent))
|| (existInDatabase() && !mNote.isLocalModified())) {
return false;
@ -225,11 +259,11 @@ public class WorkingNote {
}
}
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {
public void setOnSettingStatusChangedListener(NoteSettingChangedListener l) {//这个方法用于设置设置状态变更监听器。
mNoteSettingStatusListener = l;
}
public void setAlertDate(long date, boolean set) {
public void setAlertDate(long date, boolean set) {//这个方法用于设置提醒日期,并在设置状态监听器不为空的情况下调用提醒日期变更的回调方法
if (date != mAlertDate) {
mAlertDate = date;
mNote.setNoteValue(NoteColumns.ALERTED_DATE, String.valueOf(mAlertDate));
@ -239,7 +273,7 @@ public class WorkingNote {
}
}
public void markDeleted(boolean mark) {
public void markDeleted(boolean mark) {//这个方法用于标记笔记是否被删除,并在存在与该笔记相关的小部件并且设置状态监听器不为空的情况下调用小部件变更的回调方法
mIsDeleted = mark;
if (mWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID
&& mWidgetType != Notes.TYPE_WIDGET_INVALIDE && mNoteSettingStatusListener != null) {
@ -247,7 +281,8 @@ public class WorkingNote {
}
}
public void setBgColorId(int id) {
public void setBgColorId(int id) {//这个方法用于设置背景颜色的ID并在设置状态监听器不为空的情况下调用背景颜色变更的回调方法。
if (id != mBgColorId) {
mBgColorId = id;
if (mNoteSettingStatusListener != null) {
@ -257,7 +292,8 @@ public class WorkingNote {
}
}
public void setCheckListMode(int mode) {
public void setCheckListMode(int mode) {//这个方法用于设置清单模式,并在设置状态监听器不为空的情况下调用清单模式变更的回调方法。
if (mMode != mode) {
if (mNoteSettingStatusListener != null) {
mNoteSettingStatusListener.onCheckListModeChanged(mMode, mode);
@ -267,81 +303,85 @@ public class WorkingNote {
}
}
public void setWidgetType(int type) {
public void setWidgetType(int type) {//这个方法用于设置小部件类型
if (type != mWidgetType) {
mWidgetType = type;
mNote.setNoteValue(NoteColumns.WIDGET_TYPE, String.valueOf(mWidgetType));
}
}
public void setWidgetId(int id) {
public void setWidgetId(int id) {//这个方法用于设置小部件ID
if (id != mWidgetId) {
mWidgetId = id;
mNote.setNoteValue(NoteColumns.WIDGET_ID, String.valueOf(mWidgetId));
}
}
public void setWorkingText(String text) {
public void setWorkingText(String text) {//这个方法用于设置工作文本
if (!TextUtils.equals(mContent, text)) {
mContent = text;
mNote.setTextData(DataColumns.CONTENT, mContent);
}
}
public void convertToCallNote(String phoneNumber, long callDate) {
public void convertToCallNote(String phoneNumber, long callDate) {//这个方法用于将笔记转换为通话记录
mNote.setCallData(CallNote.CALL_DATE, String.valueOf(callDate));
mNote.setCallData(CallNote.PHONE_NUMBER, phoneNumber);
mNote.setNoteValue(NoteColumns.PARENT_ID, String.valueOf(Notes.ID_CALL_RECORD_FOLDER));
}
public boolean hasClockAlert() {
public boolean hasClockAlert() {//这个方法用于判断笔记是否有闹钟提醒
return (mAlertDate > 0 ? true : false);
}
public String getContent() {
public String getContent() {//这个方法用于获取笔记内容
return mContent;
}
public long getAlertDate() {
public long getAlertDate() {//这个方法用于获取提醒日期
return mAlertDate;
}
public long getModifiedDate() {
public long getModifiedDate() {//这个方法用于获取笔记修改日期
return mModifiedDate;
}
public int getBgColorResId() {
public int getBgColorResId() {//这个方法用于获取背景颜色的资源ID
return NoteBgResources.getNoteBgResource(mBgColorId);
}
public int getBgColorId() {
public int getBgColorId() {//这个方法用于获取背景颜色的ID
return mBgColorId;
}
public int getTitleBgResId() {
public int getTitleBgResId() {//这个方法用于获取标题背景的资源ID
return NoteBgResources.getNoteTitleBgResource(mBgColorId);
}
public int getCheckListMode() {
public int getCheckListMode() {//这个方法用于获取清单模式
return mMode;
}
public long getNoteId() {
public long getNoteId() {//这个方法用于获取笔记ID
return mNoteId;
}
public long getFolderId() {
public long getFolderId() {//这个方法用于获取笔记所属文件夹的ID
return mFolderId;
}
public int getWidgetId() {
public int getWidgetId() {//这个方法用于获取小部件的ID
return mWidgetId;
}
public int getWidgetType() {
public int getWidgetType() {//这个方法用于获取小部件的类型
return mWidgetType;
}
/**
*
*
*/
public interface NoteSettingChangedListener {
/**
* Called when the background color of current note has just changed

@ -39,119 +39,61 @@ import net.micode.notes.tool.DataUtils;
import java.io.IOException;
/**
*
* @ProjectName:
* @Package: net.micode.notes.ui
* @ClassName: AlarmAlertActivity
* @Description: AlarmAlertActivity
* 便AlarmAlertActivity
*
*
* @CreateDate: 2023-12-24 10:33
* @UpdateUser:
* @UpdateDate: 2023-12-24 10:33
* @UpdateRemark:
* @Version: 1.0
*/
public class AlarmAlertActivity extends Activity implements OnClickListener, OnDismissListener {
private long mNoteId; //文本在数据库存储中的ID号
private String mSnippet; //闹钟提示时出现的文本片段
public class AlarmAlertActivity extends Activity implements OnClickListener, OnDismissListener {
private long mNoteId;
private String mSnippet;
private static final int SNIPPET_PREW_MAX_LEN = 60;
MediaPlayer mPlayer;
/**
* @method onCreate
* @description :
*
*
* Intent便ID
* 使便ID便
* MediaPlayer
* 便便
* 便
* 便
* @date: 2023-12-24 10:41
* @param
* @return
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Bundle类型的数据与Map类型的数据相似都是以key-value的形式存储数据的
//onsaveInstanceState方法是用来保存Activity的状态的
//能从onCreate的参数savedInsanceState中获得状态数
requestWindowFeature(Window.FEATURE_NO_TITLE);
//界面显示——无标题
final Window win = getWindow();
win.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
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();
try {
mNoteId = Long.valueOf(intent.getData().getPathSegments().get(1));
mSnippet = DataUtils.getSnippetById(this.getContentResolver(), mNoteId);
//根据ID从数据库中获取标签的内容
//getContentResolver是实现数据共享实例存储。
mSnippet = mSnippet.length() > SNIPPET_PREW_MAX_LEN ? mSnippet.substring(0,
SNIPPET_PREW_MAX_LEN) + getResources().getString(R.string.notelist_string_info)
: mSnippet;
//判断标签片段是否达到符合长度
} catch (IllegalArgumentException e) {
e.printStackTrace();
return;
}
mPlayer = new MediaPlayer();
if (DataUtils.visibleInNoteDatabase(getContentResolver(), mNoteId, Notes.TYPE_NOTE)) {
showActionDialog();
//弹出对话框
playAlarmSound();
//闹钟提示音激发
} else {
finish();
//完成闹钟动作
}
}
/**
* @method isScreenOn
* @description
* @date: 2023-12-24 10:45
* @param
* @return bool
*/
private boolean isScreenOn() {
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
return pm.isScreenOn();
}
/**
* @method playAlarmSound
* @description:
*
*
* @date: 2023-12-24 10:47
* @param
* @return
*/
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);
if ((silentModeStreams & (1 << AudioManager.STREAM_ALARM)) != 0) {
mPlayer.setAudioStreamType(silentModeStreams);
} else {
@ -159,19 +101,12 @@ import java.io.IOException;
}
try {
mPlayer.setDataSource(this, url);
//方法setDataSource(Context context, Uri uri)
//解释:无返回值,设置多媒体数据来源【根据 Uri】
mPlayer.prepare();
//准备同步
mPlayer.setLooping(true);
//设置是否循环播放
mPlayer.start();
//开始播放
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
//e.printStackTrace()函数功能是抛出异常, 还将显示出更深的调用信息
//System.out.println(e),这个方法打印出异常,并且输出在哪里出现的异常
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@ -184,95 +119,39 @@ import java.io.IOException;
}
}
/**
* @method showActionDialog
* @description
* AlertDialog.BuilderR.string.app_name
* mSnippet
* Positive ButtonR.string.notealert_ok
* isScreenOn()Negative ButtonR.string.notealert_enter
* dialog.show().setOnDismissListener(this)
* @date: 2023-12-24 10:51
* @param
* @return
*/
private void showActionDialog() {
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
/*
* AlertDialogProtected
* newAlertDialogAlertDialog
* AlertDialogAlertDialog.Buildercreate()
* dialogAlertDialog
*/
dialog.setTitle(R.string.app_name);
//为对话框设置标题
dialog.setMessage(mSnippet);
//为对话框设置内容
dialog.setPositiveButton(R.string.notealert_ok, this);
//给对话框添加"Yes"按钮
if (isScreenOn()) {
dialog.setNegativeButton(R.string.notealert_enter, this);
}//对话框添加"No"按钮
}
dialog.show().setOnDismissListener(this);
}
/**
* @method onClick
* @description :
*
* 便idActivity
* @date: 2023-12-24 10:55
* @param
* @return
*/
public void onClick(DialogInterface dialog, int which) {
switch (which) {
//用which来选择click后下一步的操作
case DialogInterface.BUTTON_NEGATIVE:
//这是取消操作
Intent intent = new Intent(this, NoteEditActivity.class);
//实现两个类间的数据传输
intent.setAction(Intent.ACTION_VIEW);
//设置动作属性
intent.putExtra(Intent.EXTRA_UID, mNoteId);
//实现key-value对
//EXTRA_UID为keymNoteId为键
startActivity(intent);
//开始动作
break;
default:
//这是确定操作'
break;
}
}
/**
* @method onDismiss
* @description Activity
* @date: 2023-12-24 10:57
* @param
* @return
*/
public void onDismiss(DialogInterface dialog) {
stopAlarmSound();
//停止闹钟声音
finish();
//完成该动作
}
/**
* @method stopAlarmSound
* @description
* @date: 2023-12-24 10:58
* @param
* @return
*/
private void stopAlarmSound() {
if (mPlayer != null) {
mPlayer.stop();
//停止播放
mPlayer.release();
//释放MediaPlayer对象
mPlayer = null;
}
}

@ -27,21 +27,6 @@ import android.database.Cursor;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns;
/**
*
* @ProjectName:
* @Package: net.micode.notes.ui
* @ClassName: AlarmInitReceiver
* @Description: AlarmInitReceiver便广BroadcastReceiver
* 广
* @Author: xumingyang
* @CreateDate: 2023-12-24 11:11
* @UpdateUser:
* @UpdateDate: 2023-12-24 11:11
* @UpdateRemark:
* @Version: 1.0
*/
public class AlarmInitReceiver extends BroadcastReceiver {
@ -49,35 +34,19 @@ public class AlarmInitReceiver extends BroadcastReceiver {
NoteColumns.ID,
NoteColumns.ALERTED_DATE
};
//对数据库的操作调用标签ID和闹钟时间
private static final int COLUMN_ID = 0;
private static final int COLUMN_ALERTED_DATE = 1;
/**
* @method onReceive
* @description
* 便
* @date: 2023-12-24 11:26
* @author: lyt
* @param *Cursor
* alertDate
* Intentsender广AlarmReceiver
* PendingIntent使getBroadcast()广PendingIntentpendingIntent
* @return Cursorc
*/
@Override
public void onReceive(Context context, Intent intent) {
long currentDate = System.currentTimeMillis();
//System.currentTimeMillis()产生一个当前的毫秒
//这个毫秒其实就是自1970年1月1日0时起的毫秒数
Cursor c = context.getContentResolver().query(Notes.CONTENT_NOTE_URI,
PROJECTION,
NoteColumns.ALERTED_DATE + ">? AND " + NoteColumns.TYPE + "=" + Notes.TYPE_NOTE,
new String[] { String.valueOf(currentDate) },
//将long变量currentDate转化为字符串
null);
//Cursor在这里的作用是通过查找数据库中的标签内容找到和当前系统时间相等的标签
if (c != null) {
if (c.moveToFirst()) {
do {
@ -93,9 +62,4 @@ public class AlarmInitReceiver extends BroadcastReceiver {
c.close();
}
}
/*
*
* IntentPendingIntentAlarmManager
*
*/
}

@ -20,36 +20,11 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
/**
*
* @ProjectName:
* @Package: net.micode.notes.ui
* @ClassName: AlarmReceiver
* @Description: AlarmReceiver便
*
* @Author: liyiting
* @CreateDate: 2023-12-24 12:46
* @UpdateUser:
* @UpdateDate: 2023-12-24 12:46
* @UpdateRemark:
*/
/**
* @method
* @description 广AlarmAlertActivity
* @param *Context contextIntent intentcontextintent广
* @return
*/
public class AlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
//重写了onReceive()方法,该方法在接收到广播时会被调用
intent.setClass(context, AlarmAlertActivity.class);
////启动AlarmAlertActivity
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
////activity要存在于activity的栈中而非activity的途径启动activity时必然不存在一个activity的栈
//所以要新起一个栈装入启动的activity
context.startActivity(intent);
}
}

@ -28,22 +28,8 @@ import android.view.View;
import android.widget.FrameLayout;
import android.widget.NumberPicker;
/**
*
* @ProjectName:
* @Package: net.micode.notes.ui
* @ClassName: DateTimePicker
* @Description:
* 使NumberPicker便
* @CreateDate: 2023-12-24 12:58
* @UpdateUser:
* @UpdateDate: 2023-12-24 12:58
* @UpdateRemark:
* @Version: 1.0
*/
public class DateTimePicker extends FrameLayout {
//FrameLayout是布局模板之一
//所有的子元素全部在屏幕的右上方
private static final boolean DEFAULT_ENABLE_STATE = true;
private static final int HOURS_IN_HALF_DAY = 12;
@ -59,15 +45,13 @@ 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;
@ -88,21 +72,8 @@ public class DateTimePicker extends FrameLayout {
onDateTimeChanged();
}
};
//OnValueChangeListener这是时间改变监听器这里主要是对日期的监听
//将现在日期的值传递给mDateupdateDateControl是同步操作
private NumberPicker.OnValueChangeListener mOnHourChangedListener = new NumberPicker.OnValueChangeListener() {
//这里是对 小时Hour 的监听
/**
* @method onValueChange
* @description NumberPicker
*
* 24
* @date: 2023-12-24 13:03
* @param *Calendarcal便
* @return isdateChanged bool
*/
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
boolean isDateChanged = false;
@ -112,33 +83,29 @@ public class DateTimePicker extends FrameLayout {
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点交替时对日期的更改
}
int newHour = mHourSpinner.getValue() % HOURS_IN_HALF_DAY + (mIsAm ? 0 : HOURS_IN_HALF_DAY);
//通过数字选择器对newHour的赋值
mDate.set(Calendar.HOUR_OF_DAY, newHour);
//通过set函数将新的Hour值传给mDate
onDateTimeChanged();
if (isDateChanged) {
setCurrentYear(cal.get(Calendar.YEAR));
@ -149,25 +116,16 @@ public class DateTimePicker extends FrameLayout {
};
private NumberPicker.OnValueChangeListener mOnMinuteChangedListener = new NumberPicker.OnValueChangeListener() {
/**
* @method onValueChange
* @description NumberPicker
*
* @param *picker NumberPicker oldVal newVal
*/
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
int minValue = mMinuteSpinner.getMinValue();
int maxValue = mMinuteSpinner.getMaxValue();
int offset = 0;
//设置offset作为小时改变的一个记录数据
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());
@ -187,15 +145,9 @@ public class DateTimePicker extends FrameLayout {
};
private NumberPicker.OnValueChangeListener mOnAmPmChangedListener = new NumberPicker.OnValueChangeListener() {
/**
* @method onValueChange
* @description NumberPicker
* /
*/
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
mIsAm = !mIsAm;
//对AM和PM的监听
if (mIsAm) {
mDate.add(Calendar.HOUR_OF_DAY, -HOURS_IN_HALF_DAY);
} else {
@ -214,25 +166,18 @@ public class DateTimePicker extends FrameLayout {
public DateTimePicker(Context context) {
this(context, System.currentTimeMillis());
}
//通过对数据库的访问,获取当前的系统时间
public DateTimePicker(Context context, long date) {
this(context, date, DateFormat.is24HourFormat(context));
}
//上面函数的得到的是一个天文数字1970至今的秒数需要DateFormat将其变得有意义
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);
/*
* Activitylayoutlayout
* layoutinflate()layout
* findViewById()
*/
mDateSpinner = (NumberPicker) findViewById(R.id.date);
mDateSpinner.setMinValue(DATE_SPINNER_MIN_VAL);
mDateSpinner.setMaxValue(DATE_SPINNER_MAX_VAL);
@ -269,28 +214,17 @@ public class DateTimePicker extends FrameLayout {
mInitialising = false;
}
/**
* @method setEnabled
* @description
* @param * enabled
* @return mIsEnabled enabled
*/
@Override
public void setEnabled(boolean enabled) {
if (mIsEnabled == enabled) {
return;
}
/*
* enabled mIsEnabled
*
*/
super.setEnabled(enabled);
mDateSpinner.setEnabled(enabled);
mMinuteSpinner.setEnabled(enabled);
mHourSpinner.setEnabled(enabled);
mAmPmSpinner.setEnabled(enabled);
mIsEnabled = enabled;
//将 mIsEnabled 的值更新为传入的 enabled以保持状态同步
}
@Override
@ -305,7 +239,7 @@ public class DateTimePicker extends FrameLayout {
*/
public long getCurrentDateInTimeMillis() {
return mDate.getTimeInMillis();
}//实现函数——得到当前的秒数
}
/**
* Set the current date
@ -317,7 +251,7 @@ public class DateTimePicker extends FrameLayout {
cal.setTimeInMillis(date);
setCurrentDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH),
cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE));
}//实现函数功能——设置当前的时间参数是date
}
/**
* Set the current date
@ -335,14 +269,13 @@ public class DateTimePicker extends FrameLayout {
setCurrentDay(dayOfMonth);
setCurrentHour(hourOfDay);
setCurrentMinute(minute);
}//实现函数功能——设置当前的时间,参数是各详细的变量
}
/**
* Get current year
*
* @return The current year
*/
//下面是得到year、month、day等值
public int getCurrentYear() {
return mDate.get(Calendar.YEAR);
}
@ -513,7 +446,7 @@ public class DateTimePicker extends FrameLayout {
mDateSpinner.setDisplayedValues(mDateDisplayValues);
mDateSpinner.setValue(DAYS_IN_ALL_WEEK / 2);
mDateSpinner.invalidate();
}// 对于星期几的算法
}
private void updateAmPmControl() {
if (mIs24HourView) {
@ -523,7 +456,7 @@ public class DateTimePicker extends FrameLayout {
mAmPmSpinner.setValue(index);
mAmPmSpinner.setVisibility(View.VISIBLE);
}
}// 对于上下午操作的算法
}
private void updateHourControl() {
if (mIs24HourView) {
@ -533,7 +466,7 @@ public class DateTimePicker extends FrameLayout {
mHourSpinner.setMinValue(HOUR_SPINNER_MIN_VAL_12_HOUR_VIEW);
mHourSpinner.setMaxValue(HOUR_SPINNER_MAX_VAL_12_HOUR_VIEW);
}
}// 对与小时的算法
}
/**
* Set the callback that indicates the 'Set' button has been pressed.

@ -29,42 +29,21 @@ import android.content.DialogInterface.OnClickListener;
import android.text.format.DateFormat;
import android.text.format.DateUtils;
/**
*
* @ProjectName: DateTimePickerDialog
* @Package: net.micode.notes.ui
* @ClassName: DateTimePickerDialog
* @Description: DateTimePickerDialog
* 便
* DateTimePickerDialog 便使便
* @CreateDate: 2023-12-24 13:52
* @UpdateUser:
* @UpdateDate: 2023-12-24 13:52
* @UpdateRemark:
* @Version: 1.0
*/
public class DateTimePickerDialog extends AlertDialog implements OnClickListener {
private Calendar mDate = Calendar.getInstance();
//创建一个Calendar类型的变量 mDate方便时间的操作
private boolean mIs24HourView;
private OnDateTimeSetListener mOnDateTimeSetListener;
//声明一个时间日期滚动选择控件 mOnDateTimeSetListener
private DateTimePicker mDateTimePicker;
//DateTimePicker控件控件一般用于让用户可以从日期列表中选择单个值。
//运行时,单击控件边上的下拉箭头,会显示为两个部分:一个下拉列表,一个用于选择日期的
public interface OnDateTimeSetListener {
void OnDateTimeSet(AlertDialog dialog, long date);
}
public DateTimePickerDialog(Context context, long date) {
//对该界面对话框的实例化
super(context);
//对数据库的操作
mDateTimePicker = new DateTimePicker(context);
setView(mDateTimePicker);
//添加一个子视图
mDateTimePicker.setOnDateTimeChangedListener(new OnDateTimeChangedListener() {
public void onDateTimeChanged(DateTimePicker view, int year, int month,
int dayOfMonth, int hourOfDay, int minute) {
@ -73,21 +52,15 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener
mDate.set(Calendar.DAY_OF_MONTH, dayOfMonth);
mDate.set(Calendar.HOUR_OF_DAY, hourOfDay);
mDate.set(Calendar.MINUTE, minute);
//将视图中的各选项设置为系统当前时间
updateTitle(mDate.getTimeInMillis());
}
});
mDate.setTimeInMillis(date);
//得到系统时间
mDate.set(Calendar.SECOND, 0);
//将秒数设置为0 对日期时间进行标准化处理
mDateTimePicker.setCurrentDate(mDate.getTimeInMillis());
//将日期时间选择器设置为当前设置的日期时间。
setButton(context.getString(R.string.datetime_dialog_ok), this);
setButton2(context.getString(R.string.datetime_dialog_cancel), (OnClickListener)null);
//设置按钮
set24HourView(DateFormat.is24HourFormat(this.getContext()));
//时间标准化打印
updateTitle(mDate.getTimeInMillis());
}
@ -97,7 +70,7 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener
public void setOnDateTimeSetListener(OnDateTimeSetListener callBack) {
mOnDateTimeSetListener = callBack;
}//将时间日期滚动选择控件实例化
}
private void updateTitle(long date) {
int flag =
@ -106,13 +79,12 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener
DateUtils.FORMAT_SHOW_TIME;
flag |= mIs24HourView ? DateUtils.FORMAT_24HOUR : DateUtils.FORMAT_24HOUR;
setTitle(DateUtils.formatDateTime(this.getContext(), date, flag));
}//android开发中常见日期管理工具类API——DateUtils按照上下午显示时间
}
public void onClick(DialogInterface arg0, int arg1) {
if (mOnDateTimeSetListener != null) {
mOnDateTimeSetListener.OnDateTimeSet(this, mDate.getTimeInMillis());
}
}//第一个参数arg0是接收到点击事件的对话框
//第二个参数arg1是该对话框上的按钮
}
}

@ -27,37 +27,17 @@ import android.widget.PopupMenu.OnMenuItemClickListener;
import net.micode.notes.R;
/**
*
* @ProjectName:
* @Package: net.micode.notes.ui
* @ClassName: DropdownMenu
* @Description: DropdownMenu
* DropdownMenu
* 1.使DropdownMenu便
* 2.使DropdownMenu
* 3.使DropdownMenu
* @CreateDate: 2023-12-24 13:57
* @UpdateUser:
* @UpdateDate: 2023-12-24 13:57
* @UpdateRemark:
* @Version: 1.0
*/
public class DropdownMenu {
private Button mButton;
private PopupMenu mPopupMenu;
//声明一个下拉菜单
private Menu mMenu;
public DropdownMenu(Context context, Button button, int menuId) {
mButton = button;
mButton.setBackgroundResource(R.drawable.dropdown_icon);
//设置这个view的背景
mPopupMenu = new PopupMenu(context, mButton);
mMenu = mPopupMenu.getMenu();
mPopupMenu.getMenuInflater().inflate(menuId, mMenu);
//MenuInflater是用来实例化Menu目录下的Menu布局文件
//根据ID来确认menu的内容选项
mButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mPopupMenu.show();
@ -69,13 +49,13 @@ public class DropdownMenu {
if (mPopupMenu != null) {
mPopupMenu.setOnMenuItemClickListener(listener);
}
}//设置菜单的监听
}
public MenuItem findItem(int id) {
return mMenu.findItem(id);
}
//对于菜单选项的初始化,根据索引搜索菜单需要的选项
public void setTitle(CharSequence title) {
mButton.setText(title);
}
}//布局文件,设置标题
}

@ -28,53 +28,25 @@ import net.micode.notes.R;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns;
/**
*
* @ProjectName:
* @Package: net.micode.notes.ui
* @ClassName: FoldersListAdapter
* @Description: FoldersListAdapter
* @CreateDate: 2023-12-24 14:05
* @UpdateUser:
* @UpdateDate: 2023-12-24 14:05
* @UpdateRemark:
* @Version: 1.0
*/
public class FoldersListAdapter extends CursorAdapter {
/*
* CursorAdapterCursorListView
* FoldersListAdapterCursorAdapter
* 便
* folder
*/
public static final String [] PROJECTION = {
NoteColumns.ID,
NoteColumns.SNIPPET
};//调用数据库中便签的ID和片段
};
public static final int ID_COLUMN = 0;
public static final int NAME_COLUMN = 1;
/**
* @method FoldersListAdapter
* @description FoldersListAdapter
* @param context
* c Cursor
*/
public FoldersListAdapter(Context context, Cursor c) {
super(context, c);
// TODO Auto-generated constructor stub
}//数据库操作
}
/**
* @method newView
* @description
* @return 使
*/
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
return new FolderListItem(context);
}//创建一个文件夹,对于各文件夹中子标签的初始化
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
@ -83,23 +55,20 @@ public class FoldersListAdapter extends CursorAdapter {
.getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN);
((FolderListItem) view).bind(folderName);
}
}//将各个布局文件绑定起来
}
public String getFolderName(Context context, int position) {
Cursor cursor = (Cursor) getItem(position);
return (cursor.getLong(ID_COLUMN) == Notes.ID_ROOT_FOLDER) ? context
.getString(R.string.menu_move_parent_folder) : cursor.getString(NAME_COLUMN);
}//根据数据库中标签的ID得到标签的各项内容
}
private class FolderListItem extends LinearLayout {
private TextView mName;
public FolderListItem(Context context) {
super(context);
//操作数据库
inflate(context, R.layout.folder_list_item, this);
//根据布局文件的名字等信息将其找出来
mName = (TextView) findViewById(R.id.tv_folder_name);
}

@ -22,19 +22,34 @@ import android.app.AlertDialog;
import android.app.PendingIntent;
import android.app.SearchManager;
import android.appwidget.AppWidgetManager;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.text.Editable;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.style.BackgroundColorSpan;
import android.text.style.ImageSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@ -43,10 +58,12 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -65,6 +82,7 @@ import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener;
import net.micode.notes.widget.NoteWidgetProvider_2x;
import net.micode.notes.widget.NoteWidgetProvider_4x;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@ -149,6 +167,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private String mUserQuery;
private Pattern mPattern;
private final int PHOTO_REQUEST = 1;//请求码
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -159,12 +179,27 @@ public class NoteEditActivity extends Activity implements OnClickListener,
return;
}
initResources();
//根据id获取添加图片按钮
final ImageButton add_img_btn = (ImageButton) findViewById(R.id.add_img_btn);
//为点击图片按钮设置监听器
add_img_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d(TAG, "onClick: click add image button");
//ACTION_GET_CONTENT: 允许用户选择特殊种类的数据,并返回(特殊种类的数据:照一张相片或录一段音)
Intent loadImage = new Intent(Intent.ACTION_GET_CONTENT);
//Category属性用于指定当前动作Action被执行的环境.
//CATEGORY_OPENABLE; 用来指示一个ACTION_GET_CONTENT的intent
loadImage.addCategory(Intent.CATEGORY_OPENABLE);
loadImage.setType("image/*");
startActivityForResult(loadImage, PHOTO_REQUEST);
}
});
}
/**
* Current activity may be killed when the memory is low. Once it is killed, for another time
* user load this activity, we should restore the former state
*/
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
@ -263,14 +298,13 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
@Override
protected void onResume() {
protected void onResume() {//能获得用户焦点:可以操作
super.onResume();
initNoteScreen();
initNoteScreen();//初始化便签屏幕
}
private void initNoteScreen() {
mNoteEditor.setTextAppearance(this, TextAppearanceResources
.getTexAppearanceResource(mFontSizeId));
mNoteEditor.setTextAppearance(this, TextAppearanceResources.getTexAppearanceResource(mFontSizeId));
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
switchToListMode(mWorkingNote.getContent());
} else {
@ -288,11 +322,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
| DateUtils.FORMAT_NUMERIC_DATE | DateUtils.FORMAT_SHOW_TIME
| DateUtils.FORMAT_SHOW_YEAR));
/**
* TODO: Add the menu for setting alert. Currently disable it because the DateTimePicker
* is not ready
*/
showAlertHeader();
//将有图片路径的位置转换为图片
convertToImage();
}
private void showAlertHeader() {
@ -312,6 +344,47 @@ public class NoteEditActivity extends Activity implements OnClickListener,
};
}
//路径字符串格式 转换为 图片image格式
private void convertToImage() {
NoteEditText noteEditText = (NoteEditText) findViewById(R.id.note_edit_view); //获取当前的edit
Editable editable = noteEditText.getText();//1.获取text
String noteText = editable.toString(); //2.将note内容转换为字符串
int length = editable.length(); //内容的长度
//3.截取img片段 [local]+uri+[local]提取uri
for(int i = 0; i < length; i++) {
for(int j = i; j < length; j++) {
String img_fragment = noteText.substring(i, j+1); //img_fragment关于图片路径的片段
if(img_fragment.length() > 15 && img_fragment.endsWith("[/local]") && img_fragment.startsWith("[local]")){
int limit = 7; //[local]为7个字符
//[local][/local]共15个字符剩下的为真正的path长度
int len = img_fragment.length()-15;
//从[local]之后的len个字符就是path
String path = img_fragment.substring(limit,limit+len);//获取到了图片路径
Bitmap bitmap = null;
Log.d(TAG, "图片的路径是:"+path);
try {
bitmap = BitmapFactory.decodeFile(path);//将图片路径解码为图片格式
} catch (Exception e) {
e.printStackTrace();
}
if(bitmap!=null){ //若图片存在
Log.d(TAG, "图片不为null");
ImageSpan imageSpan = new ImageSpan(NoteEditActivity.this, bitmap);
//4.创建一个SpannableString对象以便插入用ImageSpan对象封装的图像
String ss = "[local]" + path + "[/local]";
SpannableString spannableString = new SpannableString(ss);
//5.将指定的标记对象附加到文本的开始...结束范围
spannableString.setSpan(imageSpan, 0, ss.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
Log.d(TAG, "Create spannable string success!");
Editable edit_text = noteEditText.getEditableText();
edit_text.delete(i,i+len+15); //6.删掉图片路径的文字
edit_text.insert(i, spannableString); //7.在路径的起始位置插入图片
}
}
}
}
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
@ -358,8 +431,8 @@ public class NoteEditActivity extends Activity implements OnClickListener,
|| ev.getX() > (x + view.getWidth())
|| ev.getY() < y
|| ev.getY() > (y + view.getHeight())) {
return false;
}
return false;
}
return true;
}
@ -418,7 +491,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[] {
mWorkingNote.getWidgetId()
mWorkingNote.getWidgetId()
});
sendBroadcast(intent);
@ -430,7 +503,7 @@ public class NoteEditActivity extends Activity implements OnClickListener,
if (id == R.id.btn_set_bg_color) {
mNoteBgColorSelector.setVisibility(View.VISIBLE);
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
- View.VISIBLE);
View.VISIBLE);
} else if (sBgSelectorBtnsMap.containsKey(id)) {
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
View.GONE);
@ -507,56 +580,52 @@ public class NoteEditActivity extends Activity implements OnClickListener,
@Override
public boolean onOptionsItemSelected(MenuItem item) {
/**
*
* ID
* createNewNote()
* deleteCurrentNote()
*
*
*
*
*
*
*/
int itemId = item.getItemId();
if (itemId == R.id.menu_new_note) {
createNewNote(); //调用创建新的便签的函数
} else if (itemId == R.id.menu_delete) {
//弹出确认对话框
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.alert_title_delete));
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setMessage(getString(R.string.alert_message_delete_note));
builder.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
deleteCurrentNote();//确认后调用删除笔记的函数
finish();//结束当前活动
}
});
builder.setNegativeButton(android.R.string.cancel, null);
builder.show();
} else if (itemId == R.id.menu_font_size) {
mFontSizeSelector.setVisibility(View.VISIBLE);//显示字体大小选择器
findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.VISIBLE);//根据当前字体大小设置选择器状态
} else if (itemId == R.id.menu_list_mode) {
mWorkingNote.setCheckListMode(mWorkingNote.getCheckListMode() == 0 ?
TextNote.MODE_CHECK_LIST : 0);//切换笔记的列表模式
} else if (itemId == R.id.menu_share) {
getWorkingText();//获取当前笔记内容
sendTo(this, mWorkingNote.getContent());//分享笔记内容
} else if (itemId == R.id.menu_send_to_desktop) {
sendToDesktop();//发送到桌面
} else if (itemId == R.id.menu_alert) {
setReminder();//设置提醒
} else if (itemId == R.id.menu_delete_remind) {
mWorkingNote.setAlertDate(0, false);//清除提醒
switch (item.getItemId()) {
case R.id.menu_new_note:
createNewNote();
break;
case R.id.menu_delete:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.alert_title_delete));
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setMessage(getString(R.string.alert_message_delete_note));
builder.setPositiveButton(android.R.string.ok,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
deleteCurrentNote();
finish();
}
});
builder.setNegativeButton(android.R.string.cancel, null);
builder.show();
break;
case R.id.menu_font_size:
mFontSizeSelector.setVisibility(View.VISIBLE);
findViewById(sFontSelectorSelectionMap.get(mFontSizeId)).setVisibility(View.VISIBLE);
break;
case R.id.menu_list_mode:
mWorkingNote.setCheckListMode(mWorkingNote.getCheckListMode() == 0 ?
TextNote.MODE_CHECK_LIST : 0);
break;
case R.id.menu_share:
getWorkingText();
sendTo(this, mWorkingNote.getContent());
break;
case R.id.menu_send_to_desktop:
sendToDesktop();
break;
case R.id.menu_alert:
setReminder();
break;
case R.id.menu_delete_remind:
mWorkingNote.setAlertDate(0, false);
break;
default:
break;
}
return true;
}
private void setReminder() {
DateTimePickerDialog d = new DateTimePickerDialog(this, System.currentTimeMillis());
d.setOnDateTimeSetListener(new OnDateTimeSetListener() {
@ -567,10 +636,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
d.show();
}
/**
* Share note to apps that support {@link Intent#ACTION_SEND} action
* and {@text/plain} type
*/
private void sendTo(Context context, String info) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, info);
@ -579,13 +644,6 @@ public class NoteEditActivity extends Activity implements OnClickListener,
}
private void createNewNote() {
/**
*
*
* NoteEditActivity
*
* Intent
*/
// Firstly, save current editing notes
saveNote();
@ -784,12 +842,12 @@ public class NoteEditActivity extends Activity implements OnClickListener,
switchToListMode(mNoteEditor.getText().toString());
} else {
if (!getWorkingText()) {
mWorkingNote.setWorkingText(mWorkingNote.getContent().replace(TAG_UNCHECKED + " ",
""));
mWorkingNote.setWorkingText(mWorkingNote.getContent().replace(TAG_UNCHECKED + " ", ""));
}
mNoteEditor.setText(getHighlightQueryResult(mWorkingNote.getContent(), mUserQuery));
mEditTextList.setVisibility(View.GONE);
mNoteEditor.setVisibility(View.VISIBLE);
convertToImage(); //退出清单模式,应该将有图片的地方显示出来
}
}
@ -881,4 +939,147 @@ public class NoteEditActivity extends Activity implements OnClickListener,
private void showToast(int resId, int duration) {
Toast.makeText(this, resId, duration).show();
}
@Override
//重写onActivityResult()来处理返回的数据
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
ContentResolver resolver = getContentResolver();
switch (requestCode) {
case PHOTO_REQUEST:
Uri originalUri = intent.getData(); //1.获得图片的真实路径
Bitmap bitmap = null;
try {
bitmap = BitmapFactory.decodeStream(resolver.openInputStream(originalUri));//2.解码图片
} catch (FileNotFoundException e) {
Log.d(TAG, "onActivityResult: get file_exception");
e.printStackTrace();
}
if(bitmap != null){
//3.根据Bitmap对象创建ImageSpan对象
Log.d(TAG, "onActivityResult: bitmap is not null");
ImageSpan imageSpan = new ImageSpan(NoteEditActivity.this, bitmap);
String path = getPath(this,originalUri);
//4.使用[local][/local]将path括起来用于之后方便识别图片路径在note中的位置
String img_fragment= "[local]" + path + "[/local]";
//创建一个SpannableString对象以便插入用ImageSpan对象封装的图像
SpannableString spannableString = new SpannableString(img_fragment);
spannableString.setSpan(imageSpan, 0, img_fragment.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
//5.将选择的图片追加到EditText中光标所在位置
NoteEditText e = (NoteEditText) findViewById(R.id.note_edit_view);
int index = e.getSelectionStart(); //获取光标所在位置
Log.d(TAG, "Index是: " + index);
Editable edit_text = e.getEditableText();
edit_text.insert(index, spannableString); //将图片插入到光标所在位置
mWorkingNote.mContent = e.getText().toString();
//6.把改动提交到数据库中,两个数据库表都要改的
ContentResolver contentResolver = getContentResolver();
ContentValues contentValues = new ContentValues();
final long id = mWorkingNote.getNoteId();
contentValues.put("snippet",mWorkingNote.mContent);
contentResolver.update(Uri.parse("content://micode_notes/note"), contentValues,"_id=?",new String[]{""+id});
ContentValues contentValues1 = new ContentValues();
contentValues1.put("content",mWorkingNote.mContent);
contentResolver.update(Uri.parse("content://micode_notes/data"), contentValues1,"mime_type=? and note_id=?", new String[]{"vnd.android.cursor.item/text_note",""+id});
}else{
Toast.makeText(NoteEditActivity.this, "获取图片失败", Toast.LENGTH_SHORT).show();
}
break;
default:
break;
}
}
//获取文件的real path
public String getPath(final Context context, final Uri uri) {
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
// DocumentProvider
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
// ExternalStorageProvider
// if (isExternalStorageDocument(uri)) {
// final String docId = DocumentsContract.getDocumentId(uri);
// final String[] split = docId.split(":");
// final String type = split[0];
//
// if ("primary".equalsIgnoreCase(type)) {
// return Environment.getExternalStorageDirectory() + "/" + split[1];
// }
// }
// // DownloadsProvider
// else if (isDownloadsDocument(uri)) {
// final String id = DocumentsContract.getDocumentId(uri);
// final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
// return getDataColumn(context, contentUri, null, null);
// }
// MediaProvider
// else
if (isMediaDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
Uri contentUri = null;
if ("image".equals(type)) {
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
}
final String selection = "_id=?";
final String[] selectionArgs = new String[]{split[1]};
return getDataColumn(context, contentUri, selection, selectionArgs);
}
}
// Media
else if ("content".equalsIgnoreCase(uri.getScheme())) {
return getDataColumn(context, uri, null, null);
}
// File
else if ("file".equalsIgnoreCase(uri.getScheme())) {
return uri.getPath();
}
return null;
}
//获取数据列_获取此 Uri 的数据列的值。这对MediaStore Uris 和其他基于文件的 ContentProvider。
public String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) {
Cursor cursor = null;
final String column = "_data";
final String[] projection = {column};
try {
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
if (cursor != null && cursor.moveToFirst()) {
final int column_index = cursor.getColumnIndexOrThrow(column);
return cursor.getString(column_index);
}
} finally {
if (cursor != null)
cursor.close();
}
return null;
}
//是否为外部存储文件
// public boolean isExternalStorageDocument(Uri uri) {
// return "com.android.externalstorage.documents".equals(uri.getAuthority());
// }
//
// //是否为下载文件
// public boolean isDownloadsDocument(Uri uri) {
// return "com.android.providers.downloads.documents".equals(uri.getAuthority());
// }
//是否为媒体文件
public boolean isMediaDocument(Uri uri) {
return "com.android.providers.media.documents".equals(uri.getAuthority());
}
}

@ -76,10 +76,12 @@ public class NoteEditText extends EditText {
}
private OnTextViewChangeListener mOnTextViewChangeListener;
/*NoteEditText类实现了OnTextViewChangeListener接口用于在编辑框中删除或添加文本时通知NoteEditActivity进行相应的操作。*/
public NoteEditText(Context context) {
super(context, null);
mIndex = 0;
mIndex = 0;//在构造函数中设置了编辑框的索引为0。
}
public void setIndex(int index) {
@ -98,7 +100,7 @@ public class NoteEditText extends EditText {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
//当用户点击编辑框时,根据点击的位置计算出光标的位置,并将光标移动到该位置。
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
@ -124,11 +126,14 @@ public class NoteEditText extends EditText {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
//当用户按下回车键时如果设置了OnTextViewChangeListener监听器则通知该监听器进行相应的操作。
case KeyEvent.KEYCODE_ENTER:
if (mOnTextViewChangeListener != null) {
return false;
}
break;
case KeyEvent.KEYCODE_DEL:
mSelectionStartBeforeDelete = getSelectionStart();
break;
@ -139,6 +144,7 @@ public class NoteEditText extends EditText {
}
@Override
//在onKeyUp()方法中当用户松开删除键时如果设置了OnTextViewChangeListener监听器则通知该监听器进行相应的操作。
public boolean onKeyUp(int keyCode, KeyEvent event) {
switch(keyCode) {
case KeyEvent.KEYCODE_DEL:
@ -151,6 +157,8 @@ public class NoteEditText extends EditText {
Log.d(TAG, "OnTextViewChangeListener was not seted");
}
break;
//当用户松开回车键时如果设置了OnTextViewChangeListener监听器则通知该监听器进行相应的操作。
case KeyEvent.KEYCODE_ENTER:
if (mOnTextViewChangeListener != null) {
int selectionStart = getSelectionStart();
@ -168,6 +176,7 @@ public class NoteEditText extends EditText {
}
@Override
//当编辑框失去焦点时如果设置了OnTextViewChangeListener监听器则通知该监听器进行相应的操作。
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
if (mOnTextViewChangeListener != null) {
if (!focused && TextUtils.isEmpty(getText())) {
@ -180,6 +189,8 @@ public class NoteEditText extends EditText {
}
@Override
//当用户长按编辑框时如果编辑框中有URLSpan则创建一个上下文菜单用于打开链接。
protected void onCreateContextMenu(ContextMenu menu) {
if (getText() instanceof Spanned) {
int selStart = getSelectionStart();
@ -187,7 +198,7 @@ public class NoteEditText extends EditText {
int min = Math.min(selStart, selEnd);
int max = Math.max(selStart, selEnd);
//如果URLSpan的URI方案与预定义的URI方案相匹配则使用预定义的操作打开链接否则使用默认的打开链接操作
final URLSpan[] urls = ((Spanned) getText()).getSpans(min, max, URLSpan.class);
if (urls.length == 1) {
int defaultResId = 0;

@ -397,4 +397,13 @@
android:src="@drawable/selected" />
</FrameLayout>
</LinearLayout>
<ImageButton
android:id="@+id/add_img_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:layout_marginTop="600dp"
android:layout_marginBottom="7dp"
android:src="@android:drawable/ic_menu_gallery" />
</FrameLayout>

@ -64,6 +64,6 @@
<style name="NoteActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:displayOptions" />
<item name="android:visibility">gone</item>
<item name="android:visibility">visible</item>
</style>
</resources>
Loading…
Cancel
Save