|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
package io.legado.app.ui.rss.read |
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint |
|
|
|
|
import android.content.Intent |
|
|
|
|
import android.os.Bundle |
|
|
|
|
import android.view.KeyEvent |
|
|
|
|
import android.view.Menu |
|
|
|
@ -15,6 +16,7 @@ import io.legado.app.lib.theme.primaryTextColor |
|
|
|
|
import io.legado.app.utils.NetworkUtils |
|
|
|
|
import io.legado.app.utils.getViewModel |
|
|
|
|
import kotlinx.android.synthetic.main.activity_rss_read.* |
|
|
|
|
import org.jetbrains.anko.toast |
|
|
|
|
|
|
|
|
|
class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_read), |
|
|
|
|
ReadRssViewModel.CallBack { |
|
|
|
@ -42,6 +44,9 @@ class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_r |
|
|
|
|
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean { |
|
|
|
|
when (item.itemId) { |
|
|
|
|
R.id.menu_rss_star -> viewModel.star() |
|
|
|
|
R.id.menu_share_it -> viewModel.rssArticle?.let { |
|
|
|
|
shareText("链接分享", it.link) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return super.onCompatOptionsItemSelected(item) |
|
|
|
|
} |
|
|
|
@ -115,4 +120,15 @@ class ReadRssActivity : VMBaseActivity<ReadRssViewModel>(R.layout.activity_rss_r |
|
|
|
|
} |
|
|
|
|
return super.onKeyUp(keyCode, event) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun shareText(title: String, text: String) { |
|
|
|
|
try { |
|
|
|
|
val textIntent = Intent(Intent.ACTION_SEND) |
|
|
|
|
textIntent.type = "text/plain" |
|
|
|
|
textIntent.putExtra(Intent.EXTRA_TEXT, text) |
|
|
|
|
startActivity(Intent.createChooser(textIntent, title)) |
|
|
|
|
} catch (e: Exception) { |
|
|
|
|
toast(R.string.can_not_share) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |