import android.annotation.SuppressLint;
import android.graphics.Typeface;
import android.text.Editable;
+import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.Gravity;
import android.view.View;
final View focusedView = tvTransactionComment.findFocus();
tvTransactionComment.setTypeface(null,
(focusedView == tvTransactionComment) ? Typeface.NORMAL : Typeface.ITALIC);
- tvTransactionComment.setVisibility(((focusedView != tvTransactionComment) &&
- Misc.isEmptyOrNull(transactionComment))
- ? View.INVISIBLE : View.VISIBLE);
+ tvTransactionComment.setVisibility(
+ ((focusedView != tvTransactionComment) && TextUtils.isEmpty(transactionComment))
+ ? View.INVISIBLE : View.VISIBLE);
};
hintObserver = hint -> {
tvComment.setTypeface(null,
(focusedView == tvComment) ? Typeface.NORMAL : Typeface.ITALIC);
tvComment.setVisibility(
- ((focusedView != tvComment) && Misc.isEmptyOrNull(comment)) ? View.INVISIBLE
- : View.VISIBLE);
+ ((focusedView != tvComment) && TextUtils.isEmpty(comment)) ? View.INVISIBLE
+ : View.VISIBLE);
};
showCommentsObserver = show -> {
textColor = (alpha << 24) | (0x00ffffff & textColor);
textView.setTypeface(null, Typeface.ITALIC);
textView.setHint("");
- if (Misc.isEmptyOrNull(textView.getText())) {
+ if (TextUtils.isEmpty(textView.getText())) {
textView.setVisibility(View.INVISIBLE);
}
}
import android.annotation.SuppressLint;
import android.app.Activity;
import android.database.Cursor;
+import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.LinearLayout;
ArrayList<String> params = new ArrayList<>();
StringBuilder sb = new StringBuilder("select t.profile, t.id from transactions t");
- if (!Misc.isEmptyOrNull(accFilter)) {
+ if (!TextUtils.isEmpty(accFilter)) {
sb.append(" JOIN transaction_accounts ta")
.append(" ON ta.profile = t.profile")
.append(" AND ta.transaction_id = t.id");
sb.append(" WHERE t.description=?");
params.add(description);
- if (!Misc.isEmptyOrNull(accFilter)) {
+ if (!TextUtils.isEmpty(accFilter)) {
sb.append(" AND ta.account_name LIKE '%'||?||'%'");
params.add(accFilter);
}
}
@Override
public void onNoRows() {
- if (Misc.isEmptyOrNull(accFilter))
+ if (TextUtils.isEmpty(accFilter))
return;
debug("description", "Trying transaction search without preferred account filter");
package net.ktnx.mobileledger.ui.profiles;
+import android.text.TextUtils;
+
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Observer;
showCommodityByDefault.setValue(mProfile.getShowCommodityByDefault());
{
String comm = mProfile.getDefaultCommodity();
- if (Misc.isEmptyOrNull(comm))
+ if (TextUtils.isEmpty(comm))
setDefaultCommodity(null);
else
setDefaultCommodity(new Currency(-1, comm));
/*
- * 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
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 boolean equalStrings(String u, CharSequence text) {
return nullIsEmpty(u).equals(text.toString());
}
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;