當前位置: 首頁>>代碼示例>>Java>>正文


Java Resources.getAssets方法代碼示例

本文整理匯總了Java中android.content.res.Resources.getAssets方法的典型用法代碼示例。如果您正苦於以下問題:Java Resources.getAssets方法的具體用法?Java Resources.getAssets怎麽用?Java Resources.getAssets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.content.res.Resources的用法示例。


在下文中一共展示了Resources.getAssets方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRoundIcon

import android.content.res.Resources; //導入方法依賴的package包/類
private Drawable getRoundIcon(Context context,String packageName, int iconDpi) {

        mPackageManager = context.getPackageManager();

        try {
            Resources resourcesForApplication = mPackageManager.getResourcesForApplication(packageName);
            AssetManager assets = resourcesForApplication.getAssets();
            XmlResourceParser parseXml = assets.openXmlResourceParser("AndroidManifest.xml");
            int eventType;
            while ((eventType = parseXml.nextToken()) != XmlPullParser.END_DOCUMENT)
                if (eventType == XmlPullParser.START_TAG && parseXml.getName().equals("application"))
                    for (int i = 0; i < parseXml.getAttributeCount(); i++)
                        if (parseXml.getAttributeName(i).equals("roundIcon"))
                            return resourcesForApplication.getDrawableForDensity(Integer.parseInt(parseXml.getAttributeValue(i).substring(1)), iconDpi, context.getTheme());
            parseXml.close();
        }
        catch (Exception ex) {
            ex.printStackTrace();
        }
        return null;
    }
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:22,代碼來源:IconThemer.java

示例2: say

import android.content.res.Resources; //導入方法依賴的package包/類
/**
 * get String out of a string-value file
 *
 * @param resourceId id of string
 * @param useTTSLanguage set to true if the string should be said in the current language of the tts engine
 *
 * */
public Future say(Integer resourceId, Boolean useTTSLanguage) {

    if(useTTSLanguage) {
        Resources standardResources = session.getContext().getResources();
        AssetManager assets = standardResources.getAssets();
        DisplayMetrics metrics = standardResources.getDisplayMetrics();
        Configuration config = new Configuration(standardResources.getConfiguration());
        try {
            config.locale = LANGUAGE_TO_LOCALE.get((String) this.getLanguage().get());
            Resources defaultResources = new Resources(assets, metrics, config);
            String text = defaultResources.getString(resourceId);
            return this.say(text);
        } catch (ExecutionException e) {
            Log.d("PepperAndroid.Say", e.getMessage());
        }
    }

    // Fallback to default language
    return this.say(this.session.getContext().getResources().getString(resourceId));


}
 
開發者ID:LilithWittmann,項目名稱:pepper-android,代碼行數:30,代碼來源:Say.java

示例3: getAssetPathFromResources

import android.content.res.Resources; //導入方法依賴的package包/類
private List<String> getAssetPathFromResources(Resources resource){
   	List<String> paths = null;
	try{
		AssetManager asset = resource.getAssets();
		paths = DelegateResources.getCurrentAssetPath(asset);
	} catch(Exception e){
		e.printStackTrace();
	}
	return paths;
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:11,代碼來源:InstrumentationHook.java

示例4: SaiyResources

import android.content.res.Resources; //導入方法依賴的package包/類
/**
 * Constructor
 *
 * @param mContext the application context
 * @param sl       the {@link SupportedLanguage}
 */
public SaiyResources(@NonNull final Context mContext, @NonNull final SupportedLanguage sl) {

    this.mContext = mContext;
    final Resources resources = this.mContext.getResources();
    this.assetManager = resources.getAssets();
    this.metrics = resources.getDisplayMetrics();
    this.configuration = new Configuration(resources.getConfiguration());
    this.targetLocale = sl.getLocale();
}
 
開發者ID:brandall76,項目名稱:Saiy-PS,代碼行數:16,代碼來源:SaiyResources.java

示例5: BaseResources

import android.content.res.Resources; //導入方法依賴的package包/類
public BaseResources(Resources baseResources) {
    this(baseResources.getAssets(), baseResources.getDisplayMetrics(), baseResources.getConfiguration());
}
 
開發者ID:Zeal27,項目名稱:SkinFramework,代碼行數:4,代碼來源:BaseResources.java

示例6: ResourcesOverride

import android.content.res.Resources; //導入方法依賴的package包/類
@SuppressWarnings("deprecated")
 ResourcesOverride(Resources parent, int overrideId, String overrideValue) {
    super(parent.getAssets(), parent.getDisplayMetrics(), parent.getConfiguration());
    mOverrideId = overrideId;
    mOverrideValue = overrideValue;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:7,代碼來源:IconShapeOverride.java

示例7: LeanplumResources

import android.content.res.Resources; //導入方法依賴的package包/類
public LeanplumResources(Resources base) {
  super(base.getAssets(), base.getDisplayMetrics(), base.getConfiguration());
}
 
開發者ID:Leanplum,項目名稱:Leanplum-Android-SDK,代碼行數:4,代碼來源:LeanplumResources.java

示例8: TintResources

import android.content.res.Resources; //導入方法依賴的package包/類
public TintResources(@NonNull Context context, @NonNull Resources res) {
    super(res.getAssets(), res.getDisplayMetrics(), res.getConfiguration());
    this.mContextRef = new WeakReference(context);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:5,代碼來源:TintResources.java


注:本文中的android.content.res.Resources.getAssets方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。