Compare commits

..

11 Commits
JHQ ... master

2
.idea/.gitignore vendored

@ -0,0 +1,2 @@
# Default ignored files
/workspace.xml

@ -0,0 +1,140 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>

@ -0,0 +1,463 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DBNavigator.Project.DataEditorManager">
<record-view-column-sorting-type value="BY_INDEX" />
<value-preview-text-wrapping value="true" />
<value-preview-pinned value="false" />
</component>
<component name="DBNavigator.Project.DataExportManager">
<export-instructions>
<create-header value="true" />
<friendly-headers value="false" />
<quote-values-containing-separator value="true" />
<quote-all-values value="false" />
<value-separator value="" />
<file-name value="" />
<file-location value="" />
<scope value="GLOBAL" />
<destination value="FILE" />
<format value="EXCEL" />
<charset value="UTF-8" />
<charset value="UTF-8" />
</export-instructions>
</component>
<component name="DBNavigator.Project.DatabaseBrowserManager">
<autoscroll-to-editor value="false" />
<autoscroll-from-editor value="true" />
<show-object-properties value="true" />
<loaded-nodes />
</component>
<component name="DBNavigator.Project.DatabaseFileManager">
<open-files />
</component>
<component name="DBNavigator.Project.EditorStateManager">
<last-used-providers />
</component>
<component name="DBNavigator.Project.ExecutionManager">
<retain-sticky-names value="false" />
</component>
<component name="DBNavigator.Project.MethodExecutionManager">
<method-browser />
<execution-history>
<group-entries value="true" />
<execution-inputs />
</execution-history>
<argument-values-cache />
</component>
<component name="DBNavigator.Project.ObjectDependencyManager">
<last-used-dependency-type value="INCOMING" />
</component>
<component name="DBNavigator.Project.ObjectQuickFilterManager">
<last-used-operator value="EQUAL" />
<filters />
</component>
<component name="DBNavigator.Project.ParserDiagnosticsManager">
<diagnostics-history />
</component>
<component name="DBNavigator.Project.ScriptExecutionManager" clear-outputs="true">
<recently-used-interfaces />
</component>
<component name="DBNavigator.Project.Settings">
<connections />
<browser-settings>
<general>
<display-mode value="TABBED" />
<navigation-history-size value="100" />
<show-object-details value="false" />
</general>
<filters>
<object-type-filter>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="true" />
<object-type name="ROLE" enabled="true" />
<object-type name="PRIVILEGE" enabled="true" />
<object-type name="CHARSET" enabled="true" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED_VIEW" enabled="true" />
<object-type name="NESTED_TABLE" enabled="true" />
<object-type name="COLUMN" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET_TRIGGER" enabled="true" />
<object-type name="DATABASE_TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="true" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="TYPE_ATTRIBUTE" enabled="true" />
<object-type name="ARGUMENT" enabled="true" />
<object-type name="DIMENSION" enabled="true" />
<object-type name="CLUSTER" enabled="true" />
<object-type name="DBLINK" enabled="true" />
</object-type-filter>
</filters>
<sorting>
<object-type name="COLUMN" sorting-type="NAME" />
<object-type name="FUNCTION" sorting-type="NAME" />
<object-type name="PROCEDURE" sorting-type="NAME" />
<object-type name="ARGUMENT" sorting-type="POSITION" />
<object-type name="TYPE ATTRIBUTE" sorting-type="POSITION" />
</sorting>
<default-editors>
<object-type name="VIEW" editor-type="SELECTION" />
<object-type name="PACKAGE" editor-type="SELECTION" />
<object-type name="TYPE" editor-type="SELECTION" />
</default-editors>
</browser-settings>
<navigation-settings>
<lookup-filters>
<lookup-objects>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="false" />
<object-type name="ROLE" enabled="false" />
<object-type name="PRIVILEGE" enabled="false" />
<object-type name="CHARSET" enabled="false" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED VIEW" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET TRIGGER" enabled="true" />
<object-type name="DATABASE TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="false" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="DIMENSION" enabled="false" />
<object-type name="CLUSTER" enabled="false" />
<object-type name="DBLINK" enabled="true" />
</lookup-objects>
<force-database-load value="false" />
<prompt-connection-selection value="true" />
<prompt-schema-selection value="true" />
</lookup-filters>
</navigation-settings>
<dataset-grid-settings>
<general>
<enable-zooming value="true" />
<enable-column-tooltip value="true" />
</general>
<sorting>
<nulls-first value="true" />
<max-sorting-columns value="4" />
</sorting>
<audit-columns>
<column-names value="" />
<visible value="true" />
<editable value="false" />
</audit-columns>
</dataset-grid-settings>
<dataset-editor-settings>
<text-editor-popup>
<active value="false" />
<active-if-empty value="false" />
<data-length-threshold value="100" />
<popup-delay value="1000" />
</text-editor-popup>
<values-actions-popup>
<show-popup-button value="true" />
<element-count-threshold value="1000" />
<data-length-threshold value="250" />
</values-actions-popup>
<general>
<fetch-block-size value="100" />
<fetch-timeout value="30" />
<trim-whitespaces value="true" />
<convert-empty-strings-to-null value="true" />
<select-content-on-cell-edit value="true" />
<large-value-preview-active value="true" />
</general>
<filters>
<prompt-filter-dialog value="true" />
<default-filter-type value="BASIC" />
</filters>
<qualified-text-editor text-length-threshold="300">
<content-types>
<content-type name="Text" enabled="true" />
<content-type name="Properties" enabled="true" />
<content-type name="XML" enabled="true" />
<content-type name="DTD" enabled="true" />
<content-type name="HTML" enabled="true" />
<content-type name="XHTML" enabled="true" />
<content-type name="Java" enabled="true" />
<content-type name="SQL" enabled="true" />
<content-type name="PL/SQL" enabled="true" />
<content-type name="JSON" enabled="true" />
<content-type name="JSON5" enabled="true" />
<content-type name="Groovy" enabled="true" />
<content-type name="AIDL" enabled="true" />
<content-type name="YAML" enabled="true" />
<content-type name="Manifest" enabled="true" />
</content-types>
</qualified-text-editor>
<record-navigation>
<navigation-target value="VIEWER" />
</record-navigation>
</dataset-editor-settings>
<code-editor-settings>
<general>
<show-object-navigation-gutter value="false" />
<show-spec-declaration-navigation-gutter value="true" />
<enable-spellchecking value="true" />
<enable-reference-spellchecking value="false" />
</general>
<confirmations>
<save-changes value="false" />
<revert-changes value="true" />
</confirmations>
</code-editor-settings>
<code-completion-settings>
<filters>
<basic-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="false" />
<filter-element type="OBJECT" id="view" selected="false" />
<filter-element type="OBJECT" id="materialized view" selected="false" />
<filter-element type="OBJECT" id="index" selected="false" />
<filter-element type="OBJECT" id="constraint" selected="false" />
<filter-element type="OBJECT" id="trigger" selected="false" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="false" />
<filter-element type="OBJECT" id="procedure" selected="false" />
<filter-element type="OBJECT" id="function" selected="false" />
<filter-element type="OBJECT" id="package" selected="false" />
<filter-element type="OBJECT" id="type" selected="false" />
<filter-element type="OBJECT" id="dimension" selected="false" />
<filter-element type="OBJECT" id="cluster" selected="false" />
<filter-element type="OBJECT" id="dblink" selected="false" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</basic-filter>
<extended-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</extended-filter>
</filters>
<sorting enabled="true">
<sorting-element type="RESERVED_WORD" id="keyword" />
<sorting-element type="RESERVED_WORD" id="datatype" />
<sorting-element type="OBJECT" id="column" />
<sorting-element type="OBJECT" id="table" />
<sorting-element type="OBJECT" id="view" />
<sorting-element type="OBJECT" id="materialized view" />
<sorting-element type="OBJECT" id="index" />
<sorting-element type="OBJECT" id="constraint" />
<sorting-element type="OBJECT" id="trigger" />
<sorting-element type="OBJECT" id="synonym" />
<sorting-element type="OBJECT" id="sequence" />
<sorting-element type="OBJECT" id="procedure" />
<sorting-element type="OBJECT" id="function" />
<sorting-element type="OBJECT" id="package" />
<sorting-element type="OBJECT" id="type" />
<sorting-element type="OBJECT" id="dimension" />
<sorting-element type="OBJECT" id="cluster" />
<sorting-element type="OBJECT" id="dblink" />
<sorting-element type="OBJECT" id="schema" />
<sorting-element type="OBJECT" id="role" />
<sorting-element type="OBJECT" id="user" />
<sorting-element type="RESERVED_WORD" id="function" />
<sorting-element type="RESERVED_WORD" id="parameter" />
</sorting>
<format>
<enforce-code-style-case value="true" />
</format>
</code-completion-settings>
<execution-engine-settings>
<statement-execution>
<fetch-block-size value="100" />
<execution-timeout value="20" />
<debug-execution-timeout value="600" />
<focus-result value="false" />
<prompt-execution value="false" />
</statement-execution>
<script-execution>
<command-line-interfaces />
<execution-timeout value="300" />
</script-execution>
<method-execution>
<execution-timeout value="30" />
<debug-execution-timeout value="600" />
<parameter-history-size value="10" />
</method-execution>
</execution-engine-settings>
<operation-settings>
<transactions>
<uncommitted-changes>
<on-project-close value="ASK" />
<on-disconnect value="ASK" />
<on-autocommit-toggle value="ASK" />
</uncommitted-changes>
<multiple-uncommitted-changes>
<on-commit value="ASK" />
<on-rollback value="ASK" />
</multiple-uncommitted-changes>
</transactions>
<session-browser>
<disconnect-session value="ASK" />
<kill-session value="ASK" />
<reload-on-filter-change value="false" />
</session-browser>
<compiler>
<compile-type value="KEEP" />
<compile-dependencies value="ASK" />
<always-show-controls value="false" />
</compiler>
<debugger>
<debugger-type value="ASK" />
<use-generic-runners value="true" />
</debugger>
</operation-settings>
<ddl-file-settings>
<extensions>
<mapping file-type-id="VIEW" extensions="vw" />
<mapping file-type-id="TRIGGER" extensions="trg" />
<mapping file-type-id="PROCEDURE" extensions="prc" />
<mapping file-type-id="FUNCTION" extensions="fnc" />
<mapping file-type-id="PACKAGE" extensions="pkg" />
<mapping file-type-id="PACKAGE_SPEC" extensions="pks" />
<mapping file-type-id="PACKAGE_BODY" extensions="pkb" />
<mapping file-type-id="TYPE" extensions="tpe" />
<mapping file-type-id="TYPE_SPEC" extensions="tps" />
<mapping file-type-id="TYPE_BODY" extensions="tpb" />
</extensions>
<general>
<lookup-ddl-files value="true" />
<create-ddl-files value="false" />
<synchronize-ddl-files value="true" />
<use-qualified-names value="false" />
<make-scripts-rerunnable value="true" />
</general>
</ddl-file-settings>
<general-settings>
<regional-settings>
<date-format value="MEDIUM" />
<number-format value="UNGROUPED" />
<locale value="SYSTEM_DEFAULT" />
<use-custom-formats value="false" />
</regional-settings>
<environment>
<environment-types>
<environment-type id="development" name="Development" description="Development environment" color="-2430209/-12296320" readonly-code="false" readonly-data="false" />
<environment-type id="integration" name="Integration" description="Integration environment" color="-2621494/-12163514" readonly-code="true" readonly-data="false" />
<environment-type id="production" name="Production" description="Productive environment" color="-11574/-10271420" readonly-code="true" readonly-data="true" />
<environment-type id="other" name="Other" description="" color="-1576/-10724543" readonly-code="false" readonly-data="false" />
</environment-types>
<visibility-settings>
<connection-tabs value="true" />
<dialog-headers value="true" />
<object-editor-tabs value="true" />
<script-editor-tabs value="false" />
<execution-result-tabs value="true" />
</visibility-settings>
</environment>
</general-settings>
</component>
<component name="DBNavigator.Project.StatementExecutionManager">
<execution-variables />
</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$/.idea/xiaomi_notes_development.iml" filepath="$PROJECT_DIR$/.idea/xiaomi_notes_development.iml" />
</modules>
</component>
</project>

