From b44c79fed794c945dcdd143f00c3cbfa8fc4936a Mon Sep 17 00:00:00 2001 From: TrillGates Date: Wed, 24 Feb 2021 10:57:29 +0800 Subject: [PATCH] adjust provider part. --- app/src/main/AndroidManifest.xml | 2 +- .../com/enqualcomm/support/CoreService.java | 2 +- .../enqualcomm/support/bean/BaiRuiMember.java | 43 + .../{ => provider}/ICContentProvider.java | 2320 ++++++++--------- .../support/service/Initialize.java | 2 +- .../support/service/SilentManager.java | 2 +- .../support/utils/ContextProxy.java | 2 +- .../enqualcomm/support/utils/DBHelper.java | 24 +- .../enqualcomm/support/utils/GetContact.java | 2 +- .../java/com/ic/protocols/protocol_fzd.java | 16 + 10 files changed, 1236 insertions(+), 1179 deletions(-) create mode 100644 app/src/main/java/com/enqualcomm/support/bean/BaiRuiMember.java rename app/src/main/java/com/enqualcomm/support/{ => provider}/ICContentProvider.java (97%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7826d2c7..ae26119f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -117,7 +117,7 @@ diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index 43d4afd2..88d1fbae 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -1533,7 +1533,7 @@ public class CoreService extends Service { // } } - private ReConnectSrvThread mReConnectSrvThread = new ReConnectSrvThread(); + private final ReConnectSrvThread mReConnectSrvThread = new ReConnectSrvThread(); private class ReConnectSrvThread implements Runnable { @Override diff --git a/app/src/main/java/com/enqualcomm/support/bean/BaiRuiMember.java b/app/src/main/java/com/enqualcomm/support/bean/BaiRuiMember.java new file mode 100644 index 00000000..a65c13e5 --- /dev/null +++ b/app/src/main/java/com/enqualcomm/support/bean/BaiRuiMember.java @@ -0,0 +1,43 @@ +package com.enqualcomm.support.bean; + +public class BaiRuiMember { + + private int bairuiId; + + private String name; + + private String phoneNum; + + public int getBairuiId() { + return bairuiId; + } + + public void setBairuiId(int bairuiId) { + this.bairuiId = bairuiId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhoneNum() { + return phoneNum; + } + + public void setPhoneNum(String phoneNum) { + this.phoneNum = phoneNum; + } + + @Override + public String toString() { + return "BaiRuiMember{" + + "bairuiId=" + bairuiId + + ", name='" + name + '\'' + + ", phoneNum='" + phoneNum + '\'' + + '}'; + } +} diff --git a/app/src/main/java/com/enqualcomm/support/ICContentProvider.java b/app/src/main/java/com/enqualcomm/support/provider/ICContentProvider.java similarity index 97% rename from app/src/main/java/com/enqualcomm/support/ICContentProvider.java rename to app/src/main/java/com/enqualcomm/support/provider/ICContentProvider.java index 7846f4b1..3ae20209 100644 --- a/app/src/main/java/com/enqualcomm/support/ICContentProvider.java +++ b/app/src/main/java/com/enqualcomm/support/provider/ICContentProvider.java @@ -1,1160 +1,1160 @@ -package com.enqualcomm.support; - -import android.content.ContentProvider; -import android.content.ContentUris; -import android.content.ContentValues; -import android.content.UriMatcher; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -import android.net.Uri; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; - - -public class ICContentProvider extends ContentProvider { - private static final int ALARM = 5; - - private static final int ALARM_ITEM = 6; - - private static final String ALARM_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.alarm"; - - private static final String ALARM_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.alarm"; - - private static final String ALARM_TABLE_NAME = "ALARM"; - - public static final Uri ALARM_URI = Uri.parse("content://com.enqualcomm.support/alarm"); - - private static final int ANTIOFF = 19; - - private static final int ANTIOFF_ITEM = 20; - - private static final String ANTIOFF_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.antioff"; - - private static final String ANTIOFF_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.antioff"; - - private static final String ANTIOFF_TABLE_NAME = "ANTIOFF"; - - public static final Uri ANTIOFF_URI = Uri.parse("content://com.enqualcomm.support/antioff"); - - private static final int CONTACT = 1; - - private static final int CONTACT_ITEM = 2; - - private static final String CONTACT_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.contact"; - - private static final String CONTACT_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.contact"; - - private static final String CONTACT_TABLE_NAME = "CONTACT"; - - public static final Uri CONTACT_URI =Uri.parse("content://com.enqualcomm.support/contact"); - - private static final int DEVICESTATUS = 15; - - private static final String DEVICESTATUS_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.deviceStatus"; - - private static final String DEVICESTATUS_TABLE_NAME = "DEVICESTATUS"; - - public static final Uri DEVICESTATUS_URL = Uri.parse("content://com.enqualcomm.support/deviceStatus"); - - private static final int DOWNLOADINFO = 16; - - private static final int DOWNLOADINFO_ITEM = 17; - - private static final String DOWNLOADINFO_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.downloadInfo"; - - private static final String DOWNLOADINFO_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.downloadInfo"; - - private static final String DOWNLOADINFO_TABLE_NAME = "DOWNLOADINFO"; - - public static final Uri DOWNLOADINFO_URL = Uri .parse("content://com.enqualcomm.support/downloadInfo"); - - private static final int IKNOWLEDGE = 9; - - private static final String IKNOWLEDGE_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.iKnowledge"; - - private static final String IKNOWLEDGE_TABLE_NAME = "IKNOWLEDGE"; - - public static final Uri IKNOWLEDGE_URL = Uri.parse("content://com.enqualcomm.support/iKnowledge"); - - private static final int MESSAGE = 3; - - private static final int MESSAGE_ITEM = 4; - - private static final String MESSAGE_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.message"; - - private static final String MESSAGE_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.message"; - - private static final String MESSAGE_TABLE_NAME = "MESSAGE"; - - public static final Uri MESSAGE_URI = Uri.parse("content://com.enqualcomm.support/message"); - - private static final int NOTICE = 12; - - private static final int NOTICE_ITEM = 13; - - private static final String NOTICE_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.notice"; - - private static final String NOTICE_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.notice"; - - private static final String NOTICE_TABLE_NAME = "NOTICE"; - - public static final Uri NOTICE_URL = Uri.parse("content://com.enqualcomm.support/notice"); - - private static final int SILENT = 7; - - private static final int SILENT_ITEM = 8; - - private static final String SILENT_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.silent"; - - private static final String SILENT_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.silent"; - - private static final String SILENT_TABLE_NAME = "SILENT"; - - public static final Uri SILENT_URI = Uri.parse("content://com.enqualcomm.support/silent"); - - private static final int STHEART_RATE = 18; - - private static final String STHEART_RATE_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.stheartRate"; - - private static final String STHEART_RATE_TABLE_NAME = "STHEART_RATE"; - - public static final Uri STHEART_RATE_URL = Uri.parse("content://com.enqualcomm.support/stheartRate"); - - private static final int UNREADMSG = 21; - - private static final String UNREADMSG_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.unreadMsg"; - - private static final String UNREADMSG_TABLE_NAME = "UNREADMSG"; - - public static final Uri UNREAD_MSG_URI = Uri.parse("content://com.enqualcomm.support/unreadMsg"); - - private static final UriMatcher URI_MATCHER = new UriMatcher(-1); - - private static final int URLDOWNLOADPIC = 10; - - private static final int URLDOWNLOADPIC_ITEM = 11; - - private static final String URLDOWNLOADPIC_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.urlDownloadPic"; - - private static final String URLDOWNLOADPIC_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.urlDownloadPic"; - - private static final String URLDOWNLOADPIC_TABLE_NAME = "URLDOWNLOADPIC"; - - public static final Uri URLDOWNLOADPIC_URL = Uri .parse("content://com.enqualcomm.support/urlDownloadPic"); - - private static final int WEATHER = 14; - - private static final String WEATHER_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.weather"; - - private static final String WEATHER_TABLE_NAME = "WEATHER"; - - public static final Uri WEATHER_URL = Uri.parse("content://com.enqualcomm.support/weather"); - - public static final String SLEEP_RECORDS_TABLE_NAME = "SLEEP_RECORDS"; - private static final int SLEEP_RECORDS = 22; - private static final String SLEEP_RECORDS_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.sleepRecords"; - public static final Uri SLEEP_RECORDS_URI = Uri.parse("content://com.enqualcomm.support/sleepRecords"); - - - public static final String SLEEP_STATUS_TABLE_NAME = "SLEEP_STATUS"; - private static final int SLEEP_STATUS = 23; - private static final String SLEEP_STATUS_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.sleepStatus"; - public static final Uri SLEEP_STATUS_URI = Uri.parse("content://com.enqualcomm.support/sleepStatus"); - - - public static final String EVENT_MESSAGE_TABLE_NAME = "EVENT_MESSAGE"; - private static final int EVENT_MESSAGE = 24; - private static final String EVENT_MESSAGE_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.eventMessage"; - public static final Uri EVENT_MESSAGE_URI = Uri.parse("content://com.enqualcomm.support/eventMessage"); - - public static final String SIT_TABLE_NAME = "SIT"; - private static final int SIT = 25; - private static final String SIT_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.sit"; - public static final Uri SIT_URI = Uri.parse("content://com.enqualcomm.support/sit"); - - public static final String ALARM_MSG_RECORDS_TABLE_NAME = "ALARM_MSG_RECORDS"; - private static final int ALARM_MSG_RECORDS = 26; - private static final String ALARM_MSG_RECORDS_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.alarmMSG"; - public static final Uri ALARM_MSG_RECORDS_URI = Uri.parse("content://com.enqualcomm.support/alarmMSG"); - - public static final String PROTOCOL_CMD_RECORDS_TABLE_NAME = "PROTOCOL_CMD_RECORDS"; - private static final int PROTOCOL_CMD_RECORDS = 27; - private static final String PROTOCOL_CMD_RECORDS_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.cmdRecord"; - public static final Uri PROTOCOL_CMD_RECORDS_URI = Uri.parse("content://com.enqualcomm.support/cmdRecord"); - - private SQLiteDatabase db; - - static { - URI_MATCHER.addURI("com.enqualcomm.support", "contact", CONTACT); //1 - URI_MATCHER.addURI("com.enqualcomm.support", "contact/#", CONTACT_ITEM); //2 - URI_MATCHER.addURI("com.enqualcomm.support", "message", MESSAGE); //3 - URI_MATCHER.addURI("com.enqualcomm.support", "message/#", MESSAGE_ITEM); //4 - URI_MATCHER.addURI("com.enqualcomm.support", "alarm", ALARM); //5 - URI_MATCHER.addURI("com.enqualcomm.support", "alarm/#", ALARM_ITEM); //6 - URI_MATCHER.addURI("com.enqualcomm.support", "silent", SILENT); //7 - URI_MATCHER.addURI("com.enqualcomm.support", "silent/#", SILENT_ITEM); //8 - URI_MATCHER.addURI("com.enqualcomm.support", "iKnowledge", IKNOWLEDGE); //9 - URI_MATCHER.addURI("com.enqualcomm.support", "urlDownloadPic", URLDOWNLOADPIC); //10 - URI_MATCHER.addURI("com.enqualcomm.support", "urlDownloadPic/#", URLDOWNLOADPIC_ITEM); //11 - URI_MATCHER.addURI("com.enqualcomm.support", "notice", NOTICE); //12 - URI_MATCHER.addURI("com.enqualcomm.support", "notice/#", NOTICE_ITEM); //13 - URI_MATCHER.addURI("com.enqualcomm.support", "weather", WEATHER); //14 - URI_MATCHER.addURI("com.enqualcomm.support", "deviceStatus", DEVICESTATUS); //15 - URI_MATCHER.addURI("com.enqualcomm.support", "downloadInfo", DOWNLOADINFO); //16 - URI_MATCHER.addURI("com.enqualcomm.support", "downloadInfo/#", DOWNLOADINFO_ITEM); //17 - URI_MATCHER.addURI("com.enqualcomm.support", "stheartRate", STHEART_RATE); //18 - URI_MATCHER.addURI("com.enqualcomm.support", "antioff", ANTIOFF); //19 - URI_MATCHER.addURI("com.enqualcomm.support", "antioff/#", ANTIOFF_ITEM); //20 - URI_MATCHER.addURI("com.enqualcomm.support", "unreadMsg", UNREADMSG); //21 - URI_MATCHER.addURI("com.enqualcomm.support", "sleepRecords", SLEEP_RECORDS); //22 - URI_MATCHER.addURI("com.enqualcomm.support", "sleepStatus", SLEEP_STATUS); //23 - URI_MATCHER.addURI("com.enqualcomm.support", "eventMessage", EVENT_MESSAGE); //24 - URI_MATCHER.addURI("com.enqualcomm.support", "sit", SIT); //25 - URI_MATCHER.addURI("com.enqualcomm.support", "alarmMSG", ALARM_MSG_RECORDS); //26 - URI_MATCHER.addURI("com.enqualcomm.support", "cmdRecord", PROTOCOL_CMD_RECORDS); //27 - - } - - private int bulkInsertLocale(String table, ContentValues[] paramArrayOfContentValues) { - this.db.beginTransaction(); - try { - int i = paramArrayOfContentValues.length; - for (byte b = 0; b < i; b++) { - long l = this.db.insert(table, null, paramArrayOfContentValues[b]); - if (l < 0L) - return 0; - } - this.db.setTransactionSuccessful(); - return paramArrayOfContentValues.length; - } finally { - this.db.endTransaction(); - } - } - - public int bulkInsert(Uri paramUri, ContentValues[] paramArrayOfContentValues) { - int i; - i=0; - switch (URI_MATCHER.match(paramUri)) { - case UNREADMSG: - i = bulkInsertLocale(UNREADMSG_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(UNREAD_MSG_URI, null); - break; - case ANTIOFF: - i = bulkInsertLocale(ANTIOFF_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(ANTIOFF_URI, null); - break; - case STHEART_RATE: - i = bulkInsertLocale(STHEART_RATE_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(STHEART_RATE_URL, null); - break; - case DOWNLOADINFO: - i = bulkInsertLocale(DOWNLOADINFO_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(DOWNLOADINFO_URL, null); - break; - case DEVICESTATUS: - i = bulkInsertLocale(DEVICESTATUS_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(DEVICESTATUS_URL, null); - break; - case WEATHER: - i = bulkInsertLocale(WEATHER_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(WEATHER_URL, null); - break; - case NOTICE: - i = bulkInsertLocale(NOTICE_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(NOTICE_URL, null); - break; - case URLDOWNLOADPIC: - i = bulkInsertLocale(URLDOWNLOADPIC_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(URLDOWNLOADPIC_URL, null); - break; - case IKNOWLEDGE: - i = bulkInsertLocale(IKNOWLEDGE_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(IKNOWLEDGE_URL, null); - break; - case SILENT: - i = bulkInsertLocale(SILENT_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(SILENT_URI, null); - break; - case ALARM: - i = bulkInsertLocale(ALARM_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(ALARM_URI, null); - break; - case MESSAGE: - i = bulkInsertLocale(MESSAGE_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(MESSAGE_URI, null); - break; - case CONTACT: - i = bulkInsertLocale(CONTACT_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(CONTACT_URI, null); - break; - - - case SLEEP_RECORDS: - i = bulkInsertLocale(SLEEP_RECORDS_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(SLEEP_RECORDS_URI, null); - break; - case SLEEP_STATUS: - i = bulkInsertLocale(SLEEP_STATUS_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(SLEEP_STATUS_URI, null); - break; - case EVENT_MESSAGE: - i = bulkInsertLocale(EVENT_MESSAGE_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(EVENT_MESSAGE_URI, null); - break; - case SIT: - i = bulkInsertLocale(SIT_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(SIT_URI, null); - break; - case ALARM_MSG_RECORDS: - i = bulkInsertLocale(ALARM_MSG_RECORDS_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(ALARM_MSG_RECORDS_URI, null); - break; - case PROTOCOL_CMD_RECORDS: - i = bulkInsertLocale(PROTOCOL_CMD_RECORDS_TABLE_NAME, paramArrayOfContentValues); - getContext().getContentResolver().notifyChange(PROTOCOL_CMD_RECORDS_URI, null); - break; - default: - break; - } - return i; - } - - public int delete(Uri paramUri, String whereClause, String[] whereArgs) { - long l; - int i=0,j; - StringBuilder stringBuilder; - SQLiteDatabase sQLiteDatabase; - - switch (URI_MATCHER.match(paramUri)) { - case UNREADMSG: - j = this.db.delete(UNREADMSG_TABLE_NAME, whereClause, whereArgs); - - if (j != 0) { - getContext().getContentResolver().notifyChange(UNREAD_MSG_URI, null); - } - i = j; - break; - case ANTIOFF_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.delete(ANTIOFF_TABLE_NAME, stringBuilder.toString(), null); - if (j != 0) { - getContext().getContentResolver().notifyChange(ANTIOFF_URI, null); - } - i = j; - break; - case ANTIOFF: - - j = this.db.delete(ANTIOFF_TABLE_NAME, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(ANTIOFF_URI, null); - - } - break; - case STHEART_RATE: - j = this.db.delete(STHEART_RATE_TABLE_NAME, whereClause, whereArgs); - - if (j != 0) { - getContext().getContentResolver().notifyChange(STHEART_RATE_URL, null); - - } - i = j; - break; - case DOWNLOADINFO_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.delete(DOWNLOADINFO_TABLE_NAME, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(DOWNLOADINFO_URL, null); - - } - break; - case DOWNLOADINFO: - j = this.db.delete(DOWNLOADINFO_TABLE_NAME, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(DOWNLOADINFO_URL, null); - - } - break; - case DEVICESTATUS: - j = this.db.delete(DEVICESTATUS_TABLE_NAME, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(DEVICESTATUS_URL, null); - - } - break; - case WEATHER: - j = this.db.delete(WEATHER_TABLE_NAME, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(WEATHER_URL, null); - - } - break; - case NOTICE_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.delete(NOTICE_TABLE_NAME, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(NOTICE_URL, null); - } - break; - case NOTICE: - j = this.db.delete(NOTICE_TABLE_NAME, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(NOTICE_URL, null); - - } - break; - case URLDOWNLOADPIC_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.delete(URLDOWNLOADPIC_TABLE_NAME, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(URLDOWNLOADPIC_URL, null); - - } - break; - case URLDOWNLOADPIC: - j = this.db.delete(URLDOWNLOADPIC_TABLE_NAME, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(URLDOWNLOADPIC_URL, null); - - } - break; - case IKNOWLEDGE: - j = this.db.delete(IKNOWLEDGE_TABLE_NAME, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(IKNOWLEDGE_URL, null); - - } - break; - case SILENT_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.delete(SILENT_TABLE_NAME, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(SILENT_URI, null); - - } - break; - case SILENT: - j = this.db.delete(SILENT_TABLE_NAME, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(SILENT_URI, null); - - } - break; - case ALARM_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.delete(ALARM_TABLE_NAME, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(ALARM_URI, null); - - } - break; - case ALARM: - j = this.db.delete(ALARM_TABLE_NAME, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(ALARM_URI, null); - - } - break; - case 4: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.delete(MESSAGE_TABLE_NAME, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(MESSAGE_URI, null); - - } - break; - case MESSAGE: - j = this.db.delete(MESSAGE_TABLE_NAME, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(MESSAGE_URI, null); - - } - break; - case CONTACT_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.delete(CONTACT_TABLE_NAME, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(CONTACT_URI, null); - - } - break; - case CONTACT: - - j = this.db.delete(CONTACT_TABLE_NAME, whereClause, whereArgs); - if (j != 0) { - getContext().getContentResolver().notifyChange(CONTACT_URI, null); - - } - i = j; - break; - case SLEEP_RECORDS: - - j = this.db.delete(SLEEP_RECORDS_TABLE_NAME, whereClause, whereArgs); - - if (j != 0) { - getContext().getContentResolver().notifyChange(SLEEP_RECORDS_URI, null); - - } - i = j; - break; - case SLEEP_STATUS: - - j = this.db.delete(SLEEP_STATUS_TABLE_NAME, whereClause, whereArgs); - - if (j != 0) { - getContext().getContentResolver().notifyChange(SLEEP_STATUS_URI, null); - - } - i = j; - break; - - - case EVENT_MESSAGE: - - j = this.db.delete(EVENT_MESSAGE_TABLE_NAME, whereClause, whereArgs); - - if (j != 0) { - getContext().getContentResolver().notifyChange(EVENT_MESSAGE_URI, null); - - } - i = j; - break; - case SIT: - - j = this.db.delete(SIT_TABLE_NAME, whereClause, whereArgs); - - if (j != 0) { - getContext().getContentResolver().notifyChange(SIT_URI, null); - - } - i = j; - break; - case ALARM_MSG_RECORDS: - - j = this.db.delete(ALARM_MSG_RECORDS_TABLE_NAME, whereClause, whereArgs); - - if (j != 0) { - getContext().getContentResolver().notifyChange(ALARM_MSG_RECORDS_URI, null); - - } - i = j; - break; - case PROTOCOL_CMD_RECORDS: - - j = this.db.delete(PROTOCOL_CMD_RECORDS_TABLE_NAME, whereClause, whereArgs); - - if (j != 0) { - getContext().getContentResolver().notifyChange(PROTOCOL_CMD_RECORDS_URI, null); - - } - i = j; - break; - default: - break; - } - return i; - } - - - public String getType(Uri paramUri) { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(paramUri); - stringBuilder.append("=="); - stringBuilder.append(URI_MATCHER.match(paramUri)); -// ICLogger.i(stringBuilder.toString()); - switch (URI_MATCHER.match(paramUri)) { - case UNREADMSG: - return UNREADMSG_MIME; - case ANTIOFF_ITEM: - return ANTIOFF_ITEM_MIME; - case ANTIOFF: - return ANTIOFF_MIME; - case STHEART_RATE: - return STHEART_RATE_MIME; - case DOWNLOADINFO_ITEM: - return DOWNLOADINFO_ITEM_MIME; - case DOWNLOADINFO: - return DOWNLOADINFO_MIME; - case DEVICESTATUS: - return DEVICESTATUS_MIME; - case WEATHER: - return WEATHER_MIME; - case NOTICE_ITEM: - return NOTICE_ITEM_MIME; - case NOTICE: - return NOTICE_MIME; - case URLDOWNLOADPIC_ITEM: - return URLDOWNLOADPIC_ITEM_MIME; - case URLDOWNLOADPIC: - return URLDOWNLOADPIC_MIME; - case IKNOWLEDGE: - return IKNOWLEDGE_MIME; - case SILENT_ITEM: - return SILENT_ITEM_MIME; - case SILENT: - return SILENT_MIME; - case ALARM_ITEM: - return ALARM_ITEM_MIME; - case ALARM: - return ALARM_MIME; - case MESSAGE_ITEM: - return MESSAGE_ITEM_MIME; - case MESSAGE: - return MESSAGE_MIME; - case CONTACT_ITEM: - return CONTACT_ITEM_MIME; - case CONTACT: - return CONTACT_MIME; - case SLEEP_RECORDS: - return SLEEP_RECORDS_MIME; - case SLEEP_STATUS: - return SLEEP_STATUS_MIME; - case EVENT_MESSAGE: - return EVENT_MESSAGE_MIME; - case SIT: - return SIT_MIME; - case ALARM_MSG_RECORDS: - return ALARM_MSG_RECORDS_MIME; - case PROTOCOL_CMD_RECORDS: - return PROTOCOL_CMD_RECORDS_MIME; - default: - return null; - } - - } - - public Uri insert(Uri paramUri, ContentValues paramContentValues) { - switch (URI_MATCHER.match(paramUri)) { - - case UNREADMSG: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(UNREADMSG_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(UNREAD_MSG_URI, null); - break; - case ANTIOFF: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(ANTIOFF_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(ANTIOFF_URI, null); - break; - case STHEART_RATE: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(STHEART_RATE_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(STHEART_RATE_URL, null); - break; - case DOWNLOADINFO: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(DOWNLOADINFO_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(DOWNLOADINFO_URL, null); - break; - case DEVICESTATUS: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(DEVICESTATUS_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(DEVICESTATUS_URL, null); - break; - case WEATHER: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(WEATHER_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(WEATHER_URL, null); - break; - case NOTICE: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(NOTICE_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(NOTICE_URL, null); - break; - case URLDOWNLOADPIC: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(URLDOWNLOADPIC_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(URLDOWNLOADPIC_URL, null); - break; - case IKNOWLEDGE: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(IKNOWLEDGE_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(IKNOWLEDGE_URL, null); - break; - case SILENT: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(SILENT_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(SILENT_URI, null); - break; - case ALARM: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(ALARM_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(ALARM_URI, null); - break; - case MESSAGE: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(MESSAGE_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(MESSAGE_URI, null); - break; - case CONTACT: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(CONTACT_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(CONTACT_URI, null); - break; - - case SLEEP_RECORDS: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(SLEEP_RECORDS_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(SLEEP_RECORDS_URI, null); - break; - case SLEEP_STATUS: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(SLEEP_STATUS_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(SLEEP_STATUS_URI, null); - break; - case EVENT_MESSAGE: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(EVENT_MESSAGE_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(EVENT_MESSAGE_URI, null); - break; - case SIT: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(SIT_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(SIT_URI, null); - break; - case ALARM_MSG_RECORDS: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(ALARM_MSG_RECORDS_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(ALARM_MSG_RECORDS_URI, null); - break; - case PROTOCOL_CMD_RECORDS: - paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(PROTOCOL_CMD_RECORDS_TABLE_NAME, null, paramContentValues)); - getContext().getContentResolver().notifyChange(PROTOCOL_CMD_RECORDS_URI, null); - break; - default: - return null; - } - - return paramUri; - } - - public boolean onCreate() { - this.db = (new MySqlitOpenHelper(getContext())).getWritableDatabase(); - return true; - } - - @Override - public Cursor query(Uri paramUri, String[] columns, String paramString1, String[] paramArrayOfString2, String paramString2) { - long l; - StringBuilder stringBuilder; - - SQLiteDatabase sQLiteDatabase; - sQLiteDatabase = this.db; - switch (URI_MATCHER.match(paramUri)) { - - case UNREADMSG: - return this.db.query(UNREADMSG_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case ANTIOFF_ITEM: - l = ContentUris.parseId(paramUri); - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - return sQLiteDatabase.query(ANTIOFF_TABLE_NAME, columns, paramString1.toString(), null, null, null, null); - case ANTIOFF: - return this.db.query(ANTIOFF_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case STHEART_RATE: - return this.db.query(STHEART_RATE_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case DOWNLOADINFO_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - return sQLiteDatabase.query(DOWNLOADINFO_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); - case DOWNLOADINFO: - return this.db.query(DOWNLOADINFO_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case DEVICESTATUS: - return this.db.query(DEVICESTATUS_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case WEATHER: - return this.db.query(WEATHER_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case NOTICE_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - return sQLiteDatabase.query(NOTICE_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); - case NOTICE: - return this.db.query(NOTICE_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case URLDOWNLOADPIC_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - return sQLiteDatabase.query(URLDOWNLOADPIC_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); - case URLDOWNLOADPIC: - return this.db.query(URLDOWNLOADPIC_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case IKNOWLEDGE: - return this.db.query(IKNOWLEDGE_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case SILENT_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - return sQLiteDatabase.query(SILENT_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); - case SILENT: - return this.db.query(SILENT_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case ALARM_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - return sQLiteDatabase.query(ALARM_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); - case ALARM: - return this.db.query(ALARM_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case 4: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - return sQLiteDatabase.query(MESSAGE_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); - case MESSAGE: - return this.db.query(MESSAGE_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case CONTACT_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - return sQLiteDatabase.query(CONTACT_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); - case CONTACT: - return this.db.query(CONTACT_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - - case SLEEP_RECORDS: - return this.db.query(SLEEP_RECORDS_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case SLEEP_STATUS: - return this.db.query(SLEEP_STATUS_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case EVENT_MESSAGE: - return this.db.query(EVENT_MESSAGE_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case SIT: - return this.db.query(SIT_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case ALARM_MSG_RECORDS: - return this.db.query(ALARM_MSG_RECORDS_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - case PROTOCOL_CMD_RECORDS: - return this.db.query(PROTOCOL_CMD_RECORDS_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); - default: - return null; - } - - } - @Override - public int update(Uri paramUri, ContentValues paramContentValues, String whereClause, String[] whereArgs) { - long l; - int i=0,j; - StringBuilder stringBuilder; - SQLiteDatabase sQLiteDatabase; - switch (URI_MATCHER.match(paramUri)) { - - case UNREADMSG: - j = this.db.update(UNREADMSG_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(UNREAD_MSG_URI, null); - return j; - } - return i; - case ANTIOFF_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.update(ANTIOFF_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(ANTIOFF_URI, null); - return j; - } - return i; - case ANTIOFF: - j = this.db.update(ANTIOFF_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(ANTIOFF_URI, null); - return j; - } - return i; - case STHEART_RATE: - j = this.db.update(STHEART_RATE_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(STHEART_RATE_URL, null); - return j; - } - return i; - case DOWNLOADINFO_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.update(DOWNLOADINFO_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(DOWNLOADINFO_URL, null); - return j; - } - return i; - case DOWNLOADINFO: - j = this.db.update(DOWNLOADINFO_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(DOWNLOADINFO_URL, null); - return j; - } - return i; - case DEVICESTATUS: - j = this.db.update(DEVICESTATUS_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(DEVICESTATUS_URL, null); - return j; - } - return i; - case WEATHER: - j = this.db.update(WEATHER_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(WEATHER_URL, null); - return j; - } - return i; - case NOTICE_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.update(NOTICE_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(NOTICE_URL, null); - return j; - } - return i; - case NOTICE: - j = this.db.update(NOTICE_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(NOTICE_URL, null); - return j; - } - return i; - case URLDOWNLOADPIC_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.update(URLDOWNLOADPIC_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(URLDOWNLOADPIC_URL, null); - return j; - } - return i; - case URLDOWNLOADPIC: - j = this.db.update(URLDOWNLOADPIC_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(URLDOWNLOADPIC_URL, null); - return j; - } - return i; - case IKNOWLEDGE: - j = this.db.update(IKNOWLEDGE_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(IKNOWLEDGE_URL, null); - return j; - } - return i; - case SILENT_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.update(SILENT_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(SILENT_URI, null); - return j; - } - return i; - case SILENT: - j = this.db.update(SILENT_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(SILENT_URI, null); - return j; - } - return i; - case ALARM_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.update(ALARM_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(ALARM_URI, null); - return j; - } - return i; - case ALARM: - j = this.db.update(ALARM_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(ALARM_URI, null); - return j; - } - return i; - case MESSAGE_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.update(MESSAGE_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(MESSAGE_URI, null); - return j; - } - return i; - case MESSAGE: - j = this.db.update(MESSAGE_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(MESSAGE_URI, null); - return j; - } - return i; - case CONTACT_ITEM: - l = ContentUris.parseId(paramUri); - sQLiteDatabase = this.db; - stringBuilder = new StringBuilder(); - stringBuilder.append("_id="); - stringBuilder.append(l); - j = sQLiteDatabase.update(CONTACT_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(CONTACT_URI, null); - return j; - } - return i; - case CONTACT: - - j = this.db.update(CONTACT_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(CONTACT_URI, null); - i = j; - } - - break; - - case SLEEP_RECORDS: - - j = this.db.update(SLEEP_RECORDS_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(SLEEP_RECORDS_URI, null); - i = j; - } - - break; - case SLEEP_STATUS: - - j = this.db.update(SLEEP_STATUS_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(SLEEP_STATUS_URI, null); - i = j; - } - - break; - case EVENT_MESSAGE: - - j = this.db.update(EVENT_MESSAGE_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(EVENT_MESSAGE_URI, null); - i = j; - } - - break; - case SIT: - - j = this.db.update(SIT_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(SIT_URI, null); - i = j; - } - - break; - case ALARM_MSG_RECORDS: - - j = this.db.update(ALARM_MSG_RECORDS_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(ALARM_MSG_RECORDS_URI, null); - i = j; - } - - break; - case PROTOCOL_CMD_RECORDS: - - j = this.db.update(PROTOCOL_CMD_RECORDS_TABLE_NAME, paramContentValues, whereClause, whereArgs); - i = j; - if (j != 0) { - getContext().getContentResolver().notifyChange(PROTOCOL_CMD_RECORDS_URI, null); - i = j; - } - - break; - default: - break; - } - return i; - } -} - - +package com.enqualcomm.support.provider; + +import android.content.ContentProvider; +import android.content.ContentUris; +import android.content.ContentValues; +import android.content.UriMatcher; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.net.Uri; + +import com.enqualcomm.support.MySqlitOpenHelper; + + +public class ICContentProvider extends ContentProvider { + private static final int ALARM = 5; + + private static final int ALARM_ITEM = 6; + + private static final String ALARM_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.alarm"; + + private static final String ALARM_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.alarm"; + + private static final String ALARM_TABLE_NAME = "ALARM"; + + public static final Uri ALARM_URI = Uri.parse("content://com.enqualcomm.support/alarm"); + + private static final int ANTIOFF = 19; + + private static final int ANTIOFF_ITEM = 20; + + private static final String ANTIOFF_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.antioff"; + + private static final String ANTIOFF_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.antioff"; + + private static final String ANTIOFF_TABLE_NAME = "ANTIOFF"; + + public static final Uri ANTIOFF_URI = Uri.parse("content://com.enqualcomm.support/antioff"); + + private static final int CONTACT = 1; + + private static final int CONTACT_ITEM = 2; + + private static final String CONTACT_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.contact"; + + private static final String CONTACT_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.contact"; + + private static final String CONTACT_TABLE_NAME = "CONTACT"; + + public static final Uri CONTACT_URI =Uri.parse("content://com.enqualcomm.support/contact"); + + private static final int DEVICESTATUS = 15; + + private static final String DEVICESTATUS_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.deviceStatus"; + + private static final String DEVICESTATUS_TABLE_NAME = "DEVICESTATUS"; + + public static final Uri DEVICESTATUS_URL = Uri.parse("content://com.enqualcomm.support/deviceStatus"); + + private static final int DOWNLOADINFO = 16; + + private static final int DOWNLOADINFO_ITEM = 17; + + private static final String DOWNLOADINFO_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.downloadInfo"; + + private static final String DOWNLOADINFO_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.downloadInfo"; + + private static final String DOWNLOADINFO_TABLE_NAME = "DOWNLOADINFO"; + + public static final Uri DOWNLOADINFO_URL = Uri .parse("content://com.enqualcomm.support/downloadInfo"); + + private static final int IKNOWLEDGE = 9; + + private static final String IKNOWLEDGE_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.iKnowledge"; + + private static final String IKNOWLEDGE_TABLE_NAME = "IKNOWLEDGE"; + + public static final Uri IKNOWLEDGE_URL = Uri.parse("content://com.enqualcomm.support/iKnowledge"); + + private static final int MESSAGE = 3; + + private static final int MESSAGE_ITEM = 4; + + private static final String MESSAGE_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.message"; + + private static final String MESSAGE_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.message"; + + private static final String MESSAGE_TABLE_NAME = "MESSAGE"; + + public static final Uri MESSAGE_URI = Uri.parse("content://com.enqualcomm.support/message"); + + private static final int NOTICE = 12; + + private static final int NOTICE_ITEM = 13; + + private static final String NOTICE_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.notice"; + + private static final String NOTICE_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.notice"; + + private static final String NOTICE_TABLE_NAME = "NOTICE"; + + public static final Uri NOTICE_URL = Uri.parse("content://com.enqualcomm.support/notice"); + + private static final int SILENT = 7; + + private static final int SILENT_ITEM = 8; + + private static final String SILENT_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.silent"; + + private static final String SILENT_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.silent"; + + private static final String SILENT_TABLE_NAME = "SILENT"; + + public static final Uri SILENT_URI = Uri.parse("content://com.enqualcomm.support/silent"); + + private static final int STHEART_RATE = 18; + + private static final String STHEART_RATE_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.stheartRate"; + + private static final String STHEART_RATE_TABLE_NAME = "STHEART_RATE"; + + public static final Uri STHEART_RATE_URL = Uri.parse("content://com.enqualcomm.support/stheartRate"); + + private static final int UNREADMSG = 21; + + private static final String UNREADMSG_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.unreadMsg"; + + private static final String UNREADMSG_TABLE_NAME = "UNREADMSG"; + + public static final Uri UNREAD_MSG_URI = Uri.parse("content://com.enqualcomm.support/unreadMsg"); + + private static final UriMatcher URI_MATCHER = new UriMatcher(-1); + + private static final int URLDOWNLOADPIC = 10; + + private static final int URLDOWNLOADPIC_ITEM = 11; + + private static final String URLDOWNLOADPIC_ITEM_MIME = "vnd.android.cursor.item/vnd.com.enqualcomm.support.urlDownloadPic"; + + private static final String URLDOWNLOADPIC_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.urlDownloadPic"; + + private static final String URLDOWNLOADPIC_TABLE_NAME = "URLDOWNLOADPIC"; + + public static final Uri URLDOWNLOADPIC_URL = Uri .parse("content://com.enqualcomm.support/urlDownloadPic"); + + private static final int WEATHER = 14; + + private static final String WEATHER_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.weather"; + + private static final String WEATHER_TABLE_NAME = "WEATHER"; + + public static final Uri WEATHER_URL = Uri.parse("content://com.enqualcomm.support/weather"); + + public static final String SLEEP_RECORDS_TABLE_NAME = "SLEEP_RECORDS"; + private static final int SLEEP_RECORDS = 22; + private static final String SLEEP_RECORDS_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.sleepRecords"; + public static final Uri SLEEP_RECORDS_URI = Uri.parse("content://com.enqualcomm.support/sleepRecords"); + + + public static final String SLEEP_STATUS_TABLE_NAME = "SLEEP_STATUS"; + private static final int SLEEP_STATUS = 23; + private static final String SLEEP_STATUS_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.sleepStatus"; + public static final Uri SLEEP_STATUS_URI = Uri.parse("content://com.enqualcomm.support/sleepStatus"); + + + public static final String EVENT_MESSAGE_TABLE_NAME = "EVENT_MESSAGE"; + private static final int EVENT_MESSAGE = 24; + private static final String EVENT_MESSAGE_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.eventMessage"; + public static final Uri EVENT_MESSAGE_URI = Uri.parse("content://com.enqualcomm.support/eventMessage"); + + public static final String SIT_TABLE_NAME = "SIT"; + private static final int SIT = 25; + private static final String SIT_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.sit"; + public static final Uri SIT_URI = Uri.parse("content://com.enqualcomm.support/sit"); + + public static final String ALARM_MSG_RECORDS_TABLE_NAME = "ALARM_MSG_RECORDS"; + private static final int ALARM_MSG_RECORDS = 26; + private static final String ALARM_MSG_RECORDS_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.alarmMSG"; + public static final Uri ALARM_MSG_RECORDS_URI = Uri.parse("content://com.enqualcomm.support/alarmMSG"); + + public static final String PROTOCOL_CMD_RECORDS_TABLE_NAME = "PROTOCOL_CMD_RECORDS"; + private static final int PROTOCOL_CMD_RECORDS = 27; + private static final String PROTOCOL_CMD_RECORDS_MIME = "vnd.android.cursor.dir/vnd.com.enqualcomm.support.cmdRecord"; + public static final Uri PROTOCOL_CMD_RECORDS_URI = Uri.parse("content://com.enqualcomm.support/cmdRecord"); + + private SQLiteDatabase db; + + static { + URI_MATCHER.addURI("com.enqualcomm.support", "contact", CONTACT); //1 + URI_MATCHER.addURI("com.enqualcomm.support", "contact/#", CONTACT_ITEM); //2 + URI_MATCHER.addURI("com.enqualcomm.support", "message", MESSAGE); //3 + URI_MATCHER.addURI("com.enqualcomm.support", "message/#", MESSAGE_ITEM); //4 + URI_MATCHER.addURI("com.enqualcomm.support", "alarm", ALARM); //5 + URI_MATCHER.addURI("com.enqualcomm.support", "alarm/#", ALARM_ITEM); //6 + URI_MATCHER.addURI("com.enqualcomm.support", "silent", SILENT); //7 + URI_MATCHER.addURI("com.enqualcomm.support", "silent/#", SILENT_ITEM); //8 + URI_MATCHER.addURI("com.enqualcomm.support", "iKnowledge", IKNOWLEDGE); //9 + URI_MATCHER.addURI("com.enqualcomm.support", "urlDownloadPic", URLDOWNLOADPIC); //10 + URI_MATCHER.addURI("com.enqualcomm.support", "urlDownloadPic/#", URLDOWNLOADPIC_ITEM); //11 + URI_MATCHER.addURI("com.enqualcomm.support", "notice", NOTICE); //12 + URI_MATCHER.addURI("com.enqualcomm.support", "notice/#", NOTICE_ITEM); //13 + URI_MATCHER.addURI("com.enqualcomm.support", "weather", WEATHER); //14 + URI_MATCHER.addURI("com.enqualcomm.support", "deviceStatus", DEVICESTATUS); //15 + URI_MATCHER.addURI("com.enqualcomm.support", "downloadInfo", DOWNLOADINFO); //16 + URI_MATCHER.addURI("com.enqualcomm.support", "downloadInfo/#", DOWNLOADINFO_ITEM); //17 + URI_MATCHER.addURI("com.enqualcomm.support", "stheartRate", STHEART_RATE); //18 + URI_MATCHER.addURI("com.enqualcomm.support", "antioff", ANTIOFF); //19 + URI_MATCHER.addURI("com.enqualcomm.support", "antioff/#", ANTIOFF_ITEM); //20 + URI_MATCHER.addURI("com.enqualcomm.support", "unreadMsg", UNREADMSG); //21 + URI_MATCHER.addURI("com.enqualcomm.support", "sleepRecords", SLEEP_RECORDS); //22 + URI_MATCHER.addURI("com.enqualcomm.support", "sleepStatus", SLEEP_STATUS); //23 + URI_MATCHER.addURI("com.enqualcomm.support", "eventMessage", EVENT_MESSAGE); //24 + URI_MATCHER.addURI("com.enqualcomm.support", "sit", SIT); //25 + URI_MATCHER.addURI("com.enqualcomm.support", "alarmMSG", ALARM_MSG_RECORDS); //26 + URI_MATCHER.addURI("com.enqualcomm.support", "cmdRecord", PROTOCOL_CMD_RECORDS); //27 + + } + + private int bulkInsertLocale(String table, ContentValues[] paramArrayOfContentValues) { + this.db.beginTransaction(); + try { + int i = paramArrayOfContentValues.length; + for (byte b = 0; b < i; b++) { + long l = this.db.insert(table, null, paramArrayOfContentValues[b]); + if (l < 0L) + return 0; + } + this.db.setTransactionSuccessful(); + return paramArrayOfContentValues.length; + } finally { + this.db.endTransaction(); + } + } + + public int bulkInsert(Uri paramUri, ContentValues[] paramArrayOfContentValues) { + int i; + i=0; + switch (URI_MATCHER.match(paramUri)) { + case UNREADMSG: + i = bulkInsertLocale(UNREADMSG_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(UNREAD_MSG_URI, null); + break; + case ANTIOFF: + i = bulkInsertLocale(ANTIOFF_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(ANTIOFF_URI, null); + break; + case STHEART_RATE: + i = bulkInsertLocale(STHEART_RATE_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(STHEART_RATE_URL, null); + break; + case DOWNLOADINFO: + i = bulkInsertLocale(DOWNLOADINFO_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(DOWNLOADINFO_URL, null); + break; + case DEVICESTATUS: + i = bulkInsertLocale(DEVICESTATUS_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(DEVICESTATUS_URL, null); + break; + case WEATHER: + i = bulkInsertLocale(WEATHER_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(WEATHER_URL, null); + break; + case NOTICE: + i = bulkInsertLocale(NOTICE_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(NOTICE_URL, null); + break; + case URLDOWNLOADPIC: + i = bulkInsertLocale(URLDOWNLOADPIC_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(URLDOWNLOADPIC_URL, null); + break; + case IKNOWLEDGE: + i = bulkInsertLocale(IKNOWLEDGE_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(IKNOWLEDGE_URL, null); + break; + case SILENT: + i = bulkInsertLocale(SILENT_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(SILENT_URI, null); + break; + case ALARM: + i = bulkInsertLocale(ALARM_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(ALARM_URI, null); + break; + case MESSAGE: + i = bulkInsertLocale(MESSAGE_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(MESSAGE_URI, null); + break; + case CONTACT: + i = bulkInsertLocale(CONTACT_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(CONTACT_URI, null); + break; + + + case SLEEP_RECORDS: + i = bulkInsertLocale(SLEEP_RECORDS_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(SLEEP_RECORDS_URI, null); + break; + case SLEEP_STATUS: + i = bulkInsertLocale(SLEEP_STATUS_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(SLEEP_STATUS_URI, null); + break; + case EVENT_MESSAGE: + i = bulkInsertLocale(EVENT_MESSAGE_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(EVENT_MESSAGE_URI, null); + break; + case SIT: + i = bulkInsertLocale(SIT_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(SIT_URI, null); + break; + case ALARM_MSG_RECORDS: + i = bulkInsertLocale(ALARM_MSG_RECORDS_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(ALARM_MSG_RECORDS_URI, null); + break; + case PROTOCOL_CMD_RECORDS: + i = bulkInsertLocale(PROTOCOL_CMD_RECORDS_TABLE_NAME, paramArrayOfContentValues); + getContext().getContentResolver().notifyChange(PROTOCOL_CMD_RECORDS_URI, null); + break; + default: + break; + } + return i; + } + + public int delete(Uri paramUri, String whereClause, String[] whereArgs) { + long l; + int i=0,j; + StringBuilder stringBuilder; + SQLiteDatabase sQLiteDatabase; + + switch (URI_MATCHER.match(paramUri)) { + case UNREADMSG: + j = this.db.delete(UNREADMSG_TABLE_NAME, whereClause, whereArgs); + + if (j != 0) { + getContext().getContentResolver().notifyChange(UNREAD_MSG_URI, null); + } + i = j; + break; + case ANTIOFF_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.delete(ANTIOFF_TABLE_NAME, stringBuilder.toString(), null); + if (j != 0) { + getContext().getContentResolver().notifyChange(ANTIOFF_URI, null); + } + i = j; + break; + case ANTIOFF: + + j = this.db.delete(ANTIOFF_TABLE_NAME, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(ANTIOFF_URI, null); + + } + break; + case STHEART_RATE: + j = this.db.delete(STHEART_RATE_TABLE_NAME, whereClause, whereArgs); + + if (j != 0) { + getContext().getContentResolver().notifyChange(STHEART_RATE_URL, null); + + } + i = j; + break; + case DOWNLOADINFO_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.delete(DOWNLOADINFO_TABLE_NAME, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(DOWNLOADINFO_URL, null); + + } + break; + case DOWNLOADINFO: + j = this.db.delete(DOWNLOADINFO_TABLE_NAME, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(DOWNLOADINFO_URL, null); + + } + break; + case DEVICESTATUS: + j = this.db.delete(DEVICESTATUS_TABLE_NAME, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(DEVICESTATUS_URL, null); + + } + break; + case WEATHER: + j = this.db.delete(WEATHER_TABLE_NAME, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(WEATHER_URL, null); + + } + break; + case NOTICE_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.delete(NOTICE_TABLE_NAME, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(NOTICE_URL, null); + } + break; + case NOTICE: + j = this.db.delete(NOTICE_TABLE_NAME, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(NOTICE_URL, null); + + } + break; + case URLDOWNLOADPIC_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.delete(URLDOWNLOADPIC_TABLE_NAME, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(URLDOWNLOADPIC_URL, null); + + } + break; + case URLDOWNLOADPIC: + j = this.db.delete(URLDOWNLOADPIC_TABLE_NAME, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(URLDOWNLOADPIC_URL, null); + + } + break; + case IKNOWLEDGE: + j = this.db.delete(IKNOWLEDGE_TABLE_NAME, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(IKNOWLEDGE_URL, null); + + } + break; + case SILENT_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.delete(SILENT_TABLE_NAME, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(SILENT_URI, null); + + } + break; + case SILENT: + j = this.db.delete(SILENT_TABLE_NAME, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(SILENT_URI, null); + + } + break; + case ALARM_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.delete(ALARM_TABLE_NAME, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(ALARM_URI, null); + + } + break; + case ALARM: + j = this.db.delete(ALARM_TABLE_NAME, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(ALARM_URI, null); + + } + break; + case 4: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.delete(MESSAGE_TABLE_NAME, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(MESSAGE_URI, null); + + } + break; + case MESSAGE: + j = this.db.delete(MESSAGE_TABLE_NAME, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(MESSAGE_URI, null); + + } + break; + case CONTACT_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.delete(CONTACT_TABLE_NAME, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(CONTACT_URI, null); + + } + break; + case CONTACT: + + j = this.db.delete(CONTACT_TABLE_NAME, whereClause, whereArgs); + if (j != 0) { + getContext().getContentResolver().notifyChange(CONTACT_URI, null); + + } + i = j; + break; + case SLEEP_RECORDS: + + j = this.db.delete(SLEEP_RECORDS_TABLE_NAME, whereClause, whereArgs); + + if (j != 0) { + getContext().getContentResolver().notifyChange(SLEEP_RECORDS_URI, null); + + } + i = j; + break; + case SLEEP_STATUS: + + j = this.db.delete(SLEEP_STATUS_TABLE_NAME, whereClause, whereArgs); + + if (j != 0) { + getContext().getContentResolver().notifyChange(SLEEP_STATUS_URI, null); + + } + i = j; + break; + + + case EVENT_MESSAGE: + + j = this.db.delete(EVENT_MESSAGE_TABLE_NAME, whereClause, whereArgs); + + if (j != 0) { + getContext().getContentResolver().notifyChange(EVENT_MESSAGE_URI, null); + + } + i = j; + break; + case SIT: + + j = this.db.delete(SIT_TABLE_NAME, whereClause, whereArgs); + + if (j != 0) { + getContext().getContentResolver().notifyChange(SIT_URI, null); + + } + i = j; + break; + case ALARM_MSG_RECORDS: + + j = this.db.delete(ALARM_MSG_RECORDS_TABLE_NAME, whereClause, whereArgs); + + if (j != 0) { + getContext().getContentResolver().notifyChange(ALARM_MSG_RECORDS_URI, null); + + } + i = j; + break; + case PROTOCOL_CMD_RECORDS: + + j = this.db.delete(PROTOCOL_CMD_RECORDS_TABLE_NAME, whereClause, whereArgs); + + if (j != 0) { + getContext().getContentResolver().notifyChange(PROTOCOL_CMD_RECORDS_URI, null); + + } + i = j; + break; + default: + break; + } + return i; + } + + + public String getType(Uri paramUri) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(paramUri); + stringBuilder.append("=="); + stringBuilder.append(URI_MATCHER.match(paramUri)); +// ICLogger.i(stringBuilder.toString()); + switch (URI_MATCHER.match(paramUri)) { + case UNREADMSG: + return UNREADMSG_MIME; + case ANTIOFF_ITEM: + return ANTIOFF_ITEM_MIME; + case ANTIOFF: + return ANTIOFF_MIME; + case STHEART_RATE: + return STHEART_RATE_MIME; + case DOWNLOADINFO_ITEM: + return DOWNLOADINFO_ITEM_MIME; + case DOWNLOADINFO: + return DOWNLOADINFO_MIME; + case DEVICESTATUS: + return DEVICESTATUS_MIME; + case WEATHER: + return WEATHER_MIME; + case NOTICE_ITEM: + return NOTICE_ITEM_MIME; + case NOTICE: + return NOTICE_MIME; + case URLDOWNLOADPIC_ITEM: + return URLDOWNLOADPIC_ITEM_MIME; + case URLDOWNLOADPIC: + return URLDOWNLOADPIC_MIME; + case IKNOWLEDGE: + return IKNOWLEDGE_MIME; + case SILENT_ITEM: + return SILENT_ITEM_MIME; + case SILENT: + return SILENT_MIME; + case ALARM_ITEM: + return ALARM_ITEM_MIME; + case ALARM: + return ALARM_MIME; + case MESSAGE_ITEM: + return MESSAGE_ITEM_MIME; + case MESSAGE: + return MESSAGE_MIME; + case CONTACT_ITEM: + return CONTACT_ITEM_MIME; + case CONTACT: + return CONTACT_MIME; + case SLEEP_RECORDS: + return SLEEP_RECORDS_MIME; + case SLEEP_STATUS: + return SLEEP_STATUS_MIME; + case EVENT_MESSAGE: + return EVENT_MESSAGE_MIME; + case SIT: + return SIT_MIME; + case ALARM_MSG_RECORDS: + return ALARM_MSG_RECORDS_MIME; + case PROTOCOL_CMD_RECORDS: + return PROTOCOL_CMD_RECORDS_MIME; + default: + return null; + } + + } + + public Uri insert(Uri paramUri, ContentValues paramContentValues) { + switch (URI_MATCHER.match(paramUri)) { + + case UNREADMSG: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(UNREADMSG_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(UNREAD_MSG_URI, null); + break; + case ANTIOFF: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(ANTIOFF_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(ANTIOFF_URI, null); + break; + case STHEART_RATE: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(STHEART_RATE_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(STHEART_RATE_URL, null); + break; + case DOWNLOADINFO: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(DOWNLOADINFO_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(DOWNLOADINFO_URL, null); + break; + case DEVICESTATUS: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(DEVICESTATUS_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(DEVICESTATUS_URL, null); + break; + case WEATHER: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(WEATHER_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(WEATHER_URL, null); + break; + case NOTICE: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(NOTICE_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(NOTICE_URL, null); + break; + case URLDOWNLOADPIC: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(URLDOWNLOADPIC_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(URLDOWNLOADPIC_URL, null); + break; + case IKNOWLEDGE: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(IKNOWLEDGE_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(IKNOWLEDGE_URL, null); + break; + case SILENT: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(SILENT_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(SILENT_URI, null); + break; + case ALARM: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(ALARM_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(ALARM_URI, null); + break; + case MESSAGE: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(MESSAGE_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(MESSAGE_URI, null); + break; + case CONTACT: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(CONTACT_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(CONTACT_URI, null); + break; + + case SLEEP_RECORDS: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(SLEEP_RECORDS_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(SLEEP_RECORDS_URI, null); + break; + case SLEEP_STATUS: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(SLEEP_STATUS_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(SLEEP_STATUS_URI, null); + break; + case EVENT_MESSAGE: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(EVENT_MESSAGE_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(EVENT_MESSAGE_URI, null); + break; + case SIT: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(SIT_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(SIT_URI, null); + break; + case ALARM_MSG_RECORDS: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(ALARM_MSG_RECORDS_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(ALARM_MSG_RECORDS_URI, null); + break; + case PROTOCOL_CMD_RECORDS: + paramUri = ContentUris.withAppendedId(paramUri, this.db.insert(PROTOCOL_CMD_RECORDS_TABLE_NAME, null, paramContentValues)); + getContext().getContentResolver().notifyChange(PROTOCOL_CMD_RECORDS_URI, null); + break; + default: + return null; + } + + return paramUri; + } + + public boolean onCreate() { + this.db = (new MySqlitOpenHelper(getContext())).getWritableDatabase(); + return true; + } + + @Override + public Cursor query(Uri paramUri, String[] columns, String paramString1, String[] paramArrayOfString2, String paramString2) { + long l; + StringBuilder stringBuilder; + + SQLiteDatabase sQLiteDatabase; + sQLiteDatabase = this.db; + switch (URI_MATCHER.match(paramUri)) { + + case UNREADMSG: + return this.db.query(UNREADMSG_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case ANTIOFF_ITEM: + l = ContentUris.parseId(paramUri); + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + return sQLiteDatabase.query(ANTIOFF_TABLE_NAME, columns, paramString1.toString(), null, null, null, null); + case ANTIOFF: + return this.db.query(ANTIOFF_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case STHEART_RATE: + return this.db.query(STHEART_RATE_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case DOWNLOADINFO_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + return sQLiteDatabase.query(DOWNLOADINFO_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); + case DOWNLOADINFO: + return this.db.query(DOWNLOADINFO_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case DEVICESTATUS: + return this.db.query(DEVICESTATUS_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case WEATHER: + return this.db.query(WEATHER_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case NOTICE_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + return sQLiteDatabase.query(NOTICE_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); + case NOTICE: + return this.db.query(NOTICE_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case URLDOWNLOADPIC_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + return sQLiteDatabase.query(URLDOWNLOADPIC_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); + case URLDOWNLOADPIC: + return this.db.query(URLDOWNLOADPIC_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case IKNOWLEDGE: + return this.db.query(IKNOWLEDGE_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case SILENT_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + return sQLiteDatabase.query(SILENT_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); + case SILENT: + return this.db.query(SILENT_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case ALARM_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + return sQLiteDatabase.query(ALARM_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); + case ALARM: + return this.db.query(ALARM_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case 4: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + return sQLiteDatabase.query(MESSAGE_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); + case MESSAGE: + return this.db.query(MESSAGE_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case CONTACT_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + return sQLiteDatabase.query(CONTACT_TABLE_NAME, columns, stringBuilder.toString(), null, null, null, null); + case CONTACT: + return this.db.query(CONTACT_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + + case SLEEP_RECORDS: + return this.db.query(SLEEP_RECORDS_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case SLEEP_STATUS: + return this.db.query(SLEEP_STATUS_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case EVENT_MESSAGE: + return this.db.query(EVENT_MESSAGE_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case SIT: + return this.db.query(SIT_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case ALARM_MSG_RECORDS: + return this.db.query(ALARM_MSG_RECORDS_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + case PROTOCOL_CMD_RECORDS: + return this.db.query(PROTOCOL_CMD_RECORDS_TABLE_NAME, columns, paramString1, paramArrayOfString2, null, null, paramString2); + default: + return null; + } + + } + @Override + public int update(Uri paramUri, ContentValues paramContentValues, String whereClause, String[] whereArgs) { + long l; + int i=0,j; + StringBuilder stringBuilder; + SQLiteDatabase sQLiteDatabase; + switch (URI_MATCHER.match(paramUri)) { + + case UNREADMSG: + j = this.db.update(UNREADMSG_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(UNREAD_MSG_URI, null); + return j; + } + return i; + case ANTIOFF_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.update(ANTIOFF_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(ANTIOFF_URI, null); + return j; + } + return i; + case ANTIOFF: + j = this.db.update(ANTIOFF_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(ANTIOFF_URI, null); + return j; + } + return i; + case STHEART_RATE: + j = this.db.update(STHEART_RATE_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(STHEART_RATE_URL, null); + return j; + } + return i; + case DOWNLOADINFO_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.update(DOWNLOADINFO_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(DOWNLOADINFO_URL, null); + return j; + } + return i; + case DOWNLOADINFO: + j = this.db.update(DOWNLOADINFO_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(DOWNLOADINFO_URL, null); + return j; + } + return i; + case DEVICESTATUS: + j = this.db.update(DEVICESTATUS_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(DEVICESTATUS_URL, null); + return j; + } + return i; + case WEATHER: + j = this.db.update(WEATHER_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(WEATHER_URL, null); + return j; + } + return i; + case NOTICE_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.update(NOTICE_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(NOTICE_URL, null); + return j; + } + return i; + case NOTICE: + j = this.db.update(NOTICE_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(NOTICE_URL, null); + return j; + } + return i; + case URLDOWNLOADPIC_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.update(URLDOWNLOADPIC_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(URLDOWNLOADPIC_URL, null); + return j; + } + return i; + case URLDOWNLOADPIC: + j = this.db.update(URLDOWNLOADPIC_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(URLDOWNLOADPIC_URL, null); + return j; + } + return i; + case IKNOWLEDGE: + j = this.db.update(IKNOWLEDGE_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(IKNOWLEDGE_URL, null); + return j; + } + return i; + case SILENT_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.update(SILENT_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(SILENT_URI, null); + return j; + } + return i; + case SILENT: + j = this.db.update(SILENT_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(SILENT_URI, null); + return j; + } + return i; + case ALARM_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.update(ALARM_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(ALARM_URI, null); + return j; + } + return i; + case ALARM: + j = this.db.update(ALARM_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(ALARM_URI, null); + return j; + } + return i; + case MESSAGE_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.update(MESSAGE_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(MESSAGE_URI, null); + return j; + } + return i; + case MESSAGE: + j = this.db.update(MESSAGE_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(MESSAGE_URI, null); + return j; + } + return i; + case CONTACT_ITEM: + l = ContentUris.parseId(paramUri); + sQLiteDatabase = this.db; + stringBuilder = new StringBuilder(); + stringBuilder.append("_id="); + stringBuilder.append(l); + j = sQLiteDatabase.update(CONTACT_TABLE_NAME, paramContentValues, stringBuilder.toString(), null); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(CONTACT_URI, null); + return j; + } + return i; + case CONTACT: + + j = this.db.update(CONTACT_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(CONTACT_URI, null); + i = j; + } + + break; + + case SLEEP_RECORDS: + + j = this.db.update(SLEEP_RECORDS_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(SLEEP_RECORDS_URI, null); + i = j; + } + + break; + case SLEEP_STATUS: + + j = this.db.update(SLEEP_STATUS_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(SLEEP_STATUS_URI, null); + i = j; + } + + break; + case EVENT_MESSAGE: + + j = this.db.update(EVENT_MESSAGE_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(EVENT_MESSAGE_URI, null); + i = j; + } + + break; + case SIT: + + j = this.db.update(SIT_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(SIT_URI, null); + i = j; + } + + break; + case ALARM_MSG_RECORDS: + + j = this.db.update(ALARM_MSG_RECORDS_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(ALARM_MSG_RECORDS_URI, null); + i = j; + } + + break; + case PROTOCOL_CMD_RECORDS: + + j = this.db.update(PROTOCOL_CMD_RECORDS_TABLE_NAME, paramContentValues, whereClause, whereArgs); + i = j; + if (j != 0) { + getContext().getContentResolver().notifyChange(PROTOCOL_CMD_RECORDS_URI, null); + i = j; + } + + break; + default: + break; + } + return i; + } +} + + diff --git a/app/src/main/java/com/enqualcomm/support/service/Initialize.java b/app/src/main/java/com/enqualcomm/support/service/Initialize.java index 9cd1b7f0..7b1adca7 100644 --- a/app/src/main/java/com/enqualcomm/support/service/Initialize.java +++ b/app/src/main/java/com/enqualcomm/support/service/Initialize.java @@ -3,7 +3,7 @@ package com.enqualcomm.support.service; import android.database.Cursor; import com.enqualcomm.support.Config; -import com.enqualcomm.support.ICContentProvider; +import com.enqualcomm.support.provider.ICContentProvider; import com.ic.protocols.protocolAPIHelper; import com.enqualcomm.support.bean.StringMessage; import com.enqualcomm.support.service.base.AbstractConnectionService; diff --git a/app/src/main/java/com/enqualcomm/support/service/SilentManager.java b/app/src/main/java/com/enqualcomm/support/service/SilentManager.java index ec325288..38572998 100644 --- a/app/src/main/java/com/enqualcomm/support/service/SilentManager.java +++ b/app/src/main/java/com/enqualcomm/support/service/SilentManager.java @@ -17,7 +17,7 @@ import android.telephony.TelephonyManager; import com.enqualcomm.support.Config; import com.enqualcomm.support.CoreService; -import com.enqualcomm.support.ICContentProvider; +import com.enqualcomm.support.provider.ICContentProvider; import com.enqualcomm.support.bean.Alarm; import com.enqualcomm.support.bean.Antioff; import com.enqualcomm.support.bean.EventLooperHandlerThread; diff --git a/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java b/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java index f8c9f7a7..51a7b350 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java @@ -15,7 +15,7 @@ import android.os.HandlerThread; import android.telephony.TelephonyManager; import com.enqualcomm.support.Config; -import com.enqualcomm.support.ICContentProvider; +import com.enqualcomm.support.provider.ICContentProvider; import com.enqualcomm.support.R; import com.enqualcomm.support.bean.Alarm; import com.enqualcomm.support.bean.NoticeContent; diff --git a/app/src/main/java/com/enqualcomm/support/utils/DBHelper.java b/app/src/main/java/com/enqualcomm/support/utils/DBHelper.java index 619f1f59..124cec62 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/DBHelper.java +++ b/app/src/main/java/com/enqualcomm/support/utils/DBHelper.java @@ -16,7 +16,7 @@ import android.provider.ContactsContract.Data; import android.provider.ContactsContract.RawContacts; import com.enqualcomm.support.Config; -import com.enqualcomm.support.ICContentProvider; +import com.enqualcomm.support.provider.ICContentProvider; import com.enqualcomm.support.bean.Alarm; import com.enqualcomm.support.bean.Antioff; import com.enqualcomm.support.bean.Contact; @@ -50,9 +50,9 @@ public class DBHelper { private Handler mHandler;//=new Handler(EventLooperHandlerThread.makeLooper(DBHelper.class.getSimpleName())); // private Handler mHandler=new Handler(); - public DBHelper(ContentResolver var1, Context var2) { - this.cr = var1; - this.context = var2; + public DBHelper(ContentResolver cr, Context ct) { + this.cr = cr; + this.context = ct; HandlerThread handlerThread = new HandlerThread("ic:db-handler-thread"); handlerThread.start(); mHandler = new Handler(handlerThread.getLooper()); @@ -175,12 +175,11 @@ public class DBHelper { this.deleteAllContact(contactArray, where.toString(), this.cr); int contactCount = contactArray.size(); if (contactCount != 0) { - ContentValues[] contentlist = new ContentValues[contactCount]; - + ContentValues[] contentList = new ContentValues[contactCount]; for (int i = 0; i < contactCount; ++i) { Contact contact = (Contact) contactArray.get(i); ContentValues contentValues = new ContentValues(); - contentlist[i] = contentValues; + contentList[i] = contentValues; contentValues.put("CATEGORY", contact.category); contentValues.put("NAME", contact.name); contentValues.put("NUMBER", contact.number); @@ -191,9 +190,8 @@ public class DBHelper { log1.append(contact.toString()); ICLogger.i(log1.toString()); } - - int rows=this.cr.bulkInsert(ICContentProvider.CONTACT_URI, contentlist); - ICLogger.i("Create rows "+rows); + int rows = this.cr.bulkInsert(ICContentProvider.CONTACT_URI, contentList); + ICLogger.i("Create rows " + rows); this.addAllContact(contactArray, this.cr); } @@ -725,10 +723,10 @@ public class DBHelper { } try { - long currenttime = SystemClock.elapsedRealtime(); - if (currenttime - lastUpdateTime > 1000L) { + long currentTime = SystemClock.elapsedRealtime(); + if (currentTime - lastUpdateTime > 1000L) { this.saveContactsImpl(contactArray, admin, care, call, partner, video, sos); - lastUpdateTime = currenttime; + lastUpdateTime = currentTime; } else { mHandler.postDelayed(new Runnable() { @Override diff --git a/app/src/main/java/com/enqualcomm/support/utils/GetContact.java b/app/src/main/java/com/enqualcomm/support/utils/GetContact.java index 942d5ca5..e7c5984e 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/GetContact.java +++ b/app/src/main/java/com/enqualcomm/support/utils/GetContact.java @@ -2,7 +2,7 @@ package com.enqualcomm.support.utils; import android.content.Context; import android.database.Cursor; -import com.enqualcomm.support.ICContentProvider; +import com.enqualcomm.support.provider.ICContentProvider; import com.enqualcomm.support.bean.Contact; import rx.Observable; import rx.Subscriber; diff --git a/app/src/main/java/com/ic/protocols/protocol_fzd.java b/app/src/main/java/com/ic/protocols/protocol_fzd.java index eecf4633..2b9ad14d 100644 --- a/app/src/main/java/com/ic/protocols/protocol_fzd.java +++ b/app/src/main/java/com/ic/protocols/protocol_fzd.java @@ -11,6 +11,7 @@ import android.text.TextUtils; import com.enqualcomm.support.Config; import com.enqualcomm.support.CoreService; import com.enqualcomm.support.IFZDCallback; +import com.enqualcomm.support.bean.BaiRuiMember; import com.enqualcomm.support.bean.Contact; import com.enqualcomm.support.bean.HealthInfo; import com.enqualcomm.support.bean.Runtime; @@ -27,6 +28,7 @@ import com.enqualcomm.support.utils.regexUtil; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.List; import static com.enqualcomm.support.Constants.FROM_SERVER; import static com.enqualcomm.support.LocationClient.LOCATION_MODE; @@ -1109,6 +1111,20 @@ public class protocol_fzd { ICLogger.d("members result == > " + s); //对数据进行切割 String[] split = data.split(CMDSPLIT); + //每3个为一组 + if (split.length % 3 != 0) { + ICLogger.d("数据出错 == > " + s); + } else { + List baiRuiMembers = new ArrayList<>(); + for (int i = 0; i < split.length; i += 3) { + BaiRuiMember temp = new BaiRuiMember(); + temp.setBairuiId(Integer.parseInt(split[i])); + temp.setName(split[i + 1]); + temp.setPhoneNum(split[i + 2]); + baiRuiMembers.add(temp); + } + //结果有了,保存到内容提供者里头去. + } } } -- 2.17.1