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


Java LevelListDrawable.addLevel方法代码示例

本文整理汇总了Java中android.graphics.drawable.LevelListDrawable.addLevel方法的典型用法代码示例。如果您正苦于以下问题:Java LevelListDrawable.addLevel方法的具体用法?Java LevelListDrawable.addLevel怎么用?Java LevelListDrawable.addLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.drawable.LevelListDrawable的用法示例。


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

示例1: onFinishInflate

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mDeviceIcon = (ImageView) findViewById(R.id.device_icon);
    mTimeLabel = (TextView) findViewById(R.id.time_label);
    mDeviceLabel = (TextView) findViewById(R.id.device_label);
    mExpandCollapseIcon = (ImageView) findViewById(R.id.expand_collapse_icon);

    // Create drawable for expand/collapse arrow.
    LevelListDrawable collapseIcon = new LevelListDrawable();
    collapseIcon.addLevel(DRAWABLE_LEVEL_COLLAPSED, DRAWABLE_LEVEL_COLLAPSED,
            TintedDrawable.constructTintedDrawable(getResources(), R.drawable.ic_expanded));
    TintedDrawable collapse =
            TintedDrawable.constructTintedDrawable(getResources(), R.drawable.ic_collapsed);
    collapse.setTint(
            ApiCompatibilityUtils.getColorStateList(getResources(), R.color.blue_mode_tint));
    collapseIcon.addLevel(DRAWABLE_LEVEL_EXPANDED, DRAWABLE_LEVEL_EXPANDED, collapse);
    mExpandCollapseIcon.setImageDrawable(collapseIcon);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:20,代码来源:RecentTabsGroupView.java

示例2: updateColor

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
private void updateColor() {
    Drawable leftDrawable = name.getCompoundDrawablesRelative()[0];
    String domain = entity.getDomain();
    if (leftDrawable != null && (domain.equals(LIGHT) || domain.equals(SWITCH))) {
        if (!(leftDrawable instanceof LevelListDrawable)) {
            LevelListDrawable levelListDrawable = new LevelListDrawable();
            // Add states
            levelListDrawable.addLevel(1, 1, leftDrawable);
            BitmapDrawable enabledDrawable = (BitmapDrawable) leftDrawable.getConstantState().newDrawable().mutate();
            enabledDrawable.setTintList(ColorStateList.valueOf(ContextCompat.getColor(name.getContext(), R.color.color_activated)));
            levelListDrawable.addLevel(2, 2, enabledDrawable);
            // Restore bounds
            levelListDrawable.setBounds(0, 0, name.getResources().getDimensionPixelSize(R.dimen.icon_size), name.getResources().getDimensionPixelSize(R.dimen.icon_size));

            // Set drawable
            name.setCompoundDrawablesRelative(levelListDrawable, null, null, null);
            leftDrawable = levelListDrawable;
        }
        leftDrawable.setLevel(entity.state.equals(HassUtils.getOnState(entity, false)) ? 1 : 2);
    }
}
 
开发者ID:Maxr1998,项目名称:home-assistant-Android,代码行数:22,代码来源:SwitchViewHolder.java

示例3: loadFromMemCache

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@Override
public Drawable loadFromMemCache(ImageCache cache, Resources res) {
	if(cache == null)
		return null;
	LevelListDrawable sld = new LevelListDrawable();
	for (int i = 0; i < urls.size(); i++) {
		Bitmap bmp = cache.getBitmapFromMemCache(getStoreKey(i));
		if (mCachePolicy == CachePolicy.NO_CACHE)
			cache.removeBitmapFromCache(getStoreKey(i));
		if (bmp == null)
			return null;
		sld.addLevel(levels.get(i)[0], levels.get(i)[1],
				new BitmapDrawable(res, bmp));
	}
	return sld;
}
 
开发者ID:ROKOLabs,项目名称:ROKO.Stickers-Android,代码行数:17,代码来源:LevelListImageFetchTask.java