@ -0,0 +1,146 @@
g
java:S1301á "KReplace this "switch" statement by "if" statements to increase readability.(×ö³–úÿÿÿÿ
]
java:S1192ã"FDefine a constant instead of duplicating this literal "zh_cn" 3 times.(ðýþ°
_
java:S1192Ï
"HDefine a constant instead of duplicating this literal "[local]" 4 times.(˜îÞ<C3AE>
e
java:S1192Ð
"IDefine a constant instead of duplicating this literal "[/local]" 5 times.(¢Ñ<C2A2><C391>üÿÿÿÿ
D
java:S1199Ø"-Extract this nested code block into a method.(€õ£Ý
D
java:S1199Ü"-Extract this nested code block into a method.(Ãñ£ñ
D
java:S1199à"-Extract this nested code block into a method.(ÒöÓù
D
java:S1199ä"-Extract this nested code block into a method.(袵ú
D
java:S1199é"-Extract this nested code block into a method.(†˜‘¿
I
java:S1199î"-Extract this nested code block into a method.(’‚ŠÁüÿÿÿÿ
I
java:S1199ó"-Extract this nested code block into a method.(<28>ù§úüÿÿÿÿ
g java:S117"QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¨Å£Ð
g java:S117ú"QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(¡€öº
g java:S117½ "QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ê‰øº
l java:S117Ô "QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ÄÀ´Àúÿÿÿÿ
g java:S117ò "QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(<28>ò<EFBFBD>é
g java:S117ú "QRename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ª€üÖ
?
java:S1148É "#Use a logger to log this exception.(€ÉÔ…ýÿÿÿÿ
?
java:S1148é "#Use a logger to log this exception.(€ÉÔ…ýÿÿÿÿ
:
java:S1148â "#Use a logger to log this exception.(Ç’Çê
r
java:S1104<18>"VMake tvModified a static final constant or non-public and provide accessors if needed.(ƒëÔ£ÿÿÿÿÿ
s
java:S1104ƒ"WMake ivAlertIcon a static final constant or non-public and provide accessors if needed.(ªà¶±ûÿÿÿÿ
s
java:S1104"WMake tvAlertDate a static final constant or non-public and provide accessors if needed.(“²<E2809C>Öúÿÿÿÿ
t
java:S1104"XMake ibSetBgColor a static final constant or non-public and provide accessors if needed.(ýãä¬üÿÿÿÿ
t
java:S1104Â"XMake mWorkingNote a static final constant or non-public and provide accessors if needed.(Ü’±Íþÿÿÿÿ
x
java:S1488¥ "\Immediately return this expression instead of assigning it to the temporary variable "path".(†Üºˆûÿÿÿÿ
s
java:S1488¨ "\Immediately return this expression instead of assigning it to the temporary variable "path".(­ïŽ 
r
java:S1488¯ "\Immediately return this expression instead of assigning it to the temporary variable "path".(¬Ë³|
s
java:S1488³ "\Immediately return this expression instead of assigning it to the temporary variable "path".(°•ÖÖ
s
java:S1488Å "\Immediately return this expression instead of assigning it to the temporary variable "path".(¢îàð
N
java:S1128p"3Remove this unused import 'org.json.JSONException'.(<28>¹Ó·úÿÿÿÿ
V
java:S1128\"@Remove this unused import 'com.iflytek.cloud.util.ResourceUtil'.(µ–¸Û
K
java:S1128q"0Remove this unused import 'org.json.JSONObject'.(œÖ´üþÿÿÿÿ
M
java:S1128C"2Remove this unused import 'android.widget.Button'.(²<>òžýÿÿÿÿ
U
java:S1128W":Remove this unused import 'com.iflytek.cloud.SpeechEvent'.(¡Öšáûÿÿÿÿ
W
java:S1128S"ARemove this unused import 'com.iflytek.cloud.RecognizerListener'.(œ<E28099>
n
java:S1450å"WRemove the "btnStart" field and declare it as a local variable in the relevant methods.(¹‹¡¸
n
java:S1450Õ"WRemove the "mPattern" field and declare it as a local variable in the relevant methods.(©´ÖÛ
r java:S116ê "\Rename this field "MAX_OF_RVOKE_TIME" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(°ÖêÊ
{
java:S1149Ë
"_Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder".(ºá¯²ùÿÿÿÿ
{
java:S1149æ
"_Replace the synchronized class "StringBuffer" by an unsynchronized one such as "StringBuilder".(ºá¯²ùÿÿÿÿ
|
java:S1149ë "eReplace the synchronized class "Vector" by an unsynchronized one such as "ArrayList" or "LinkedList".(×¼‰í
u
java:S2293<18>"YReplace the type specification in this constructor call with the diamond operator ("<>").(ÑÓ<C391>¥üÿÿÿÿ
u
java:S2293"YReplace the type specification in this constructor call with the diamond operator ("<>").(®ú÷õþÿÿÿÿ
u
java:S2293¡"YReplace the type specification in this constructor call with the diamond operator ("<>").(êÝýÂþÿÿÿÿ
p
java:S2293ª"YReplace the type specification in this constructor call with the diamond operator ("<>").(À—’¢
p
java:S2293Þ"YReplace the type specification in this constructor call with the diamond operator ("<>").(…·ú¿
2
java:S3626š"Remove this redundant jump.(ûÁÝ…
˜
java:S1186Ÿ"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(«û³±
<EFBFBD>
java:S1186¢"€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(Ê¥¾àûÿÿÿÿ
n
java:S3776Ã"RRefactor this method to reduce its Cognitive Complexity from 27 to the 15 allowed.(ݨÁ±øÿÿÿÿ
K
java:S2864¹"4Iterate over the "entrySet" instead of the "keySet".(­Ô‡ï
N
java:S1135Å"2Complete the task associated to this TODO comment.(Ùü§“ýÿÿÿÿ
8
java:S1116Ý"Remove this empty statement.(ôŸŽìúÿÿÿÿ
X
java:S1126<18>"AReplace this if-then-else statement by a single return statement.(®ÎÚÉ
2
java:S1116º"Remove this empty statement.(Ú°šY
=
java:S1172»"&Remove these unused method parameters.(¦Œœ¢
c java:S100ù"NRename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ý†®
C
java:S1172ù"-Remove this unused method parameter "dialog".(ý†®
p
java:S2293±"YReplace the type specification in this constructor call with the diamond operator ("<>").(艥ð
H
java:S1172ý"1Remove this unused method parameter "buttonView".(ãÜ›Ø
E
java:S1172° ".Remove this unused method parameter "oldMode".(ÍÇí<C387>
d java:S100Ê
"NRename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ÆÈ•™
d java:S100å
"NRename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'.(ÑÞÖ½
h
java:S3776 "RRefactor this method to reduce its Cognitive Complexity from 24 to the 15 allowed.(¢‰é[
p
java:S2293ë "YReplace the type specification in this constructor call with the diamond operator ("<>").(×¼‰í
2
java:S3626<18> "Remove this redundant jump.(ûÁÝ…
˜
java:S1186ú "€Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.(¦Œœ¢
7 java:S131• ""Add a default case to this switch.(ìúÇV
R java:S125Á"<This block of commented-out lines of code should be removed.(Ü—àâ
Q java:S125¦ "<This block of commented-out lines of code should be removed.(ë<>û
R java:S125¨ "<This block of commented-out lines of code should be removed.(¸¦”–
R java:S125« "<This block of commented-out lines of code should be removed.(Ž®ƒ÷
W java:S125­ "<This block of commented-out lines of code should be removed.(ŒÒ˜Ÿøÿÿÿÿ
W java:S125¯ "<This block of commented-out lines of code should be removed.(¼˜ßóûÿÿÿÿ
R java:S125£"<This block of commented-out lines of code should be removed.(—Ü<E28094>±
N
java:S1144"2Remove this unused private "createNewNote" method.(½Ë¾’úÿÿÿÿ
G
java:S1144å
"0Remove this unused private "Text_revoke" method.(ÑÞÖ½

@ -0,0 +1,14 @@
f
java:S1301v"KReplace this "switch" statement by "if" statements to increase readability.(ãÁð™øÿÿÿÿ
o
java:S22933"YReplace the type specification in this constructor call with the diamond operator ("<>").(§þ¢¾
M
java:S1135n"2Complete the task associated to this TODO comment.(ƒŠ® úÿÿÿÿ
< java:S131v""Add a default case to this switch.(ãÁð™øÿÿÿÿ
^
java:S1126ß"BReplace this if-then-else statement by a single method invocation.(‚å¿¥ûÿÿÿÿ
P
java:S2864"4Iterate over the "entrySet" instead of the "keySet".(ΚŸ<C5A1>ûÿÿÿÿ
B
java:S1172"+Remove this unused method parameter "item".(ãÅι

@ -0,0 +1,7 @@
9
README.md,8\e\8ec9a00bfd09b3190ac6b22251dbb1aa95a0579d
c
3src/main/java/net/micode/notes/ui/NoteEditText.java,f\e\fef8f2c22f47dd30d58ab667a0d7228194d7051f
g
7src/main/java/net/micode/notes/ui/NoteEditActivity.java,6\c\6c40630893054a28c13c2eb04ceb5fa51173b0b6

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -0,0 +1,9 @@
<?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$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,2 +1,2 @@
# xiaomi_notes_development # xiaomi_notes_development
这是一场没有硝烟的战争,一场胜利的战争🔥

Binary file not shown.

@ -6,6 +6,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /> <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<!--连接网络权限,用于执行云端语音能力 -->
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" /> <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
@ -14,9 +15,27 @@
<uses-permission android:name="android.permission.USE_CREDENTIALS" /> <uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!--获取手机录音机使用权限,听写、识别、语义理解需要用到此权限 -->
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<!--读取网络信息状态 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!--获取当前wifi状态 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<application <application
android:icon="@drawable/icon_app_write" android:icon="@drawable/icon_app_write"
android:label="@string/app_name"> android:label="@string/app_name">
<activity
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 <activity
android:name=".ui.NotesListActivity" android:name=".ui.NotesListActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
@ -26,15 +45,6 @@
android:uiOptions="splitActionBarWhenNarrow" android:uiOptions="splitActionBarWhenNarrow"
android:windowSoftInputMode="adjustPan"> android:windowSoftInputMode="adjustPan">
</activity> </activity>
<activity
android:name="notes.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 <activity
android:name=".ui.NoteEditActivity" android:name=".ui.NoteEditActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"

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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

@ -196,8 +196,9 @@ AUTHORITY + "/data");//定义查找数据的指针。
*passwored *passwored
* *
*/ */
public static final String PASSWORD = "set_password";//设置密码的什么东西啊? public static final String PASSWORD = "set_password";
public static final String TAG_PASSWORD = "set_tag"; public static final String TAG_PASSWORD = "set_tag";
public static final String TOP = "top";
}//这些常量主要是定义便签的属性的。 }//这些常量主要是定义便签的属性的。
// 定义DataColumns的常量,用于后面创建数据库的表头 // 定义DataColumns的常量,用于后面创建数据库的表头

@ -18,6 +18,7 @@ package net.micode.notes.data;
import android.content.ContentValues;//就是用于保存一些数据string boolean byte double float int long short ...)信息,这些信息可以被数据库操作时使用。 import android.content.ContentValues;//就是用于保存一些数据string boolean byte double float int long short ...)信息,这些信息可以被数据库操作时使用。
import android.content.Context;//加载和访问资源。android中主要是这两个功能但是这里具体不清楚 import android.content.Context;//加载和访问资源。android中主要是这两个功能但是这里具体不清楚
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;//主要提供了对应于添加、删除、更新、查询的操作方法: insert()、delete()、update()和query()。配合content.values import android.database.sqlite.SQLiteDatabase;//主要提供了对应于添加、删除、更新、查询的操作方法: insert()、delete()、update()和query()。配合content.values
import android.database.sqlite.SQLiteOpenHelper;//用来管理数据的创建和版本更新 import android.database.sqlite.SQLiteOpenHelper;//用来管理数据的创建和版本更新
import android.util.Log; import android.util.Log;
@ -62,7 +63,8 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," + NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," +
NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0," + NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.PASSWORD + " TEXT NOT NULL DEFAULT ''," + NoteColumns.PASSWORD + " TEXT NOT NULL DEFAULT ''," +
NoteColumns.TAG_PASSWORD + " TEXT NOT NULL DEFAULT ''" + NoteColumns.TAG_PASSWORD + " TEXT NOT NULL DEFAULT ''," +
NoteColumns.TOP + " INTEGER NOT NULL DEFAULT 0" +
")";//数据库中需要存储的项目的名称,就相当于创建一个表格的表头的内容。 ")";//数据库中需要存储的项目的名称,就相当于创建一个表格的表头的内容。
private static final String CREATE_DATA_TABLE_SQL = private static final String CREATE_DATA_TABLE_SQL =
@ -337,6 +339,11 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
oldVersion++; oldVersion++;
} }
if (oldVersion == 6){
upgradeToV7(db);
oldVersion++;
}
if (reCreateTriggers) { if (reCreateTriggers) {
reCreateNoteTableTriggers(db); reCreateNoteTableTriggers(db);
reCreateDataTableTriggers(db); reCreateDataTableTriggers(db);
@ -384,4 +391,30 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
db.execSQL("ALTER TABLE " + TABLE.NOTE + " ADD COLUMN " + NoteColumns.TAG_PASSWORD db.execSQL("ALTER TABLE " + TABLE.NOTE + " ADD COLUMN " + NoteColumns.TAG_PASSWORD
+ " INTEGER NOT NULL DEFAULT 0"); + " INTEGER NOT NULL DEFAULT 0");
} }
private void upgradeToV7(SQLiteDatabase db){
db.execSQL("ALTER TABLE " + TABLE.NOTE + " ADD COLUMN " + NoteColumns.TOP
+ " INTEGER NOT NULL DEFAULT 0");
}
public void dosearch(String querystring){//搜索时不区分大小写
Cursor cursor = null;
SQLiteDatabase db = mInstance.getReadableDatabase();
String query_sql_string = "select * from " + TABLE.DATA + " where content like " + "'%"+ querystring + "%'";
Log.i(TAG,query_sql_string);
cursor = db.rawQuery(query_sql_string,null);
if(cursor!=null)
{
while(cursor.moveToNext())
{
String content = cursor.getString(cursor.getColumnIndex("content"));
Log.i(TAG, content);
}
}
else{
cursor.close();
}
}
} }

@ -61,7 +61,7 @@ public class SqlNote {
NoteColumns.NOTES_COUNT, NoteColumns.PARENT_ID, NoteColumns.SNIPPET, NoteColumns.TYPE, NoteColumns.NOTES_COUNT, NoteColumns.PARENT_ID, NoteColumns.SNIPPET, NoteColumns.TYPE,
NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE, NoteColumns.SYNC_ID, NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE, NoteColumns.SYNC_ID,
NoteColumns.LOCAL_MODIFIED, NoteColumns.ORIGIN_PARENT_ID, NoteColumns.GTASK_ID, NoteColumns.LOCAL_MODIFIED, NoteColumns.ORIGIN_PARENT_ID, NoteColumns.GTASK_ID,
NoteColumns.VERSION NoteColumns.VERSION,NoteColumns.TOP
}; };
//以下设置17个列的编号 //以下设置17个列的编号
@ -99,6 +99,8 @@ public class SqlNote {
public static final int VERSION_COLUMN = 16; public static final int VERSION_COLUMN = 16;
public static final int Top_COLUMN = 17;
//一下定义了17个内部的变量其中12个可以由content中获得5个需要初始化为0或者new //一下定义了17个内部的变量其中12个可以由content中获得5个需要初始化为0或者new
private Context mContext; private Context mContext;
@ -135,6 +137,7 @@ public class SqlNote {
private ContentValues mDiffNoteValues; private ContentValues mDiffNoteValues;
private ArrayList<SqlData> mDataList; private ArrayList<SqlData> mDataList;
private String mTop;
/* /*
* *
@ -149,6 +152,7 @@ public class SqlNote {
mIsCreate = true; mIsCreate = true;
mId = INVALID_ID; mId = INVALID_ID;
mAlertDate = 0; mAlertDate = 0;
mTop = getmTop();
mBgColorId = ResourceParser.getDefaultBgId(context); mBgColorId = ResourceParser.getDefaultBgId(context);
mCreatedDate = System.currentTimeMillis();//调用系统函数获得创建时间 mCreatedDate = System.currentTimeMillis();//调用系统函数获得创建时间
mHasAttachment = 0; mHasAttachment = 0;
@ -176,6 +180,7 @@ public class SqlNote {
mContext = context; mContext = context;
mContentResolver = context.getContentResolver(); mContentResolver = context.getContentResolver();
mIsCreate = false; mIsCreate = false;
mTop = getmTop();
loadFromCursor(c); loadFromCursor(c);
mDataList = new ArrayList<SqlData>(); mDataList = new ArrayList<SqlData>();
// //
@ -195,6 +200,7 @@ public class SqlNote {
mContext = context; mContext = context;
mContentResolver = context.getContentResolver(); mContentResolver = context.getContentResolver();
mIsCreate = false; mIsCreate = false;
mTop = getmTop();
loadFromCursor(id); loadFromCursor(id);
mDataList = new ArrayList<SqlData>(); mDataList = new ArrayList<SqlData>();
if (mType == Notes.TYPE_NOTE) if (mType == Notes.TYPE_NOTE)
@ -245,6 +251,7 @@ public class SqlNote {
mWidgetId = c.getInt(WIDGET_ID_COLUMN); mWidgetId = c.getInt(WIDGET_ID_COLUMN);
mWidgetType = c.getInt(WIDGET_TYPE_COLUMN); mWidgetType = c.getInt(WIDGET_TYPE_COLUMN);
mVersion = c.getLong(VERSION_COLUMN); mVersion = c.getLong(VERSION_COLUMN);
mTop = c.getString(Top_COLUMN);
} }
/* /*
@ -608,4 +615,7 @@ public class SqlNote {
mDiffNoteValues.clear(); mDiffNoteValues.clear();
mIsCreate = false; mIsCreate = false;
} }
public String getmTop(){
return mTop;
}
} }

@ -183,15 +183,15 @@ public class Task extends Node {
} }
} }
public void setContentByLocalJSON(JSONObject js) { //<2F><>metadata<74><61><EFBFBD><EFBFBD>ʵʩ public void setContentByLocalJSON(JSONObject js) {//method data here!
if (js == null || !js.has(GTaskStringUtils.META_HEAD_NOTE) if (js == null || !js.has(GTaskStringUtils.META_HEAD_NOTE)
|| !js.has(GTaskStringUtils.META_HEAD_DATA)) { || !js.has(GTaskStringUtils.META_HEAD_DATA)) {
Log.w(TAG, "setContentByLocalJSON: nothing is avaiable"); Log.w(TAG, "setContentByLocalJSON: nothing is avaiable");
} }
try { try {
JSONObject note = js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE); JSONObject note = (js!=null)?js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE):new JSONObject();
JSONArray dataArray = js.getJSONArray(GTaskStringUtils.META_HEAD_DATA); JSONArray dataArray = (js!=null)?js.getJSONArray(GTaskStringUtils.META_HEAD_DATA):new JSONArray();
if (note.getInt(NoteColumns.TYPE) != Notes.TYPE_NOTE) { if (note.getInt(NoteColumns.TYPE) != Notes.TYPE_NOTE) {
Log.e(TAG, "invalid type"); Log.e(TAG, "invalid type");

@ -147,7 +147,7 @@ public class TaskList extends Node {
} }
try { try {
JSONObject folder = js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE); JSONObject folder = (js!=null)?js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE):new JSONObject();
if (folder.getInt(NoteColumns.TYPE) == Notes.TYPE_FOLDER) { if (folder.getInt(NoteColumns.TYPE) == Notes.TYPE_FOLDER) {
String name = folder.getString(NoteColumns.SNIPPET); String name = folder.getString(NoteColumns.SNIPPET);
@ -212,13 +212,7 @@ public class TaskList extends Node {
Log.e(TAG, "gtask id doesn't match"); Log.e(TAG, "gtask id doesn't match");
return SYNC_ACTION_ERROR; return SYNC_ACTION_ERROR;
} }
if (c.getLong(SqlNote.SYNC_ID_COLUMN) == getLastModified()) { return SYNC_ACTION_UPDATE_REMOTE;
// local modification only
return SYNC_ACTION_UPDATE_REMOTE;
} else {
// for folder conflicts, just apply local modification
return SYNC_ACTION_UPDATE_REMOTE;
}
} }
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, e.toString()); Log.e(TAG, e.toString());

@ -27,7 +27,6 @@ import android.os.AsyncTask;
import net.micode.notes.R; import net.micode.notes.R;
import net.micode.notes.ui.NotesListActivity; import net.micode.notes.ui.NotesListActivity;
import net.micode.notes.ui.NotesPreferenceActivity; import net.micode.notes.ui.NotesPreferenceActivity;
import net.micode.notes.ui.NotesListActivity;
/*GTask /*GTask
* *

@ -126,7 +126,7 @@ public class GTaskClient {
// we suppose that the cookie would expire after 5 minutes // we suppose that the cookie would expire after 5 minutes
// then we need to re-login // then we need to re-login
//判断距离最后一次登录操作是否超过5分钟 //判断距离最后一次登录操作是否超过5分钟
final long interval = 1000 * 60 * 5; final long interval = 1000 * 60 * 5L;
if (mLastLoginTime + interval < System.currentTimeMillis()) { if (mLastLoginTime + interval < System.currentTimeMillis()) {
mLoggedin = false; mLoggedin = false;
} }

@ -38,11 +38,13 @@ public class WorkingNote {
// Note Id // Note Id
private long mNoteId; private long mNoteId;
// Note content // Note content
private String mContent; public String mContent;
// Note mode // Note mode
private String mPassword = ""; private String mPassword = "";
private String mTag = ""; private String mTag = "";
//note password,initial = 0 //note password,initial = 0
//TOP
private String mTop = "";
private int mMode; private int mMode;
private long mAlertDate; private long mAlertDate;
@ -85,7 +87,8 @@ public class WorkingNote {
NoteColumns.WIDGET_TYPE, NoteColumns.WIDGET_TYPE,
NoteColumns.MODIFIED_DATE, NoteColumns.MODIFIED_DATE,
NoteColumns.PASSWORD, NoteColumns.PASSWORD,
NoteColumns.TAG_PASSWORD NoteColumns.TAG_PASSWORD,
NoteColumns.TOP
}; };
private static final int DATA_ID_COLUMN = 0; private static final int DATA_ID_COLUMN = 0;
@ -112,6 +115,8 @@ public class WorkingNote {
private static final int NOTE_TAG_PASSWORD_COLUMN = 7; private static final int NOTE_TAG_PASSWORD_COLUMN = 7;
private static final int NOTE_TOP_COLUMN = 8;
// New note construct // New note construct
public WorkingNote(Context context, long folderId) { public WorkingNote(Context context, long folderId) {
mContext = context; mContext = context;
@ -123,6 +128,7 @@ public class WorkingNote {
mIsDeleted = false; mIsDeleted = false;
mMode = 0; mMode = 0;
mWidgetType = Notes.TYPE_WIDGET_INVALIDE; mWidgetType = Notes.TYPE_WIDGET_INVALIDE;
mTop = String.valueOf(getTopId());
} }
// WorkingNote的构造函数 // WorkingNote的构造函数
@ -154,6 +160,7 @@ public class WorkingNote {
mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN); mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN);
mPassword = cursor.getString(NOTE_PASSWORD_COLUMN); mPassword = cursor.getString(NOTE_PASSWORD_COLUMN);
mTag = cursor.getString(NOTE_TAG_PASSWORD_COLUMN); mTag = cursor.getString(NOTE_TAG_PASSWORD_COLUMN);
mTop = cursor.getString(NOTE_TOP_COLUMN);
} }
cursor.close(); cursor.close();
// 若不存在,报错 // 若不存在,报错
@ -214,7 +221,7 @@ public class WorkingNote {
public synchronized boolean saveNote() { public synchronized boolean saveNote() {
if (isWorthSaving()) { //是否值得保存 if (isWorthSaving()) { //是否值得保存
if (!existInDatabase()) { // 是否存在数据库中 if (!existInDatabase()) { // 是否存在数据库中
if ((mNoteId = Note.getNewNoteId(mContext, mFolderId)) == 0) { if ((mNoteId = net.micode.notes.model.Note.getNewNoteId(mContext, mFolderId)) == 0) {
Log.e(TAG, "Create new note fail with id:" + mNoteId); Log.e(TAG, "Create new note fail with id:" + mNoteId);
return false; return false;
} }
@ -441,4 +448,19 @@ public class WorkingNote {
mNote.setNoteValue(NoteColumns.TAG_PASSWORD,String.valueOf(mTag)); mNote.setNoteValue(NoteColumns.TAG_PASSWORD,String.valueOf(mTag));
} }
public void setTop(String Top){
if (Top.equals(mTop)){
mTop = Top;
mNote.setNoteValue(NoteColumns.TOP,String.valueOf(mTop));
}
}
public int getTopId(){
if (mTop.equals("1")){
return 1;
}else {
return 0;
}
}
} }

@ -0,0 +1,37 @@
package net.micode.notes.speech.setting;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;
import android.view.Window;
import net.micode.notes.speech.util.SettingTextWatcher;
/**
*
*/
public class IatSettings extends PreferenceActivity implements OnPreferenceChangeListener {
public static final String PREFER_NAME = "com.iflytek.setting";
private EditTextPreference mVadbosPreference;
private EditTextPreference mVadeosPreference;
@SuppressWarnings("deprecation")
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
getPreferenceManager().setSharedPreferencesName(PREFER_NAME);
mVadbosPreference = (EditTextPreference) findPreference("iat_vadbos_preference");
mVadbosPreference.getEditText().addTextChangedListener(new SettingTextWatcher(IatSettings.this, mVadbosPreference, 0, 10000));
mVadeosPreference = (EditTextPreference) findPreference("iat_vadeos_preference");
mVadeosPreference.getEditText().addTextChangedListener(new SettingTextWatcher(IatSettings.this, mVadeosPreference, 0, 10000));
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
return true;
}
}

@ -0,0 +1,173 @@
package net.micode.notes.speech.util;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
/**
* Json
*/
public class JsonParser {
public static String parseIatResult(String json) {
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
JSONArray words = joResult.getJSONArray("ws");
for (int i = 0; i < words.length(); i++) {
// 转写结果词,默认使用第一个结果
JSONArray items = words.getJSONObject(i).getJSONArray("cw");
JSONObject obj = items.getJSONObject(0);
ret.append(obj.getString("w"));
// 如果需要多候选结果,解析数组其他字段
// for(int j = 0; j < items.length(); j++)
// {
// JSONObject obj = items.getJSONObject(j);
// ret.append(obj.getString("w"));
// }
}
} catch (Exception e) {
e.printStackTrace();
}
return ret.toString();
}
public static String parseGrammarResult(String json, String engType) {
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
JSONArray words = joResult.getJSONArray("ws");
// 云端和本地结果分情况解析
if ("cloud".equals(engType)) {
for (int i = 0; i < words.length(); i++) {
JSONArray items = words.getJSONObject(i).getJSONArray("cw");
for (int j = 0; j < items.length(); j++) {
JSONObject obj = items.getJSONObject(j);
if (obj.getString("w").contains("nomatch")) {
ret.append("没有匹配结果.");
return ret.toString();
}
ret.append("【结果】" + obj.getString("w"));
ret.append("【置信度】" + obj.getInt("sc"));
ret.append("\n");
}
}
} else if ("local".equals(engType)) {
ret.append("【结果】");
for (int i = 0; i < words.length(); i++) {
JSONObject wsItem = words.getJSONObject(i);
JSONArray items = wsItem.getJSONArray("cw");
if ("<contact>".equals(wsItem.getString("slot"))) {
// 可能会有多个联系人供选择,用中括号括起来,这些候选项具有相同的置信度
ret.append("【");
for (int j = 0; j < items.length(); j++) {
JSONObject obj = items.getJSONObject(j);
if (obj.getString("w").contains("nomatch")) {
ret.append("没有匹配结果.");
return ret.toString();
}
ret.append(obj.getString("w")).append("|");
}
ret.setCharAt(ret.length() - 1, '】');
} else {
//本地多候选按照置信度高低排序,一般选取第一个结果即可
JSONObject obj = items.getJSONObject(0);
if (obj.getString("w").contains("nomatch")) {
ret.append("没有匹配结果.");
return ret.toString();
}
ret.append(obj.getString("w"));
}
}
ret.append("【置信度】" + joResult.getInt("sc"));
ret.append("\n");
}
} catch (Exception e) {
e.printStackTrace();
ret.append("没有匹配结果.");
}
return ret.toString();
}
public static String parseGrammarResult(String json) {
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
JSONArray words = joResult.getJSONArray("ws");
for (int i = 0; i < words.length(); i++) {
JSONArray items = words.getJSONObject(i).getJSONArray("cw");
for (int j = 0; j < items.length(); j++) {
JSONObject obj = items.getJSONObject(j);
if (obj.getString("w").contains("nomatch")) {
ret.append("没有匹配结果.");
return ret.toString();
}
ret.append("【结果】" + obj.getString("w"));
ret.append("【置信度】" + obj.getInt("sc"));
ret.append("\n");
}
}
} catch (Exception e) {
e.printStackTrace();
ret.append("没有匹配结果.");
}
return ret.toString();
}
public static String parseLocalGrammarResult(String json) {
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
JSONArray words = joResult.getJSONArray("ws");
for (int i = 0; i < words.length(); i++) {
JSONArray items = words.getJSONObject(i).getJSONArray("cw");
for (int j = 0; j < items.length(); j++) {
JSONObject obj = items.getJSONObject(j);
if (obj.getString("w").contains("nomatch")) {
ret.append("没有匹配结果.");
return ret.toString();
}
ret.append("【结果】" + obj.getString("w"));
ret.append("\n");
}
}
ret.append("【置信度】" + joResult.optInt("sc"));
} catch (Exception e) {
e.printStackTrace();
ret.append("没有匹配结果.");
}
return ret.toString();
}
public static String parseTransResult(String json, String key) {
StringBuffer ret = new StringBuffer();
try {
JSONTokener tokener = new JSONTokener(json);
JSONObject joResult = new JSONObject(tokener);
String errorCode = joResult.optString("ret");
if (!errorCode.equals("0")) {
return joResult.optString("errmsg");
}
JSONObject transResult = joResult.optJSONObject("trans_result");
ret.append(transResult.optString(key));
/*JSONArray words = joResult.getJSONArray("results");
for (int i = 0; i < words.length(); i++) {
JSONObject obj = words.getJSONObject(i);
ret.append(obj.getString(key));
}*/
} catch (Exception e) {
e.printStackTrace();
}
return ret.toString();
}
}

