parent
682ccf2b56
commit
0612336e62
|
@ -46,7 +46,7 @@ fun Account.toParcelable(accountKey: UserKey, position: Long = 0): ParcelableUse
|
||||||
obj.key = getKey(accountKey.host)
|
obj.key = getKey(accountKey.host)
|
||||||
obj.created_at = createdAt?.time ?: -1
|
obj.created_at = createdAt?.time ?: -1
|
||||||
obj.is_protected = isLocked
|
obj.is_protected = isLocked
|
||||||
obj.name = displayName?.takeIf(String::isNotEmpty) ?: username
|
obj.name = name
|
||||||
obj.screen_name = username
|
obj.screen_name = username
|
||||||
if (note?.isHtml ?: false) {
|
if (note?.isHtml ?: false) {
|
||||||
val descriptionHtml = HtmlSpanBuilder.fromHtml(note, note)
|
val descriptionHtml = HtmlSpanBuilder.fromHtml(note, note)
|
||||||
|
@ -70,6 +70,8 @@ fun Account.toParcelable(accountKey: UserKey, position: Long = 0): ParcelableUse
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
val Account.host: String? get() = acct?.let(UserKey::valueOf)?.host
|
inline val Account.host: String? get() = acct?.let(UserKey::valueOf)?.host
|
||||||
|
|
||||||
|
inline val Account.name: String? get() = displayName?.takeIf(String::isNotEmpty) ?: username
|
||||||
|
|
||||||
fun Account.getKey(host: String?) = UserKey(id, acct?.let(UserKey::valueOf)?.host ?: host)
|
fun Account.getKey(host: String?) = UserKey(id, acct?.let(UserKey::valueOf)?.host ?: host)
|
|
@ -54,7 +54,7 @@ fun Status.toParcelable(accountKey: UserKey): ParcelableStatus {
|
||||||
result.retweet_id = retweetedStatus.id
|
result.retweet_id = retweetedStatus.id
|
||||||
result.retweet_timestamp = retweetedStatus.createdAt?.time ?: 0
|
result.retweet_timestamp = retweetedStatus.createdAt?.time ?: 0
|
||||||
result.retweeted_by_user_key = retweetAccount.getKey(accountKey.host)
|
result.retweeted_by_user_key = retweetAccount.getKey(accountKey.host)
|
||||||
result.retweeted_by_user_name = retweetAccount.displayName
|
result.retweeted_by_user_name = retweetAccount.name
|
||||||
result.retweeted_by_user_screen_name = retweetAccount.username
|
result.retweeted_by_user_screen_name = retweetAccount.username
|
||||||
result.retweeted_by_user_profile_image = retweetAccount.avatar
|
result.retweeted_by_user_profile_image = retweetAccount.avatar
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ fun Status.toParcelable(accountKey: UserKey): ParcelableStatus {
|
||||||
|
|
||||||
val account = status.account
|
val account = status.account
|
||||||
result.user_key = account.getKey(accountKey.host)
|
result.user_key = account.getKey(accountKey.host)
|
||||||
result.user_name = account.displayName
|
result.user_name = account.name
|
||||||
result.user_screen_name = account.username
|
result.user_screen_name = account.username
|
||||||
result.user_profile_image_url = account.avatar
|
result.user_profile_image_url = account.avatar
|
||||||
result.user_is_protected = account.isLocked
|
result.user_is_protected = account.isLocked
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package org.mariotaku.twidere.fragment.statuses
|
package org.mariotaku.twidere.fragment.statuses
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Rect
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.support.v4.content.Loader
|
import android.support.v4.content.Loader
|
||||||
import org.mariotaku.twidere.TwidereConstants.*
|
import org.mariotaku.twidere.TwidereConstants.*
|
||||||
|
@ -73,12 +72,8 @@ open class StatusesSearchFragment : ParcelableStatusesFragment() {
|
||||||
val tabPosition = args.getInt(EXTRA_TAB_POSITION, -1)
|
val tabPosition = args.getInt(EXTRA_TAB_POSITION, -1)
|
||||||
val makeGap = args.getBoolean(EXTRA_MAKE_GAP, true)
|
val makeGap = args.getBoolean(EXTRA_MAKE_GAP, true)
|
||||||
val loadingMore = args.getBoolean(EXTRA_LOADING_MORE, false)
|
val loadingMore = args.getBoolean(EXTRA_LOADING_MORE, false)
|
||||||
return TweetSearchLoader(activity, accountKey, query, adapterData, savedStatusesFileArgs, tabPosition, fromUser,
|
return TweetSearchLoader(activity, accountKey, query, adapterData, savedStatusesFileArgs,
|
||||||
makeGap, loadingMore)
|
tabPosition, fromUser, makeGap, loadingMore)
|
||||||
}
|
|
||||||
|
|
||||||
override fun fitSystemWindows(insets: Rect) {
|
|
||||||
super.fitSystemWindows(insets)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,9 +76,9 @@ open class MediaStatusesSearchLoader(
|
||||||
protected open fun processQuery(details: AccountDetails, query: String): String {
|
protected open fun processQuery(details: AccountDetails, query: String): String {
|
||||||
if (details.type == AccountType.TWITTER) {
|
if (details.type == AccountType.TWITTER) {
|
||||||
if (details.extras?.official ?: false) {
|
if (details.extras?.official ?: false) {
|
||||||
return TweetSearchLoader.smQuery(query, pagination)
|
return TweetSearchLoader.smQuery("$query filter:media", pagination)
|
||||||
}
|
}
|
||||||
return "$query exclude:retweets filter:media"
|
return "$query filter:media exclude:retweets"
|
||||||
}
|
}
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ class NetworkPublicTimelineLoader(
|
||||||
when (account.type) {
|
when (account.type) {
|
||||||
AccountType.MASTODON -> {
|
AccountType.MASTODON -> {
|
||||||
val mastodon = account.newMicroBlogInstance(context, Mastodon::class.java)
|
val mastodon = account.newMicroBlogInstance(context, Mastodon::class.java)
|
||||||
return mastodon.getPublicTimeline(paging, true).mapToPaginated {
|
return mastodon.getPublicTimeline(paging, false).mapToPaginated {
|
||||||
it.toParcelable(account)
|
it.toParcelable(account)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ open class TweetSearchLoader(
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
fun smQuery(query: String, pagination: Pagination?): String {
|
fun smQuery(query: String, pagination: Pagination?): String {
|
||||||
var universalQueryText = "$query filter:media"
|
var universalQueryText = query
|
||||||
|
|
||||||
if (pagination !is SinceMaxPagination) return universalQueryText
|
if (pagination !is SinceMaxPagination) return universalQueryText
|
||||||
pagination.maxId?.let { maxId ->
|
pagination.maxId?.let { maxId ->
|
||||||
|
|
Loading…
Reference in New Issue