@Override
public long insertAndCheck(SQLiteDatabase db, ContentValues values) {
if (mExistingItems.size() >= mRequiredSize) {
// No need to add more items.
return 0;
}
Intent intent;
try {
intent = Intent.parseUri(values.getAsString(Favorites.INTENT), 0);
} catch (URISyntaxException e) {
return 0;
}
String pkg = getPackage(intent);
if (pkg == null || mExisitingApps.contains(pkg)) {
// The item does not target an app or is already in hotseat.
return 0;
}
mExisitingApps.add(pkg);
// find next vacant spot.
long screen = 0;
while (mExistingItems.get(screen) != null) {
screen++;
}
mExistingItems.put(screen, intent);
values.put(Favorites.SCREEN, screen);
mOutOps.add(ContentProviderOperation.newInsert(Favorites.CONTENT_URI).withValues(values).build());
return 0;
}
ImportDataTask.java 文件源码
java
阅读 42
收藏 0
点赞 0
评论 0
项目:LaunchEnr
作者:
评论列表
文章目录