-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(adaptive): remove padding in compact mode.
* Remove padding for schedule grid screen * Remove padding for speaker grid screen * Remove padding for partner grid screen
- Loading branch information
1 parent
4312e83
commit c94ba4e
Showing
19 changed files
with
167 additions
and
13 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
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,15 @@ | ||
plugins { | ||
id("conferences4hall.android.library") | ||
id("conferences4hall.android.library.compose") | ||
id("conferences4hall.quality") | ||
} | ||
|
||
android { | ||
namespace = "org.gdglille.devfest.android.theme.m3.style.adaptive" | ||
} | ||
|
||
dependencies { | ||
implementation(platform(libs.androidx.compose.bom)) | ||
implementation(libs.androidx.compose.material3.adaptive) | ||
implementation(libs.androidx.compose.material3.windowsizeclass) | ||
} |
25 changes: 25 additions & 0 deletions
25
...org/gdglille/devfest/android/theme/m3/style/adaptive/ListDetailPaneScaffoldDefaultsExt.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,25 @@ | ||
package org.gdglille.devfest.android.theme.m3.style.adaptive | ||
|
||
import androidx.compose.foundation.layout.WindowInsets | ||
import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi | ||
import androidx.compose.material3.adaptive.ListDetailPaneScaffoldDefaults | ||
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo | ||
import androidx.compose.runtime.Composable | ||
|
||
/** | ||
* By default, list detail scaffold configure a window inset as if it was used | ||
* without NavigationSuiteScaffold component and add a vertical padding. | ||
* This padding is useful when we display more than one pane on the screen but when | ||
* we are in compact mode, we don't want any vertical padding. | ||
*/ | ||
@OptIn(ExperimentalMaterial3AdaptiveApi::class) | ||
val ListDetailPaneScaffoldDefaults.windowInsetsAdaptive: WindowInsets | ||
@Composable | ||
get() { | ||
val windowSizeClass = currentWindowAdaptiveInfo() | ||
return if (windowSizeClass.windowSizeClass.widthSizeClass.isCompat) { | ||
WindowInsets(0, 0, 0, 0) | ||
} else { | ||
windowInsets | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...n/kotlin/org/gdglille/devfest/android/theme/m3/style/adaptive/PaneScaffoldDirectiveExt.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,48 @@ | ||
package org.gdglille.devfest.android.theme.m3.style.adaptive | ||
|
||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi | ||
import androidx.compose.material3.adaptive.HingePolicy | ||
import androidx.compose.material3.adaptive.PaneScaffoldDirective | ||
import androidx.compose.material3.adaptive.WindowAdaptiveInfo | ||
import androidx.compose.material3.adaptive.calculateStandardPaneScaffoldDirective | ||
import androidx.compose.ui.geometry.Rect | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
|
||
/** | ||
* By default, adaptive scaffold configure a content padding as if it was used | ||
* without NavigationSuiteScaffold component and add a padding around the main pane. | ||
* This padding is useful when we display more than one pane on the screen but when | ||
* we are in compact mode, we don't want any padding. | ||
*/ | ||
@OptIn(ExperimentalMaterial3AdaptiveApi::class) | ||
fun calculateStandardPaneScaffoldDirectiveAdaptive( | ||
windowAdaptiveInfo: WindowAdaptiveInfo, | ||
verticalHingePolicy: HingePolicy = HingePolicy.AvoidSeparating | ||
): PaneScaffoldDirective { | ||
val directive = calculateStandardPaneScaffoldDirective(windowAdaptiveInfo, verticalHingePolicy) | ||
return if (windowAdaptiveInfo.windowSizeClass.widthSizeClass.isCompat) { | ||
directive.copy(contentPadding = PaddingValues(0.dp)) | ||
} else { | ||
directive | ||
} | ||
} | ||
|
||
@Suppress("LongParameterList") | ||
@OptIn(ExperimentalMaterial3AdaptiveApi::class) | ||
fun PaneScaffoldDirective.copy( | ||
contentPadding: PaddingValues = this.contentPadding, | ||
maxHorizontalPartitions: Int = this.maxHorizontalPartitions, | ||
horizontalPartitionSpacerSize: Dp = this.horizontalPartitionSpacerSize, | ||
maxVerticalPartitions: Int = this.maxVerticalPartitions, | ||
verticalPartitionSpacerSize: Dp = this.verticalPartitionSpacerSize, | ||
excludedBounds: List<Rect> = this.excludedBounds | ||
): PaneScaffoldDirective = PaneScaffoldDirective( | ||
contentPadding = contentPadding, | ||
maxHorizontalPartitions = maxHorizontalPartitions, | ||
horizontalPartitionSpacerSize = horizontalPartitionSpacerSize, | ||
maxVerticalPartitions = maxVerticalPartitions, | ||
verticalPartitionSpacerSize = verticalPartitionSpacerSize, | ||
excludedBounds = excludedBounds | ||
) |
25 changes: 25 additions & 0 deletions
25
...org/gdglille/devfest/android/theme/m3/style/adaptive/SupportingPaneScaffoldDefaultsExt.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,25 @@ | ||
package org.gdglille.devfest.android.theme.m3.style.adaptive | ||
|
||
import androidx.compose.foundation.layout.WindowInsets | ||
import androidx.compose.material3.adaptive.ExperimentalMaterial3AdaptiveApi | ||
import androidx.compose.material3.adaptive.SupportingPaneScaffoldDefaults | ||
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo | ||
import androidx.compose.runtime.Composable | ||
|
||
/** | ||
* By default, supporting page scaffold configure a window inset as if it was used | ||
* without NavigationSuiteScaffold component and add a vertical padding. | ||
* This padding is useful when we display more than one pane on the screen but when | ||
* we are in compact mode, we don't want any vertical padding. | ||
*/ | ||
@OptIn(ExperimentalMaterial3AdaptiveApi::class) | ||
val SupportingPaneScaffoldDefaults.windowInsetsAdaptive: WindowInsets | ||
@Composable | ||
get() { | ||
val windowSizeClass = currentWindowAdaptiveInfo() | ||
return if (windowSizeClass.windowSizeClass.widthSizeClass.isCompat) { | ||
WindowInsets(0, 0, 0, 0) | ||
} else { | ||
windowInsets | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...vfest/android/theme/WindowSizeClassExt.kt → ...e/m3/style/adaptive/WindowSizeClassExt.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