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

Še malo boljše

* Malo fejt bolj efficient

* Še malo boljše
parent d0032458
......@@ -8,12 +8,6 @@ import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
Button clear, equals;
Button add, subtract, divide, multipy;
String niz1;
EditText vnos;
@Override
......@@ -22,49 +16,12 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main);
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 addNumber(View v){
String s = String.valueOf(vnos.getText());
vnos.setText(s + ((Button)v).getText().toString());
public void addText(View v){
}
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
......@@ -61,18 +61,18 @@
android:textSize="24sp"/>
<Button
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:background="@drawable/circle"
android:onClick="Divide"
android:text="@string/divide"
android:textColor="#ffffff"
android:textSize="24sp"
app:backgroundTint="@null" />
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:background="@drawable/circle"
android:onClick="addText"
android:text="@string/divide"
android:textColor="#ffffff"
android:textSize="24sp"
app:backgroundTint="@null"/>
</TableRow>
<TableRow
......@@ -87,7 +87,7 @@
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/circle"
android:onClick="addNumber"
android:onClick="addText"
android:text="@string/seven"
android:textColor="#ffffff"
app:backgroundTint="@null"
......@@ -101,7 +101,7 @@
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/circle"
android:onClick="addNumber"
android:onClick="addText"
android:text="@string/eight"
android:textColor="#ffffff"
app:backgroundTint="@null"
......@@ -115,25 +115,25 @@
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/circle"
android:onClick="addNumber"
android:onClick="addText"
android:text="@string/nine"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
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:background="@drawable/circle"
android:onClick="Multipy"
android:text="@string/multiply"
android:textColor="#ffffff"
android:textSize="24sp"
app:backgroundTint="@null" />
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:background="@drawable/circle"
android:onClick="addText"
android:text="@string/multiply"
android:textColor="#ffffff"
android:textSize="24sp"
app:backgroundTint="@null"/>
</TableRow>
<TableRow
......@@ -148,7 +148,7 @@
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/circle"
android:onClick="addNumber"
android:onClick="addText"
android:text="@string/four"
android:textColor="#ffffff"
app:backgroundTint="@null"
......@@ -162,7 +162,7 @@
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/circle"
android:onClick="addNumber"
android:onClick="addText"
android:text="@string/five"
android:textColor="#ffffff"
app:backgroundTint="@null"
......@@ -176,25 +176,25 @@
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/circle"
android:onClick="addNumber"
android:onClick="addText"
android:text="@string/six"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
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:background="@drawable/circle"
android:onClick="Subtract"
android:text="@string/subtract"
android:textColor="#ffffff"
android:textSize="24sp"
app:backgroundTint="@null" />
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:background="@drawable/circle"
android:onClick="addText"
android:text="@string/subtract"
android:textColor="#ffffff"
android:textSize="24sp"
app:backgroundTint="@null"/>
</TableRow>
<TableRow
......@@ -209,7 +209,7 @@
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/circle"
android:onClick="addNumber"
android:onClick="addText"
android:text="@string/one"
android:textColor="#ffffff"
app:backgroundTint="@null"
......@@ -223,7 +223,7 @@
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/circle"
android:onClick="addNumber"
android:onClick="addText"
android:text="@string/two"
android:textColor="#ffffff"
app:backgroundTint="@null"
......@@ -237,25 +237,25 @@
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/circle"
android:onClick="addNumber"
android:onClick="addText"
android:text="@string/three"
android:textColor="#ffffff"
app:backgroundTint="@null"
android:textSize="24sp"/>
<Button
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:background="@drawable/circle"
android:onClick="Add"
android:text="@string/add"
android:textColor="#ffffff"
android:textSize="24sp"
app:backgroundTint="@null" />
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:background="@drawable/circle"
android:onClick="addText"
android:text="@string/add"
android:textColor="#ffffff"
android:textSize="24sp"
app:backgroundTint="@null"/>
</TableRow>
<TableRow
......@@ -283,7 +283,7 @@
android:layout_margin="5dp"
android:layout_weight="1"
android:background="@drawable/circle"
android:onClick="addNumber"
android:onClick="addText"
android:text="@string/zero"
android:textColor="#ffffff"
app:backgroundTint="@null"
......
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