aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusDetailDialogFragment.kt
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-10-22 23:12:44 +0900
committerKazuki Yamaguchi <k@rhe.jp>2017-10-22 23:12:44 +0900
commit0b16b186751aca2a6000e5bc949e8511b91c0dfd (patch)
treef5d0a56a7292591c173031eda19a61a52ec12533 /app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusDetailDialogFragment.kt
parent565d3ddf03098be859594f2d6c3ca452c7738d4f (diff)
downloadSmileEssence-0b16b186751aca2a6000e5bc949e8511b91c0dfd.tar.gz
data simplification
Diffstat (limited to 'app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusDetailDialogFragment.kt')
-rw-r--r--app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusDetailDialogFragment.kt22
1 files changed, 11 insertions, 11 deletions
diff --git a/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusDetailDialogFragment.kt b/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusDetailDialogFragment.kt
index 5fb37ced..9e589176 100644
--- a/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusDetailDialogFragment.kt
+++ b/app/src/main/java/net/lacolaco/smileessence/view/dialog/StatusDetailDialogFragment.kt
@@ -39,8 +39,8 @@ class StatusDetailDialogFragment : StackableDialogFragment() {
statusHeader.isClickable = false
// XXX
- view.button_status_detail_favorite.isActivated = tweet.isFavoritedBy(world.id)
- view.button_status_detail_retweet.isActivated = tweet.isRetweetedBy(world.id)
+ view.button_status_detail_favorite.isActivated = world.id in tweet.favoriters
+ view.button_status_detail_retweet.isActivated = world.id in tweet.retweets
updateViewButtons(view)
setupViewMenu(view)
@@ -74,7 +74,7 @@ class StatusDetailDialogFragment : StackableDialogFragment() {
val builder = StringBuilder()
builder.append("@${originalTweet.user.screenName} ")
- for (screenName in originalTweet.mentions) {
+ for (screenName in originalTweet.entities.mentions) {
if (screenName != world.user.screenName)
builder.append("@$screenName ")
}
@@ -85,10 +85,10 @@ class StatusDetailDialogFragment : StackableDialogFragment() {
}
view.button_status_detail_retweet.setOnClickListener {
confirm(R.string.dialog_confirm_commands) {
- if (tweet.isRetweetedBy(world.id)) {
+ if (world.id in tweet.retweets) {
launchUi {
try {
- world.deleteTweetAsync(tweet.getRetweetIdBy(world.id)).await()
+ world.deleteTweetAsync(tweet.retweets[world.id]!!).await()
world.notify(R.string.notice_status_delete_succeeded)
updateViewButtons(view)
} catch (e: TwitterTaskException) {
@@ -109,7 +109,7 @@ class StatusDetailDialogFragment : StackableDialogFragment() {
}
}
view.button_status_detail_favorite.setOnClickListener {
- val favoriting = !tweet.isFavoritedBy(world.id)
+ val favoriting = world.id !in tweet.favoriters
launchUi {
try {
@@ -153,14 +153,14 @@ class StatusDetailDialogFragment : StackableDialogFragment() {
world.notify(R.string.notice_add_to_reply)
}
popup.add(R.string.command_status_open_in_browser) {
- browse(tweet.originalTweet.twitterUrl)
+ browse("https://twitter.com/${tweet.originalTweet.user.screenName}/status/${tweet.originalTweet.id}")
}
popup.add(R.string.command_status_copy_text_to_clipboard) {
SystemServiceHelper.copyToClipboard(activity, "tweet text", tweet.originalTweet.text)
world.notify(R.string.notice_copy_clipboard)
}
popup.add(R.string.command_status_copy_url_to_clipboard) {
- SystemServiceHelper.copyToClipboard(activity, "tweet url", tweet.originalTweet.twitterUrl)
+ SystemServiceHelper.copyToClipboard(activity, "tweet url", "https://twitter.com/${tweet.originalTweet.user.screenName}/status/${tweet.originalTweet.id}")
world.notify(R.string.notice_copy_clipboard)
}
popup.show()
@@ -171,7 +171,7 @@ class StatusDetailDialogFragment : StackableDialogFragment() {
val users = mutableListOf<String>()
if (tweet.user !== tweet.originalTweet.user)
users += tweet.user.screenName
- users += tweet.mentions
+ users += tweet.entities.mentions
for (screenName in users.distinct())
view.embedded_menu_items.add("@$screenName") {
val ref = ref(activity as MainActivity)
@@ -184,12 +184,12 @@ class StatusDetailDialogFragment : StackableDialogFragment() {
}
}
}
- for (hashtag in tweet.hashtags)
+ for (hashtag in tweet.entities.hashtags)
view.embedded_menu_items.add("#$hashtag") {
// XXX
(activity as MainActivity).openPostPageAndAppendText(" #$hashtag")
}
- for (url in tweet.urlsExpanded + tweet.mediaUrls)
+ for (url in tweet.entities.urlsExpanded + tweet.entities.mediaUrls)
view.embedded_menu_items.add(url) {
activity.browse(url)
}