Merge pull request #1673 from mfietz/xiaomi_fuckupery
StringUtils: Xiaomi NoSuchMethodError
This commit is contained in:
commit
8e1cbdeb40
@ -7,6 +7,7 @@ import android.support.v4.content.ContextCompat;
|
|||||||
import android.support.v4.view.MotionEventCompat;
|
import android.support.v4.view.MotionEventCompat;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.helper.ItemTouchHelper;
|
import android.support.v7.widget.helper.ItemTouchHelper;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -28,8 +29,6 @@ import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;
|
|||||||
import com.joanzapata.iconify.Iconify;
|
import com.joanzapata.iconify.Iconify;
|
||||||
import com.nineoldandroids.view.ViewHelper;
|
import com.nineoldandroids.view.ViewHelper;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
@ -214,13 +213,13 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap
|
|||||||
title.setText(item.getTitle());
|
title.setText(item.getTitle());
|
||||||
String pubDateStr = DateUtils.formatAbbrev(mainActivity.get(), item.getPubDate());
|
String pubDateStr = DateUtils.formatAbbrev(mainActivity.get(), item.getPubDate());
|
||||||
int index = 0;
|
int index = 0;
|
||||||
if(StringUtils.countMatches(pubDateStr, ' ') == 1 || StringUtils.countMatches(pubDateStr, ' ') == 2) {
|
if(countMatches(pubDateStr, ' ') == 1 || countMatches(pubDateStr, ' ') == 2) {
|
||||||
index = pubDateStr.lastIndexOf(' ');
|
index = pubDateStr.lastIndexOf(' ');
|
||||||
} else if(StringUtils.countMatches(pubDateStr, '.') == 2) {
|
} else if(countMatches(pubDateStr, '.') == 2) {
|
||||||
index = pubDateStr.lastIndexOf('.');
|
index = pubDateStr.lastIndexOf('.');
|
||||||
} else if(StringUtils.countMatches(pubDateStr, '-') == 2) {
|
} else if(countMatches(pubDateStr, '-') == 2) {
|
||||||
index = pubDateStr.lastIndexOf('-');
|
index = pubDateStr.lastIndexOf('-');
|
||||||
} else if(StringUtils.countMatches(pubDateStr, '/') == 2) {
|
} else if(countMatches(pubDateStr, '/') == 2) {
|
||||||
index = pubDateStr.lastIndexOf('/');
|
index = pubDateStr.lastIndexOf('/');
|
||||||
}
|
}
|
||||||
if(index > 0) {
|
if(index > 0) {
|
||||||
@ -376,4 +375,18 @@ public class QueueRecyclerAdapter extends RecyclerView.Adapter<QueueRecyclerAdap
|
|||||||
*/
|
*/
|
||||||
void onItemClear();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user