From 4a18a6ed1964a7b55348f248426f4132c9587214 Mon Sep 17 00:00:00 2001 From: jens Date: Sun, 16 May 2021 02:32:31 +0200 Subject: [PATCH] Wifi trigger mgmt change --- app/src/apkFlavor/AndroidManifest.xml | 1 + .../ActivityManageTriggerWifi.java | 55 ++++++++++++ .../layout/activity_manage_trigger_wifi.xml | 85 +++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 app/src/main/java/com/jens/automation2/ActivityManageTriggerWifi.java create mode 100644 app/src/main/res/layout/activity_manage_trigger_wifi.xml diff --git a/app/src/apkFlavor/AndroidManifest.xml b/app/src/apkFlavor/AndroidManifest.xml index 7ec926c8..e553a812 100644 --- a/app/src/apkFlavor/AndroidManifest.xml +++ b/app/src/apkFlavor/AndroidManifest.xml @@ -188,6 +188,7 @@ + diff --git a/app/src/main/java/com/jens/automation2/ActivityManageTriggerWifi.java b/app/src/main/java/com/jens/automation2/ActivityManageTriggerWifi.java new file mode 100644 index 00000000..23565e51 --- /dev/null +++ b/app/src/main/java/com/jens/automation2/ActivityManageTriggerWifi.java @@ -0,0 +1,55 @@ +package com.jens.automation2; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.RadioButton; +import android.widget.Spinner; + +import androidx.annotation.Nullable; + +public class ActivityManageTriggerWifi extends Activity +{ + RadioButton rbTriggerWifiConnected, rbTriggerWifiDisconnected; + EditText etTriggerWifiName; + Spinner spinnerWifiList; + Button btriggerWifiSave; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_manage_trigger_wifi); + + rbTriggerWifiConnected = (RadioButton)findViewById(R.id.rbTriggerWifiConnected); + rbTriggerWifiDisconnected = (RadioButton)findViewById(R.id.rbTriggerWifiDisconnected); + etTriggerWifiName = (EditText) findViewById(R.id.etTriggerWifiName); + spinnerWifiList = (Spinner) findViewById(R.id. spinnerWifiList); + btriggerWifiSave = (Button) findViewById(R.id. btriggerWifiSave); + + if(getIntent().hasExtra("edit")) + { + boolean connected = getIntent().getBooleanExtra("wifiState", false); + String wifiName = getIntent().getStringExtra("wifiName"); + + rbTriggerWifiConnected.setChecked(connected); + rbTriggerWifiDisconnected.setChecked(!connected); + + etTriggerWifiName.setText(wifiName); + } + + btriggerWifiSave.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + Intent response = new Intent(); + response.putExtra("wifiState", rbTriggerWifiConnected.isChecked()); + response.putExtra("wifiName", etTriggerWifiName.getText().toString()); + } + }); + } +} diff --git a/app/src/main/res/layout/activity_manage_trigger_wifi.xml b/app/src/main/res/layout/activity_manage_trigger_wifi.xml new file mode 100644 index 00000000..0ba29bec --- /dev/null +++ b/app/src/main/res/layout/activity_manage_trigger_wifi.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +