本文整理汇总了Java中com.mikepenz.materialdrawer.holder.ImageHolder类的典型用法代码示例。如果您正苦于以下问题:Java ImageHolder类的具体用法?Java ImageHolder怎么用?Java ImageHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageHolder类属于com.mikepenz.materialdrawer.holder包,在下文中一共展示了ImageHolder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: bindView
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的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());
//get the correct color for the icon
int iconColor;
if (this.isEnabled()) {
iconColor = ColorHolder.color(getIconColor(), ctx, R.attr.material_drawer_primary_icon, R.color.material_drawer_primary_icon);
} else {
iconColor = ColorHolder.color(getDisabledIconColor(), ctx, R.attr.material_drawer_hint_icon, R.color.material_drawer_hint_icon);
}
int selectedIconColor = ColorHolder.color(getSelectedIconColor(), ctx, R.attr.material_drawer_selected_text, R.color.material_drawer_selected_text);
//get the drawables for our icon and set it
Drawable icon = ImageHolder.decideIcon(getIcon(), ctx, iconColor, isIconTinted(), 1);
Drawable selectedIcon = ImageHolder.decideIcon(getSelectedIcon(), ctx, selectedIconColor, isIconTinted(), 1);
ImageHolder.applyMultiIconTo(icon, iconColor, selectedIcon, selectedIconColor, isIconTinted(), viewHolder.icon);
//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,代码来源:IconDrawerItem.java
示例2: bindView
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
@Override
public void bindView(ViewHolder viewHolder) {
if (customHeight != null) {
RecyclerView.LayoutParams lp = (RecyclerView.LayoutParams) viewHolder.itemView.getLayoutParams();
lp.height = customHeight.asPixel(viewHolder.itemView.getContext());
viewHolder.itemView.setLayoutParams(lp);
}
//set the identifier from the drawerItem here. It can be used to run tests
viewHolder.itemView.setId(hashCode());
//set the item enabled if it is
viewHolder.itemView.setEnabled(isEnabled());
//set the icon
ImageHolder.applyToOrSetInvisible(getIcon(), viewHolder.icon);
//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,代码行数:21,代码来源:MiniProfileDrawerItem.java
示例3: bindView
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
@Override
public void bindView(RecyclerView.ViewHolder holder) {
//get our viewHolder
ViewHolder viewHolder = (ViewHolder) holder;
if (customHeight != null) {
RecyclerView.LayoutParams lp = (RecyclerView.LayoutParams) viewHolder.itemView.getLayoutParams();
lp.height = customHeight.asPixel(viewHolder.itemView.getContext());
viewHolder.itemView.setLayoutParams(lp);
}
//set the identifier from the drawerItem here. It can be used to run tests
viewHolder.itemView.setId(getIdentifier());
//set the icon
ImageHolder.applyToOrSetInvisible(getIcon(), viewHolder.icon);
//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,代码行数:21,代码来源:MiniProfileDrawerItem.java
示例4: onConnected
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
@Override
public void onConnected(@Nullable Bundle bundle) {
loadingView.setVisibility(View.VISIBLE);
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.GET_ACCOUNTS)) {
Toast.makeText(getApplicationContext(), getString(R.string.should_accept_permissions), Toast.LENGTH_LONG).show();
return;
// ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.GET_ACCOUNTS}, PERMISSION_REQUEST_GET_ACCOUNTS);
} else {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.GET_ACCOUNTS}, PERMISSION_REQUEST_GET_ACCOUNTS);
}
return;
}
new Thread(new Runnable() {
@Override
public void run() {
DataManager.setGoogleAccountLink(true);
Drive.DriveApi.getAppFolder(mGoogleApiClient).listChildren(mGoogleApiClient).setResultCallback(connectDriveCallback);
}
}).start();
Person person = Plus.PeopleApi.getCurrentPerson(mGoogleApiClient);
headerResult.removeProfile(0);
headerResult.addProfiles(new ProfileDrawerItem().withName(person.getDisplayName()).withEmail(Plus.AccountApi.getAccountName(mGoogleApiClient)).withIcon(person.getImage().getUrl()));
if (person.getCover() != null && person.getCover().getCoverPhoto() != null && person.getCover().getCoverPhoto().getUrl() != null)
headerResult.setHeaderBackground(new ImageHolder(person.getCover().getCoverPhoto().getUrl()));
drawer.removeItems(4, 11);
}
开发者ID:JeanBarriere,项目名称:Note,代码行数:31,代码来源:MainActivity.java
示例5: withIcon
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
public IconDrawerItem withIcon(IIcon iicon) {
this.icon = new ImageHolder(iicon);
//if we are on api 21 or higher we use the IconicsDrawable for selection too and color it with the correct color
//else we use just the one drawable and enable tinting on press
if (Build.VERSION.SDK_INT >= 21) {
this.selectedIcon = new ImageHolder(iicon);
} else {
this.withIconTintingEnabled(true);
}
return this;
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:13,代码来源:IconDrawerItem.java
示例6: withIcon
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
public T withIcon(IIcon iicon) {
this.icon = new ImageHolder(iicon);
//if we are on api 21 or higher we use the IconicsDrawable for selection too and color it with the correct color
//else we use just the one drawable and enable tinting on press
if (Build.VERSION.SDK_INT >= 21) {
this.selectedIcon = new ImageHolder(iicon);
} else {
this.withIconTintingEnabled(true);
}
return (T) this;
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:13,代码来源:BaseDrawerItem.java
示例7: updateIcon
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
/**
* update the name for a specific drawerItem
* identified by its id
*
* @param identifier
* @param image
*/
public void updateIcon(long identifier, ImageHolder image) {
IDrawerItem drawerItem = getDrawerItem(identifier);
if (drawerItem instanceof Iconable) {
Iconable pdi = (Iconable) drawerItem;
pdi.withIcon(image);
updateItem((IDrawerItem) pdi);
}
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:16,代码来源:Drawer.java
示例8: setImageOrPlaceholder
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
/**
* small helper method to set an profile image or a placeholder
*
* @param iv
* @param imageHolder
*/
private void setImageOrPlaceholder(ImageView iv, ImageHolder imageHolder) {
//cancel previous started image loading processes
DrawerImageLoader.getInstance().cancelImage(iv);
//set the placeholder
iv.setImageDrawable(DrawerImageLoader.getInstance().getImageLoader().placeholder(iv.getContext(), DrawerImageLoader.Tags.PROFILE.name()));
//set the real image (probably also the uri)
ImageHolder.applyTo(imageHolder, iv, DrawerImageLoader.Tags.PROFILE.name());
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:15,代码来源:AccountHeaderBuilder.java
示例9: updateIcon
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
/**
* update the name for a specific drawerItem
* identified by its id
*
* @param identifier
* @param image
*/
public void updateIcon(int identifier, ImageHolder image) {
IDrawerItem drawerItem = getDrawerItem(identifier);
if (drawerItem instanceof Iconable) {
Iconable pdi = (Iconable) drawerItem;
pdi.withIcon(image);
updateItem((IDrawerItem) pdi);
}
}
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:16,代码来源:Drawer.java
示例10: setImageOrPlaceholder
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
/**
* small helper method to set an profile image or a placeholder
*
* @param iv
* @param imageHolder
*/
private void setImageOrPlaceholder(ImageView iv, ImageHolder imageHolder) {
//cancel previous started image loading processes
DrawerImageLoader.getInstance().cancelImage(iv);
//set the placeholder
iv.setImageDrawable(DrawerUIUtils.getPlaceHolder(iv.getContext()));
//set the real image (probably also the uri)
ImageHolder.applyTo(imageHolder, iv, DrawerImageLoader.Tags.PROFILE.name());
}
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:15,代码来源:AccountHeaderBuilder.java
示例11: bindView
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
@Override
public void bindView(RecyclerView.ViewHolder holder) {
Context ctx = holder.itemView.getContext();
ViewHolder viewHolder = (ViewHolder) holder;
viewHolder.itemView.setId(getIdentifier());
viewHolder.itemView.setSelected(isSelected());
viewHolder.itemView.setTag(this);
int selectedColor = getSelectedColor(ctx);
int color = getColor(ctx);
int selectedTextColor = getSelectedTextColor(ctx);
int iconColor = getIconColor(ctx);
int selectedIconColor = getSelectedIconColor(ctx);
UIUtils.setBackground(viewHolder.view, DrawerUIUtils.getSelectableBackground(ctx, selectedColor));
StringHolder.applyTo(this.getName(), viewHolder.name);
StringHolder.applyToOrHide(this.getDescription(), viewHolder.description);
viewHolder.name.setTextColor(getTextColorStateList(color, selectedTextColor));
ColorHolder.applyToOr(getDescriptionTextColor(), viewHolder.description, getTextColorStateList(color, selectedTextColor));
if (getTypeface() != null) {
viewHolder.name.setTypeface(getTypeface());
viewHolder.description.setTypeface(getTypeface());
}
Drawable icon = ImageHolder.decideIcon(getIcon(), ctx, iconColor, isIconTinted(), 1);
Drawable selectedIcon = ImageHolder.decideIcon(getSelectedIcon(), ctx, selectedIconColor, isIconTinted(), 1);
ImageHolder.applyMultiIconTo(icon, iconColor, selectedIcon, selectedIconColor, isIconTinted(), viewHolder.icon);
ImageHolder.applyTo(expanderIcon, viewHolder.expander);
}
开发者ID:adamgrieger,项目名称:Android-PythonEasyDocs,代码行数:34,代码来源:ExpandableDrawerItem.java
示例12: bindView
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
@Override
public void bindView(RecyclerView.ViewHolder holder) {
//get our viewHolder
ViewHolder viewHolder = (ViewHolder) holder;
//set the identifier from the drawerItem here. It can be used to run tests
viewHolder.itemView.setId(getIdentifier());
//set the icon
ImageHolder.applyToOrSetInvisible(getIcon(), viewHolder.icon);
//call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required)
onPostBindView(this, holder.itemView);
}
开发者ID:amatkivskiy,项目名称:MaterialDrawer-Xamarin,代码行数:15,代码来源:MiniProfileDrawerItem.java
示例13: withIcon
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
public TreeItemDrawerItem withIcon(String url) {
icon = new ImageHolder(url);
return this;
}
开发者ID:schaal,项目名称:ocreader,代码行数:5,代码来源:TreeItemDrawerItem.java
示例14: getIcon
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
@Override
public ImageHolder getIcon() {
return null;
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:5,代码来源:AccountDividerDrawerItem.java
示例15: withSelectedIcon
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
public IconDrawerItem withSelectedIcon(Drawable selectedIcon) {
this.selectedIcon = new ImageHolder(selectedIcon);
return this;
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:5,代码来源:IconDrawerItem.java
示例16: getIcon
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
public ImageHolder getIcon() {
return icon;
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:4,代码来源:IconDrawerItem.java
示例17: getSelectedIcon
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
public ImageHolder getSelectedIcon() {
return selectedIcon;
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:4,代码来源:IconDrawerItem.java
示例18: withIcon
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
public T withIcon(String url) {
this.icon = new ImageHolder(url);
return (T) this;
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:5,代码来源:CustomUrlBasePrimaryDrawerItem.java
示例19: bindViewHelper
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
/**
* a helper method to have the logic for all secondaryDrawerItems only once
*
* @param viewHolder
*/
protected void bindViewHelper(CustomBaseViewHolder viewHolder) {
Context ctx = viewHolder.itemView.getContext();
//set the identifier from the drawerItem here. It can be used to run tests
viewHolder.itemView.setId(hashCode());
//set the item selected if it is
viewHolder.itemView.setSelected(isSelected());
//
viewHolder.itemView.setTag(this);
//get the correct color for the background
int selectedColor = getSelectedColor(ctx);
//get the correct color for the text
int color = getColor(ctx);
int selectedTextColor = getSelectedTextColor(ctx);
//get the correct color for the icon
int iconColor = getIconColor(ctx);
int selectedIconColor = getSelectedIconColor(ctx);
//set the background for the item
UIUtils.setBackground(viewHolder.view, UIUtils.getSelectableBackground(ctx, selectedColor, true));
//set the text for the name
StringHolder.applyTo(this.getName(), viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(this.getDescription(), viewHolder.description);
//set the colors for textViews
viewHolder.name.setTextColor(getTextColorStateList(color, selectedTextColor));
//set the description text color
ColorHolder.applyToOr(getDescriptionTextColor(), viewHolder.description, getTextColorStateList(color, selectedTextColor));
//define the typeface for our textViews
if (getTypeface() != null) {
viewHolder.name.setTypeface(getTypeface());
viewHolder.description.setTypeface(getTypeface());
}
//we make sure we reset the image first before setting the new one in case there is an empty one
DrawerImageLoader.getInstance().cancelImage(viewHolder.icon);
viewHolder.icon.setImageBitmap(null);
//get the drawables for our icon and set it
ImageHolder.applyTo(icon, viewHolder.icon, "customUrlItem");
//for android API 17 --> Padding not applied via xml
DrawerUIUtils.setDrawerVerticalPadding(viewHolder.view);
}
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:54,代码来源:CustomUrlBasePrimaryDrawerItem.java
示例20: bindView
import com.mikepenz.materialdrawer.holder.ImageHolder; //导入依赖的package包/类
@Override
public void bindView(ViewHolder viewHolder) {
Context ctx = viewHolder.itemView.getContext();
//set a different height for this item
if (mCustomHeight != null) {
RecyclerView.LayoutParams lp = (RecyclerView.LayoutParams) viewHolder.itemView.getLayoutParams();
lp.height = mCustomHeight.asPixel(ctx);
viewHolder.itemView.setLayoutParams(lp);
}
//set the identifier from the drawerItem here. It can be used to run tests
viewHolder.itemView.setId(hashCode());
//set the item enabled if it is
viewHolder.itemView.setEnabled(isEnabled());
//set the item selected if it is
viewHolder.itemView.setSelected(isSelected());
//
viewHolder.itemView.setTag(this);
//get the correct color for the icon
int iconColor = getIconColor(ctx);
int selectedIconColor = getSelectedIconColor(ctx);
if (mEnableSelectedBackground) {
//get the correct color for the background
int selectedColor = getSelectedColor(ctx);
//set the background for the item
UIUtils.setBackground(viewHolder.view, UIUtils.getSelectableBackground(ctx, selectedColor, true));
}
//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);
}
//get the drawables for our icon and set it
Drawable icon = ImageHolder.decideIcon(getIcon(), ctx, iconColor, isIconTinted(), 1);
Drawable selectedIcon = ImageHolder.decideIcon(getSelectedIcon(), ctx, selectedIconColor, isIconTinted(), 1);
ImageHolder.applyMultiIconTo(icon, iconColor, selectedIcon, selectedIconColor, isIconTinted(), viewHolder.icon);
//for android API 17 --> Padding not applied via xml
int verticalPadding = ctx.getResources().getDimensionPixelSize(R.dimen.material_drawer_padding);
int topBottomPadding = ctx.getResources().getDimensionPixelSize(R.dimen.material_mini_drawer_item_padding);
viewHolder.itemView.setPadding(verticalPadding, topBottomPadding, verticalPadding, topBottomPadding);
//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,代码行数:55,代码来源:MiniDrawerItem.java
注:本文中的com.mikepenz.materialdrawer.holder.ImageHolder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论