@ -0,0 +1,71 @@
package net.micode.notes.speech.util;
import android.content.Context;
import android.preference.EditTextPreference;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.widget.Toast;
import java.util.regex.Pattern;
/**
*
*/
public class SettingTextWatcher implements TextWatcher {
private int editStart;
private int editCount;
private EditTextPreference mEditTextPreference;
int minValue;//最小值
int maxValue;//最大值
private Context mContext;
public SettingTextWatcher(Context context, EditTextPreference e, int min, int max) {
mContext = context;
mEditTextPreference = e;
minValue = min;
maxValue = max;
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// Log.e("demo", "onTextChanged start:"+start+" count:"+count+" before:"+before);
editStart = start;
editCount = count;
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// Log.e("demo", "beforeTextChanged start:"+start+" count:"+count+" after:"+after);
}
@Override
public void afterTextChanged(Editable s) {
if (TextUtils.isEmpty(s)) {
return;
}
String content = s.toString();
// Log.e("demo", "content:"+content);
if (isNumeric(content)) {
int num = Integer.parseInt(content);
if (num > maxValue || num < minValue) {
s.delete(editStart, editStart + editCount);
mEditTextPreference.getEditText().setText(s);
Toast.makeText(mContext, "超出有效值范围", Toast.LENGTH_SHORT).show();
}
} else {
s.delete(editStart, editStart + editCount);
mEditTextPreference.getEditText().setText(s);
Toast.makeText(mContext, "只能输入数字哦", Toast.LENGTH_SHORT).show();
}
}
/**
* -
*/
public static boolean isNumeric(String str) {
Pattern pattern = Pattern.compile("[0-9]*");
return pattern.matcher(str).matches();
}
};

@ -305,7 +305,8 @@ public class BackupUtils {
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;
} catch (NullPointerException e) { }
catch (NullPointerException e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;
} }

