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


Java DateUtils.getRelativeTimeSpanString方法代码示例

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


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

示例1: buildFolderStatus

import android.text.format.DateUtils; //导入方法依赖的package包/类
private String buildFolderStatus(FolderInfoHolder folder) {
    String folderStatus;
    if (folder.loading) {
        folderStatus = getString(R.string.status_loading);
    } else if (folder.status != null) {
        folderStatus = folder.status;
    } else if (folder.lastChecked != 0) {
        long now = System.currentTimeMillis();
        int flags = DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR;
        CharSequence formattedDate;

        if (Math.abs(now - folder.lastChecked) > DateUtils.WEEK_IN_MILLIS) {
            formattedDate = getString(R.string.preposition_for_date,
                    DateUtils.formatDateTime(context, folder.lastChecked, flags));
        } else {
            formattedDate = DateUtils.getRelativeTimeSpanString(folder.lastChecked,
                    now, DateUtils.MINUTE_IN_MILLIS, flags);
        }

        folderStatus = getString(folder.pushActive
                        ? R.string.last_refresh_time_format_with_push
                        : R.string.last_refresh_time_format,
                formattedDate);
    } else {
        folderStatus = null;
    }
    return folderStatus;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:29,代码来源:FolderList.java

示例2: getApplicationVersion

import android.text.format.DateUtils; //导入方法依赖的package包/类
/**
 * Build the application version to be shown.  In particular, this ensures the debug build
 * versions are more useful.
 */
public static String getApplicationVersion(Context context, String version) {
    if (ChromeVersionInfo.isOfficialBuild()) {
        return version;
    }

    // For developer builds, show how recently the app was installed/updated.
    PackageInfo info;
    try {
        info = context.getPackageManager().getPackageInfo(
                context.getPackageName(), 0);
    } catch (NameNotFoundException e) {
        return version;
    }
    CharSequence updateTimeString = DateUtils.getRelativeTimeSpanString(
            info.lastUpdateTime, System.currentTimeMillis(), 0);
    return context.getString(R.string.version_with_update_time, version,
            updateTimeString);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:AboutChromePreferences.java

示例3: onBindViewHolder

import android.text.format.DateUtils; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(DiaryEntryAdapter.ViewHolder viewHolder, int position) {
    DiaryEntry entry = mDiaryEntries.get(position);

    viewHolder.text1.setText(entry.getText1());
    viewHolder.text2.setText(entry.getText2());
    viewHolder.text3.setText(entry.getText3());
    viewHolder.text4.setText(entry.getText4());
    viewHolder.text5.setText(entry.getText5());

    // Convert timestamp to useful string description based on age
    long now = System.currentTimeMillis();
    CharSequence ago = DateUtils.getRelativeTimeSpanString(
            entry.getCreationTimestamp(),
            now,
            DateUtils.MINUTE_IN_MILLIS, DateUtils.FORMAT_NO_YEAR | DateUtils.FORMAT_ABBREV_ALL);

    viewHolder.time.setText(ago);
}
 
开发者ID:jgevans,项目名称:TherapyGuide,代码行数:20,代码来源:DiaryFragment.java

示例4: getOperation

import android.text.format.DateUtils; //导入方法依赖的package包/类
public String getOperation(Context context) {
    synchronized (lock) {
        if (loadingAccountDescription != null ||
                sendingAccountDescription != null ||
                loadingHeaderFolderId != null ||
                processingAccountDescription != null) {
            return getActionInProgressOperation(context);
        }
    }

    long nextPollTime = MailService.getNextPollTime();
    if (nextPollTime != -1) {
        CharSequence relativeTimeSpanString = DateUtils.getRelativeTimeSpanString(
                nextPollTime, System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS, 0);
        return context.getString(R.string.status_next_poll, relativeTimeSpanString);
    } else if (QMail.isDebug() && MailService.isSyncDisabled()) {
        if (MailService.hasNoConnectivity()) {
            return context.getString(R.string.status_no_network);
        } else if (MailService.isSyncNoBackground()) {
            return context.getString(R.string.status_no_background);
        } else if (MailService.isSyncBlocked()) {
            return context.getString(R.string.status_syncing_blocked);
        } else if (MailService.isPollAndPushDisabled()) {
            return context.getString(R.string.status_poll_and_push_disabled);
        } else {
            return context.getString(R.string.status_syncing_off);
        }
    } else if (MailService.isSyncDisabled()) {
        return context.getString(R.string.status_syncing_off);
    } else {
        return "";
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:34,代码来源:ActivityListener.java

示例5: getChildView

import android.text.format.DateUtils; //导入方法依赖的package包/类
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) mContext.getSystemService (Context.LAYOUT_INFLATER_SERVICE);
    ViewHolderNotes viewHolderNotes;
    if (convertView == null) {
        convertView = inflater.inflate (R.layout.custom_row_notes, parent, false);
        viewHolderNotes = new ViewHolderNotes (convertView);
        convertView.setTag (viewHolderNotes);
    } else {
        viewHolderNotes = (ViewHolderNotes) convertView.getTag ();
    }
    NoteUtil noteUtil = new NoteUtil (mContext);
    JSONArray jsonArrayNotesTag = null;
    try {
        jsonArrayNotesTag = noteUtil.getNotesForATag (mSectionID, noteUtil
                .getDistinctTags (mSectionID).getJSONObject (groupPosition).toString ());
        JSONObject jsonObject;
        String noteText = mContext.getString (R.string.lorem_ipsum_str), noteDateStamp = mContext.getString (R.string.lorem_ipsum_str), titleText = mContext.getString (R.string.lorem_ipsum_str);
        long noteTimeInMillis;
        jsonObject = jsonArrayNotesTag.getJSONObject (childPosition);
        noteText = jsonObject.getString (GlobalData.NOTE_BODY);
        noteTimeInMillis = jsonObject.getLong (GlobalData.NOTE_TIME_MILLIS);
        noteDateStamp = (String) DateUtils.getRelativeTimeSpanString (noteTimeInMillis, System.currentTimeMillis (), 3, DateUtils.FORMAT_ABBREV_RELATIVE);
        titleText = jsonObject.getString (GlobalData.NOTE_TITLE);
        viewHolderNotes.notes.setText (noteText);
        viewHolderNotes.date.setText (noteDateStamp);
        viewHolderNotes.title.setText (titleText);
    } catch (JSONException e) {
        e.printStackTrace ();
    }
    viewHolderNotes.popupMenuDots.setVisibility (View.INVISIBLE);
    return convertView;
}
 
开发者ID:atulgpt,项目名称:TimeTrix,代码行数:34,代码来源:CustomAdapterTags.java

示例6: manipulateDateFormat

import android.text.format.DateUtils; //导入方法依赖的package包/类
public static String manipulateDateFormat(String post_date) {

        if (post_date == null)
            return "";       //if no date is returned by the API then set corresponding date view to empty

        if (post_date.equals("0001-01-01T00:00:00Z")) //because Times of India is always returning this in time stamp which is Jan1,1 (wrong information they are sending)
            return "";

        SimpleDateFormat existingUTCFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");

        Date date = null;
        try {
            date = existingUTCFormat.parse(post_date);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        if (date != null) {
            // Converting timestamp into x ago format
            CharSequence timeAgo = DateUtils.getRelativeTimeSpanString(
                    Long.parseLong(String.valueOf(date.getTime())),
                    System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS);
            return timeAgo + "";
        } else {
            return post_date;
        }
    }
 
开发者ID:ansh94,项目名称:DailyTech,代码行数:28,代码来源:DateUtil.java

示例7: getTimeAgo

import android.text.format.DateUtils; //导入方法依赖的package包/类
@NonNull public static CharSequence getTimeAgo(@Nullable String toParse) {
    try {
        Date parsedDate = getInstance().dateFormat.parse(toParse);
        long now = System.currentTimeMillis();
        return DateUtils.getRelativeTimeSpanString(parsedDate.getTime(), now, DateUtils.SECOND_IN_MILLIS);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "N/A";
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:11,代码来源:ParseDateFormat.java

示例8: getRelativeTimeSpanString

import android.text.format.DateUtils; //导入方法依赖的package包/类
public static CharSequence getRelativeTimeSpanString(Context context, long time) {
    long now = System.currentTimeMillis();
    long range = Math.abs(now - time);

    if (range < NOW_TIME_RANGE) {
        return context.getString(R.string.now_time_range);
    }

    return DateUtils.getRelativeTimeSpanString(time, now, DateUtils.MINUTE_IN_MILLIS);
}
 
开发者ID:rozdoum,项目名称:social-app-android,代码行数:11,代码来源:FormatterUtil.java

示例9: manipulateDateFormat

import android.text.format.DateUtils; //导入方法依赖的package包/类
public static String manipulateDateFormat(String post_date) {

        if (post_date == null)
            return "";       //if no date is returned by the API then set corresponding date view to empty

        if (post_date.equals("0001-01-01T00:00:00Z")) //because Times of India is always returning this in time stamp which is Jan1,1 (wrong information they are sending)
            return "";

        SimpleDateFormat existingUTCFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");

        Date date = null;
        if(!post_date.equals("")) {
            try {
                date = existingUTCFormat.parse(post_date);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        if (date != null) {
            // Converting timestamp into x ago format
            CharSequence timeAgo = DateUtils.getRelativeTimeSpanString(
                    Long.parseLong(String.valueOf(date.getTime())),
                    System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS);
            return timeAgo + "";
        } else {
            return post_date;
        }
    }
 
开发者ID:vikasdesale,项目名称:News24x7-news-from-every-part-of-the-world,代码行数:29,代码来源:Util.java

示例10: onBindViewHolder

import android.text.format.DateUtils; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(ItemViewHolder holder, int position) {
	HostViewHolder hostHolder = (HostViewHolder) holder;

	HostBean host = hosts.get(position);
	hostHolder.host = host;
	if (host == null) {
		// Well, something bad happened. We can't continue.
		Log.e("HostAdapter", "Host bean is null!");
		hostHolder.nickname.setText("Error during lookup");
	} else {
		hostHolder.nickname.setText(host.getNickname());
	}

	switch (this.getConnectedState(host)) {
	case STATE_UNKNOWN:
		hostHolder.icon.setImageState(new int[] { }, true);
		hostHolder.icon.setContentDescription(null);
		if (Build.VERSION.SDK_INT >= 16) {
			hideFromAccessibility(hostHolder.icon, true);
		}
		break;
	case STATE_CONNECTED:
		hostHolder.icon.setImageState(new int[] { android.R.attr.state_checked }, true);
		hostHolder.icon.setContentDescription(getString(R.string.image_description_connected));
		if (Build.VERSION.SDK_INT >= 16) {
			hideFromAccessibility(hostHolder.icon, false);
		}
		break;
	case STATE_DISCONNECTED:
		hostHolder.icon.setImageState(new int[] { android.R.attr.state_expanded }, true);
		hostHolder.icon.setContentDescription(getString(R.string.image_description_disconnected));
		if (Build.VERSION.SDK_INT >= 16) {
			hideFromAccessibility(hostHolder.icon, false);
		}
		break;
	default:
		Log.e("HostAdapter", "Unknown host state encountered: " + getConnectedState(host));
	}

	@StyleRes final int chosenStyleFirstLine;
	@StyleRes final int chosenStyleSecondLine;
	if (HostDatabase.COLOR_RED.equals(host.getColor())) {
		chosenStyleFirstLine = R.style.ListItemFirstLineText_Red;
		chosenStyleSecondLine = R.style.ListItemSecondLineText_Red;
	} else if (HostDatabase.COLOR_GREEN.equals(host.getColor())) {
		chosenStyleFirstLine = R.style.ListItemFirstLineText_Green;
		chosenStyleSecondLine = R.style.ListItemSecondLineText_Green;
	} else if (HostDatabase.COLOR_BLUE.equals(host.getColor())) {
		chosenStyleFirstLine = R.style.ListItemFirstLineText_Blue;
		chosenStyleSecondLine = R.style.ListItemSecondLineText_Blue;
	} else {
		chosenStyleFirstLine = R.style.ListItemFirstLineText;
		chosenStyleSecondLine = R.style.ListItemSecondLineText;
	}

	hostHolder.nickname.setTextAppearance(context, chosenStyleFirstLine);
	hostHolder.caption.setTextAppearance(context, chosenStyleSecondLine);

	CharSequence nice = context.getString(R.string.bind_never);
	if (host.getLastConnect() > 0) {
		nice = DateUtils.getRelativeTimeSpanString(host.getLastConnect() * 1000);
	}

	hostHolder.caption.setText(nice);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:67,代码来源:HostListActivity.java

示例11: getRelativeTimeSpanString

import android.text.format.DateUtils; //导入方法依赖的package包/类
public CharSequence getRelativeTimeSpanString(long time, long now, long minResolution)
{
    return DateUtils.getRelativeTimeSpanString(time, now, minResolution);
}
 
开发者ID:jbmlaird,项目名称:DiscogsBrowser,代码行数:5,代码来源:DateUtilsWrapper.java

示例12: setPhoneCallDetails

import android.text.format.DateUtils; //导入方法依赖的package包/类
/** Fills the call details views with content. */
public void setPhoneCallDetails(PhoneCallDetailsViews views, PhoneCallDetails details) {
    // Display up to a given number of icons.
    views.callTypeIcons.clear();
    int count = details.callTypes.length;
    for (int index = 0; index < count && index < MAX_CALL_TYPE_ICONS; ++index) {
        views.callTypeIcons.add(details.callTypes[index]);
    }
    views.callTypeIcons.setVisibility(View.VISIBLE);

    // Show the total call count only if there are more than the maximum
    // number of icons.
    Integer callCount;
    if (count > MAX_CALL_TYPE_ICONS) {
        callCount = count;
    } else {
        callCount = null;
    }

    // The date of this call, relative to the current time.
    CharSequence dateText =
            DateUtils.getRelativeTimeSpanString(details.date,
                    getCurrentTimeMillis(),
                    DateUtils.MINUTE_IN_MILLIS,
                    DateUtils.FORMAT_ABBREV_RELATIVE);

    // Set the call count and date.
    setCallCountAndDate(views, callCount, dateText);

    // Display number and display name
    CharSequence displayName;
    if (!TextUtils.isEmpty(details.name)) {
        displayName = details.name;
    } else {
        // Try to fallback on number treat
        if (!TextUtils.isEmpty(details.number)) {
            displayName = SipUri.getDisplayedSimpleContact(details.number.toString());
            // SipUri.getCanonicalSipContact(details.number.toString(),
            // false);
        } else {
            displayName = mResources.getString(R.string.unknown);
        }

        if (!TextUtils.isEmpty(details.numberLabel)) {
            SpannableString text = new SpannableString(details.numberLabel + " " + displayName);
            text.setSpan(new StyleSpan(Typeface.BOLD), 0, details.numberLabel.length(),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            displayName = text;
        }
    }

    views.nameView.setText(displayName);
    if (!TextUtils.isEmpty(details.formattedNumber)) {
        views.numberView.setText(details.formattedNumber);
    } else if (!TextUtils.isEmpty(details.number)) {
        views.numberView.setText(details.number);
    } else {
        // In this case we can assume that display name was set to unknown
        views.numberView.setText(displayName);
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:62,代码来源:PhoneCallDetailsHelper.java

示例13: converteTimestamp

import android.text.format.DateUtils; //导入方法依赖的package包/类
private CharSequence converteTimestamp(String mileSegundos){
    return DateUtils.getRelativeTimeSpanString(Long.parseLong(mileSegundos),System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS);
}
 
开发者ID:picopalette,项目名称:event-me,代码行数:4,代码来源:ChatFirebaseAdapter.java

示例14: onBindViewHolder

import android.text.format.DateUtils; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(@NonNull final TwoLinesViewHolder holder,
                             @NonNull final Cursor cursor, final int position) {
    final SpannableStringBuilder primary = new SpannableStringBuilder();
    final String cachedName = cursor.getString(cursor.getColumnIndexOrThrow(CallLog.Calls.CACHED_NAME));
    final String number = cursor.getString(cursor.getColumnIndexOrThrow(CallLog.Calls.NUMBER));
    SpannableStringBuilderCompat.append(primary, (cachedName != null ? cachedName : number),
            new StyleSpan(Typeface.BOLD), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    primary.append(" ");

    final long duration = cursor.getLong(cursor.getColumnIndexOrThrow(CallLog.Calls.DURATION));
    if (duration > 0) {
        final CharSequence formattedDuration = DateUtils.formatElapsedTime(duration);
        primary.append(formattedDuration);
    }

    holder.setText1(primary);

    final SpannableStringBuilder summary = new SpannableStringBuilder();
    final int type = cursor.getInt(cursor.getColumnIndexOrThrow(CallLog.Calls.TYPE));
    switch (type) {
        case CallLog.Calls.INCOMING_TYPE:
            SpannableStringBuilderCompat.append(summary, "←", new ForegroundColorSpan(Color.BLUE),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            summary.append(" ");
            break;

        case CallLog.Calls.OUTGOING_TYPE:
            SpannableStringBuilderCompat.append(summary, "→", new ForegroundColorSpan(Color.GREEN),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            summary.append(" ");
            break;

        case CallLog.Calls.MISSED_TYPE:
        case CallLog.Calls.REJECTED_TYPE:
            SpannableStringBuilderCompat.append(summary, "☇", new ForegroundColorSpan(Color.RED),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            summary.append(" ");
            break;

        case CallLog.Calls.BLOCKED_TYPE:
            SpannableStringBuilderCompat.append(summary, "☓", new ForegroundColorSpan(Color.BLACK),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            summary.append(" ");
            break;
    }

    final long date = cursor.getLong(cursor.getColumnIndexOrThrow(CallLog.Calls.DATE));
    final CharSequence relativeDate = DateUtils.getRelativeTimeSpanString(date,
            System.currentTimeMillis(), DateUtils.MINUTE_IN_MILLIS);
    summary.append(relativeDate);

    holder.setText2(summary);
}
 
开发者ID:GlobusLTD,项目名称:recyclerview-android,代码行数:55,代码来源:CallsAdapter.java

示例15: onBindViewHolder

import android.text.format.DateUtils; //导入方法依赖的package包/类
public void onBindViewHolder(SnippetArticle article) {
    super.onBindViewHolder();

    // No longer listen for offline status changes to the old article.
    if (mArticle != null) mArticle.setOfflineStatusChangeRunnable(null);

    mArticle = article;
    updateLayout();

    mHeadlineTextView.setText(mArticle.mTitle);

    // DateUtils.getRelativeTimeSpanString(...) calls through to TimeZone.getDefault(). If this
    // has never been called before it loads the current time zone from disk. In most likelihood
    // this will have been called previously and the current time zone will have been cached,
    // but in some cases (eg instrumentation tests) it will cause a strict mode violation.
    StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
    try {
        long time = SystemClock.elapsedRealtime();
        CharSequence relativeTimeSpan = DateUtils.getRelativeTimeSpanString(
                mArticle.mPublishTimestampMilliseconds, System.currentTimeMillis(),
                DateUtils.MINUTE_IN_MILLIS);
        RecordHistogram.recordTimesHistogram("Android.StrictMode.SnippetUIBuildTime",
                SystemClock.elapsedRealtime() - time, TimeUnit.MILLISECONDS);

        // We format the publisher here so that having a publisher name in an RTL language
        // doesn't mess up the formatting on an LTR device and vice versa.
        String publisherAttribution = String.format(PUBLISHER_FORMAT_STRING,
                BidiFormatter.getInstance().unicodeWrap(mArticle.mPublisher), relativeTimeSpan);
        mPublisherTextView.setText(publisherAttribution);
    } finally {
        StrictMode.setThreadPolicy(oldPolicy);
    }

    // The favicon of the publisher should match the TextView height.
    int widthSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    int heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
    mPublisherTextView.measure(widthSpec, heightSpec);
    mPublisherFaviconSizePx = mPublisherTextView.getMeasuredHeight();

    mArticleSnippetTextView.setText(mArticle.mPreviewText);

    // If there's still a pending thumbnail fetch, cancel it.
    cancelImageFetch();

    // If the article has a thumbnail already, reuse it. Otherwise start a fetch.
    // mThumbnailView's visibility is modified in updateLayout().
    if (mThumbnailView.getVisibility() == View.VISIBLE) {
        if (mArticle.getThumbnailBitmap() != null) {
            mThumbnailView.setImageBitmap(mArticle.getThumbnailBitmap());
        } else {
            mThumbnailView.setImageResource(R.drawable.ic_snippet_thumbnail_placeholder);
            mImageCallback = new FetchImageCallback(this, mArticle);
            mNewTabPageManager.getSuggestionsSource()
                    .fetchSuggestionImage(mArticle, mImageCallback);
        }
    }

    // Set the favicon of the publisher.
    try {
        fetchFaviconFromLocalCache(new URI(mArticle.mUrl), true);
    } catch (URISyntaxException e) {
        setDefaultFaviconOnView();
    }

    mOfflineBadge.setVisibility(View.GONE);
    if (SnippetsConfig.isOfflineBadgeEnabled()) {
        Runnable offlineChecker = new Runnable() {
            @Override
            public void run() {
                if (mArticle.getOfflinePageOfflineId() != null || mArticle.mIsDownloadedAsset) {
                    mOfflineBadge.setVisibility(View.VISIBLE);
                }
            }
        };
        mArticle.setOfflineStatusChangeRunnable(offlineChecker);
        offlineChecker.run();
    }

    mRecyclerView.onSnippetBound(itemView);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:81,代码来源:SnippetArticleViewHolder.java


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