Skip to content

Commit ce42666

Browse files
committed
(All) Customize icon style used for use-cases #6
Removes the material-icons-extended dependency at the same time for the library.
1 parent 8e2366a commit ce42666

File tree

156 files changed

+6448
-83
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+6448
-83
lines changed

buildSrc/src/main/java/LibraryModulePlugin.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class LibraryModulePlugin : Plugin<Project> {
4646
Dependencies.Compose.ANIMATION_GRAPHICS,
4747
Dependencies.Compose.RUNTIME,
4848
Dependencies.Compose.MATERIAL_3,
49-
Dependencies.Compose.ICONS_EXTENDED,
5049
)
5150

5251

calendar/src/main/java/com/maxkeppeler/sheets/calendar/models/CalendarConfig.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
*/
1616
package com.maxkeppeler.sheets.calendar.models
1717

18+
import com.maxkeppeker.sheets.core.icons.LibIcons
1819
import com.maxkeppeker.sheets.core.models.base.BaseConfigs
20+
import com.maxkeppeker.sheets.core.utils.BaseConstants.DEFAULT_ICON_STYLE
1921
import com.maxkeppeler.sheets.calendar.utils.Constants
2022
import java.time.LocalDate
2123

@@ -28,6 +30,7 @@ import java.time.LocalDate
2830
* @param maxYear The maximum year that is selectable.
2931
* @param disabledDates A list of dates that will be marked as disabled and can not be selected.
3032
* @param disabledTimeline The timeline you want to disable and which dates can not be selected.
33+
* @param icons The style of icons that are used for dialog/ view-specific icons.
3134
*/
3235
class CalendarConfig(
3336
val style: CalendarStyle = CalendarStyle.MONTH,
@@ -36,5 +39,6 @@ class CalendarConfig(
3639
val minYear: Int = Constants.DEFAULT_MIN_YEAR,
3740
val maxYear: Int = Constants.DEFAULT_MAX_YEAR,
3841
val disabledDates: List<LocalDate>? = null,
39-
val disabledTimeline: CalendarTimeline? = null
42+
val disabledTimeline: CalendarTimeline? = null,
43+
override val icons: LibIcons = DEFAULT_ICON_STYLE,
4044
) : BaseConfigs()

calendar/src/main/java/com/maxkeppeler/sheets/calendar/views/CalendarTopComponent.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,12 @@
1818
package com.maxkeppeler.sheets.calendar.views
1919

2020
import androidx.compose.animation.*
21-
import androidx.compose.animation.core.tween
2221
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
2322
import androidx.compose.animation.graphics.res.animatedVectorResource
2423
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
2524
import androidx.compose.animation.graphics.vector.AnimatedImageVector
2625
import androidx.compose.foundation.clickable
2726
import androidx.compose.foundation.layout.*
28-
import androidx.compose.material.icons.Icons
29-
import androidx.compose.material.icons.rounded.ChevronLeft
30-
import androidx.compose.material.icons.rounded.ChevronRight
3127
import androidx.compose.material3.*
3228
import androidx.compose.runtime.*
3329
import androidx.compose.ui.Alignment
@@ -113,7 +109,7 @@ internal fun CalendarTopComponent(
113109
) {
114110
Icon(
115111
modifier = Modifier.size(dimensionResource(RC.dimen.scd_size_150)),
116-
imageVector = Icons.Rounded.ChevronLeft,
112+
imageVector = config.icons.ChevronLeft,
117113
contentDescription = stringResource(
118114
when (config.style) {
119115
CalendarStyle.MONTH -> R.string.scd_calendar_dialog_prev_month
@@ -199,7 +195,7 @@ internal fun CalendarTopComponent(
199195
) {
200196
Icon(
201197
modifier = Modifier.size(dimensionResource(RC.dimen.scd_size_150)),
202-
imageVector = Icons.Rounded.ChevronRight,
198+
imageVector = config.icons.ChevronRight,
203199
contentDescription = stringResource(
204200
when (config.style) {
205201
CalendarStyle.MONTH -> R.string.scd_calendar_dialog_next_month

clock/src/main/java/com/maxkeppeler/sheets/clock/ClockView.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ fun ClockView(
6262
onAm = clockState::onChange12HourFormatValue,
6363
)
6464
KeyboardComponent(
65+
config = config,
6566
keys = clockState.keys,
6667
disabledKeys = clockState.disabledKeys,
6768
onEnterValue = clockState::onEnterValue,

clock/src/main/java/com/maxkeppeler/sheets/clock/models/ClockConfig.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,19 @@
1515
*/
1616
package com.maxkeppeler.sheets.clock.models
1717

18+
import com.maxkeppeker.sheets.core.icons.LibIcons
1819
import com.maxkeppeker.sheets.core.models.base.BaseConfigs
20+
import com.maxkeppeker.sheets.core.utils.BaseConstants.DEFAULT_ICON_STYLE
1921
import java.time.LocalTime
2022

2123
/**
2224
* The general configuration for the clock dialog.
2325
* @param defaultTime The default time.
2426
* @param is24HourFormat If the 24HourFormat is enabled.
27+
* @param icons The style of icons that are used for dialog/ view-specific icons.
2528
*/
2629
data class ClockConfig(
2730
val defaultTime: LocalTime? = null,
2831
val is24HourFormat: Boolean? = null,
32+
override val icons: LibIcons = DEFAULT_ICON_STYLE,
2933
) : BaseConfigs()

clock/src/main/java/com/maxkeppeler/sheets/clock/views/KeyItemComponent.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ import androidx.compose.foundation.layout.Row
2727
import androidx.compose.foundation.layout.aspectRatio
2828
import androidx.compose.foundation.layout.size
2929
import androidx.compose.foundation.shape.RoundedCornerShape
30-
import androidx.compose.material.icons.Icons
31-
import androidx.compose.material.icons.outlined.ChevronLeft
32-
import androidx.compose.material.icons.outlined.ChevronRight
3330
import androidx.compose.material3.Icon
3431
import androidx.compose.material3.MaterialTheme
3532
import androidx.compose.material3.Text
@@ -46,11 +43,13 @@ import androidx.compose.ui.text.font.FontWeight
4643
import com.maxkeppeker.sheets.core.utils.TestTags
4744
import com.maxkeppeker.sheets.core.utils.testTags
4845
import com.maxkeppeler.sheets.clock.R
46+
import com.maxkeppeler.sheets.clock.models.ClockConfig
4947
import com.maxkeppeler.sheets.clock.utils.Constants
5048
import com.maxkeppeler.sheets.core.R as RC
5149

5250
/**
5351
* The item component of the keyboard.
52+
* @param config The general configuration for the dialog view.
5453
* @param key The key that the component represents.
5554
* @param disabled Whenever the current key is disabled.
5655
* @param onEnterValue The listener that is invoked when a value was clicked.
@@ -59,6 +58,7 @@ import com.maxkeppeler.sheets.core.R as RC
5958
*/
6059
@Composable
6160
internal fun KeyItemComponent(
61+
config: ClockConfig,
6262
key: String,
6363
disabled: Boolean = false,
6464
onEnterValue: (Int) -> Unit,
@@ -110,7 +110,7 @@ internal fun KeyItemComponent(
110110
Icon(
111111
modifier = Modifier
112112
.size(dimensionResource(RC.dimen.scd_size_175)),
113-
imageVector = if (isActionNext) Icons.Outlined.ChevronRight else Icons.Outlined.ChevronLeft,
113+
imageVector = if (isActionNext) config.icons.ChevronRight else config.icons.ChevronLeft,
114114
contentDescription = stringResource(if (isActionNext) R.string.scd_clock_dialog_next_value else R.string.scd_clock_dialog_previous_value),
115115
tint = MaterialTheme.colorScheme.secondary
116116
)

clock/src/main/java/com/maxkeppeler/sheets/clock/views/KeyboardComponent.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@ package com.maxkeppeler.sheets.clock.views
1818

1919
import androidx.compose.foundation.layout.Arrangement
2020
import androidx.compose.foundation.layout.fillMaxWidth
21-
import androidx.compose.foundation.layout.padding
2221
import androidx.compose.foundation.lazy.grid.GridCells
2322
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
2423
import androidx.compose.foundation.lazy.grid.items
2524
import androidx.compose.runtime.Composable
2625
import androidx.compose.ui.Modifier
2726
import androidx.compose.ui.res.dimensionResource
27+
import com.maxkeppeler.sheets.clock.models.ClockConfig
2828
import com.maxkeppeler.sheets.clock.utils.Constants
2929
import com.maxkeppeler.sheets.core.R as RC
3030

3131
/**
3232
* The keyboard component that is used to input the clock time.
33+
* @param config The general configuration for the dialog view.
3334
* @param keys A list of keys that will be displayed.
3435
* @param disabledKeys A list of the keys that are displayed.
3536
* @param onEnterValue The listener that is invoked when a value was clicked.
@@ -38,6 +39,7 @@ import com.maxkeppeler.sheets.core.R as RC
3839
*/
3940
@Composable
4041
internal fun KeyboardComponent(
42+
config: ClockConfig,
4143
keys: List<String>,
4244
disabledKeys: List<String>,
4345
onEnterValue: (Int) -> Unit,
@@ -55,6 +57,7 @@ internal fun KeyboardComponent(
5557
items(keys) { key ->
5658
val disabled = disabledKeys.contains(key)
5759
KeyItemComponent(
60+
config = config,
5861
key = key,
5962
disabled = disabled,
6063
onNextAction = onNextAction,

color/src/main/java/com/maxkeppeler/sheets/color/ColorView.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ fun ColorView(
8383
when (colorState.displayMode) {
8484
ColorSelectionMode.TEMPLATE ->
8585
ColorTemplateComponent(
86+
config = config,
8687
colors = colorState.colors,
8788
selectedColor = colorState.color,
8889
inputDisabled = colorState.inputDisabled,

color/src/main/java/com/maxkeppeler/sheets/color/models/ColorConfig.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,22 @@
1515
*/
1616
package com.maxkeppeler.sheets.color.models
1717

18+
import com.maxkeppeker.sheets.core.icons.LibIcons
1819
import com.maxkeppeker.sheets.core.models.base.BaseConfigs
20+
import com.maxkeppeker.sheets.core.utils.BaseConstants.DEFAULT_ICON_STYLE
1921

2022
/**
2123
* The general configuration for the clock dialog.
2224
* @param displayMode Available color selection modes. If null, both are used.
2325
* @param defaultDisplayMode Default view when opening ColorDialog.
2426
* @param templateColors Colors for the [ColorSelectionMode.TEMPLATE]-view.
2527
* @param allowCustomColorAlphaValues Allow alpha values in the custom color picker.
28+
* @param icons The style of icons that are used for dialog/ view-specific icons.
2629
*/
2730
data class ColorConfig(
2831
val displayMode: ColorSelectionMode? = null,
2932
val defaultDisplayMode: ColorSelectionMode? = null,
3033
val templateColors: MultipleColors = MultipleColors.ColorsInt(),
3134
val allowCustomColorAlphaValues: Boolean = true,
35+
override val icons: LibIcons = DEFAULT_ICON_STYLE,
3236
) : BaseConfigs()

color/src/main/java/com/maxkeppeler/sheets/color/views/ColorCustomComponent.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ internal fun ColorCustomComponent(
3333
) {
3434
Column {
3535
ColorCustomInfoComponent(
36+
config = config,
3637
color = color,
3738
onColorChange = onColorChange,
3839
)

0 commit comments

Comments
 (0)