@ -45,7 +45,6 @@ public class ResourceParser {
public static final int WHITE = 2; public static final int WHITE = 2;
public static final int GREEN = 3; public static final int GREEN = 3;
public static final int RED = 4; public static final int RED = 4;
public static final int pic_one = 5;
public static final int BG_DEFAULT_COLOR = YELLOW; public static final int BG_DEFAULT_COLOR = YELLOW;
@ -55,8 +54,6 @@ public class ResourceParser {
public static final int TEXT_SUPER = 3; public static final int TEXT_SUPER = 3;
public static final int BG_DEFAULT_FONT_SIZE = TEXT_MEDIUM; public static final int BG_DEFAULT_FONT_SIZE = TEXT_MEDIUM;
//public static Integer picture_1;
public static class NoteBgResources { public static class NoteBgResources {
private final static int [] BG_EDIT_RESOURCES = new int [] { private final static int [] BG_EDIT_RESOURCES = new int [] {
@ -64,8 +61,7 @@ public class ResourceParser {
R.drawable.edit_blue, R.drawable.edit_blue,
R.drawable.edit_white, R.drawable.edit_white,
R.drawable.edit_green, R.drawable.edit_green,
R.drawable.edit_red, R.drawable.edit_red
R.drawable.pic_one
}; };
private final static int [] BG_EDIT_TITLE_RESOURCES = new int [] { private final static int [] BG_EDIT_TITLE_RESOURCES = new int [] {
@ -73,8 +69,7 @@ public class ResourceParser {
R.drawable.edit_title_blue, R.drawable.edit_title_blue,
R.drawable.edit_title_white, R.drawable.edit_title_white,
R.drawable.edit_title_green, R.drawable.edit_title_green,
R.drawable.edit_title_red, R.drawable.edit_title_red
R.drawable.pic_one
}; };
public static int getNoteBgResource(int id) { public static int getNoteBgResource(int id) {
@ -101,8 +96,7 @@ public class ResourceParser {
R.drawable.list_blue_up, R.drawable.list_blue_up,
R.drawable.list_white_up, R.drawable.list_white_up,
R.drawable.list_green_up, R.drawable.list_green_up,
R.drawable.list_red_up, R.drawable.list_red_up
R.drawable.pic_one
}; };
private final static int [] BG_NORMAL_RESOURCES = new int [] { private final static int [] BG_NORMAL_RESOURCES = new int [] {
@ -110,8 +104,7 @@ public class ResourceParser {
R.drawable.list_blue_middle, R.drawable.list_blue_middle,
R.drawable.list_white_middle, R.drawable.list_white_middle,
R.drawable.list_green_middle, R.drawable.list_green_middle,
R.drawable.list_red_middle, R.drawable.list_red_middle
R.drawable.pic_one
}; };
private final static int [] BG_LAST_RESOURCES = new int [] { private final static int [] BG_LAST_RESOURCES = new int [] {
@ -120,7 +113,6 @@ public class ResourceParser {
R.drawable.list_white_down, R.drawable.list_white_down,
R.drawable.list_green_down, R.drawable.list_green_down,
R.drawable.list_red_down, R.drawable.list_red_down,
R.drawable.pic_one
}; };
private final static int [] BG_SINGLE_RESOURCES = new int [] { private final static int [] BG_SINGLE_RESOURCES = new int [] {
@ -128,8 +120,7 @@ public class ResourceParser {
R.drawable.list_blue_single, R.drawable.list_blue_single,
R.drawable.list_white_single, R.drawable.list_white_single,
R.drawable.list_green_single, R.drawable.list_green_single,
R.drawable.list_red_single, R.drawable.list_red_single
R.drawable.pic_one
}; };
public static int getNoteBgFirstRes(int id) { public static int getNoteBgFirstRes(int id) {

@ -39,8 +39,6 @@ import net.micode.notes.tool.DataUtils;
import java.io.IOException; import java.io.IOException;
import net.micode.notes.ui.NoteEditActivity;
public class AlarmAlertActivity extends Activity implements OnClickListener, OnDismissListener { public class AlarmAlertActivity extends Activity implements OnClickListener, OnDismissListener {
private long mNoteId; //文本在数据库存储中的ID号 private long mNoteId; //文本在数据库存储中的ID号

@ -1,71 +0,0 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.ui;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns;
public class AlarmInitReceiver extends BroadcastReceiver {
private static final String [] PROJECTION = new String [] {
NoteColumns.ID,
NoteColumns.ALERTED_DATE
};
//对数据库的操作调用标签ID和闹钟时间
private static final int COLUMN_ID = 0;
private static final int COLUMN_ALERTED_DATE = 1;
@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 {
long alertDate = c.getLong(COLUMN_ALERTED_DATE);
Intent sender = new Intent(context, AlarmReceiver.class);
sender.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, c.getLong(COLUMN_ID)));
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, sender, 0);
AlarmManager alermManager = (AlarmManager) context
.getSystemService(Context.ALARM_SERVICE);
alermManager.set(AlarmManager.RTC_WAKEUP, alertDate, pendingIntent);
} while (c.moveToNext());
}
c.close();
}
//然而通过网上查找资料发现,对于闹钟机制的启动,通常需要上面的几个步骤
//如新建Intent、PendingIntent以及AlarmManager等
//这里就是根据数据库里的闹钟时间创建一个闹钟机制
}
}

@ -1,36 +0,0 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.ui;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class AlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
intent.setClass(context, AlarmAlertActivity.class);
//启动AlarmAlertActivity
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//activity要存在于activity的栈中而非activity的途径启动activity时必然不存在一个activity的栈
//所以要新起一个栈装入启动的activity
context.startActivity(intent);
}
}
//这是实现alarm这个功能最接近用户层的包基于上面的两个包
//作用还需要深究但是对于setClass和addFlags的

@ -1,507 +0,0 @@
/*
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.micode.notes.ui;
import java.text.DateFormatSymbols;
import java.util.Calendar;
import net.micode.notes.R;
import android.content.Context;
import android.text.format.DateFormat;
import android.view.View;
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;
private static final int HOURS_IN_ALL_DAY = 24;
private static final int DAYS_IN_ALL_WEEK = 7;
private static final int DATE_SPINNER_MIN_VAL = 0;
private static final int DATE_SPINNER_MAX_VAL = DAYS_IN_ALL_WEEK - 1;
private static final int HOUR_SPINNER_MIN_VAL_24_HOUR_VIEW = 0;
private static final int HOUR_SPINNER_MAX_VAL_24_HOUR_VIEW = 23;
private static final int HOUR_SPINNER_MIN_VAL_12_HOUR_VIEW = 1;
private static final int HOUR_SPINNER_MAX_VAL_12_HOUR_VIEW = 12;
private static final int MINUT_SPINNER_MIN_VAL = 0;
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;
private boolean mIs24HourView;
private boolean mIsEnabled = DEFAULT_ENABLE_STATE;
private boolean mInitialising;
private OnDateTimeChangedListener mOnDateTimeChangedListener;
private NumberPicker.OnValueChangeListener mOnDateChangedListener = new NumberPicker.OnValueChangeListener() {
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
mDate.add(Calendar.DAY_OF_YEAR, newVal - oldVal);
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点交替时对日期的更改
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));
setCurrentMonth(cal.get(Calendar.MONTH));
setCurrentDay(cal.get(Calendar.DAY_OF_MONTH));
}
}
};
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();
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());
updateDateControl();
int newHour = getCurrentHourOfDay();
if (newHour >= HOURS_IN_HALF_DAY) {
mIsAm = false;
updateAmPmControl();
} else {
mIsAm = true;
updateAmPmControl();
}
}
mDate.set(Calendar.MINUTE, newVal);
onDateTimeChanged();
}
};
private NumberPicker.OnValueChangeListener mOnAmPmChangedListener = new NumberPicker.OnValueChangeListener() {
//对AM和PM的监听
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
mIsAm = !mIsAm;
if (mIsAm) {
mDate.add(Calendar.HOUR_OF_DAY, -HOURS_IN_HALF_DAY);
} else {
mDate.add(Calendar.HOUR_OF_DAY, HOURS_IN_HALF_DAY);
}
updateAmPmControl();
onDateTimeChanged();
}
};
public interface OnDateTimeChangedListener {
void onDateTimeChanged(DateTimePicker view, int year, int month,
int dayOfMonth, int hourOfDay, int minute);
}
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);
//如果当前Activity里用到别的layout比如对话框layout
//还要设置这个layout上的其他组件的内容就必须用inflate()方法先将对话框的layout找出来
//然后再用findViewById()找到它上面的其它组件
mDateSpinner = (NumberPicker) findViewById(R.id.date);
mDateSpinner.setMinValue(DATE_SPINNER_MIN_VAL);
mDateSpinner.setMaxValue(DATE_SPINNER_MAX_VAL);
mDateSpinner.setOnValueChangedListener(mOnDateChangedListener);
mHourSpinner = (NumberPicker) findViewById(R.id.hour);
mHourSpinner.setOnValueChangedListener(mOnHourChangedListener);
mMinuteSpinner = (NumberPicker) findViewById(R.id.minute);
mMinuteSpinner.setMinValue(MINUT_SPINNER_MIN_VAL);
mMinuteSpinner.setMaxValue(MINUT_SPINNER_MAX_VAL);
mMinuteSpinner.setOnLongPressUpdateInterval(100);
mMinuteSpinner.setOnValueChangedListener(mOnMinuteChangedListener);
String[] stringsForAmPm = new DateFormatSymbols().getAmPmStrings();
mAmPmSpinner = (NumberPicker) findViewById(R.id.amPm);
mAmPmSpinner.setMinValue(AMPM_SPINNER_MIN_VAL);
mAmPmSpinner.setMaxValue(AMPM_SPINNER_MAX_VAL);
mAmPmSpinner.setDisplayedValues(stringsForAmPm);
mAmPmSpinner.setOnValueChangedListener(mOnAmPmChangedListener);
// update controls to initial state
updateDateControl();
updateHourControl();
updateAmPmControl();
set24HourView(is24HourView);
// set to current time
setCurrentDate(date);
setEnabled(isEnabled());
// set the content descriptions
mInitialising = false;
}
@Override
public void setEnabled(boolean enabled) {
if (mIsEnabled == enabled) {
return;
}
super.setEnabled(enabled);
mDateSpinner.setEnabled(enabled);
mMinuteSpinner.setEnabled(enabled);
mHourSpinner.setEnabled(enabled);
mAmPmSpinner.setEnabled(enabled);
mIsEnabled = enabled;
}
//存在疑问setEnabled的作用
//下面的代码通过原程序的注释已经比较清晰,另外可以通过函数名来判断
//下面的各函数主要是对上面代码引用到的各函数功能的实现
@Override
public boolean isEnabled() {
return mIsEnabled;
}
/**
* Get the current date in millis
*
* @return the current date in millis
*/
public long getCurrentDateInTimeMillis() {
return mDate.getTimeInMillis();
}//实现函数——得到当前的秒数
/**
* Set the current date
*
* @param date The current date in millis
*/
public void setCurrentDate(long date) {
Calendar cal = Calendar.getInstance();
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
*
* @param year The current year
* @param month The current month
* @param dayOfMonth The current dayOfMonth
* @param hourOfDay The current hourOfDay
* @param minute The current minute
*/
public void setCurrentDate(int year, int month,
int dayOfMonth, int hourOfDay, int minute) {
setCurrentYear(year);
setCurrentMonth(month);
setCurrentDay(dayOfMonth);
setCurrentHour(hourOfDay);
setCurrentMinute(minute);
}//实现函数功能——设置当前的时间,参数是各详细的变量
/**
* Get current year
*
* @return The current year
*/
//下面是得到year、month、day等值
public int getCurrentYear() {
return mDate.get(Calendar.YEAR);
}
/**
* Set current year
*
* @param year The current year
*/
public void setCurrentYear(int year) {
if (!mInitialising && year == getCurrentYear()) {
return;
}
mDate.set(Calendar.YEAR, year);
updateDateControl();
onDateTimeChanged();
}
/**
* Get current month in the year
*
* @return The current month in the year
*/
public int getCurrentMonth() {
return mDate.get(Calendar.MONTH);
}
/**
* Set current month in the year
*
* @param month The month in the year
*/
public void setCurrentMonth(int month) {
if (!mInitialising && month == getCurrentMonth()) {
return;
}
mDate.set(Calendar.MONTH, month);
updateDateControl();
onDateTimeChanged();
}
/**
* Get current day of the month
*
* @return The day of the month
*/
public int getCurrentDay() {
return mDate.get(Calendar.DAY_OF_MONTH);
}
/**
* Set current day of the month
*
* @param dayOfMonth The day of the month
*/
public void setCurrentDay(int dayOfMonth) {
if (!mInitialising && dayOfMonth == getCurrentDay()) {
return;
}
mDate.set(Calendar.DAY_OF_MONTH, dayOfMonth);
updateDateControl();
onDateTimeChanged();
}
/**
* Get current hour in 24 hour mode, in the range (0~23)
* @return The current hour in 24 hour mode
*/
public int getCurrentHourOfDay() {
return mDate.get(Calendar.HOUR_OF_DAY);
}
private int getCurrentHour() {
if (mIs24HourView){
return getCurrentHourOfDay();
} else {
int hour = getCurrentHourOfDay();
if (hour > HOURS_IN_HALF_DAY) {
return hour - HOURS_IN_HALF_DAY;
} else {
return hour == 0 ? HOURS_IN_HALF_DAY : hour;
}
}
}
/**
* Set current hour in 24 hour mode, in the range (0~23)
*
* @param hourOfDay
*/
public void setCurrentHour(int hourOfDay) {
if (!mInitialising && hourOfDay == getCurrentHourOfDay()) {
return;
}
mDate.set(Calendar.HOUR_OF_DAY, hourOfDay);
if (!mIs24HourView) {
if (hourOfDay >= HOURS_IN_HALF_DAY) {
mIsAm = false;
if (hourOfDay > HOURS_IN_HALF_DAY) {
hourOfDay -= HOURS_IN_HALF_DAY;
}
} else {
mIsAm = true;
if (hourOfDay == 0) {
hourOfDay = HOURS_IN_HALF_DAY;
}
}
updateAmPmControl();
}
mHourSpinner.setValue(hourOfDay);
onDateTimeChanged();
}
/**
* Get currentMinute
*
* @return The Current Minute
*/
public int getCurrentMinute() {
return mDate.get(Calendar.MINUTE);
}
/**
* Set current minute
*/
public void setCurrentMinute(int minute) {
if (!mInitialising && minute == getCurrentMinute()) {
return;
}
mMinuteSpinner.setValue(minute);
mDate.set(Calendar.MINUTE, minute);
onDateTimeChanged();
}
/**
* @return true if this is in 24 hour view else false.
*/
public boolean is24HourView () {
return mIs24HourView;
}
/**
* Set whether in 24 hour or AM/PM mode.
*
* @param is24HourView True for 24 hour mode. False for AM/PM mode.
*/
public void set24HourView(boolean is24HourView) {
if (mIs24HourView == is24HourView) {
return;
}
mIs24HourView = is24HourView;
mAmPmSpinner.setVisibility(is24HourView ? View.GONE : View.VISIBLE);
int hour = getCurrentHourOfDay();
updateHourControl();
setCurrentHour(hour);
updateAmPmControl();
}
private void updateDateControl() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(mDate.getTimeInMillis());
cal.add(Calendar.DAY_OF_YEAR, -DAYS_IN_ALL_WEEK / 2 - 1);
mDateSpinner.setDisplayedValues(null);
for (int i = 0; i < DAYS_IN_ALL_WEEK; ++i) {
cal.add(Calendar.DAY_OF_YEAR, 1);
mDateDisplayValues[i] = (String) DateFormat.format("MM.dd EEEE", cal);
}
mDateSpinner.setDisplayedValues(mDateDisplayValues);
mDateSpinner.setValue(DAYS_IN_ALL_WEEK / 2);
mDateSpinner.invalidate();
}// 对于星期几的算法
private void updateAmPmControl() {
if (mIs24HourView) {
mAmPmSpinner.setVisibility(View.GONE);
} else {
int index = mIsAm ? Calendar.AM : Calendar.PM;
mAmPmSpinner.setValue(index);
mAmPmSpinner.setVisibility(View.VISIBLE);
}// 对于上下午操作的算法
}
private void updateHourControl() {
if (mIs24HourView) {
mHourSpinner.setMinValue(HOUR_SPINNER_MIN_VAL_24_HOUR_VIEW);
mHourSpinner.setMaxValue(HOUR_SPINNER_MAX_VAL_24_HOUR_VIEW);
} else {
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.
* @param callback the callback, if null will do nothing
*/
public void setOnDateTimeChangedListener(OnDateTimeChangedListener callback) {
mOnDateTimeChangedListener = callback;
}
private void onDateTimeChanged() {
if (mOnDateTimeChangedListener != null) {
mOnDateTimeChangedListener.onDateTimeChanged(this, getCurrentYear(),
getCurrentMonth(), getCurrentDay(), getCurrentHourOfDay(), getCurrentMinute());
}
}
}

@ -89,7 +89,7 @@ public class DateTimePickerDialog extends AlertDialog implements OnClickListener
DateUtils.FORMAT_SHOW_YEAR | DateUtils.FORMAT_SHOW_YEAR |
DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_DATE |
DateUtils.FORMAT_SHOW_TIME; DateUtils.FORMAT_SHOW_TIME;
flag |= mIs24HourView ? DateUtils.FORMAT_24HOUR : DateUtils.FORMAT_24HOUR; flag |= DateUtils.FORMAT_24HOUR;
setTitle(DateUtils.formatDateTime(this.getContext(), date, flag)); setTitle(DateUtils.formatDateTime(this.getContext(), date, flag));
}//android开发中常见日期管理工具类API——DateUtils按照上下午显示时间 }//android开发中常见日期管理工具类API——DateUtils按照上下午显示时间

@ -15,22 +15,38 @@
*/ */
package net.micode.notes.ui; package net.micode.notes.ui;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlarmManager; import android.app.AlarmManager;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.SearchManager; import android.app.SearchManager;
import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetManager;
import android.content.ContentResolver;
import android.content.ContentUris; import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity; import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
import android.text.Editable; import android.text.Editable;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
@ -38,6 +54,7 @@ import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.text.style.BackgroundColorSpan; import android.text.style.BackgroundColorSpan;
import android.text.style.ImageSpan;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@ -52,35 +69,56 @@ import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import com.iflytek.cloud.ErrorCode;
import com.iflytek.cloud.InitListener;
import com.iflytek.cloud.RecognizerListener;
import com.iflytek.cloud.RecognizerResult;
import com.iflytek.cloud.SpeechConstant;
import com.iflytek.cloud.SpeechError;
import com.iflytek.cloud.SpeechEvent;
import com.iflytek.cloud.SpeechRecognizer;
import com.iflytek.cloud.SpeechUtility;
import com.iflytek.cloud.ui.RecognizerDialog;
import com.iflytek.cloud.ui.RecognizerDialogListener;
import com.iflytek.cloud.util.ResourceUtil;
import net.micode.notes.R; import net.micode.notes.R;
import net.micode.notes.data.Notes; import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.TextNote; import net.micode.notes.data.Notes.TextNote;
import net.micode.notes.data.NotesDatabaseHelper;
import net.micode.notes.model.WorkingNote; import net.micode.notes.model.WorkingNote;
import net.micode.notes.model.WorkingNote.NoteSettingChangedListener; import net.micode.notes.model.WorkingNote.NoteSettingChangedListener;
import net.micode.notes.speech.util.JsonParser;
import net.micode.notes.tool.DataUtils; import net.micode.notes.tool.DataUtils;
import net.micode.notes.tool.ResourceParser; import net.micode.notes.tool.ResourceParser;
import net.micode.notes.tool.ResourceParser.TextAppearanceResources; import net.micode.notes.tool.ResourceParser.TextAppearanceResources;
import net.micode.notes.ui.AlarmReceiver;
import net.micode.notes.ui.DateTimePickerDialog;
import net.micode.notes.ui.DateTimePickerDialog.OnDateTimeSetListener; import net.micode.notes.ui.DateTimePickerDialog.OnDateTimeSetListener;
import net.micode.notes.ui.NoteEditText;
import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener; import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener;
import net.micode.notes.ui.NotesPreferenceActivity;
import net.micode.notes.widget.NoteWidgetProvider_2x; import net.micode.notes.widget.NoteWidgetProvider_2x;
import net.micode.notes.widget.NoteWidgetProvider_4x; import net.micode.notes.widget.NoteWidgetProvider_4x;
import java.io.FileNotFoundException;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Vector;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class NoteEditActivity extends AppCompatActivity implements OnClickListener, public class NoteEditActivity extends AppCompatActivity implements OnClickListener,
NoteSettingChangedListener, OnTextViewChangeListener { NoteSettingChangedListener, OnTextViewChangeListener {
//该类主要是针对标签的编辑 //该类主要是针对标签的编辑
@ -94,6 +132,10 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
public ImageView ibSetBgColor; public ImageView ibSetBgColor;
} }
//使用Map实现数据存储
final String[] mPermissionList = new String[]{
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE};
private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>(); private static final Map<Integer, Integer> sBgSelectorBtnsMap = new HashMap<Integer, Integer>();
static { static {
sBgSelectorBtnsMap.put(R.id.iv_bg_yellow, ResourceParser.YELLOW); sBgSelectorBtnsMap.put(R.id.iv_bg_yellow, ResourceParser.YELLOW);
@ -133,9 +175,9 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
} }
private static final String TAG = "NoteEditActivity"; private static final String TAG = "NoteEditActivity";
private AlertDialog alertDialog2;
private HeadViewHolder mNoteHeaderHolder; private HeadViewHolder mNoteHeaderHolder;
private TextToSpeech mTTS;
private View mHeadViewPanel; private View mHeadViewPanel;
//私有化一个界面操作mHeadViewPanel对表头的操作 //私有化一个界面操作mHeadViewPanel对表头的操作
private View mNoteBgColorSelector; private View mNoteBgColorSelector;
@ -158,6 +200,8 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
private static final int SHORTCUT_ICON_TITLE_MAX_LEN = 10; private static final int SHORTCUT_ICON_TITLE_MAX_LEN = 10;
private static final int PHOTO_REQUEST=1;
private boolean mIsRvoke=false;
public static final String TAG_CHECKED = String.valueOf('\u221A'); public static final String TAG_CHECKED = String.valueOf('\u221A');
public static final String TAG_UNCHECKED = String.valueOf('\u25A1'); public static final String TAG_UNCHECKED = String.valueOf('\u25A1');
@ -168,6 +212,24 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
//字符数量计数显示 //字符数量计数显示
private TextView textView; private TextView textView;
/////////////////////////////////////
private SpeechRecognizer mIat;// 语音听写对象
private RecognizerDialog mIatDialog;// 语音听写UI
// 用HashMap存储听写结果
private HashMap<String, String> mIatResults = new LinkedHashMap<String, String>();
private SharedPreferences mSharedPreferences;//缓存
private String mEngineType = SpeechConstant.TYPE_CLOUD;// 引擎类型
private String language = "zh_cn";//识别语言
private ImageButton btnStart;//开始识别
private String resultType = "json";//结果内容数据格式
/////////////////////////////////////
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -180,6 +242,62 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
} }
initResources(); initResources();
count(); count();
read();
////////////////////////////////////////
SpeechUtility.createUtility(NoteEditActivity.this, "appid=802516ec");
btnStart = findViewById(R.id.listen_note);
btnStart.setOnClickListener(this);
// 使用SpeechRecognizer对象可根据回调消息自定义界面
mIat = SpeechRecognizer.createRecognizer(NoteEditActivity.this, mInitListener);
// 使用UI听写功能请根据sdk文件目录下的notice.txt,放置布局文件和图片资源
mIatDialog = new RecognizerDialog(NoteEditActivity.this, mInitListener);
mSharedPreferences = getSharedPreferences("ASR",
Activity.MODE_PRIVATE);
////////////////////////////////////////
//根据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);
}
});
final ImageButton revoke = (ImageButton) findViewById(R.id.revoke);
revoke.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
doRevoke();
return;
}
});
mNoteEditor.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {//文本更改后
if(!mIsRvoke) {
saveMyChanged();
}else {
mIsRvoke = false;
}
}
});
} }
/** /**
@ -208,7 +326,7 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
mWorkingNote = null; mWorkingNote = null;
if (TextUtils.equals(Intent.ACTION_VIEW, intent.getAction())) { if (TextUtils.equals(Intent.ACTION_VIEW, intent.getAction())) {
long noteId = intent.getLongExtra(Intent.EXTRA_UID, 0); long noteId = intent.getLongExtra(Intent.EXTRA_UID, 0);
mUserQuery = ""; mUserQuery = "";//要高亮的字符串
//如果用户实例化标签时系统并未给出标签ID //如果用户实例化标签时系统并未给出标签ID
/** /**
* Starting from the searched result * Starting from the searched result
@ -284,7 +402,14 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
getWindow().setSoftInputMode( getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
| WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); | WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
} else { }else if (TextUtils.equals(Intent.ACTION_SEARCH,intent.getAction())){//点击搜索按钮响应
String querystring = intent.getStringExtra(SearchManager.QUERY);//获取搜索框的字符
NotesDatabaseHelper dbhelper = new NotesDatabaseHelper(this);
dbhelper.dosearch(querystring);
finish();
return false;
}
else {
Log.e(TAG, "Intent not specified action, should not support"); Log.e(TAG, "Intent not specified action, should not support");
finish(); finish();
return false; return false;
@ -300,11 +425,11 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
} }
private void initNoteScreen() { private void initNoteScreen() {
//对界面的初始化操作
//对便签的初始化操作
mNoteEditor.setTextAppearance(this, TextAppearanceResources mNoteEditor.setTextAppearance(this, TextAppearanceResources
.getTexAppearanceResource(mFontSizeId)); .getTexAppearanceResource(mFontSizeId));
//设置外观 //设置外观
if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) { if (mWorkingNote.getCheckListMode() == TextNote.MODE_CHECK_LIST) {
switchToListMode(mWorkingNote.getContent()); switchToListMode(mWorkingNote.getContent());
} else { } else {
@ -326,6 +451,7 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
* TODO: Add the menu for setting alert. Currently disable it because the DateTimePicker * TODO: Add the menu for setting alert. Currently disable it because the DateTimePicker
* is not ready * is not ready
*/ */
convertToImage();
showAlertHeader(); showAlertHeader();
} }
//设置闹钟的显示 //设置闹钟的显示
@ -406,12 +532,26 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
} }
private void initResources() { private void initResources() {
mTTS = new TextToSpeech(this, new OnInitListener() {
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS) {
int result = mTTS.setLanguage(Locale.US);
if (result != TextToSpeech.LANG_COUNTRY_AVAILABLE && result != TextToSpeech.LANG_AVAILABLE) {
//ToastmakeTextCodeViewthisTTS暂时不支持这种语言朗读50000show()
}
}
}
});
mHeadViewPanel = findViewById(R.id.note_title); mHeadViewPanel = findViewById(R.id.note_title);
mNoteHeaderHolder = new HeadViewHolder(); mNoteHeaderHolder = new HeadViewHolder();
mNoteHeaderHolder.tvModified = (TextView) findViewById(R.id.tv_modified_date); mNoteHeaderHolder.tvModified = (TextView) findViewById(R.id.tv_modified_date);
mNoteHeaderHolder.ivAlertIcon = (ImageView) findViewById(R.id.iv_alert_icon); mNoteHeaderHolder.ivAlertIcon = (ImageView) findViewById(R.id.iv_alert_icon);
mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date); mNoteHeaderHolder.tvAlertDate = (TextView) findViewById(R.id.tv_alert_date);
mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.image_button); mNoteHeaderHolder.ibSetBgColor = (ImageView) findViewById(R.id.btn_set_bg_color);
mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this); mNoteHeaderHolder.ibSetBgColor.setOnClickListener(this);
mNoteEditor = (EditText) findViewById(R.id.note_edit_view); mNoteEditor = (EditText) findViewById(R.id.note_edit_view);
mNoteEditorPanel = findViewById(R.id.sv_note_edit); mNoteEditorPanel = findViewById(R.id.sv_note_edit);
@ -469,11 +609,13 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
public void onClick(View v) { public void onClick(View v) {
int id = v.getId(); int id = v.getId();
if (id == R.id.image_button) { if (id == R.id.btn_set_bg_color) {
mNoteBgColorSelector.setVisibility(View.VISIBLE); mNoteBgColorSelector.setVisibility(View.VISIBLE);
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(View.VISIBLE); findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
View.VISIBLE);
} else if (sBgSelectorBtnsMap.containsKey(id)) { } else if (sBgSelectorBtnsMap.containsKey(id)) {
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(View.GONE); findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(
View.GONE);
mWorkingNote.setBgColorId(sBgSelectorBtnsMap.get(id)); mWorkingNote.setBgColorId(sBgSelectorBtnsMap.get(id));
mNoteBgColorSelector.setVisibility(View.GONE); mNoteBgColorSelector.setVisibility(View.GONE);
} else if (sFontSizeBtnsMap.containsKey(id)) { } else if (sFontSizeBtnsMap.containsKey(id)) {
@ -489,7 +631,26 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
TextAppearanceResources.getTexAppearanceResource(mFontSizeId)); TextAppearanceResources.getTexAppearanceResource(mFontSizeId));
} }
mFontSizeSelector.setVisibility(View.GONE); mFontSizeSelector.setVisibility(View.GONE);
}else if (id==R.id.read_note){
mTTS.speak(mNoteEditor.getText().toString(),TextToSpeech.QUEUE_FLUSH,null);
} }
/////////////////////////////////////////
else if (id==R.id.listen_note){
if( null == mIat ){
// 创建单例失败,与 21001 错误为同样原因,参考 http://bbs.xfyun.cn/forum.php?mod=viewthread&tid=9688
showMsg( "创建对象失败,请确认 libmsc.so 放置正确,且有调用 createUtility 进行初始化" );
return;
}
Log.i(TAG, "onClick: 1");
mIatResults.clear();//清除数据
setParam(); // 设置参数
Log.i(TAG, "onClick: 2");
mIatDialog.setListener(mRecognizerDialogListener);//设置监听
Log.i(TAG, "onClick: 3");
mIatDialog.show();// 显示对话框
Log.i(TAG, "onClick: 4");
}
/////////////////////////////////////////
}//************************存在问题 }//************************存在问题
@Override @Override
@ -544,10 +705,16 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
} else { } else {
menu.findItem(R.id.menu_delete_remind).setVisible(false); menu.findItem(R.id.menu_delete_remind).setVisible(false);
} }
if (mWorkingNote.getTopId() == 1){
menu.findItem(R.id.menu_top).setTitle("Cancel top");
}else {
menu.findItem(R.id.menu_top).setTitle("Top");
}
return true; return true;
} }
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@Override @Override
/* /*
* *
@ -556,16 +723,38 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
//根据菜单的id来编剧相关项目 //根据菜单的id来编剧相关项目
case R.id.bk_pic1:{ case R.id.color1:{
mNoteEditorPanel.setBackground(getResources().getDrawable(R.drawable.pic_one)); mNoteEditor.setTextColor(Color.BLUE);
break;
}
case R.id.color2:{
mNoteEditor.setTextColor(Color.CYAN);
break;
}
case R.id.color3:{
mNoteEditor.setTextColor(Color.RED);
break;
}
case R.id.pic1:{
mNoteEditorPanel.setBackground(getResources().getDrawable(R.drawable.pic1));
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(View.GONE); findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(View.GONE);
break; break;
} }
case R.id.bk_pic2:{ case R.id.pic2:{
mNoteEditorPanel.setBackground(getResources().getDrawable(R.drawable.pic2)); mNoteEditorPanel.setBackground(getResources().getDrawable(R.drawable.pic2));
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(View.GONE); findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(View.GONE);
break; break;
} }
case R.id.pic3:{
mNoteEditorPanel.setBackground(getResources().getDrawable(R.drawable.pic3));
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(View.GONE);
break;
}
case R.id.pic4:{
mNoteEditorPanel.setBackground(getResources().getDrawable(R.drawable.pic4));
findViewById(sBgSelectorSelectionMap.get(mWorkingNote.getBgColorId())).setVisibility(View.GONE);
break;
}
case R.id.locker: case R.id.locker:
//为便签上锁 //为便签上锁
final AlertDialog.Builder create_password = new AlertDialog.Builder(this); final AlertDialog.Builder create_password = new AlertDialog.Builder(this);
@ -616,9 +805,9 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
mWorkingNote.setPassword("",""); mWorkingNote.setPassword("","");
Toast.makeText(NoteEditActivity.this,"Password unlocked successfully",Toast.LENGTH_SHORT).show(); Toast.makeText(NoteEditActivity.this,"Password unlocked successfully",Toast.LENGTH_SHORT).show();
break; break;
case R.id.menu_new_note: case R.id.menu_top:
//创建一个新的便签 //置顶便签
createNewNote(); mWorkingNote.setTop((mWorkingNote.getTopId())==1? "0" : "1");
break; break;
case R.id.menu_delete: case R.id.menu_delete:
//删除便签 //删除便签
@ -676,6 +865,11 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
//删除日期提醒 //删除日期提醒
mWorkingNote.setAlertDate(0, false); mWorkingNote.setAlertDate(0, false);
break; break;
case R.id.menu_font_select:
showSingleAlertDiglog();
break;
default: default:
break; break;
} }
@ -687,19 +881,18 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
* *
*/ */
private void setReminder() { private void setReminder() {
DateTimePickerDialog d = new DateTimePickerDialog(this, System.currentTimeMillis()); net.micode.notes.ui.DateTimePickerDialog d = new net.micode.notes.ui.DateTimePickerDialog(this, System.currentTimeMillis());
// 建立修改时间日期的对话框 // 建立修改时间日期的对话框
d.setOnDateTimeSetListener(new OnDateTimeSetListener() { d.setOnDateTimeSetListener(new OnDateTimeSetListener() {
public void OnDateTimeSet(AlertDialog dialog, long date) { public void OnDateTimeSet(AlertDialog dialog, long date) {
mWorkingNote.setAlertDate(date , true); mWorkingNote.setAlertDate(date , true);
//选择提醒的日期 //选择提醒的日期
} }
}); });
//建立时间日期的监听器 //建立时间日期的监听器
d.show(); d.show();
//显示对话框 //显示对话框
} }
/** /**
* Share note to apps that support {@link Intent#ACTION_SEND} action * Share note to apps that support {@link Intent#ACTION_SEND} action
* and {@text/plain} type * and {@text/plain} type
@ -779,7 +972,7 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
* NotesPreferenceActivity * NotesPreferenceActivity
*/ */
private boolean isSyncMode() { private boolean isSyncMode() {
return NotesPreferenceActivity.getSyncAccountName(this).trim().length() > 0; return net.micode.notes.ui.NotesPreferenceActivity.getSyncAccountName(this).trim().length() > 0;
} }
/* /*
@ -796,7 +989,7 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
saveNote(); saveNote();
} }
if (mWorkingNote.getNoteId() > 0) { if (mWorkingNote.getNoteId() > 0) {
Intent intent = new Intent(this, AlarmReceiver.class); Intent intent = new Intent(this, net.micode.notes.ui.AlarmReceiver.class);
intent.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mWorkingNote.getNoteId())); intent.setData(ContentUris.withAppendedId(Notes.CONTENT_NOTE_URI, mWorkingNote.getNoteId()));
//若有有运行的便签就是建立一个链接器将标签id都存在uri中 //若有有运行的便签就是建立一个链接器将标签id都存在uri中
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0);
@ -839,19 +1032,19 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
} }
//没有编辑框的话直接返回 //没有编辑框的话直接返回
for (int i = index + 1; i < childCount; i++) { for (int i = index + 1; i < childCount; i++) {
((NoteEditText) mEditTextList.getChildAt(i).findViewById(R.id.et_edit_text)) ((net.micode.notes.ui.NoteEditText) mEditTextList.getChildAt(i).findViewById(R.id.et_edit_text))
.setIndex(i - 1); .setIndex(i - 1);
//通过id把编辑框存在便签编辑框中 //通过id把编辑框存在便签编辑框中
} }
mEditTextList.removeViewAt(index); mEditTextList.removeViewAt(index);
//删除特定位置的视图 //删除特定位置的视图
NoteEditText edit = null; net.micode.notes.ui.NoteEditText edit = null;
if(index == 0) { if(index == 0) {
edit = (NoteEditText) mEditTextList.getChildAt(0).findViewById( edit = (net.micode.notes.ui.NoteEditText) mEditTextList.getChildAt(0).findViewById(
R.id.et_edit_text); R.id.et_edit_text);
} else { } else {
edit = (NoteEditText) mEditTextList.getChildAt(index - 1).findViewById( edit = (net.micode.notes.ui.NoteEditText) mEditTextList.getChildAt(index - 1).findViewById(
R.id.et_edit_text); R.id.et_edit_text);
} }
//通过id把编辑框存在空的NoteEditText中 //通过id把编辑框存在空的NoteEditText中
@ -877,11 +1070,11 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
View view = getListItem(text, index); View view = getListItem(text, index);
mEditTextList.addView(view, index); mEditTextList.addView(view, index);
//建立一个新的视图并添加到编辑文本框内 //建立一个新的视图并添加到编辑文本框内
NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text); net.micode.notes.ui.NoteEditText edit = (net.micode.notes.ui.NoteEditText) view.findViewById(R.id.et_edit_text);
edit.requestFocus();//请求优先操作 edit.requestFocus();//请求优先操作
edit.setSelection(0);//定位到起始位置 edit.setSelection(0);//定位到起始位置
for (int i = index + 1; i < mEditTextList.getChildCount(); i++) { for (int i = index + 1; i < mEditTextList.getChildCount(); i++) {
((NoteEditText) mEditTextList.getChildAt(i).findViewById(R.id.et_edit_text)) ((net.micode.notes.ui.NoteEditText) mEditTextList.getChildAt(i).findViewById(R.id.et_edit_text))
.setIndex(i); .setIndex(i);
//遍历子文本框并设置对应对下标 //遍历子文本框并设置对应对下标
} }
@ -946,7 +1139,7 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
private View getListItem(String item, int index) { private View getListItem(String item, int index) {
View view = LayoutInflater.from(this).inflate(R.layout.note_edit_list_item, null); View view = LayoutInflater.from(this).inflate(R.layout.note_edit_list_item, null);
//创建一个视图 //创建一个视图
final NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text); final net.micode.notes.ui.NoteEditText edit = (net.micode.notes.ui.NoteEditText) view.findViewById(R.id.et_edit_text);
edit.setTextAppearance(this, TextAppearanceResources.getTexAppearanceResource(mFontSizeId)); edit.setTextAppearance(this, TextAppearanceResources.getTexAppearanceResource(mFontSizeId));
//创建一个文本编辑框并设置可见性 //创建一个文本编辑框并设置可见性
CheckBox cb = ((CheckBox) view.findViewById(R.id.cb_edit_item)); CheckBox cb = ((CheckBox) view.findViewById(R.id.cb_edit_item));
@ -1033,7 +1226,7 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
for (int i = 0; i < mEditTextList.getChildCount(); i++) { for (int i = 0; i < mEditTextList.getChildCount(); i++) {
View view = mEditTextList.getChildAt(i); View view = mEditTextList.getChildAt(i);
//遍历所有子编辑框的视图 //遍历所有子编辑框的视图
NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text); net.micode.notes.ui.NoteEditText edit = (net.micode.notes.ui.NoteEditText) view.findViewById(R.id.et_edit_text);
if (!TextUtils.isEmpty(edit.getText())) { if (!TextUtils.isEmpty(edit.getText())) {
//若文本不为空 //若文本不为空
if (((CheckBox) view.findViewById(R.id.cb_edit_item)).isChecked()) { if (((CheckBox) view.findViewById(R.id.cb_edit_item)).isChecked()) {
@ -1161,8 +1354,8 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
int flag1 = -1; int flag1 = -1;
int flag2 = -1; int flag2 = -1;
do{//不计入表示图片的字符 do{//不计入表示图片的字符
flag1 = stringBuffer.indexOf("<img"); flag1 = stringBuffer.indexOf("[local]");
flag2 = stringBuffer.indexOf(">"); flag2 = stringBuffer.indexOf("[/local]")+7;
if (flag1 != -1 && flag2 != -1){ if (flag1 != -1 && flag2 != -1){
stringBuffer = stringBuffer.replace(flag1,flag2+1,""); stringBuffer = stringBuffer.replace(flag1,flag2+1,"");
} }
@ -1183,7 +1376,33 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
}while (flag1 != -1); }while (flag1 != -1);
return stringBuffer.toString(); return stringBuffer.toString();
} }
private String Text_revoke(String oriText){
StringBuffer stringBuffer = new StringBuffer(oriText);
int flag1 = -1;
int flag2 = -1;
do{//不计入表示图片的字符
flag1 = stringBuffer.indexOf("/n");
flag2 = stringBuffer.indexOf("[/local]")+7;
if (flag1 != -1 && flag2 != -1){
stringBuffer = stringBuffer.replace(flag1,flag2+1,"");
}
}while (flag1 != -1 && flag2 != -1);
do{//不计入换行字符
flag1 = stringBuffer.indexOf("\n");
if (flag1 != -1){
stringBuffer = stringBuffer.replace(flag1,flag1+1,"");
}
}while (flag1 != -1);
do{//不计入空格字符
flag1 = stringBuffer.indexOf(" ");
if (flag1 != -1){
stringBuffer = stringBuffer.replace(flag1,flag1+1,"");
}
}while (flag1 != -1);
return stringBuffer.toString();
}
/* /*
便 便
@ -1207,6 +1426,426 @@ public class NoteEditActivity extends AppCompatActivity implements OnClickListen
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
textView.setText("字符数: " + currentLength); textView.setText("字符数: " + currentLength);
} }
}); });
} }
public void read() {
ImageButton read = findViewById(R.id.read_note);
read.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mTTS.speak(TextChange(mNoteEditor.getText().toString()),TextToSpeech.QUEUE_FLUSH,null);
}
});
}
// final String[] mPermissionList = new String[]{
// Manifest.permission.WRITE_EXTERNAL_STORAGE,
// Manifest.permission.READ_EXTERNAL_STORAGE};
// findViewById(R.id.action_insert_image).setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
////绑定按钮的点击响应获取危险权限这里的100是申请码可以自己定义整数即可
// ActivityCompat.requestPermissions(NoteEditActivity.this, mPermissionList, 100);
////用于获取焦点,否则插入图片时没有响应
// mNoteEditor.focusEditor();
// }
// });
//路径字符串格式 转换为 图片image格式
private void convertToImage() {
net.micode.notes.ui.NoteEditText noteEditText = (net.micode.notes.ui.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.在路径的起始位置插入图片
}
}
}
}
}
//重写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中光标所在位置
net.micode.notes.ui.NoteEditText e = (net.micode.notes.ui.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
@SuppressLint("NewApi")
public static String getPath(final Context context, final Uri uri) {
if (uri == null) {
return null;
}
// 判斷是否為Android 4.4之後的版本
final boolean after44 = Build.VERSION.SDK_INT >= 19;
if (after44 && DocumentsContract.isDocumentUri(context, uri)) {
// 如果是Android 4.4之後的版本而且屬於文件URI
final String authority = uri.getAuthority();
// 判斷Authority是否為本地端檔案所使用的
if ("com.android.externalstorage.documents".equals(authority)) {
// 外部儲存空間
final String docId = DocumentsContract.getDocumentId(uri);
final String[] divide = docId.split(":");
final String type = divide[0];
if ("primary".equals(type)) {
String path = Environment.getExternalStorageDirectory().getAbsolutePath().concat("/").concat(divide[1]);
return path;
} else {
String path = "/storage/".concat(type).concat("/").concat(divide[1]);
return path;
}
} else if ("com.android.providers.downloads.documents".equals(authority)) {
// 下載目錄
final String docId = DocumentsContract.getDocumentId(uri);
if (docId.startsWith("raw:")) {
final String path = docId.replaceFirst("raw:", "");
return path;
}
final Uri downloadUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.parseLong(docId));
String path = queryAbsolutePath(context, downloadUri);
return path;
} else if ("com.android.providers.media.documents".equals(authority)) {
// 圖片、影音檔案
final String docId = DocumentsContract.getDocumentId(uri);
final String[] divide = docId.split(":");
final String type = divide[0];
Uri mediaUri = null;
if ("image".equals(type)) {
mediaUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
} else if ("video".equals(type)) {
mediaUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
} else if ("audio".equals(type)) {
mediaUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
} else {
return null;
}
mediaUri = ContentUris.withAppendedId(mediaUri, Long.parseLong(divide[1]));
String path = queryAbsolutePath(context, mediaUri);
return path;
}
} else {
// 如果是一般的URI
final String scheme = uri.getScheme();
String path = null;
if ("content".equals(scheme)) {
// 內容URI
path = queryAbsolutePath(context, uri);
} else if ("file".equals(scheme)) {
// 檔案URI
path = uri.getPath();
}
return path;
}
return null;
}
public static String queryAbsolutePath(final Context context, final Uri uri) {
final String[] projection = {MediaStore.MediaColumns.DATA};
Cursor cursor = null;
try {
cursor = context.getContentResolver().query(uri, projection, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
final int index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA);
return cursor.getString(index);
}
} catch (final Exception ex) {
ex.printStackTrace();
if (cursor != null) {
cursor.close();
}
}
return null;
}
private static final int MAX_TIME_OF_RVOKE_TIME=100;
private int MAX_OF_RVOKE_TIME=100;
private Vector<SpannableString> mChanged = new Vector<SpannableString>(MAX_OF_RVOKE_TIME);
private void saveMyChanged(){
SpannableString text = new SpannableString(mNoteEditor.getText());//用getText方法获取每次编辑的内容
if(mChanged.size()>=MAX_TIME_OF_RVOKE_TIME){//如果栈中的数据大于最大撤销次数,就把第一次修改的内容删除
mChanged.removeElementAt(0);
}
mChanged.add(text);//然后把本次修改的内容加入栈中
}
private void doRevoke(){
int size = mChanged.size();//获取当前栈大小
AlertDialog.Builder dialog = new AlertDialog.Builder(this);//创建一个alertdialog窗口
dialog.setTitle(R.string.tips_of_revoke);//设置title信息
dialog.setCancelable(true);//设置为可取消
dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() {//只需要设置一个OK键即可
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
mIsRvoke = true;//把是否已执行撤销的标记设置为true
if(size<=1){//如果栈中元素过少,打印提示信息
dialog.setMessage(R.string.have_not_input_anything);//提示用户您还没有输入任何信息
dialog.show();//显示当前alertdialog
return;
}
else {
mNoteEditor.setText((CharSequence) mChanged.elementAt(size-2));//在textview中设置撤销的内容
mNoteEditor.setSelection(mNoteEditor.length());
mChanged.removeElementAt(size-1);//删除元素
if(size==2){
dialog.setMessage(R.string.can_not_revoke);//如果只有一次操作,那么提示用户不能再撤销了
dialog.show();//显示当前alertdialog
}
}
}
public void showSingleAlertDiglog(){
final String[] items = {"默认-普通","默认-非衬线","默认-衬线","默认-等宽","仿宋","黑体","楷体","姚体","隶书","行楷","新魏","中宋"};
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this);
alertBuilder.setTitle("选择字体");
alertBuilder.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
switch (i) {
case 0:
mNoteEditor.setTypeface(Typeface.DEFAULT);
break;
case 1:
mNoteEditor.setTypeface(Typeface.SANS_SERIF);
break;
case 2:
mNoteEditor.setTypeface(Typeface.SERIF);
break;
case 3:
mNoteEditor.setTypeface(Typeface.MONOSPACE);
break;
case 4:
Typeface typeface0 = Typeface.createFromAsset(getAssets(), "font/simfang.ttf");
mNoteEditor.setTypeface(typeface0);
break;
case 5:
Typeface typeface1 = Typeface.createFromAsset(getAssets(), "font/simhei.ttf");
mNoteEditor.setTypeface(typeface1);
break;
case 6:
Typeface typeface2 = Typeface.createFromAsset(getAssets(), "font/simkai.ttf");
mNoteEditor.setTypeface(typeface2);
break;
case 7:
Typeface typeface3 = Typeface.createFromAsset(getAssets(), "font/FZYTK.TTF");
mNoteEditor.setTypeface(typeface3);
break;
case 8:
Typeface typeface4 = Typeface.createFromAsset(getAssets(), "font/STLITI.TTF");
mNoteEditor.setTypeface(typeface4);
break;
case 9:
Typeface typeface5 = Typeface.createFromAsset(getAssets(), "font/STXINGKA.TTF");
mNoteEditor.setTypeface(typeface5);
break;
case 10:
Typeface typeface6 = Typeface.createFromAsset(getAssets(), "font/STXINWEI.TTF");
mNoteEditor.setTypeface(typeface6);
break;
case 11:
Typeface typeface7 = Typeface.createFromAsset(getAssets(), "font/STZHONGS.TTF");
mNoteEditor.setTypeface(typeface7);
break;
}
Toast.makeText(NoteEditActivity.this, items[i], Toast.LENGTH_SHORT).show();
}
});
alertBuilder.setPositiveButton("确定",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
alertDialog2.dismiss();
}
});
alertBuilder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
alertDialog2.dismiss();
}
});
alertDialog2 = alertBuilder.create();
alertDialog2.show();
}
/**
*
*/
private InitListener mInitListener = new InitListener() {
@Override
public void onInit(int code) {
Log.d(TAG, "SpeechRecognizer init() code = " + code);
if (code != ErrorCode.SUCCESS) {
showMsg("初始化失败,错误码:" + code + ",请点击网址https://www.xfyun.cn/document/error-code查询解决方案");
}
}
};
/**
* UI
*/
private RecognizerDialogListener mRecognizerDialogListener = new RecognizerDialogListener() {
@Override
public void onResult(RecognizerResult results, boolean isLast) {
String text = JsonParser.parseIatResult(results.getResultString());
String input = mWorkingNote.getContent() + text;
mNoteEditor.setText(input);
mNoteEditor.setSelection(mNoteEditor.length());
getWorkingText();
}
/**
* .
*/
public void onError(SpeechError error) {
showMsg(error.getPlainDescription(true));
}
};
/**
*
* @param msg
*/
private void showMsg(String msg) {
Toast.makeText(NoteEditActivity.this, msg, Toast.LENGTH_SHORT).show();
}
/**
*
*
* @return
*/
public void setParam() {
// 清空参数
mIat.setParameter(SpeechConstant.PARAMS, null);
// 设置听写引擎
mIat.setParameter(SpeechConstant.ENGINE_TYPE, mEngineType);
// 设置返回结果格式
mIat.setParameter(SpeechConstant.RESULT_TYPE, resultType);
if (language.equals("zh_cn")) {
String lag = mSharedPreferences.getString("iat_language_preference",
"mandarin");
Log.e(TAG, "language:" + language);// 设置语言
mIat.setParameter(SpeechConstant.LANGUAGE, "zh_cn");
// 设置语言区域
mIat.setParameter(SpeechConstant.ACCENT, lag);
} else {
mIat.setParameter(SpeechConstant.LANGUAGE, language);
}
Log.e(TAG, "last language:" + mIat.getParameter(SpeechConstant.LANGUAGE));
//此处用于设置dialog中不显示错误码信息
//mIat.setParameter("view_tips_plain","false");
// 设置语音前端点:静音超时时间,即用户多长时间不说话则当做超时处理
mIat.setParameter(SpeechConstant.VAD_BOS, mSharedPreferences.getString("iat_vadbos_preference", "4000"));
// 设置语音后端点:后端点静音检测时间,即用户停止说话多长时间内即认为不再输入, 自动停止录音
mIat.setParameter(SpeechConstant.VAD_EOS, mSharedPreferences.getString("iat_vadeos_preference", "1000"));
// 设置标点符号,设置为"0"返回结果无标点,设置为"1"返回结果有标点
mIat.setParameter(SpeechConstant.ASR_PTT, mSharedPreferences.getString("iat_punc_preference", "1"));
// 设置音频保存路径保存音频格式支持pcm、wav设置路径为sd卡请注意WRITE_EXTERNAL_STORAGE权限
mIat.setParameter(SpeechConstant.AUDIO_FORMAT, "wav");
mIat.setParameter(SpeechConstant.ASR_AUDIO_PATH, Environment.getExternalStorageDirectory() + "/msc/iat.wav");
}
@Override
protected void onDestroy() {
super.onDestroy();
if (null != mIat) {
// 退出时释放连接
mIat.cancel();
mIat.destroy();
}
}
} }

