]> git.ktnx.net Git - mobile-ledger-staging.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/utils/Misc.java
migrate profile detail fragment to view binding
[mobile-ledger-staging.git] / app / src / main / java / net / ktnx / mobileledger / utils / Misc.java
index b912541fcd351f20d92b948c846ab481cb289d14..c75b6339ae0fb0b074deed2d2088ed7c0e811fd2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2019 Damyan Ivanov.
+ * Copyright © 2020 Damyan Ivanov.
  * This file is part of MoLe.
  * MoLe is free software: you can distribute it and/or modify it
  * under the term of the GNU General Public License as published by
@@ -19,6 +19,7 @@ package net.ktnx.mobileledger.utils;
 
 import android.app.Activity;
 import android.content.res.Configuration;
+import android.text.Editable;
 import android.view.WindowManager;
 
 import androidx.annotation.Nullable;
@@ -63,9 +64,10 @@ public class Misc {
     public static String nullIsEmpty(String str) {
         return (str == null) ? "" : str;
     }
-    public static boolean isEmptyOrNull (String str) {
-        if (str == null) return true;
-        return str.isEmpty();
+    public static String nullIsEmpty(Editable e) {
+        if (e == null)
+            return "";
+        return e.toString();
     }
     public static boolean equalStrings(String u, CharSequence text) {
         return nullIsEmpty(u).equals(text.toString());
@@ -73,11 +75,6 @@ public class Misc {
     public static boolean equalStrings(String a, String b) {
         return nullIsEmpty(a).equals(nullIsEmpty(b));
     }
-    public static boolean isEmptyOrNull(CharSequence text) {
-        if (text == null)
-            return true;
-        return text.length() == 0;
-    }
     public static String trim(@Nullable String string) {
         if (string == null)
             return null;