77 lines
2.9 KiB
Java
77 lines
2.9 KiB
Java
|
package com.example.clicker;
|
||
|
|
||
|
import android.os.Bundle;
|
||
|
import android.widget.Button;
|
||
|
import android.widget.EditText;
|
||
|
import android.widget.ImageView;
|
||
|
import android.widget.TextView;
|
||
|
|
||
|
import androidx.activity.EdgeToEdge;
|
||
|
import androidx.appcompat.app.AppCompatActivity;
|
||
|
import androidx.core.graphics.Insets;
|
||
|
import androidx.core.view.ViewCompat;
|
||
|
import androidx.core.view.WindowInsetsCompat;
|
||
|
|
||
|
|
||
|
|
||
|
public class MainActivity extends AppCompatActivity {
|
||
|
TextView mainText;
|
||
|
EditText ETPrimer;
|
||
|
Button minus_btn, drop_btn, btn1, btn2, btn3, btn4, btn5, btn6, btn7, btn8, btn9, btn0, btnMulti, btnDiv, btnMinus, btnPlus, btnTransfer;
|
||
|
ImageView mainBtn;
|
||
|
|
||
|
@Override
|
||
|
protected void onCreate(Bundle savedInstanceState) {
|
||
|
super.onCreate(savedInstanceState);
|
||
|
EdgeToEdge.enable(this);
|
||
|
setContentView(R.layout.activity_main);
|
||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||
|
return insets;
|
||
|
});
|
||
|
|
||
|
mainText = findViewById(R.id.mainText);
|
||
|
mainBtn = findViewById(R.id.main_btn);
|
||
|
minus_btn = findViewById(R.id.minus_btn);
|
||
|
drop_btn = findViewById(R.id.drop_btn);
|
||
|
ETPrimer=findViewById(R.id.ETPrimer);
|
||
|
btn1=findViewById(R.id.btn1);
|
||
|
btn2=findViewById(R.id.btn2);
|
||
|
btn3=findViewById(R.id.btn3);
|
||
|
btn4=findViewById(R.id.btn4);
|
||
|
btn5=findViewById(R.id.btn5);
|
||
|
btn6=findViewById(R.id.btn6);
|
||
|
btn7=findViewById(R.id.btn7);
|
||
|
btn8=findViewById(R.id.btn8);
|
||
|
btn9=findViewById(R.id.btn9);
|
||
|
btn0=findViewById(R.id.btn0);
|
||
|
btnMulti=findViewById(R.id.btnMulti);
|
||
|
btnDiv=findViewById(R.id.btnDiv);
|
||
|
btnMinus=findViewById(R.id.btnMinus);
|
||
|
btnPlus=findViewById(R.id.btnPlus);
|
||
|
btnTransfer=findViewById(R.id.btnTransfer);
|
||
|
|
||
|
Click clickListener = new Click(mainText,ETPrimer);
|
||
|
mainBtn.setOnClickListener(clickListener);
|
||
|
minus_btn.setOnClickListener(clickListener);
|
||
|
drop_btn.setOnClickListener(clickListener);
|
||
|
|
||
|
btn1.setOnClickListener(clickListener);
|
||
|
btn2.setOnClickListener(clickListener);
|
||
|
btn3.setOnClickListener(clickListener);
|
||
|
btn4.setOnClickListener(clickListener);
|
||
|
btn5.setOnClickListener(clickListener);
|
||
|
btn6.setOnClickListener(clickListener);
|
||
|
btn7.setOnClickListener(clickListener);
|
||
|
btn8.setOnClickListener(clickListener);
|
||
|
btn9.setOnClickListener(clickListener);
|
||
|
btn0.setOnClickListener(clickListener);
|
||
|
btnPlus.setOnClickListener(clickListener);
|
||
|
btnMinus.setOnClickListener(clickListener);
|
||
|
btnDiv.setOnClickListener(clickListener);
|
||
|
btnMulti.setOnClickListener(clickListener);
|
||
|
btnTransfer.setOnClickListener(clickListener);
|
||
|
|
||
|
}
|
||
|
}
|