Super geile Änderungen
parent
3187ea3aec
commit
73ea482776
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="PROJECT_FILES" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,59 @@
|
||||
package io.n0x.android.java_mot_testing;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class FractionCalculator{
|
||||
|
||||
private static final String TAG = FractionCalculator.class.getName();
|
||||
|
||||
private int enumLeft;
|
||||
private int denomLeft;
|
||||
private int enumRight;
|
||||
private int denomRight;
|
||||
public int enumResult;
|
||||
public int denomResult;
|
||||
|
||||
|
||||
protected void doStuff() {
|
||||
Log.d(TAG, "FractionCalculator started");
|
||||
}
|
||||
|
||||
public int getEnumLeft() {
|
||||
return enumLeft;
|
||||
}
|
||||
|
||||
public void setEnumLeft(int enumLeft) {
|
||||
this.enumLeft = enumLeft;
|
||||
}
|
||||
|
||||
public int getDenomLeft() {
|
||||
return denomLeft;
|
||||
}
|
||||
|
||||
public void setDenomLeft(int denomLeft) {
|
||||
this.denomLeft = denomLeft;
|
||||
}
|
||||
|
||||
public int getEnumRight() {
|
||||
return enumRight;
|
||||
}
|
||||
|
||||
public void setEnumRight(int enumRight) {
|
||||
this.enumRight = enumRight;
|
||||
}
|
||||
|
||||
public int getDenomRight() {
|
||||
return denomRight;
|
||||
}
|
||||
|
||||
public void setDenomRight(int denomRight) {
|
||||
this.denomRight = denomRight;
|
||||
}
|
||||
|
||||
// GETTER AND SETTER
|
||||
|
||||
}
|
@ -1,19 +1,54 @@
|
||||
package io.n0x.android.java_mot_testing;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import io.n0x.android.java_mot_testing.ex9.FractionCalculator;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.databinding.BindingAdapter;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
||||
private static final String TAG = MainActivity.class.getName();
|
||||
|
||||
|
||||
|
||||
FractionCalculator calc = new FractionCalculator();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.ex9_data_binding);
|
||||
Log.d(TAG, "MainActivity started");
|
||||
|
||||
Intent intent = new Intent(this, FractionCalculator.class);
|
||||
startActivity(intent);
|
||||
|
||||
// Button Listeners
|
||||
findViewById(R.id.button_add).setOnClickListener(this);
|
||||
|
||||
calc.doStuff();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.button_add) {
|
||||
|
||||
TextView textView = findViewById(R.id.txt_enum_result);
|
||||
textView.setText("10");
|
||||
|
||||
calc.enumResult = 5;
|
||||
calc.denomResult = 6;
|
||||
|
||||
//calc.setDenomLeft(10);
|
||||
/*
|
||||
enumLeft = 1;
|
||||
denomLeft = 2;
|
||||
enumRight = 3;
|
||||
denomRight = 4;
|
||||
|
||||
|
||||
//*/
|
||||
}
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package io.n0x.android.java_mot_testing.ex9;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import io.n0x.android.java_mot_testing.R;
|
||||
|
||||
public class FractionCalculator extends Activity{
|
||||
|
||||
private static final String TAG = FractionCalculator.class.getName();
|
||||
|
||||
private TextView txt_enum_left;
|
||||
private TextView txt_denom_left;
|
||||
private TextView txt_enum_right;
|
||||
private TextView txt_denom_right;
|
||||
private TextView txt_enum_result;
|
||||
private TextView txt_denom_result;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.ex9_data_binding);
|
||||
Log.d(TAG, "FractionCalculator started");
|
||||
|
||||
/*
|
||||
txt_enum_left = (TextView) findViewById(R.id.txt_enum_left);
|
||||
txt_denom_left = (TextView) findViewById(R.id.txt_denom_left);
|
||||
txt_enum_right = (TextView) findViewById(R.id.txt_enum_right);
|
||||
txt_denom_right = (TextView) findViewById(R.id.txt_denom_right);
|
||||
txt_enum_result = (TextView) findViewById(R.id.txt_enum_result);
|
||||
txt_denom_result = (TextView) findViewById(R.id.txt_denom_result);
|
||||
|
||||
// Set all fields to 0
|
||||
txt_enum_left.setText("0");
|
||||
txt_denom_left.setText("0");
|
||||
txt_enum_right.setText("0");
|
||||
txt_denom_right.setText("0");
|
||||
txt_enum_result.setText("0");
|
||||
txt_denom_result.setText("0");
|
||||
//*/
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue