Unverified Commit d0032458 authored by Anej's avatar Anej Committed by GitHub
Browse files

Malo fejt bolj efficient (#1)

parent e11caf13
prva4a22
\ No newline at end of file
......@@ -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="..\:/Users/Anej/Desktop/Random Stuff/Mili/AndroidStudioProjects/app/src/main/res/layout/activity_main.xml" value="0.19635416666666666" />
<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>
......
......@@ -9,7 +9,6 @@ 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;
......@@ -22,16 +21,6 @@ public class MainActivity extends AppCompatActivity {
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);
......@@ -44,54 +33,9 @@ public class MainActivity extends AppCompatActivity {
}
public void One(View v){
public void addNumber(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");
vnos.setText(s + ((Button)v).getText().toString());
}
public void Clear(View v){
......
......@@ -80,46 +80,46 @@
android:layout_height="match_parent">
<Button
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:background="@drawable/circle"
android:onClick="Seven"
android:text="@string/seven"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp" />
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:background="@drawable/circle"
android:onClick="addNumber"
android:text="@string/seven"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
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:background="@drawable/circle"
android:onClick="Eight"
android:text="@string/eight"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp" />
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:background="@drawable/circle"
android:onClick="addNumber"
android:text="@string/eight"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
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:background="@drawable/circle"
android:onClick="Nine"
android:text="@string/nine"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp" />
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:background="@drawable/circle"
android:onClick="addNumber"
android:text="@string/nine"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
android:id="@+id/multiplyBTN"
......@@ -141,46 +141,46 @@
android:layout_height="match_parent">
<Button
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:background="@drawable/circle"
android:onClick="Four"
android:text="@string/four"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp" />
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:background="@drawable/circle"
android:onClick="addNumber"
android:text="@string/four"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
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:background="@drawable/circle"
android:onClick="Five"
android:text="@string/five"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp" />
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:background="@drawable/circle"
android:onClick="addNumber"
android:text="@string/five"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
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:background="@drawable/circle"
android:onClick="Six"
android:text="@string/six"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp" />
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:background="@drawable/circle"
android:onClick="addNumber"
android:text="@string/six"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
android:id="@+id/subtractBTN"
......@@ -202,46 +202,46 @@
android:layout_height="match_parent">
<Button
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:background="@drawable/circle"
android:onClick="One"
android:text="@string/one"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp" />
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:background="@drawable/circle"
android:onClick="addNumber"
android:text="@string/one"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
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:background="@drawable/circle"
android:onClick="Two"
android:text="@string/two"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp" />
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:background="@drawable/circle"
android:onClick="addNumber"
android:text="@string/two"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
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:background="@drawable/circle"
android:onClick="Three"
android:text="@string/three"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp" />
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:background="@drawable/circle"
android:onClick="addNumber"
android:text="@string/three"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
android:id="@+id/addBTN"
......@@ -276,18 +276,18 @@
android:textSize="24sp"/>
<Button
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:background="@drawable/circle"
android:onClick="Zero"
android:text="@string/zero"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp" />
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:background="@drawable/circle"
android:onClick="addNumber"
android:text="@string/zero"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
android:id="@+id/button39"
......
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