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
buildscript { | |
ext.kotlin_version = '1.3.0' | |
ext.support_library_version = '27.1.1' | |
... | |
} | |
... |
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
dependencies { | |
implementation project(path: ':common') | |
implementation project(path: ':api') | |
implementation project(path: ':onboarding') | |
... | |
} |
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
org.gradle.parallel=true |
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
sealed class Transition { | |
class WhatIsToEnter : Transition() | |
class EnterToCreation : Transition() | |
class EnterToJoining : Transition() | |
class Joining2WaitForConfirmation : Transition() | |
} |
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
override fun navigate(transition: Transition) { | |
val actionId = when (transition) { | |
is Transition.WhatIsToEnter -> R.id.action_whatIsLoftFragment_to_enterLoftFragment | |
is Transition.EnterToCreation -> R.id.action_enterLoftFragment_to_creationFragment | |
is Transition.EnterToJoining -> R.id.action_enterLoftFragment_to_joiningFragment | |
is Transition.Joining2WaitForConfirmation -> | |
R.id.action_joiningFragment_to_waitForConfirmationFragment | |
} | |
findNavController(R.id.nav_host_fragment).navigate(actionId) | |
} |
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
class SomethingActivity extends AppCompatActivity { | |
@Override | |
void onCreate() { | |
super.onCreate(); | |
setContentView(R.layout.activity_something); | |
} | |
@Override | |
void onResume() { | |
retrofitService.someApiEndpoint().enqueue(this); |
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
class SomeAdapter( | |
val factory1: ViewHolderFactory1, | |
val factory2: ViewHOlderFactory2 | |
): RecyclerView.Adapter<RecyclerView.ViewHolder>() { | |
override fun getItemViewType(position: Int) = if (position == 0) 1 else 2 | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = when (viewType) { | |
1 -> factory1.createViewHolder(parent) | |
2 -> factory2.createViewHolder(parent) | |
else -> error("This should not be possible") |
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
interface ViewHolderFactory { | |
fun createViewHolder(parent: ViewGroup, onClick: () -> Unit): ViewHolder | |
} | |
class ViewHolderFactoryImpl1 : ViewHolderFactory { | |
override fun createViewHolder(parent: ViewGroup, onClick: () -> Unit): ViewHolder = TODO("") | |
} | |
class ViewHolderFactoryImpl2 : ViewHolderFactory { | |
override fun createViewHolder(parent: ViewGroup, onClick: () -> Unit): ViewHolder = TODO("") |
OlderNewer