File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
src/main/java/com/reandroid Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -82,10 +82,17 @@ public void scanMainDirectory(File mainDirectory) throws IOException {
82
82
public void scanResourcesDirectory (File resourcesDirectory ) throws IOException {
83
83
try {
84
84
scanResourceFiles (resourcesDirectory );
85
+ ensureEmptyTable ();
85
86
} catch (XmlPullParserException ex ) {
86
87
throw new IOException (ex );
87
88
}
88
89
}
90
+ private void ensureEmptyTable () {
91
+ TableBlock tableBlock = this .getTableBlock ();
92
+ if (tableBlock .initializeAsEmpty ()) {
93
+ logMessage ("Using <NULL> resource table" );
94
+ }
95
+ }
89
96
private void scanResourceFiles (File resourcesDirectory ) throws IOException , XmlPullParserException {
90
97
List <File > pubXmlFileList = ApkUtil .listPublicXmlFiles (resourcesDirectory );
91
98
if (pubXmlFileList .size () == 0 ){
Original file line number Diff line number Diff line change @@ -530,6 +530,14 @@ public boolean isEmpty(){
530
530
}
531
531
return true ;
532
532
}
533
+ public boolean initializeAsEmpty () {
534
+ if (isEmpty ()) {
535
+ setNull (true );
536
+ setCurrentPackage (pickOrEmptyPackage ());
537
+ return true ;
538
+ }
539
+ return false ;
540
+ }
533
541
public boolean isMultiPackage () {
534
542
return size () > 1 ;
535
543
}
@@ -845,8 +853,7 @@ public static TableBlock load(InputStream inputStream) throws IOException{
845
853
}
846
854
public static TableBlock createEmpty () {
847
855
TableBlock tableBlock = new TableBlock ();
848
- tableBlock .pickOrEmptyPackage ();
849
- tableBlock .setNull (true );
856
+ tableBlock .initializeAsEmpty ();
850
857
return tableBlock ;
851
858
}
852
859
You can’t perform that action at this time.
0 commit comments