-
-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved accessibility of compound amount inputs (original and equiva…
…lent amount)
- Loading branch information
1 parent
c46fbf0
commit ec9d9e4
Showing
11 changed files
with
122 additions
and
76 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
30 changes: 30 additions & 0 deletions
30
myExpenses/src/main/java/org/totschnig/myexpenses/util/ui/DisplayProgress.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,30 @@ | ||
package org.totschnig.myexpenses.util.ui | ||
|
||
import app.futured.donut.DonutSection | ||
|
||
data class DisplayProgress(val displayValue: Float, val displayExcess: Float) { | ||
fun forViewSystem(valueColor: Int, excessColor: Int) = listOf( | ||
DonutSection("excess", excessColor, displayExcess), | ||
DonutSection("progress", valueColor, displayValue) | ||
) | ||
|
||
fun forCompose( | ||
valueColor: androidx.compose.ui.graphics.Color, | ||
excessColor: androidx.compose.ui.graphics.Color, | ||
) = listOf( | ||
app.futured.donut.compose.data.DonutSection(displayExcess, excessColor), | ||
app.futured.donut.compose.data.DonutSection(displayValue, valueColor) | ||
) | ||
companion object { | ||
fun calcProgressVisualRepresentation(progress: Float) = when { | ||
|
||
progress > 200 -> DisplayProgress(0f,100f) | ||
|
||
progress > 100 -> DisplayProgress(200f - progress, progress - 100) | ||
|
||
progress >= 0 -> DisplayProgress(progress, 0f) | ||
|
||
else -> throw IllegalArgumentException() | ||
} | ||
} | ||
} |
Oops, something went wrong.