mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-31 22:25:08 +00:00
Fixed crash on older Androids
This commit is contained in:
@@ -37,6 +37,7 @@ import android.util.Base64;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.kde.kdeconnect.Backends.BaseLink;
|
import org.kde.kdeconnect.Backends.BaseLink;
|
||||||
|
import org.kde.kdeconnect.Helpers.ObjectsHelper;
|
||||||
import org.kde.kdeconnect.UserInterface.MaterialActivity;
|
import org.kde.kdeconnect.UserInterface.MaterialActivity;
|
||||||
import org.kde.kdeconnect.Plugins.Plugin;
|
import org.kde.kdeconnect.Plugins.Plugin;
|
||||||
import org.kde.kdeconnect.Plugins.PluginFactory;
|
import org.kde.kdeconnect.Plugins.PluginFactory;
|
||||||
@@ -556,8 +557,8 @@ public class Device implements BaseLink.PackageReceiver {
|
|||||||
} else if (NetworkPackage.PACKAGE_TYPE_CAPABILITIES.equals(np.getType())) {
|
} else if (NetworkPackage.PACKAGE_TYPE_CAPABILITIES.equals(np.getType())) {
|
||||||
ArrayList<String> newIncomingCapabilities = np.getStringList("SupportedIncomingInterfaces");
|
ArrayList<String> newIncomingCapabilities = np.getStringList("SupportedIncomingInterfaces");
|
||||||
ArrayList<String> newOutgoingCapabilities = np.getStringList("SupportedOutgoingInterfaces");
|
ArrayList<String> newOutgoingCapabilities = np.getStringList("SupportedOutgoingInterfaces");
|
||||||
if (!Objects.equals(newIncomingCapabilities, incomingCapabilities) ||
|
if (!ObjectsHelper.equals(newIncomingCapabilities, incomingCapabilities) ||
|
||||||
!Objects.equals(newOutgoingCapabilities, outgoingCapabilities)) {
|
!ObjectsHelper.equals(newOutgoingCapabilities, outgoingCapabilities)) {
|
||||||
incomingCapabilities = newIncomingCapabilities;
|
incomingCapabilities = newIncomingCapabilities;
|
||||||
outgoingCapabilities = newOutgoingCapabilities;
|
outgoingCapabilities = newOutgoingCapabilities;
|
||||||
reloadPluginsFromSettings();
|
reloadPluginsFromSettings();
|
||||||
|
7
src/org/kde/kdeconnect/Helpers/ObjectsHelper.java
Normal file
7
src/org/kde/kdeconnect/Helpers/ObjectsHelper.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package org.kde.kdeconnect.Helpers;
|
||||||
|
|
||||||
|
public class ObjectsHelper {
|
||||||
|
public static boolean equals(Object a, Object b) {
|
||||||
|
return (a == null) ? (b == null) : a.equals(b);
|
||||||
|
}
|
||||||
|
}
|
@@ -69,7 +69,7 @@ public class PluginPreference extends CheckBoxPreference {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
boolean newState = !device.isPluginEnabled(pluginKey);
|
boolean newState = !device.isPluginEnabled(pluginKey);
|
||||||
setChecked(newState);
|
setChecked(newState); //It actually works on API<14
|
||||||
button.setEnabled(newState);
|
button.setEnabled(newState);
|
||||||
device.setPluginEnabled(pluginKey, newState);
|
device.setPluginEnabled(pluginKey, newState);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user