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


Java CalligraphyUtils类代码示例

本文整理汇总了Java中uk.co.chrisjenx.calligraphy.CalligraphyUtils的典型用法代码示例。如果您正苦于以下问题:Java CalligraphyUtils类的具体用法?Java CalligraphyUtils怎么用?Java CalligraphyUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: updateFontPath

import uk.co.chrisjenx.calligraphy.CalligraphyUtils; //导入依赖的package包/类
private void updateFontPath() {
	String fontPath = settings.getString(C.PREF_FONT_VERSION, "fonts/freehkkai_4700.ttf");
	CalligraphyUtils.applyFontToTextView(mContext, resultTv, fontPath);

	String fontName = C.getCurrentFontName(mContext, fontPath);

	boolean isShowAlert = settings.getBoolean(C.PREF_FONT_VERSION_ALERT, true);
	if (isShowAlert) {
		Snackbar.make(getView(), "你正在使用" + fontName, Snackbar.LENGTH_LONG).setAction("設定", new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				onClickHelp();
			}
		}).show();
	}
}
 
开发者ID:collaction,项目名称:freehkkai-android,代码行数:17,代码来源:MainFragment.java

示例2: applyTypefaceOnTitle

import uk.co.chrisjenx.calligraphy.CalligraphyUtils; //导入依赖的package包/类
private void applyTypefaceOnTitle(Toolbar toolbar, String title) {
    try {
        for (int i = 0; i < toolbar.getChildCount(); ++i) {
            View child = toolbar.getChildAt(i);
            if (child instanceof TextView) {
                Typeface mTypeface = TypefaceUtils.load(getAssets(), "fonts/Roboto/Roboto-Bold.ttf");
                if (((TextView) child).getText().toString().equalsIgnoreCase(title)) {
                    CalligraphyUtils.applyFontToTextView((TextView)child, mTypeface);
                    break;
                }
            }
        }
    } catch (Exception e) {
        Log.e("BaseActivity", "Fail to apply typeface on toolbar");
    }
}
 
开发者ID:brunogabriel,项目名称:giyp-android,代码行数:17,代码来源:BaseActivity.java

示例3: setPlainOrLaTeXTextWithCustomFontColored

import uk.co.chrisjenx.calligraphy.CalligraphyUtils; //导入依赖的package包/类
public void setPlainOrLaTeXTextWithCustomFontColored(String text, String fontPath, @ColorRes int colorRes, boolean allowLaTeX) {
    @ColorInt
    int colorArgb = ColorUtil.INSTANCE.getColorArgb(colorRes, getContext());
    TextResult textResult = textResolver.resolveStepText(text);
    if (textResult.isNeedWebView()) {
        String hexColor = String.format("#%06X", (0xFFFFFF & colorArgb));
        String coloredText = "<font color='" + hexColor + "'>" + textResult.getText() + "</font>";
        setTextWebView(coloredText, allowLaTeX && HtmlHelper.hasLaTeX(text), fontPath);
    } else {
        textView.setTextColor(colorArgb);
        setPlainText(textResult.getText());
        if (fontPath != null) {
            CalligraphyUtils.applyFontToTextView(getContext(), textView, fontPath);
        }
    }
}
 
开发者ID:StepicOrg,项目名称:stepik-android,代码行数:17,代码来源:LatexSupportableEnhancedFrameLayout.java

示例4: getSectionName

