Compare commits
3 Commits
v25.1011.1
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 539be882b5 | |||
| f267dce372 | |||
| d51147affe |
@@ -12,7 +12,7 @@ android {
|
|||||||
minSdk 26
|
minSdk 26
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "25.1011.1"
|
versionName "25.1018.1"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -12,7 +12,7 @@
|
|||||||
"filters": [],
|
"filters": [],
|
||||||
"attributes": [],
|
"attributes": [],
|
||||||
"versionCode": 1,
|
"versionCode": 1,
|
||||||
"versionName": "25.1011.1",
|
"versionName": "25.1018.1",
|
||||||
"outputFile": "app-release.apk"
|
"outputFile": "app-release.apk"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.os.Bundle;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.RadioButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@@ -13,7 +14,6 @@ import androidx.appcompat.content.res.AppCompatResources;
|
|||||||
import androidx.lifecycle.ProcessLifecycleOwner;
|
import androidx.lifecycle.ProcessLifecycleOwner;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.haussteuerung.helper.Blutdruck;
|
|
||||||
import com.haussteuerung.helper.Temperatur;
|
import com.haussteuerung.helper.Temperatur;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -22,15 +22,8 @@ import java.time.format.DateTimeFormatter;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class activityDoris extends AppCompatActivity {
|
public class activityDoris extends AppCompatActivity {
|
||||||
Button buttonSend, zeitBlutdruck, zeitFiebertemp;
|
|
||||||
int hourBlutdruck = 0, minuteBlutdruck = 0, hourFiebertemp = 0, minuteFiebertemp = 0;
|
|
||||||
static String werteBlutdruck = "";
|
|
||||||
TextView textSYS, textDIA, textFiebertemp;
|
|
||||||
LocalDateTime datetime = LocalDateTime.now();
|
|
||||||
DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
||||||
String formattedDate = datetime.format(dateTimeFormat);
|
|
||||||
Gson gson = new Gson();
|
|
||||||
String msg;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -44,44 +37,49 @@ public class activityDoris extends AppCompatActivity {
|
|||||||
setContentView(R.layout.activity_doris);
|
setContentView(R.layout.activity_doris);
|
||||||
setTitle("Haussteuerung - Doris");
|
setTitle("Haussteuerung - Doris");
|
||||||
|
|
||||||
buttonSend = findViewById(R.id.buttonSend);
|
LocalDateTime datetime = LocalDateTime.now();
|
||||||
|
DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
|
||||||
// Blutdruck ---------------------------------------
|
// Tablette + Essen -------------------------------
|
||||||
zeitBlutdruck = findViewById(R.id.zeitBlutdruck);
|
Button buttonTablette = findViewById(R.id.buttonTablette);
|
||||||
CheckBox checkBlutdruck = findViewById(R.id.checkBlutdruck);
|
Button buttonSendEssen = findViewById(R.id.buttonSendEssen);
|
||||||
textSYS = findViewById(R.id.textSYS);
|
RadioButton doris_fruehstueck = findViewById(R.id.doris_fruehstueck);
|
||||||
textDIA = findViewById(R.id.textDIA);
|
RadioButton doris_mittagessen = findViewById(R.id.doris_mittagessen);
|
||||||
TextView tv_SYS = findViewById(R.id.tvSYS);
|
RadioButton doris_abendessen = findViewById(R.id.doris_abendessen);
|
||||||
TextView tv_DIA = findViewById(R.id.tvDIA);
|
RadioButton doris_snack = findViewById(R.id.doris_snack);
|
||||||
hourBlutdruck = datetime.getHour();
|
|
||||||
minuteBlutdruck = datetime.getMinute();
|
|
||||||
zeitBlutdruck.setText(String.format(Locale.getDefault(), "%02d:%02d", datetime.getHour(), datetime.getMinute()));
|
|
||||||
zeitBlutdruck.setOnClickListener(v -> timePickerDialog(zeitBlutdruck));
|
|
||||||
|
|
||||||
checkBlutdruck.setOnClickListener(view -> {
|
buttonTablette.setOnClickListener(view -> {
|
||||||
if (checkBlutdruck.isChecked()) {
|
MqttClient.publish("cmnd/Haussteuerung/Doris/Tabletten", "Tablette");
|
||||||
zeitBlutdruck.setEnabled(true);
|
Toast.makeText(activityDoris.this, "Tablette genommen. Gespeichert!", Toast.LENGTH_LONG).show();
|
||||||
tv_SYS.setEnabled(true);
|
});
|
||||||
tv_DIA.setEnabled(true);
|
|
||||||
textSYS.setEnabled(true);
|
buttonSendEssen.setOnClickListener(view -> {
|
||||||
textDIA.setEnabled(true);
|
if (doris_fruehstueck.isChecked()) {
|
||||||
|
MqttClient.publish("cmnd/Haussteuerung/Doris/Tabletten", "Frühstück");
|
||||||
|
Toast.makeText(activityDoris.this, "Frühstück. Gespeichert!", Toast.LENGTH_LONG).show();
|
||||||
|
} else if (doris_mittagessen.isChecked()) {
|
||||||
|
MqttClient.publish("cmnd/Haussteuerung/Doris/Tabletten", "Mittagessen");
|
||||||
|
Toast.makeText(activityDoris.this, "Mittagessen. Gespeichert!", Toast.LENGTH_LONG).show();
|
||||||
|
} else if (doris_abendessen.isChecked()) {
|
||||||
|
MqttClient.publish("cmnd/Haussteuerung/Doris/Tabletten", "Abendessen");
|
||||||
|
Toast.makeText(activityDoris.this, "Abendessen. Gespeichert!", Toast.LENGTH_LONG).show();
|
||||||
|
} else if (doris_snack.isChecked()) {
|
||||||
|
MqttClient.publish("cmnd/Haussteuerung/Doris/Tabletten", "Snack");
|
||||||
|
Toast.makeText(activityDoris.this, "Snack. Gespeichert!", Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
zeitBlutdruck.setEnabled(false);
|
Toast.makeText(activityDoris.this, "Bitte eine Mahlzeit auswählen.", Toast.LENGTH_LONG).show();
|
||||||
tv_SYS.setEnabled(false);
|
|
||||||
tv_DIA.setEnabled(false);
|
|
||||||
textSYS.setEnabled(false);
|
|
||||||
textDIA.setEnabled(false);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Fiebertemperatur --------------------------------
|
// Fiebertemperatur --------------------------------
|
||||||
zeitFiebertemp = findViewById(R.id.zeitFiebertemp);
|
Button zeitFiebertemp = findViewById(R.id.zeitFiebertemp);
|
||||||
CheckBox checkFiebertemp = findViewById(R.id.checkFiebertemp);
|
CheckBox checkFiebertemp = findViewById(R.id.checkFiebertemp);
|
||||||
TextView tvFiebertemp = findViewById(R.id.tvFiebertemp);
|
TextView tvFiebertemp = findViewById(R.id.tvFiebertemp);
|
||||||
textFiebertemp = findViewById(R.id.textFiebertemp);
|
TextView textFiebertemp = findViewById(R.id.textFiebertemp);
|
||||||
hourFiebertemp = datetime.getHour();
|
|
||||||
minuteFiebertemp = datetime.getMinute();
|
int hourFiebertemp = datetime.getHour();
|
||||||
|
int minuteFiebertemp = datetime.getMinute();
|
||||||
|
|
||||||
zeitFiebertemp.setText(String.format(Locale.getDefault(), "%02d:%02d", datetime.getHour(), datetime.getMinute()));
|
zeitFiebertemp.setText(String.format(Locale.getDefault(), "%02d:%02d", datetime.getHour(), datetime.getMinute()));
|
||||||
zeitFiebertemp.setOnClickListener(v -> timePickerDialog(zeitFiebertemp));
|
zeitFiebertemp.setOnClickListener(v -> timePickerDialog(zeitFiebertemp));
|
||||||
|
|
||||||
@@ -98,21 +96,8 @@ public class activityDoris extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Send-Button -------------------------------------
|
// Send-Button -------------------------------------
|
||||||
|
Button buttonSend = findViewById(R.id.buttonSend);
|
||||||
buttonSend.setOnClickListener(view -> {
|
buttonSend.setOnClickListener(view -> {
|
||||||
boolean setBlutdruck = false;
|
|
||||||
if (checkBlutdruck.isChecked() && (textSYS.getText().length() == 0 || textDIA.getText().length() == 0)) {
|
|
||||||
Toast.makeText(activityDoris.this, "Bitte alle Blutdruck-Werte ausfüllen!", Toast.LENGTH_LONG).show();
|
|
||||||
} else if (checkBlutdruck.isChecked() && (textSYS.getText().length() > 0 || textDIA.getText().length() > 0)) {
|
|
||||||
String hour = Integer.toString(hourBlutdruck);
|
|
||||||
String minute = Integer.toString(minuteBlutdruck);
|
|
||||||
String sys = textSYS.getText().toString();
|
|
||||||
String dia = textDIA.getText().toString();
|
|
||||||
msg = gson.toJson(new Blutdruck(MainActivity.ID, formattedDate + " " + hour + ":" + minute + ":00", sys, dia));
|
|
||||||
MqttClient.publish("cmnd/Haussteuerung/Doris/Blutdruck", msg);
|
|
||||||
setBlutdruck = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean setFiebertemp = false;
|
boolean setFiebertemp = false;
|
||||||
if (checkFiebertemp.isChecked() && (textFiebertemp.getText().length() == 0)) {
|
if (checkFiebertemp.isChecked() && (textFiebertemp.getText().length() == 0)) {
|
||||||
Toast.makeText(activityDoris.this, "Bitte einen Temperaturwert eingeben!", Toast.LENGTH_LONG).show();
|
Toast.makeText(activityDoris.this, "Bitte einen Temperaturwert eingeben!", Toast.LENGTH_LONG).show();
|
||||||
@@ -121,12 +106,15 @@ public class activityDoris extends AppCompatActivity {
|
|||||||
String hour = Integer.toString(hourFiebertemp);
|
String hour = Integer.toString(hourFiebertemp);
|
||||||
String minute = Integer.toString(minuteFiebertemp);
|
String minute = Integer.toString(minuteFiebertemp);
|
||||||
String fiebertemp = textFiebertemp.getText().toString();
|
String fiebertemp = textFiebertemp.getText().toString();
|
||||||
msg = gson.toJson(new Temperatur(MainActivity.ID, formattedDate + " " + hour + ":" + minute + ":00", fiebertemp));
|
|
||||||
|
Gson gson = new Gson();
|
||||||
|
String msg = gson.toJson(new Temperatur(MainActivity.ID, formattedDate + " " + hour + ":" + minute + ":00", fiebertemp));
|
||||||
|
|
||||||
MqttClient.publish("cmnd/Haussteuerung/Doris/Temperatur", msg);
|
MqttClient.publish("cmnd/Haussteuerung/Doris/Temperatur", msg);
|
||||||
Log.d("Doris", msg);
|
|
||||||
setFiebertemp = true;
|
setFiebertemp = true;
|
||||||
}
|
}
|
||||||
if (setBlutdruck || setFiebertemp) {
|
if (setFiebertemp) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.haussteuerung.helper;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
public class Blutdruck {
|
|
||||||
@SerializedName("DeviceID")
|
|
||||||
private final String deviceId;
|
|
||||||
@SerializedName("Datum")
|
|
||||||
private final String datum;
|
|
||||||
@SerializedName("SYS")
|
|
||||||
private final String sys;
|
|
||||||
@SerializedName("DIA")
|
|
||||||
private final String dia;
|
|
||||||
|
|
||||||
public Blutdruck(String deviceId, String datum, String sys, String dia) {
|
|
||||||
this.deviceId = deviceId;
|
|
||||||
this.datum = datum;
|
|
||||||
this.sys = sys;
|
|
||||||
this.dia = dia;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,105 +23,87 @@
|
|||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<CheckBox
|
<RadioGroup
|
||||||
android:id="@+id/checkBlutdruck"
|
android:id="@+id/radiogroupEssen"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="90dp"
|
android:layout_height="195dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="7dp"
|
||||||
android:text="@string/blutdruck"
|
android:text="@string/blutdruck"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textSize="23sp"
|
android:textSize="23sp"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/zeitBlutdruck"
|
app:layout_constraintEnd_toStartOf="@+id/buttonTablette"
|
||||||
app:layout_constraintHorizontal_chainStyle="packed"
|
app:layout_constraintHorizontal_chainStyle="packed"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/doris_fruehstueck"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:text="@string/fruehstueck"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/doris_mittagessen"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginTop="0dp"
|
||||||
|
android:text="@string/mittagessen"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/doris_abendessen"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginTop="0dp"
|
||||||
|
android:text="@string/abendessen"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/doris_snack"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginTop="0dp"
|
||||||
|
android:text="@string/snack"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
android:id="@+id/zeitBlutdruck"
|
android:id="@+id/buttonTablette"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="90dp"
|
android:layout_height="80dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
android:background="@drawable/button_ww"
|
android:background="@drawable/button_text_color"
|
||||||
android:enabled="false"
|
android:enabled="true"
|
||||||
|
android:text="Tablette"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="30sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/checkBlutdruck"
|
app:layout_constraintStart_toEndOf="@+id/radiogroupEssen"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:ignore="DuplicateSpeakableTextCheck,SpeakableTextPresentCheck" />
|
tools:ignore="DuplicateSpeakableTextCheck,SpeakableTextPresentCheck" />
|
||||||
|
|
||||||
<TextView
|
<androidx.appcompat.widget.AppCompatButton
|
||||||
android:id="@+id/tvSYS"
|
android:id="@+id/buttonSendEssen"
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="60dp"
|
|
||||||
android:layout_marginTop="35dp"
|
|
||||||
android:enabled="false"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/sys"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="28sp"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/textSYS"
|
|
||||||
app:layout_constraintHorizontal_chainStyle="packed"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/checkBlutdruck" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/textSYS"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="80dp"
|
android:layout_height="80dp"
|
||||||
android:layout_marginTop="25dp"
|
|
||||||
android:autofillHints="120"
|
|
||||||
android:backgroundTint="@color/dark_grey"
|
|
||||||
android:ems="10"
|
|
||||||
android:enabled="false"
|
|
||||||
android:hint="@string/_120"
|
|
||||||
android:inputType="phone"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textColorHint="@color/dark_grey"
|
|
||||||
android:textSize="30sp"
|
|
||||||
android:visibility="visible"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/tvDIA"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/tvSYS"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/checkBlutdruck"
|
|
||||||
tools:ignore="TextContrastCheck,DuplicateSpeakableTextCheck" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvDIA"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="60dp"
|
|
||||||
android:layout_marginTop="35dp"
|
|
||||||
android:enabled="false"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/dia"
|
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textSize="28sp"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/textDIA"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/textSYS"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/checkBlutdruck" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/textDIA"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="80dp"
|
|
||||||
android:layout_marginTop="25dp"
|
|
||||||
android:layout_marginEnd="20dp"
|
android:layout_marginEnd="20dp"
|
||||||
android:autofillHints="80"
|
android:background="@drawable/button_text_color"
|
||||||
android:backgroundTint="@color/dark_grey"
|
android:enabled="true"
|
||||||
android:ems="10"
|
android:textColor="@color/white"
|
||||||
android:enabled="false"
|
android:text="@string/absenden"
|
||||||
android:hint="@string/_80"
|
android:textSize="20sp"
|
||||||
android:inputType="phone"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
android:textColor="@color/black"
|
|
||||||
android:textColorHint="@color/dark_grey"
|
|
||||||
android:textSize="30sp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/tvDIA"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/zeitBlutdruck"
|
app:layout_constraintStart_toEndOf="@+id/radiogroupEssen"
|
||||||
tools:ignore="TextContrastCheck" />
|
app:layout_constraintTop_toBottomOf="@+id/buttonTablette"
|
||||||
|
tools:ignore="DuplicateSpeakableTextCheck,SpeakableTextPresentCheck" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|||||||
@@ -148,4 +148,8 @@
|
|||||||
<string name="growatt_ein">Growatt ein.</string>
|
<string name="growatt_ein">Growatt ein.</string>
|
||||||
<string name="growatt_aus">Growatt aus.</string>
|
<string name="growatt_aus">Growatt aus.</string>
|
||||||
<string name="pc_flo">PC Flo</string>
|
<string name="pc_flo">PC Flo</string>
|
||||||
|
<string name="fruehstueck">Frühstück</string>
|
||||||
|
<string name="mittagessen">Mittagessen</string>
|
||||||
|
<string name="abendessen">Abendessen</string>
|
||||||
|
<string name="snack">Snack</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user