mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-30 05:37:43 +00:00
Use TextUtils' isEmpty() and equals().
This commit is contained in:
parent
0f589fd821
commit
80121a7951
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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 : "";
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user