diff --git a/twidere/src/androidTest/java/org/mariotaku/twidere/util/UriUtilsTest.kt b/twidere/src/androidTest/java/org/mariotaku/twidere/util/UriUtilsTest.kt index eb4e4f38c..ee851ea6d 100644 --- a/twidere/src/androidTest/java/org/mariotaku/twidere/util/UriUtilsTest.kt +++ b/twidere/src/androidTest/java/org/mariotaku/twidere/util/UriUtilsTest.kt @@ -1,10 +1,9 @@ package org.mariotaku.twidere.util +import org.junit.Assert import org.junit.Test -import junit.framework.Assert.assertEquals -import junit.framework.Assert.assertNull /** * Created by mariotaku on 16/2/9. @@ -14,22 +13,22 @@ class UriUtilsTest { @Test @Throws(Exception::class) fun testGetAuthority() { - assertEquals("www.google.com", UriUtils.getAuthority("http://www.google.com/")) - assertEquals("twitter.com", UriUtils.getAuthority("https://twitter.com")) - assertNull(UriUtils.getAuthority("www.google.com/")) + Assert.assertEquals("www.google.com", UriUtils.getAuthority("http://www.google.com/")) + Assert.assertEquals("twitter.com", UriUtils.getAuthority("https://twitter.com")) + Assert.assertNull(UriUtils.getAuthority("www.google.com/")) } @Test @Throws(Exception::class) fun testGetPath() { - assertEquals("/", UriUtils.getPath("http://www.example.com/")) - assertEquals("", UriUtils.getPath("http://www.example.com")) - assertEquals("/test/path", UriUtils.getPath("https://example.com/test/path")) - assertEquals("/test/path", UriUtils.getPath("https://example.com/test/path?with=query")) - assertEquals("/test/path/", UriUtils.getPath("https://example.com/test/path/?with=query")) - assertEquals("/test/path", UriUtils.getPath("https://example.com/test/path?with=query#fragment")) - assertEquals("/test/path/", UriUtils.getPath("https://example.com/test/path/?with=query#fragment")) - assertEquals("/test/path", UriUtils.getPath("https://example.com/test/path#fragment")) - assertEquals("/test/path/", UriUtils.getPath("https://example.com/test/path/#fragment")) + Assert.assertEquals("/", UriUtils.getPath("http://www.example.com/")) + Assert.assertEquals("", UriUtils.getPath("http://www.example.com")) + Assert.assertEquals("/test/path", UriUtils.getPath("https://example.com/test/path")) + Assert.assertEquals("/test/path", UriUtils.getPath("https://example.com/test/path?with=query")) + Assert.assertEquals("/test/path/", UriUtils.getPath("https://example.com/test/path/?with=query")) + Assert.assertEquals("/test/path", UriUtils.getPath("https://example.com/test/path?with=query#fragment")) + Assert.assertEquals("/test/path/", UriUtils.getPath("https://example.com/test/path/?with=query#fragment")) + Assert.assertEquals("/test/path", UriUtils.getPath("https://example.com/test/path#fragment")) + Assert.assertEquals("/test/path/", UriUtils.getPath("https://example.com/test/path/#fragment")) } } \ No newline at end of file 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 d95e87fba..34565fada 100644 --- a/twidere/src/main/java/org/mariotaku/twidere/util/CustomTabUtils.java +++ b/twidere/src/main/java/org/mariotaku/twidere/util/CustomTabUtils.java @@ -93,7 +93,7 @@ public class CustomTabUtils implements Constants { List specs = new ArrayList<>(); for (Tab tab : getTabs(context)) { @CustomTabType - final String type = tab.getType(); + final String type = Tab.getTypeAlias(tab.getType()); final int position = tab.getPosition(); final String iconType = tab.getIcon(); final String name = tab.getName(); @@ -153,11 +153,6 @@ public class CustomTabUtils implements Constants { return null; } - public static TabConfiguration getTabConfiguration(final String tabType) { - if (tabType == null) return null; - return TabConfiguration.ofType(Tab.getTypeAlias(tabType)); - } - public static Drawable getTabIconDrawable(final Context context, final DrawableHolder icon) { if (icon == null) { return ContextCompat.getDrawable(context, R.drawable.ic_action_list); diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/ParcelableActivitiesAdapter.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/ParcelableActivitiesAdapter.kt index 015da6f42..8bfda7f85 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/ParcelableActivitiesAdapter.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/adapter/ParcelableActivitiesAdapter.kt @@ -158,7 +158,7 @@ class ParcelableActivitiesAdapter( } private fun bindTitleSummaryViewHolder(holder: ActivityTitleSummaryViewHolder, position: Int) { - holder.displayActivity(getActivity(position)!!, byFriends) + holder.displayActivity(getActivity(position)!!) } fun getData(): List? { 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 0a0e5ad2a..35409816c 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/CustomTabsFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/CustomTabsFragment.kt @@ -469,7 +469,7 @@ class CustomTabsFragment : BaseSupportFragment(), LoaderCallbacks, Mult super.bindView(view, context, cursor) val holder = view.tag as TwoLineWithIconViewHolder val indices = indices!! - val type = cursor.getString(indices.type) + val type = Tab.getTypeAlias(cursor.getString(indices.type)) val name = cursor.getString(indices.name) val iconKey = cursor.getString(indices.icon) if (CustomTabUtils.isTabTypeValid(type)) { diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/SavedSearchesListFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/SavedSearchesListFragment.kt index b51996da9..d9972bfbc 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/SavedSearchesListFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/SavedSearchesListFragment.kt @@ -72,25 +72,25 @@ class SavedSearchesListFragment : AbsContentListViewFragment(EXTRA_ACCOUNT_KEY) override fun onItemLongClick(view: AdapterView<*>, child: View, position: Int, id: Long): Boolean { - val item = adapter!!.findItem(id) ?: return false + val item = adapter.findItem(id) ?: return false DestroySavedSearchDialogFragment.show(fragmentManager, accountKey, item.id, item.name) return true } override fun onItemClick(view: AdapterView<*>, child: View, position: Int, id: Long) { - val item = adapter!!.findItem(id) ?: return + val item = adapter.findItem(id) ?: return openTweetSearch(activity, accountKey, item.query) } override fun onLoaderReset(loader: Loader?>) { - adapter!!.setData(null) + adapter.setData(null) } override fun onLoadFinished(loader: Loader?>, data: ResponseList?) { if (data != null) { Collections.sort(data, POSITION_COMPARATOR) } - adapter!!.setData(data) + adapter.setData(data) showContent() refreshing = false } @@ -109,7 +109,7 @@ class SavedSearchesListFragment : AbsContentListViewFragment