2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-28 12:47:43 +00:00

Use ArrayUtils.EMPTY_STRING_ARRAY constant.

This commit is contained in:
Isira Seneviratne 2020-07-12 13:37:24 +05:30 committed by Nicolas Fella
parent f6187333a8
commit 7458adc7d6
9 changed files with 22 additions and 17 deletions

View File

@ -40,6 +40,7 @@ import androidx.annotation.RequiresApi;
import com.klinker.android.send_message.Utils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.json.JSONArray;
@ -302,7 +303,7 @@ public class SMSHelper {
try (Cursor myCursor = context.getContentResolver().query(
uri,
fetchColumns.toArray(new String[]{}),
fetchColumns.toArray(ArrayUtils.EMPTY_STRING_ARRAY),
selection,
selectionArgs,
sortOrder)
@ -401,7 +402,7 @@ public class SMSHelper {
) {
try (Cursor myCursor = context.getContentResolver().query(
uri,
fetchColumns.toArray(new String[]{}),
fetchColumns.toArray(ArrayUtils.EMPTY_STRING_ARRAY),
selection,
selectionArgs,
sortOrder)

View File

@ -29,6 +29,7 @@ import android.preference.PreferenceManager;
import android.util.Base64;
import android.util.Log;
import org.apache.commons.lang3.ArrayUtils;
import org.kde.kdeconnect.Helpers.DeviceHelper;
import org.kde.kdeconnect.Helpers.RandomHelper;
import org.spongycastle.asn1.x500.RDN;
@ -241,7 +242,7 @@ public class SslHelper {
supportedCiphers.add("TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"); // API 20+
}
supportedCiphers.add("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"); // API 11+
socket.setEnabledCipherSuites(supportedCiphers.toArray(new String[0]));
socket.setEnabledCipherSuites(supportedCiphers.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
socket.setSoTimeout(10000);

View File

@ -38,6 +38,7 @@ import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
import org.apache.commons.lang3.ArrayUtils;
import org.kde.kdeconnect.Helpers.DeviceHelper;
import org.kde.kdeconnect.Helpers.NotificationHelper;
import org.kde.kdeconnect.MyApplication;
@ -215,7 +216,7 @@ public class FindMyPhonePlugin extends Plugin {
@Override
public String[] getOutgoingPacketTypes() {
return new String[0];
return ArrayUtils.EMPTY_STRING_ARRAY;
}
@Override

View File

@ -22,6 +22,7 @@ package org.kde.kdeconnect.Plugins.FindRemoteDevicePlugin;
import android.app.Activity;
import org.apache.commons.lang3.ArrayUtils;
import org.kde.kdeconnect.NetworkPacket;
import org.kde.kdeconnect.Plugins.FindMyPhonePlugin.FindMyPhonePlugin;
import org.kde.kdeconnect.Plugins.Plugin;
@ -70,12 +71,11 @@ public class FindRemoteDevicePlugin extends Plugin {
@Override
public String[] getSupportedPacketTypes() {
return new String[]{};
return ArrayUtils.EMPTY_STRING_ARRAY;
}
@Override
public String[] getOutgoingPacketTypes() {
return new String[]{FindMyPhonePlugin.PACKET_TYPE_FINDMYPHONE_REQUEST};
}
}

View File

@ -51,6 +51,7 @@ import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.fragment.app.FragmentManager;
import org.apache.commons.lang3.ArrayUtils;
import org.kde.kdeconnect.Backends.BaseLink;
import org.kde.kdeconnect.Backends.BaseLinkProvider;
import org.kde.kdeconnect.BackgroundService;
@ -160,7 +161,7 @@ public class MprisActivity extends AppCompatActivity {
final List<String> playerList = mpris.getPlayerList();
final ArrayAdapter<String> adapter = new ArrayAdapter<>(MprisActivity.this,
android.R.layout.simple_spinner_item,
playerList.toArray(new String[0])
playerList.toArray(ArrayUtils.EMPTY_STRING_ARRAY)
);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

View File

@ -33,6 +33,7 @@ import androidx.annotation.StringRes;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;
import org.apache.commons.lang3.ArrayUtils;
import org.kde.kdeconnect.Device;
import org.kde.kdeconnect.NetworkPacket;
import org.kde.kdeconnect.UserInterface.AlertDialogFragment;
@ -236,11 +237,11 @@ public abstract class Plugin {
public abstract String[] getOutgoingPacketTypes();
protected String[] getRequiredPermissions() {
return new String[0];
return ArrayUtils.EMPTY_STRING_ARRAY;
}
protected String[] getOptionalPermissions() {
return new String[0];
return ArrayUtils.EMPTY_STRING_ARRAY;
}
//Permission from Manifest.permission.*

View File

@ -24,18 +24,16 @@ package org.kde.kdeconnect.Plugins.PresenterPlugin;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Network;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
import androidx.core.content.ContextCompat;
import org.apache.commons.lang3.ArrayUtils;
import org.kde.kdeconnect.NetworkPacket;
import org.kde.kdeconnect.Plugins.Plugin;
import org.kde.kdeconnect.Plugins.PluginFactory;
import org.kde.kdeconnect_tp.R;
import androidx.core.content.ContextCompat;
import static org.kde.kdeconnect.Plugins.MousePadPlugin.KeyListenerView.SpecialKeysMap;
@PluginFactory.LoadablePlugin
@ -81,7 +79,7 @@ public class PresenterPlugin extends Plugin {
}
@Override
public String[] getSupportedPacketTypes() { return new String[0]; }
public String[] getSupportedPacketTypes() { return ArrayUtils.EMPTY_STRING_ARRAY; }
@Override
public String[] getOutgoingPacketTypes() {

View File

@ -32,6 +32,7 @@ import com.klinker.android.send_message.Settings;
import com.klinker.android.send_message.Transaction;
import com.klinker.android.send_message.Utils;
import org.apache.commons.lang3.ArrayUtils;
import org.kde.kdeconnect.Helpers.SMSHelper;
import org.kde.kdeconnect_tp.R;
@ -92,7 +93,7 @@ public class SmsMmsUtils {
addresses.add(address.toString());
}
Message message = new Message(textMessage, addresses.toArray(new String[0]));
Message message = new Message(textMessage, addresses.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
message.setSave(true);
// Sending MMS on android requires the app to be set as the default SMS app,

View File

@ -35,6 +35,7 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import org.apache.commons.lang3.ArrayUtils;
import org.kde.kdeconnect.Helpers.ContactsHelper;
import org.kde.kdeconnect.NetworkPacket;
import org.kde.kdeconnect.Plugins.Plugin;
@ -316,7 +317,7 @@ public class TelephonyPlugin extends Plugin {
Manifest.permission.READ_CALL_LOG,
};
} else {
return new String[0];
return ArrayUtils.EMPTY_STRING_ARRAY;
}
}