forked from az4521/TachiyomiAZ
-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dedupe common LazyColumn with action at bottom layout
(cherry picked from commit 1cdaa76) # Conflicts: # app/src/main/java/eu/kanade/presentation/more/settings/screen/advanced/ClearDatabaseScreen.kt
- Loading branch information
Showing
5 changed files
with
116 additions
and
141 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
52 changes: 52 additions & 0 deletions
52
...ntation-core/src/main/java/tachiyomi/presentation/core/components/LazyColumnWithAction.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,52 @@ | ||
package tachiyomi.presentation.core.components | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.foundation.lazy.LazyListScope | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.HorizontalDivider | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun LazyColumnWithAction( | ||
contentPadding: PaddingValues, | ||
actionLabel: String, | ||
onClickAction: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
actionEnabled: Boolean = true, | ||
content: LazyListScope.() -> Unit, | ||
) { | ||
Column( | ||
modifier = modifier | ||
.padding(contentPadding) | ||
.fillMaxSize(), | ||
) { | ||
LazyColumn( | ||
modifier = Modifier.weight(1f), | ||
content = content, | ||
) | ||
|
||
HorizontalDivider() | ||
|
||
Button( | ||
modifier = Modifier | ||
.padding(horizontal = 16.dp, vertical = 8.dp) | ||
.fillMaxWidth(), | ||
enabled = actionEnabled, | ||
onClick = onClickAction, | ||
) { | ||
Text( | ||
text = actionLabel, | ||
color = MaterialTheme.colorScheme.onPrimary, | ||
) | ||
} | ||
} | ||
} |
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