Browse Source

codacy: Avoid using Literals in Conditional Statements

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 5 years ago
parent
commit
783e28365d

+ 2 - 1
src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java

@@ -83,6 +83,7 @@ public class FileDataStorageManager {
     private static final String EXCEPTION_MSG = "Exception in batch of operations ";
 
     public static final int ROOT_PARENT_ID = 0;
+    public static final String NULL_STRING = "null";
 
     private ContentResolver contentResolver;
     private ContentProviderClient contentProviderClient;
@@ -1001,7 +1002,7 @@ public class FileDataStorageManager {
 
             String sharees = c.getString(c.getColumnIndex(ProviderTableMeta.FILE_SHAREES));
 
-            if (sharees == null || "null".equals(sharees) || sharees.isEmpty()) {
+            if (sharees == null || NULL_STRING.equals(sharees) || sharees.isEmpty()) {
                 file.setSharees(new ArrayList<>());
             } else {
                 try {

+ 1 - 1
src/main/java/com/owncloud/android/utils/ThemeUtils.java

@@ -636,7 +636,7 @@ public final class ThemeUtils {
     public static void setEditTextCursorColor(EditText editText, int color) {
         try {
             // Get the cursor resource id
-            if (Build.VERSION.SDK_INT >= 28) {//set differently in Android P (API 28)
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//set differently in Android P (API 28)
                 Field field = TextView.class.getDeclaredField("mCursorDrawableRes");
                 field.setAccessible(true);
                 int drawableResId = field.getInt(editText);