From a24375557ffc7362886df61606252dbd9c382468 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 17 Sep 2020 07:13:37 +0000 Subject: [PATCH] replace local utility functions with ones from TextUtils --- .../ui/activity/NewTransactionItemHolder.java | 13 +++++++------ .../ui/activity/NewTransactionItemsAdapter.java | 7 ++++--- .../ui/profiles/ProfileDetailModel.java | 4 +++- .../main/java/net/ktnx/mobileledger/utils/Misc.java | 11 +---------- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java index 21c0ce28..62f0de49 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java @@ -20,6 +20,7 @@ package net.ktnx.mobileledger.ui.activity; 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; @@ -270,9 +271,9 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder 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 -> { @@ -389,8 +390,8 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder 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 -> { @@ -444,7 +445,7 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder 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); } } diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemsAdapter.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemsAdapter.java index 55e02381..0da28e8e 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemsAdapter.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemsAdapter.java @@ -20,6 +20,7 @@ package net.ktnx.mobileledger.ui.activity; 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; @@ -195,7 +196,7 @@ class NewTransactionItemsAdapter extends RecyclerView.Adapter 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"); @@ -204,7 +205,7 @@ class NewTransactionItemsAdapter extends RecyclerView.Adapter