-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
alenafedyakshina
committed
Oct 10, 2023
1 parent
5c833c1
commit 32c67c3
Showing
5 changed files
with
61 additions
and
5 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...igation/android/src/main/kotlin/com/bumble/appyx/navigation/node/viewModel/MyViewModel.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
2 changes: 1 addition & 1 deletion
2
.../ActivityIntegrationPointWithViewModel.kt → .../ActivityIntegrationPointWithViewModel.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
2 changes: 1 addition & 1 deletion
2
...ls/viewmodel/IntegrationPointViewModel.kt → .../integration/IntegrationPointViewModel.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
56 changes: 56 additions & 0 deletions
56
...oid/src/main/kotlin/com/bumble/appyx/utils/viewmodel/integration/ViewModelNodeActivity.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,56 @@ | ||
package com.bumble.appyx.utils.viewmodel.integration | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.bumble.appyx.navigation.integrationpoint.IntegrationPointProvider | ||
|
||
/** | ||
* Helper class for root [Node] integration into projects using [AppCompatActivity]. | ||
* | ||
* See [NodeComponentActivity] for building upon [ComponentActivity]. | ||
* | ||
* Also offers base functionality to satisfy dependencies of Android-related functionality | ||
* down the tree via [appyxV2IntegrationPoint]: | ||
* - [ActivityStarter] | ||
* - [PermissionRequester] | ||
* | ||
* Feel free to not extend this and use your own integration point - in this case, | ||
* don't forget to take a look here what methods needs to be forwarded to the root Node. | ||
*/ | ||
open class ViewModelNodeActivity : AppCompatActivity(), IntegrationPointProvider { | ||
|
||
override lateinit var appyxV2IntegrationPoint: ActivityIntegrationPointWithViewModel | ||
protected set | ||
|
||
protected open fun createIntegrationPoint(savedInstanceState: Bundle?) = | ||
ActivityIntegrationPointWithViewModel( | ||
activity = this, | ||
savedInstanceState = savedInstanceState | ||
) | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
appyxV2IntegrationPoint = createIntegrationPoint(savedInstanceState) | ||
} | ||
|
||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { | ||
super.onActivityResult(requestCode, resultCode, data) | ||
appyxV2IntegrationPoint.onActivityResult(requestCode, resultCode, data) | ||
} | ||
|
||
override fun onRequestPermissionsResult( | ||
requestCode: Int, | ||
permissions: Array<out String>, | ||
grantResults: IntArray | ||
) { | ||
super.onRequestPermissionsResult(requestCode, permissions, grantResults) | ||
appyxV2IntegrationPoint.onRequestPermissionsResult(requestCode, permissions, grantResults) | ||
} | ||
|
||
override fun onSaveInstanceState(outState: Bundle) { | ||
super.onSaveInstanceState(outState) | ||
appyxV2IntegrationPoint.onSaveInstanceState(outState) | ||
} | ||
|
||
} |
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