Kk 3 years ago
parent 2846fcf27e
commit 0950bcff1b

@ -196,7 +196,7 @@ AUTHORITY + "/data");//定义查找数据的指针。
*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 TOP = "top";
}//这些常量主要是定义便签的属性的。

@ -411,6 +411,10 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
Log.i(TAG, content);
}
}
cursor.close();
else{
cursor.close();
}
}
}

@ -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)
|| !js.has(GTaskStringUtils.META_HEAD_DATA)) {
Log.w(TAG, "setContentByLocalJSON: nothing is avaiable");
}
try {
JSONObject note = js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE);
JSONArray dataArray = js.getJSONArray(GTaskStringUtils.META_HEAD_DATA);
JSONObject note = (js!=null)?js.getJSONObject(GTaskStringUtils.META_HEAD_NOTE):new JSONObject();
JSONArray dataArray = (js!=null)?js.getJSONArray(GTaskStringUtils.META_HEAD_DATA):new JSONArray();
if (note.getInt(NoteColumns.TYPE) != Notes.TYPE_NOTE) {
Log.e(TAG, "invalid type");

@ -147,7 +147,7 @@ public class TaskList extends Node {
}
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) {
String name = folder.getString(NoteColumns.SNIPPET);
@ -212,13 +212,7 @@ public class TaskList extends Node {
Log.e(TAG, "gtask id doesn't match");
return SYNC_ACTION_ERROR;
}
if (c.getLong(SqlNote.SYNC_ID_COLUMN) == getLastModified()) {
// local modification only
return SYNC_ACTION_UPDATE_REMOTE;
} else {
// for folder conflicts, just apply local modification
return SYNC_ACTION_UPDATE_REMOTE;
}
return SYNC_ACTION_UPDATE_REMOTE;
}
} catch (Exception e) {
Log.e(TAG, e.toString());

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

@ -449,7 +449,7 @@ public class WorkingNote {
}
public void setTop(String Top){
if (Top != mTop){
if (Top.equals(mTop)){
mTop = Top;
mNote.setNoteValue(NoteColumns.TOP,String.valueOf(mTop));
}

@ -6,8 +6,7 @@ import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;
import android.view.Window;
import com.iflytek.speech.util.SettingTextWatcher;
import net.micode.notes.speech.util.SettingTextWatcher;
/**
*

@ -1,144 +0,0 @@
package com.iflytek.speech.util;
import android.content.Context;
import com.iflytek.cloud.ErrorCode;
import com.iflytek.cloud.SpeechConstant;
import com.iflytek.cloud.SpeechUtility;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
/**
*
*/
public class FucUtil {
/**
* asset
*
* @return content
*/
public static String readFile(Context mContext, String file, String code) {
int len = 0;
byte[] buf = null;
String result = "";
try {
InputStream in = mContext.getAssets().open(file);
len = in.available();
buf = new byte[len];
in.read(buf, 0, len);
result = new String(buf, code);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
*
*
* @param buffer
* @param length
* @param spsize
* @return
*/
public static ArrayList<byte[]> splitBuffer(byte[] buffer, int length, int spsize) {
ArrayList<byte[]> array = new ArrayList<byte[]>();
if (spsize <= 0 || length <= 0 || buffer == null || buffer.length < length)
return array;
int size = 0;
while (size < length) {
int left = length - size;
if (spsize < left) {
byte[] sdata = new byte[spsize];
System.arraycopy(buffer, size, sdata, 0, spsize);
array.add(sdata);
size += spsize;
} else {
byte[] sdata = new byte[left];
System.arraycopy(buffer, size, sdata, 0, left);
array.add(sdata);
size += left;
}
}
return array;
}
/**
* 线
* 1.PLUS_LOCAL_ALL:
* 2.PLUS_LOCAL_ASR:
* 3.PLUS_LOCAL_TTS:
*/
public static String checkLocalResource() {
String resource = SpeechUtility.getUtility().getParameter(SpeechConstant.PLUS_LOCAL_ASR);
try {
JSONObject result = new JSONObject(resource);
int ret = result.getInt(SpeechUtility.TAG_RESOURCE_RET);
switch (ret) {
case ErrorCode.SUCCESS:
JSONArray asrArray = result.getJSONObject("result").optJSONArray("asr");
if (asrArray != null) {
int i = 0;
// 查询否包含离线听写资源
for (; i < asrArray.length(); i++) {
if ("iat".equals(asrArray.getJSONObject(i).get(SpeechConstant.DOMAIN))) {
//asrArray中包含语言、方言字段后续会增加支持方言的本地听写。
//如:"accent": "mandarin","language": "zh_cn"
break;
}
}
if (i >= asrArray.length()) {
SpeechUtility.getUtility().openEngineSettings(SpeechConstant.ENG_ASR);
return "没有听写资源,跳转至资源下载页面";
}
} else {
SpeechUtility.getUtility().openEngineSettings(SpeechConstant.ENG_ASR);
return "没有听写资源,跳转至资源下载页面";
}
break;
case ErrorCode.ERROR_VERSION_LOWER:
return "语记版本过低,请更新后使用本地功能";
case ErrorCode.ERROR_INVALID_RESULT:
SpeechUtility.getUtility().openEngineSettings(SpeechConstant.ENG_ASR);
return "获取结果出错,跳转至资源下载页面";
case ErrorCode.ERROR_SYSTEM_PREINSTALL:
default:
break;
}
} catch (Exception e) {
SpeechUtility.getUtility().openEngineSettings(SpeechConstant.ENG_ASR);
return "获取结果出错,跳转至资源下载页面";
}
return "";
}
/**
* asset
*
* @return
*/
public static byte[] readAudioFile(Context context, String filename) {
try {
InputStream ins = context.getAssets().open(filename);
byte[] data = new byte[ins.available()];
ins.read(data);
ins.close();
return data;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}

@ -1,4 +1,4 @@
package com.iflytek.speech.util;
package net.micode.notes.speech.util;
import android.content.Context;
import android.preference.EditTextPreference;

@ -1,55 +0,0 @@
package com.iflytek.speech.util;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
/**
* Xml
*/
public class XmlParser {
public static String parseNluResult(String xml) {
StringBuffer buffer = new StringBuffer();
try {
// DOM builder
DocumentBuilder domBuilder = null;
// DOM doc
Document domDoc = null;
// init DOM
DocumentBuilderFactory domFact = DocumentBuilderFactory.newInstance();
domBuilder = domFact.newDocumentBuilder();
InputStream is = new ByteArrayInputStream(xml.getBytes());
domDoc = domBuilder.parse(is);
// 获取根节点
Element root = (Element) domDoc.getDocumentElement();
Element raw = (Element) root.getElementsByTagName("rawtext").item(0);
buffer.append("【识别结果】" + raw.getFirstChild().getNodeValue());
buffer.append("\n");
Element e = (Element) root.getElementsByTagName("result").item(0);
Element focus = (Element) e.getElementsByTagName("focus").item(0);
buffer.append("【FOCUS】" + focus.getFirstChild().getNodeValue());
buffer.append("\n");
Element action = (Element) e.getElementsByTagName("action").item(0);
Element operation = (Element) action.getElementsByTagName("operation").item(0);
buffer.append("【ACTION】" + operation.getFirstChild().getNodeValue());
buffer.append("\n");
} catch (Exception e) {
e.printStackTrace();
}
buffer.append("【ALL】" + xml);
return buffer.toString();
}
}

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

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

@ -109,8 +109,6 @@ import net.micode.notes.ui.NoteEditText.OnTextViewChangeListener;
import net.micode.notes.widget.NoteWidgetProvider_2x;
import net.micode.notes.widget.NoteWidgetProvider_4x;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.FileNotFoundException;
import java.util.HashMap;

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 KiB

@ -50,7 +50,7 @@
android:id="@+id/splash"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/moon"
android:background="@drawable/main_background"
android:keepScreenOn="true"
android:gravity="center|clip_vertical"
android:text="@string/dummy_content"

@ -24,7 +24,7 @@
<string name="notelist_string_info">...</string>
<string name="note_lock">Lock</string>
<string name="menu_font_style">font</string>
<string name="menu_font_style">Font</string>
<string name="note_unlock">Unlock</string>
<string name="notelist_menu_new">Add note</string>
@ -158,9 +158,9 @@
<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="color1">Blue</string>
<string name="color2">Cyan</string>
<string name="color3">Red</string>
</resources>

Loading…
Cancel
Save