Skip to content

Commit 0a62a09

Browse files
committed
Fixed style for API < 21
1 parent e8212ca commit 0a62a09

File tree

4 files changed

+14
-18
lines changed

4 files changed

+14
-18
lines changed

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
# v2.0.0
22
- Changed package name to `com.maltaisn.calcdialoglib`.
33
- To change the dialog settings, `CalcDialog.getSettings()` must now be used.
4+
- Order of operations is now applied by default. This can be changed with `setOrderOfOperationsApplied(Boolean)`.
45
- Added a setting to show the typed expression (`setExpressionShown(Boolean)`), which can also be edited (`setExpressionEditable(Boolean)`).
56
- Added a setting for choosing the numpad layout: like a phone (top row 123) or a calculator (top row 789).
67
- Added a min value setting separate from max value. As a consequence, `setSignCanBeChanged` setting was removed, use a minimum or maximum of 0 instead. If the minimum or the maximum is 0, special error messages like "Result must be positive" will still be shown.
78
- Added `calcHeaderElevation`, `calcHeaderStyle`, `calcExpressionStyle` and `calcExpressionScrollViewStyle` style attributes.
89
- Added getters to `CalcSettings` for Kotlin property syntax.
9-
- Order of operations is now applied by default. This can be changed with `setOrderOfOperationsApplied(Boolean)`.
10+
- Added a `calcHeaderElevationDrawable` attribute, needed to customize the header before API 21.
1011
- Changed `setValue(BigDecimal)` to `setInitialValue(BigDecimal)`.
1112
- Changed `setClearOnOperation(Boolean)` to `setShouldEvaluateOnOperation(Boolean)`.
1213
- Changed `setShowZeroWhenNoValue(Boolean)` to `setZeroShownWhenNoValue(Boolean)`.
1314
- Changed minus sign from hyphen `-` to unicode symbol ``.
1415
- Changed "Out of bounds" error behavior, now only shown when OK is pressed.
1516
- Changed default maximum dialog height from 400dp to 500dp.
1617
- Replaced all formatting settings with NumberFormat:
17-
- `setMaximumIntegerDigits`: maximum integer digits than can be typed.
18-
- `setMaximumFractionDigits`: maximum fraction digits than can be typed.
19-
- `setDecimalFormatSymbolds`: change decimal separator, negative sign, grouping symbol, etc.
18+
- `setMaximumIntegerDigits`: maximum integer digits than can be typed, but more could be displayed.
19+
- `setMaximumFractionDigits`: maximum fraction digits than can be typed and displayed.
20+
- `setDecimalFormatSymbols`: change decimal separator, negative sign, grouping symbol, etc.
2021
- `setGroupingUsed`: enable or disable grouping.
2122
- `setRoundingMode`: change the rounding mode, also used for division by the calculator.
2223
- More settings available like prefix, suffix and minimum digits.

calcdialog/src/main/res/drawable/calc_bg_elevation.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,14 @@
1212
</item>
1313

1414
<item
15+
android:bottom="2dp"
1516
android:left="0dp"
1617
android:right="0dp"
1718
android:top="0dp"
18-
android:bottom="?attr/calcHeaderElevation"
1919
tools:bottom="2dp"
2020
>
2121
<shape android:shape="rectangle">
22-
<solid
23-
android:color="?attr/colorBackgroundFloating"
24-
tools:color="#ffffff"
25-
/>
22+
<solid android:color="#ffffff"/>
2623
</shape>
2724
</item>
2825
</layer-list>

calcdialog/src/main/res/values/attrs.xml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@
1212
<attr name="calcButtonTextOk" format="string"/>
1313
<attr name="calcButtonTexts" format="reference"/>
1414
<attr name="calcBackgroundColor" format="color|reference"/>
15-
<attr name="calcHeaderStyle"
16-
format="reference"/>
17-
<attr name="calcHeaderElevation"
18-
format="dimension|reference"/>
15+
<attr name="calcHeaderStyle" format="reference"/>
16+
<attr name="calcHeaderElevation" format="dimension|reference"/>
17+
<attr name="calcHeaderElevationDrawable" format="reference"/>
1918
<attr name="calcValueStyle" format="reference"/>
20-
<attr name="calcExpressionScrollViewStyle"
21-
format="reference"/>
22-
<attr name="calcExpressionStyle"
23-
format="reference"/>
19+
<attr name="calcExpressionScrollViewStyle" format="reference"/>
20+
<attr name="calcExpressionStyle" format="reference"/>
2421
<attr name="calcNumberBtnStyle" format="reference"/>
2522
<attr name="calcNumberBtnColor" format="color|reference"/>
2623
<attr name="calcOperationBtnStyle" format="reference"/>

calcdialog/src/main/res/values/styles.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<item name="calcBackgroundColor">?attr/colorBackgroundFloating</item>
1414
<item name="calcHeaderStyle">@style/CalcHeaderStyle</item>
1515
<item name="calcHeaderElevation">2dp</item>
16+
<item name="calcHeaderElevationDrawable">@drawable/calc_bg_elevation</item>
1617
<item name="calcValueStyle">@style/CalcValueStyle</item>
1718
<item name="calcExpressionScrollViewStyle">@style/CalcExpressionScrollViewStyle</item>
1819
<item name="calcExpressionStyle">@style/CalcExpressionStyle</item>
@@ -29,7 +30,7 @@
2930

3031
<public name="CalcHeaderStyle" type="style"/>
3132
<style name="CalcHeaderStyle">
32-
<item name="android:background">@drawable/calc_bg_elevation</item>
33+
<item name="android:background">?attr/calcHeaderElevationDrawable</item>
3334
</style>
3435

3536
<public name="CalcValueStyle" type="style"/>

0 commit comments

Comments
 (0)