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