diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2016-02-14 07:47:12 +0100 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2016-02-14 07:47:12 +0100 |
commit | 8d60c3b4e9da28e4db5a59eb3847cd1d5dea5c92 (patch) | |
tree | 9835b873dc8796d10146ccc2c23cfa8160b54cb5 /app/src/main/java/de/danoeh/antennapod | |
parent | bd3152b73722f1b33f40daf6bb72d823edcc5110 (diff) | |
download | AntennaPod-8d60c3b4e9da28e4db5a59eb3847cd1d5dea5c92.zip |
Same issue and solution as #884
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java index deddc9af1..aa3368258 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java @@ -7,6 +7,7 @@ import android.support.v4.content.ContextCompat; import android.support.v4.view.MotionEventCompat; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.helper.ItemTouchHelper; +import android.text.TextUtils; import android.util.Log; import android.view.ContextMenu; import android.view.LayoutInflater; @@ -28,8 +29,6 @@ import com.bumptech.glide.request.target.GlideDrawableImageViewTarget; import com.joanzapata.iconify.Iconify; import com.nineoldandroids.view.ViewHelper; -import org.apache.commons.lang3.StringUtils; - import java.lang.ref.WeakReference; import de.danoeh.antennapod.R; @@ -214,13 +213,13 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap title.setText(item.getTitle()); String pubDateStr = DateUtils.formatAbbrev(mainActivity.get(), item.getPubDate()); int index = 0; - if(StringUtils.countMatches(pubDateStr, ' ') == 1 || StringUtils.countMatches(pubDateStr, ' ') == 2) { + if(countMatches(pubDateStr, ' ') == 1 || countMatches(pubDateStr, ' ') == 2) { index = pubDateStr.lastIndexOf(' '); - } else if(StringUtils.countMatches(pubDateStr, '.') == 2) { + } else if(countMatches(pubDateStr, '.') == 2) { index = pubDateStr.lastIndexOf('.'); - } else if(StringUtils.countMatches(pubDateStr, '-') == 2) { + } else if(countMatches(pubDateStr, '-') == 2) { index = pubDateStr.lastIndexOf('-'); - } else if(StringUtils.countMatches(pubDateStr, '/') == 2) { + } else if(countMatches(pubDateStr, '/') == 2) { index = pubDateStr.lastIndexOf('/'); } if(index > 0) { @@ -376,4 +375,18 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap */ void onItemClear(); } + + // Oh Xiaomi, I hate you so much. How did you manage to fuck this up? + private static int countMatches(final CharSequence str, final char ch) { + if (TextUtils.isEmpty(str)) { + return 0; + } + int count = 0; + for (int i = 0; i < str.length(); i++) { + if (ch == str.charAt(i)) { + count++; + } + } + return count; + } } |