aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hennen <TomHennen@users.noreply.github.com>2016-02-15 16:42:47 -0500
committerTom Hennen <TomHennen@users.noreply.github.com>2016-02-15 16:42:47 -0500
commit8e1cbdeb403e026389c18a62286c45fd2ced58fb (patch)
tree9835b873dc8796d10146ccc2c23cfa8160b54cb5
parentbd3152b73722f1b33f40daf6bb72d823edcc5110 (diff)
parent8d60c3b4e9da28e4db5a59eb3847cd1d5dea5c92 (diff)
downloadAntennaPod-8e1cbdeb403e026389c18a62286c45fd2ced58fb.tar.gz
Merge pull request #1673 from mfietz/xiaomi_fuckupery
StringUtils: Xiaomi NoSuchMethodError
-rw-r--r--app/src/main/java/de/danoeh/antennapod/adapter/QueueRecyclerAdapter.java25
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 deddc9af..aa336825 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;
+ }
}