Skip to content

Commit

Permalink
Merge branch 'keypad-improvements'
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhasDissa committed Dec 10, 2023
2 parents ac79cf5 + 8107551 commit f03b276
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 45 deletions.
5 changes: 2 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 19 additions & 22 deletions app/src/main/java/net/youapps/calcyou/ui/components/Keypad.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,35 +65,29 @@ fun CenterKeypad(
horizontalArrangement = Arrangement.spacedBy(buttonSpacing)
) {
CalculatorButton(
iconRes = R.drawable.delete,
backgroundColor = MaterialTheme.colorScheme.tertiaryContainer,
textColor = MaterialTheme.colorScheme.onTertiaryContainer,
iconRes = R.drawable.bracket_l,
backgroundColor = MaterialTheme.colorScheme.secondaryContainer,
textColor = MaterialTheme.colorScheme.onSecondaryContainer,
onClick = {
onEvent(CalculatorEvent.Delete)
},
onLongClick = {
onEvent(CalculatorEvent.DeleteAll)
onEvent(CalculatorEvent.SpecialOperator(SpecialOperator.LBracket))
}
)

CalculatorButton(
iconRes = R.drawable.lbracket,
iconRes = R.drawable.bracket_r,
backgroundColor = MaterialTheme.colorScheme.secondaryContainer,
textColor = MaterialTheme.colorScheme.onSecondaryContainer,
onClick = {
onEvent(CalculatorEvent.SpecialOperator(SpecialOperator.LBracket))
onEvent(CalculatorEvent.SpecialOperator(SpecialOperator.RBracket))
}
)

CalculatorButton(
iconRes = R.drawable.rbracket,
iconRes = R.drawable.percent,
backgroundColor = MaterialTheme.colorScheme.secondaryContainer,
textColor = MaterialTheme.colorScheme.onSecondaryContainer,
onClick = {
onEvent(CalculatorEvent.SpecialOperator(SpecialOperator.RBracket))
onEvent(CalculatorEvent.Operator(SimpleOperator.Percent))
}
)

CalculatorButton(
iconRes = R.drawable.divide,
backgroundColor = MaterialTheme.colorScheme.secondaryContainer,
Expand Down Expand Up @@ -204,14 +198,6 @@ fun CenterKeypad(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(buttonSpacing)
) {
CalculatorButton(
iconRes = R.drawable.percent,
backgroundColor = MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp),
textColor = MaterialTheme.colorScheme.onSurface,
onClick = {
onEvent(CalculatorEvent.Operator(SimpleOperator.Percent))
}
)
CalculatorButton(
text = "0",
onClick = {
Expand All @@ -224,6 +210,17 @@ fun CenterKeypad(
onEvent(CalculatorEvent.Decimal)
}
)
CalculatorButton(
iconRes = R.drawable.delete,
backgroundColor = MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp),
textColor = MaterialTheme.colorScheme.onSurface,
onClick = {
onEvent(CalculatorEvent.Delete)
},
onLongClick = {
onEvent(CalculatorEvent.DeleteAll)
}
)
CalculatorButton(
iconRes = R.drawable.equal,
backgroundColor = MaterialTheme.colorScheme.primaryContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M13.6,4V4C9.592,8.58 9.592,15.42 13.6,20V20"
android:strokeWidth="1.7"
android:fillColor="#00000000"
android:pathData="M15.65,4V4C18.963,8.819 18.963,15.181 15.65,20V20"
android:strokeWidth="2"
android:strokeColor="#000000" />
android:strokeColor="#000000"/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M8.35,4V4C5.037,8.819 5.037,15.181 8.35,20V20"
android:strokeWidth="2"
android:pathData="M10.4,4V4C14.408,8.58 14.408,15.42 10.4,20V20"
android:strokeWidth="1.7"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
</vector>
18 changes: 11 additions & 7 deletions app/src/main/res/drawable/delete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M13.999,10.585L11.524,8.11L10.11,9.524L12.585,11.999L10.11,14.474L11.524,15.888L13.999,13.413L16.474,15.888L17.888,14.474L15.413,11.999L17.888,9.524L16.474,8.11L13.999,10.585Z"
android:fillColor="#000000"/>
<path
android:pathData="M20,18H8.515L4.229,12L8.515,6H20V18Z"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
android:pathData="M17.782,6C18.749,6 19.532,6.784 19.532,7.75V16.25C19.532,17.216 18.749,18 17.782,18H9.408C8.857,18 8.338,17.741 8.007,17.3L4.82,13.05C4.353,12.428 4.353,11.572 4.82,10.95L8.007,6.7C8.338,6.259 8.857,6 9.408,6H17.782ZM10.002,9.53L12.472,12L10.002,14.47L11.063,15.53L13.533,13.061L16.002,15.53L17.063,14.47L14.593,12L17.063,9.53L16.002,8.47L13.533,10.939L11.063,8.47L10.002,9.53Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
<group>
<clip-path
android:pathData="M17.782,6C18.749,6 19.532,6.784 19.532,7.75V16.25C19.532,17.216 18.749,18 17.782,18H9.408C8.857,18 8.338,17.741 8.007,17.3L4.82,13.05C4.353,12.428 4.353,11.572 4.82,10.95L8.007,6.7C8.338,6.259 8.857,6 9.408,6H17.782ZM10.002,9.53L12.472,12L10.002,14.47L11.063,15.53L13.533,13.061L16.002,15.53L17.063,14.47L14.593,12L17.063,9.53L16.002,8.47L13.533,10.939L11.063,8.47L10.002,9.53Z"
android:fillType="evenOdd"/>
<path
android:pathData="M8.007,17.3L6.648,18.32L6.648,18.32L8.007,17.3ZM4.82,13.05L3.46,14.07L3.46,14.07L4.82,13.05ZM4.82,10.95L3.46,9.93L3.46,9.93L4.82,10.95ZM8.007,6.7L9.368,7.72L8.007,6.7ZM12.472,12L13.674,13.202L14.876,12L13.674,10.798L12.472,12ZM10.002,9.53L8.8,8.328L7.598,9.53L8.8,10.732L10.002,9.53ZM10.002,14.47L8.8,13.268L7.598,14.47L8.8,15.672L10.002,14.47ZM11.063,15.53L9.861,16.732L11.063,17.934L12.265,16.732L11.063,15.53ZM13.533,13.061L14.735,11.859L13.533,10.656L12.33,11.859L13.533,13.061ZM16.002,15.53L14.8,16.732L16.002,17.934L17.204,16.732L16.002,15.53ZM17.063,14.47L18.265,15.672L19.467,14.47L18.265,13.268L17.063,14.47ZM14.593,12L13.391,10.798L12.189,12L13.391,13.202L14.593,12ZM17.063,9.53L18.265,10.732L19.467,9.53L18.265,8.328L17.063,9.53ZM16.002,8.47L17.204,7.268L16.002,6.066L14.8,7.268L16.002,8.47ZM13.533,10.939L12.33,12.141L13.533,13.344L14.735,12.141L13.533,10.939ZM11.063,8.47L12.265,7.268L11.063,6.066L9.861,7.268L11.063,8.47ZM21.233,7.75C21.233,5.845 19.688,4.3 17.782,4.3V7.7C17.792,7.7 17.798,7.702 17.801,7.703C17.806,7.705 17.812,7.709 17.818,7.715C17.824,7.72 17.827,7.726 17.829,7.731C17.831,7.735 17.833,7.74 17.833,7.75H21.233ZM21.233,16.25V7.75H17.833V16.25H21.233ZM17.782,19.7C19.688,19.7 21.233,18.155 21.233,16.25H17.833C17.833,16.26 17.831,16.265 17.829,16.269C17.827,16.274 17.824,16.28 17.818,16.285C17.812,16.291 17.806,16.295 17.801,16.297C17.798,16.298 17.792,16.3 17.782,16.3V19.7ZM9.408,19.7H17.782V16.3H9.408V19.7ZM6.648,18.32C7.299,19.189 8.322,19.7 9.408,19.7V16.3C9.392,16.3 9.377,16.293 9.368,16.28L6.648,18.32ZM3.46,14.07L6.648,18.32L9.368,16.28L6.18,12.03L3.46,14.07ZM3.46,9.93C2.54,11.157 2.54,12.843 3.46,14.07L6.18,12.03C6.167,12.012 6.167,11.988 6.18,11.97L3.46,9.93ZM6.648,5.68L3.46,9.93L6.18,11.97L9.368,7.72L6.648,5.68ZM9.408,4.3C8.322,4.3 7.299,4.811 6.648,5.68L9.368,7.72C9.377,7.707 9.392,7.7 9.408,7.7V4.3ZM17.782,4.3H9.408V7.7H17.782V4.3ZM13.674,10.798L11.204,8.328L8.8,10.732L11.27,13.202L13.674,10.798ZM11.204,15.672L13.674,13.202L11.27,10.798L8.8,13.268L11.204,15.672ZM12.265,14.328L11.204,13.268L8.8,15.672L9.861,16.732L12.265,14.328ZM12.33,11.859L9.861,14.328L12.265,16.732L14.735,14.263L12.33,11.859ZM17.204,14.328L14.735,11.859L12.33,14.263L14.8,16.732L17.204,14.328ZM15.861,13.268L14.8,14.328L17.204,16.732L18.265,15.672L15.861,13.268ZM13.391,13.202L15.861,15.672L18.265,13.268L15.795,10.798L13.391,13.202ZM15.861,8.328L13.391,10.798L15.795,13.202L18.265,10.732L15.861,8.328ZM14.8,9.672L15.861,10.732L18.265,8.328L17.204,7.268L14.8,9.672ZM14.735,12.141L17.204,9.672L14.8,7.268L12.33,9.737L14.735,12.141ZM9.861,9.672L12.33,12.141L14.735,9.737L12.265,7.268L9.861,9.672ZM11.204,10.732L12.265,9.672L9.861,7.268L8.8,8.328L11.204,10.732Z"
android:fillColor="#000000"/>
</group>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/divide.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,8.5C12.828,8.5 13.5,7.828 13.5,7C13.5,6.172 12.828,5.5 12,5.5C11.172,5.5 10.5,6.172 10.5,7C10.5,7.828 11.172,8.5 12,8.5ZM5,13V11H19V13H5ZM13.5,17C13.5,17.828 12.828,18.5 12,18.5C11.172,18.5 10.5,17.828 10.5,17C10.5,16.172 11.172,15.5 12,15.5C12.828,15.5 13.5,16.172 13.5,17Z"
android:pathData="M13.5,6.9C13.5,7.728 12.828,8.4 12,8.4C11.172,8.4 10.5,7.728 10.5,6.9C10.5,6.072 11.172,5.4 12,5.4C12.828,5.4 13.5,6.072 13.5,6.9ZM5.25,12.85V11.15H18.75V12.85H5.25ZM12,18.6C12.828,18.6 13.5,17.928 13.5,17.1C13.5,16.272 12.828,15.6 12,15.6C11.172,15.6 10.5,16.272 10.5,17.1C10.5,17.928 11.172,18.6 12,18.6Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/equal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M5,8.25V10.25H19V8.25H5ZM5,13.75V15.75H19V13.75H5Z"
android:pathData="M5.25,9.7H18.75V8H5.25V9.7ZM5.25,16H18.75V14.3H5.25V16Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
</vector>
6 changes: 4 additions & 2 deletions app/src/main/res/drawable/minus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M5,13V11H19V13H5Z"
android:fillColor="#000000"/>
android:pathData="M5.25,12L18.75,12"
android:strokeWidth="1.7"
android:fillColor="#00000000"
android:strokeColor="#000000"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/multiply.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,13.414L7.05,18.364L5.636,16.95L10.586,12L5.636,7.05L7.05,5.636L12,10.586L16.95,5.636L18.364,7.05L13.414,12L18.364,16.95L16.95,18.364L12,13.414Z"
android:pathData="M11.998,10.798L6.942,5.742L5.74,6.944L10.796,12L5.74,17.056L6.942,18.258L11.998,13.202L17.054,18.258L18.256,17.056L13.2,12L18.256,6.944L17.054,5.742L11.998,10.798Z"
android:fillColor="#000000"/>
</vector>
9 changes: 8 additions & 1 deletion app/src/main/res/drawable/percent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M8.818,6.697C9.404,7.282 9.404,8.232 8.818,8.818C8.232,9.404 7.282,9.404 6.697,8.818C6.111,8.232 6.111,7.282 6.697,6.697C7.282,6.111 8.232,6.111 8.818,6.697ZM10.232,5.282C11.599,6.649 11.599,8.865 10.232,10.232C8.865,11.599 6.649,11.599 5.282,10.232C3.916,8.865 3.916,6.649 5.282,5.282C6.649,3.916 8.865,3.916 10.232,5.282ZM19.778,5.636L5.636,19.778L4.222,18.364L18.364,4.222L19.778,5.636ZM17.303,17.303C17.889,16.718 17.889,15.768 17.303,15.182C16.718,14.596 15.768,14.596 15.182,15.182C14.596,15.768 14.596,16.718 15.182,17.303C15.768,17.889 16.718,17.889 17.303,17.303ZM18.718,18.718C20.084,17.351 20.084,15.135 18.718,13.768C17.351,12.401 15.135,12.401 13.768,13.768C12.401,15.135 12.401,17.351 13.768,18.718C15.135,20.084 17.351,20.084 18.718,18.718Z"
android:pathData="M6.236,18.964L5.034,17.762L17.762,5.034L18.964,6.236L6.236,18.964Z"
android:fillColor="#000000"/>
<path
android:pathData="M13.59,18.186C14.859,19.455 16.917,19.455 18.186,18.186C19.455,16.917 19.455,14.859 18.186,13.59C16.917,12.321 14.859,12.321 13.59,13.59C12.321,14.859 12.321,16.917 13.59,18.186ZM14.792,16.984C15.398,17.59 16.379,17.59 16.984,16.984C17.59,16.379 17.59,15.398 16.984,14.792C16.379,14.187 15.398,14.187 14.792,14.792C14.187,15.398 14.187,16.379 14.792,16.984Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
<path
android:pathData="M10.408,10.408C9.139,11.677 7.081,11.677 5.812,10.408C4.543,9.139 4.543,7.081 5.812,5.812C7.081,4.543 9.139,4.543 10.408,5.812C11.677,7.081 11.677,9.139 10.408,10.408ZM9.206,9.206C8.601,9.811 7.619,9.811 7.014,9.206C6.409,8.601 6.409,7.619 7.014,7.014C7.619,6.409 8.601,6.409 9.206,7.014C9.811,7.619 9.811,8.601 9.206,9.206Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
</vector>
5 changes: 3 additions & 2 deletions app/src/main/res/drawable/plus.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M11,13H5V11H11V5H13V11H19V13H13V19H11V13Z"
android:fillColor="#000000"/>
android:pathData="M12.85,11.15V5.25H11.15V11.15H5.25V12.85H11.15V18.75H12.85V12.85H18.75V11.15H12.85Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
</vector>

0 comments on commit f03b276

Please sign in to comment.