Remove unneeded version checks

We require API 14 now which makes some checks needless
This commit is contained in:
Nicolas Fella
2018-10-26 22:51:13 +02:00
parent cbd4af2378
commit 7a24310cea
21 changed files with 83 additions and 128 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 686 B

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 936 B

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -444,11 +444,7 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
// Server is disabled on these devices and using a reverse connection strategy. This works well for connection of these devices with kde
// and newer android versions. Although devices with android version less than ICS cannot connect to other devices who also have android version less
// than ICS because server is disabled on both
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
Log.w("KDE/LanLinkProvider", "Not starting a TCP server because it's not supported on Android < 14. Operating only as client.");
} else {
setupTcpListener();
}
setupTcpListener();
broadcastUdpPacket();
}

View File

@@ -212,15 +212,10 @@ public class SslHelper {
supportedCiphers.add("TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"); // API 20+
supportedCiphers.add("TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"); // API 20+
supportedCiphers.add("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"); // API 11+
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
} else {
supportedCiphers.add("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"); // API 11+
supportedCiphers.add("SSL_RSA_WITH_RC4_128_SHA"); // API 9+
supportedCiphers.add("SSL_RSA_WITH_RC4_128_MD5"); // API 9+
} else {
// Following ciphers are for and due to old devices
supportedCiphers.add("SSL_RSA_WITH_RC4_128_SHA"); // API 9+
supportedCiphers.add("SSL_RSA_WITH_RC4_128_MD5"); // API 9+
supportedCiphers.add("TLS_DHE_RSA_WITH_AES_256_CBC_SHA"); // API 9+
}
socket.setEnabledCipherSuites(supportedCiphers.toArray(new String[supportedCiphers.size()]));

View File

