-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce experimental ConcurrentPairNavigator
- Loading branch information
Showing
32 changed files
with
2,916 additions
and
12 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
**.log | ||
|
||
*.orig | ||
*.attach_* | ||
|
||
.idea/assetWizardSettings.xml | ||
.idea/caches/* | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
...xperimental/src/main/java/com/nhaarman/acorn/navigation/experimental/CombinedContainer.kt
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2018 Niek Haarman | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.nhaarman.acorn.navigation.experimental | ||
|
||
import com.nhaarman.acorn.presentation.Container | ||
import com.nhaarman.acorn.presentation.RestorableContainer | ||
|
||
/** | ||
* A [Container] that combines two Containers into one. | ||
* | ||
* This interface is used in conjunction with [ConcurrentPairNavigator]. | ||
*/ | ||
@ExperimentalConcurrentPairNavigator | ||
interface CombinedContainer : RestorableContainer { | ||
|
||
val firstContainer: Container | ||
val secondContainer: Container | ||
} |
58 changes: 58 additions & 0 deletions
58
...rn-experimental/src/main/java/com/nhaarman/acorn/navigation/experimental/CombinedScene.kt
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2018 Niek Haarman | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.nhaarman.acorn.navigation.experimental | ||
|
||
import com.nhaarman.acorn.presentation.Container | ||
import com.nhaarman.acorn.presentation.Scene | ||
import com.nhaarman.acorn.presentation.SceneKey | ||
|
||
/** | ||
* A [Scene] that combines two Scenes into one. | ||
* The key of this Scene is taken from [secondScene]. | ||
* | ||
* This class is used in conjunction with [ConcurrentPairNavigator]. | ||
*/ | ||
@ExperimentalConcurrentPairNavigator | ||
class CombinedScene( | ||
val firstScene: Scene<out Container>, | ||
val secondScene: Scene<out Container> | ||
) : Scene<CombinedContainer> { | ||
|
||
override val key: SceneKey | ||
get() = secondScene.key | ||
|
||
override fun onStart() { | ||
} | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
override fun attach(v: CombinedContainer) { | ||
(firstScene as Scene<Container>).attach(v.firstContainer) | ||
(secondScene as Scene<Container>).attach(v.secondContainer) | ||
} | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
override fun detach(v: CombinedContainer) { | ||
(secondScene as Scene<Container>).detach(v.secondContainer) | ||
(firstScene as Scene<Container>).detach(v.firstContainer) | ||
} | ||
|
||
override fun onStop() { | ||
} | ||
|
||
override fun onDestroy() { | ||
} | ||
} |
Oops, something went wrong.