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


Java ParserUtils类代码示例

本文整理汇总了Java中com.google.android.apps.iosched.util.ParserUtils的典型用法代码示例。如果您正苦于以下问题:Java ParserUtils类的具体用法?Java ParserUtils怎么用?Java ParserUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParserUtils类属于com.google.android.apps.iosched.util包,在下文中一共展示了ParserUtils类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseSlot

import com.google.android.apps.iosched.util.ParserUtils; //导入依赖的package包/类
private static void parseSlot(String date, TimeSlot slot,
        ArrayList<ContentProviderOperation> batch) {
    ContentProviderOperation.Builder builder = ContentProviderOperation
            .newInsert(ScheduleContract.addCallerIsSyncAdapterParameter(Blocks.CONTENT_URI));
    //LOGD(TAG, "Inside parseSlot:" + date + ",  " + slot);
    String start = slot.start;
    String end = slot.end;

    String type = "N_D";
    if (slot.type != null) {
        type = slot.type;
    }
    String title = "N_D";
    if (slot.title != null) {
        title = slot.title;
    }
    String startTime = date + "T" + start + ":00.000-07:00";
    String endTime = date + "T" + end + ":00.000-07:00";
    LOGV(TAG, "startTime:" + startTime);
    long startTimeL = ParserUtils.parseTime(startTime);
    long endTimeL = ParserUtils.parseTime(endTime);
    final String blockId = Blocks.generateBlockId(startTimeL, endTimeL);
    LOGV(TAG, "blockId:" + blockId);
    LOGV(TAG, "title:" + title);
    LOGV(TAG, "start:" + startTimeL);
    builder.withValue(Blocks.BLOCK_ID, blockId);
    builder.withValue(Blocks.BLOCK_TITLE, title);
    builder.withValue(Blocks.BLOCK_START, startTimeL);
    builder.withValue(Blocks.BLOCK_END, endTimeL);
    builder.withValue(Blocks.BLOCK_TYPE, type);
    builder.withValue(Blocks.BLOCK_META, slot.meta);
    batch.add(builder.build());
}
 
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:34,代码来源:BlocksHandler.java

示例2: parseTrack

