Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
developer-krushna authored Oct 16, 2024
1 parent 3a06bd5 commit 847d99b
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions app/src/main/java/mt/modder/hub/axml/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import android.os.*;
import java.io.FileInputStream;
import java.io.IOException;
import mt.modder.hub.axml.AXMLPrinter;

import android.widget.TextView;
import java.io.File;
import java.io.FileWriter;
Expand All @@ -48,6 +48,12 @@
import android.widget.ScrollView;
import android.widget.LinearLayout.LayoutParams;
import android.widget.LinearLayout;
import java.util.regex.*;
import java.io.*;
import java.nio.*;




public class MainActivity extends Activity {

Expand All @@ -63,22 +69,22 @@ protected void onCreate(Bundle savedInstanceState) {
scroll.setLayoutParams(new LinearLayout.LayoutParams(-1, -1));
scroll.setFillViewport(true);
scroll.setPadding(8,8,8,8);

TextView text = new TextView(this);
text.setText("Processing "+ Input_Path +" ...");
try {
// Read the binary XML file into a byte array
FileInputStream fis = new FileInputStream(Input_Path);
/*byte[] byteArray = new byte[fis.available()];
byte[] byteArray = new byte[fis.available()];
fis.read(byteArray);
fis.close();*/
fis.close();

// initialize the axmlprinter class
AXMLPrinter axmlPrinter = new AXMLPrinter();
axmlPrinter.setAttributeIntConversion(true);
axmlPrinter.setEnableID2Name(false);
axmlPrinter.setAttributeIntConversion(false);

// Use the XMLDecompiler to decompile to an XML string
String xmlString = axmlPrinter.convertXml(fis);
String xmlString = axmlPrinter.convertXml(byteArray);

// Output the XML string
saveAsFile(xmlString, outPath);
Expand All @@ -92,6 +98,8 @@ protected void onCreate(Bundle savedInstanceState) {
text.setText(exceptionDetails);
e.printStackTrace();
}


scroll.addView(text);
setContentView(scroll);
}
Expand All @@ -102,4 +110,6 @@ public void saveAsFile(String data, String path) throws IOException{
fileWriter.write(data.toString());
fileWriter.close();
}


}

0 comments on commit 847d99b

Please sign in to comment.