-
Notifications
You must be signed in to change notification settings - Fork 332
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 to the Session Detail Screen #578
Changes from 7 commits
a00a6bd
0d6d219
191413e
9fbb272
89b820a
98481e4
324727f
5c94e62
ebcfd93
29aad61
640c400
ae95383
4ba453f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package io.github.droidkaigi.confsched2018.presentation.detail | |
|
||
import android.arch.lifecycle.ViewModelProvider | ||
import android.arch.lifecycle.ViewModelProviders | ||
import android.content.Intent | ||
import android.graphics.drawable.Animatable | ||
import android.os.Bundle | ||
import android.support.v4.app.Fragment | ||
|
@@ -52,7 +53,7 @@ class SessionDetailFragment : Fragment(), Injectable { | |
is Result.Success -> { | ||
val sessions = result.data | ||
val position = sessions.indexOfFirst { it.id == sessionId } | ||
bindSession(sessions[position]) | ||
bindSession(sessions[position], sessionId) | ||
setSessionIndicator(sessions.getOrNull(position - 1), | ||
sessions.getOrNull(position + 1)) | ||
} | ||
|
@@ -77,13 +78,29 @@ class SessionDetailFragment : Fragment(), Injectable { | |
binding.toolbar.setNavigationOnClickListener { activity?.finish() } | ||
} | ||
|
||
private fun bindSession(session: Session.SpeechSession) { | ||
private fun bindSession(session: Session.SpeechSession, sessionId: String) { | ||
binding.session = session | ||
binding.fab.setOnClickListener { | ||
updateDrawable() | ||
sessionDetailViewModel.onFavoriteClick(session) | ||
sessionAlarm.toggleRegister(session) | ||
} | ||
binding.fabShare.setOnClickListener { | ||
val shareIntent = Intent(Intent.ACTION_SEND).apply { | ||
type = "text/plain" | ||
var speakerList = listOf<String>() | ||
session.speakers.forEach { speakerList += it.name } | ||
val speakers = speakerList.joinToString(", ") | ||
val title = resources.getString(R.string.session_share_title, | ||
session.title, | ||
session.room.name, | ||
speakers) | ||
val url = resources.getString(R.string.session_share_url, sessionId) | ||
putExtra(Intent.EXTRA_TEXT, "$title\n$url") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. example
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Q] Should I add a hashtag or any text? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please wait. I will talk with staff🙏 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The staff has decided to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🙏 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added e.g.
|
||
} | ||
startActivity(Intent.createChooser(shareIntent, | ||
resources.getString(R.string.session_share_via))) | ||
} | ||
binding.sessionTopic.text = session.topic.getNameByLang(lang()) | ||
val levelDrawable = binding.context.drawable(when (session.level) { | ||
is Level.Beginner -> R.drawable.ic_beginner_lightgreen_20dp | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24.0" | ||
android:viewportHeight="24.0"> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/> | ||
</vector> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,9 @@ | |
<string name="session_finished">Finished Session</string> | ||
<string name="session_go_to_feedback">Go To Feedback</string> | ||
<string name="session_current_badge" translatable="false">NOW!</string> | ||
<string name="session_share_url" translatable="false">https://droidkaigi.jp/2018/timetable?session=%s</string> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for |
||
<string name="session_share_title" translatable="false">%1$s at %2$s by %3$s</string> | ||
<string name="session_share_via">Share via</string> | ||
|
||
<!-- Session detail --> | ||
<string name="detail_sessions_next">Next</string> | ||
|
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.
I think you can get sessionId by
session.id
.What do you think? 👀
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.
Oops, I'll fix