Make some fields final as suggested by AS
Most of these are fields initialized statically or in the constructor.
This commit is contained in:
parent
ebb991d1c6
commit
eea66e390b
@ -85,7 +85,7 @@ public class SwapService extends Service {
|
|||||||
private static final String KEY_WIFI_ENABLED = "wifiEnabled";
|
private static final String KEY_WIFI_ENABLED = "wifiEnabled";
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private Set<String> appsToSwap = new HashSet<>();
|
private final Set<String> appsToSwap = new HashSet<>();
|
||||||
|
|
||||||
public SwapService() {
|
public SwapService() {
|
||||||
super();
|
super();
|
||||||
|
@ -9,7 +9,7 @@ import org.fdroid.fdroid.localrepo.type.BluetoothSwap;
|
|||||||
public class BluetoothPeer implements Peer {
|
public class BluetoothPeer implements Peer {
|
||||||
private static final String TAG = "BluetoothPeer";
|
private static final String TAG = "BluetoothPeer";
|
||||||
|
|
||||||
private BluetoothDevice device;
|
private final BluetoothDevice device;
|
||||||
|
|
||||||
public BluetoothPeer(BluetoothDevice device) {
|
public BluetoothPeer(BluetoothDevice device) {
|
||||||
this.device = device;
|
this.device = device;
|
||||||
|
@ -8,7 +8,7 @@ import javax.jmdns.impl.FDroidServiceInfo;
|
|||||||
|
|
||||||
public class BonjourPeer extends WifiPeer {
|
public class BonjourPeer extends WifiPeer {
|
||||||
|
|
||||||
private FDroidServiceInfo serviceInfo;
|
private final FDroidServiceInfo serviceInfo;
|
||||||
|
|
||||||
public BonjourPeer(ServiceInfo serviceInfo) {
|
public BonjourPeer(ServiceInfo serviceInfo) {
|
||||||
this.serviceInfo = new FDroidServiceInfo(serviceInfo);
|
this.serviceInfo = new FDroidServiceInfo(serviceInfo);
|
||||||
|
@ -31,7 +31,7 @@ public class BluetoothServer extends Thread {
|
|||||||
private static final String TAG = "BluetoothServer";
|
private static final String TAG = "BluetoothServer";
|
||||||
|
|
||||||
private BluetoothServerSocket serverSocket;
|
private BluetoothServerSocket serverSocket;
|
||||||
private List<ClientConnection> clients = new ArrayList<>();
|
private final List<ClientConnection> clients = new ArrayList<>();
|
||||||
|
|
||||||
private final File webRoot;
|
private final File webRoot;
|
||||||
private final BluetoothSwap swap;
|
private final BluetoothSwap swap;
|
||||||
|
@ -26,9 +26,9 @@ public class Request {
|
|||||||
private String path;
|
private String path;
|
||||||
private Map<String, String> headers;
|
private Map<String, String> headers;
|
||||||
|
|
||||||
private BluetoothConnection connection;
|
private final BluetoothConnection connection;
|
||||||
private Writer output;
|
private final Writer output;
|
||||||
private InputStream input;
|
private final InputStream input;
|
||||||
|
|
||||||
private Request(String method, String path, BluetoothConnection connection) {
|
private Request(String method, String path, BluetoothConnection connection) {
|
||||||
this.method = method;
|
this.method = method;
|
||||||
|
@ -22,8 +22,8 @@ public class Response {
|
|||||||
|
|
||||||
private static final String TAG = "bluetooth.Response";
|
private static final String TAG = "bluetooth.Response";
|
||||||
|
|
||||||
private int statusCode;
|
private final int statusCode;
|
||||||
private Map<String, String> headers;
|
private final Map<String, String> headers;
|
||||||
private final InputStream contentStream;
|
private final InputStream contentStream;
|
||||||
|
|
||||||
public Response(int statusCode, Map<String, String> headers) {
|
public Response(int statusCode, Map<String, String> headers) {
|
||||||
|
@ -6,7 +6,7 @@ import java.util.Locale;
|
|||||||
|
|
||||||
public abstract class Header {
|
public abstract class Header {
|
||||||
|
|
||||||
private static Header[] VALID_HEADERS = {
|
private static final Header[] VALID_HEADERS = {
|
||||||
new ContentLengthHeader(),
|
new ContentLengthHeader(),
|
||||||
new ETagHeader(),
|
new ETagHeader(),
|
||||||
};
|
};
|
||||||
|
@ -276,7 +276,7 @@ public class SwapAppsView extends ListView implements
|
|||||||
TextView statusInstalled;
|
TextView statusInstalled;
|
||||||
TextView statusIncompatible;
|
TextView statusIncompatible;
|
||||||
|
|
||||||
private BroadcastReceiver downloadProgressReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver downloadProgressReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Apk apk = getApkToInstall();
|
Apk apk = getApkToInstall();
|
||||||
@ -297,7 +297,7 @@ public class SwapAppsView extends ListView implements
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private BroadcastReceiver apkDownloadReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver apkDownloadReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
Apk apk = getApkToInstall();
|
Apk apk = getApkToInstall();
|
||||||
@ -325,7 +325,7 @@ public class SwapAppsView extends ListView implements
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private ContentObserver appObserver = new ContentObserver(new Handler()) {
|
private final ContentObserver appObserver = new ContentObserver(new Handler()) {
|
||||||
@Override
|
@Override
|
||||||
public void onChange(boolean selfChange) {
|
public void onChange(boolean selfChange) {
|
||||||
app = AppProvider.Helper.findById(getActivity().getContentResolver(), app.id);
|
app = AppProvider.Helper.findById(getActivity().getContentResolver(), app.id);
|
||||||
|
@ -68,8 +68,8 @@ public class SwapConnecting extends LinearLayout implements SwapWorkflowActivity
|
|||||||
prepareSwapReceiver, new IntentFilter(SwapWorkflowActivity.PrepareSwapRepo.ACTION));
|
prepareSwapReceiver, new IntentFilter(SwapWorkflowActivity.PrepareSwapRepo.ACTION));
|
||||||
}
|
}
|
||||||
|
|
||||||
private BroadcastReceiver repoUpdateReceiver = new ConnectSwapReceiver();
|
private final BroadcastReceiver repoUpdateReceiver = new ConnectSwapReceiver();
|
||||||
private BroadcastReceiver prepareSwapReceiver = new PrepareSwapReceiver();
|
private final BroadcastReceiver prepareSwapReceiver = new PrepareSwapReceiver();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listens for feedback about a local repository being prepared:
|
* Listens for feedback about a local repository being prepared:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user