mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-01 22:55:10 +00:00
Make linter happy: misc fixes
This commit is contained in:
@@ -59,7 +59,7 @@ public abstract class BasePairingHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* To be implemented by respective pairing handler */
|
/* To be implemented by respective pairing handler */
|
||||||
public abstract void packageReceived(NetworkPacket np) throws Exception;
|
public abstract void packageReceived(NetworkPacket np);
|
||||||
public abstract void requestPairing();
|
public abstract void requestPairing();
|
||||||
public abstract void acceptPairing();
|
public abstract void acceptPairing();
|
||||||
public abstract void rejectPairing();
|
public abstract void rejectPairing();
|
||||||
|
@@ -329,18 +329,12 @@ public class SMSHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Message message;
|
switch (transportType) {
|
||||||
if (transportType == TransportType.SMS) {
|
case SMS:
|
||||||
message = parseSMS(context, messageInfo);
|
toReturn.add(parseSMS(context, messageInfo));
|
||||||
} else if (transportType == TransportType.MMS) {
|
case MMS:
|
||||||
message = parseMMS(context, messageInfo, userPhoneNumbers);
|
toReturn.add(parseMMS(context, messageInfo, userPhoneNumbers));
|
||||||
} else {
|
|
||||||
// As we can see, all possible transportTypes are covered, but the compiler
|
|
||||||
// requires this line anyway
|
|
||||||
throw new UnsupportedOperationException("Unknown TransportType encountered");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toReturn.add(message);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Swallow exceptions in case we get an error reading one message so that we
|
// Swallow exceptions in case we get an error reading one message so that we
|
||||||
// might be able to read some of them
|
// might be able to read some of them
|
||||||
|
@@ -130,7 +130,7 @@ public class VideoUrlsHelper {
|
|||||||
}
|
}
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
newValue = String.format(Locale.getDefault(), "%s%s%s%s%s",
|
newValue = String.format(Locale.getDefault(), "%s%s%s%s%s",
|
||||||
url.toString(), separator, parameter, position, trailer);
|
url, separator, parameter, position, trailer);
|
||||||
return new URL(newValue);
|
return new URL(newValue);
|
||||||
}
|
}
|
||||||
if (inQuery) {
|
if (inQuery) {
|
||||||
|
@@ -139,10 +139,10 @@ public class KeyListenerView extends View {
|
|||||||
//Alt will change the utf symbol to non-ascii characters, we want the plain original letter
|
//Alt will change the utf symbol to non-ascii characters, we want the plain original letter
|
||||||
//Since getDisplayLabel will always have a value, we have to check for special keys before
|
//Since getDisplayLabel will always have a value, we have to check for special keys before
|
||||||
char keyCharacter = event.getDisplayLabel();
|
char keyCharacter = event.getDisplayLabel();
|
||||||
np.set("key", new String(new char[]{keyCharacter}).toLowerCase());
|
np.set("key", String.valueOf(keyCharacter).toLowerCase());
|
||||||
} else {
|
} else {
|
||||||
//A normal key, but still not handled by the KeyInputConnection (happens with numbers)
|
//A normal key, but still not handled by the KeyInputConnection (happens with numbers)
|
||||||
np.set("key", new String(new char[]{(char) event.getUnicodeChar()}));
|
np.set("key", String.valueOf((char) event.getUnicodeChar()));
|
||||||
}
|
}
|
||||||
|
|
||||||
sendKeyPressPacket(np);
|
sendKeyPressPacket(np);
|
||||||
|
@@ -36,9 +36,7 @@ public abstract class ExtendedFragmentAdapter extends FragmentStateAdapter {
|
|||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return (LongSparseArray<Fragment>) fieldData;
|
return (LongSparseArray<Fragment>) fieldData;
|
||||||
}
|
}
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -168,9 +168,7 @@ class RunCommandControlsProviderService : ControlsProviderService() {
|
|||||||
private fun getCommandByControlId(controlId: String): CommandEntryWithDevice? {
|
private fun getCommandByControlId(controlId: String): CommandEntryWithDevice? {
|
||||||
val controlIdParts = controlId.split(":")
|
val controlIdParts = controlId.split(":")
|
||||||
|
|
||||||
val service = BackgroundService.getInstance();
|
val service = BackgroundService.getInstance() ?: return null
|
||||||
|
|
||||||
if (service == null) return null
|
|
||||||
|
|
||||||
val device = service.getDevice(controlIdParts[0])
|
val device = service.getDevice(controlIdParts[0])
|
||||||
|
|
||||||
|
@@ -330,14 +330,10 @@ public class AndroidSafSshFile implements SshFile {
|
|||||||
ret = documentInfo.length;
|
ret = documentInfo.length;
|
||||||
break;
|
break;
|
||||||
case Uid:
|
case Uid:
|
||||||
ret = 1;
|
|
||||||
break;
|
|
||||||
case Owner:
|
|
||||||
ret = getOwner();
|
|
||||||
break;
|
|
||||||
case Gid:
|
case Gid:
|
||||||
ret = 1;
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
|
case Owner:
|
||||||
case Group:
|
case Group:
|
||||||
ret = getOwner();
|
ret = getOwner();
|
||||||
break;
|
break;
|
||||||
@@ -372,11 +368,7 @@ public class AndroidSafSshFile implements SshFile {
|
|||||||
: EnumSet.copyOf(tmp);
|
: EnumSet.copyOf(tmp);
|
||||||
break;
|
break;
|
||||||
case CreationTime:
|
case CreationTime:
|
||||||
ret = documentInfo.lastModified;
|
|
||||||
break;
|
|
||||||
case LastModifiedTime:
|
case LastModifiedTime:
|
||||||
ret = documentInfo.lastModified;
|
|
||||||
break;
|
|
||||||
case LastAccessTime:
|
case LastAccessTime:
|
||||||
ret = documentInfo.lastModified;
|
ret = documentInfo.lastModified;
|
||||||
break;
|
break;
|
||||||
@@ -416,12 +408,8 @@ public class AndroidSafSshFile implements SshFile {
|
|||||||
private static class DocumentInfo {
|
private static class DocumentInfo {
|
||||||
private Uri uri;
|
private Uri uri;
|
||||||
private boolean exists;
|
private boolean exists;
|
||||||
@Nullable
|
|
||||||
private String documentId;
|
|
||||||
private boolean canRead;
|
private boolean canRead;
|
||||||
private boolean canWrite;
|
private boolean canWrite;
|
||||||
@Nullable
|
|
||||||
private String mimeType;
|
|
||||||
private boolean isDirectory;
|
private boolean isDirectory;
|
||||||
private boolean isFile;
|
private boolean isFile;
|
||||||
private long lastModified;
|
private long lastModified;
|
||||||
@@ -459,7 +447,7 @@ public class AndroidSafSshFile implements SshFile {
|
|||||||
|
|
||||||
cursor.moveToFirst();
|
cursor.moveToFirst();
|
||||||
|
|
||||||
documentId = cursor.getString(cursor.getColumnIndex(DocumentsContract.Document.COLUMN_DOCUMENT_ID));
|
//String documentId = cursor.getString(cursor.getColumnIndex(DocumentsContract.Document.COLUMN_DOCUMENT_ID));
|
||||||
|
|
||||||
final boolean readPerm = c.checkCallingOrSelfUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
final boolean readPerm = c.checkCallingOrSelfUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
== PackageManager.PERMISSION_GRANTED;
|
== PackageManager.PERMISSION_GRANTED;
|
||||||
@@ -470,7 +458,7 @@ public class AndroidSafSshFile implements SshFile {
|
|||||||
final boolean supportsDelete = (flags & DocumentsContract.Document.FLAG_SUPPORTS_DELETE) != 0;
|
final boolean supportsDelete = (flags & DocumentsContract.Document.FLAG_SUPPORTS_DELETE) != 0;
|
||||||
final boolean supportsCreate = (flags & DocumentsContract.Document.FLAG_DIR_SUPPORTS_CREATE) != 0;
|
final boolean supportsCreate = (flags & DocumentsContract.Document.FLAG_DIR_SUPPORTS_CREATE) != 0;
|
||||||
final boolean supportsWrite = (flags & DocumentsContract.Document.FLAG_SUPPORTS_WRITE) != 0;
|
final boolean supportsWrite = (flags & DocumentsContract.Document.FLAG_SUPPORTS_WRITE) != 0;
|
||||||
mimeType = cursor.getString(cursor.getColumnIndex(DocumentsContract.Document.COLUMN_MIME_TYPE));
|
String mimeType = cursor.getString(cursor.getColumnIndex(DocumentsContract.Document.COLUMN_MIME_TYPE));
|
||||||
final boolean hasMime = !TextUtils.isEmpty(mimeType);
|
final boolean hasMime = !TextUtils.isEmpty(mimeType);
|
||||||
|
|
||||||
isDirectory = DocumentsContract.Document.MIME_TYPE_DIR.equals(mimeType);
|
isDirectory = DocumentsContract.Document.MIME_TYPE_DIR.equals(mimeType);
|
||||||
|
Reference in New Issue
Block a user