You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
Resources + LayoutInflater: throw same Exceptions as on AOSP
This commit is contained in:
@@ -572,7 +572,7 @@ public final class AssetManager {
|
|||||||
* @param fileName The name of the file to retrieve.
|
* @param fileName The name of the file to retrieve.
|
||||||
*/
|
*/
|
||||||
public final XmlResourceParser openXmlResourceParser(int cookie,
|
public final XmlResourceParser openXmlResourceParser(int cookie,
|
||||||
String fileName) throws /*IO*/ Exception {
|
String fileName) throws IOException {
|
||||||
/* XmlBlock block = openXmlBlockAsset(cookie, fileName);
|
/* XmlBlock block = openXmlBlockAsset(cookie, fileName);
|
||||||
XmlResourceParser rp = block.newParser();
|
XmlResourceParser rp = block.newParser();
|
||||||
block.close();
|
block.close();
|
||||||
|
|||||||
@@ -940,7 +940,7 @@ public class Resources {
|
|||||||
*
|
*
|
||||||
* @see #getXml
|
* @see #getXml
|
||||||
*/
|
*/
|
||||||
public XmlResourceParser getLayout(int id) throws /*NotFound*/ Exception {
|
public XmlResourceParser getLayout(int id) throws NotFoundException {
|
||||||
return loadXmlResourceParser(id, "layout");
|
return loadXmlResourceParser(id, "layout");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2280,7 +2280,7 @@ public class Resources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*package*/ XmlResourceParser loadXmlResourceParser(int id, String type)
|
/*package*/ XmlResourceParser loadXmlResourceParser(int id, String type)
|
||||||
throws /*NotFound*/ Exception {
|
throws NotFoundException {
|
||||||
synchronized (mAccessLock) {
|
synchronized (mAccessLock) {
|
||||||
TypedValue value = mTmpValue;
|
TypedValue value = mTmpValue;
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@@ -2297,8 +2297,12 @@ public class Resources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*package*/ XmlResourceParser loadXmlResourceParser(String file, int id,
|
/*package*/ XmlResourceParser loadXmlResourceParser(String file, int id,
|
||||||
int assetCookie, String type) throws /*NotFound*/ Exception {
|
int assetCookie, String type) throws NotFoundException {
|
||||||
|
try {
|
||||||
return mAssets.openXmlResourceParser(assetCookie, file);
|
return mAssets.openXmlResourceParser(assetCookie, file);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
/* if (id != 0) {
|
/* if (id != 0) {
|
||||||
try {
|
try {
|
||||||
// These may be compiled...
|
// These may be compiled...
|
||||||
|
|||||||
@@ -82,15 +82,19 @@ public class LayoutInflater {
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public View inflate(int resource, ViewGroup root) throws Exception {
|
public View inflate(int resource, ViewGroup root) {
|
||||||
return inflate(resource, root, root != null);
|
return inflate(resource, root, root != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public View inflate(int layoutResID, ViewGroup root, boolean attachToRoot) throws Exception {
|
public View inflate(int layoutResID, ViewGroup root, boolean attachToRoot) {
|
||||||
|
|
||||||
XmlResourceParser xpp = Context.this_application.getResources().getLayout(layoutResID);
|
XmlResourceParser xpp = Context.this_application.getResources().getLayout(layoutResID);
|
||||||
|
|
||||||
|
try {
|
||||||
return inflate(xpp, root, attachToRoot);
|
return inflate(xpp, root, attachToRoot);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public View inflate(XmlPullParser parser, ViewGroup root, boolean attachToRoot) throws Exception {
|
public View inflate(XmlPullParser parser, ViewGroup root, boolean attachToRoot) throws Exception {
|
||||||
|
|||||||
@@ -115,7 +115,11 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
|
|||||||
protected native void native_removeView(long widget, long child);
|
protected native void native_removeView(long widget, long child);
|
||||||
|
|
||||||
public View getChildAt(int index) {
|
public View getChildAt(int index) {
|
||||||
|
try {
|
||||||
return children.get(index);
|
return children.get(index);
|
||||||
|
} catch (IndexOutOfBoundsException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int indexOfChild(View child) {
|
public int indexOfChild(View child) {
|
||||||
|
|||||||
Reference in New Issue
Block a user