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


Java DrawerImageLoader类代码示例

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


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

示例1: performInit

import com.mikepenz.materialdrawer.util.DrawerImageLoader; //导入依赖的package包/类
private void performInit() {
    AppLog.d("performInit begin:" + System.currentTimeMillis());

    // init Drawer image loader
    DrawerImageLoader.init(new AbstractDrawerImageLoader() {
        @Override
        public void set(ImageView imageView, Uri uri, Drawable placeholder) {
            ImageLoader.loadWithCircle(getApplicationContext(), uri, imageView);
        }
    });

    // init crash helper
    CrashHelper.init(this.getApplicationContext());

    // init Push
    PushPlatform.init(this.getApplicationContext());

    // init Feedback
    FeedbackPlatform.init(this.getApplication());

    // init Share
    SharePlatform.init(this.getApplicationContext());

    AppLog.d("performInit end:" + System.currentTimeMillis());
}
 
开发者ID:mingjunli,项目名称:GithubApp,代码行数:26,代码来源:InitializeService.java

示例2: applyTo

import com.mikepenz.materialdrawer.util.DrawerImageLoader; //导入依赖的package包/类
/**
 * sets an existing image to the imageView
 *
 * @param imageView
 * @param tag       used to identify imageViews and define different placeholders
 * @return true if an image was set
 */
@Override
public boolean applyTo(ImageView imageView, String tag) {
    if (getUri() != null) {
        boolean consumed = DrawerImageLoader.getInstance().setImage(imageView, getUri(), tag);
        if (!consumed) {
            imageView.setImageURI(getUri());
        }
    } else if (getIcon() != null) {
        imageView.setImageDrawable(getIcon());
    } else if (getBitmap() != null) {
        imageView.setImageBitmap(getBitmap());
    } else if (getIconRes() != -1) {
        imageView.setImageResource(getIconRes());
    } else if (mIIcon != null) {
        imageView.setImageDrawable(new IconicsDrawable(imageView.getContext(), mIIcon).actionBar());
    } else {
        imageView.setImageBitmap(null);
        return false;
    }
    return true;
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:29,代码来源:ImageHolder.java

示例3: onCreate

import com.mikepenz.materialdrawer.util.DrawerImageLoader; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    // init logger.
    AppLog.init();

    // init Drawer image loader
    DrawerImageLoader.init(new AbstractDrawerImageLoader() {
        @Override
        public void set(ImageView imageView, Uri uri, Drawable placeholder) {
            ImageLoader.loadWithCircle(GithubApplication.this, uri, imageView);
        }
    });
}
 
开发者ID:pxx11111,项目名称:githubclient,代码行数:16,代码来源:GithubApplication.java

示例4: setImageURI

import com.mikepenz.materialdrawer.util.DrawerImageLoader; //导入依赖的package包/类
@Override
public void setImageURI(Uri uri) {
    if ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme())) {
        DrawerImageLoader.getInstance().setImage(this, uri, null);
    } else {
        super.setImageURI(uri);
    }
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:9,代码来源:BezelImageView.java

示例5: setImageOrPlaceholder

import com.mikepenz.materialdrawer.util.DrawerImageLoader; //导入依赖的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

示例6: setImageOrPlaceholder

import com.mikepenz.materialdrawer.util.DrawerImageLoader; //导入依赖的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

示例7: onCreate

import com.mikepenz.materialdrawer.util.DrawerImageLoader; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    if (!BuildConfig.DEBUG) {
        Fabric.with(this, new Crashlytics());
    }

    appComponent = DaggerAppComponent.builder()
            .appModule(new AppModule(this))
            .build();

    vkAccessTokenTracker.startTracking();
    VKSdk.initialize(this);

    Paper.init(this);

    Dexter.initialize(this);

    DrawerImageLoader.init(new AbstractDrawerImageLoader() {
        @Override
        public void set(ImageView imageView, Uri uri, Drawable placeholder, String tag) {
            Glide.with(imageView.getContext())
                    .load(uri)
                    .into(imageView);
        }
    });
}
 
开发者ID:Mavamaarten,项目名称:vk_music_android,代码行数:28,代码来源:VkApplication.java

示例8: bindViewHelper

import com.mikepenz.materialdrawer.util.DrawerImageLoader; //导入依赖的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


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