Tusky-App-Android/app/src/main/java/com/keylesspalace/tusky/StatusListActivity.kt

437 lines
17 KiB
Kotlin
Raw Normal View History

/* Copyright 2019 Tusky Contributors
*
* This file is a part of Tusky.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Tusky; if not,
* see <https://www.gnu.org/licenses>. */
package com.keylesspalace.tusky
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import androidx.fragment.app.commit
import androidx.lifecycle.lifecycleScope
import at.connyduck.calladapter.networkresult.fold
import com.google.android.material.snackbar.Snackbar
import com.keylesspalace.tusky.appstore.EventHub
import com.keylesspalace.tusky.appstore.PreferenceChangedEvent
import com.keylesspalace.tusky.components.filters.EditFilterActivity
import com.keylesspalace.tusky.components.filters.FiltersActivity
import com.keylesspalace.tusky.components.timeline.TimelineFragment
Timeline paging (#2238) * first setup * network timeline paging / improvements * rename classes / move to correct package * remove unused class TimelineAdapter * some code cleanup * remove TimelineRepository, put mapper functions in TimelineTypeMappers.kt * add db migration * cleanup unused code * bugfix * make default timeline settings work again * fix pinning statuses from timeline * fix network timeline * respect account settings in NetworkTimelineRemoteMediator * respect account settings in NetworkTimelineRemoteMediator * update license headers * show error view when an error occurs * cleanup some todos * fix db migration * fix changing mediaPreviewEnabled setting * fix "load more" button appearing on top of timeline * fix filtering and other bugs * cleanup cache after 14 days * fix TimelineDAOTest * fix code formatting * add NetworkTimeline unit tests * add CachedTimeline unit tests * fix code formatting * move TimelineDaoTest to unit tests * implement removeAllByInstance for CachedTimelineViewModel * fix code formatting * fix bug in TimelineDao.deleteAllFromInstance * improve loading more statuses in NetworkTimelineViewModel * improve loading more statuses in NetworkTimelineViewModel * fix bug where empty state was shown too soon * reload top of cached timeline on app start * improve CachedTimelineRemoteMediator and Tests * improve cached timeline tests * fix some more todos * implement TimelineFragment.removeItem * fix ListStatusAccessibilityDelegate * fix crash in NetworkTimelineViewModel.loadMore * fix default state of collapsible statuses * fix default state of collapsible statuses -tests * fix showing/hiding media in the timeline * get rid of some not-null assertion operators in TimelineTypeMappers * fix tests * error handling in CachedTimelineViewModel.loadMore * keep local status state when refreshing cached statuses * keep local status state when refreshing network timeline statuses * show placeholder loading state in cached timeline * better comments, some code cleanup * add TimelineViewModelTest, improve code, fix bug * fix ktlint * fix voting in boosted polls * code improvement
2022-01-11 19:00:29 +01:00
import com.keylesspalace.tusky.components.timeline.viewmodel.TimelineViewModel.Kind
import com.keylesspalace.tusky.databinding.ActivityStatuslistBinding
import com.keylesspalace.tusky.entity.Filter
import com.keylesspalace.tusky.entity.FilterV1
import com.keylesspalace.tusky.util.isHttpNotFound
import com.keylesspalace.tusky.util.startActivityWithSlideInAnimation
import com.keylesspalace.tusky.util.viewBinding
Replace Dagger-Android with Hilt and remove Kapt (#4423) Hilt is an annotation processor built on top of Dagger which allows to remove all the Android dependency injection boilerplate code (currently around 900 lines) by writing it for us. Hilt can use KSP instead of Kapt so Kapt can be completely removed from the project. Kapt is slow, deprecated and has a few compatibility issues. Removing Kapt will improve build times since no Java stubs have to be generated for Kotlin classes anymore (Note that KSP also processes annotations in Java classes so it can completely replace Kapt). - Remove all modules related to manual dependency injection configuration. - Rename `AppModule` to `StorageModule` since it now only contains configuration to retrieve the DataBase and SharedPreferences. - Annotate all entry points (Activities, Fragments, BroadcastReceivers and Services) with `@AndroidEntryPoint`. - Annotate all injected ViewModels with `@HiltViewModel` and replace the custom ViewModel Factory with the default one (which integrates with the one generated by Hilt). - Add a public field to allow overriding the default ViewModelProvider.Factory in `BaseActivity` in tests. - Annotate tested Activities with `@OptionalInject` since Activity tests currently rely on the Activities not being injected automatically. - Annotate injected `Context` arguments with `@ApplicationContext`. Hilt provides the `Context` binding automatically but requires to specify if the Application or Activity Context is wanted. - Add WorkManager Hilt integration so all Workers are injected by Hilt automatically using `HiltWorkerFactory`. - Lazily initialize WorkManager in `TuskyApplication`. - Remove Kapt and Kapt workarounds. - ~~Remove toolchain configuration for Java 21. Toolchains force the Java bytecode to match the JDK version used to build the project, and apparently Hilt doesn't run inside the toolchain so cannot process the source code if the JDK version of the toolchain is higher than the JDK used to run Gradle. [And configuring a toolchain for an older Java version causes other issues](https://jakewharton.com/gradle-toolchains-are-rarely-a-good-idea/). **Removing toolchains configuration doesn't prevent the project from being built using JDK 21** or more recent versions but allows to build the project using older JDKs as well.~~ Added a fix to allow Hilt to properly use the JDK toolchain. - ~~Set the Java and Kotlin bytecode target to Java 17. The standard bytecode target for Android projects is usually Java 8 or 11 (any higher version doesn't provide any benefit but may cause compatibility issues). However, since the app currently uses a library built against Java 17 bytecode (`networkresult-calladapter`), it needs to target at least Java 17 bytecode as well.~~ - Update the Dagger 2 URL in the licenses screen. Hilt is part of Dagger 2 so the label wasn't changed.
2024-05-10 15:55:07 +02:00
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import kotlinx.coroutines.launch
Replace Dagger-Android with Hilt and remove Kapt (#4423) Hilt is an annotation processor built on top of Dagger which allows to remove all the Android dependency injection boilerplate code (currently around 900 lines) by writing it for us. Hilt can use KSP instead of Kapt so Kapt can be completely removed from the project. Kapt is slow, deprecated and has a few compatibility issues. Removing Kapt will improve build times since no Java stubs have to be generated for Kotlin classes anymore (Note that KSP also processes annotations in Java classes so it can completely replace Kapt). - Remove all modules related to manual dependency injection configuration. - Rename `AppModule` to `StorageModule` since it now only contains configuration to retrieve the DataBase and SharedPreferences. - Annotate all entry points (Activities, Fragments, BroadcastReceivers and Services) with `@AndroidEntryPoint`. - Annotate all injected ViewModels with `@HiltViewModel` and replace the custom ViewModel Factory with the default one (which integrates with the one generated by Hilt). - Add a public field to allow overriding the default ViewModelProvider.Factory in `BaseActivity` in tests. - Annotate tested Activities with `@OptionalInject` since Activity tests currently rely on the Activities not being injected automatically. - Annotate injected `Context` arguments with `@ApplicationContext`. Hilt provides the `Context` binding automatically but requires to specify if the Application or Activity Context is wanted. - Add WorkManager Hilt integration so all Workers are injected by Hilt automatically using `HiltWorkerFactory`. - Lazily initialize WorkManager in `TuskyApplication`. - Remove Kapt and Kapt workarounds. - ~~Remove toolchain configuration for Java 21. Toolchains force the Java bytecode to match the JDK version used to build the project, and apparently Hilt doesn't run inside the toolchain so cannot process the source code if the JDK version of the toolchain is higher than the JDK used to run Gradle. [And configuring a toolchain for an older Java version causes other issues](https://jakewharton.com/gradle-toolchains-are-rarely-a-good-idea/). **Removing toolchains configuration doesn't prevent the project from being built using JDK 21** or more recent versions but allows to build the project using older JDKs as well.~~ Added a fix to allow Hilt to properly use the JDK toolchain. - ~~Set the Java and Kotlin bytecode target to Java 17. The standard bytecode target for Android projects is usually Java 8 or 11 (any higher version doesn't provide any benefit but may cause compatibility issues). However, since the app currently uses a library built against Java 17 bytecode (`networkresult-calladapter`), it needs to target at least Java 17 bytecode as well.~~ - Update the Dagger 2 URL in the licenses screen. Hilt is part of Dagger 2 so the label wasn't changed.
2024-05-10 15:55:07 +02:00
@AndroidEntryPoint
class StatusListActivity : BottomSheetActivity() {
@Inject
lateinit var eventHub: EventHub
private val binding: ActivityStatuslistBinding by viewBinding(
ActivityStatuslistBinding::inflate
)
private lateinit var kind: Kind
private var hashtag: String? = null
private var followTagItem: MenuItem? = null
private var unfollowTagItem: MenuItem? = null
private var muteTagItem: MenuItem? = null
private var unmuteTagItem: MenuItem? = null
/** The filter muting hashtag, null if unknown or hashtag is not filtered */
private var mutedFilterV1: FilterV1? = null
private var mutedFilter: Filter? = null
override fun onCreate(savedInstanceState: Bundle?) {
Log.d("StatusListActivity", "onCreate")
super.onCreate(savedInstanceState)
setContentView(binding.root)
setSupportActionBar(binding.includedToolbar.toolbar)
kind = Kind.valueOf(intent.getStringExtra(EXTRA_KIND)!!)
val listId = intent.getStringExtra(EXTRA_LIST_ID)
hashtag = intent.getStringExtra(EXTRA_HASHTAG)
val title = when (kind) {
Kind.FAVOURITES -> getString(R.string.title_favourites)
Kind.BOOKMARKS -> getString(R.string.title_bookmarks)
Kind.TAG -> getString(R.string.title_tag).format(hashtag)
Kind.PUBLIC_TRENDING_STATUSES -> getString(R.string.title_public_trending_statuses)
else -> intent.getStringExtra(EXTRA_LIST_TITLE)
}
supportActionBar?.run {
setTitle(title)
setDisplayHomeAsUpEnabled(true)
setDisplayShowHomeEnabled(true)
}
if (supportFragmentManager.findFragmentById(R.id.fragmentContainer) == null) {
supportFragmentManager.commit {
val fragment = if (kind == Kind.TAG) {
TimelineFragment.newHashtagInstance(listOf(hashtag!!))
} else {
TimelineFragment.newInstance(kind, listId)
}
replace(R.id.fragmentContainer, fragment)
}
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
val tag = hashtag
if (kind == Kind.TAG && tag != null) {
lifecycleScope.launch {
mastodonApi.tag(tag).fold(
{ tagEntity ->
menuInflater.inflate(R.menu.view_hashtag_toolbar, menu)
followTagItem = menu.findItem(R.id.action_follow_hashtag)
unfollowTagItem = menu.findItem(R.id.action_unfollow_hashtag)
muteTagItem = menu.findItem(R.id.action_mute_hashtag)
unmuteTagItem = menu.findItem(R.id.action_unmute_hashtag)
followTagItem?.isVisible = tagEntity.following == false
unfollowTagItem?.isVisible = tagEntity.following == true
followTagItem?.setOnMenuItemClickListener { followTag() }
unfollowTagItem?.setOnMenuItemClickListener { unfollowTag() }
muteTagItem?.setOnMenuItemClickListener { muteTag() }
unmuteTagItem?.setOnMenuItemClickListener { unmuteTag() }
updateMuteTagMenuItems()
},
{
Log.w(TAG, "Failed to query tag #$tag", it)
}
)
}
}
return super.onCreateOptionsMenu(menu)
}
private fun followTag(): Boolean {
val tag = hashtag
if (tag != null) {
lifecycleScope.launch {
mastodonApi.followTag(tag).fold(
{
followTagItem?.isVisible = false
unfollowTagItem?.isVisible = true
Snackbar.make(
binding.root,
getString(R.string.following_hashtag_success_format, tag),
Snackbar.LENGTH_SHORT
).show()
},
{
Snackbar.make(
binding.root,
getString(R.string.error_following_hashtag_format, tag),
Snackbar.LENGTH_SHORT
).show()
Log.e(TAG, "Failed to follow #$tag", it)
}
)
}
}
return true
}
private fun unfollowTag(): Boolean {
val tag = hashtag
if (tag != null) {
lifecycleScope.launch {
mastodonApi.unfollowTag(tag).fold(
{
followTagItem?.isVisible = true
unfollowTagItem?.isVisible = false
Snackbar.make(
binding.root,
getString(R.string.unfollowing_hashtag_success_format, tag),
Snackbar.LENGTH_SHORT
).show()
},
{
Snackbar.make(
binding.root,
getString(R.string.error_unfollowing_hashtag_format, tag),
Snackbar.LENGTH_SHORT
).show()
Log.e(TAG, "Failed to unfollow #$tag", it)
}
)
}
}
return true
}
/**
* Determine if the current hashtag is muted, and update the UI state accordingly.
*/
private fun updateMuteTagMenuItems() {
val tag = hashtag ?: return
val hashedTag = "#$tag"
muteTagItem?.isVisible = true
muteTagItem?.isEnabled = false
unmuteTagItem?.isVisible = false
2022-12-08 09:58:58 +01:00
lifecycleScope.launch {
mastodonApi.getFilters().fold(
{ filters ->
mutedFilter = filters.firstOrNull { filter ->
// TODO shouldn't this be an exact match (only one keyword; exactly the hashtag)?
filter.context.contains(Filter.Kind.HOME.kind) && filter.title == hashedTag
}
updateTagMuteState(mutedFilter != null)
2022-12-08 09:58:58 +01:00
},
{ throwable ->
if (throwable.isHttpNotFound()) {
mastodonApi.getFiltersV1().fold(
{ filters ->
mutedFilterV1 = filters.firstOrNull { filter ->
hashedTag == filter.phrase && filter.context.contains(FilterV1.HOME)
}
updateTagMuteState(mutedFilterV1 != null)
},
Fix various lint warnings (#4409) - Remove empty file `ExampleInstrumentedTest.java`. - Replace deprecated `MigrationTestHelper` constructor call. - Add reified inline extension methods for `Bundle` and `Intent` to retrieve `Parcelable` and `Serializable` objects by calling the core `BundleCompat` and `IntentCompat` methods, to allow shorter syntax and removing the need to pass the class explicitly. - Replace deprecated `drawable.setColorFilter()` with simpler `drawable.setTint()` (uses blend mode `SRC_IN` by default, has the same effect as `SRC_ATOP` when the source is a color). - Rename shadowed variables (mostly caught exceptions). - Remove unnecessary `.orEmpty()` on non-null fields. - Replace `.size() == 0` with `.isEmpty()`. - Prevent `NullPointerException` when `account.getDisplayName()` is `null` in `StatusBaseViewHolder.setDisplayName()`. - Declare `customEmojis` argument as non-null in `StatusBaseViewHolder.setDisplayName()` because it calls `CustomEmojiHelper.emojify()` which now requires it to be non-null. - Prevent `NullPointerException` when no matching filter is found in `StatusBaseViewHolder.setupFilterPlaceholder()`. - Remove deprecated call to `setTargetFragment()` (target fragment is not used anyway). - Remove deprecated call to `isUserVisibleHint()` and test if the view has been destroyed instead. - Remove some unused imports. - Remove unnecessary casts. - Rename arguments to supertype names when a warning is shown. - Prevent a potential memory leak by clearing the `toolbarVisibilityDisposable` reference in `onDestroyView()`.
2024-05-05 08:34:41 +02:00
{ throwable2 ->
Log.e(TAG, "Error getting filters: $throwable2")
}
)
} else {
Log.e(TAG, "Error getting filters: $throwable")
}
2022-12-08 09:58:58 +01:00
}
)
}
}
private fun updateTagMuteState(muted: Boolean) {
if (muted) {
muteTagItem?.isVisible = false
muteTagItem?.isEnabled = false
unmuteTagItem?.isVisible = true
} else {
unmuteTagItem?.isVisible = false
muteTagItem?.isEnabled = true
muteTagItem?.isVisible = true
}
}
private fun muteTag(): Boolean {
val tag = hashtag ?: return true
lifecycleScope.launch {
var filterCreateSuccess = false
val hashedTag = "#$tag"
mastodonApi.createFilter(
title = "#$tag",
context = listOf(FilterV1.HOME),
filterAction = Filter.Action.WARN.action,
expiresInSeconds = null
).fold(
{ filter ->
if (mastodonApi.addFilterKeyword(
filterId = filter.id,
keyword = hashedTag,
wholeWord = true
).isSuccess
) {
// must be requested again; otherwise does not contain the keyword (but server does)
mutedFilter = mastodonApi.getFilter(filter.id).getOrNull()
// TODO the preference key here ("home") is not meaningful; should probably be another event if any
eventHub.dispatch(PreferenceChangedEvent(filter.context[0]))
filterCreateSuccess = true
} else {
Snackbar.make(
binding.root,
getString(R.string.error_muting_hashtag_format, tag),
Snackbar.LENGTH_SHORT
).show()
Log.e(TAG, "Failed to mute #$tag")
}
},
{ throwable ->
if (throwable.isHttpNotFound()) {
mastodonApi.createFilterV1(
hashedTag,
listOf(FilterV1.HOME),
irreversible = false,
wholeWord = true,
expiresInSeconds = null
).fold(
{ filter ->
mutedFilterV1 = filter
eventHub.dispatch(PreferenceChangedEvent(filter.context[0]))
filterCreateSuccess = true
},
Fix various lint warnings (#4409) - Remove empty file `ExampleInstrumentedTest.java`. - Replace deprecated `MigrationTestHelper` constructor call. - Add reified inline extension methods for `Bundle` and `Intent` to retrieve `Parcelable` and `Serializable` objects by calling the core `BundleCompat` and `IntentCompat` methods, to allow shorter syntax and removing the need to pass the class explicitly. - Replace deprecated `drawable.setColorFilter()` with simpler `drawable.setTint()` (uses blend mode `SRC_IN` by default, has the same effect as `SRC_ATOP` when the source is a color). - Rename shadowed variables (mostly caught exceptions). - Remove unnecessary `.orEmpty()` on non-null fields. - Replace `.size() == 0` with `.isEmpty()`. - Prevent `NullPointerException` when `account.getDisplayName()` is `null` in `StatusBaseViewHolder.setDisplayName()`. - Declare `customEmojis` argument as non-null in `StatusBaseViewHolder.setDisplayName()` because it calls `CustomEmojiHelper.emojify()` which now requires it to be non-null. - Prevent `NullPointerException` when no matching filter is found in `StatusBaseViewHolder.setupFilterPlaceholder()`. - Remove deprecated call to `setTargetFragment()` (target fragment is not used anyway). - Remove deprecated call to `isUserVisibleHint()` and test if the view has been destroyed instead. - Remove some unused imports. - Remove unnecessary casts. - Rename arguments to supertype names when a warning is shown. - Prevent a potential memory leak by clearing the `toolbarVisibilityDisposable` reference in `onDestroyView()`.
2024-05-05 08:34:41 +02:00
{ throwable2 ->
Snackbar.make(
binding.root,
getString(R.string.error_muting_hashtag_format, tag),
Snackbar.LENGTH_SHORT
).show()
Fix various lint warnings (#4409) - Remove empty file `ExampleInstrumentedTest.java`. - Replace deprecated `MigrationTestHelper` constructor call. - Add reified inline extension methods for `Bundle` and `Intent` to retrieve `Parcelable` and `Serializable` objects by calling the core `BundleCompat` and `IntentCompat` methods, to allow shorter syntax and removing the need to pass the class explicitly. - Replace deprecated `drawable.setColorFilter()` with simpler `drawable.setTint()` (uses blend mode `SRC_IN` by default, has the same effect as `SRC_ATOP` when the source is a color). - Rename shadowed variables (mostly caught exceptions). - Remove unnecessary `.orEmpty()` on non-null fields. - Replace `.size() == 0` with `.isEmpty()`. - Prevent `NullPointerException` when `account.getDisplayName()` is `null` in `StatusBaseViewHolder.setDisplayName()`. - Declare `customEmojis` argument as non-null in `StatusBaseViewHolder.setDisplayName()` because it calls `CustomEmojiHelper.emojify()` which now requires it to be non-null. - Prevent `NullPointerException` when no matching filter is found in `StatusBaseViewHolder.setupFilterPlaceholder()`. - Remove deprecated call to `setTargetFragment()` (target fragment is not used anyway). - Remove deprecated call to `isUserVisibleHint()` and test if the view has been destroyed instead. - Remove some unused imports. - Remove unnecessary casts. - Rename arguments to supertype names when a warning is shown. - Prevent a potential memory leak by clearing the `toolbarVisibilityDisposable` reference in `onDestroyView()`.
2024-05-05 08:34:41 +02:00
Log.e(TAG, "Failed to mute #$tag", throwable2)
}
)
} else {
Snackbar.make(
binding.root,
getString(R.string.error_muting_hashtag_format, tag),
Snackbar.LENGTH_SHORT
).show()
Log.e(TAG, "Failed to mute #$tag", throwable)
}
}
)
if (filterCreateSuccess) {
updateTagMuteState(true)
Snackbar.make(
binding.root,
getString(R.string.muting_hashtag_success_format, tag),
Snackbar.LENGTH_LONG
).apply {
setAction(R.string.action_view_filter) {
val intent = if (mutedFilter != null) {
Intent(this@StatusListActivity, EditFilterActivity::class.java).apply {
putExtra(EditFilterActivity.FILTER_TO_EDIT, mutedFilter)
}
} else {
Intent(this@StatusListActivity, FiltersActivity::class.java)
}
startActivityWithSlideInAnimation(intent)
}
show()
}
}
}
return true
}
private fun unmuteTag(): Boolean {
lifecycleScope.launch {
val tag = hashtag
val result = if (mutedFilter != null) {
val filter = mutedFilter!!
if (filter.context.size > 1) {
// This filter exists in multiple contexts, just remove the home context
mastodonApi.updateFilter(
id = filter.id,
context = filter.context.filter { it != Filter.Kind.HOME.kind }
)
} else {
mastodonApi.deleteFilter(filter.id)
}
} else if (mutedFilterV1 != null) {
mutedFilterV1?.let { filter ->
if (filter.context.size > 1) {
// This filter exists in multiple contexts, just remove the home context
mastodonApi.updateFilterV1(
id = filter.id,
phrase = filter.phrase,
context = filter.context.filter { it != FilterV1.HOME },
irreversible = null,
wholeWord = null,
expiresInSeconds = null
)
} else {
mastodonApi.deleteFilterV1(filter.id)
}
}
} else {
null
}
result?.fold(
{
updateTagMuteState(false)
eventHub.dispatch(PreferenceChangedEvent(Filter.Kind.HOME.kind))
mutedFilterV1 = null
mutedFilter = null
Snackbar.make(
binding.root,
getString(R.string.unmuting_hashtag_success_format, tag),
Snackbar.LENGTH_SHORT
).show()
},
{ throwable ->
Snackbar.make(
binding.root,
getString(R.string.error_unmuting_hashtag_format, tag),
Snackbar.LENGTH_SHORT
).show()
Log.e(TAG, "Failed to unmute #$tag", throwable)
}
)
}
return true
}
companion object {
private const val EXTRA_KIND = "kind"
private const val EXTRA_LIST_ID = "id"
private const val EXTRA_LIST_TITLE = "title"
private const val EXTRA_HASHTAG = "tag"
const val TAG = "StatusListActivity"
fun newFavouritesIntent(context: Context) =
Intent(context, StatusListActivity::class.java).apply {
putExtra(EXTRA_KIND, Kind.FAVOURITES.name)
}
fun newBookmarksIntent(context: Context) =
Intent(context, StatusListActivity::class.java).apply {
putExtra(EXTRA_KIND, Kind.BOOKMARKS.name)
}
fun newListIntent(context: Context, listId: String, listTitle: String) =
Intent(context, StatusListActivity::class.java).apply {
putExtra(EXTRA_KIND, Kind.LIST.name)
putExtra(EXTRA_LIST_ID, listId)
putExtra(EXTRA_LIST_TITLE, listTitle)
}
@JvmStatic
fun newHashtagIntent(context: Context, hashtag: String) =
Intent(context, StatusListActivity::class.java).apply {
putExtra(EXTRA_KIND, Kind.TAG.name)
putExtra(EXTRA_HASHTAG, hashtag)
}
fun newTrendingIntent(context: Context) =
Intent(context, StatusListActivity::class.java).apply {
putExtra(EXTRA_KIND, Kind.PUBLIC_TRENDING_STATUSES.name)
}
}
}