當前位置: 首頁>>代碼示例>>Java>>正文


Java TextDrawable.IBuilder方法代碼示例

本文整理匯總了Java中com.amulyakhare.textdrawable.TextDrawable.IBuilder方法的典型用法代碼示例。如果您正苦於以下問題:Java TextDrawable.IBuilder方法的具體用法?Java TextDrawable.IBuilder怎麽用?Java TextDrawable.IBuilder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.amulyakhare.textdrawable.TextDrawable的用法示例。


在下文中一共展示了TextDrawable.IBuilder方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRectWithCustomSize

import com.amulyakhare.textdrawable.TextDrawable; //導入方法依賴的package包/類
public Drawable getRectWithCustomSize() {
    String leftText = "I";
    String rightText = "J";

    TextDrawable.IBuilder builder = TextDrawable.builder()
            .beginConfig()
                .width(toPx(29))
                .withBorder(toPx(2))
            .endConfig()
            .rect();

    TextDrawable left = builder
            .build(leftText, mGenerator.getColor(leftText));

    TextDrawable right = builder
            .build(rightText, mGenerator.getColor(rightText));

    Drawable[] layerList = {
            new InsetDrawable(left, 0, 0, toPx(31), 0),
            new InsetDrawable(right, toPx(31), 0, 0, 0)
    };
    return new LayerDrawable(layerList);
}
 
開發者ID:apache,項目名稱:incubator-wave-android,代碼行數:24,代碼來源:DrawableProvider.java

示例2: getRectWithCustomSize

import com.amulyakhare.textdrawable.TextDrawable; //導入方法依賴的package包/類
public Drawable getRectWithCustomSize(Context context, String leftText, String rightText, boolean selected) {

        TextDrawable.IBuilder builder = TextDrawable.builder()
                .beginConfig()
                .width(toPx(context, 29))
                .withBorder(toPx(context, 2))
                .textColor(selected ? getTextColorSelected() : getTextColorUnselected())
                .endConfig()
                .rect();


        TextDrawable left = builder
                .build(leftText, mGenerator.getColor(leftText));


        TextDrawable right = builder
                .build(rightText, mGenerator.getColor(rightText));


        Drawable[] layerList = {
                new InsetDrawable(left, 0, 0, toPx(context, 31), 0),
                new InsetDrawable(right, toPx(context, 31), 0, 0, 0)
        };
        return new LayerDrawable(layerList);
    }
 
開發者ID:TouchBoarder,項目名稱:weekdays-buttons-bar,代碼行數:26,代碼來源:WeekdaysDrawableProvider.java

示例3: getRectWithAnimation

import com.amulyakhare.textdrawable.TextDrawable; //導入方法依賴的package包/類
public static Drawable getRectWithAnimation(int count, String label, int delay) {
    TextDrawable.IBuilder builder = TextDrawable.builder()
            .rect();


    AnimationDrawable animationDrawable = new AnimationDrawable();
    for (int i = count; i > 0; i--) {
        TextDrawable frame = builder.build(label, ColorGenerator.MATERIAL.getRandomColor());
        animationDrawable.addFrame(frame, delay);
    }
    animationDrawable.setOneShot(false);
    animationDrawable.start();


    return animationDrawable;
}
 
開發者ID:TouchBoarder,項目名稱:weekdays-buttons-bar,代碼行數:17,代碼來源:WeekdaysDrawableProvider.java

示例4: onBindViewHolder

import com.amulyakhare.textdrawable.TextDrawable; //導入方法依賴的package包/類
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
    final CommonHolder holder = (CommonHolder) viewHolder;
    ColorGenerator generator = ColorGenerator.MATERIAL;
    int color = generator.getColor(position);
    TextDrawable.IBuilder builder = TextDrawable.builder()
            .beginConfig()
            .endConfig()
            .round();
    holder.fabImage.setImageDrawable(builder.build("" + position, color));
    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            homePresenter.onFilterClick(filterModelList.get(holder.getAdapterPosition()));
        }
    });
}
 
開發者ID:k0shk0sh,項目名稱:Filtra-StyleMe-,代碼行數:18,代碼來源:FiltersAdapter.java

示例5: onBindViewHolder

