mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-25 03:17:09 +00:00
Make linter happy: add final
This commit is contained in:
parent
20cc67e63a
commit
00f3fc43d0
@ -43,7 +43,7 @@ public class BluetoothLinkProvider extends BaseLinkProvider {
|
|||||||
private final Map<String, BluetoothLink> visibleComputers = new HashMap<>();
|
private final Map<String, BluetoothLink> visibleComputers = new HashMap<>();
|
||||||
private final Map<BluetoothDevice, BluetoothSocket> sockets = new HashMap<>();
|
private final Map<BluetoothDevice, BluetoothSocket> sockets = new HashMap<>();
|
||||||
|
|
||||||
private BluetoothAdapter bluetoothAdapter;
|
private final BluetoothAdapter bluetoothAdapter;
|
||||||
|
|
||||||
private ServerRunnable serverRunnable;
|
private ServerRunnable serverRunnable;
|
||||||
private ClientRunnable clientRunnable;
|
private ClientRunnable clientRunnable;
|
||||||
|
@ -19,7 +19,7 @@ public final class ConnectionMultiplexer implements Closeable {
|
|||||||
private static final int BUFFER_SIZE = 4096;
|
private static final int BUFFER_SIZE = 4096;
|
||||||
|
|
||||||
private static final class ChannelInputStream extends InputStream implements Closeable {
|
private static final class ChannelInputStream extends InputStream implements Closeable {
|
||||||
Channel channel;
|
final Channel channel;
|
||||||
|
|
||||||
ChannelInputStream(Channel channel) {
|
ChannelInputStream(Channel channel) {
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
@ -57,7 +57,7 @@ public final class ConnectionMultiplexer implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final class ChannelOutputStream extends OutputStream implements Closeable {
|
private static final class ChannelOutputStream extends OutputStream implements Closeable {
|
||||||
Channel channel;
|
final Channel channel;
|
||||||
|
|
||||||
ChannelOutputStream(Channel channel) {
|
ChannelOutputStream(Channel channel) {
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
@ -92,9 +92,9 @@ public final class ConnectionMultiplexer implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final class Channel implements Closeable {
|
private static final class Channel implements Closeable {
|
||||||
ConnectionMultiplexer multiplexer;
|
final ConnectionMultiplexer multiplexer;
|
||||||
UUID id;
|
final UUID id;
|
||||||
ByteBuffer read_buffer = ByteBuffer.allocate(BUFFER_SIZE);
|
final ByteBuffer read_buffer = ByteBuffer.allocate(BUFFER_SIZE);
|
||||||
final Object lock = new Object();
|
final Object lock = new Object();
|
||||||
boolean open = true;
|
boolean open = true;
|
||||||
int requestedReadAmount = 0; //Number of times we requested some bytes from the channel
|
int requestedReadAmount = 0; //Number of times we requested some bytes from the channel
|
||||||
@ -199,7 +199,7 @@ public final class ConnectionMultiplexer implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private BluetoothSocket socket;
|
private BluetoothSocket socket;
|
||||||
private Map<UUID, Channel> channels = new HashMap<>();
|
private final Map<UUID, Channel> channels = new HashMap<>();
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
private boolean open = true;
|
private boolean open = true;
|
||||||
private boolean receivedProtocolVersion = false;
|
private boolean receivedProtocolVersion = false;
|
||||||
|
@ -17,7 +17,7 @@ class DevicePacketQueue {
|
|||||||
/**
|
/**
|
||||||
* Replacement ID: if positive, it can be replaced by later packets with the same ID
|
* Replacement ID: if positive, it can be replaced by later packets with the same ID
|
||||||
*/
|
*/
|
||||||
int replaceID;
|
final int replaceID;
|
||||||
Device.SendPacketStatusCallback callback;
|
Device.SendPacketStatusCallback callback;
|
||||||
|
|
||||||
Item(NetworkPacket packet, int replaceID, Device.SendPacketStatusCallback callback) {
|
Item(NetworkPacket packet, int replaceID, Device.SendPacketStatusCallback callback) {
|
||||||
@ -28,7 +28,7 @@ class DevicePacketQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final ArrayDeque<Item> items = new ArrayDeque<>();
|
private final ArrayDeque<Item> items = new ArrayDeque<>();
|
||||||
private Device mDevice;
|
private final Device mDevice;
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
private boolean exit = false;
|
private boolean exit = false;
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ public class TelephonyHelper {
|
|||||||
private int mmsProxyPort = 80; // Default port should be 80 according to code comment in Android's ApnSettings.java
|
private int mmsProxyPort = 80; // Default port should be 80 according to code comment in Android's ApnSettings.java
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private org.kde.kdeconnect.Helpers.TelephonyHelper.ApnSetting internalApnSetting;
|
private final org.kde.kdeconnect.Helpers.TelephonyHelper.ApnSetting internalApnSetting;
|
||||||
|
|
||||||
public Builder() {
|
public Builder() {
|
||||||
internalApnSetting = new ApnSetting();
|
internalApnSetting = new ApnSetting();
|
||||||
|
@ -310,9 +310,9 @@ public class NetworkPacket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Payload {
|
public static class Payload {
|
||||||
private InputStream inputStream;
|
private final InputStream inputStream;
|
||||||
private Socket inputSocket;
|
private final Socket inputSocket;
|
||||||
private long payloadSize;
|
private final long payloadSize;
|
||||||
|
|
||||||
public Payload(long payloadSize) {
|
public Payload(long payloadSize) {
|
||||||
this((InputStream)null, payloadSize);
|
this((InputStream)null, payloadSize);
|
||||||
|
@ -13,7 +13,7 @@ import android.view.ViewConfiguration;
|
|||||||
class MousePadGestureDetector {
|
class MousePadGestureDetector {
|
||||||
|
|
||||||
private static final int TAP_TIMEOUT = ViewConfiguration.getTapTimeout() + 100;
|
private static final int TAP_TIMEOUT = ViewConfiguration.getTapTimeout() + 100;
|
||||||
private OnGestureListener mGestureListener;
|
private final OnGestureListener mGestureListener;
|
||||||
|
|
||||||
private long mFirstDownTime = 0;
|
private long mFirstDownTime = 0;
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ class AppDatabase {
|
|||||||
+ KEY_PRIVACY_OPTIONS + " INTEGER NOT NULL); ";
|
+ KEY_PRIVACY_OPTIONS + " INTEGER NOT NULL); ";
|
||||||
|
|
||||||
|
|
||||||
private SQLiteDatabase ourDatabase;
|
private final SQLiteDatabase ourDatabase;
|
||||||
private DbHelper ourHelper;
|
private final DbHelper ourHelper;
|
||||||
private SharedPreferences prefs;
|
private final SharedPreferences prefs;
|
||||||
|
|
||||||
AppDatabase(Context context, boolean readonly) {
|
AppDatabase(Context context, boolean readonly) {
|
||||||
ourHelper = new DbHelper(context);
|
ourHelper = new DbHelper(context);
|
||||||
|
@ -36,7 +36,7 @@ public class SftpPlugin extends Plugin implements SharedPreferences.OnSharedPref
|
|||||||
private final static String PACKET_TYPE_SFTP = "kdeconnect.sftp";
|
private final static String PACKET_TYPE_SFTP = "kdeconnect.sftp";
|
||||||
private final static String PACKET_TYPE_SFTP_REQUEST = "kdeconnect.sftp.request";
|
private final static String PACKET_TYPE_SFTP_REQUEST = "kdeconnect.sftp.request";
|
||||||
|
|
||||||
static int PREFERENCE_KEY_STORAGE_INFO_LIST = R.string.sftp_preference_key_storage_info_list;
|
static final int PREFERENCE_KEY_STORAGE_INFO_LIST = R.string.sftp_preference_key_storage_info_list;
|
||||||
|
|
||||||
private static final SimpleSftpServer server = new SimpleSftpServer();
|
private static final SimpleSftpServer server = new SimpleSftpServer();
|
||||||
|
|
||||||
@ -242,8 +242,10 @@ public class SftpPlugin extends Plugin implements SharedPreferences.OnSharedPref
|
|||||||
private static final String KEY_DISPLAY_NAME = "DisplayName";
|
private static final String KEY_DISPLAY_NAME = "DisplayName";
|
||||||
private static final String KEY_URI = "Uri";
|
private static final String KEY_URI = "Uri";
|
||||||
|
|
||||||
@NonNull String displayName;
|
@NonNull
|
||||||
@NonNull Uri uri;
|
String displayName;
|
||||||
|
@NonNull
|
||||||
|
final Uri uri;
|
||||||
|
|
||||||
StorageInfo(@NonNull String displayName, @NonNull Uri uri) {
|
StorageInfo(@NonNull String displayName, @NonNull Uri uri) {
|
||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
|
@ -41,13 +41,13 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class CompositeUploadFileJob extends BackgroundJob<Device, Void> {
|
public class CompositeUploadFileJob extends BackgroundJob<Device, Void> {
|
||||||
private boolean isRunning;
|
private boolean isRunning;
|
||||||
private Handler handler;
|
private final Handler handler;
|
||||||
private String currentFileName;
|
private String currentFileName;
|
||||||
private int currentFileNum;
|
private int currentFileNum;
|
||||||
private boolean updatePacketPending;
|
private boolean updatePacketPending;
|
||||||
private long totalSend;
|
private long totalSend;
|
||||||
private int prevProgressPercentage;
|
private int prevProgressPercentage;
|
||||||
private UploadNotification uploadNotification;
|
private final UploadNotification uploadNotification;
|
||||||
|
|
||||||
private final Object lock; //Use to protect concurrent access to the variables below
|
private final Object lock; //Use to protect concurrent access to the variables below
|
||||||
@GuardedBy("lock")
|
@GuardedBy("lock")
|
||||||
|
@ -34,7 +34,7 @@ class ReceiveNotification {
|
|||||||
private final int notificationId;
|
private final int notificationId;
|
||||||
private NotificationCompat.Builder builder;
|
private NotificationCompat.Builder builder;
|
||||||
private final Device device;
|
private final Device device;
|
||||||
private long jobId;
|
private final long jobId;
|
||||||
|
|
||||||
//https://documentation.onesignal.com/docs/android-customizations#section-big-picture
|
//https://documentation.onesignal.com/docs/android-customizations#section-big-picture
|
||||||
private static final int bigImageWidth = 1440;
|
private static final int bigImageWidth = 1440;
|
||||||
|
@ -25,7 +25,7 @@ class UploadNotification {
|
|||||||
private NotificationCompat.Builder builder;
|
private NotificationCompat.Builder builder;
|
||||||
private final int notificationId;
|
private final int notificationId;
|
||||||
private final Device device;
|
private final Device device;
|
||||||
private long jobId;
|
private final long jobId;
|
||||||
|
|
||||||
UploadNotification(Device device, long jobId) {
|
UploadNotification(Device device, long jobId) {
|
||||||
this.device = device;
|
this.device = device;
|
||||||
|
@ -21,10 +21,10 @@ class Sink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int volume;
|
private int volume;
|
||||||
private String description;
|
private final String description;
|
||||||
private String name;
|
private final String name;
|
||||||
private boolean mute;
|
private boolean mute;
|
||||||
private int maxVolume;
|
private final int maxVolume;
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
|
||||||
private final List<UpdateListener> listeners;
|
private final List<UpdateListener> listeners;
|
||||||
|
@ -118,7 +118,7 @@ public class AlertDialogFragment extends DialogFragment implements DialogInterfa
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static abstract class AbstractBuilder<B extends AbstractBuilder<B, F>, F extends DialogFragment> {
|
public static abstract class AbstractBuilder<B extends AbstractBuilder<B, F>, F extends DialogFragment> {
|
||||||
Bundle args;
|
final Bundle args;
|
||||||
|
|
||||||
AbstractBuilder() {
|
AbstractBuilder() {
|
||||||
args = new Bundle();
|
args = new Bundle();
|
||||||
|
@ -88,7 +88,7 @@ public class CustomDevicesAdapter extends RecyclerView.Adapter<CustomDevicesAdap
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class ItemTouchHelperCallback extends ItemTouchHelper.Callback {
|
private static class ItemTouchHelperCallback extends ItemTouchHelper.Callback {
|
||||||
@NonNull private Callback callback;
|
@NonNull private final Callback callback;
|
||||||
|
|
||||||
private ItemTouchHelperCallback(@NonNull Callback callback) {
|
private ItemTouchHelperCallback(@NonNull Callback callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
|
@ -11,13 +11,13 @@ import androidx.annotation.NonNull;
|
|||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
public abstract class BackgroundJob<I, R> implements Runnable {
|
public abstract class BackgroundJob<I, R> implements Runnable {
|
||||||
private static AtomicLong atomicLong = new AtomicLong(0);
|
private static final AtomicLong atomicLong = new AtomicLong(0);
|
||||||
protected volatile boolean canceled;
|
protected volatile boolean canceled;
|
||||||
private BackgroundJobHandler backgroundJobHandler;
|
private BackgroundJobHandler backgroundJobHandler;
|
||||||
private long id;
|
private final long id;
|
||||||
|
|
||||||
protected I requestInfo;
|
protected final I requestInfo;
|
||||||
private Callback<R> callback;
|
private final Callback<R> callback;
|
||||||
|
|
||||||
public BackgroundJob(I requestInfo, Callback<R> callback) {
|
public BackgroundJob(I requestInfo, Callback<R> callback) {
|
||||||
this.id = atomicLong.incrementAndGet();
|
this.id = atomicLong.incrementAndGet();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user