Block formatting fixes
This commit is contained in:
parent
cba2e67a70
commit
d415ceae15
@ -50,7 +50,7 @@ public class BluetoothSwap extends SwapType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDiscoverable () {
|
public boolean isDiscoverable() {
|
||||||
return isDiscoverable;
|
return isDiscoverable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,8 +120,7 @@ public class BluetoothSwap extends SwapType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adapter.isEnabled())
|
if (adapter.isEnabled()) {
|
||||||
{
|
|
||||||
setConnected(true);
|
setConnected(true);
|
||||||
} else {
|
} else {
|
||||||
Log.i(TAG, "Didn't start Bluetooth swapping server, because Bluetooth is disabled and couldn't be enabled.");
|
Log.i(TAG, "Didn't start Bluetooth swapping server, because Bluetooth is disabled and couldn't be enabled.");
|
||||||
|
@ -33,8 +33,7 @@ public abstract class SwapType {
|
|||||||
|
|
||||||
abstract protected String getBroadcastAction();
|
abstract protected String getBroadcastAction();
|
||||||
|
|
||||||
public boolean isDiscoverable ()
|
public boolean isDiscoverable() {
|
||||||
{
|
|
||||||
return isConnected();
|
return isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,8 +97,7 @@ public class BluetoothDownloader extends Downloader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close ()
|
public void close() {
|
||||||
{
|
|
||||||
if (connection != null)
|
if (connection != null)
|
||||||
connection.closeQuietly();
|
connection.closeQuietly();
|
||||||
}
|
}
|
||||||
|
@ -166,8 +166,7 @@ public abstract class Downloader {
|
|||||||
|
|
||||||
int readLength = Math.min(input.available(), buffer.length);
|
int readLength = Math.min(input.available(), buffer.length);
|
||||||
count = input.read(buffer, 0, readLength);
|
count = input.read(buffer, 0, readLength);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
count = input.read(buffer);
|
count = input.read(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +48,7 @@ public class HttpDownloader extends Downloader {
|
|||||||
* only stream the file through the {@link HttpDownloader#getInputStream()}
|
* only stream the file through the {@link HttpDownloader#getInputStream()}
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public HttpDownloader streamDontDownload()
|
public HttpDownloader streamDontDownload() {
|
||||||
{
|
|
||||||
onlyStream = true;
|
onlyStream = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -69,8 +68,7 @@ public class HttpDownloader extends Downloader {
|
|||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BufferedReader getBufferedReader () throws IOException
|
public BufferedReader getBufferedReader() throws IOException {
|
||||||
{
|
|
||||||
return new BufferedReader(new InputStreamReader(getInputStream()));
|
return new BufferedReader(new InputStreamReader(getInputStream()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,14 +167,13 @@ public class HttpDownloader extends Downloader {
|
|||||||
return statusCode;
|
return statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close ()
|
public void close() {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
if (stream != null)
|
if (stream != null)
|
||||||
stream.close();
|
stream.close();
|
||||||
}
|
}
|
||||||
catch (IOException e) {}
|
catch (IOException e) {}
|
||||||
|
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,7 @@ public class IconDownloader extends BaseImageDownloader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//bluetooth isn't a scheme in the Scheme. library, so we can add a check here
|
//bluetooth isn't a scheme in the Scheme. library, so we can add a check here
|
||||||
if (imageUri.toLowerCase().startsWith("bluetooth"))
|
if (imageUri.toLowerCase().startsWith("bluetooth")) {
|
||||||
{
|
|
||||||
Downloader downloader = DownloaderFactory.create(context, imageUri);
|
Downloader downloader = DownloaderFactory.create(context, imageUri);
|
||||||
|
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
@ -276,9 +276,9 @@ public class LocalHTTPD extends NanoHTTPD {
|
|||||||
res.addHeader("ETag", etag);
|
res.addHeader("ETag", etag);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (etag.equals(header.get("if-none-match")))
|
if (etag.equals(header.get("if-none-match"))) {
|
||||||
res = createResponse(Response.Status.NOT_MODIFIED, mime, "");
|
res = createResponse(Response.Status.NOT_MODIFIED, mime, "");
|
||||||
else {
|
} else {
|
||||||
res = createResponse(Response.Status.OK, mime, new FileInputStream(file));
|
res = createResponse(Response.Status.OK, mime, new FileInputStream(file));
|
||||||
res.addHeader("Content-Length", "" + fileLen);
|
res.addHeader("Content-Length", "" + fileLen);
|
||||||
res.addHeader("ETag", etag);
|
res.addHeader("ETag", etag);
|
||||||
|
@ -311,9 +311,9 @@ public class BluetoothServer extends Thread {
|
|||||||
res.addHeader("ETag", etag);
|
res.addHeader("ETag", etag);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (etag.equals(header.get("if-none-match")))
|
if (etag.equals(header.get("if-none-match"))) {
|
||||||
res = createResponse(NanoHTTPD.Response.Status.NOT_MODIFIED, mime, "");
|
res = createResponse(NanoHTTPD.Response.Status.NOT_MODIFIED, mime, "");
|
||||||
else {
|
} else {
|
||||||
res = createResponse(NanoHTTPD.Response.Status.OK, mime, new FileInputStream(file));
|
res = createResponse(NanoHTTPD.Response.Status.OK, mime, new FileInputStream(file));
|
||||||
res.addHeader("Content-Length", "" + fileLen);
|
res.addHeader("Content-Length", "" + fileLen);
|
||||||
res.addHeader("ETag", etag);
|
res.addHeader("ETag", etag);
|
||||||
|
@ -44,8 +44,7 @@ public class Request {
|
|||||||
input = connection.getInputStream();
|
input = connection.getInputStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Request createHEAD(String path, BluetoothConnection connection)
|
public static Request createHEAD(String path, BluetoothConnection connection) {
|
||||||
{
|
|
||||||
return new Request(Methods.HEAD, path, connection);
|
return new Request(Methods.HEAD, path, connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,8 +140,7 @@ public class Request {
|
|||||||
return Integer.parseInt(status);
|
return Integer.parseInt(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String readLine () throws IOException
|
private String readLine() throws IOException {
|
||||||
{
|
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
String line = null;
|
String line = null;
|
||||||
|
|
||||||
|
@ -62,8 +62,7 @@ public class Response {
|
|||||||
this.contentStream = contentStream;
|
this.contentStream = contentStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addHeader (String key, String value)
|
public void addHeader (String key, String value) {
|
||||||
{
|
|
||||||
headers.put(key, value);
|
headers.put(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,8 +38,7 @@ public abstract class ThemeableListFragment extends ListFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private LayoutInflater getThemedInflater(Context context)
|
private LayoutInflater getThemedInflater(Context context) {
|
||||||
{
|
|
||||||
Context c = (getThemeStyle() == 0) ? context : new ContextThemeWrapper(context, getThemeStyle());
|
Context c = (getThemeStyle() == 0) ? context : new ContextThemeWrapper(context, getThemeStyle());
|
||||||
return (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
return (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
}
|
}
|
||||||
|
@ -751,7 +751,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
|
|||||||
String bluetooth = service.getBluetoothSwap().isConnected() ? "Y" : " N";
|
String bluetooth = service.getBluetoothSwap().isConnected() ? "Y" : " N";
|
||||||
String wifi = service.getWifiSwap().isConnected() ? "Y" : " N";
|
String wifi = service.getWifiSwap().isConnected() ? "Y" : " N";
|
||||||
String mdns = service.getWifiSwap().getBonjour().isConnected() ? "Y" : " N";
|
String mdns = service.getWifiSwap().getBonjour().isConnected() ? "Y" : " N";
|
||||||
message += "Swap { BT: " + bluetooth + ", WiFi: " + wifi + ", mDNS: " + mdns + "}, ";
|
message += "Swap { BT: " + bluetooth + ", WiFi: " + wifi + ", mDNS: " + mdns + "}, ";
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user