import com.amulyakhare.textdrawable.TextDrawable; //導入方法依賴的package包/類
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    holder.mItem = mValues.get(position);

    ColorGenerator generator = ColorGenerator.MATERIAL;

    int color = mContext.getResources().getColor(R.color.accent);

    // declare the builder object once.
    TextDrawable.IBuilder builder = TextDrawable.builder()
            .beginConfig()
            .endConfig()
            .round();

    String title = holder.mItem.getTitle().isEmpty() ? "  " : holder.mItem.getTitle();

    TextDrawable ic = builder.build(title.substring(0, 1).toUpperCase(), color);
    holder.mIdView.setImageDrawable(ic);

    holder.mTitleView.setText(title);
    holder.mContentView.setText(holder.mItem.getCroppedContent());


    holder.mView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (null != mListener) {
                // Notify the active callbacks interface (the activity, if the
                // fragment is attached to one) that an item has been selected.
                mListener.onListFragmentInteraction(holder.mItem);
            }
        }
    });
}
 
開發者ID:hamzux,項目名稱:cosi,代碼行數:35,代碼來源:NoteRecyclerViewAdapter.java

示例6: getRectWithAnimation

import com.amulyakhare.textdrawable.TextDrawable; //導入方法依賴的package包/類
public Drawable getRectWithAnimation() {
    TextDrawable.IBuilder builder = TextDrawable.builder()
            .rect();

    AnimationDrawable animationDrawable = new AnimationDrawable();
    for (int i = 10; i > 0; i--) {
        TextDrawable frame = builder.build(String.valueOf(i), mGenerator.getRandomColor());
        animationDrawable.addFrame(frame, 1200);
    }
    animationDrawable.setOneShot(false);
    animationDrawable.start();

    return animationDrawable;
}
 
開發者ID:apache,項目名稱:incubator-wave-android,代碼行數:15,代碼來源:DrawableProvider.java

示例7: setupDrawable

import com.amulyakhare.textdrawable.TextDrawable; //導入方法依賴的package包/類
private void setupDrawable(@NonNull String upDrawable) {
    TextDrawable.IBuilder builder = TextDrawable.builder()
            .beginConfig()
            .endConfig()
            .round();
    String letter = InputHelper.isEmpty(upDrawable) ? "N/A" : InputHelper.getTwoLetters(upDrawable);
    folderImage.setImageDrawable(builder.build(letter.toUpperCase(), selectedColor));
}
 
開發者ID:k0shk0sh,項目名稱:FastAccess,代碼行數:9,代碼來源:CreateFolderView.java

示例8: bind

import com.amulyakhare.textdrawable.TextDrawable; //導入方法依賴的package包/類
@Override public void bind(@NonNull FolderModel folderModel) {
    TextDrawable.IBuilder builder = TextDrawable.builder()
            .beginConfig()
            .endConfig()
            .round();
    String letter = InputHelper.getTwoLetters(folderModel.getFolderName());
    int color = folderModel.getColor() == 0 ? ColorGenerator.MATERIAL.getRandomColor() : folderModel.getColor();
    imageIcon.setImageDrawable(builder.build(letter.toUpperCase(), color));
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) imageIcon.getLayoutParams();
    int gap = PrefConstant.getGapSize(imageIcon.getResources());
    if (!isHorizontal) params.setMargins(0, 0, 0, gap);
    else params.setMargins(0, 0, gap, 0);
}
 
開發者ID:k0shk0sh,項目名稱:FastAccess,代碼行數:14,代碼來源:FloatingFoldersViewHolder.java

示例9: bind

import com.amulyakhare.textdrawable.TextDrawable; //導入方法依賴的package包/類
@Override public void bind(@NonNull FolderModel folderModel) {
    folderName.setText(folderModel.getFolderName());
    appsCount.setText(String.valueOf(folderModel.getAppsCount()));
    folderImage.setContentDescription(folderModel.getFolderName());
    TextDrawable.IBuilder builder = TextDrawable.builder()
            .beginConfig()
            .endConfig()
            .round();
    String letter = InputHelper.getTwoLetters(folderModel.getFolderName());
    int color = folderModel.getColor() == 0 ? ColorGenerator.MATERIAL.getRandomColor() : folderModel.getColor();
    folderImage.setImageDrawable(builder.build(letter.toUpperCase(), color));
    if (getAdapterPosition() == 0) {
        ViewHelper.showTooltip(delete, R.string.delete_folder_hint, this);
    }
}
 
開發者ID:k0shk0sh,項目名稱:FastAccess,代碼行數:16,代碼來源:FoldersViewHolder.java


注:本文中的com.amulyakhare.textdrawable.TextDrawable.IBuilder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。