Skip to content

Commit

Permalink
feat(ViewModel): 测试ViewModel
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaoyaning committed Aug 8, 2022
1 parent 4fe7e53 commit f6b970d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
12 changes: 6 additions & 6 deletions app/src/main/java/com/jyn/composecalculator/ui/BottomBtnView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import androidx.compose.ui.unit.sp
* Created by jiaoyaning on 2022/8/6.
*/
private val numberColumns = listOf(
listOf("C", "7", "4", "1", "%"),
listOf("÷", "8", "5", "2", "0"),
listOf("×", "9", "6", "3", "."),
listOf("D", "-", "+", "="),
listOf("C", "7", "4", "1", "00"),
listOf("%", "8", "5", "2", "0"),
listOf("D", "9", "6", "3", "."),
listOf("÷", "×", "-", "+", "="),
)

const val BOTTOM_FRACTION = 0.618f
Expand Down Expand Up @@ -56,7 +56,7 @@ fun BottomBtnView() {
Box(
modifier = Modifier
.padding(bottom = 10.dp)
.weight(if (it == "=") 2f else 1f)
.weight(1f)
) {
ItemBtn(text = it)
}
Expand All @@ -71,7 +71,7 @@ fun BottomBtnView() {
fun ItemBtn(text: String) {
val modifier = if (text != "=") Modifier.aspectRatio(1f) else Modifier
Button(
modifier = modifier
modifier = Modifier
.fillMaxWidth()
.fillMaxHeight(),
shape = RoundedCornerShape(1000.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.graphics.drawscope.Stroke
import com.apkfuns.logutils.LogUtils
import com.jyn.composecalculator.ui.theme.black1

/**
* 取值1..100
Expand Down Expand Up @@ -47,7 +48,7 @@ fun SlideIndicator(process: Float) {
}
drawPath(
path = path,
color = Color.Blue,
color = black1,
style = Stroke(
width = height.toPx(),
join = StrokeJoin.Round,
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_backspace.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M22,3L7,3c-0.69,0 -1.23,0.35 -1.59,0.88L0,12l5.41,8.11c0.36,0.53 0.9,0.89 1.59,0.89h15c1.1,0 2,-0.9 2,-2L24,5c0,-1.1 -0.9,-2 -2,-2zM19,15.59L17.59,17 14,13.41 10.41,17 9,15.59 12.59,12 9,8.41 10.41,7 14,10.59 17.59,7 19,8.41 15.41,12 19,15.59z"/>
</vector>

0 comments on commit f6b970d

Please sign in to comment.