ANDROID: Use TextUtils.isEmpty() instead of String's isEmpty()

This commit is contained in:
antoniou 2020-11-01 19:36:59 +02:00
parent 7aa38e197a
commit 4bda9bf112
2 changed files with 5 additions and 5 deletions

View File

@ -322,7 +322,7 @@ public class ExternalStorage {
*/
private static void addPath(String strNew, Collection<File> 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);

View File

@ -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) {