Commit e11caf13 authored by milosic.jan1@scptuj.si's avatar milosic.jan1@scptuj.si
Browse files

update

parent db58036e
......@@ -5,6 +5,7 @@
<map>
<entry key="..\:/AndroidStudioProjects/app/src/main/res/drawable/circle.xml" value="0.590625" />
<entry key="..\:/AndroidStudioProjects/app/src/main/res/layout/activity_main.xml" value="0.5" />
<entry key="app/src/main/res/drawable/circle.xml" value="0.37447916666666664" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.34427083333333336" />
</map>
</option>
......
......@@ -3,12 +3,124 @@ package com.example.prva4a22;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
Button one, two, three, four, five, six, seven, eight, nine, zero;
Button clear, equals;
Button add, subtract, divide, multipy;
String niz1;
EditText vnos;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
one = findViewById(R.id.oneBTN);
two = findViewById(R.id.twoBTN);
three = findViewById(R.id.threeBTN);
four = findViewById(R.id.fourBTN);
five = findViewById(R.id.fiveBTN);
six = findViewById(R.id.sixBTN);
seven = findViewById(R.id.sevenBTN);
eight = findViewById(R.id.eightBTN);
nine = findViewById(R.id.nineBTN);
zero = findViewById(R.id.zeroBTN);
vnos = findViewById(R.id.vnos);
clear = findViewById(R.id.clearBTN);
equals = findViewById(R.id.equalsBTN);
add = findViewById(R.id.addBTN);
subtract = findViewById(R.id.subtractBTN);
multipy = findViewById(R.id.multiplyBTN);
divide = findViewById(R.id.divideBTN);
}
public void One(View v){
String s = String.valueOf(vnos.getText());
vnos.setText(s + "1");
}
public void Two(View v){
String s = String.valueOf(vnos.getText());
vnos.setText(s + "2");
}
public void Three(View v){
String s = String.valueOf(vnos.getText());
vnos.setText(s + "3");
}
public void Four(View v){
String s = String.valueOf(vnos.getText());
vnos.setText(s + "4");
}
public void Five(View v){
String s = String.valueOf(vnos.getText());
vnos.setText(s + "5");
}
public void Six(View v){
String s = String.valueOf(vnos.getText());
vnos.setText(s + "6");
}
public void Seven(View v){
String s = String.valueOf(vnos.getText());
vnos.setText(s + "7");
}
public void Eight(View v){
String s = String.valueOf(vnos.getText());
vnos.setText(s + "8");
}
public void Nine(View v){
String s = String.valueOf(vnos.getText());
vnos.setText(s + "9");
}
public void Zero(View v){
String s = String.valueOf(vnos.getText());
vnos.setText(s + "0");
}
public void Clear(View v){
String s = String.valueOf(vnos.getText());
vnos.setText("");
}
public void Add(View v){
String add = String.valueOf(vnos.getText());
niz1 = String.valueOf(vnos.getText());
vnos.setText(add + "+");
}
public void Subtract(View v){
String subtract = String.valueOf(vnos.getText());
vnos.setText(subtract + "-");
}
public void Multipy(View v){
String multiply = String.valueOf(vnos.getText());
vnos.setText(multiply + "×");
}
public void Divide(View v){
String divide = String.valueOf(vnos.getText());
vnos.setText(divide + "÷");
}
}
\ No newline at end of file
......@@ -27,13 +27,15 @@
android:layout_weight="1"
android:background="@drawable/circle"
android:backgroundTint="#DD2C00"
app:backgroundTint="@null"
android:onClick="Clear"
android:text="@string/clear"
android:textColor="#ffffff"
android:textSize="24sp" />
<Button
android:id="@+id/button24"
android:id="@+id/pharenthesesBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
......@@ -41,11 +43,12 @@
android:text="@string/pharentheses"
android:background="@drawable/circle"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:layout_margin="5dp"
android:textSize="24sp"/>
<Button
android:id="@+id/button23"
android:id="@+id/exponentBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
......@@ -53,20 +56,23 @@
android:text="@string/exponent"
android:background="@drawable/circle"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:layout_margin="5dp"
android:textSize="24sp"/>
<Button
android:id="@+id/button22"
android:id="@+id/divideBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/divide"
android:background="@drawable/circle"
android:onClick="Divide"
android:text="@string/divide"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
android:textSize="24sp"
app:backgroundTint="@null" />
</TableRow>
<TableRow
......@@ -74,52 +80,60 @@
android:layout_height="match_parent">
<Button
android:id="@+id/button29"
android:id="@+id/sevenBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/seven"
android:background="@drawable/circle"
android:onClick="Seven"
android:text="@string/seven"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
app:backgroundTint="@null"
android:textSize="24sp" />
<Button
android:id="@+id/button28"
android:id="@+id/eightBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/eight"
android:background="@drawable/circle"
android:onClick="Eight"
android:text="@string/eight"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
app:backgroundTint="@null"
android:textSize="24sp" />
<Button
android:id="@+id/button27"
android:id="@+id/nineBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/nine"
android:background="@drawable/circle"
android:onClick="Nine"
android:text="@string/nine"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
app:backgroundTint="@null"
android:textSize="24sp" />
<Button
android:id="@+id/button26"
android:id="@+id/multiplyBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/multiply"
android:background="@drawable/circle"
android:onClick="Multipy"
android:text="@string/multiply"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
android:textSize="24sp"
app:backgroundTint="@null" />
</TableRow>
<TableRow
......@@ -127,52 +141,60 @@
android:layout_height="match_parent">
<Button
android:id="@+id/button33"
android:id="@+id/fourBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/four"
android:background="@drawable/circle"
android:onClick="Four"
android:text="@string/four"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
app:backgroundTint="@null"
android:textSize="24sp" />
<Button
android:id="@+id/button32"
android:id="@+id/fiveBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/five"
android:background="@drawable/circle"
android:onClick="Five"
android:text="@string/five"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
app:backgroundTint="@null"
android:textSize="24sp" />
<Button
android:id="@+id/button31"
android:id="@+id/sixBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/six"
android:background="@drawable/circle"
android:onClick="Six"
android:text="@string/six"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
app:backgroundTint="@null"
android:textSize="24sp" />
<Button
android:id="@+id/button30"
android:id="@+id/subtractBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/subtract"
android:background="@drawable/circle"
android:onClick="Subtract"
android:text="@string/subtract"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
android:textSize="24sp"
app:backgroundTint="@null" />
</TableRow>
<TableRow
......@@ -180,52 +202,60 @@
android:layout_height="match_parent">
<Button
android:id="@+id/button37"
android:id="@+id/oneBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/one"
android:background="@drawable/circle"
android:onClick="One"
android:text="@string/one"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
app:backgroundTint="@null"
android:textSize="24sp" />
<Button
android:id="@+id/button36"
android:id="@+id/twoBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/two"
android:background="@drawable/circle"
android:onClick="Two"
android:text="@string/two"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
app:backgroundTint="@null"
android:textSize="24sp" />
<Button
android:id="@+id/button35"
android:id="@+id/threeBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/three"
android:background="@drawable/circle"
android:onClick="Three"
android:text="@string/three"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
app:backgroundTint="@null"
android:textSize="24sp" />
<Button
android:id="@+id/button34"
android:id="@+id/addBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/add"
android:background="@drawable/circle"
android:onClick="Add"
android:text="@string/add"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
android:textSize="24sp"
app:backgroundTint="@null" />
</TableRow>
<TableRow
......@@ -241,20 +271,23 @@
android:text="@string/plusMinus"
android:background="@drawable/circle"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:layout_margin="5dp"
android:textSize="24sp"/>
<Button
android:id="@+id/button40"
android:id="@+id/zeroBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/zero"
android:background="@drawable/circle"
android:onClick="Zero"
android:text="@string/zero"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
app:backgroundTint="@null"
android:textSize="24sp" />
<Button
android:id="@+id/button39"
......@@ -265,20 +298,24 @@
android:text="@string/point"
android:background="@drawable/circle"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:layout_margin="5dp"
android:textSize="24sp"/>
<Button
android:id="@+id/button38"
android:id="@+id/equalsBTN"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:text="@string/equals"
android:background="@drawable/circle"
android:backgroundTint="#50c878"
android:onClick="writeBack"
android:text="@string/equals"
android:textColor="#ffffff"
android:layout_margin="5dp"
android:textSize="24sp"/>
android:textSize="24sp"
app:backgroundTint="@null" />
</TableRow>
</TableLayout>
......@@ -287,10 +324,21 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="TextView"
android:text="Kalkulator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/vnos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="88dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:backgroundTint="#43A047"/>
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment