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

Favorite session date text #574

Merged
merged 13 commits into from
Feb 9, 2020

Conversation

CaptainPAG
Copy link
Contributor

@CaptainPAG CaptainPAG commented Jan 24, 2020

Issue

Overview (Required)

  • Add date text only favorite session list

Screenshot

Before After


// session time text
var sessionTimeTextPositionY =
(view.top + sessionTimeTextMarginTop.toInt() - sessionTimeTextMarginTopInPx.toInt()).coerceAtLeast(
Copy link
Collaborator

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)

@CaptainPAG CaptainPAG changed the title WIP: Favorite session date text Favorite session date text Jan 24, 2020
Copy link
Contributor

@jmatsu jmatsu left a 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
Copy link
Contributor

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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The following looks clearer.

Suggested change
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") }
Copy link
Contributor

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(
Copy link
Contributor

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(
Copy link
Contributor

Choose a reason for hiding this comment

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

Great work. 👀

Copy link
Contributor

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.

@takahirom
Copy link
Member

@CaptainPAG If you have any questions. Please tell me 🙏

FujiKinaga added 2 commits February 9, 2020 19:52
…to favorite-session-date-text

# Conflicts:
#	feature/session/src/main/java/io/github/droidkaigi/confsched2020/session/ui/item/SessionItem.kt
@FujiKinaga
Copy link
Contributor

@CaptainPAG
I work on this PR to release this feature!😄
Thank you for your contribution!

currentSessionItem.startSessionDate() == lastSessionItem.startSessionDate()
return when {
isSameDateWithLastItem -> false
else -> true
Copy link
Contributor

Choose a reason for hiding this comment

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

When multiple same time's favorite session has, date time text will dismiss on scrolling one item height in this code.😭
But, I was not be able to fix this problem. I'll issue for the problem once.
fps_30

@jmatsu-bot
Copy link
Collaborator

Your apk has been deployed to https://deploygate.com/distributions/621a358cc169f3b59aa946169198df451f816df3. Anyone can try your changes via the link.

Generated by 🚫 Danger

@jmatsu-bot
Copy link
Collaborator

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
Copy link
Member

Choose a reason for hiding this comment

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

👍

@takahirom
Copy link
Member

LGTM 👍

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.

5 participants