Browse Source
* Update widgets gallery examples * Update notepad example * Update issues example This change updates: * Gradle to 7.1.1; * AGP to 7.0.0; * Compose to 1.0.0-alpha1-rc1; * Kotlin to 1.5.21. * Update image viewer examplepull/972/head
Alexey Tsvetkov
3 years ago
committed by
GitHub
24 changed files with 98 additions and 124 deletions
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME |
||||
distributionPath=wrapper/dists |
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip |
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip |
||||
zipStoreBase=GRADLE_USER_HOME |
||||
zipStorePath=wrapper/dists |
||||
|
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME |
||||
distributionPath=wrapper/dists |
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip |
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip |
||||
zipStoreBase=GRADLE_USER_HOME |
||||
zipStorePath=wrapper/dists |
||||
|
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME |
||||
distributionPath=wrapper/dists |
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip |
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip |
||||
zipStoreBase=GRADLE_USER_HOME |
||||
zipStorePath=wrapper/dists |
||||
|
@ -1,2 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<manifest package="org.jetbrains.compose.demo.widgets"/> |
||||
<manifest package="org.jetbrains.compose.demo.widgets.platform"/> |
@ -1,27 +1,18 @@
|
||||
package org.jetbrains.compose.demo.widgets |
||||
|
||||
import androidx.compose.ui.unit.IntSize |
||||
import androidx.compose.ui.unit.dp |
||||
import androidx.compose.ui.window.* |
||||
import androidx.compose.ui.window.Window |
||||
import androidx.compose.ui.window.WindowSize |
||||
import androidx.compose.ui.window.WindowState |
||||
import androidx.compose.ui.window.application |
||||
import org.jetbrains.compose.demo.widgets.ui.MainView |
||||
import java.awt.Dimension |
||||
import java.awt.Toolkit |
||||
|
||||
fun main() { |
||||
val size = getPreferredWindowSize(600, 800) |
||||
singleWindowApplication ( |
||||
title = "Widgets Gallery", |
||||
state = WindowState(size = WindowSize(size.width.dp, size.height.dp)), |
||||
) { |
||||
fun main() = application { |
||||
Window( |
||||
onCloseRequest = ::exitApplication, |
||||
title = "Widgets Gallery", |
||||
state = WindowState(size = WindowSize(800.dp, 600.dp)) |
||||
) { |
||||
MainView() |
||||
} |
||||
} |
||||
|
||||
private fun getPreferredWindowSize(desiredWidth: Int, desiredHeight: Int): IntSize { |
||||
val screenSize: Dimension = Toolkit.getDefaultToolkit().screenSize |
||||
val preferredWidth: Int = (screenSize.width * 0.8f).toInt() |
||||
val preferredHeight: Int = (screenSize.height * 0.8f).toInt() |
||||
val width: Int = if (desiredWidth < preferredWidth) desiredWidth else preferredWidth |
||||
val height: Int = if (desiredHeight < preferredHeight) desiredHeight else preferredHeight |
||||
return IntSize(width, height) |
||||
} |
||||
} |
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME |
||||
distributionPath=wrapper/dists |
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip |
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip |
||||
zipStoreBase=GRADLE_USER_HOME |
||||
zipStorePath=wrapper/dists |
||||
|
Loading…
Reference in new issue