Android/app/src/main/java/com/example/clicker/MainActivity.java

43 lines
1.4 KiB
Java
Raw Normal View History

2025-03-18 11:20:56 +00:00
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;
2025-03-19 07:05:53 +00:00
Button drop_btn, minus_btn;
2025-03-18 11:20:56 +00:00
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);
drop_btn = findViewById(R.id.drop_btn);
2025-03-19 07:05:53 +00:00
minus_btn = findViewById(R.id.minus_btn);
2025-03-18 11:20:56 +00:00
2025-03-19 07:05:53 +00:00
Click clickListener = new Click(mainText);
2025-03-18 11:20:56 +00:00
mainBtn.setOnClickListener(clickListener);
drop_btn.setOnClickListener(clickListener);
2025-03-19 07:05:53 +00:00
minus_btn.setOnClickListener(clickListener);
2025-03-18 11:20:56 +00:00
}
}