mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 09:58:08 +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<BluetoothDevice, BluetoothSocket> sockets = new HashMap<>();
|
||||
|
||||
private BluetoothAdapter bluetoothAdapter;
|
||||
private final BluetoothAdapter bluetoothAdapter;
|
||||
|
||||
private ServerRunnable serverRunnable;
|
||||
private ClientRunnable clientRunnable;
|
||||
|
@ -19,7 +19,7 @@ public final class ConnectionMultiplexer implements Closeable {
|
||||
private static final int BUFFER_SIZE = 4096;
|
||||
|
||||
private static final class ChannelInputStream extends InputStream implements Closeable {
|
||||
Channel channel;
|
||||
final Channel channel;
|
||||
|
||||
ChannelInputStream(Channel channel) {
|
||||
this.channel = channel;
|
||||
@ -57,7 +57,7 @@ public final class ConnectionMultiplexer implements Closeable {
|
||||
}
|
||||
|
||||
private static final class ChannelOutputStream extends OutputStream implements Closeable {
|
||||
Channel channel;
|
||||
final Channel channel;
|
||||
|
||||
ChannelOutputStream(Channel channel) {
|
||||
this.channel = channel;
|
||||
@ -92,9 +92,9 @@ public final class ConnectionMultiplexer implements Closeable {
|
||||
}
|
||||
|
||||
private static final class Channel implements Closeable {
|
||||
ConnectionMultiplexer multiplexer;
|
||||
UUID id;
|
||||
ByteBuffer read_buffer = ByteBuffer.allocate(BUFFER_SIZE);
|
||||
final ConnectionMultiplexer multiplexer;
|
||||
final UUID id;
|
||||
final ByteBuffer read_buffer = ByteBuffer.allocate(BUFFER_SIZE);
|
||||
final Object lock = new Object();
|
||||
boolean open = true;
|
||||
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 Map<UUID, Channel> channels = new HashMap<>();
|
||||
private final Map<UUID, Channel> channels = new HashMap<>();
|
||||
private final Object lock = new Object();
|
||||
private boolean open = true;
|
||||
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
|
||||
*/
|
||||
int replaceID;
|
||||
final 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 Device mDevice;
|
||||
private final Device mDevice;
|
||||
private final Object lock = new Object();
|
||||
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
|
||||
|
||||
public static class Builder {
|
||||
private org.kde.kdeconnect.Helpers.TelephonyHelper.ApnSetting internalApnSetting;
|
||||
private final org.kde.kdeconnect.Helpers.TelephonyHelper.ApnSetting internalApnSetting;
|
||||
|
||||
public Builder() {
|
||||
internalApnSetting = new ApnSetting();
|
||||
|
@ -310,9 +310,9 @@ public class NetworkPacket {
|
||||
}
|
||||
|
||||
public static class Payload {
|
||||
private InputStream inputStream;
|
||||
private Socket inputSocket;
|
||||
private long payloadSize;
|
||||
private final InputStream inputStream;
|
||||
private final Socket inputSocket;
|
||||
private final long payloadSize;
|
||||
|
||||
public Payload(long payloadSize) {
|
||||
this((InputStream)null, payloadSize);
|
||||
|
@ -13,7 +13,7 @@ import android.view.ViewConfiguration;
|
||||
class MousePadGestureDetector {
|
||||
|
||||
private static final int TAP_TIMEOUT = ViewConfiguration.getTapTimeout() + 100;
|
||||
private OnGestureListener mGestureListener;
|
||||
private final OnGestureListener mGestureListener;
|
||||
|
||||
private long mFirstDownTime = 0;
|
||||
|
||||
|
@ -43,9 +43,9 @@ class AppDatabase {
|
||||
+ KEY_PRIVACY_OPTIONS + " INTEGER NOT NULL); ";
|
||||
|
||||
|
||||
private SQLiteDatabase ourDatabase;
|
||||
private DbHelper ourHelper;
|
||||
private SharedPreferences prefs;
|
||||
private final SQLiteDatabase ourDatabase;
|
||||
private final DbHelper ourHelper;
|
||||
private final SharedPreferences prefs;
|
||||
|
||||
AppDatabase(Context context, boolean readonly) {
|
||||
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_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();
|
||||
|
||||
@ -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_URI = "Uri";
|
||||
|
||||
@NonNull String displayName;
|
||||
@NonNull Uri uri;
|
||||
@NonNull
|
||||
String displayName;
|
||||
@NonNull
|
||||
final Uri uri;
|
||||
|
||||
StorageInfo(@NonNull String displayName, @NonNull Uri uri) {
|
||||
this.displayName = displayName;
|
||||
|
@ -41,13 +41,13 @@ import java.util.List;
|
||||
*/
|
||||
public class CompositeUploadFileJob extends BackgroundJob<Device, Void> {
|
||||
private boolean isRunning;
|
||||
private Handler handler;
|
||||
private final Handler handler;
|
||||
private String currentFileName;
|
||||
private int currentFileNum;
|
||||
private boolean updatePacketPending;
|
||||
private long totalSend;
|
||||
private int prevProgressPercentage;
|
||||
private UploadNotification uploadNotification;
|
||||
private final UploadNotification uploadNotification;
|
||||
|
||||
private final Object lock; //Use to protect concurrent access to the variables below
|
||||
@GuardedBy("lock")
|
||||
|
@ -34,7 +34,7 @@ class ReceiveNotification {
|
||||
private final int notificationId;
|
||||
private NotificationCompat.Builder builder;
|
||||
private final Device device;
|
||||
private long jobId;
|
||||
private final long jobId;
|
||||
|
||||
//https://documentation.onesignal.com/docs/android-customizations#section-big-picture
|
||||
private static final int bigImageWidth = 1440;
|
||||
|
@ -25,7 +25,7 @@ class UploadNotification {
|
||||
private NotificationCompat.Builder builder;
|
||||
private final int notificationId;
|
||||
private final Device device;
|
||||
private long jobId;
|
||||
private final long jobId;
|
||||
|
||||
UploadNotification(Device device, long jobId) {
|
||||
this.device = device;
|
||||
|
@ -21,10 +21,10 @@ class Sink {
|
||||
}
|
||||
|
||||
private int volume;
|
||||
private String description;
|
||||
private String name;
|
||||
private final String description;
|
||||
private final String name;
|
||||
private boolean mute;
|
||||
private int maxVolume;
|
||||
private final int maxVolume;
|
||||
private boolean enabled;
|
||||
|
||||
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> {
|
||||
Bundle args;
|
||||
final Bundle args;
|
||||
|
||||
AbstractBuilder() {
|
||||
args = new Bundle();
|
||||
|
@ -88,7 +88,7 @@ public class CustomDevicesAdapter extends RecyclerView.Adapter<CustomDevicesAdap
|
||||
}
|
||||
|
||||
private static class ItemTouchHelperCallback extends ItemTouchHelper.Callback {
|
||||
@NonNull private Callback callback;
|
||||
@NonNull private final Callback callback;
|
||||
|
||||
private ItemTouchHelperCallback(@NonNull Callback callback) {
|
||||
this.callback = callback;
|
||||
|
@ -11,13 +11,13 @@ import androidx.annotation.NonNull;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
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;
|
||||
private BackgroundJobHandler backgroundJobHandler;
|
||||
private long id;
|
||||
private final long id;
|
||||
|
||||
protected I requestInfo;
|
||||
private Callback<R> callback;
|
||||
protected final I requestInfo;
|
||||
private final Callback<R> callback;
|
||||
|
||||
public BackgroundJob(I requestInfo, Callback<R> callback) {
|
||||
this.id = atomicLong.incrementAndGet();
|
||||
|
Loading…
x
Reference in New Issue
Block a user