File diff suppressed because it is too large Load Diff

@ -41,7 +41,8 @@ public class NoteItemData {
NoteColumns.WIDGET_ID, NoteColumns.WIDGET_ID,
NoteColumns.WIDGET_TYPE, NoteColumns.WIDGET_TYPE,
NoteColumns.PASSWORD, NoteColumns.PASSWORD,
NoteColumns.TAG_PASSWORD NoteColumns.TAG_PASSWORD,
NoteColumns.TOP
}; };
//常量标记和数据就不一一标记了,意义翻译基本就知道 //常量标记和数据就不一一标记了,意义翻译基本就知道
private static final int ID_COLUMN = 0; private static final int ID_COLUMN = 0;
@ -58,6 +59,7 @@ public class NoteItemData {
private static final int WIDGET_TYPE_COLUMN = 11; private static final int WIDGET_TYPE_COLUMN = 11;
private static final int PASSWORD_COLUMN = 12; private static final int PASSWORD_COLUMN = 12;
private static final int TAG_PASSWORD_COLUMN = 13; private static final int TAG_PASSWORD_COLUMN = 13;
private static final int TOP_COLUMN = 14;
private long mId; private long mId;
private long mAlertDate; private long mAlertDate;
@ -73,6 +75,7 @@ public class NoteItemData {
private int mWidgetType; private int mWidgetType;
private String mPassword; private String mPassword;
private String mTAG; private String mTAG;
private String mTop;
private String mName; private String mName;
private String mPhoneNumber; private String mPhoneNumber;
@ -93,14 +96,14 @@ public class NoteItemData {
mNotesCount = cursor.getInt(NOTES_COUNT_COLUMN); mNotesCount = cursor.getInt(NOTES_COUNT_COLUMN);
mParentId = cursor.getLong(PARENT_ID_COLUMN); mParentId = cursor.getLong(PARENT_ID_COLUMN);
mSnippet = cursor.getString(SNIPPET_COLUMN); mSnippet = cursor.getString(SNIPPET_COLUMN);
mSnippet = mSnippet.replace(net.micode.notes.ui.NoteEditActivity.TAG_CHECKED, "").replace( mSnippet = mSnippet.replace(NoteEditActivity.TAG_CHECKED, "").replace(
net.micode.notes.ui.NoteEditActivity.TAG_UNCHECKED, ""); NoteEditActivity.TAG_UNCHECKED, "");
mType = cursor.getInt(TYPE_COLUMN); mType = cursor.getInt(TYPE_COLUMN);
mWidgetId = cursor.getInt(WIDGET_ID_COLUMN); mWidgetId = cursor.getInt(WIDGET_ID_COLUMN);
mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN); mWidgetType = cursor.getInt(WIDGET_TYPE_COLUMN);
mPassword = cursor.getString(PASSWORD_COLUMN); mPassword = cursor.getString(PASSWORD_COLUMN);
mTAG = cursor.getString(TAG_PASSWORD_COLUMN); mTAG = cursor.getString(TAG_PASSWORD_COLUMN);
mTop = cursor.getString(TOP_COLUMN);
//初始化电话号码的信息 //初始化电话号码的信息
mPhoneNumber = ""; mPhoneNumber = "";
if (mParentId == Notes.ID_CALL_RECORD_FOLDER) { if (mParentId == Notes.ID_CALL_RECORD_FOLDER) {
@ -241,4 +244,13 @@ public class NoteItemData {
public boolean hasPassword() { return mPassword.equals("") ;} public boolean hasPassword() { return mPassword.equals("") ;}
public String getmTAG() {return mTAG;} public String getmTAG() {return mTAG;}
public boolean isTOP() {
if(mTop.equals("1")){
return true;
}else{
return false;
}
}
} }

@ -31,7 +31,6 @@ import android.database.Cursor;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -61,6 +60,8 @@ import android.widget.PopupMenu;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import net.micode.notes.R; import net.micode.notes.R;
import net.micode.notes.data.Notes; import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns; import net.micode.notes.data.Notes.NoteColumns;
@ -69,9 +70,6 @@ import net.micode.notes.model.WorkingNote;
import net.micode.notes.tool.BackupUtils; import net.micode.notes.tool.BackupUtils;
import net.micode.notes.tool.DataUtils; import net.micode.notes.tool.DataUtils;
import net.micode.notes.tool.ResourceParser; import net.micode.notes.tool.ResourceParser;
import net.micode.notes.ui.DropdownMenu;
import net.micode.notes.ui.NoteItemData;
import net.micode.notes.ui.NotesListAdapter;
import net.micode.notes.ui.NotesListAdapter.AppWidgetAttribute; import net.micode.notes.ui.NotesListAdapter.AppWidgetAttribute;
import net.micode.notes.widget.NoteWidgetProvider_2x; import net.micode.notes.widget.NoteWidgetProvider_2x;
import net.micode.notes.widget.NoteWidgetProvider_4x; import net.micode.notes.widget.NoteWidgetProvider_4x;
@ -88,7 +86,6 @@ import java.util.HashSet;
*/ */
public class NotesListActivity extends AppCompatActivity implements OnClickListener, OnItemLongClickListener { //没有用特定的标签加注释。。。感觉没有什么用 public class NotesListActivity extends AppCompatActivity implements OnClickListener, OnItemLongClickListener { //没有用特定的标签加注释。。。感觉没有什么用
private int bk_mode=0; private int bk_mode=0;
private static final int FOLDER_NOTE_LIST_QUERY_TOKEN = 0; private static final int FOLDER_NOTE_LIST_QUERY_TOKEN = 0;
private static final int FOLDER_LIST_QUERY_TOKEN = 1; private static final int FOLDER_LIST_QUERY_TOKEN = 1;
@ -109,7 +106,7 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
private BackgroundQueryHandler mBackgroundQueryHandler; private BackgroundQueryHandler mBackgroundQueryHandler;
private net.micode.notes.ui.NotesListAdapter mNotesListAdapter; private NotesListAdapter mNotesListAdapter;
private ListView mNotesListView; private ListView mNotesListView;
@ -133,7 +130,7 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
public static final int NOTES_LISTVIEW_SCROLL_RATE = 30; public static final int NOTES_LISTVIEW_SCROLL_RATE = 30;
private net.micode.notes.ui.NoteItemData mFocusNoteDataItem; private NoteItemData mFocusNoteDataItem;
private static final String NORMAL_SELECTION = NoteColumns.PARENT_ID + "=?"; private static final String NORMAL_SELECTION = NoteColumns.PARENT_ID + "=?";
@ -154,7 +151,7 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
//final不能用于修饰构造方法。 //final不能用于修饰构造方法。
super.onCreate(savedInstanceState); // 调用父类的onCreate函数 super.onCreate(savedInstanceState); // 调用父类的onCreate函数
setContentView(R.layout.note_list); setContentView(R.layout.note_list);
getWindow().setBackgroundDrawableResource(R.drawable.list_background); getWindow().setBackgroundDrawableResource(R.drawable.pic1);
initResources(); initResources();
/** /**
@ -260,7 +257,7 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
// 继承自ListView.MultiChoiceModeListener 和 OnMenuItemClickListener // 继承自ListView.MultiChoiceModeListener 和 OnMenuItemClickListener
private class ModeCallback implements ListView.MultiChoiceModeListener, OnMenuItemClickListener { private class ModeCallback implements ListView.MultiChoiceModeListener, OnMenuItemClickListener {
private net.micode.notes.ui.DropdownMenu mDropDownMenu; private DropdownMenu mDropDownMenu;
private ActionMode mActionMode; private ActionMode mActionMode;
private MenuItem mMoveMenu; private MenuItem mMoveMenu;
@ -443,7 +440,7 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
mBackgroundQueryHandler.startQuery(FOLDER_NOTE_LIST_QUERY_TOKEN, null, mBackgroundQueryHandler.startQuery(FOLDER_NOTE_LIST_QUERY_TOKEN, null,
Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[] { Notes.CONTENT_NOTE_URI, NoteItemData.PROJECTION, selection, new String[] {
String.valueOf(mCurrentFolderId) String.valueOf(mCurrentFolderId)
}, NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC"); }, NoteColumns.TOP + " DESC," + NoteColumns.TYPE + " DESC," + NoteColumns.MODIFIED_DATE + " DESC");
} }
private final class BackgroundQueryHandler extends AsyncQueryHandler { private final class BackgroundQueryHandler extends AsyncQueryHandler {
@ -492,7 +489,7 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
} }
private void createNewNote() { private void createNewNote() {
Intent intent = new Intent(this, net.micode.notes.ui.NoteEditActivity.class); Intent intent = new Intent(this, NoteEditActivity.class);
intent.setAction(Intent.ACTION_INSERT_OR_EDIT); intent.setAction(Intent.ACTION_INSERT_OR_EDIT);
intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mCurrentFolderId); intent.putExtra(Notes.INTENT_EXTRA_FOLDER_ID, mCurrentFolderId);
this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE); this.startActivityForResult(intent, REQUEST_CODE_NEW_NODE);
@ -561,15 +558,15 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
} }
} }
} }
//打开一个便签
private void openNode(net.micode.notes.ui.NoteItemData data) { private void openNode(NoteItemData data) {
Intent intent = new Intent(this, net.micode.notes.ui.NoteEditActivity.class); Intent intent = new Intent(this, NoteEditActivity.class);
intent.setAction(Intent.ACTION_VIEW); intent.setAction(Intent.ACTION_VIEW);
intent.putExtra(Intent.EXTRA_UID, data.getId()); intent.putExtra(Intent.EXTRA_UID, data.getId());
this.startActivityForResult(intent, REQUEST_CODE_OPEN_NODE); this.startActivityForResult(intent, REQUEST_CODE_OPEN_NODE);
} }
private void openFolder(net.micode.notes.ui.NoteItemData data) { private void openFolder(NoteItemData data) {
mCurrentFolderId = data.getId(); mCurrentFolderId = data.getId();
startAsyncNotesListQuery(); startAsyncNotesListQuery();
if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) { if (data.getId() == Notes.ID_CALL_RECORD_FOLDER) {
@ -820,13 +817,14 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
Log.e(TAG, "Wrong state:" + mState); Log.e(TAG, "Wrong state:" + mState);
} }
if(bk_mode==0){ if(bk_mode==0){
menu.findItem(R.id.pic_zero).setVisible(false); menu.findItem(R.id.pic1).setVisible(false);
}else if(bk_mode==1){ }else if(bk_mode==1){
menu.findItem(R.id.picture_1).setVisible(false); menu.findItem(R.id.pic2).setVisible(false);
}else if(bk_mode==2) { }
menu.findItem(R.id.picture_2).setVisible(false); else if(bk_mode==2){
menu.findItem(R.id.pic3).setVisible(false);
}else if(bk_mode==3){ }else if(bk_mode==3){
menu.findItem(R.id.picture_3).setVisible(false); menu.findItem(R.id.pic4).setVisible(false);
} }
return true; return true;
} }
@ -834,26 +832,26 @@ public class NotesListActivity extends AppCompatActivity implements OnClickListe
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.picture_1:{ case R.id.pic1:{
getWindow().setBackgroundDrawableResource(R.drawable.pic_one); getWindow().setBackgroundDrawableResource(R.drawable.pic1);
bk_mode=0;
break;
}
case R.id.pic2:{
getWindow().setBackgroundDrawableResource(R.drawable.pic2);
bk_mode=1; bk_mode=1;
break; break;
} }
case R.id.picture_2:{ case R.id.pic3:{
getWindow().setBackgroundDrawableResource(R.drawable.pic_two); getWindow().setBackgroundDrawableResource(R.drawable.pic3);
bk_mode=2; bk_mode=2;
break; break;
} }
case R.id.picture_3:{ case R.id.pic4:{
getWindow().setBackgroundDrawableResource(R.drawable.pic_three); getWindow().setBackgroundDrawableResource(R.drawable.pic4);
bk_mode=3; bk_mode=3;
break; break;
} }
case R.id.pic_zero:{
getWindow().setBackgroundDrawableResource(R.drawable.list_background);
bk_mode=0;
break;
}
case R.id.menu_new_folder: { case R.id.menu_new_folder: {
showCreateOrModifyFolderDialog(true); showCreateOrModifyFolderDialog(true);
break; break;

@ -39,6 +39,7 @@ public class NotesListItem extends LinearLayout {
private NoteItemData mItemData; //标签数据 private NoteItemData mItemData; //标签数据
private CheckBox mCheckBox; //打钩框 private CheckBox mCheckBox; //打钩框
private ImageView mLocker;//锁图片 private ImageView mLocker;//锁图片
private ImageView mTop;//图钉图片
/*初始化基本信息*/ /*初始化基本信息*/
public NotesListItem(Context context) { public NotesListItem(Context context) {
@ -51,6 +52,7 @@ public class NotesListItem extends LinearLayout {
mCallName = (TextView) findViewById(R.id.tv_name); mCallName = (TextView) findViewById(R.id.tv_name);
mCheckBox = (CheckBox) findViewById(android.R.id.checkbox); mCheckBox = (CheckBox) findViewById(android.R.id.checkbox);
mLocker = (ImageView) findViewById(R.id.iv_locker); mLocker = (ImageView) findViewById(R.id.iv_locker);
mTop = (ImageView)findViewById(R.id.iv_top_icon);
} }
///根据data的属性对各个控件的属性的控制主要是可见性Visibility内容setText格式setTextAppearance ///根据data的属性对各个控件的属性的控制主要是可见性Visibility内容setText格式setTextAppearance
public void bind(Context context, NoteItemData data, boolean choiceMode, boolean checked) { public void bind(Context context, NoteItemData data, boolean choiceMode, boolean checked) {
@ -113,6 +115,12 @@ public class NotesListItem extends LinearLayout {
String text = " 不给你看哟~" + " (tag:" + data.getmTAG() + ")"; String text = " 不给你看哟~" + " (tag:" + data.getmTAG() + ")";
mTitle.setText(text); mTitle.setText(text);
} }
mTop.setImageResource(R.drawable.title_tuding);
if (data.isTOP()){
mTop.setVisibility(View.VISIBLE);
}else {
mTop.setVisibility(View.GONE);
}
///设置内容获取相关时间从data里编辑的日期中获取 ///设置内容获取相关时间从data里编辑的日期中获取
mTime. setText(DateUtils.getRelativeTimeSpanString(data.getModifiedDate())); mTime. setText(DateUtils.getRelativeTimeSpanString(data.getModifiedDate()));

@ -0,0 +1,15 @@
package net.micode.notes.ui;
import android.app.Application;
import com.iflytek.cloud.SpeechUtility;
public class SpeechApplication extends Application {
@Override
public void onCreate() {
SpeechUtility.createUtility(SpeechApplication.this, "appid=802516ec");
super.onCreate();
}
}

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

@ -29,9 +29,8 @@ import net.micode.notes.R;
import net.micode.notes.data.Notes; import net.micode.notes.data.Notes;
import net.micode.notes.data.Notes.NoteColumns; import net.micode.notes.data.Notes.NoteColumns;
import net.micode.notes.tool.ResourceParser; import net.micode.notes.tool.ResourceParser;
import net.micode.notes.ui.NoteEditActivity;
import net.micode.notes.ui.NotesListActivity; import net.micode.notes.ui.NotesListActivity;
//import net.micode.notes.ui.NoteEditActivity;
//import net.micode.notes.ui.NotesListActivity;
public abstract class NoteWidgetProvider extends AppWidgetProvider { public abstract class NoteWidgetProvider extends AppWidgetProvider {
public static final String [] PROJECTION = new String [] { public static final String [] PROJECTION = new String [] {
@ -76,7 +75,7 @@ public abstract class NoteWidgetProvider extends AppWidgetProvider {
if (appWidgetIds[i] != AppWidgetManager.INVALID_APPWIDGET_ID) { if (appWidgetIds[i] != AppWidgetManager.INVALID_APPWIDGET_ID) {
int bgId = ResourceParser.getDefaultBgId(context); int bgId = ResourceParser.getDefaultBgId(context);
String snippet = ""; String snippet = "";
Intent intent = new Intent(context, net.micode.notes.ui.NoteEditActivity.class); Intent intent = new Intent(context, NoteEditActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.putExtra(Notes.INTENT_EXTRA_WIDGET_ID, appWidgetIds[i]); intent.putExtra(Notes.INTENT_EXTRA_WIDGET_ID, appWidgetIds[i]);
intent.putExtra(Notes.INTENT_EXTRA_WIDGET_TYPE, getWidgetType()); intent.putExtra(Notes.INTENT_EXTRA_WIDGET_TYPE, getWidgetType());

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 626 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#0099cc" android:background="#0099cc"
tools:context="notes.ui.SplashActivity"> tools:context=".ui.SplashActivity">
<!-- The primary full-screen view. This can be replaced with whatever view <!-- The primary full-screen view. This can be replaced with whatever view
is needed to present your content, e.g. VideoView, SurfaceView, is needed to present your content, e.g. VideoView, SurfaceView,
@ -49,12 +50,16 @@
android:id="@+id/splash" android:id="@+id/splash"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/splash" android:background="@drawable/main_background"
android:gravity="center|bottom"
android:keepScreenOn="true" android:keepScreenOn="true"
android:gravity="center|clip_vertical"
android:text="@string/dummy_content" android:text="@string/dummy_content"
android:textSize="@dimen/text_title_size"
android:textColor="@color/royalblue"
android:textStyle="bold" android:textStyle="bold"
android:textSize="50sp"/> android:paddingTop="150dp"/>
</FrameLayout> </FrameLayout>
</FrameLayout> </FrameLayout>

@ -31,14 +31,17 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/tv_modified_date" android:id="@+id/tv_modified_date"
android:layout_width="200dp" android:layout_width="300dip"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="8dip"
android:layout_weight="1" android:layout_weight="1"
android:textAppearance="@style/TextAppearanceSecondaryItem" />
android:layout_marginRight="8dip"
android:textAppearance="@style/TextAppearanceSecondaryItem" />
<ImageView <ImageView
android:id="@+id/iv_alert_icon" android:id="@+id/iv_alert_icon"
@ -46,6 +49,24 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="@drawable/title_alert" /> android:background="@drawable/title_alert" />
<ImageButton
android:id="@+id/add_img_btn"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginLeft="7dp"
android:background="@drawable/photo"
android:layout_gravity="center|center_vertical"
android:layout_marginHorizontal="@dimen/text_font_size_large"/>
<ImageButton
android:id="@+id/revoke"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginLeft="7dp"
android:background="@drawable/cehui3"
android:layout_gravity="center|center_vertical"
android:layout_marginHorizontal="@dimen/text_font_size_large"/>
<TextView <TextView
android:id="@+id/tv_alert_date" android:id="@+id/tv_alert_date"
@ -61,13 +82,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical" android:layout_gravity="right|center_vertical"
android:layout_marginRight="8dip" /> android:layout_marginRight="8dip" />
<ImageButton <ImageButton
android:id="@+id/image_button" android:id="@+id/btn_set_bg_color"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@drawable/bg_btn_set_color" /> android:background="@drawable/bg_btn_set_color" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -76,24 +98,31 @@
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical"> android:orientation="vertical">
<!-- <ImageView-->
<!-- android:id="@+id/btn_set_bg_color"-->
<!-- android:layout_width="wrap_content"-->
<!-- androidight="43dip"-->
<!-- android:layout_gravity="top|right"-->
<!-- android:background="@drawable/bg_color_btn_mask" />:layout_he-->
<ImageView <ImageView
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="7dip" android:layout_height="7dip"
android:background="@drawable/bg_color_btn_mask" /> android:background="@drawable/bg_color_btn_mask" />
<ScrollView <ScrollView
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="0dip" android:layout_height="0dip"
android:layout_gravity="left|top"
android:layout_weight="1" android:layout_weight="1"
android:fadingEdgeLength="0dip" android:scrollbars="none"
android:overScrollMode="never" android:overScrollMode="never"
android:scrollbars="none"> android:layout_gravity="left|top"
android:fadingEdgeLength="0dip">
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent">
android:orientation="horizontal">
<net.micode.notes.ui.NoteEditText <net.micode.notes.ui.NoteEditText
android:id="@+id/note_edit_view" android:id="@+id/note_edit_view"
@ -109,13 +138,14 @@
<LinearLayout <LinearLayout
android:id="@+id/note_edit_list" android:id="@+id/note_edit_list"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="-10dip"
android:orientation="vertical" android:orientation="vertical"
android:layout_marginLeft="-10dip"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
<ImageView <ImageView
@ -124,7 +154,20 @@
android:background="@drawable/bg_color_btn_mask" /> android:background="@drawable/bg_color_btn_mask" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<ImageButton
android:id="@+id/read_note"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/video_laba"
android:layout_gravity="bottom|left"
android:layout_marginHorizontal="@dimen/text_font_size_large" />
<ImageButton
android:id="@+id/listen_note"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/voice"
android:layout_gravity="bottom|right"
android:layout_marginHorizontal="@dimen/text_font_size_large" />
<LinearLayout <LinearLayout
android:id="@+id/note_bg_color_selector" android:id="@+id/note_bg_color_selector"
android:layout_width="wrap_content" android:layout_width="wrap_content"

@ -76,6 +76,15 @@
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="@drawable/title_locker" /> android:background="@drawable/title_locker" />
<ImageView
android:id="@+id/iv_top_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginRight = "@dimen/text_font_size_medium"
android:layout_gravity="top|right"
android:background="@drawable/title_tuding"/>
<ImageView <ImageView
android:id="@+id/iv_alert_icon" android:id="@+id/iv_alert_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"

@ -18,6 +18,10 @@
<menu <menu
xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_font_select"
android:title="@string/menu_font_style" />
<item <item
android:id="@+id/locker" android:id="@+id/locker"
android:title="@string/note_lock"/> android:title="@string/note_lock"/>
@ -25,8 +29,8 @@
android:id="@+id/unlocker" android:id="@+id/unlocker"
android:title="@string/note_unlock"/> android:title="@string/note_unlock"/>
<item <item
android:id="@+id/menu_new_note" android:id="@+id/menu_top"
android:title="@string/notelist_menu_new"/> android:title="@string/notelist_top"/>
<item <item
android:id="@+id/menu_delete" android:id="@+id/menu_delete"
@ -55,11 +59,26 @@
<item <item
android:id="@+id/menu_delete_remind" android:id="@+id/menu_delete_remind"
android:title="@string/menu_remove_remind" /> android:title="@string/menu_remove_remind" />
<item android:id="@+id/edit_bk" android:title="edit_bk"> <item
android:id="@+id/change_color"
android:title="@string/change_color">
<menu>
<group android:checkableBehavior = "none">
<item android:id="@+id/color1" android:title = "@string/color1"/>
<item android:id="@+id/color2" android:title = "@string/color2"/>
<item android:id="@+id/color3" android:title = "@string/color3"/>
</group>
</menu>
</item>
<item android:id="@+id/Change_bk"
android:title="@string/Change_bk">
<menu> <menu>
<group android:checkableBehavior = "none"> <group android:checkableBehavior = "none">
<item android:id="@+id/bk_pic1" android:title = "@string/pic1"/> <item android:id="@+id/pic1" android:title = "@string/pic1"/>
<item android:id="@+id/bk_pic2" android:title = "@string/pic2"/> <item android:id="@+id/pic2" android:title = "@string/pic2"/>
<item android:id="@+id/pic3" android:title = "@string/pic3"/>
<item android:id="@+id/pic4" android:title = "@string/pic4"/>
</group> </group>
</menu> </menu>
</item> </item>

@ -36,13 +36,14 @@
<item <item
android:id="@+id/menu_search" android:id="@+id/menu_search"
android:title="@string/menu_search"/> android:title="@string/menu_search"/>
<item android:id="@+id/alter" android:title="@string/alert_bk"> <item android:id="@+id/change_bk"
android:title="@string/change_bk">
<menu> <menu>
<group android:checkableBehavior = "none"> <group android:checkableBehavior = "none">
<item android:id="@+id/pic_zero" android:title="@string/pic_none"/> <item android:id="@+id/pic1" android:title = "@string/pic1"/>
<item android:id="@+id/picture_1" android:title = "@string/pic_one"/> <item android:id="@+id/pic2" android:title = "@string/pic2"/>
<item android:id="@+id/picture_2" android:title = "@string/pic_two"/> <item android:id="@+id/pic3" android:title = "@string/pic3"/>
<item android:id="@+id/picture_3" android:title = "@string/pic_three"/> <item android:id="@+id/pic4" android:title = "@string/pic4"/>
</group> </group>
</menu> </menu>
</item> </item>

@ -60,6 +60,9 @@
<string name="menu_folder_change_name">修改文件夹名称</string> <string name="menu_folder_change_name">修改文件夹名称</string>
<string name="folder_exist">文件夹 %1$s 已存在,请重新命名</string> <string name="folder_exist">文件夹 %1$s 已存在,请重新命名</string>
<string name="menu_share">分享</string> <string name="menu_share">分享</string>
<string name="menu_font_style">设置字体</string>
<string name="menu_send_to_desktop">发送到桌面</string> <string name="menu_send_to_desktop">发送到桌面</string>
<string name="menu_alert">提醒我</string> <string name="menu_alert">提醒我</string>
<string name="menu_remove_remind">删除提醒</string> <string name="menu_remove_remind">删除提醒</string>
@ -119,6 +122,35 @@
<string name="search">便签</string> <string name="search">便签</string>
<string name="datetime_dialog_ok">设置</string> <string name="datetime_dialog_ok">设置</string>
<string name="datetime_dialog_cancel">取消</string> <string name="datetime_dialog_cancel">取消</string>
<string name="note_length">Length</string>
<string name="change_bk">Background</string>
<string name="pic1">pic1</string>
<string name="pic2">pic2</string>
<string name="pic3">pic3</string>
<string name="pic4">pic4</string>
<string name="title_activity_splash">FullscreenActivity</string>
<string name="dummy_button">Dummy Button</string>
<string name="dummy_content">凡是过往,皆为序章</string>
<string name="splash">splash</string>
<string name="Change_bk">Background</string>
<string name="change_color">Font color</string>
<string name="color1">color1</string>
<string name="color2">color2</string>
<string name="color3">color3</string>
<string name="preferences_last_sync_time_format">yyyy-MM-dd hh:mm:ss</string>
<string name="alert_set_password">Set your password and tag</string>;
<string name="tips_of_revoke">提示</string>
<string name="can_not_revoke">您不能再执行撤销了</string>
<string name="have_not_input_anything">您还没有输入任何内容</string>
<string name="read_note">read_note</string>
<string name="file_path">/MIUI/notes/</string>
<string name="file_name_txt_format">notes_%s.txt</string>
<!-- notes list string -->
<string name="format_folder_files_count">(%d)</string>
<string name="notelist_top">Top</string>
<string name="cancel_top">Cancel top</string>
<string name="note_unlock">Unlock</string>
<string name="note_lock">Lock</string>
<plurals name="search_results_title"> <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> <item quantity="other"><xliff:g id="NUMBER">%1$s</xliff:g> 条符合“<xliff:g id="SEARCH">%2$s</xliff:g>”的搜索结果</item>
</plurals> </plurals>

@ -61,6 +61,9 @@
<string name="menu_folder_change_name">修改文件夾名稱</string> <string name="menu_folder_change_name">修改文件夾名稱</string>
<string name="folder_exist">文件夾 %1$s 已存在,請重新命名</string> <string name="folder_exist">文件夾 %1$s 已存在,請重新命名</string>
<string name="menu_share">分享</string> <string name="menu_share">分享</string>
<string name="menu_font_style">设置字体</string>
<string name="menu_send_to_desktop">發送到桌面</string> <string name="menu_send_to_desktop">發送到桌面</string>
<string name="menu_alert">提醒我</string> <string name="menu_alert">提醒我</string>
<string name="menu_remove_remind">刪除提醒</string> <string name="menu_remove_remind">刪除提醒</string>

@ -19,4 +19,150 @@
<color name="user_query_highlight">#335b5b5b</color> <color name="user_query_highlight">#335b5b5b</color>
<color name="black_overlay">#66000000</color> <color name="black_overlay">#66000000</color>
<color name="white">#FFFFFF</color> <!--白色 -->
<color name="ivory">#FFFFF0</color> <!--象牙色 -->
<color name="lightyellow">#FFFFE0</color> <!--亮黄色 -->
<color name="yellow">#FFFF00</color> <!--黄色 -->
<color name="snow">#FFFAFA</color> <!--雪白色 -->
<color name="floralwhite">#FFFAF0</color> <!--花白色 -->
<color name="lemonchiffon">#FFFACD</color> <!--柠檬绸色 -->
<color name="cornsilk">#FFF8DC</color> <!--米绸色 -->
<color name="seashell">#FFF5EE</color> <!--海贝色 -->
<color name="lavenderblush">#FFF0F5</color> <!--淡紫红 -->
<color name="papayawhip">#FFEFD5</color> <!--番木色 -->
<color name="blanchedalmond">#FFEBCD</color> <!--白杏色 -->
<color name="mistyrose">#FFE4E1</color> <!--浅玫瑰色 -->
<color name="bisque">#FFE4C4</color> <!--桔黄色 -->
<color name="moccasin">#FFE4B5</color> <!--鹿皮色 -->
<color name="navajowhite">#FFDEAD</color> <!--纳瓦白 -->
<color name="peachpuff">#FFDAB9</color> <!--桃色 -->
<color name="gold">#FFD700</color> <!--金色 -->
<color name="pink">#FFC0CB</color> <!--粉红色 -->
<color name="lightpink">#FFB6C1</color> <!--亮粉红色 -->
<color name="orange">#FFA500</color> <!--橙色 -->
<color name="lightsalmon">#FFA07A</color> <!--亮肉色 -->
<color name="darkorange">#FF8C00</color> <!--暗桔黄色 -->
<color name="coral">#FF7F50</color> <!--珊瑚色 -->
<color name="hotpink">#FF69B4</color> <!--热粉红色 -->
<color name="tomato">#FF6347</color> <!--西红柿色 -->
<color name="orangered">#FF4500</color> <!--红橙色 -->
<color name="deeppink">#FF1493</color> <!--深粉红色 -->
<color name="fuchsia">#FF00FF</color> <!--紫红色 -->
<color name="magenta">#FF00FF</color> <!--红紫色 -->
<color name="red">#FF0000</color> <!--红色 -->
<color name="oldlace">#FDF5E6</color> <!--老花色 -->
<color name="lightgoldenrodyellow">#FAFAD2</color> <!--亮金黄色 -->
<color name="linen">#FAF0E6</color> <!--亚麻色 -->
<color name="antiquewhite">#FAEBD7</color> <!--古董白 -->
<color name="salmon">#FA8072</color> <!--鲜肉色 -->
<color name="ghostwhite">#F8F8FF</color> <!--幽灵白 -->
<color name="mintcream">#F5FFFA</color> <!--薄荷色 -->
<color name="whitesmoke">#F5F5F5</color> <!--烟白色 -->
<color name="beige">#F5F5DC</color> <!--米色 -->
<color name="wheat">#F5DEB3</color> <!--浅黄色 -->
<color name="sandybrown">#F4A460</color> <!--沙褐色 -->
<color name="azure">#F0FFFF</color> <!--天蓝色 -->
<color name="honeydew">#F0FFF0</color> <!--蜜色 -->
<color name="aliceblue">#F0F8FF</color> <!--艾利斯兰 -->
<color name="khaki">#F0E68C</color> <!--黄褐色 -->
<color name="lightcoral">#F08080</color> <!--亮珊瑚色 -->
<color name="palegoldenrod">#EEE8AA</color> <!--苍麒麟色 -->
<color name="violet">#EE82EE</color> <!--紫罗兰色 -->
<color name="darksalmon">#E9967A</color> <!--暗肉色 -->
<color name="lavender">#E6E6FA</color> <!--淡紫色 -->
<color name="lightcyan">#E0FFFF</color> <!--亮青色 -->
<color name="burlywood">#DEB887</color> <!--实木色 -->
<color name="plum">#DDA0DD</color> <!--洋李色 -->
<color name="gainsboro">#DCDCDC</color> <!--淡灰色 -->
<color name="crimson">#DC143C</color> <!--暗深红色 -->
<color name="palevioletred">#DB7093</color> <!--苍紫罗兰色 -->
<color name="goldenrod">#DAA520</color> <!--金麒麟色 -->
<color name="orchid">#DA70D6</color> <!--淡紫色 -->
<color name="thistle">#D8BFD8</color> <!--蓟色 -->
<color name="lightgray">#D3D3D3</color> <!--亮灰色 -->
<color name="lightgrey">#D3D3D3</color> <!--亮灰色 -->
<color name="tan">#D2B48C</color> <!--茶色 -->
<color name="chocolate">#D2691E</color> <!--巧可力色 -->
<color name="peru">#CD853F</color> <!--秘鲁色 -->
<color name="indianred">#CD5C5C</color> <!--印第安红 -->
<color name="mediumvioletred">#C71585</color> <!--中紫罗兰色 -->
<color name="silver">#C0C0C0</color> <!--银色 -->
<color name="darkkhaki">#BDB76B</color> <!--暗黄褐色-->
<color name="rosybrown">#BC8F8F</color> <!--褐玫瑰红 -->
<color name="mediumorchid">#BA55D3</color> <!--中粉紫色 -->
<color name="darkgoldenrod">#B8860B</color> <!--暗金黄色 -->
<color name="firebrick">#B22222</color> <!--火砖色 -->
<color name="powderblue">#B0E0E6</color> <!--粉蓝色 -->
<color name="lightsteelblue">#B0C4DE</color> <!--亮钢兰色-->
<color name="paleturquoise">#AFEEEE</color> <!--苍宝石绿 -->
<color name="greenyellow">#ADFF2F</color> <!--黄绿色 -->
<color name="lightblue">#ADD8E6</color> <!--亮蓝色 -->
<color name="darkgray">#A9A9A9</color> <!--暗灰色 -->
<color name="darkgrey">#A9A9A9</color> <!--暗灰色 -->
<color name="brown">#A52A2A</color> <!--褐色 -->
<color name="sienna">#A0522D</color> <!--赭色 -->
<color name="darkorchid">#9932CC</color> <!--暗紫色 -->
<color name="palegreen">#98FB98</color> <!--苍绿色 -->
<color name="darkviolet">#9400D3</color> <!--暗紫罗兰色 -->
<color name="mediumpurple">#9370DB</color> <!--中紫色 -->
<color name="lightgreen">#90EE90</color> <!--亮绿色 -->
<color name="darkseagreen">#8FBC8F</color> <!--暗海兰色 -->
<color name="saddlebrown">#8B4513</color> <!--重褐色 -->
<color name="darkmagenta">#8B008B</color> <!--暗洋红 -->
<color name="darkred">#8B0000</color> <!--暗红色 -->
<color name="blueviolet">#8A2BE2</color> <!--紫罗兰蓝色 -->
<color name="lightskyblue">#87CEFA</color> <!--亮天蓝色 -->
<color name="skyblue">#87CEEB</color> <!--天蓝色 -->
<color name="gray">#808080</color> <!--灰色 -->
<color name="grey">#808080</color> <!--灰色 -->
<color name="olive">#808000</color> <!--橄榄色 -->
<color name="purple">#800080</color> <!--紫色 -->
<color name="maroon">#800000</color> <!--粟色 -->
<color name="aquamarine">#7FFFD4</color> <!--碧绿色 -->
<color name="chartreuse">#7FFF00</color> <!--黄绿色 -->
<color name="lawngreen">#7CFC00</color> <!--草绿色 -->
<color name="mediumslateblue">#7B68EE</color> <!--中暗蓝色 -->
<color name="lightslategray">#778899</color> <!--亮蓝灰 -->
<color name="lightslategrey">#778899</color> <!--亮蓝灰 -->
<color name="slategray">#708090</color> <!--灰石色 -->
<color name="slategrey">#708090</color> <!--灰石色 -->
<color name="olivedrab">#6B8E23</color> <!--深绿褐色 -->
<color name="slateblue">#6A5ACD</color> <!--石蓝色 -->
<color name="dimgray">#696969</color> <!--暗灰色 -->
<color name="dimgrey">#696969</color> <!--暗灰色 -->
<color name="mediumaquamarine">#66CDAA</color> <!--中绿色 -->
<color name="cornflowerblue">#6495ED</color> <!--菊兰色 -->
<color name="cadetblue">#5F9EA0</color> <!--军兰色 -->
<color name="darkolivegreen">#556B2F</color> <!--暗橄榄绿-->
<color name="indigo">#4B0082</color> <!--靛青色 -->
<color name="mediumturquoise">#48D1CC</color> <!--中绿宝石 -->
<color name="darkslateblue">#483D8B</color> <!--暗灰蓝色 -->
<color name="steelblue">#4682B4</color> <!--钢兰色 -->
<color name="royalblue">#4169E1</color> <!--皇家蓝 -->
<color name="turquoise">#40E0D0</color> <!--青绿色 -->
<color name="mediumseagreen">#3CB371</color> <!--中海蓝 -->
<color name="limegreen">#32CD32</color> <!--橙绿色 -->
<color name="darkslategray">#2F4F4F</color> <!--暗瓦灰色 -->
<color name="darkslategrey">#2F4F4F</color> <!--暗瓦灰色 -->
<color name="seagreen">#2E8B57</color> <!--海绿色 -->
<color name="forestgreen">#228B22</color> <!--森林绿 -->
<color name="lightseagreen">#20B2AA</color> <!--亮海蓝色 -->
<color name="dodgerblue">#1E90FF</color> <!--闪兰色 -->
<color name="midnightblue">#191970</color> <!--中灰兰色 -->
<color name="aqua">#00FFFF</color> <!--浅绿色 -->
<color name="cyan">#00FFFF</color> <!--青色 -->
<color name="springgreen">#00FF7F</color> <!--春绿色 -->
<color name="lime">#00FF00</color> <!--酸橙色 -->
<color name="mediumspringgreen">#00FA9A</color> <!--中春绿色 -->
<color name="darkturquoise">#00CED1</color> <!--暗宝石绿 -->
<color name="deepskyblue">#00BFFF</color> <!--深天蓝色 -->
<color name="darkcyan">#008B8B</color> <!--暗青色 -->
<color name="teal">#008080</color> <!--水鸭色 -->
<color name="green">#008000</color> <!--绿色 -->
<color name="darkgreen">#006400</color> <!--暗绿色 -->
<color name="blue">#0000FF</color> <!--蓝色 -->
<color name="mediumblue">#0000CD</color> <!--中兰色 -->
<color name="darkblue">#00008B</color> <!--暗蓝色 -->
<color name="navy">#000080</color> <!--海军色 -->
<color name="black">#000000</color> <!--黑色 -->
</resources> </resources>

@ -21,4 +21,5 @@
<dimen name="text_font_size_medium">20sp</dimen> <dimen name="text_font_size_medium">20sp</dimen>
<dimen name="text_font_size_normal">17sp</dimen> <dimen name="text_font_size_normal">17sp</dimen>
<dimen name="text_font_size_small">14sp</dimen> <dimen name="text_font_size_small">14sp</dimen>
<dimen name="text_title_size">40sp</dimen>
</resources> </resources>

@ -23,8 +23,13 @@
<string name="widget_under_visit_mode">Privacy modecan not see note content</string> <string name="widget_under_visit_mode">Privacy modecan not see note content</string>
<string name="notelist_string_info">...</string> <string name="notelist_string_info">...</string>
<string name="note_lock">Lock</string> <string name="note_lock">Lock</string>
<string name="menu_font_style">Font</string>
<string name="note_unlock">Unlock</string> <string name="note_unlock">Unlock</string>
<string name="notelist_menu_new">Add note</string> <string name="notelist_menu_new">Add note</string>
<string name="notelist_top">Top</string>
<string name="cancel_top">Cancel top</string>
<string name="delete_remind_time_message">Delete reminder successfully</string> <string name="delete_remind_time_message">Delete reminder successfully</string>
<string name="set_remind_time_message">Set reminder</string> <string name="set_remind_time_message">Set reminder</string>
<string name="note_alert_expired">Expired</string> <string name="note_alert_expired">Expired</string>
@ -37,16 +42,13 @@
<string name="note_link_web">Browse web</string> <string name="note_link_web">Browse web</string>
<string name="note_link_other">Open map</string> <string name="note_link_other">Open map</string>
<!-- Text export file information --> <!-- Text export file information -->
<string name="tips_of_revoke">提示</string>
<string name="can_not_revoke">您不能再执行撤销了</string>
<string name="have_not_input_anything">您还没有输入任何内容</string>
<string name="read_note">read_note</string>
<string name="file_path">/MIUI/notes/</string> <string name="file_path">/MIUI/notes/</string>
<string name="file_name_txt_format">notes_%s.txt</string> <string name="file_name_txt_format">notes_%s.txt</string>
<!-- notes list string --> <!-- notes list string -->
<string name="alter_bk">alter_bk</string>
<string name="picture_1">pic_1</string>
<string name="picture_2">pic_2</string>
<string name="picture_3">pic_3</string>
<string name="bk_pic1">pic1</string>
<string name="bk_pic2">pic2</string>
<string name="image_button">image_button</string>
<string name="format_folder_files_count">(%d)</string> <string name="format_folder_files_count">(%d)</string>
<string name="menu_create_folder">New Folder</string> <string name="menu_create_folder">New Folder</string>
<string name="menu_export_text">Export text</string> <string name="menu_export_text">Export text</string>
@ -138,9 +140,13 @@
<string name="datetime_dialog_cancel">cancel</string> <string name="datetime_dialog_cancel">cancel</string>
<string name="note_length">Length</string> <string name="note_length">Length</string>
<string name="set_bk">set_bk</string> <string name="change_bk">Background</string>
<string name="set_back">set_back</string> <string name="pic1">pic1</string>
<string name="alert_bk">alert_bk</string> <string name="pic2">pic2</string>
<string name="pic3">pic3</string>
<string name="pic4">pic4</string>
<plurals name="search_results_title"> <plurals name="search_results_title">
<item quantity="one"><xliff:g example="1" id="number">%1$s</xliff:g> result for \"<xliff:g example="???" id="search">%2$s</xliff:g>\"</item> <item quantity="one"><xliff:g example="1" id="number">%1$s</xliff:g> result for \"<xliff:g example="???" id="search">%2$s</xliff:g>\"</item>
<!-- Case of 0 or 2 or more results. --> <!-- Case of 0 or 2 or more results. -->
@ -148,13 +154,13 @@
</plurals> </plurals>
<string name="title_activity_splash">FullscreenActivity</string> <string name="title_activity_splash">FullscreenActivity</string>
<string name="dummy_button">Dummy Button</string> <string name="dummy_button">Dummy Button</string>
<string name="dummy_content">凡是过往,皆为序章</string>
<string name="splash">splash</string> <string name="splash">splash</string>
<string name="dummy_content">记录生活</string> <string name="Change_bk">Background</string>
<string name="pic1">pic1</string> <string name="change_color">Font color</string>
<string name="pic2">pic2</string> <string name="color1">Blue</string>
<string name="pic_none">pic_none</string> <string name="color2">Cyan</string>
<string name="pic_one">pic_one</string> <string name="color3">Red</string>
<string name="pic_two">pic_two</string>
<string name="pic_three">pic_three</string>
</resources> </resources>

Loading…
Cancel
Save