-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
.
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:")) |
There was a problem hiding this comment.
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
Thank you for the suggestion @PatilShreyas , I already changed it. Please check my PR again 😁 |
There was a problem hiding this 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?
Foodium/app/src/main/java/dev/shreyaspatil/foodium/ui/details/PostDetailsActivity.kt
Line 78 in 5f2a4a8
const val POST_ID = "postId" |
Sure, I already move it to the end of class @PatilShreyas |
Great! LGTM. Merging it. |
Thank you @PatilShreyas 🎉 |
Features: