mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-08 11:05:52 +01:00
Reformat & Rearrange
This commit is contained in:
parent
7ff89c4f44
commit
c3e8be3e8a
@ -15,9 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package android.content.res;
|
package android.content.res;
|
||||||
|
|
||||||
import org.xmlpull.v1.XmlPullParser;
|
|
||||||
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import org.xmlpull.v1.XmlPullParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The XML parsing interface returned for an XML resource. This is a standard
|
* The XML parsing interface returned for an XML resource. This is a standard
|
||||||
|
@ -48,23 +48,17 @@ public interface AttributeSet {
|
|||||||
|
|
||||||
String getAttributeValue(String namespace, String attribute);
|
String getAttributeValue(String namespace, String attribute);
|
||||||
|
|
||||||
int getAttributeListValue(String namespace, String attribute,
|
int getAttributeListValue(String namespace, String attribute, String[] options, int defaultValue);
|
||||||
String[] options, int defaultValue);
|
|
||||||
|
|
||||||
boolean getAttributeBooleanValue(String namespace, String attribute,
|
boolean getAttributeBooleanValue(String namespace, String attribute, boolean defaultValue);
|
||||||
boolean defaultValue);
|
|
||||||
|
|
||||||
int getAttributeResourceValue(String namespace, String attribute,
|
int getAttributeResourceValue(String namespace, String attribute, int defaultValue);
|
||||||
int defaultValue);
|
|
||||||
|
|
||||||
int getAttributeIntValue(String namespace, String attribute,
|
int getAttributeIntValue(String namespace, String attribute, int defaultValue);
|
||||||
int defaultValue);
|
|
||||||
|
|
||||||
int getAttributeUnsignedIntValue(String namespace, String attribute,
|
int getAttributeUnsignedIntValue(String namespace, String attribute, int defaultValue);
|
||||||
int defaultValue);
|
|
||||||
|
|
||||||
float getAttributeFloatValue(String namespace, String attribute,
|
float getAttributeFloatValue(String namespace, String attribute, float defaultValue);
|
||||||
float defaultValue);
|
|
||||||
|
|
||||||
// TODO: remove
|
// TODO: remove
|
||||||
int getAttributeValueType(int index);
|
int getAttributeValueType(int index);
|
||||||
|
@ -35,14 +35,13 @@ public class ResAttr extends ResBagValue implements ResValuesXmlSerializable {
|
|||||||
mL10n = l10n;
|
mL10n = l10n;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String convertToResXmlFormat(ResScalarValue value)
|
public String convertToResXmlFormat(ResScalarValue value) throws AndrolibException {
|
||||||
throws AndrolibException {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serializeToResValuesXml(XmlSerializer serializer,
|
public void serializeToResValuesXml(XmlSerializer serializer, ResResource res)
|
||||||
ResResource res) throws IOException, AndrolibException {
|
throws IOException, AndrolibException {
|
||||||
String type = getTypeAsString();
|
String type = getTypeAsString();
|
||||||
|
|
||||||
serializer.startTag(null, "attr");
|
serializer.startTag(null, "attr");
|
||||||
@ -90,30 +89,24 @@ public class ResAttr extends ResBagValue implements ResValuesXmlSerializable {
|
|||||||
if (i == items.length) {
|
if (i == items.length) {
|
||||||
return new ResAttr(parent, scalarType, min, max, l10n);
|
return new ResAttr(parent, scalarType, min, max, l10n);
|
||||||
}
|
}
|
||||||
Duo<ResReferenceValue, ResIntValue>[] attrItems = new Duo[items.length
|
Duo<ResReferenceValue, ResIntValue>[] attrItems = new Duo[items.length - i];
|
||||||
- i];
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (; i < items.length; i++) {
|
for (; i < items.length; i++) {
|
||||||
int resId = items[i].m1;
|
int resId = items[i].m1;
|
||||||
pkg.addSynthesizedRes(resId);
|
pkg.addSynthesizedRes(resId);
|
||||||
attrItems[j++] = new Duo<>(
|
attrItems[j++] = new Duo<>(factory.newReference(resId, null), (ResIntValue) items[i].m2);
|
||||||
factory.newReference(resId, null),
|
|
||||||
(ResIntValue) items[i].m2);
|
|
||||||
}
|
}
|
||||||
switch (type & 0xff0000) {
|
switch (type & 0xff0000) {
|
||||||
case TYPE_ENUM:
|
case TYPE_ENUM:
|
||||||
return new ResEnumAttr(parent, scalarType, min, max, l10n,
|
return new ResEnumAttr(parent, scalarType, min, max, l10n, attrItems);
|
||||||
attrItems);
|
|
||||||
case TYPE_FLAGS:
|
case TYPE_FLAGS:
|
||||||
return new ResFlagsAttr(parent, scalarType, min, max, l10n,
|
return new ResFlagsAttr(parent, scalarType, min, max, l10n, attrItems);
|
||||||
attrItems);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new AndrolibException("Could not decode attr value");
|
throw new AndrolibException("Could not decode attr value");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void serializeBody(XmlSerializer serializer, ResResource res)
|
protected void serializeBody(XmlSerializer serializer, ResResource res) throws AndrolibException, IOException {
|
||||||
throws AndrolibException, IOException {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getTypeAsString() {
|
protected String getTypeAsString() {
|
||||||
|
@ -25,12 +25,15 @@ import javax.imageio.ImageIO;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.Raster;
|
import java.awt.image.Raster;
|
||||||
import java.awt.image.WritableRaster;
|
import java.awt.image.WritableRaster;
|
||||||
import java.io.*;
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.DataInput;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
public class Res9patchStreamDecoder implements ResStreamDecoder {
|
public class Res9patchStreamDecoder implements ResStreamDecoder {
|
||||||
@Override
|
@Override
|
||||||
public void decode(InputStream in, OutputStream out)
|
public void decode(InputStream in, OutputStream out) throws AndrolibException {
|
||||||
throws AndrolibException {
|
|
||||||
try {
|
try {
|
||||||
byte[] data = IOUtils.toByteArray(in);
|
byte[] data = IOUtils.toByteArray(in);
|
||||||
|
|
||||||
@ -112,11 +115,11 @@ public class Res9patchStreamDecoder implements ResStreamDecoder {
|
|||||||
|
|
||||||
ImageIO.write(im2, "png", out);
|
ImageIO.write(im2, "png", out);
|
||||||
} catch (IOException | NullPointerException ex) {
|
} catch (IOException | NullPointerException ex) {
|
||||||
throw new AndrolibException(ex);
|
// In my case this was triggered because a .png file was
|
||||||
} // In my case this was triggered because a .png file was
|
|
||||||
// containing a html document instead of an image.
|
// containing a html document instead of an image.
|
||||||
// This could be more verbose and try to MIME ?
|
// This could be more verbose and try to MIME ?
|
||||||
|
throw new AndrolibException(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private NinePatch getNinePatch(byte[] data) throws AndrolibException,
|
private NinePatch getNinePatch(byte[] data) throws AndrolibException,
|
||||||
@ -195,8 +198,7 @@ public class Res9patchStreamDecoder implements ResStreamDecoder {
|
|||||||
int[] xDivs = di.readIntArray(numXDivs);
|
int[] xDivs = di.readIntArray(numXDivs);
|
||||||
int[] yDivs = di.readIntArray(numYDivs);
|
int[] yDivs = di.readIntArray(numYDivs);
|
||||||
|
|
||||||
return new NinePatch(padLeft, padRight, padTop, padBottom, xDivs,
|
return new NinePatch(padLeft, padRight, padTop, padBottom, xDivs, yDivs);
|
||||||
yDivs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +468,8 @@ public class MXSerializer implements XmlSerializer {
|
|||||||
// now check that prefix is still in scope
|
// now check that prefix is still in scope
|
||||||
for (int p = namespaceEnd - 1; p > i; --p) {
|
for (int p = namespaceEnd - 1; p > i; --p) {
|
||||||
if (prefix == namespacePrefix[p]) {
|
if (prefix == namespacePrefix[p]) {
|
||||||
} // too bad - prefix is redeclared with different namespace
|
// too bad - prefix is redeclared with different namespace
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
@ -16,45 +16,61 @@
|
|||||||
*/
|
*/
|
||||||
package brut.directory;
|
package brut.directory;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public interface Directory {
|
public interface Directory {
|
||||||
Set<String> getFiles();
|
Set<String> getFiles();
|
||||||
|
|
||||||
Set<String> getFiles(boolean recursive);
|
Set<String> getFiles(boolean recursive);
|
||||||
|
|
||||||
Map<String, Directory> getDirs();
|
Map<String, Directory> getDirs();
|
||||||
|
|
||||||
Map<String, Directory> getDirs(boolean recursive);
|
Map<String, Directory> getDirs(boolean recursive);
|
||||||
|
|
||||||
boolean containsFile(String path);
|
boolean containsFile(String path);
|
||||||
|
|
||||||
boolean containsDir(String path);
|
boolean containsDir(String path);
|
||||||
|
|
||||||
InputStream getFileInput(String path) throws DirectoryException;
|
InputStream getFileInput(String path) throws DirectoryException;
|
||||||
|
|
||||||
OutputStream getFileOutput(String path) throws DirectoryException;
|
OutputStream getFileOutput(String path) throws DirectoryException;
|
||||||
|
|
||||||
Directory getDir(String path) throws PathNotExist;
|
Directory getDir(String path) throws PathNotExist;
|
||||||
|
|
||||||
Directory createDir(String path) throws DirectoryException;
|
Directory createDir(String path) throws DirectoryException;
|
||||||
|
|
||||||
boolean removeFile(String path);
|
boolean removeFile(String path);
|
||||||
|
|
||||||
void copyToDir(Directory out) throws DirectoryException;
|
void copyToDir(Directory out) throws DirectoryException;
|
||||||
|
|
||||||
void copyToDir(Directory out, String[] fileNames)
|
void copyToDir(Directory out, String[] fileNames)
|
||||||
throws DirectoryException;
|
throws DirectoryException;
|
||||||
|
|
||||||
void copyToDir(Directory out, String fileName)
|
void copyToDir(Directory out, String fileName)
|
||||||
throws DirectoryException;
|
throws DirectoryException;
|
||||||
|
|
||||||
void copyToDir(File out) throws DirectoryException;
|
void copyToDir(File out) throws DirectoryException;
|
||||||
|
|
||||||
void copyToDir(File out, String[] fileNames)
|
void copyToDir(File out, String[] fileNames)
|
||||||
throws DirectoryException;
|
throws DirectoryException;
|
||||||
|
|
||||||
void copyToDir(File out, String fileName)
|
void copyToDir(File out, String fileName)
|
||||||
throws DirectoryException;
|
throws DirectoryException;
|
||||||
|
|
||||||
long getSize(String fileName)
|
long getSize(String fileName)
|
||||||
throws DirectoryException;
|
throws DirectoryException;
|
||||||
|
|
||||||
long getCompressedSize(String fileName)
|
long getCompressedSize(String fileName)
|
||||||
throws DirectoryException;
|
throws DirectoryException;
|
||||||
|
|
||||||
int getCompressionLevel(String fileName)
|
int getCompressionLevel(String fileName)
|
||||||
throws DirectoryException;
|
throws DirectoryException;
|
||||||
|
|
||||||
|
|
||||||
void close() throws IOException;
|
void close() throws IOException;
|
||||||
|
|
||||||
char separator = '/';
|
char separator = '/';
|
||||||
|
Loading…
Reference in New Issue
Block a user