-
Notifications
You must be signed in to change notification settings - Fork 326
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
Favorite session date text #574
Favorite session date text #574
Conversation
|
||
// session time text | ||
var sessionTimeTextPositionY = | ||
(view.top + sessionTimeTextMarginTop.toInt() - sessionTimeTextMarginTopInPx.toInt()).coerceAtLeast( |
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.
🚫 | Exceeded max line length (100) (cannot be auto-corrected) |
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.
Thank you! I commented on several reviews. Could you please have a look?
@@ -15,14 +15,15 @@ import io.github.droidkaigi.confsched2020.util.AndroidRAttr | |||
|
|||
class SessionsItemDecoration( | |||
private val adapter: GroupAdapter<*>, | |||
private val context: Context | |||
private val context: Context, | |||
private val isShowDate: Boolean |
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.
isShowDate
looks ambiguous because it's shadowed due to here and isShowDateText
is also defined.
How about visibleSessionDate
for here?
@@ -44,7 +48,14 @@ class SessionsItemDecoration( | |||
if (position == RecyclerView.NO_POSITION) return | |||
|
|||
val sessionItem = adapter.getItem(position) as SessionItem | |||
val startTimeText = calcTimeText(position, view) | |||
val isShowDateText = if (position > 0) { |
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.
The following looks clearer.
val isShowDateText = if (position > 0) { | |
val shouldShowDateText = visibleSessionDate && if (position > 0) { |
@@ -14,7 +14,7 @@ sealed class Session( | |||
open val room: Room, | |||
open val isFavorited: Boolean | |||
) { | |||
val startDayText by lazy { startTime.toOffset(defaultTimeZoneOffset()).format("yyyy.M.d") } | |||
val startDayText by lazy { startTime.toOffset(defaultTimeZoneOffset()).format("M/d") } |
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.
Make sense 😄
val startTimeText: StartTimeText | ||
) | ||
|
||
private data class DateText( |
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.
Is this almost the same class as StartTimeText
? then it would be enough to have only one class like PositionalText
.
textPaint | ||
) | ||
} | ||
} | ||
|
||
private fun calcTimeText(position: Int, view: View): StartTimeText { | ||
private fun calcDateTimeText( |
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.
Great work. 👀
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 felt it would be nicer if this method could be split into calcTimeText
and calcDateText
with offset calculation when I glanced, but it would be kinda heavy work. So it's okay but we are welcoming additional improvements anytime.
@CaptainPAG If you have any questions. Please tell me 🙏 |
…to favorite-session-date-text
…to favorite-session-date-text # Conflicts: # feature/session/src/main/java/io/github/droidkaigi/confsched2020/session/ui/item/SessionItem.kt
@CaptainPAG |
currentSessionItem.startSessionDate() == lastSessionItem.startSessionDate() | ||
return when { | ||
isSameDateWithLastItem -> false | ||
else -> true |
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.
Your apk has been deployed to https://deploygate.com/distributions/621a358cc169f3b59aa946169198df451f816df3. Anyone can try your changes via the link. Generated by 🚫 Danger |
No issue was reported. Cool! Generated by 🚫 Danger |
@@ -26,6 +26,8 @@ sealed class SessionPage : AndroidParcel { | |||
|
|||
abstract val title: String | |||
|
|||
fun visibleSessionDate() = this is Event || this is Favorite |
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.
👍
LGTM 👍 |
Issue
Overview (Required)
Screenshot