fix layout
parent
372f34ff03
commit
591f3f9c70
|
@ -1,6 +1,7 @@
|
|||
package com.mouseboy.assignment1;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
@ -11,30 +12,13 @@ import androidx.core.view.WindowInsetsCompat;
|
|||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MainCalculatorActivity extends AppCompatActivity {
|
||||
|
||||
public static String formatDecimal(double value) {
|
||||
BigDecimal decimalValue = BigDecimal.valueOf(value);
|
||||
// I missing having decltype already
|
||||
public static final ArrayList<Integer> buttonIDs = new ArrayList<>();
|
||||
|
||||
String pattern;
|
||||
|
||||
if (decimalValue.stripTrailingZeros().scale() <= 0) {
|
||||
pattern = "#,##0";
|
||||
} else {
|
||||
pattern = "#,##0.##";
|
||||
}
|
||||
|
||||
DecimalFormat df = new DecimalFormat(pattern);
|
||||
|
||||
DecimalFormatSymbols symbols = new DecimalFormatSymbols();
|
||||
symbols.setDecimalSeparator('.');
|
||||
symbols.setGroupingSeparator(',');
|
||||
|
||||
df.setDecimalFormatSymbols(symbols);
|
||||
|
||||
return df.format(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -46,5 +30,32 @@ public class MainCalculatorActivity extends AppCompatActivity {
|
|||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||
return insets;
|
||||
});
|
||||
|
||||
// evil.
|
||||
buttonIDs.add(R.id.b0);
|
||||
buttonIDs.add(R.id.b1);
|
||||
buttonIDs.add(R.id.b2);
|
||||
buttonIDs.add(R.id.b3);
|
||||
buttonIDs.add(R.id.b4);
|
||||
buttonIDs.add(R.id.b5);
|
||||
buttonIDs.add(R.id.b6);
|
||||
buttonIDs.add(R.id.b7);
|
||||
buttonIDs.add(R.id.b8);
|
||||
buttonIDs.add(R.id.b9);
|
||||
|
||||
buttonIDs.add(R.id.bac);
|
||||
buttonIDs.add(R.id.bc);
|
||||
|
||||
buttonIDs.add(R.id.bplus);
|
||||
buttonIDs.add(R.id.bdiv);
|
||||
buttonIDs.add(R.id.bminus);
|
||||
buttonIDs.add(R.id.bmul);
|
||||
|
||||
buttonIDs.add(R.id.bdot);
|
||||
buttonIDs.add(R.id.bneg);
|
||||
buttonIDs.add(R.id.bequals);
|
||||
buttonIDs.add(R.id.bpar);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.mouseboy.assignment1.helpers;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
|
||||
public class Utils {
|
||||
|
||||
// why does java not have a nice decimal formatter
|
||||
public static String formatDecimal(double value) {
|
||||
BigDecimal decimalValue = BigDecimal.valueOf(value);
|
||||
|
||||
String pattern;
|
||||
|
||||
if (decimalValue.stripTrailingZeros().scale() <= 0) {
|
||||
pattern = "#,##0";
|
||||
} else {
|
||||
pattern = "#,##0.##";
|
||||
}
|
||||
|
||||
DecimalFormat df = new DecimalFormat(pattern);
|
||||
|
||||
DecimalFormatSymbols symbols = new DecimalFormatSymbols();
|
||||
symbols.setDecimalSeparator('.');
|
||||
symbols.setGroupingSeparator(',');
|
||||
|
||||
df.setDecimalFormatSymbols(symbols);
|
||||
|
||||
return df.format(value);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="16dp" />
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="32dp"/>
|
||||
<stroke android:width="2dp" android:color="#FF3700B3"/>
|
||||
</shape>
|
|
@ -7,52 +7,26 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:context=".MainCalculatorActivity">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/materialToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:clickable="false"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="?attr/actionBarTheme"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:subtitleTextAppearance="@style/TextAppearance.AppCompat.Large">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="Balculator"
|
||||
android:textColor="#FBFBFB"
|
||||
android:textSize="34sp" />
|
||||
</com.google.android.material.appbar.MaterialToolbar>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/alignmentLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/materialToolbar">
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/calsbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="10"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
android:layout_weight="1"/>
|
||||
android:layout_weight="1"
|
||||
android:background="?android:attr/listDivider" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/output"
|
||||
|
@ -60,241 +34,162 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="10"
|
||||
android:paddingEnd="8dp"
|
||||
android:gravity="end|center_vertical"
|
||||
android:paddingStart="8dp"
|
||||
android:gravity="end"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="" />
|
||||
|
||||
<View
|
||||
android:id="@+id/divider2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:attr/listDivider"
|
||||
android:layout_weight="1"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bs"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
android:text="S" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/br"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
android:text="R" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/ba"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
android:text="A" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bc"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
android:text="C" />
|
||||
|
||||
android:background="?android:attr/listDivider" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
style="@style/LinearLayoutStyle">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bdiv"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/operatorButtons"
|
||||
android:text="÷" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b7"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="7" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b8"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="8" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b9"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="9" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bdiv"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
android:text="÷" />
|
||||
android:id="@+id/bac"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/clearButtons"
|
||||
android:text="AC" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
style="@style/LinearLayoutStyle">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bmul"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/operatorButtons"
|
||||
android:text="*" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b4"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="4" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b5"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="5" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b6"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="6" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bmul"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
android:text="*" />
|
||||
android:id="@+id/bc"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/clearButtons"
|
||||
android:text="C" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
style="@style/LinearLayoutStyle">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bminus"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/operatorButtons"
|
||||
android:text="-" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b1"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b2"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b3"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="3" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bminus"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/bpar"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
android:text="-" />
|
||||
android:backgroundTint="@color/specialButtons"
|
||||
android:text="( )"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/row5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bdot"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
android:text="." />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b0"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
android:text="0" />
|
||||
android:paddingBottom="2dp"
|
||||
style="@style/LinearLayoutStyle">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bplus"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/operatorButtons"
|
||||
android:text="+" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bneg"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/specialButtons"
|
||||
android:text="+/-" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b0"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="0" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bdot"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/specialButtons"
|
||||
android:text="." />
|
||||
|
||||
<!-- i put equals last because it puts it close to the thumb-->
|
||||
<Button
|
||||
android:id="@+id/bequals"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:layout_weight="1"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/equalsButton"
|
||||
android:text="=" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -17,37 +17,6 @@
|
|||
android:layout_gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/titlebar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/materialToolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="#7986CB"
|
||||
android:clickable="false"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:theme="?attr/actionBarTheme">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleText"
|
||||
style="@style/TextAutoScaleStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="Balculator"
|
||||
android:textColor="#FBFBFB" />
|
||||
</com.google.android.material.appbar.MaterialToolbar>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/calsbar"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -88,25 +57,26 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/bpar"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:backgroundTint="#4DB6AC"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:layout_height="match_parent"
|
||||
android:backgroundTint="@color/specialButtons"
|
||||
android:text="( )"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bac"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/clearButtons"
|
||||
android:text="AC" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bc"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/clearButtons"
|
||||
android:text="C" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bplus"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/operatorButtons"
|
||||
android:text="+" />
|
||||
|
||||
|
@ -118,25 +88,25 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/b7"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="7" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b8"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="8" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b9"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="9" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bdiv"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/operatorButtons"
|
||||
android:text="÷" />
|
||||
|
||||
|
@ -148,25 +118,25 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/b4"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="4" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b5"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="5" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b6"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="6" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bmul"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/operatorButtons"
|
||||
android:text="*" />
|
||||
|
||||
|
@ -178,25 +148,25 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/b1"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b2"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b3"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="3" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bminus"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/operatorButtons"
|
||||
android:text="-" />
|
||||
|
||||
|
@ -208,27 +178,27 @@
|
|||
style="@style/LinearLayoutStyle">
|
||||
|
||||
<Button
|
||||
android:id="@+id/bdot"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:id="@+id/bneg"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/specialButtons"
|
||||
android:text="." />
|
||||
android:text="+/-" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/b0"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/numberButtons"
|
||||
android:text="0" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bneg"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
android:id="@+id/bdot"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/specialButtons"
|
||||
android:text="+/-" />
|
||||
android:text="." />
|
||||
|
||||
<!-- i put equals last because it puts it close to the thumb-->
|
||||
<Button
|
||||
android:id="@+id/bequals"
|
||||
style="@style/CalculatorButtonTextStyle"
|
||||
style="@style/CalculatorButtonStyle"
|
||||
android:backgroundTint="@color/equalsButton"
|
||||
android:text="=" />
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<item name="autoSizeStepGranularity">2sp</item>
|
||||
</style>
|
||||
|
||||
<style name="CalculatorButtonTextStyle">
|
||||
<style name="CalculatorButtonStyle">
|
||||
<item name="autoSizeTextType">uniform</item>
|
||||
<item name="autoSizeMinTextSize">10sp</item>
|
||||
<item name="autoSizeMaxTextSize">256sp</item>
|
||||
|
@ -19,6 +19,7 @@
|
|||
<item name="android:layout_height">match_parent</item>
|
||||
<item name="android:layout_weight">1</item>
|
||||
<item name="android:gravity">center</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="LinearLayoutStyle">
|
||||
|
|
Loading…
Reference in New Issue