本文整理汇总了Java中com.mikepenz.materialdrawer.holder.StringHolder类的典型用法代码示例。如果您正苦于以下问题:Java StringHolder类的具体用法?Java StringHolder怎么用?Java StringHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringHolder类属于com.mikepenz.materialdrawer.holder包,在下文中一共展示了StringHolder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: bindView
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
/**
* binds the data of this item onto the viewHolder
*
* @param viewHolder the viewHolder of this item
*/
@Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//set the text for the name
StringHolder.applyTo(name, viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(description, viewHolder.description);
viewHolder.swipeResultContent.setVisibility(swipedDirection != 0 ? View.VISIBLE : View.GONE);
viewHolder.itemContent.setVisibility(swipedDirection != 0 ? View.GONE : View.VISIBLE);
CharSequence swipedAction = null;
CharSequence swipedText = null;
if (swipedDirection != 0) {
swipedAction = viewHolder.itemView.getContext().getString(R.string.action_undo);
swipedText = swipedDirection == ItemTouchHelper.LEFT ? "Removed" : "Archived";
viewHolder.swipeResultContent.setBackgroundColor(ContextCompat.getColor(viewHolder.itemView.getContext(), swipedDirection == ItemTouchHelper.LEFT ? R.color.md_red_900 : R.color.md_blue_900));
}
viewHolder.swipedAction.setText(swipedAction == null ? "" : swipedAction);
viewHolder.swipedText.setText(swipedText == null ? "" : swipedText);
viewHolder.swipedActionRunnable = this.swipedAction;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:SwipeableItem.java
示例2: bindView
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
@Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//get the context
Context ctx = viewHolder.itemView.getContext();
//set the background for the item
UIUtils.setBackground(viewHolder.view, FastAdapterUIUtils.getSelectableBackground(ctx, Color.RED, true));
//set the text for the name
StringHolder.applyTo(name, viewHolder.name);
//set the text for the description or hide
int selectedSubItems = 0;
if (mSubSelectionProvider != null)
selectedSubItems = mSubSelectionProvider.getSelectedSubItems();
StringHolder descr = new StringHolder(description.getText());
if (selectedSubItems > 0)
descr.setText("Selected children: " + selectedSubItems + "/" + getSubItems().size());
StringHolder.applyToOrHide(descr, viewHolder.description);
viewHolder.description.setTextColor(selectedSubItems == 0 ? Color.BLACK : Color.RED);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:HeaderSelectionItem.java
示例3: bindView
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
/**
* binds the data of this item onto the viewHolder
*
* @param viewHolder the viewHolder of this item
*/
@Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//get the context
Context ctx = viewHolder.itemView.getContext();
//set the background for the item
UIUtils.setBackground(viewHolder.view, FastAdapterUIUtils.getSelectableBackground(ctx, Color.RED, true));
//set the text for the name
StringHolder.applyTo(name, viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(description, viewHolder.description);
if (isExpanded()) {
ViewCompat.setRotation(viewHolder.icon, 0);
} else {
ViewCompat.setRotation(viewHolder.icon, 180);
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:SimpleSubExpandableItem.java
示例4: bindView
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
@Override
public void bindView(ViewHolder viewHolder) {
Context ctx = viewHolder.itemView.getContext();
//bind the basic view parts
bindViewHelper(viewHolder);
//set the text for the badge or hide
boolean badgeVisible = StringHolder.applyToOrHide(mBadge, viewHolder.badge);
//style the badge if it is visible
if (badgeVisible) {
mBadgeStyle.style(viewHolder.badge, getTextColorStateList(getColor(ctx), getSelectedTextColor(ctx)));
viewHolder.badgeContainer.setVisibility(View.VISIBLE);
} else {
viewHolder.badgeContainer.setVisibility(View.GONE);
}
//define the typeface for our textViews
if (getTypeface() != null) {
viewHolder.badge.setTypeface(getTypeface());
}
//call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required)
onPostBindView(this, viewHolder.itemView);
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:26,代码来源:CustomUrlPrimaryDrawerItem.java
示例5: bindView
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
@Override
public void bindView(ViewHolder viewHolder) {
Context ctx = viewHolder.itemView.getContext();
//bind the basic view parts
bindViewHelper(viewHolder);
//set the text for the badge or hide
boolean badgeVisible = StringHolder.applyToOrHide(mBadge, viewHolder.badge);
//style the badge if it is visible
if (badgeVisible) {
mBadgeStyle.style(viewHolder.badge, getTextColorStateList(getColor(ctx), getSelectedTextColor(ctx)));
viewHolder.badgeContainer.setVisibility(View.VISIBLE);
} else {
viewHolder.badgeContainer.setVisibility(View.GONE);
}
//define the typeface for our textViews
if (getTypeface() != null) {
viewHolder.badge.setTypeface(getTypeface());
}
//call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required)
onPostBindView(this, viewHolder.itemView);
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:25,代码来源:PrimaryDrawerItem.java
示例6: bindView
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
/**
* binds the data of this item onto the viewHolder
*
* @param viewHolder the viewHolder of this item
*/
@Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
viewHolder.checkBox.setChecked(isSelected());
//set the text for the name
StringHolder.applyTo(name, viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(description, viewHolder.description);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:CheckBoxSampleItem.java
示例7: bindView
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
/**
* binds the data of this item onto the viewHolder
*
* @param viewHolder the viewHolder of this item
*/
@Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//get the context
Context ctx = viewHolder.itemView.getContext();
//set the background for the item
UIUtils.setBackground(viewHolder.view, FastAdapterUIUtils.getSelectableBackground(ctx, Color.RED, true));
//set the text for the name
StringHolder.applyTo(name, viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(description, viewHolder.description);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:SimpleItem.java
示例8: bindView
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
/**
* binds the data of this item onto the viewHolder
*
* @param viewHolder the viewHolder of this item
*/
@Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
viewHolder.radioButton.setChecked(isSelected());
//set the text for the name
StringHolder.applyTo(name, viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(description, viewHolder.description);
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:RadioButtonSampleItem.java
示例9: updateBadge
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
private void updateBadge(@NonNull Badgeable badgeable, @Nullable String badgeString) {
StringHolder oldBadge = badgeable.getBadge();
StringHolder newBadge = new StringHolder(badgeString);
if (!compareBadges(oldBadge, newBadge)) {
badgeable.withBadge(newBadge);
drawer.updateItem((IDrawerItem)badgeable);
}
}
开发者ID:schaal,项目名称:ocreader,代码行数:9,代码来源:BaseDrawerManager.java
示例10: bindView
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
@Override
public void bindView(ViewHolder viewHolder) {
Context ctx = viewHolder.itemView.getContext();
//set the identifier from the drawerItem here. It can be used to run tests
viewHolder.itemView.setId(hashCode());
//define this item to be not clickable nor enabled
viewHolder.view.setClickable(false);
viewHolder.view.setEnabled(false);
//define the text color
viewHolder.name.setTextColor(ColorHolder.color(getTextColor(), ctx, R.attr.material_drawer_secondary_text, R.color.material_drawer_secondary_text));
//set the text for the name
StringHolder.applyTo(this.getName(), viewHolder.name);
//define the typeface for our textViews
if (getTypeface() != null) {
viewHolder.name.setTypeface(getTypeface());
}
//hide the divider if we do not need one
if (this.hasDivider()) {
viewHolder.divider.setVisibility(View.VISIBLE);
} else {
viewHolder.divider.setVisibility(View.GONE);
}
//set the color for the divider
viewHolder.divider.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(ctx, R.attr.material_drawer_divider, R.color.material_drawer_divider));
//call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required)
onPostBindView(this, viewHolder.itemView);
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:36,代码来源:SectionDrawerItem.java
示例11: updateBadge
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
/**
* update the badge for a specific drawerItem
* identified by its id
*
* @param identifier
* @param badge
*/
public void updateBadge(long identifier, StringHolder badge) {
IDrawerItem drawerItem = getDrawerItem(identifier);
if (drawerItem instanceof Badgeable) {
Badgeable badgeable = (Badgeable) drawerItem;
badgeable.withBadge(badge);
updateItem((IDrawerItem) badgeable);
}
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:16,代码来源:Drawer.java
示例12: updateName
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
/**
* update the name for a specific drawerItem
* identified by its id
*
* @param identifier
* @param name
*/
public void updateName(long identifier, StringHolder name) {
IDrawerItem drawerItem = getDrawerItem(identifier);
if (drawerItem instanceof Nameable) {
Nameable pdi = (Nameable) drawerItem;
pdi.withName(name);
updateItem((IDrawerItem) pdi);
}
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:16,代码来源:Drawer.java
示例13: onEvent
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(ImTypeMessageEvent event){
drawer.updateBadge(DRAWER_MSG, new StringHolder(""));
//当收到了新的消息时,不需要重新获取所有的会话列表
//只需要将新收到的消息进行处理即可:
//1.增加该会话的未读消息数
addUnreadMsgCount(event.conversation);
//2.将新收到的消息本地存储(?)
//3.新收到的消息显示在会话列表
}
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:11,代码来源:MainActivity.java
示例14: updateBadge
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
/**
* update the badge for a specific drawerItem
* identified by its id
*
* @param identifier
* @param badge
*/
public void updateBadge(int identifier, StringHolder badge) {
IDrawerItem drawerItem = getDrawerItem(identifier);
if (drawerItem instanceof Badgeable) {
Badgeable badgeable = (Badgeable) drawerItem;
badgeable.withBadge(badge);
updateItem((IDrawerItem) badgeable);
}
}
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:16,代码来源:Drawer.java
示例15: updateName
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
/**
* update the name for a specific drawerItem
* identified by its id
*
* @param identifier
* @param name
*/
public void updateName(int identifier, StringHolder name) {
IDrawerItem drawerItem = getDrawerItem(identifier);
if (drawerItem instanceof Nameable) {
Nameable pdi = (Nameable) drawerItem;
pdi.withName(name);
updateItem((IDrawerItem) pdi);
}
}
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:16,代码来源:Drawer.java
示例16: bindView
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
@Override
public void bindView(RecyclerView.ViewHolder holder) {
Context ctx = holder.itemView.getContext();
//get our viewHolder
ViewHolder viewHolder = (ViewHolder) holder;
//bind the basic view parts
bindViewHelper((BaseViewHolder) holder);
//set the text for the badge or hide
boolean badgeVisible = StringHolder.applyToOrHide(mBadge, viewHolder.badge);
//style the badge if it is visible
if (badgeVisible) {
mBadgeStyle.style(viewHolder.badge, getTextColorStateList(getColor(ctx), getSelectedTextColor(ctx)));
viewHolder.badgeContainer.setVisibility(View.VISIBLE);
} else {
viewHolder.badgeContainer.setVisibility(View.GONE);
}
//define the typeface for our textViews
if (getTypeface() != null) {
viewHolder.badge.setTypeface(getTypeface());
}
//call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required)
onPostBindView(this, holder.itemView);
}
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:29,代码来源:SecondaryDrawerItem.java
示例17: bindView
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
@Override
public void bindView(RecyclerView.ViewHolder holder) {
Context ctx = holder.itemView.getContext();
//get our viewHolder
ViewHolder viewHolder = (ViewHolder) holder;
//set the identifier from the drawerItem here. It can be used to run tests
holder.itemView.setId(getIdentifier());
//define this item to be not clickable nor enabled
viewHolder.view.setClickable(false);
viewHolder.view.setEnabled(false);
//define the text color
viewHolder.name.setTextColor(ColorHolder.color(getTextColor(), ctx, R.attr.material_drawer_secondary_text, R.color.material_drawer_secondary_text));
//set the text for the name
StringHolder.applyTo(this.getName(), viewHolder.name);
//hide the divider if we do not need one
if (this.hasDivider()) {
viewHolder.divider.setVisibility(View.VISIBLE);
} else {
viewHolder.divider.setVisibility(View.GONE);
}
//set the color for the divider
viewHolder.divider.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(ctx, R.attr.material_drawer_divider, R.color.material_drawer_divider));
//call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required)
onPostBindView(this, holder.itemView);
}
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:34,代码来源:SectionDrawerItem.java
示例18: withName
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
public CheckBoxSampleItem withName(String Name) {
this.name = new StringHolder(Name);
return this;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:CheckBoxSampleItem.java
示例19: withDescription
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
public CheckBoxSampleItem withDescription(String description) {
this.description = new StringHolder(description);
return this;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:CheckBoxSampleItem.java
示例20: withName
import com.mikepenz.materialdrawer.holder.StringHolder; //导入依赖的package包/类
public SimpleItem withName(String Name) {
this.name = new StringHolder(Name);
return this;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:5,代码来源:SimpleItem.java
注:本文中的com.mikepenz.materialdrawer.holder.StringHolder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论