示例4: onFinishInflate

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@Override
public void onFinishInflate() {
    super.onFinishInflate();
    mDeviceIcon = (ImageView) findViewById(R.id.device_icon);
    mTimeLabel = (TextView) findViewById(R.id.time_label);
    mDeviceLabel = (TextView) findViewById(R.id.device_label);
    mExpandCollapseIcon = (ImageView) findViewById(R.id.expand_collapse_icon);

    // Create drawable for expand/collapse arrow.
    LevelListDrawable collapseIcon = new LevelListDrawable();
    collapseIcon.addLevel(DRAWABLE_LEVEL_COLLAPSED, DRAWABLE_LEVEL_COLLAPSED,
            TintedDrawable.constructTintedDrawable(getResources(), R.drawable.ic_expand));
    TintedDrawable collapse =
            TintedDrawable.constructTintedDrawable(getResources(), R.drawable.ic_collapse);
    collapse.setTint(getResources().getColorStateList(R.color.blue_mode_tint));
    collapseIcon.addLevel(DRAWABLE_LEVEL_EXPANDED, DRAWABLE_LEVEL_EXPANDED, collapse);
    mExpandCollapseIcon.setImageDrawable(collapseIcon);
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:19,代码来源:RecentTabsGroupView.java

示例5: loadFromDiskCache

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@Override
public Drawable loadFromDiskCache(ImageCache cache, Resources res) {
	if(cache == null)
		return null;
	LevelListDrawable sld = new LevelListDrawable();
	for (int i = 0; i < urls.size(); i++) {
		Bitmap bmp = cache.getBitmapFromDiskCache(getStoreKey(i));
		if (bmp == null)
			return null;
		cache.addBitmapToCache(getStoreKey(i), bmp);
		sld.addLevel(levels.get(i)[0], levels.get(i)[1],
				new BitmapDrawable(res, bmp));
	}
	return sld;
}
 
开发者ID:ROKOLabs,项目名称:ROKO.Stickers-Android,代码行数:16,代码来源:LevelListImageFetchTask.java

示例6: drawable

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@NonNull
private static Drawable drawable(Context context) {
    LevelListDrawable levels = new AppLevelListDrawable();
    levels.addLevel(PLAY_ICON_LEVEL, PLAY_ICON_LEVEL, spinnerDrawable(context));
    levels.addLevel(STOP_ICON_LEVEL, STOP_ICON_LEVEL, speakerDrawable(context));
    int radius = getDimensionPixelSize(context, R.dimen.audio_url_span_loading_spinner_radius);
    levels.setBounds(0, 0, radius * 2, radius * 2);
    return levels;
}
 
开发者ID:gnosygnu,项目名称:xowa_android,代码行数:10,代码来源:AudioUrlSpan.java

示例7: getDrawable

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@Override
public Drawable getDrawable(String source) {
    Logger.d("URLImageParser", "source:" + source);
    final LevelListDrawable mDrawable = new LevelListDrawable();
    Drawable empty = new BitmapDrawable();
    mDrawable.addLevel(0, 0, empty);
    mDrawable.setBounds(0, 0, empty.getIntrinsicWidth(), empty.getIntrinsicHeight());
    // get the actual source
    ImageLoader.loadBitmapFromUrl(context, source, cookie, referer, new BaseBitmapDataSubscriber() {
        @Override
        protected void onNewResultImpl(Bitmap bitmap) {
            if (bitmap != null) {
                Bitmap copy = bitmap.copy(Bitmap.Config.ARGB_8888, true);
                Drawable drawable = new BitmapDrawable(context.getResources(), copy);
                mDrawable.addLevel(1, 1, drawable);
                mDrawable.setBounds(0, 0, copy.getWidth(), copy.getHeight());
                mDrawable.setLevel(1);
                new Handler(context.getMainLooper()).post(new Runnable() {
                    @Override
                    public void run() {
                        CharSequence t = textView.getText();
                        textView.setText(t);
                    }
                });
            }
        }

        @Override
        protected void onFailureImpl(DataSource<CloseableReference<CloseableImage>> dataSource) {
        }
    });

    // return reference to URLDrawable where I will change with actual image from
    // the src tag
    return mDrawable;
}
 
开发者ID:PureDark,项目名称:H-Viewer,代码行数:37,代码来源:URLImageParser.java

示例8: getDrawable

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@Override
public Drawable getDrawable(String source) {
    LevelListDrawable d = new LevelListDrawable();
    Drawable empty = getResources().getDrawable(R.drawable.ic_launcher);
    d.addLevel(0, 0, empty);
    d.setBounds(0, 0, empty.getIntrinsicWidth(), empty.getIntrinsicHeight());

    new LoadImage().execute(source, d);

    return d;
}
 
开发者ID:jungho-shin,项目名称:SIHSchool,代码行数:12,代码来源:SNoticeDetail.java

示例9: createElementDrawableChildRoot

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@Override
public ElementDrawableChildRoot createElementDrawableChildRoot(DOMElemDrawable rootElem, AttrDrawableContext attrCtx)
{
    ElementDrawableChildRoot elementDrawableRoot = new ElementDrawableChildRoot();

    XMLInflaterDrawable xmlInflaterDrawable = attrCtx.getXMLInflaterDrawable();
    xmlInflaterDrawable.processChildElements(rootElem,elementDrawableRoot,attrCtx);
    ArrayList<ElementDrawableChildBase> itemList = elementDrawableRoot.getElementDrawableChildList();

    LevelListDrawable drawable = new LevelListDrawable();

    for(int i = 0; i < itemList.size(); i++)
    {
        LevelListDrawableChildItem item = (LevelListDrawableChildItem)itemList.get(i);

        Drawable drawableChild = item.getDrawable();

        Integer minObj = item.getMinLevel();
        Integer maxObj = item.getMaxLevel();
        int min = minObj != null ? minObj : 0; // Según el código fuente
        int max = maxObj != null ? maxObj : 0; // Según el código fuente

        drawable.addLevel(min,max,drawableChild);

        setCallback(drawableChild,drawable); // Se puede ver en el código fuente si se sigue hasta addChild(Drawable dr)
    }

    elementDrawableRoot.setDrawable(drawable);

    return elementDrawableRoot;
}
 
开发者ID:jmarranz,项目名称:itsnat_droid,代码行数:32,代码来源:ClassDescLevelListDrawable.java

示例10: getShuffleDrawable36

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
public static LevelListDrawable getShuffleDrawable36(Context context, int color) {
    final int res = R.drawable.ic_shuffle_white_36dp;
    final LevelListDrawable d = new LevelListDrawable();
    d.addLevel(0,0, context.getResources().getDrawable(res));
    d.addLevel(1, 2, tintDrawable(context, res, color));
    return d;
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:8,代码来源:PlaybackDrawableTint.java

示例11: getRepeatDrawable36

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
public static LevelListDrawable getRepeatDrawable36(Context context, int color) {
    final int one = R.drawable.ic_repeat_once_white_36dp;
    final int all = R.drawable.ic_repeat_white_36dp;
    final LevelListDrawable d = new LevelListDrawable();
    d.addLevel(0, 0, context.getResources().getDrawable(all));
    d.addLevel(1, 1, tintDrawable(context, one, color));
    d.addLevel(2, 2, tintDrawable(context, all, color));
    return d;
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:10,代码来源:PlaybackDrawableTint.java

示例12: doRepeatDrawable

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
static void doRepeatDrawable(ImageButton v, boolean is24, int color) {
    int one = is24 ? R.drawable.ic_repeat_once_white_24dp : R.drawable.ic_repeat_once_white_36dp;
    int all = is24 ? R.drawable.ic_repeat_white_24dp : R.drawable.ic_repeat_white_36dp;
    LevelListDrawable d = (LevelListDrawable) v.getDrawable();
    d.addLevel(1, 1, tintDrawable(v.getContext(), one, color));
    d.addLevel(2, 2, tintDrawable(v.getContext(), all, color));
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:8,代码来源:PlaybackDrawableTint.java

示例13: getRepeatDrawable36

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
public static LevelListDrawable getRepeatDrawable36(Context context, int color) {
    final int one = R.drawable.ic_repeat_one_white_36dp;
    final int all = R.drawable.ic_repeat_white_36dp;
    final LevelListDrawable d = new LevelListDrawable();
    d.addLevel(0, 0, context.getResources().getDrawable(all));
    d.addLevel(1, 1, tintDrawable(context, one, color));
    d.addLevel(2, 2, tintDrawable(context, all, color));
    return d;
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:10,代码来源:PlaybackDrawableTint.java

示例14: doRepeatDrawable

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
static void doRepeatDrawable(ImageButton v, boolean is24, int color) {
    int one = is24 ? R.drawable.ic_repeat_one_white_24dp : R.drawable.ic_repeat_one_white_36dp;
    int all = is24 ? R.drawable.ic_repeat_white_24dp : R.drawable.ic_repeat_white_36dp;
    LevelListDrawable d = (LevelListDrawable) v.getDrawable();
    d.addLevel(1, 1, tintDrawable(v.getContext(), one, color));
    d.addLevel(2, 2, tintDrawable(v.getContext(), all, color));
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:8,代码来源:PlaybackDrawableTint.java

示例15: getDrawable

import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@Override
public Drawable getDrawable(String source) {
    LevelListDrawable drawable = new LevelListDrawable();
    Drawable empty = ConversationActivity.this.getResources().getDrawable(R.drawable.ic_menu_refresh);
    drawable.addLevel(0, 0, empty);
    drawable.setBounds(0, 0, empty.getIntrinsicWidth(), empty.getIntrinsicHeight());
    new LoadImage().execute(source, drawable, this.mTextView);
    return drawable;
}
 
开发者ID:mcilloni,项目名称:NerdzMessenger,代码行数:10,代码来源:ConversationActivity.java


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