329 lines
13 KiB
XML
329 lines
13 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||
xmlns:tools="http://schemas.android.com/tools"
|
||
android:id="@+id/main"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="match_parent"
|
||
tools:context=".activities.MainActivity">
|
||
|
||
<!-- Calculator Display -->
|
||
<androidx.constraintlayout.widget.ConstraintLayout
|
||
android:id="@+id/displayContainer"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="16dp"
|
||
app:layout_constraintEnd_toEndOf="parent"
|
||
app:layout_constraintHeight_percent="0.3"
|
||
app:layout_constraintStart_toStartOf="parent"
|
||
app:layout_constraintTop_toTopOf="parent">
|
||
|
||
<LinearLayout
|
||
android:id="@+id/scrollView"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="0dp"
|
||
android:scrollbars="none"
|
||
android:gravity="end|bottom"
|
||
app:layout_constraintBottom_toTopOf="@+id/total"
|
||
app:layout_constraintEnd_toEndOf="parent"
|
||
app:layout_constraintStart_toStartOf="parent"
|
||
app:layout_constraintTop_toTopOf="parent"
|
||
app:layout_constraintVertical_chainStyle="packed">
|
||
|
||
<LinearLayout
|
||
android:layout_width="match_parent"
|
||
android:layout_height="match_parent"
|
||
android:layout_gravity="bottom"
|
||
android:gravity="end|bottom"
|
||
android:orientation="vertical">
|
||
|
||
<TextView
|
||
android:id="@+id/display"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:autoSizeMaxTextSize="48sp"
|
||
android:autoSizeMinTextSize="16sp"
|
||
android:autoSizeStepGranularity="2sp"
|
||
android:gravity="end|bottom"
|
||
android:autoSizeTextType="uniform"
|
||
android:padding="10dp"
|
||
android:text="0"
|
||
android:textSize="48sp"
|
||
tools:ignore="Suspicious0dp" />
|
||
</LinearLayout>
|
||
|
||
|
||
</LinearLayout>
|
||
|
||
<TextView
|
||
android:id="@+id/total"
|
||
android:layout_width="0dp"
|
||
android:layout_height="wrap_content"
|
||
android:autoSizeMaxTextSize="26sp"
|
||
android:autoSizeMinTextSize="24sp"
|
||
android:autoSizeStepGranularity="2sp"
|
||
android:autoSizeTextType="uniform"
|
||
android:gravity="end|bottom"
|
||
android:paddingRight="10dp"
|
||
android:paddingBottom="10dp"
|
||
android:text=""
|
||
android:textSize="26sp"
|
||
app:layout_constraintBottom_toBottomOf="parent"
|
||
app:layout_constraintEnd_toEndOf="parent"
|
||
app:layout_constraintStart_toStartOf="parent"
|
||
app:layout_constraintTop_toBottomOf="@+id/scrollView"
|
||
tools:ignore="Suspicious0dp" />
|
||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||
|
||
<!-- Calculator Buttons -->
|
||
<androidx.gridlayout.widget.GridLayout
|
||
android:id="@+id/buttonGrid"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="8dp"
|
||
app:columnCount="4"
|
||
app:layout_constraintBottom_toBottomOf="parent"
|
||
app:layout_constraintEnd_toEndOf="parent"
|
||
app:layout_constraintStart_toStartOf="parent"
|
||
app:layout_constraintTop_toBottomOf="@id/displayContainer"
|
||
app:rowCount="5">
|
||
|
||
<!-- Row 1 -->
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnClear"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="C"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnPercent"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="%"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnDivide"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="÷"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/cut"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:gravity="center"
|
||
android:textAlignment="center"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:icon="@drawable/backspace"
|
||
app:iconSize="32dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<!-- Row 2 -->
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn7"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="7"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn8"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="8"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn9"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="9"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnMultiply"
|
||
style="@style/Widget.MaterialComponents.Button"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="×"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<!-- Row 3 -->
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn4"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="4"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn5"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="5"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn6"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="6"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnMinus"
|
||
style="@style/Widget.MaterialComponents.Button"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="-"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<!-- Row 4 -->
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn1"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="1"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn2"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="2"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn3"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="3"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnPlus"
|
||
style="@style/Widget.MaterialComponents.Button"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="+"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<!-- Row 5 -->
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn0"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="0"
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnSpan="2"
|
||
app:layout_columnWeight="2"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnDot"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="."
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnEquals"
|
||
style="@style/Widget.MaterialComponents.Button"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="4dp"
|
||
android:text="="
|
||
android:textSize="30sp"
|
||
app:cornerRadius="15dp"
|
||
app:layout_columnWeight="1"
|
||
app:layout_rowWeight="1" />
|
||
|
||
</androidx.gridlayout.widget.GridLayout>
|
||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |