diff --git a/twidere/src/main/java/org/mariotaku/twidere/util/CustomTabUtils.java b/twidere/src/main/java/org/mariotaku/twidere/util/CustomTabUtils.java index 34565fada..27b1719bb 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/CustomTabUtils.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/CustomTabUtils.java @@ -28,7 +28,6 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; -import android.support.v4.util.SimpleArrayMap; import android.text.TextUtils; import org.apache.commons.lang3.ArrayUtils; @@ -53,21 +52,10 @@ import java.util.Collections; import java.util.List; public class CustomTabUtils implements Constants { - private static final SimpleArrayMap CUSTOM_TABS_ICON_NAME_MAP = new SimpleArrayMap<>(); private CustomTabUtils() { } - @Nullable - public static String findTabIconKey(final int iconRes) { - for (int i = 0, j = CUSTOM_TABS_ICON_NAME_MAP.size(); i < j; i++) { - if (CUSTOM_TABS_ICON_NAME_MAP.valueAt(i) == iconRes) { - return CUSTOM_TABS_ICON_NAME_MAP.keyAt(i); - } - } - return null; - } - public static List getTabs(@NonNull final Context context) { final ContentResolver resolver = context.getContentResolver(); @@ -179,8 +167,8 @@ public class CustomTabUtils implements Constants { return added; } - public static boolean isTabTypeValid(final String tabType) { - return tabType != null && TabConfiguration.ofType(Tab.getTypeAlias(tabType)) != null; + public static boolean isTabTypeValid(@NonNull final String tabType) { + return TabConfiguration.ofType(Tab.getTypeAlias(tabType)) != null; } public static boolean hasAccountId(final Context context, @NonNull final Bundle args, diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/CustomTabsFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/CustomTabsFragment.kt index 35409816c..fd5f3435f 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/CustomTabsFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/CustomTabsFragment.kt @@ -472,7 +472,7 @@ class CustomTabsFragment : BaseSupportFragment(), LoaderCallbacks, Mult val type = Tab.getTypeAlias(cursor.getString(indices.type)) val name = cursor.getString(indices.name) val iconKey = cursor.getString(indices.icon) - if (CustomTabUtils.isTabTypeValid(type)) { + if (type != null && CustomTabUtils.isTabTypeValid(type)) { val typeName = CustomTabUtils.getTabTypeName(context, type) holder.text1.text = if (TextUtils.isEmpty(name)) typeName else name holder.text1.paintFlags = holder.text1.paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()