From 4bda9bf1121537277b333de40fca9a71f99aac31 Mon Sep 17 00:00:00 2001 From: antoniou Date: Sun, 1 Nov 2020 19:36:59 +0200 Subject: [PATCH] ANDROID: Use TextUtils.isEmpty() instead of String's isEmpty() --- .../android/org/scummvm/scummvm/ExternalStorage.java | 4 ++-- .../android/org/scummvm/scummvm/ScummVMActivity.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backends/platform/android/org/scummvm/scummvm/ExternalStorage.java b/backends/platform/android/org/scummvm/scummvm/ExternalStorage.java index c6c60f5e412..8a42add48e3 100644 --- a/backends/platform/android/org/scummvm/scummvm/ExternalStorage.java +++ b/backends/platform/android/org/scummvm/scummvm/ExternalStorage.java @@ -322,7 +322,7 @@ public class ExternalStorage { */ private static void addPath(String strNew, Collection paths) { // If one of the arguments is null, fill it in from the other. - if (strNew != null && !strNew.isEmpty()) { + if (!TextUtils.isEmpty(strNew)) { File fileNew = new File(strNew); if (!paths.contains(fileNew) && @@ -456,7 +456,7 @@ public class ExternalStorage { mMounts.clear(); if (Environment.getDataDirectory() != null - && !Environment.getDataDirectory().getAbsolutePath().isEmpty()) { + && !TextUtils.isEmpty(Environment.getDataDirectory().getAbsolutePath())) { File dataFilePath = new File(Environment.getDataDirectory().getAbsolutePath()); if (dataFilePath.exists() && dataFilePath.isDirectory()) { map.add(DATA_DIRECTORY); diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java index e4d088a520c..6a590d60c56 100644 --- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java +++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java @@ -1571,7 +1571,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis Log.d(ScummVM.LOG_TAG, "ScummVM Config file already exists!"); Log.d(ScummVM.LOG_TAG, "Existing ScummVM INI: " + _configScummvmFile.getPath()); String existingVersionInfo = getVersionInfoFromScummvmConfiguration(_configScummvmFile.getPath()); - if (!existingVersionInfo.trim().isEmpty()) { + if (!TextUtils.isEmpty(existingVersionInfo) && !TextUtils.isEmpty(existingVersionInfo.trim()) ) { Log.d(ScummVM.LOG_TAG, "Existing ScummVM Version: " + existingVersionInfo.trim()); Version tmpOldVersionFound = new Version(existingVersionInfo.trim()); if (tmpOldVersionFound.compareTo(maxOldVersionFound) > 0) { @@ -1603,7 +1603,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis if (oldCandidateScummVMConfig.exists() && oldCandidateScummVMConfig.isFile()) { Log.d(ScummVM.LOG_TAG, "Old config " + oldConfigFileDescription + " ScummVM file was found!"); String existingVersionInfo = getVersionInfoFromScummvmConfiguration(oldCandidateScummVMConfig.getPath()); - if (!existingVersionInfo.trim().isEmpty()) { + if (!TextUtils.isEmpty(existingVersionInfo) && !TextUtils.isEmpty(existingVersionInfo.trim())) { Log.d(ScummVM.LOG_TAG, "Old config's ScummVM version: " + existingVersionInfo.trim()); Version tmpOldVersionFound = new Version(existingVersionInfo.trim()); // @@ -1927,7 +1927,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis if (_configScummvmFile.exists() && _configScummvmFile.isFile()) { Log.d(ScummVM.LOG_TAG, "Looking into config file for save path: " + _configScummvmFile.getPath()); String persistentGlobalSavePathStr = getSavepathInfoFromScummvmConfiguration(_configScummvmFile.getPath()); - if (!persistentGlobalSavePathStr.trim().isEmpty()) { + if (!TextUtils.isEmpty(persistentGlobalSavePathStr) && !TextUtils.isEmpty(persistentGlobalSavePathStr.trim()) ) { Log.d(ScummVM.LOG_TAG, "Found explicit save path: " + persistentGlobalSavePathStr); persistentGlobalSavePath = new File(persistentGlobalSavePathStr); if (persistentGlobalSavePath.exists() && persistentGlobalSavePath.isDirectory() && persistentGlobalSavePath.listFiles() != null) {