Skip to content

Commit

Permalink
Merge pull request #459 from tiwiz/ro_supporting_pane_alpha09
Browse files Browse the repository at this point in the history
Update Supporting Pane to alpha 09
  • Loading branch information
tiwiz committed Mar 29, 2024
2 parents e4a1f30 + 428cefa commit 181ebfa
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 40 deletions.
10 changes: 6 additions & 4 deletions CanonicalLayouts/supporting-pane-compose/app/build.gradle
Expand Up @@ -63,7 +63,7 @@ android {
}

dependencies {
def composeBom = platform('androidx.compose:compose-bom:2022.10.00')
def composeBom = platform('androidx.compose:compose-bom:2024.03.00')
implementation(composeBom)

implementation 'androidx.core:core-ktx:1.12.0'
Expand All @@ -72,8 +72,10 @@ dependencies {
implementation "androidx.compose.ui:ui"
implementation "androidx.compose.ui:ui-tooling-preview"
implementation "androidx.window:window:1.2.0"
implementation 'androidx.compose.material3:material3'
implementation("androidx.compose.material3:material3-adaptive:1.0.0-alpha05")
implementation "androidx.compose.material3:material3-window-size-class"
implementation 'androidx.compose.material3:material3:1.3.0-alpha03'
implementation 'androidx.compose.material3.adaptive:adaptive:1.0.0-alpha09'
implementation 'androidx.compose.material3.adaptive:adaptive-layout:1.0.0-alpha09'
implementation 'androidx.compose.material3.adaptive:adaptive-navigation:1.0.0-alpha09'
implementation "androidx.compose.material3:material3-window-size-class:1.3.0-alpha03"
testImplementation 'junit:junit:4.13.2'
}
Expand Up @@ -17,7 +17,6 @@
package com.example.supportingpanecompose.ui

import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand All @@ -26,22 +25,20 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.adaptive.AnimatedPane
import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi
import androidx.compose.material3.adaptive.SupportingPaneScaffold
import androidx.compose.material3.adaptive.SupportingPaneScaffoldRole
import androidx.compose.material3.adaptive.rememberSupportingPaneScaffoldNavigator
import androidx.compose.material3.adaptive.layout.AnimatedPane
import androidx.compose.material3.adaptive.layout.SupportingPaneScaffold
import androidx.compose.material3.adaptive.layout.SupportingPaneScaffoldRole
import androidx.compose.material3.adaptive.navigation.rememberSupportingPaneScaffoldNavigator
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.example.supportingpanecompose.R
Expand All @@ -60,14 +57,15 @@ private val data = mapOf(
@Composable
fun SupportingPaneSample() {
var selectedTopic: String by rememberSaveable { mutableStateOf(data.keys.first()) }
val navigator = rememberSupportingPaneScaffoldNavigator()
val navigator = rememberSupportingPaneScaffoldNavigator<Nothing>()

BackHandler(enabled = navigator.canNavigateBack()) {
navigator.navigateBack()
}

SupportingPaneScaffold(
scaffoldState = navigator.scaffoldState,
directive = navigator.scaffoldDirective,
value = navigator.scaffoldValue,
supportingPane = {
AnimatedPane(
modifier = Modifier.padding(all = 16.dp)
Expand Down Expand Up @@ -104,32 +102,31 @@ fun SupportingPaneSample() {
}
}
}
}
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxSize()
) {
Text(
stringResource(R.string.main_content_label),
style = MaterialTheme.typography.titleLarge
)

Box(
Modifier
.fillMaxWidth()
.padding(all = 8.dp)
.clickable {
navigator.navigateTo(SupportingPaneScaffoldRole.Supporting)
},
contentAlignment = Alignment.Center
}, mainPane = {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxSize()
) {
Text(
text = selectedTopic,
modifier = Modifier
.padding(16.dp)
stringResource(R.string.main_content_label),
style = MaterialTheme.typography.titleLarge
)

Box(
Modifier
.fillMaxWidth()
.padding(all = 8.dp)
.clickable {
navigator.navigateTo(SupportingPaneScaffoldRole.Supporting)
},
contentAlignment = Alignment.Center
) {
Text(
text = selectedTopic,
modifier = Modifier
.padding(16.dp)
)
}
}
}
}
})
}
4 changes: 2 additions & 2 deletions CanonicalLayouts/supporting-pane-compose/build.gradle
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
plugins {
id 'com.android.application' version '8.2.2' apply false
id 'com.android.library' version '8.2.2' apply false
id 'com.android.application' version '8.3.1' apply false
id 'com.android.library' version '8.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
}
@@ -1,6 +1,6 @@
#Wed May 25 14:11:15 UTC 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

0 comments on commit 181ebfa

Please sign in to comment.