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


Java Resources.getSystem方法代码示例

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


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

示例1: getDescription

import android.content.res.Resources; //导入方法依赖的package包/类
public String getDescription() {
    final Resources res = Resources.getSystem();
    if ((flags & FLAG_SD) != 0) {
        if (isInteresting(label)) {
            return res.getString(R.string.storage_sd_card_label, label);
        } else {
            return res.getString(R.string.storage_sd_card);
        }
    } else if ((flags & FLAG_USB) != 0) {
        if (isInteresting(label)) {
            return res.getString(R.string.storage_usb_drive_label, label);
        } else {
            return res.getString(R.string.storage_usb_drive);
        }
    } else {
        return null;
    }
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:19,代码来源:DiskInfo.java

示例2: getPreKKDefaultWallpaperInfo

import android.content.res.Resources; //导入方法依赖的package包/类
private ResourceWallpaperInfo getPreKKDefaultWallpaperInfo() {
    Resources sysRes = Resources.getSystem();
    int resId = sysRes.getIdentifier("default_wallpaper", "drawable", "android");

    File defaultThumbFile = getDefaultThumbFile();
    Bitmap thumb = null;
    boolean defaultWallpaperExists = false;
    if (defaultThumbFile.exists()) {
        thumb = BitmapFactory.decodeFile(defaultThumbFile.getAbsolutePath());
        defaultWallpaperExists = true;
    } else {
        Resources res = getResources();
        Point defaultThumbSize = getDefaultThumbnailSize(res);
        int rotation = BitmapUtils.getRotationFromExif(res, resId);
        thumb = createThumbnail(
                defaultThumbSize, getContext(), null, null, sysRes, resId, rotation, false);
        if (thumb != null) {
            defaultWallpaperExists = saveDefaultWallpaperThumb(thumb);
        }
    }
    if (defaultWallpaperExists) {
        return new ResourceWallpaperInfo(sysRes, resId, new BitmapDrawable(thumb));
    }
    return null;
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:26,代码来源:WallpaperPickerActivity.java

示例3: getIcon

import android.content.res.Resources; //导入方法依赖的package包/类
public Drawable getIcon(int density) {
    int iconRes = mResolveInfo.getIconResource();
    Resources resources = null;
    Drawable icon = null;
    // Get the preferred density icon from the app's resources
    if (density != 0 && iconRes != 0) {
        try {
            resources = mPm.getResourcesForApplication(mActivityInfo.applicationInfo);
            icon = resources.getDrawableForDensity(iconRes, density);
        } catch (NameNotFoundException | Resources.NotFoundException exc) {
        }
    }
    // Get the default density icon
    if (icon == null) {
        icon = mResolveInfo.loadIcon(mPm);
    }
    if (icon == null) {
        resources = Resources.getSystem();
        icon = resources.getDrawableForDensity(android.R.mipmap.sym_def_app_icon, density);
    }
    return icon;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:23,代码来源:LauncherActivityInfoCompatV16.java

示例4: setFixedTextSize

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * Set the text size to a given unit and value.
 * <p>
 * See {@link TypedValue} for the possible dimension units.
 *
 * @param unit The desired dimension unit.
 * @param size The desired size in the given units.
 */
public void setFixedTextSize(int unit, float size) {
  Context context = getContext();
  Resources resources;
  if (context == null) {
    resources = Resources.getSystem();
  } else {
    resources = context.getResources();
  }
  setTextSize(ABSOLUTE, TypedValue.applyDimension(unit, size, resources.getDisplayMetrics()));
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:19,代码来源:SubtitleView.java

示例5: getRawSize

import android.content.res.Resources; //导入方法依赖的package包/类
private float getRawSize(int unit, float size) {
    Context context = getContext();
    Resources resources;
    if (context == null) {
        resources = Resources.getSystem();
    } else {
        resources = context.getResources();
    }
    return TypedValue.applyDimension(unit, size, resources.getDisplayMetrics());
}
 
开发者ID:Zackratos,项目名称:PureMusic,代码行数:11,代码来源:LyricView.java

示例6: getRawSize

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * 根据设备信息获取当前分辨率下指定单位对应的像素大小;
 * px,dip,sp -> px
 */
public static float getRawSize(Context c, int unit, float size) {
    Resources r;
    if (c == null) {
        r = Resources.getSystem();
    } else {
        r = c.getResources();
    }
    return TypedValue.applyDimension(unit, size, r.getDisplayMetrics());
}
 
开发者ID:wzc25151,项目名称:lrs_android,代码行数:14,代码来源:DisplayUtil.java

示例7: setTextSize

import android.content.res.Resources; //导入方法依赖的package包/类
@Override
public void setTextSize(int unit, float size) {
    Context c = getContext();
    Resources r;

    if (c == null)
        r = Resources.getSystem();
    else
        r = c.getResources();
    mMaxTextSize = TypedValue.applyDimension(unit,
            size,
            r.getDisplayMetrics());
    mTextCachedSizes.clear();
    adjustTextSize(getText().toString());
}
 
开发者ID:eyeRS,项目名称:eyeRS,代码行数:16,代码来源:AutoResizeTextView.java

示例8: sp2px

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * sp转px.
 *
 * @param value   the value
 * @param context the mContext
 * @return the int
 */
public static int sp2px(float value, Context context) {
    Resources r;
    if (context == null) {
        r = Resources.getSystem();
    } else {
        r = context.getResources();
    }
    float spvalue = value * r.getDisplayMetrics().scaledDensity;
    return (int) (spvalue + 0.5f);
}
 
开发者ID:chenzj-king,项目名称:RetrofitSample,代码行数:18,代码来源:PixelUtil.java

示例9: sp2px

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * sp转px.
 *
 * @param value   the value
 * @param context the context
 * @return the int
 */
public static int sp2px(float value, Context context) {
    Resources r;
    if (context == null) {
        r = Resources.getSystem();
    } else {
        r = context.getResources();
    }
    float spvalue = value * r.getDisplayMetrics().scaledDensity;
    return (int) (spvalue + 0.5f);
}
 
开发者ID:CoderCF,项目名称:SuperVideoPlayer,代码行数:18,代码来源:PixelUtil.java

示例10: dpToPx

import android.content.res.Resources; //导入方法依赖的package包/类
private int dpToPx(float dp) {
    Resources resources = Resources.getSystem();
    return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics());
}
 
开发者ID:DysaniazzZ,项目名称:ArtOfAndroid,代码行数:5,代码来源:CircleView.java

示例11: setMinTextSize

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * Set the minimum text size to a given unit and value. See TypedValue for the possible
 * dimension units.
 *
 * @param unit The desired dimension unit.
 * @param size The desired size in the given units.
 * @attr ref me.grantland.R.styleable#AutofitEditText_minTextSize
 */
public AutofitHelper setMinTextSize(int unit, float size) {
    Context context = mTextView.getContext();
    Resources r = Resources.getSystem();

    if (context != null) {
        r = context.getResources();
    }

    setRawMinTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetrics()));
    return this;
}
 
开发者ID:victorminerva,项目名称:AutoResizeEditText,代码行数:20,代码来源:AutofitHelper.java

示例12: setMaxTextSize

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * Set the maximum text size to a given unit and value. See TypedValue for the possible
 * dimension units.
 *
 * @param unit The desired dimension unit.
 * @param size The desired size in the given units.
 *
 * @attr ref android.R.styleable#TextView_textSize
 */
public AutofitHelper setMaxTextSize(int unit, float size) {
    Context context = mTextView.getContext();
    Resources r = Resources.getSystem();

    if (context != null) {
        r = context.getResources();
    }

    setRawMaxTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetrics()));
    return this;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:21,代码来源:AutofitHelper.java

示例13: setMinTextSize

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * Set the minimum text size to a given unit and value. See TypedValue for the possible
 * dimension units.
 *
 * @param unit The desired dimension unit.
 * @param size The desired size in the given units.
 *
 * @attr ref me.grantland.R.styleable#AutofitTextView_minTextSize
 */
public AutofitHelper setMinTextSize(int unit, float size) {
    Context context = mTextView.getContext();
    Resources r = Resources.getSystem();

    if (context != null) {
        r = context.getResources();
    }

    setRawMinTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetrics()));
    return this;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:21,代码来源:AutofitHelper.java

示例14: getValueBitmapDrawable

import android.content.res.Resources; //导入方法依赖的package包/类
public Drawable getValueBitmapDrawable() {
    return new BitmapDrawable(Resources.getSystem(), getValueBitmap());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:DynamicProperty.java

示例15: dp2px

import android.content.res.Resources; //导入方法依赖的package包/类
private static float dp2px(float dp) {
    Resources r = Resources.getSystem();
    return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:5,代码来源:SwitchButton.java


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