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

Create Shared Elements Transition from All/RoomSessionsFragment to SessionDetailFragment #564

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

e10dokup
Copy link
Contributor

@e10dokup e10dokup commented Feb 3, 2018

Issue

Overview (Required)

  • Create Shared Elements Transition
    • All/RoomSessionsFragment to SessionDetailFragment
    • SpeakersSummaryLayout will be set to Shared Element

(以下日本語で失礼します)

SessionDetailFrgamentからAll/RoomSessionsFragmentへの戻りのTransactionを実装したかったのですが、SessionDetailActivityのViewPagerに入るSessionDetailFragmentのSessionが全セッションとなっているため、RoomSessionsFragmentとリストの整合性がうまく取れず綺麗に遷移できなかったため、現状は戻りに関してはアニメーションをしないようにしています…。

Links

Screenshot

Before After

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setEnterSharedElementCallback(sharedElementCallback)
}

Choose a reason for hiding this comment

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

⚠️ Unexpected blank line(s) before “}”

@@ -83,9 +121,11 @@ class SessionDetailActivity :
}
}


Choose a reason for hiding this comment

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

⚠️ Needless blank line(s)

fun findFragmentByPosition(viewPager: ViewPager, position: Int): SessionDetailFragment {
return instantiateItem(viewPager, position) as SessionDetailFragment
}

Choose a reason for hiding this comment

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

⚠️ Unexpected blank line(s) before “}”

fun start(context: Context, session: Session) {
context.startActivity(createIntent(context, session.id))
}

fun start(activity: Activity, session: Session, sharedElement: Pair<View, String>) {
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElement)

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)

putExtra(EXTRA_TRANSITION_NAME, sharedElement.second)
}
}

Choose a reason for hiding this comment

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

⚠️ Unexpected blank line(s) before “}”

@takahirom
Copy link
Member

👀

@@ -32,6 +40,8 @@ class SessionDetailActivity :
@Inject lateinit var viewModelFactory: ViewModelProvider.Factory
@Inject lateinit var drawerMenu: DrawerMenu

private var backPressed = false
Copy link
Member

Choose a reason for hiding this comment

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

Please comment why this need 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it will not be needed..., I will remove this on next commit. Thanks.

@@ -75,6 +83,26 @@ class SessionDetailFragment : Fragment(), Injectable {
}

binding.toolbar.setNavigationOnClickListener { activity?.finish() }

binding.speakerSummary.viewTreeObserver.addOnPreDrawListener(
Copy link
Member

@takahirom takahirom Feb 3, 2018

Choose a reason for hiding this comment

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

}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private val sharedElementCallback = object : SharedElementCallback() {
Copy link
Member

@takahirom takahirom Feb 3, 2018

Choose a reason for hiding this comment

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

I have a question 🙋
SharedElementCallback is not contained API Level 19.
Is this not crash on API Level 19?

@@ -75,6 +83,26 @@ class SessionDetailFragment : Fragment(), Injectable {
}

binding.toolbar.setNavigationOnClickListener { activity?.finish() }

binding.speakerSummary.viewTreeObserver.addOnPreDrawListener(
Copy link
Member

Choose a reason for hiding this comment

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

@@ -34,6 +39,9 @@ class SessionDetailFragment : Fragment(), Injectable {
ViewModelProviders.of(activity!!, viewModelFactory).get(SessionDetailViewModel::class.java)
}

val speakerSummary: SpeakersSummaryLayout
Copy link
Collaborator

Choose a reason for hiding this comment

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

[nits] Do you use this property?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I forgot to remove this property..., I will remove on next commit.

@e10dokup e10dokup force-pushed the feature/450_session_transition branch from ceddbbe to f0b84f5 Compare February 4, 2018 04:23
@e10dokup e10dokup force-pushed the feature/450_session_transition branch from f0b84f5 to 1d73ffe Compare February 4, 2018 04:28
@e10dokup
Copy link
Contributor Author

e10dokup commented Feb 4, 2018

@takahirom @rkowase Thanks for your reviews! I added fix commits to respond your comments.

@e10dokup e10dokup force-pushed the feature/450_session_transition branch from e73e923 to dd9b57c Compare February 4, 2018 04:34
@e10dokup e10dokup force-pushed the feature/450_session_transition branch from dd9b57c to 17d0220 Compare February 4, 2018 04:35
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
initViewTransitions(view)
}

Choose a reason for hiding this comment

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

⚠️ Unexpected blank line(s) before “}”

@takahirom
Copy link
Member

I'm sorry.
I am thinking about this PR. 🤔

@e10dokup
Copy link
Contributor Author

e10dokup commented Feb 5, 2018

@takahirom Thanks. I'm sorry I create poor PR...

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