2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 21:55:10 +00:00

Make linter happy: misc fixes

This commit is contained in:
Albert Vaca Cintora
2023-03-05 23:48:30 +01:00
parent 3212252e37
commit 038f6e8598
7 changed files with 14 additions and 36 deletions

View File

@@ -59,7 +59,7 @@ public abstract class BasePairingHandler {
}
/* 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 acceptPairing();
public abstract void rejectPairing();

View File

@@ -329,18 +329,12 @@ public class SMSHelper {
}
try {
Message message;
if (transportType == TransportType.SMS) {
message = parseSMS(context, messageInfo);
} else if (transportType == TransportType.MMS) {
message = 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");
switch (transportType) {
case SMS:
toReturn.add(parseSMS(context, messageInfo));
case MMS:
toReturn.add(parseMMS(context, messageInfo, userPhoneNumbers));
}
toReturn.add(message);
} catch (Exception e) {
// Swallow exceptions in case we get an error reading one message so that we
// might be able to read some of them

View File

@@ -130,7 +130,7 @@ public class VideoUrlsHelper {
}
if (value == null) {
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);
}
if (inQuery) {

View File

@@ -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
//Since getDisplayLabel will always have a value, we have to check for special keys before
char keyCharacter = event.getDisplayLabel();
np.set("key", new String(new char[]{keyCharacter}).toLowerCase());
np.set("key", String.valueOf(keyCharacter).toLowerCase());
} else {
//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);

View File

@@ -36,9 +36,7 @@ public abstract class ExtendedFragmentAdapter extends FragmentStateAdapter {
//noinspection unchecked
return (LongSparseArray<Fragment>) fieldData;
}
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}

View File

@@ -168,9 +168,7 @@ class RunCommandControlsProviderService : ControlsProviderService() {
private fun getCommandByControlId(controlId: String): CommandEntryWithDevice? {
val controlIdParts = controlId.split(":")
val service = BackgroundService.getInstance();
if (service == null) return null
val service = BackgroundService.getInstance() ?: return null
val device = service.getDevice(controlIdParts[0])

View File

@@ -330,14 +330,10 @@ public class AndroidSafSshFile implements SshFile {
ret = documentInfo.length;
break;
case Uid:
ret = 1;
break;
case Owner:
ret = getOwner();
break;
case Gid:
ret = 1;
break;
case Owner:
case Group:
ret = getOwner();
break;
@@ -372,11 +368,7 @@ public class AndroidSafSshFile implements SshFile {
: EnumSet.copyOf(tmp);
break;
case CreationTime:
ret = documentInfo.lastModified;
break;
case LastModifiedTime:
ret = documentInfo.lastModified;
break;
case LastAccessTime:
ret = documentInfo.lastModified;
break;
@@ -416,12 +408,8 @@ public class AndroidSafSshFile implements SshFile {
private static class DocumentInfo {
private Uri uri;
private boolean exists;
@Nullable
private String documentId;
private boolean canRead;
private boolean canWrite;
@Nullable
private String mimeType;
private boolean isDirectory;
private boolean isFile;
private long lastModified;
@@ -459,7 +447,7 @@ public class AndroidSafSshFile implements SshFile {
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)
== PackageManager.PERMISSION_GRANTED;
@@ -470,7 +458,7 @@ public class AndroidSafSshFile implements SshFile {
final boolean supportsDelete = (flags & DocumentsContract.Document.FLAG_SUPPORTS_DELETE) != 0;
final boolean supportsCreate = (flags & DocumentsContract.Document.FLAG_DIR_SUPPORTS_CREATE) != 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);
isDirectory = DocumentsContract.Document.MIME_TYPE_DIR.equals(mimeType);