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,7 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
<variable
|
||||||
|
name="calc"
|
||||||
|
type="io.n0x.android.java_mot_testing.FractionCalculator" />
|
||||||
|
</data>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
@ -55,14 +62,12 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/button_div" />
|
app:layout_constraintTop_toBottomOf="@+id/button_div" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:text="@{calc.denomResult}"
|
||||||
android:id="@+id/txt_denom_result"
|
android:id="@+id/txt_denom_result"
|
||||||
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:layout_marginTop="3dp"
|
||||||
android:layout_marginBottom="412dp"
|
android:layout_marginBottom="412dp"
|
||||||
android:inputType="numberSigned"
|
|
||||||
android:numeric="integer"
|
|
||||||
android:text="TextView"
|
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textSize="34sp"
|
android:textSize="34sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
@ -72,12 +77,11 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/txt_enum_result" />
|
app:layout_constraintTop_toBottomOf="@+id/txt_enum_result" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:text="Test1234"
|
||||||
android:id="@+id/txt_enum_result"
|
android:id="@+id/txt_enum_result"
|
||||||
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="32dp"
|
||||||
android:numeric="integer"
|
|
||||||
android:text="TextView"
|
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textSize="34sp"
|
android:textSize="34sp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/txt_denom_result"
|
app:layout_constraintBottom_toTopOf="@+id/txt_denom_result"
|
||||||
@ -87,6 +91,7 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/button_div" />
|
app:layout_constraintTop_toBottomOf="@+id/button_div" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
|
android:text="@{calc.enumRight}"
|
||||||
android:id="@+id/enumRight"
|
android:id="@+id/enumRight"
|
||||||
android:layout_width="140dp"
|
android:layout_width="140dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
@ -99,7 +104,8 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/enumRight2"
|
android:text="@{calc.enumLeft}"
|
||||||
|
android:id="@+id/enumLeft"
|
||||||
android:layout_width="140dp"
|
android:layout_width="140dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_marginTop="32dp"
|
||||||
@ -111,6 +117,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
|
android:text="@{calc.denomLeft}"
|
||||||
android:id="@+id/denomLeft"
|
android:id="@+id/denomLeft"
|
||||||
android:layout_width="140dp"
|
android:layout_width="140dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
@ -120,9 +127,10 @@
|
|||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/button_mult"
|
app:layout_constraintEnd_toStartOf="@+id/button_mult"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/enumRight2" />
|
app:layout_constraintTop_toBottomOf="@+id/enumLeft" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
|
android:text="@{calc.denomRight}"
|
||||||
android:id="@+id/denomRight"
|
android:id="@+id/denomRight"
|
||||||
android:layout_width="140dp"
|
android:layout_width="140dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
@ -135,3 +143,4 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/enumRight" />
|
app:layout_constraintTop_toBottomOf="@+id/enumRight" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</layout>
|
Loading…
Reference in New Issue
Block a user