import uk.co.chrisjenx.calligraphy.CalligraphyUtils; //导入依赖的package包/类
@NonNull
@Override
public String getSectionName(int position) {
    return CalligraphyUtils.applyTypefaceSpan(
            showSectionName ? MusicUtil.getSectionName(dataSet.get(position).title) : "",
            mTypeface).toString();
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:8,代码来源:SongAdapter.java

示例5: getSectionName

import uk.co.chrisjenx.calligraphy.CalligraphyUtils; //导入依赖的package包/类
@NonNull
@Override
public String getSectionName(int position) {
    return CalligraphyUtils.applyTypefaceSpan(
            MusicUtil.getSectionName(dataSet.get(position).getTitle()),
            mTypeface).toString();
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:8,代码来源:AlbumAdapter.java

示例6: getPageTitle

import uk.co.chrisjenx.calligraphy.CalligraphyUtils; //导入依赖的package包/类
@Override
public CharSequence getPageTitle(int position) {
    return CalligraphyUtils.applyTypefaceSpan(tabs[position], mTypeface);
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:5,代码来源:SettingsPagerAdapter.java

示例7: render

import uk.co.chrisjenx.calligraphy.CalligraphyUtils; //导入依赖的package包/类
@Override
public void render(BaseViewHolder tag, DiscussionThread discussionThread) {
    ViewHolder holder = (ViewHolder) tag;
    {
        final Icon icon;
        @ColorInt
        final int iconColor;
        if (discussionThread.getType() == DiscussionThread.ThreadType.QUESTION) {
            if (discussionThread.isHasEndorsed()) {
                icon = FontAwesomeIcons.fa_check_square_o;
                iconColor = edx_utility_success_dark;
            } else {
                icon = FontAwesomeIcons.fa_question;
                iconColor = edx_brand_secondary_dark;
            }
        } else {
            icon = FontAwesomeIcons.fa_comments;
            iconColor = (discussionThread.isRead() ? edx_grayscale_neutral_dark : edx_brand_primary_base);
        }
        holder.discussionPostTypeIcon.setIcon(icon);
        holder.discussionPostTypeIcon.setIconColor(iconColor);
    }

    {
        final CharSequence threadTitle = discussionThread.getTitle();
        holder.discussionPostTitle.setText(discussionThread.isRead() ? threadTitle :
                CalligraphyUtils.applyTypefaceSpan(threadTitle, openSansSemiBoldFont));
    }

    holder.discussionPostClosedIcon.setVisibility(discussionThread.isClosed() ? View.VISIBLE : View.GONE);
    holder.discussionPostPinIcon.setVisibility(discussionThread.isPinned() ? View.VISIBLE : View.GONE);
    holder.discussionPostFollowIcon.setVisibility(discussionThread.isFollowing() ? View.VISIBLE : View.GONE);

    {
        final int commentCount = discussionThread.getCommentCount();
        if (commentCount == 0) {
            holder.discussionPostRepliesTextView.setVisibility(View.GONE);
            holder.discussionSubtitleFirstPipe.setVisibility(View.GONE);
        } else {
            final CharSequence totalReplies = ResourceUtil.getFormattedString(
                    getContext().getResources(), R.string.discussion_post_total_replies,
                    "total_replies", getFormattedCount(commentCount));
            holder.discussionSubtitleFirstPipe.setVisibility(
                    isAnyIconVisible(discussionThread) ? View.VISIBLE : View.GONE
            );
            holder.discussionPostRepliesTextView.setText(totalReplies);
            holder.discussionPostRepliesTextView.setVisibility(View.VISIBLE);
        }
    }

    {
        final CharSequence lastPostDate = DiscussionTextUtils.getRelativeTimeSpanString(getContext(),
                initialTimeStampMs, discussionThread.getUpdatedAt().getTime(),
                DateUtils.FORMAT_ABBREV_MONTH | DateUtils.FORMAT_SHOW_YEAR);
        holder.discussionSubtitleSecondPipe.setVisibility(
                (isAnyIconVisible(discussionThread) || discussionThread.getCommentCount() != 0) ?
                        View.VISIBLE : View.GONE
        );
        holder.discussionPostDateTextView.setText(ResourceUtil.getFormattedString(
                getContext().getResources(), R.string.discussion_post_last_interaction_date,
                "date", lastPostDate));
    }

    {
        final int unreadCommentCount = discussionThread.getUnreadCommentCount();
        if (unreadCommentCount == 0) {
            holder.discussionUnreadRepliesTextView.setVisibility(View.INVISIBLE);
        } else {
            holder.discussionUnreadRepliesTextView.setVisibility(View.VISIBLE);
            holder.discussionUnreadRepliesTextView.setText(getFormattedCount(unreadCommentCount));
        }
    }
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:74,代码来源:DiscussionPostsAdapter.java


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