本文整理匯總了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);
}
示例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);
}
示例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;
}
示例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()));
}
});
}
示例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);
}
}
});
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}
}