Super geile Änderungen
This commit is contained in:
parent
3187ea3aec
commit
73ea482776
6
.idea/discord.xml
Normal file
6
.idea/discord.xml
Normal file
@ -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>
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="false" project-jdk-name="15" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_15_PREVIEW" default="false" project-jdk-name="15" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
@ -26,6 +26,10 @@ android {
|
|||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_8
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
dataBinding true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -36,4 +40,5 @@ dependencies {
|
|||||||
testImplementation 'junit:junit:4.+'
|
testImplementation 'junit:junit:4.+'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||||
|
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.Java_mot_testing">
|
android:theme="@style/Theme.Java_mot_testing">
|
||||||
|
|
||||||
<activity android:name=".ex9.FractionCalculator"/>
|
<activity android:name=".FractionCalculator"/>
|
||||||
|
|
||||||
<activity android:name=".MainActivity">
|
<activity android:name=".MainActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -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;
|
package io.n0x.android.java_mot_testing;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
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
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(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();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,137 +1,146 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<Button
|
<data>
|
||||||
android:id="@+id/button_add"
|
<variable
|
||||||
android:layout_width="wrap_content"
|
name="calc"
|
||||||
android:layout_height="wrap_content"
|
type="io.n0x.android.java_mot_testing.FractionCalculator" />
|
||||||
android:text="+"
|
</data>
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<Button
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/button_sub"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="match_parent">
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="-"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/button_add" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button_mult"
|
android:id="@+id/button_add"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="*"
|
android:text="+"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/button_sub" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button_div"
|
android:id="@+id/button_sub"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="/"
|
android:text="-"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.501"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintTop_toBottomOf="@+id/button_add" />
|
||||||
app:layout_constraintTop_toBottomOf="@+id/button_mult" />
|
|
||||||
|
|
||||||
<TextView
|
<Button
|
||||||
android:id="@+id/txt_equals"
|
android:id="@+id/button_mult"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="48dp"
|
android:text="*"
|
||||||
android:text="="
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:textSize="34sp"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintTop_toBottomOf="@+id/button_sub" />
|
||||||
app:layout_constraintHorizontal_bias="0.183"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/button_div" />
|
|
||||||
|
|
||||||
<TextView
|
<Button
|
||||||
android:id="@+id/txt_denom_result"
|
android:id="@+id/button_div"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="3dp"
|
android:text="/"
|
||||||
android:layout_marginBottom="412dp"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:inputType="numberSigned"
|
app:layout_constraintHorizontal_bias="0.501"
|
||||||
android:numeric="integer"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:text="TextView"
|
app:layout_constraintTop_toBottomOf="@+id/button_mult" />
|
||||||
android:textAlignment="center"
|
|
||||||
android:textSize="34sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintHorizontal_bias="0.247"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/txt_equals"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/txt_enum_result" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/txt_enum_result"
|
android:id="@+id/txt_equals"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_marginTop="48dp"
|
||||||
android:numeric="integer"
|
android:text="="
|
||||||
android:text="TextView"
|
android:textSize="34sp"
|
||||||
android:textAlignment="center"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:textSize="34sp"
|
app:layout_constraintHorizontal_bias="0.183"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/txt_denom_result"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintTop_toBottomOf="@+id/button_div" />
|
||||||
app:layout_constraintHorizontal_bias="0.247"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/txt_equals"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/button_div" />
|
|
||||||
|
|
||||||
<EditText
|
<TextView
|
||||||
android:id="@+id/enumRight"
|
android:text="@{calc.denomResult}"
|
||||||
android:layout_width="140dp"
|
android:id="@+id/txt_denom_result"
|
||||||
android:layout_height="50dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_height="wrap_content"
|
||||||
android:ems="10"
|
android:layout_marginTop="3dp"
|
||||||
android:hint="Zähler"
|
android:layout_marginBottom="412dp"
|
||||||
android:inputType="numberSigned"
|
android:textAlignment="center"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:textSize="34sp"
|
||||||
app:layout_constraintStart_toEndOf="@+id/button_add"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.247"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/txt_equals"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/txt_enum_result" />
|
||||||
|
|
||||||
<EditText
|
<TextView
|
||||||
android:id="@+id/enumRight2"
|
android:text="Test1234"
|
||||||
android:layout_width="140dp"
|
android:id="@+id/txt_enum_result"
|
||||||
android:layout_height="50dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_height="wrap_content"
|
||||||
android:ems="10"
|
android:layout_marginTop="32dp"
|
||||||
android:hint="Zähler"
|
android:textAlignment="center"
|
||||||
android:inputType="numberSigned"
|
android:textSize="34sp"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/button_add"
|
app:layout_constraintBottom_toTopOf="@+id/txt_denom_result"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintHorizontal_bias="0.247"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/txt_equals"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/button_div" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/denomLeft"
|
android:text="@{calc.enumRight}"
|
||||||
android:layout_width="140dp"
|
android:id="@+id/enumRight"
|
||||||
android:layout_height="50dp"
|
android:layout_width="140dp"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_height="50dp"
|
||||||
android:ems="10"
|
android:layout_marginTop="32dp"
|
||||||
android:hint="Nenner"
|
android:ems="10"
|
||||||
android:inputType="number"
|
android:hint="Zähler"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/button_mult"
|
android:inputType="numberSigned"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/enumRight2" />
|
app:layout_constraintStart_toEndOf="@+id/button_add"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/denomRight"
|
android:text="@{calc.enumLeft}"
|
||||||
android:layout_width="140dp"
|
android:id="@+id/enumLeft"
|
||||||
android:layout_height="50dp"
|
android:layout_width="140dp"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_height="50dp"
|
||||||
android:ems="10"
|
android:layout_marginTop="32dp"
|
||||||
android:hint="Nenner"
|
android:ems="10"
|
||||||
android:inputType="number"
|
android:hint="Zähler"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
android:inputType="numberSigned"
|
||||||
app:layout_constraintStart_toEndOf="@+id/button_mult"
|
app:layout_constraintEnd_toStartOf="@+id/button_add"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/enumRight" />
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
<EditText
|
||||||
|
android:text="@{calc.denomLeft}"
|
||||||
|
android:id="@+id/denomLeft"
|
||||||
|
android:layout_width="140dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="Nenner"
|
||||||
|
android:inputType="number"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/button_mult"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/enumLeft" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:text="@{calc.denomRight}"
|
||||||
|
android:id="@+id/denomRight"
|
||||||
|
android:layout_width="140dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="Nenner"
|
||||||
|
android:inputType="number"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/button_mult"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/enumRight" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</layout>
|
Loading…
Reference in New Issue
Block a user