diff --git a/src/org/kde/kdeconnect/Plugins/MprisPlugin/AlbumArtCache.java b/src/org/kde/kdeconnect/Plugins/MprisPlugin/AlbumArtCache.java index db18dfe4..91d28403 100644 --- a/src/org/kde/kdeconnect/Plugins/MprisPlugin/AlbumArtCache.java +++ b/src/org/kde/kdeconnect/Plugins/MprisPlugin/AlbumArtCache.java @@ -28,6 +28,7 @@ import android.graphics.BitmapFactory; import android.net.ConnectivityManager; import android.os.AsyncTask; import android.os.Build; +import android.text.TextUtils; import android.util.Log; import com.jakewharton.disklrucache.DiskLruCache; @@ -142,7 +143,7 @@ final class AlbumArtCache { */ static Bitmap getAlbumArt(String albumUrl, MprisPlugin plugin, String player) { //If the url is invalid, return "no album art" - if (albumUrl == null || albumUrl.isEmpty()) { + if (TextUtils.isEmpty(albumUrl)) { return null; } diff --git a/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisActivity.java b/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisActivity.java index 25dce3ef..e4a6e631 100644 --- a/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisActivity.java +++ b/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisActivity.java @@ -30,6 +30,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.preference.PreferenceManager; +import android.text.TextUtils; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; @@ -382,7 +383,7 @@ public class MprisActivity extends AppCompatActivity { String targetPlayerName = getIntent().getStringExtra("player"); getIntent().removeExtra("player"); - if (targetPlayerName == null || targetPlayerName.isEmpty()) { + if (TextUtils.isEmpty(targetPlayerName)) { if (savedInstanceState != null) { targetPlayerName = savedInstanceState.getString("targetPlayer"); } diff --git a/src/org/kde/kdeconnect/Plugins/MprisReceiverPlugin/MprisReceiverPlayer.java b/src/org/kde/kdeconnect/Plugins/MprisReceiverPlugin/MprisReceiverPlayer.java index 8d7e6cad..49833f76 100644 --- a/src/org/kde/kdeconnect/Plugins/MprisReceiverPlugin/MprisReceiverPlayer.java +++ b/src/org/kde/kdeconnect/Plugins/MprisReceiverPlugin/MprisReceiverPlayer.java @@ -24,6 +24,7 @@ import android.media.MediaMetadata; import android.media.session.MediaController; import android.media.session.PlaybackState; import android.os.Build; +import android.text.TextUtils; import androidx.annotation.RequiresApi; @@ -110,9 +111,9 @@ class MprisReceiverPlayer { if (metadata == null) return ""; String artist = metadata.getString(MediaMetadata.METADATA_KEY_ARTIST); - if (artist == null || artist.isEmpty()) artist = metadata.getString(MediaMetadata.METADATA_KEY_ALBUM_ARTIST); - if (artist == null || artist.isEmpty()) artist = metadata.getString(MediaMetadata.METADATA_KEY_AUTHOR); - if (artist == null || artist.isEmpty()) artist = metadata.getString(MediaMetadata.METADATA_KEY_WRITER); + if (TextUtils.isEmpty(artist)) artist = metadata.getString(MediaMetadata.METADATA_KEY_ALBUM_ARTIST); + if (TextUtils.isEmpty(artist)) artist = metadata.getString(MediaMetadata.METADATA_KEY_AUTHOR); + if (TextUtils.isEmpty(artist)) artist = metadata.getString(MediaMetadata.METADATA_KEY_WRITER); return artist != null ? artist : ""; } @@ -122,7 +123,7 @@ class MprisReceiverPlayer { if (metadata == null) return ""; String title = metadata.getString(MediaMetadata.METADATA_KEY_TITLE); - if (title == null || title.isEmpty()) title = metadata.getString(MediaMetadata.METADATA_KEY_DISPLAY_TITLE); + if (TextUtils.isEmpty(title)) title = metadata.getString(MediaMetadata.METADATA_KEY_DISPLAY_TITLE); return title != null ? title : ""; } diff --git a/src/org/kde/kdeconnect/Plugins/RunCommandPlugin/RunCommandWidget.java b/src/org/kde/kdeconnect/Plugins/RunCommandPlugin/RunCommandWidget.java index f4e03a14..cfcbb3d8 100644 --- a/src/org/kde/kdeconnect/Plugins/RunCommandPlugin/RunCommandWidget.java +++ b/src/org/kde/kdeconnect/Plugins/RunCommandPlugin/RunCommandWidget.java @@ -7,6 +7,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.net.Uri; +import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.RemoteViews; @@ -46,7 +47,7 @@ public class RunCommandWidget extends AppWidgetProvider { } } }); - } else if (intent != null && intent.getAction() != null && intent.getAction().equals(SET_CURRENT_DEVICE)) { + } else if (intent != null && TextUtils.equals(intent.getAction(), SET_CURRENT_DEVICE)) { setCurrentDevice(context); } diff --git a/src/org/kde/kdeconnect/Plugins/SftpPlugin/StoragePreferenceDialogFragment.java b/src/org/kde/kdeconnect/Plugins/SftpPlugin/StoragePreferenceDialogFragment.java index 25fb8c91..12ec928f 100644 --- a/src/org/kde/kdeconnect/Plugins/SftpPlugin/StoragePreferenceDialogFragment.java +++ b/src/org/kde/kdeconnect/Plugins/SftpPlugin/StoragePreferenceDialogFragment.java @@ -127,7 +127,8 @@ public class StoragePreferenceDialogFragment extends PreferenceDialogFragmentCom storageLocation.setText(requireContext().getString(R.string.sftp_storage_preference_click_to_select)); } - boolean isClickToSelect = storageLocation.getText() != null && storageLocation.getText().toString().equals(getString(R.string.sftp_storage_preference_click_to_select)); + boolean isClickToSelect = TextUtils.equals(storageLocation.getText(), + getString(R.string.sftp_storage_preference_click_to_select)); storageLocation.setCompoundDrawables(null, null, isClickToSelect ? arrowDropDownDrawable : null, null); storageLocation.setEnabled(isClickToSelect); diff --git a/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java b/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java index b6121b64..3c80601e 100644 --- a/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java @@ -32,6 +32,7 @@ import android.os.Build; import android.preference.PreferenceManager; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; +import android.text.TextUtils; import android.util.Log; import org.kde.kdeconnect.Helpers.ContactsHelper; @@ -164,7 +165,7 @@ public class TelephonyPlugin extends Plugin { if (photoUri != null) { try { String base64photo = ContactsHelper.photoId64Encoded(context, photoUri); - if (base64photo != null && !base64photo.isEmpty()) { + if (!TextUtils.isEmpty(base64photo)) { np.set("phoneThumbnail", base64photo); } } catch (Exception e) {