Java Code Examples for android.content.res.TypedArray#getNonConfigurationString()
The following examples show how to use
android.content.res.TypedArray#getNonConfigurationString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PackageParser.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
private boolean parsePackageItemInfo(Package owner, PackageItemInfo outInfo, String[] outError, String tag, TypedArray sa, int nameRes, int labelRes, int iconRes, int logoRes) { String name = sa.getNonConfigurationString(nameRes, 0); if (name == null) { outError[0] = tag + " does not specify android:name"; return false; } outInfo.name = buildClassName(owner.applicationInfo.packageName, name, outError); if (outInfo.name == null) { return false; } int iconVal = sa.getResourceId(iconRes, 0); if (iconVal != 0) { outInfo.icon = iconVal; outInfo.nonLocalizedLabel = null; } int logoVal = sa.getResourceId(logoRes, 0); if (logoVal != 0) { outInfo.logo = logoVal; } TypedValue v = sa.peekValue(labelRes); if (v != null && (outInfo.labelRes=v.resourceId) == 0) { outInfo.nonLocalizedLabel = v.coerceToString(); } outInfo.packageName = owner.packageName; return true; }
Example 2
Source File: PackageParser.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
private boolean parsePackageItemInfo(Package owner, PackageItemInfo outInfo, String[] outError, String tag, TypedArray sa, int nameRes, int labelRes, int iconRes, int logoRes) { String name = sa.getNonConfigurationString(nameRes, 0); if (name == null) { outError[0] = tag + " does not specify android:name"; return false; } outInfo.name = buildClassName(owner.applicationInfo.packageName, name, outError); if (outInfo.name == null) { return false; } int iconVal = sa.getResourceId(iconRes, 0); if (iconVal != 0) { outInfo.icon = iconVal; outInfo.nonLocalizedLabel = null; } int logoVal = sa.getResourceId(logoRes, 0); if (logoVal != 0) { outInfo.logo = logoVal; } TypedValue v = sa.peekValue(labelRes); if (v != null && (outInfo.labelRes=v.resourceId) == 0) { outInfo.nonLocalizedLabel = v.coerceToString(); } outInfo.packageName = owner.packageName; return true; }
Example 3
Source File: PackageParser.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
private boolean parsePackageItemInfo(Package owner, PackageItemInfo outInfo, String[] outError, String tag, TypedArray sa, int nameRes, int labelRes, int iconRes, int logoRes) { String name = sa.getNonConfigurationString(nameRes, 0); if (name == null) { outError[0] = tag + " does not specify android:name"; return false; } outInfo.name = buildClassName(owner.applicationInfo.packageName, name, outError); if (outInfo.name == null) { return false; } int iconVal = sa.getResourceId(iconRes, 0); if (iconVal != 0) { outInfo.icon = iconVal; outInfo.nonLocalizedLabel = null; } int logoVal = sa.getResourceId(logoRes, 0); if (logoVal != 0) { outInfo.logo = logoVal; } TypedValue v = sa.peekValue(labelRes); if (v != null && (outInfo.labelRes=v.resourceId) == 0) { outInfo.nonLocalizedLabel = v.coerceToString(); } outInfo.packageName = owner.packageName; return true; }
Example 4
Source File: PackageParser.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
private boolean parsePackageItemInfo(Package owner, PackageItemInfo outInfo, String[] outError, String tag, TypedArray sa, int nameRes, int labelRes, int iconRes, int logoRes) { String name = sa.getNonConfigurationString(nameRes, 0); if (name == null) { outError[0] = tag + " does not specify android:name"; return false; } outInfo.name = buildClassName(owner.applicationInfo.packageName, name, outError); if (outInfo.name == null) { return false; } int iconVal = sa.getResourceId(iconRes, 0); if (iconVal != 0) { outInfo.icon = iconVal; outInfo.nonLocalizedLabel = null; } int logoVal = sa.getResourceId(logoRes, 0); if (logoVal != 0) { outInfo.logo = logoVal; } TypedValue v = sa.peekValue(labelRes); if (v != null && (outInfo.labelRes=v.resourceId) == 0) { outInfo.nonLocalizedLabel = v.coerceToString(); } outInfo.packageName = owner.packageName; return true; }
Example 5
Source File: PackageParser.java From AndroidComponentPlugin with Apache License 2.0 | 5 votes |
private boolean parsePackageItemInfo(Package owner, PackageItemInfo outInfo, String[] outError, String tag, TypedArray sa, int nameRes, int labelRes, int iconRes, int logoRes) { String name = sa.getNonConfigurationString(nameRes, 0); if (name == null) { outError[0] = tag + " does not specify android:name"; return false; } outInfo.name = buildClassName(owner.applicationInfo.packageName, name, outError); if (outInfo.name == null) { return false; } int iconVal = sa.getResourceId(iconRes, 0); if (iconVal != 0) { outInfo.icon = iconVal; outInfo.nonLocalizedLabel = null; } int logoVal = sa.getResourceId(logoRes, 0); if (logoVal != 0) { outInfo.logo = logoVal; } TypedValue v = sa.peekValue(labelRes); if (v != null && (outInfo.labelRes=v.resourceId) == 0) { outInfo.nonLocalizedLabel = v.coerceToString(); } outInfo.packageName = owner.packageName; return true; }
Example 6
Source File: PackageParser.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
private Provider parseProvider(Package owner, Resources res, XmlPullParser parser, AttributeSet attrs, int flags, String[] outError) throws XmlPullParserException, IOException { TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.AndroidManifestProvider); if (mParseProviderArgs == null) { mParseProviderArgs = new ParseComponentArgs(owner, outError, com.android.internal.R.styleable.AndroidManifestProvider_name, com.android.internal.R.styleable.AndroidManifestProvider_label, com.android.internal.R.styleable.AndroidManifestProvider_icon, com.android.internal.R.styleable.AndroidManifestProvider_logo, mSeparateProcesses, com.android.internal.R.styleable.AndroidManifestProvider_process, com.android.internal.R.styleable.AndroidManifestProvider_description, com.android.internal.R.styleable.AndroidManifestProvider_enabled); mParseProviderArgs.tag = "<provider>"; } mParseProviderArgs.sa = sa; mParseProviderArgs.flags = flags; Provider p = new Provider(mParseProviderArgs, new ProviderInfo()); if (outError[0] != null) { sa.recycle(); return null; } p.info.exported = sa.getBoolean( com.android.internal.R.styleable.AndroidManifestProvider_exported, true); String cpname = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifestProvider_authorities, 0); p.info.isSyncable = sa.getBoolean( com.android.internal.R.styleable.AndroidManifestProvider_syncable, false); String permission = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifestProvider_permission, 0); String str = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifestProvider_readPermission, 0); if (str == null) { str = permission; } if (str == null) { p.info.readPermission = owner.applicationInfo.permission; } else { p.info.readPermission = str.length() > 0 ? str.toString().intern() : null; } str = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifestProvider_writePermission, 0); if (str == null) { str = permission; } if (str == null) { p.info.writePermission = owner.applicationInfo.permission; } else { p.info.writePermission = str.length() > 0 ? str.toString().intern() : null; } p.info.grantUriPermissions = sa.getBoolean( com.android.internal.R.styleable.AndroidManifestProvider_grantUriPermissions, false); p.info.multiprocess = sa.getBoolean( com.android.internal.R.styleable.AndroidManifestProvider_multiprocess, false); p.info.initOrder = sa.getInt( com.android.internal.R.styleable.AndroidManifestProvider_initOrder, 0); sa.recycle(); if ((owner.applicationInfo.flags&ApplicationInfo.FLAG_CANT_SAVE_STATE) != 0) { // A heavy-weight application can not have providers in its main process // We can do direct compare because we intern all strings. if (p.info.processName == owner.packageName) { outError[0] = "Heavy-weight applications can not have providers in main process"; return null; } } if (cpname == null) { outError[0] = "<provider> does not incude authorities attribute"; return null; } p.info.authority = cpname.intern(); if (!parseProviderTags(res, parser, attrs, p, outError)) { return null; } return p; }
Example 7
Source File: PackageParser.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
private Provider parseProvider(Package owner, Resources res, XmlPullParser parser, AttributeSet attrs, int flags, String[] outError) throws XmlPullParserException, IOException { TypedArray sa = res.obtainAttributes(attrs, com.android.internal.R.styleable.AndroidManifestProvider); if (mParseProviderArgs == null) { mParseProviderArgs = new ParseComponentArgs(owner, outError, com.android.internal.R.styleable.AndroidManifestProvider_name, com.android.internal.R.styleable.AndroidManifestProvider_label, com.android.internal.R.styleable.AndroidManifestProvider_icon, com.android.internal.R.styleable.AndroidManifestProvider_logo, mSeparateProcesses, com.android.internal.R.styleable.AndroidManifestProvider_process, com.android.internal.R.styleable.AndroidManifestProvider_description, com.android.internal.R.styleable.AndroidManifestProvider_enabled); mParseProviderArgs.tag = "<provider>"; } mParseProviderArgs.sa = sa; mParseProviderArgs.flags = flags; Provider p = new Provider(mParseProviderArgs, new ProviderInfo()); if (outError[0] != null) { sa.recycle(); return null; } p.info.exported = sa.getBoolean( com.android.internal.R.styleable.AndroidManifestProvider_exported, true); String cpname = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifestProvider_authorities, 0); p.info.isSyncable = sa.getBoolean( com.android.internal.R.styleable.AndroidManifestProvider_syncable, false); String permission = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifestProvider_permission, 0); String str = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifestProvider_readPermission, 0); if (str == null) { str = permission; } if (str == null) { p.info.readPermission = owner.applicationInfo.permission; } else { p.info.readPermission = str.length() > 0 ? str.toString().intern() : null; } str = sa.getNonConfigurationString( com.android.internal.R.styleable.AndroidManifestProvider_writePermission, 0); if (str == null) { str = permission; } if (str == null) { p.info.writePermission = owner.applicationInfo.permission; } else { p.info.writePermission = str.length() > 0 ? str.toString().intern() : null; } p.info.grantUriPermissions = sa.getBoolean( com.android.internal.R.styleable.AndroidManifestProvider_grantUriPermissions, false); p.info.multiprocess = sa.getBoolean( com.android.internal.R.styleable.AndroidManifestProvider_multiprocess, false); p.info.initOrder = sa.getInt( com.android.internal.R.styleable.AndroidManifestProvider_initOrder, 0); sa.recycle(); if ((owner.applicationInfo.flags&ApplicationInfo.FLAG_CANT_SAVE_STATE) != 0) { // A heavy-weight application can not have providers in its main process // We can do direct compare because we intern all strings. if (p.info.processName == owner.packageName) { outError[0] = "Heavy-weight applications can not have providers in main process"; return null; } } if (cpname == null) { outError[0] = "<provider> does not incude authorities attribute"; return null; } p.info.authority = cpname.intern(); if (!parseProviderTags(res, parser, attrs, p, outError)) { return null; } return p; }