improved user lookup (though still not perfect)
fixed #777 - this should really work!
This commit is contained in:
parent
cdf819fa0d
commit
a376c6f01d
|
@ -36,7 +36,7 @@ subprojects {
|
||||||
Kotlin : '1.1.1',
|
Kotlin : '1.1.1',
|
||||||
SupportLib : '25.3.1',
|
SupportLib : '25.3.1',
|
||||||
MariotakuCommons : '0.9.13',
|
MariotakuCommons : '0.9.13',
|
||||||
RestFu : '0.9.53',
|
RestFu : '0.9.54',
|
||||||
ObjectCursor : '0.9.16',
|
ObjectCursor : '0.9.16',
|
||||||
PlayServices : '10.2.1',
|
PlayServices : '10.2.1',
|
||||||
MapsUtils : '0.4.4',
|
MapsUtils : '0.4.4',
|
||||||
|
|
|
@ -37,11 +37,11 @@ public interface TimelinesResources {
|
||||||
|
|
||||||
@GET("/v1/timelines/public")
|
@GET("/v1/timelines/public")
|
||||||
LinkHeaderList<Status> getPublicTimeline(@Query Paging paging, @Query(value = "local",
|
LinkHeaderList<Status> getPublicTimeline(@Query Paging paging, @Query(value = "local",
|
||||||
booleanEncoding = BooleanEncoding.KEY_IF_TRUE) boolean local)
|
booleanEncoding = BooleanEncoding.IGNORE_IF_FALSE) boolean local)
|
||||||
throws MicroBlogException;
|
throws MicroBlogException;
|
||||||
|
|
||||||
@GET("/v1/timelines/tag/{tag}")
|
@GET("/v1/timelines/tag/{tag}")
|
||||||
LinkHeaderList<Status> getHashtagTimeline(@Path("tag") String hashtag, @Query Paging paging,
|
LinkHeaderList<Status> getHashtagTimeline(@Path("tag") String hashtag, @Query Paging paging,
|
||||||
@Query(value = "local", booleanEncoding = BooleanEncoding.KEY_IF_TRUE) boolean local)
|
@Query(value = "local", booleanEncoding = BooleanEncoding.IGNORE_IF_FALSE) boolean local)
|
||||||
throws MicroBlogException;
|
throws MicroBlogException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import java.util.List;
|
||||||
@ParcelablePlease
|
@ParcelablePlease
|
||||||
public class UserKey implements Comparable<UserKey>, Parcelable {
|
public class UserKey implements Comparable<UserKey>, Parcelable {
|
||||||
|
|
||||||
|
private static final String ID_PLACEHOLDER = "#placeholder";
|
||||||
public static final UserKey SELF = new UserKey("#self#", "#self#");
|
public static final UserKey SELF = new UserKey("#self#", "#self#");
|
||||||
public static final UserKey INVALID = new UserKey("#invalid#", "#invalid#");
|
public static final UserKey INVALID = new UserKey("#invalid#", "#invalid#");
|
||||||
|
|
||||||
|
|
|
@ -28,3 +28,7 @@ import org.mariotaku.twidere.model.UserKey
|
||||||
private const val mastodonPlaceholderId = "#mastodon*placeholder#"
|
private const val mastodonPlaceholderId = "#mastodon*placeholder#"
|
||||||
|
|
||||||
val UserKey.isMastodonPlaceholder get() = mastodonPlaceholderId == id && host != null
|
val UserKey.isMastodonPlaceholder get() = mastodonPlaceholderId == id && host != null
|
||||||
|
|
||||||
|
fun MastodonPlaceholderUserKey(host: String?): UserKey {
|
||||||
|
return UserKey(mastodonPlaceholderId, host)
|
||||||
|
}
|
|
@ -1393,11 +1393,21 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
||||||
|
|
||||||
override fun onLinkClick(link: String, orig: String?, accountKey: UserKey?,
|
override fun onLinkClick(link: String, orig: String?, accountKey: UserKey?,
|
||||||
extraId: Long, type: Int, sensitive: Boolean, start: Int, end: Int): Boolean {
|
extraId: Long, type: Int, sensitive: Boolean, start: Int, end: Int): Boolean {
|
||||||
val current = getCurrentMedia(link, extraId.toInt())
|
val position = extraId.toInt()
|
||||||
|
val current = getCurrentMedia(link, position)
|
||||||
if (current != null && !current.open_browser) {
|
if (current != null && !current.open_browser) {
|
||||||
expandOrOpenMedia(current)
|
expandOrOpenMedia(current)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
when (type) {
|
||||||
|
TwidereLinkify.LINK_TYPE_MENTION -> {
|
||||||
|
val status = adapter.getStatus(position)
|
||||||
|
val userKey = MastodonPlaceholderUserKey(status.user_key.host ?: accountKey?.host)
|
||||||
|
IntentUtils.openUserProfile(context, accountKey, userKey, link, null,
|
||||||
|
preferences[newDocumentApiKey], Referral.USER_MENTION, null)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
return super.onLinkClick(link, orig, accountKey, extraId, type, sensitive, start, end)
|
return super.onLinkClick(link, orig, accountKey, extraId, type, sensitive, start, end)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue