-
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
Create Shared Elements Transition from All/RoomSessionsFragment to SessionDetailFragment #564
Open
e10dokup
wants to merge
6
commits into
DroidKaigi:master
Choose a base branch
from
e10dokup:feature/450_session_transition
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2b78515
Create transition
e10dokup ed971ba
Fix missing transition
e10dokup dfe03a6
Set Shared element on other sessions fragments
e10dokup 17d0220
Remove unnecessary properties / move SharedElementCallback to anonymo…
e10dokup 3109dca
Add id to SpeakersSummaryLayout on item_horizontal_session for avoid …
e10dokup 0d2d648
Fix danger issue
e10dokup File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -1,10 +1,14 @@ | ||||
package io.github.droidkaigi.confsched2018.presentation.detail | ||||
|
||||
import android.annotation.TargetApi | ||||
import android.arch.lifecycle.ViewModelProvider | ||||
import android.arch.lifecycle.ViewModelProviders | ||||
import android.graphics.drawable.Animatable | ||||
import android.os.Build | ||||
import android.os.Bundle | ||||
import android.support.v4.app.Fragment | ||||
import android.support.v4.view.ViewCompat | ||||
import android.text.TextUtils | ||||
import android.view.LayoutInflater | ||||
import android.view.View | ||||
import android.view.ViewGroup | ||||
|
@@ -16,6 +20,7 @@ import io.github.droidkaigi.confsched2018.model.Session | |||
import io.github.droidkaigi.confsched2018.presentation.NavigationController | ||||
import io.github.droidkaigi.confsched2018.presentation.Result | ||||
import io.github.droidkaigi.confsched2018.util.SessionAlarm | ||||
import io.github.droidkaigi.confsched2018.util.ext.addOnetimeOnPreDrawListener | ||||
import io.github.droidkaigi.confsched2018.util.ext.context | ||||
import io.github.droidkaigi.confsched2018.util.ext.drawable | ||||
import io.github.droidkaigi.confsched2018.util.ext.observe | ||||
|
@@ -75,6 +80,16 @@ class SessionDetailFragment : Fragment(), Injectable { | |||
} | ||||
|
||||
binding.toolbar.setNavigationOnClickListener { activity?.finish() } | ||||
|
||||
val firstSessionId = (activity as? SessionDetailActivity)?.firstSessionId ?: return | ||||
val transitionName = arguments!!.getString(EXTRA_TRANSITION_NAME) | ||||
|
||||
if (!TextUtils.isEmpty(transitionName) | ||||
&& firstSessionId == transitionName | ||||
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||||
initViewTransitions(view) | ||||
} | ||||
|
||||
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.
|
||||
} | ||||
|
||||
private fun bindSession(session: Session.SpeechSession) { | ||||
|
@@ -110,17 +125,41 @@ class SessionDetailFragment : Fragment(), Injectable { | |||
binding.nextSession = nextSession | ||||
} | ||||
|
||||
fun hideButton() { | ||||
binding.fab.visibility = View.INVISIBLE | ||||
} | ||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP) | ||||
private fun initViewTransitions(view: View) { | ||||
binding.speakerSummary.addOnetimeOnPreDrawListener { | ||||
ViewCompat.setTransitionName( | ||||
view.findViewById<View>(R.id.speaker_summary), | ||||
arguments!!.getString(EXTRA_TRANSITION_NAME)) | ||||
activity?.supportStartPostponedEnterTransition() | ||||
} | ||||
} | ||||
|
||||
interface OnClickBottomAreaListener { | ||||
fun onClickPrevSession() | ||||
fun onClickNextSession() | ||||
} | ||||
|
||||
companion object { | ||||
const val EXTRA_SESSION_ID = "EXTRA_SESSION_ID" | ||||
const val EXTRA_TRANSITION_NAME = "EXTRA_TRANSITION_NAME" | ||||
|
||||
fun newInstance(sessionId: String): SessionDetailFragment = SessionDetailFragment().apply { | ||||
arguments = Bundle().apply { | ||||
putString(EXTRA_SESSION_ID, sessionId) | ||||
} | ||||
} | ||||
|
||||
fun newInstance(sessionId: String, transitionName: String): SessionDetailFragment = | ||||
SessionDetailFragment().apply { | ||||
arguments = Bundle().apply { | ||||
putString(EXTRA_SESSION_ID, sessionId) | ||||
putString(EXTRA_TRANSITION_NAME, transitionName) | ||||
} | ||||
} | ||||
} | ||||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.