当前位置: 首页>>代码示例>>Java>>正文


Java Utils.parseCommaSeparatedString方法代码示例

本文整理汇总了Java中org.fdroid.fdroid.Utils.parseCommaSeparatedString方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.parseCommaSeparatedString方法的具体用法?Java Utils.parseCommaSeparatedString怎么用?Java Utils.parseCommaSeparatedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.fdroid.fdroid.Utils的用法示例。


在下文中一共展示了Utils.parseCommaSeparatedString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: insert

import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
@Override
public Uri insert(Uri uri, ContentValues values) {
    boolean saveAntiFeatures = false;
    String[] antiFeatures = null;
    if (values.containsKey(Cols.AntiFeatures.ANTI_FEATURES)) {
        saveAntiFeatures = true;
        String antiFeaturesString = values.getAsString(Cols.AntiFeatures.ANTI_FEATURES);
        antiFeatures = Utils.parseCommaSeparatedString(antiFeaturesString);
        values.remove(Cols.AntiFeatures.ANTI_FEATURES);
    }

    removeFieldsFromOtherTables(values);
    validateFields(Cols.ALL, values);
    long newId = db().insertOrThrow(getTableName(), null, values);

    if (saveAntiFeatures) {
        ensureAntiFeatures(antiFeatures, newId);
    }

    if (!isApplyingBatch()) {
        getContext().getContentResolver().notifyChange(uri, null);
    }
    return getApkUri(newId);
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:25,代码来源:ApkProvider.java

示例2: insert

import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
@Override
public Uri insert(Uri uri, ContentValues values) {
    long packageId = PackageProvider.Helper.ensureExists(getContext(), values.getAsString(Cols.Package.PACKAGE_NAME));
    values.remove(Cols.Package.PACKAGE_NAME);
    values.put(Cols.PACKAGE_ID, packageId);

    if (!values.containsKey(Cols.DESCRIPTION) || values.getAsString(Cols.DESCRIPTION) == null) {
        // the current structure assumes that description is always present and non-null
        values.put(Cols.DESCRIPTION, "");
    }

    String[] categories = null;
    boolean saveCategories = false;
    if (values.containsKey(Cols.ForWriting.Categories.CATEGORIES)) {
        // Hold onto these categories, so that after we have an ID to reference the newly inserted
        // app metadata we can then specify its categories.
        saveCategories = true;
        categories = Utils.parseCommaSeparatedString(values.getAsString(Cols.ForWriting.Categories.CATEGORIES));
        values.remove(Cols.ForWriting.Categories.CATEGORIES);
    }

    long appMetadataId = db().insertOrThrow(getTableName(), null, values);
    if (!isApplyingBatch()) {
        getContext().getContentResolver().notifyChange(uri, null);
    }

    if (saveCategories) {
        ensureCategories(categories, appMetadataId);
    }

    return getSpecificAppUri(values.getAsString(PackageTable.Cols.PACKAGE_NAME), values.getAsLong(Cols.REPO_ID));
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:33,代码来源:AppProvider.java

示例3: update

import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
@Override
public int update(Uri uri, ContentValues values, String where, String[] whereArgs) {
    if (MATCHER.match(uri) != CODE_APK_FROM_REPO) {
        throw new UnsupportedOperationException("Cannot update anything other than a single apk.");
    }

    boolean saveAntiFeatures = false;
    String[] antiFeatures = null;
    if (values.containsKey(Cols.AntiFeatures.ANTI_FEATURES)) {
        saveAntiFeatures = true;
        String antiFeaturesString = values.getAsString(Cols.AntiFeatures.ANTI_FEATURES);
        antiFeatures = Utils.parseCommaSeparatedString(antiFeaturesString);
        values.remove(Cols.AntiFeatures.ANTI_FEATURES);
    }

    validateFields(Cols.ALL, values);
    removeFieldsFromOtherTables(values);

    QuerySelection query = new QuerySelection(where, whereArgs);
    query = query.add(querySingleWithAppId(uri));

    int numRows = db().update(getTableName(), values, query.getSelection(), query.getArgs());

    if (saveAntiFeatures) {
        // Get the database ID of the row we just updated, so that we can join relevant anti features to it.
        Cursor result = db().query(getTableName(), new String[]{Cols.ROW_ID},
                query.getSelection(), query.getArgs(), null, null, null);
        if (result != null) {
            result.moveToFirst();
            long apkId = result.getLong(0);
            ensureAntiFeatures(antiFeatures, apkId);
            result.close();
        }
    }

    if (!isApplyingBatch()) {
        getContext().getContentResolver().notifyChange(uri, null);
    }
    return numRows;
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:41,代码来源:ApkProvider.java

示例4: convertToRequestedPermissions

import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
private String[] convertToRequestedPermissions(String permissionsFromDb) {
    String[] array = Utils.parseCommaSeparatedString(permissionsFromDb);
    if (array != null) {
        HashSet<String> requestedPermissionsSet = new HashSet<>();
        for (String permission : array) {
            requestedPermissionsSet.add(RepoXMLHandler.fdroidToAndroidPermission(permission));
        }
        return requestedPermissionsSet.toArray(new String[requestedPermissionsSet.size()]);
    }
    return null;
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:12,代码来源:Apk.java

示例5: Repo

import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
public Repo(Cursor cursor) {

        checkCursorPosition(cursor);

        for (int i = 0; i < cursor.getColumnCount(); i++) {
            switch (cursor.getColumnName(i)) {
                case Cols._ID:
                    id = cursor.getInt(i);
                    break;
                case Cols.LAST_ETAG:
                    lastetag = cursor.getString(i);
                    break;
                case Cols.ADDRESS:
                    address = cursor.getString(i);
                    break;
                case Cols.DESCRIPTION:
                    description = cursor.getString(i);
                    break;
                case Cols.FINGERPRINT:
                    fingerprint = cursor.getString(i);
                    break;
                case Cols.IN_USE:
                    inuse = cursor.getInt(i) == 1;
                    break;
                case Cols.LAST_UPDATED:
                    lastUpdated = Utils.parseTime(cursor.getString(i), null);
                    break;
                case Cols.MAX_AGE:
                    maxage = cursor.getInt(i);
                    break;
                case Cols.VERSION:
                    version = cursor.getInt(i);
                    break;
                case Cols.NAME:
                    name = cursor.getString(i);
                    break;
                case Cols.SIGNING_CERT:
                    signingCertificate = cursor.getString(i);
                    break;
                case Cols.PRIORITY:
                    priority = cursor.getInt(i);
                    break;
                case Cols.IS_SWAP:
                    isSwap = cursor.getInt(i) == 1;
                    break;
                case Cols.USERNAME:
                    username = cursor.getString(i);
                    break;
                case Cols.PASSWORD:
                    password = cursor.getString(i);
                    break;
                case Cols.TIMESTAMP:
                    timestamp = cursor.getLong(i);
                    break;
                case Cols.ICON:
                    icon = cursor.getString(i);
                    break;
                case Cols.MIRRORS:
                    mirrors = Utils.parseCommaSeparatedString(cursor.getString(i));
                    break;
                case Cols.PUSH_REQUESTS:
                    pushRequests = cursor.getInt(i);
                    break;
            }
        }
    }
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:67,代码来源:Repo.java

示例6: setValues

import org.fdroid.fdroid.Utils; //导入方法依赖的package包/类
public void setValues(ContentValues values) {

        if (values.containsKey(Cols._ID)) {
            id = toInt(values.getAsInteger(Cols._ID));
        }

        if (values.containsKey(Cols.LAST_ETAG)) {
            lastetag = values.getAsString(Cols.LAST_ETAG);
        }

        if (values.containsKey(Cols.ADDRESS)) {
            address = values.getAsString(Cols.ADDRESS);
        }

        if (values.containsKey(Cols.DESCRIPTION)) {
            description = values.getAsString(Cols.DESCRIPTION);
        }

        if (values.containsKey(Cols.FINGERPRINT)) {
            fingerprint = values.getAsString(Cols.FINGERPRINT);
        }

        if (values.containsKey(Cols.IN_USE)) {
            inuse = toInt(values.getAsInteger(Cols.IN_USE)) == 1;
        }

        if (values.containsKey(Cols.LAST_UPDATED)) {
            final String dateString = values.getAsString(Cols.LAST_UPDATED);
            lastUpdated = Utils.parseTime(dateString, null);
        }

        if (values.containsKey(Cols.MAX_AGE)) {
            maxage = toInt(values.getAsInteger(Cols.MAX_AGE));
        }

        if (values.containsKey(Cols.VERSION)) {
            version = toInt(values.getAsInteger(Cols.VERSION));
        }

        if (values.containsKey(Cols.NAME)) {
            name = values.getAsString(Cols.NAME);
        }

        if (values.containsKey(Cols.SIGNING_CERT)) {
            signingCertificate = values.getAsString(Cols.SIGNING_CERT);
        }

        if (values.containsKey(Cols.PRIORITY)) {
            priority = toInt(values.getAsInteger(Cols.PRIORITY));
        }

        if (values.containsKey(Cols.IS_SWAP)) {
            isSwap = toInt(values.getAsInteger(Cols.IS_SWAP)) == 1;
        }

        if (values.containsKey(Cols.USERNAME)) {
            username = values.getAsString(Cols.USERNAME);
        }

        if (values.containsKey(Cols.PASSWORD)) {
            password = values.getAsString(Cols.PASSWORD);
        }

        if (values.containsKey(Cols.TIMESTAMP)) {
            timestamp = toInt(values.getAsInteger(Cols.TIMESTAMP));
        }

        if (values.containsKey(Cols.ICON)) {
            icon = values.getAsString(Cols.ICON);
        }

        if (values.containsKey(Cols.MIRRORS)) {
            mirrors = Utils.parseCommaSeparatedString(values.getAsString(Cols.MIRRORS));
        }

        if (values.containsKey(Cols.PUSH_REQUESTS)) {
            pushRequests = toInt(values.getAsInteger(Cols.PUSH_REQUESTS));
        }
    }
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:80,代码来源:Repo.java


注:本文中的org.fdroid.fdroid.Utils.parseCommaSeparatedString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。