diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
index 4ea7061..828dc84 100644
--- a/.idea/deploymentTargetDropDown.xml
+++ b/.idea/deploymentTargetDropDown.xml
@@ -18,6 +18,9 @@
+
+
+
diff --git a/app/src/main/java/uk/kagurach/android101/Kaculate.kt b/app/src/main/java/uk/kagurach/android101/Kaculate.kt
new file mode 100644
index 0000000..b75d025
--- /dev/null
+++ b/app/src/main/java/uk/kagurach/android101/Kaculate.kt
@@ -0,0 +1,7 @@
+package uk.kagurach.android101
+
+import android.content.Context
+
+fun Kaculate(src: String,ctx :Context) : String{
+ return ""
+}
\ No newline at end of file
diff --git a/app/src/main/java/uk/kagurach/android101/Page3.java b/app/src/main/java/uk/kagurach/android101/Page3.java
index 5191650..f41c849 100644
--- a/app/src/main/java/uk/kagurach/android101/Page3.java
+++ b/app/src/main/java/uk/kagurach/android101/Page3.java
@@ -1,6 +1,11 @@
package uk.kagurach.android101;
+import static uk.kagurach.android101.KaculateKt.Kaculate;
+
import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
@@ -8,6 +13,7 @@ import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
+import uk.kagurach.android101.KaculateKt;
public class Page3 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -19,6 +25,57 @@ public class Page3 extends AppCompatActivity {
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
+ findViewById(R.id.P3_0).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3_1).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3_2).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3_3).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3_4).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3_5).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3_6).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3_7).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3_8).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3_9).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3BK).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3X).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3Plus).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3Minus).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3Div).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3Dot).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3CE).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3ChengFang).setOnClickListener(new CalculateOnClickListener());
+ findViewById(R.id.P3Result).setOnClickListener(new CalculateOnClickListener());
}
+
+
+ class CalculateOnClickListener implements View.OnClickListener{
+ @Override
+ public void onClick(View v){
+ TextView tv = findViewById(R.id.P3CalcResult);
+ String s = tv.getText().toString();
+ String o = ((Button)v).getText().toString();
+ switch (o){
+ case "退格":
+ if (!s.isEmpty()){
+ s = s.substring(0,s.length()-1);
+ }
+ break;
+ case "CE":
+ s = "";
+ break;
+ case "=":
+ calc();
+ return;
+ default:
+ s += o;
+ }
+ tv.setText(s);
+ }
+ }
+
+ private void calc(){
+ TextView textView = findViewById(R.id.P3Result);
+ String result = Kaculate(textView.getText().toString(),this);
+ textView.setText(result);
+ }
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_page3.xml b/app/src/main/res/layout/activity_page3.xml
index 3b64a03..88230d4 100644
--- a/app/src/main/res/layout/activity_page3.xml
+++ b/app/src/main/res/layout/activity_page3.xml
@@ -7,4 +7,195 @@
android:layout_height="match_parent"
tools:context=".Page3">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 46b4d3a..f7b0d26 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -7,4 +7,6 @@
设置颜色
设置
设置文本
+ Kaculate
+ 退格
\ No newline at end of file