<activity android:name=".toolActivity" />
<activity android:name=".GPSActivity" />
<activity android:name=".DeviceInfoActivity" />
- <activity android:name=".MainActivity"
+ <activity
+ android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
android:authorities="com.ic.ai.info"
android:exported="true" />
+ <provider
+ android:name=".provider.WarningItemProvider"
+ android:authorities="com.ic.warning.msg"
+ android:exported="true" />
+
+ <provider
+ android:name=".provider.WebSmsProvider"
+ android:authorities="com.ic.web.sms"
+ android:exported="true" />
+
+
</application>
</manifest>
\ No newline at end of file
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
-import com.enqualcomm.support.utils.ICLogger;
-
/**
* 音视频通话,通讯录列表
*/
writableDatabase.delete(ICDatabaseHelper.tMembers, ICDatabaseHelper.mId + "=?", new String[]{
values.getAsString(ICDatabaseHelper.mId)
});
- ICLogger.d("values == > " + values.size());
- int size = values.size();
long insert = writableDatabase.insert(ICDatabaseHelper.tMembers, null, values);
- writableDatabase.close();
getContext().getContentResolver().notifyChange(uri, null);
return Uri.parse(AUTHORITY + "/" + PATH + "/" + insert);
}
if (match == MATH_CODE_TABLE) {
SQLiteDatabase writableDatabase = mDatabase.getWritableDatabase();
int delete = writableDatabase.delete(ICDatabaseHelper.tMembers, selection, selectionArgs);
- writableDatabase.close();
return delete;
}
return 0;
import android.content.ContentProvider;
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 WarningItemProvider extends ContentProvider {
+
+ public static final String PATH = "record";
+ //com.ic.warning.msg
+ public static final String AUTHORITY = "com.ic.warning.msg";
+ public static final String WARNING_MSG = "content://" + AUTHORITY + "/" + PATH;
+
+
+ private static UriMatcher sUriMatcher;
+
+ private static final int MATH_CODE_TABLE = 1;
+
+
+ static {
+ sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
+ sUriMatcher.addURI(AUTHORITY, PATH, MATH_CODE_TABLE);
+ }
+
+
+ private ICDatabaseHelper mDatabase;
+
+
@Override
public boolean onCreate() {
+ mDatabase = new ICDatabaseHelper(getContext());
return false;
}
@Nullable
@Override
- public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
+ public Cursor query(@NonNull Uri uri, @Nullable String[] projection,
+ @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
+ //查询警告消息列表
+ //匹配规则
+ int match = sUriMatcher.match(uri);
+ SQLiteDatabase readableDatabase = mDatabase.getReadableDatabase();
+ if (match == MATH_CODE_TABLE) {
+ return readableDatabase.query(ICDatabaseHelper.tb_warning_msg,
+ projection,
+ selection,
+ selectionArgs,
+ null, null, sortOrder);
+ }
return null;
}
@Nullable
@Override
public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {
+ //插入数据
+ int match = sUriMatcher.match(uri);
+ SQLiteDatabase readableDatabase = mDatabase.getReadableDatabase();
+ if (match == MATH_CODE_TABLE) {
+ long insert = readableDatabase.insert(ICDatabaseHelper.tb_warning_msg, null, values);
+ //通知UI更新
+ getContext().getContentResolver().notifyChange(uri, null);
+ return Uri.parse(AUTHORITY + "/" + PATH + "/" + insert);
+ }
return null;
}
@Override
- public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
+ public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[]
+ selectionArgs) {
+ int match = sUriMatcher.match(uri);
+ if (match == MATH_CODE_TABLE) {
+ SQLiteDatabase writableDatabase = mDatabase.getWritableDatabase();
+ return writableDatabase.delete(ICDatabaseHelper.tb_warning_msg, selection, selectionArgs);
+ }
return 0;
}
@Override
- public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) {
+ public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String
+ selection, @Nullable String[] selectionArgs) {
+ int match = sUriMatcher.match(uri);
+ if (match == MATH_CODE_TABLE) {
+ SQLiteDatabase writableDatabase = mDatabase.getWritableDatabase();
+ int update = writableDatabase.update(ICDatabaseHelper.tb_warning_msg,
+ values, selection, selectionArgs);
+ writableDatabase.close();
+ return update;
+ }
return 0;
}
}