Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/blue"
- tools:context=".MainActivity">
- <TableLayout
- android:id="@+id/tableLayout"
- android:layout_width="0dp"
- android:layout_height="420dp"
- android:stretchColumns="*"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="1.0">
- <TableRow
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
- <Button
- android:id="@+id/clear"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="AC"
- android:onClick="allClear"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/minusButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="+/-"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/percentButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="%"
- android:onClick="countPerc"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/divButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="/"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- </TableRow>
- <TableRow
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
- <Button
- android:id="@+id/sevenButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="7"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/eightButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="8"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/nineButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="9"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/mulButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="x"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- </TableRow>
- <TableRow
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
- <Button
- android:id="@+id/fourButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="4"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/fiveButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="5"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/sixButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="6"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/subButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="-"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- </TableRow>
- <TableRow
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
- <Button
- android:id="@+id/oneButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="1"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/twoButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="2"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/threeButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="3"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/sumButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="+"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- </TableRow>
- <TableRow
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- tools:layout_editor_absoluteX="-207dp"
- tools:layout_editor_absoluteY="639dp">
- <Button
- android:id="@+id/zeroButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="0"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/nothing"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- app:backgroundTint="@color/light_gray"
- tools:ignore="SpeakableTextPresentCheck" />
- <Button
- android:id="@+id/commaButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text=","
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/equalsButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="="
- android:onClick="showResult"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- </TableRow>
- </TableLayout>
- <TextView
- android:id="@+id/result"
- android:layout_width="0dp"
- android:layout_height="170dp"
- android:background="@color/blue"
- android:text="0"
- android:textStyle="bold"
- android:textAlignment="viewEnd"
- android:textColor="@color/white"
- android:textSize="75sp"
- app:layout_constraintBottom_toTopOf="@+id/tableLayout"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="1.0"
- tools:ignore="TextContrastCheck" />
- <TextView
- android:id="@+id/workings"
- android:layout_width="0dp"
- android:layout_height="100dp"
- android:text=""
- android:textAlignment="viewEnd"
- android:textColor="@color/white"
- android:textSize="40sp"
- app:layout_constraintBottom_toTopOf="@+id/result"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="1.0" />
- </androidx.constraintlayout.widget.ConstraintLayout>
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- LANDSCAPE
- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- <?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:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/blue"
- tools:context=".MainActivity">
- <TableLayout
- android:id="@+id/tableLayout"
- android:layout_width="0dp"
- android:layout_height="255dp"
- android:stretchColumns="*"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="1.0">
- <TableRow
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
- <Button
- android:id="@+id/clear"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="AC"
- android:onClick="allClear"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/minusButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="+/-"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/percentButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="%"
- android:onClick="countPerc"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/divButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="/"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/logButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="log10"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/green" />
- </TableRow>
- <TableRow
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
- <Button
- android:id="@+id/sevenButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="7"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/eightButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="8"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/nineButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="9"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/mulButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="x"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/factorialButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="x!"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/green" />
- </TableRow>
- <TableRow
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
- <Button
- android:id="@+id/fourButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="4"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/fiveButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="5"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/sixButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="6"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/subButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="-"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/sqrtButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="sqrt(x)"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/green" />
- </TableRow>
- <TableRow
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1">
- <Button
- android:id="@+id/oneButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="1"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/twoButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="2"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/threeButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="3"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/sumButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="+"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/cuberootButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="x^3"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/green" />
- </TableRow>
- <TableRow
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- tools:layout_editor_absoluteX="-207dp"
- tools:layout_editor_absoluteY="639dp">
- <Button
- android:id="@+id/zeroButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="0"
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/nothing"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/commaButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text=","
- android:onClick="clickNumber"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/equalsButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="="
- android:onClick="showResult"
- android:textSize="20sp"
- app:backgroundTint="@color/light_gray" />
- <Button
- android:id="@+id/squarerootButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/background_buttons"
- android:text="x^2"
- android:onClick="clickOperator"
- android:textSize="20sp"
- app:backgroundTint="@color/green" />
- </TableRow>
- </TableLayout>
- <TextView
- android:id="@+id/result"
- android:layout_width="0dp"
- android:layout_height="70dp"
- android:background="@color/blue"
- android:text="0"
- android:textStyle="bold"
- android:textAlignment="viewEnd"
- android:textColor="@color/white"
- android:textSize="45sp"
- app:layout_constraintBottom_toTopOf="@+id/tableLayout"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="1.0"
- tools:ignore="TextContrastCheck" />
- <TextView
- android:id="@+id/workings"
- android:layout_width="0dp"
- android:layout_height="50dp"
- android:text=""
- android:textAlignment="viewEnd"
- android:textColor="@color/white"
- android:textSize="30sp"
- app:layout_constraintBottom_toTopOf="@+id/result"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.444" />
- </androidx.constraintlayout.widget.ConstraintLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement