From 93c19cbb7693999e41ae625e6a09bfc1efca5ce7 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Sat, 3 Mar 2018 16:26:33 +0100 Subject: [PATCH] Convert fields to local variables Summary: Depends on D10905 Convert to local variables where Android Studio suggested Test Plan: Compiles Reviewers: #kde_connect, mtijink Reviewed By: #kde_connect, mtijink Subscribers: #kde_connect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D10911 --- .../kde/kdeconnect/Backends/LanBackend/LanLink.java | 4 ++-- .../RemoteKeyboardPlugin/RemoteKeyboardService.java | 10 +++++----- .../kde/kdeconnect/Plugins/SftpPlugin/SftpPlugin.java | 4 +--- .../kdeconnect/Plugins/SharePlugin/SharePlugin.java | 4 +--- .../kde/kdeconnect/UserInterface/PairingFragment.java | 3 +-- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java b/src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java index edddb2e5..5e6f39e2 100644 --- a/src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java +++ b/src/org/kde/kdeconnect/Backends/LanBackend/LanLink.java @@ -53,8 +53,8 @@ public class LanLink extends BaseLink { } public enum ConnectionStarted { - Locally, Remotely; - }; + Locally, Remotely + } private ConnectionStarted connectionSource; // If the other device sent me a broadcast, // I should not close the connection with it diff --git a/src/org/kde/kdeconnect/Plugins/RemoteKeyboardPlugin/RemoteKeyboardService.java b/src/org/kde/kdeconnect/Plugins/RemoteKeyboardPlugin/RemoteKeyboardService.java index 3f2b3852..80c74278 100644 --- a/src/org/kde/kdeconnect/Plugins/RemoteKeyboardPlugin/RemoteKeyboardService.java +++ b/src/org/kde/kdeconnect/Plugins/RemoteKeyboardPlugin/RemoteKeyboardService.java @@ -62,9 +62,6 @@ public class RemoteKeyboardService public boolean visible = false; KeyboardView inputView = null; - private final int StatusKeyIdx = 3; - private final int connectedIcon = R.drawable.ic_phonelink_white_36dp; - private final int disconnectedIcon = R.drawable.ic_phonelink_off_white_36dp; Handler handler; @@ -75,8 +72,11 @@ public class RemoteKeyboardService List keys = currentKeyboard.getKeys(); boolean connected = RemoteKeyboardPlugin.isConnected(); // Log.d("RemoteKeyboardService", "Updating keyboard connection icon, connected=" + connected); - keys.get(StatusKeyIdx).icon = getResources().getDrawable(connected ? connectedIcon : disconnectedIcon); - inputView.invalidateKey(StatusKeyIdx); + int disconnectedIcon = R.drawable.ic_phonelink_off_white_36dp; + int connectedIcon = R.drawable.ic_phonelink_white_36dp; + int statusKeyIdx = 3; + keys.get(statusKeyIdx).icon = getResources().getDrawable(connected ? connectedIcon : disconnectedIcon); + inputView.invalidateKey(statusKeyIdx); } @Override diff --git a/src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpPlugin.java b/src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpPlugin.java index 0ec83789..5bb30940 100644 --- a/src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/SftpPlugin/SftpPlugin.java @@ -39,8 +39,6 @@ public class SftpPlugin extends Plugin { private static final SimpleSftpServer server = new SimpleSftpServer(); - private int sftpPermissionExplanation = R.string.sftp_permission_explanation; - @Override public String getDisplayName() { return context.getResources().getString(R.string.pref_plugin_sftp); @@ -54,7 +52,7 @@ public class SftpPlugin extends Plugin { @Override public boolean onCreate() { server.init(context, device); - permissionExplanation = sftpPermissionExplanation; + permissionExplanation = R.string.sftp_permission_explanation; return true; } diff --git a/src/org/kde/kdeconnect/Plugins/SharePlugin/SharePlugin.java b/src/org/kde/kdeconnect/Plugins/SharePlugin/SharePlugin.java index 51d12bdf..5d2737e5 100644 --- a/src/org/kde/kdeconnect/Plugins/SharePlugin/SharePlugin.java +++ b/src/org/kde/kdeconnect/Plugins/SharePlugin/SharePlugin.java @@ -66,11 +66,9 @@ public class SharePlugin extends Plugin { final static boolean openUrlsDirectly = true; - private int sharePermissionExplanation = R.string.share_optional_permission_explanation; - @Override public boolean onCreate() { - optionalPermissionExplanation = sharePermissionExplanation; + optionalPermissionExplanation = R.string.share_optional_permission_explanation; return true; } diff --git a/src/org/kde/kdeconnect/UserInterface/PairingFragment.java b/src/org/kde/kdeconnect/UserInterface/PairingFragment.java index 8d57e7de..23c08c20 100644 --- a/src/org/kde/kdeconnect/UserInterface/PairingFragment.java +++ b/src/org/kde/kdeconnect/UserInterface/PairingFragment.java @@ -56,7 +56,6 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb private static final int RESULT_PAIRING_SUCCESFUL = Activity.RESULT_FIRST_USER; private View rootView; - private View listRootView; private SwipeRefreshLayout mSwipeRefreshLayout; private MaterialActivity mActivity; @@ -76,7 +75,7 @@ public class PairingFragment extends Fragment implements PairingDeviceItem.Callb setHasOptionsMenu(true); rootView = inflater.inflate(R.layout.activity_refresh_list, container, false); - listRootView = rootView.findViewById(R.id.listView1); + View listRootView = rootView.findViewById(R.id.listView1); mSwipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.refresh_list_layout); mSwipeRefreshLayout.setOnRefreshListener( new SwipeRefreshLayout.OnRefreshListener() {