Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Share button & Gradle Kotlin DSL #23

Merged
merged 4 commits into from
May 26, 2020

Conversation

naufalprakoso
Copy link
Contributor

Features:

  • Adding Share button in PostsDetailActivity
  • Implement Gradle Kotlin DSL

Copy link
Owner

@PatilShreyas PatilShreyas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naufalprakoso Thanks for this PR and your contribution. Before merging it here are few comments. If you fix these then I'll be happy to merge it.

@@ -37,6 +41,8 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
@ExperimentalCoroutinesApi
class PostDetailsActivity : BaseActivity<PostDetailsViewModel, ActivityPostDetailsBinding>() {

private var getPost: Post? = null
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of name getPost please rename it to post Also, make it private lateinit var.

Comment on lines 94 to 104
if (getPost != null) {
val post = getPost!!
val shareMsg = """
"${post.title}" by ${post.author} on Foodium App
""".trimIndent()

val intent = Intent()
intent.action = Intent.ACTION_SEND
intent.putExtra(Intent.EXTRA_TEXT, shareMsg)
intent.type = "text/plain"
startActivity(Intent.createChooser(intent, "Share to:"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use ShareCompat class which is recommended by Android officials for such use case. Here's the reference: https://medium.com/androiddevelopers/sharing-content-between-android-apps-2e6db9d1368b

@naufalprakoso
Copy link
Contributor Author

Thank you for the suggestion @PatilShreyas , I already changed it. Please check my PR again 😁

Copy link
Owner

@PatilShreyas PatilShreyas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment - Can you put this companion object at the end of class?

@naufalprakoso
Copy link
Contributor Author

Sure, I already move it to the end of class @PatilShreyas

@PatilShreyas
Copy link
Owner

Great! LGTM. Merging it.

@PatilShreyas PatilShreyas merged commit 459d928 into PatilShreyas:master May 26, 2020
@naufalprakoso
Copy link
Contributor Author

Thank you @PatilShreyas 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants