-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from icerockdev/develop
Release 0.1.0 dev 11
- Loading branch information
Showing
52 changed files
with
1,874 additions
and
273 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
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
70 changes: 70 additions & 0 deletions
70
...e/mpp-library/src/commonMain/kotlin/com/icerockdev/library/universal/InfoWebViewScreen.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,70 @@ | ||
/* | ||
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package com.icerockdev.library.universal | ||
|
||
import dev.icerock.moko.mvvm.livedata.MutableLiveData | ||
import dev.icerock.moko.parcelize.Parcelable | ||
import dev.icerock.moko.parcelize.Parcelize | ||
import dev.icerock.moko.resources.desc.desc | ||
import dev.icerock.moko.widgets.constraint | ||
import dev.icerock.moko.widgets.core.Theme | ||
import dev.icerock.moko.widgets.core.Widget | ||
import dev.icerock.moko.widgets.progressBar | ||
import dev.icerock.moko.widgets.screen.Args | ||
import dev.icerock.moko.widgets.screen.WidgetScreen | ||
import dev.icerock.moko.widgets.screen.getArgument | ||
import dev.icerock.moko.widgets.screen.navigation.NavigationBar | ||
import dev.icerock.moko.widgets.screen.navigation.NavigationItem | ||
import dev.icerock.moko.widgets.style.view.SizeSpec | ||
import dev.icerock.moko.widgets.style.view.WidgetSize | ||
import dev.icerock.moko.widgets.visibility | ||
import dev.icerock.moko.widgets.webView | ||
|
||
class InfoWebViewScreen( | ||
private val theme: Theme | ||
) : WidgetScreen<Args.Parcel<InfoWebViewScreen.WebViewArgs>>(), NavigationItem { | ||
|
||
override val navigationBar: NavigationBar = NavigationBar.Normal("WebView Sample".desc()) | ||
|
||
override fun createContentWidget(): Widget<WidgetSize.Const<SizeSpec.AsParent, SizeSpec.AsParent>> { | ||
val inputArgs = getArgument() | ||
|
||
val isWebViewPageLoading = MutableLiveData(false) | ||
|
||
return with(theme) { | ||
constraint( | ||
size = WidgetSize.AsParent | ||
) { | ||
val webViewConstraintItem = +webView( | ||
size = WidgetSize.AsParent, | ||
isJavaScriptEnabled = true, | ||
targetUrl = inputArgs.targetUrl, | ||
isWebPageLoading = isWebViewPageLoading | ||
) | ||
|
||
val progressVisibilityConstraintItem = +visibility( | ||
child = progressBar( | ||
size = WidgetSize.WrapContent | ||
), | ||
showed = isWebViewPageLoading | ||
) | ||
|
||
constraints { | ||
webViewConstraintItem leftRightToLeftRight root | ||
webViewConstraintItem topToTop root.safeArea | ||
|
||
progressVisibilityConstraintItem topToTop root | ||
progressVisibilityConstraintItem centerXToCenterX root | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Parcelize | ||
data class WebViewArgs( | ||
val targetUrl: String | ||
) : Parcelable | ||
|
||
} |
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.