mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-04-19 22:37:09 -04:00
run Reformat Code from Android Studio Flamingo | 2022.2.1 Patch 2
This commit is contained in:
@@ -52,8 +52,9 @@ public class HexDumpEncoder {
|
||||
if ((j + 2) % 4 == 0) hexOut.append(' ');
|
||||
|
||||
int dataChar = data[j / 2];
|
||||
if (dataChar >= 32 && dataChar < 127) chrOut.append(Character.valueOf((char) dataChar));
|
||||
else chrOut.append('.');
|
||||
if (dataChar >= 32 && dataChar < 127) {
|
||||
chrOut.append(Character.valueOf((char) dataChar));
|
||||
} else chrOut.append('.');
|
||||
}
|
||||
|
||||
hexDumpOut.append(hexOut.toString());
|
||||
|
||||
@@ -14,7 +14,7 @@ public interface ResourceAdapter {
|
||||
GENERATING_SIGNATURE_FILE,
|
||||
GENERATING_SIGNATURE_BLOCK,
|
||||
COPYING_ZIP_ENTRY
|
||||
};
|
||||
}
|
||||
|
||||
public String getString(Item item, Object... args);
|
||||
}
|
||||
|
||||
@@ -62,13 +62,19 @@ public class CentralEnd {
|
||||
if (debug) log.debug(String.format("This disk number: 0x%04x", numberThisDisk));
|
||||
|
||||
centralStartDisk = input.readShort();
|
||||
if (debug) log.debug(String.format("Central dir start disk number: 0x%04x", centralStartDisk));
|
||||
if (debug) {
|
||||
log.debug(String.format("Central dir start disk number: 0x%04x", centralStartDisk));
|
||||
}
|
||||
|
||||
numCentralEntries = input.readShort();
|
||||
if (debug) log.debug(String.format("Central entries on this disk: 0x%04x", numCentralEntries));
|
||||
if (debug) {
|
||||
log.debug(String.format("Central entries on this disk: 0x%04x", numCentralEntries));
|
||||
}
|
||||
|
||||
totalCentralEntries = input.readShort();
|
||||
if (debug) log.debug(String.format("Total number of central entries: 0x%04x", totalCentralEntries));
|
||||
if (debug) {
|
||||
log.debug(String.format("Total number of central entries: 0x%04x", totalCentralEntries));
|
||||
}
|
||||
|
||||
centralDirectorySize = input.readInt();
|
||||
if (debug) log.debug(String.format("Central directory size: 0x%08x", centralDirectorySize));
|
||||
|
||||
@@ -149,7 +149,9 @@ public class ZioEntry implements Cloneable {
|
||||
|
||||
input.seek(localHeaderOffset);
|
||||
|
||||
if (debug) getLogger().debug(String.format("FILE POSITION: 0x%08x", input.getFilePointer()));
|
||||
if (debug) {
|
||||
getLogger().debug(String.format("FILE POSITION: 0x%08x", input.getFilePointer()));
|
||||
}
|
||||
|
||||
// 0 4 Local file header signature = 0x04034b50
|
||||
int signature = input.readInt();
|
||||
@@ -169,12 +171,16 @@ public class ZioEntry implements Cloneable {
|
||||
// 4 2 Version needed to extract (minimum)
|
||||
/* versionRequired */
|
||||
tmpShort = input.readShort();
|
||||
if (debug) log.debug(String.format("Version required: 0x%04x", tmpShort /*versionRequired*/));
|
||||
if (debug) {
|
||||
log.debug(String.format("Version required: 0x%04x", tmpShort /*versionRequired*/));
|
||||
}
|
||||
|
||||
// 6 2 General purpose bit flag
|
||||
/* generalPurposeBits */
|
||||
tmpShort = input.readShort();
|
||||
if (debug) log.debug(String.format("General purpose bits: 0x%04x", tmpShort /* generalPurposeBits */));
|
||||
if (debug) {
|
||||
log.debug(String.format("General purpose bits: 0x%04x", tmpShort /* generalPurposeBits */));
|
||||
}
|
||||
|
||||
// 8 2 Compression method
|
||||
/* compression */
|
||||
@@ -184,12 +190,16 @@ public class ZioEntry implements Cloneable {
|
||||
// 10 2 File last modification time
|
||||
/* modificationTime */
|
||||
tmpShort = input.readShort();
|
||||
if (debug) log.debug(String.format("Modification time: 0x%04x", tmpShort /* modificationTime */));
|
||||
if (debug) {
|
||||
log.debug(String.format("Modification time: 0x%04x", tmpShort /* modificationTime */));
|
||||
}
|
||||
|
||||
// 12 2 File last modification date
|
||||
/* modificationDate */
|
||||
tmpShort = input.readShort();
|
||||
if (debug) log.debug(String.format("Modification date: 0x%04x", tmpShort /* modificationDate */));
|
||||
if (debug) {
|
||||
log.debug(String.format("Modification date: 0x%04x", tmpShort /* modificationDate */));
|
||||
}
|
||||
|
||||
// 14 4 CRC-32
|
||||
/* crc32 */
|
||||
@@ -289,10 +299,14 @@ public class ZioEntry implements Cloneable {
|
||||
output.writeBytes(alignBytes, 0, numAlignBytes);
|
||||
}
|
||||
|
||||
if (debug) getLogger().debug(String.format(Locale.ENGLISH, "Data position 0x%08x", output.getFilePointer()));
|
||||
if (debug) {
|
||||
getLogger().debug(String.format(Locale.ENGLISH, "Data position 0x%08x", output.getFilePointer()));
|
||||
}
|
||||
if (data != null) {
|
||||
output.writeBytes(data);
|
||||
if (debug) getLogger().debug(String.format(Locale.ENGLISH, "Wrote %d bytes", data.length));
|
||||
if (debug) {
|
||||
getLogger().debug(String.format(Locale.ENGLISH, "Wrote %d bytes", data.length));
|
||||
}
|
||||
} else {
|
||||
|
||||
if (debug) getLogger().debug(String.format("Seeking to position 0x%08x", dataPosition));
|
||||
@@ -306,7 +320,9 @@ public class ZioEntry implements Cloneable {
|
||||
int numRead = zipInput.in.read(buffer, 0, (int) Math.min(compressedSize - totalCount, bufferSize));
|
||||
if (numRead > 0) {
|
||||
output.writeBytes(buffer, 0, numRead);
|
||||
if (debug) getLogger().debug(String.format(Locale.ENGLISH, "Wrote %d bytes", numRead));
|
||||
if (debug) {
|
||||
getLogger().debug(String.format(Locale.ENGLISH, "Wrote %d bytes", numRead));
|
||||
}
|
||||
totalCount += numRead;
|
||||
} else
|
||||
throw new IllegalStateException(String.format(Locale.ENGLISH, "EOF reached while copying %s with %d bytes left to go", filename, compressedSize - totalCount));
|
||||
|
||||
@@ -47,7 +47,9 @@ public class ZioEntryInputStream extends InputStream {
|
||||
raf = entry.getZipInput().in;
|
||||
long dpos = entry.getDataPosition();
|
||||
if (dpos >= 0) {
|
||||
if (debug) log.debug(String.format(Locale.ENGLISH, "Seeking to %d", entry.getDataPosition()));
|
||||
if (debug) {
|
||||
log.debug(String.format(Locale.ENGLISH, "Seeking to %d", entry.getDataPosition()));
|
||||
}
|
||||
raf.seek(entry.getDataPosition());
|
||||
} else {
|
||||
// seeks to, then reads, the local header, causing the
|
||||
@@ -118,7 +120,9 @@ public class ZioEntryInputStream extends InputStream {
|
||||
if (monitor != null) monitor.write(b, off, numRead);
|
||||
offset += numRead;
|
||||
}
|
||||
if (debug) log.debug(String.format(Locale.ENGLISH, "Read %d bytes for read(b,%d,%d)", numRead, off, len));
|
||||
if (debug) {
|
||||
log.debug(String.format(Locale.ENGLISH, "Read %d bytes for read(b,%d,%d)", numRead, off, len));
|
||||
}
|
||||
return numRead;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,9 @@ public class ZipInput implements Closeable {
|
||||
* to get the root entries.
|
||||
*/
|
||||
public Collection<String> list(String path) {
|
||||
if (!path.endsWith("/")) throw new IllegalArgumentException("Invalid path -- does not end with '/'");
|
||||
if (!path.endsWith("/")) {
|
||||
throw new IllegalArgumentException("Invalid path -- does not end with '/'");
|
||||
}
|
||||
|
||||
if (path.startsWith("/")) path = path.substring(1);
|
||||
|
||||
|
||||
@@ -37,7 +37,9 @@ public class ZipListingHelper {
|
||||
|
||||
public static void listEntry(LoggerInterface log, ZioEntry entry) {
|
||||
int ratio = 0;
|
||||
if (entry.getSize() > 0) ratio = (100 * (entry.getSize() - entry.getCompressedSize())) / entry.getSize();
|
||||
if (entry.getSize() > 0) {
|
||||
ratio = (100 * (entry.getSize() - entry.getCompressedSize())) / entry.getSize();
|
||||
}
|
||||
log.debug(String.format(Locale.ENGLISH, "%8d %6s %8d %4d%% %s %08x %s",
|
||||
entry.getSize(),
|
||||
entry.getCompression() == 0 ? "Stored" : "Defl:N",
|
||||
|
||||
@@ -72,8 +72,7 @@ import fi.iki.elonen.NanoHTTPD.Response.IStatus;
|
||||
* <p>
|
||||
* This is mostly just synced from {@code SimpleWebServer.java} from NanoHTTPD.
|
||||
*
|
||||
* @see
|
||||
* <a href="https://github.com/NanoHttpd/nanohttpd/blob/nanohttpd-project-2.3.1/webserver/src/main/java/fi/iki/elonen/SimpleWebServer.java">webserver/src/main/java/fi/iki/elonen/SimpleWebServer.java</a>
|
||||
* @see <a href="https://github.com/NanoHttpd/nanohttpd/blob/nanohttpd-project-2.3.1/webserver/src/main/java/fi/iki/elonen/SimpleWebServer.java">webserver/src/main/java/fi/iki/elonen/SimpleWebServer.java</a>
|
||||
*/
|
||||
public class LocalHTTPD extends NanoHTTPD {
|
||||
private static final String TAG = "LocalHTTPD";
|
||||
|
||||
@@ -85,10 +85,10 @@ public class WifiStateChangeService extends Worker {
|
||||
|
||||
public static void registerReceiver(Context context) {
|
||||
ContextCompat.registerReceiver(
|
||||
context,
|
||||
new WifiStateChangeReceiver(),
|
||||
new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION),
|
||||
ContextCompat.RECEIVER_NOT_EXPORTED);
|
||||
context,
|
||||
new WifiStateChangeReceiver(),
|
||||
new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION),
|
||||
ContextCompat.RECEIVER_NOT_EXPORTED);
|
||||
}
|
||||
|
||||
public static void start(Context context, @Nullable Intent intent) {
|
||||
|
||||
Reference in New Issue
Block a user