Wifi trigger mgmt change

This commit is contained in:
jens 2021-05-16 02:32:31 +02:00
parent 9a8519d3e3
commit 4a18a6ed19
3 changed files with 141 additions and 0 deletions

View File

@ -188,6 +188,7 @@
<activity android:name=".ActivityManageTriggerBluetooth" /> <activity android:name=".ActivityManageTriggerBluetooth" />
<activity android:name=".ActivityMainProfiles" /> <activity android:name=".ActivityMainProfiles" />
<activity android:name=".ActivityManageProfile" /> <activity android:name=".ActivityManageProfile" />
<activity android:name=".ActivityManageTriggerWifi" />
<activity android:name=".ActivityVolumeTest" /> <activity android:name=".ActivityVolumeTest" />
<activity android:name=".ActivityPermissions"></activity> <activity android:name=".ActivityPermissions"></activity>
<activity android:name=".ActivityManageTriggerNotification"></activity> <activity android:name=".ActivityManageTriggerNotification"></activity>

View File

@ -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());
}
});
}
}

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_margin="@dimen/default_margin">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/wifiConnection"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:layout_marginBottom="@dimen/default_margin" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shrinkColumns="1"
android:stretchColumns="1" >
<TableRow>
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:paddingRight="@dimen/default_margin"
android:text="@string/state"/>
<RadioGroup
android:layout_height="wrap_content"
android:layout_width="match_parent">
<RadioButton
android:id="@+id/rbTriggerWifiConnected"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/connected" />
<RadioButton
android:id="@+id/rbTriggerWifiDisconnected"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/disconnected" />
</RadioGroup>
</TableRow>
<TableRow>
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:paddingRight="@dimen/default_margin"
android:text="@string/name"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/etTriggerWifiName"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
<Spinner
android:id="@+id/spinnerWifiList"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.appcompat.widget.LinearLayoutCompat>
</TableRow>
</TableLayout>
<Button
android:id="@+id/btriggerWifiSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save" />
</androidx.appcompat.widget.LinearLayoutCompat>