@@ -65,10 +65,6 @@ public class ClipboardListener {
ClipboardListener(final Context ctx) {
context = ctx;
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
return;
}
new Handler(Looper.getMainLooper()).post(() -> {
cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
listener = () -> {
@@ -98,12 +94,7 @@ public class ClipboardListener {
@SuppressWarnings("deprecation")
public void setText(String text) {
currentContent = text;
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(text);
} else {
cm.setText(text);
}
cm.setText(text);
}
}

View File

@@ -40,12 +40,6 @@ public class ClipboardPlugin extends Plugin {
return context.getResources().getString(R.string.pref_plugin_clipboard_desc);
}
@Override
public boolean isEnabledByDefault() {
//Disabled by default due to just one direction sync(incoming clipboard change) in early version of android.
return (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB);
}
@Override
public boolean onPacketReceived(NetworkPacket np) {
String content = np.getString("content");

View File

@@ -51,31 +51,29 @@ public class KeyListenerView extends View {
SpecialKeysMap.put(KeyEvent.KEYCODE_DPAD_DOWN, ++i); // 7
SpecialKeysMap.put(KeyEvent.KEYCODE_PAGE_UP, ++i); // 8
SpecialKeysMap.put(KeyEvent.KEYCODE_PAGE_DOWN, ++i); // 9
if (Build.VERSION.SDK_INT >= 11) {
SpecialKeysMap.put(KeyEvent.KEYCODE_MOVE_HOME, ++i); // 10
SpecialKeysMap.put(KeyEvent.KEYCODE_MOVE_END, ++i); // 11
SpecialKeysMap.put(KeyEvent.KEYCODE_NUMPAD_ENTER, ++i); // 12
SpecialKeysMap.put(KeyEvent.KEYCODE_FORWARD_DEL, ++i); // 13
SpecialKeysMap.put(KeyEvent.KEYCODE_ESCAPE, ++i); // 14
SpecialKeysMap.put(KeyEvent.KEYCODE_SYSRQ, ++i); // 15
SpecialKeysMap.put(KeyEvent.KEYCODE_SCROLL_LOCK, ++i); // 16
++i; // 17
++i; // 18
++i; // 19
++i; // 20
SpecialKeysMap.put(KeyEvent.KEYCODE_F1, ++i); // 21
SpecialKeysMap.put(KeyEvent.KEYCODE_F2, ++i); // 22
SpecialKeysMap.put(KeyEvent.KEYCODE_F3, ++i); // 23
SpecialKeysMap.put(KeyEvent.KEYCODE_F4, ++i); // 24
SpecialKeysMap.put(KeyEvent.KEYCODE_F5, ++i); // 25
SpecialKeysMap.put(KeyEvent.KEYCODE_F6, ++i); // 26
SpecialKeysMap.put(KeyEvent.KEYCODE_F7, ++i); // 27
SpecialKeysMap.put(KeyEvent.KEYCODE_F8, ++i); // 28
SpecialKeysMap.put(KeyEvent.KEYCODE_F9, ++i); // 29
SpecialKeysMap.put(KeyEvent.KEYCODE_F10, ++i); // 30
SpecialKeysMap.put(KeyEvent.KEYCODE_F11, ++i); // 31
SpecialKeysMap.put(KeyEvent.KEYCODE_F12, ++i); // 21
}
SpecialKeysMap.put(KeyEvent.KEYCODE_MOVE_HOME, ++i); // 10
SpecialKeysMap.put(KeyEvent.KEYCODE_MOVE_END, ++i); // 11
SpecialKeysMap.put(KeyEvent.KEYCODE_NUMPAD_ENTER, ++i); // 12
SpecialKeysMap.put(KeyEvent.KEYCODE_FORWARD_DEL, ++i); // 13
SpecialKeysMap.put(KeyEvent.KEYCODE_ESCAPE, ++i); // 14
SpecialKeysMap.put(KeyEvent.KEYCODE_SYSRQ, ++i); // 15
SpecialKeysMap.put(KeyEvent.KEYCODE_SCROLL_LOCK, ++i); // 16
++i; // 17
++i; // 18
++i; // 19
++i; // 20
SpecialKeysMap.put(KeyEvent.KEYCODE_F1, ++i); // 21
SpecialKeysMap.put(KeyEvent.KEYCODE_F2, ++i); // 22
SpecialKeysMap.put(KeyEvent.KEYCODE_F3, ++i); // 23
SpecialKeysMap.put(KeyEvent.KEYCODE_F4, ++i); // 24
SpecialKeysMap.put(KeyEvent.KEYCODE_F5, ++i); // 25
SpecialKeysMap.put(KeyEvent.KEYCODE_F6, ++i); // 26
SpecialKeysMap.put(KeyEvent.KEYCODE_F7, ++i); // 27
SpecialKeysMap.put(KeyEvent.KEYCODE_F8, ++i); // 28
SpecialKeysMap.put(KeyEvent.KEYCODE_F9, ++i); // 29
SpecialKeysMap.put(KeyEvent.KEYCODE_F10, ++i); // 30
SpecialKeysMap.put(KeyEvent.KEYCODE_F11, ++i); // 31
SpecialKeysMap.put(KeyEvent.KEYCODE_F12, ++i); // 21
}
public void setDeviceId(String id) {
@@ -91,9 +89,7 @@ public class KeyListenerView extends View {
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
if (android.os.Build.VERSION.SDK_INT >= 11) {
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN;
}
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN;
return new KeyInputConnection(this, true);
}
@@ -142,11 +138,9 @@ public class KeyListenerView extends View {
modifier = true;
}
if (Build.VERSION.SDK_INT >= 11) {
if (event.isCtrlPressed()) {
np.set("ctrl", true);
modifier = true;
}
if (event.isCtrlPressed()) {
np.set("ctrl", true);
modifier = true;
}
if (event.isShiftPressed()) {

View File

@@ -147,29 +147,27 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
final View decorView = getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener(visibility -> {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
final View decorView = getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener(visibility -> {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
int fullscreenType = 0;
int fullscreenType = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
fullscreenType |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
fullscreenType |= View.SYSTEM_UI_FLAG_FULLSCREEN;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
fullscreenType |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
getWindow().getDecorView().setSystemUiVisibility(fullscreenType);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
fullscreenType |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
}
});
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
fullscreenType |= View.SYSTEM_UI_FLAG_FULLSCREEN;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
fullscreenType |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
getWindow().getDecorView().setSystemUiVisibility(fullscreenType);
}
});
}
@@ -264,16 +262,14 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
@Override
public boolean onGenericMotionEvent(MotionEvent e) {
if (android.os.Build.VERSION.SDK_INT >= 12) { // MotionEvent.getAxisValue is >= 12
if (e.getAction() == MotionEvent.ACTION_SCROLL) {
final float distanceY = e.getAxisValue(MotionEvent.AXIS_VSCROLL);
if (e.getAction() == MotionEvent.ACTION_SCROLL) {
final float distanceY = e.getAxisValue(MotionEvent.AXIS_VSCROLL);
accumulatedDistanceY += distanceY;
accumulatedDistanceY += distanceY;
if (accumulatedDistanceY > MinDistanceToSendGenericScroll || accumulatedDistanceY < -MinDistanceToSendGenericScroll) {
sendScroll(accumulatedDistanceY);
accumulatedDistanceY = 0;
}
if (accumulatedDistanceY > MinDistanceToSendGenericScroll || accumulatedDistanceY < -MinDistanceToSendGenericScroll) {
sendScroll(accumulatedDistanceY);
accumulatedDistanceY = 0;
}
}

View File

@@ -87,10 +87,8 @@ public class ReceiveNotificationsPlugin extends Plugin {
if (np.hasPayload()) {
int width = 64; // default icon dimensions
int height = 64;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
width = context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_width);
height = context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_height);
}
width = context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_width);
height = context.getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_height);
final InputStream input = np.getPayload();
largeIcon = BitmapFactory.decodeStream(np.getPayload());
try {

View File

@@ -84,31 +84,29 @@ public class RemoteKeyboardPlugin extends Plugin {
specialKeyMap.put(++i, KeyEvent.KEYCODE_DPAD_DOWN); // 7
specialKeyMap.put(++i, KeyEvent.KEYCODE_PAGE_UP); // 8
specialKeyMap.put(++i, KeyEvent.KEYCODE_PAGE_DOWN); // 9
if (Build.VERSION.SDK_INT >= 11) {
specialKeyMap.put(++i, KeyEvent.KEYCODE_MOVE_HOME); // 10
specialKeyMap.put(++i, KeyEvent.KEYCODE_MOVE_END); // 11
specialKeyMap.put(++i, KeyEvent.KEYCODE_ENTER); // 12
specialKeyMap.put(++i, KeyEvent.KEYCODE_FORWARD_DEL); // 13
specialKeyMap.put(++i, KeyEvent.KEYCODE_ESCAPE); // 14
specialKeyMap.put(++i, KeyEvent.KEYCODE_SYSRQ); // 15
specialKeyMap.put(++i, KeyEvent.KEYCODE_SCROLL_LOCK); // 16
++i; // 17
++i; // 18
++i; // 19
++i; // 20
specialKeyMap.put(++i, KeyEvent.KEYCODE_F1); // 21
specialKeyMap.put(++i, KeyEvent.KEYCODE_F2); // 22
specialKeyMap.put(++i, KeyEvent.KEYCODE_F3); // 23
specialKeyMap.put(++i, KeyEvent.KEYCODE_F4); // 24
specialKeyMap.put(++i, KeyEvent.KEYCODE_F5); // 25
specialKeyMap.put(++i, KeyEvent.KEYCODE_F6); // 26
specialKeyMap.put(++i, KeyEvent.KEYCODE_F7); // 27
specialKeyMap.put(++i, KeyEvent.KEYCODE_F8); // 28
specialKeyMap.put(++i, KeyEvent.KEYCODE_F9); // 29
specialKeyMap.put(++i, KeyEvent.KEYCODE_F10); // 30
specialKeyMap.put(++i, KeyEvent.KEYCODE_F11); // 31
specialKeyMap.put(++i, KeyEvent.KEYCODE_F12); // 21
}
specialKeyMap.put(++i, KeyEvent.KEYCODE_MOVE_HOME); // 10
specialKeyMap.put(++i, KeyEvent.KEYCODE_MOVE_END); // 11
specialKeyMap.put(++i, KeyEvent.KEYCODE_ENTER); // 12
specialKeyMap.put(++i, KeyEvent.KEYCODE_FORWARD_DEL); // 13
specialKeyMap.put(++i, KeyEvent.KEYCODE_ESCAPE); // 14
specialKeyMap.put(++i, KeyEvent.KEYCODE_SYSRQ); // 15
specialKeyMap.put(++i, KeyEvent.KEYCODE_SCROLL_LOCK); // 16
++i; // 17
++i; // 18
++i; // 19
++i; // 20
specialKeyMap.put(++i, KeyEvent.KEYCODE_F1); // 21
specialKeyMap.put(++i, KeyEvent.KEYCODE_F2); // 22
specialKeyMap.put(++i, KeyEvent.KEYCODE_F3); // 23
specialKeyMap.put(++i, KeyEvent.KEYCODE_F4); // 24
specialKeyMap.put(++i, KeyEvent.KEYCODE_F5); // 25
specialKeyMap.put(++i, KeyEvent.KEYCODE_F6); // 26
specialKeyMap.put(++i, KeyEvent.KEYCODE_F7); // 27
specialKeyMap.put(++i, KeyEvent.KEYCODE_F8); // 28
specialKeyMap.put(++i, KeyEvent.KEYCODE_F9); // 29
specialKeyMap.put(++i, KeyEvent.KEYCODE_F10); // 30
specialKeyMap.put(++i, KeyEvent.KEYCODE_F11); // 31
specialKeyMap.put(++i, KeyEvent.KEYCODE_F12); // 21
}
@Override

View File

@@ -69,9 +69,7 @@ public class RunCommandActivity extends AppCompatActivity {
runOnUiThread(() -> {
ListView view = (ListView) findViewById(R.id.runcommandslist);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
registerForContextMenu(view);
}
registerForContextMenu(view);
commandItems = new ArrayList<>();
for (JSONObject obj : plugin.getCommandList()) {

View File

@@ -177,13 +177,8 @@ public class SharePlugin extends Plugin {
private void receiveText(NetworkPacket np) {
String text = np.getString("text");
if (Build.VERSION.SDK_INT >= 11) {
ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
cm.setText(text);
} else {
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(text);
}
ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
cm.setText(text);
Toast.makeText(context, R.string.shareplugin_text_saved, Toast.LENGTH_LONG).show();
}
@@ -253,7 +248,7 @@ public class SharePlugin extends Plugin {
notification.setURI(destinationUri, mimeType);
notification.show();
if (!customDestination && Build.VERSION.SDK_INT >= 12) {
if (!customDestination) {
Log.i("SharePlugin", "Adding to downloads");
DownloadManager manager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
manager.addCompletedDownload(destinationUri.getLastPathSegment(), device.getName(), true, mimeType, destinationUri.getPath(), fileLength, false);