import com.google.android.apps.iosched.util.ParserUtils; //导入依赖的package包/类
private static void parseTrack(Track track, ArrayList<ContentProviderOperation> batch) {
    ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(
            ScheduleContract.addCallerIsSyncAdapterParameter(
                    ScheduleContract.Tracks.CONTENT_URI));
    builder.withValue(ScheduleContract.Tracks.TRACK_ID, track.id);
    builder.withValue(ScheduleContract.Tracks.TRACK_NAME, track.name);
    builder.withValue(ScheduleContract.Tracks.TRACK_COLOR, Color.parseColor(track.color));
    builder.withValue(ScheduleContract.Tracks.TRACK_ABSTRACT, track._abstract);
    builder.withValue(ScheduleContract.Tracks.TRACK_LEVEL, track.level);
    builder.withValue(ScheduleContract.Tracks.TRACK_ORDER_IN_LEVEL,
            track.order_in_level);
    builder.withValue(ScheduleContract.Tracks.TRACK_META, track.meta);
    builder.withValue(ScheduleContract.Tracks.TRACK_HASHTAG, ParserUtils.sanitizeId(track.name));
    batch.add(builder.build());
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:16,代码来源:TracksHandler.java

示例3: parseSlot

import com.google.android.apps.iosched.util.ParserUtils; //导入依赖的package包/类
private static void parseSlot(String date, TimeSlot slot,
        ArrayList<ContentProviderOperation> batch) {
    ContentProviderOperation.Builder builder = ContentProviderOperation
            .newInsert(ScheduleContract.addCallerIsSyncAdapterParameter(Blocks.CONTENT_URI));
    //LOGD(TAG, "Inside parseSlot:" + date + ",  " + slot);
    String start = slot.start;
    String end = slot.end;

    String type = Blocks.BLOCK_TYPE_GENERIC;
    if (slot.type != null) {
        type = slot.type;
    }
    String title = "N_D";
    if (slot.title != null) {
        title = slot.title;
    }
    String startTime = date + "T" + start + ":00.000-07:00";
    String endTime = date + "T" + end + ":00.000-07:00";
    LOGV(TAG, "startTime:" + startTime);
    long startTimeL = ParserUtils.parseTime(startTime);
    long endTimeL = ParserUtils.parseTime(endTime);
    final String blockId = Blocks.generateBlockId(startTimeL, endTimeL);
    LOGV(TAG, "blockId:" + blockId);
    LOGV(TAG, "title:" + title);
    LOGV(TAG, "start:" + startTimeL);
    builder.withValue(Blocks.BLOCK_ID, blockId);
    builder.withValue(Blocks.BLOCK_TITLE, title);
    builder.withValue(Blocks.BLOCK_START, startTimeL);
    builder.withValue(Blocks.BLOCK_END, endTimeL);
    builder.withValue(Blocks.BLOCK_TYPE, type);
    builder.withValue(Blocks.BLOCK_META, slot.meta);
    batch.add(builder.build());
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:34,代码来源:BlocksHandler.java

示例4: generateBlockId

import com.google.android.apps.iosched.util.ParserUtils; //导入依赖的package包/类
/**
 * Generate a {@link #BLOCK_ID} that will always match the requested
 * {@link Blocks} details.
 */
public static String generateBlockId(long startTime, long endTime) {
    startTime /= DateUtils.SECOND_IN_MILLIS;
    endTime /= DateUtils.SECOND_IN_MILLIS;
    return ParserUtils.sanitizeId(startTime + "-" + endTime);
}
 
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:10,代码来源:ScheduleContract.java

示例5: loadTrack

import com.google.android.apps.iosched.util.ParserUtils; //导入依赖的package包/类
private void loadTrack(Cursor cursor, boolean triggerCallback) {
    final int trackColor;
    final Resources res = getResources();

    if (cursor != null) {
        trackColor = cursor.getInt(TracksAdapter.TracksQuery.TRACK_COLOR);

        mTrackId = cursor.getString(TracksAdapter.TracksQuery.TRACK_ID);

        String trackName = cursor.getString(TracksAdapter.TracksQuery.TRACK_NAME);

        mTitle.setText(trackName);
        mAbstract.setText(cursor.getString(TracksAdapter.TracksQuery.TRACK_ABSTRACT));

        int iconResId = res.getIdentifier(
                "track_" + ParserUtils.sanitizeId(trackName),
                "drawable", getActivity().getPackageName());
        if (iconResId != 0) {
            BitmapDrawable sourceIconDrawable = (BitmapDrawable) res.getDrawable(iconResId);
            Bitmap icon = Bitmap.createBitmap(sourceIconDrawable.getIntrinsicWidth(),
                    sourceIconDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
            Canvas canvas = new Canvas(icon);
            sourceIconDrawable.setBounds(0, 0, icon.getWidth(), icon.getHeight());
            sourceIconDrawable.draw(canvas);
            BitmapDrawable iconDrawable = new BitmapDrawable(res, icon);
            mIcon.setImageDrawable(iconDrawable);
        } else {
            mIcon.setImageDrawable(null);
        }
    } else {
        trackColor = res.getColor(R.color.all_track_color);
        mTrackId = ScheduleContract.Tracks.ALL_TRACK_ID;

        mIcon.setImageDrawable(null);
        switch (mViewType) {
            case VIEW_TYPE_SESSIONS:
                mTitle.setText(R.string.all_tracks_sessions);
                mAbstract.setText(R.string.all_tracks_subtitle_sessions);
                break;
            case VIEW_TYPE_OFFICE_HOURS:
                mTitle.setText(R.string.all_tracks_office_hours);
                mAbstract.setText(R.string.all_tracks_subtitle_office_hours);
                break;
            case VIEW_TYPE_SANDBOX:
                mTitle.setText(R.string.all_tracks_sandbox);
                mAbstract.setText(R.string.all_tracks_subtitle_sandbox);
                break;
        }
    }

    mRootView.setBackgroundColor(trackColor);
    mCallbacks.onTrackNameAvailable(mTrackId, mTitle.getText().toString());

    if (triggerCallback) {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                mCallbacks.onTrackSelected(mTrackId);
            }
        });
    }
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:63,代码来源:TracksDropdownFragment.java

示例6: generateTrackId

import com.google.android.apps.iosched.util.ParserUtils; //导入依赖的package包/类
/**
 * Generate a {@link #TRACK_ID} that will always match the requested
 * {@link Tracks} details.
 */
public static String generateTrackId(String name) {
    return ParserUtils.sanitizeId(name);
}
 
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:8,代码来源:ScheduleContract.java

示例7: generateVendorId

import com.google.android.apps.iosched.util.ParserUtils; //导入依赖的package包/类
/**
 * Generate a {@link #VENDOR_ID} that will always match the requested
 * {@link Vendors} details.
 */
public static String generateVendorId(String companyName) {
    return ParserUtils.sanitizeId(companyName);
}
 
开发者ID:amardeshbd,项目名称:google-iosched,代码行数:8,代码来源:ScheduleContract.java


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