Jelajahi Sumber

修改界面

xiongweixp 2 bulan lalu
induk
melakukan
ccdd3e3a6d

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>

+ 1 - 11
app/src/main/java/tech/xiongweixp/touchaction/MainActivity.kt

@@ -22,17 +22,7 @@ class MainActivity : ComponentActivity() {
         enableEdgeToEdge()
         Log.i("MainActivity", "打开APP")
         Log.i("MainActivity", intent.data.toString())
-        setContent {
-            TouchActionTheme {
-                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
-                    Greeting(
-                        name = "Android",
-                        modifier = Modifier.padding(innerPadding)
-                    )
-                }
-            }
-        }
-
+        setContentView(R.layout.mainlayout)
     }
 
     private fun hassioRequest(webhookID: String) {

+ 7 - 0
app/src/main/res/drawable/button_shape.xml

@@ -0,0 +1,7 @@
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="@color/material_dynamic_primary70"/> <!-- 按钮的背景颜色 -->
+    <corners android:radius="30dp"/> <!-- 圆角的半径 -->
+    <stroke
+            android:width="0dp"
+    /> <!-- 边框的颜色 -->
+</shape>

TEMPAT SAMPAH
app/src/main/res/drawable/computer.png


TEMPAT SAMPAH
app/src/main/res/drawable/light.png


+ 71 - 0
app/src/main/res/layout/mainlayout.xml

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout 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_height="match_parent"
+             android:theme="@style/Theme.TouchAction">
+    <androidx.constraintlayout.widget.ConstraintLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" android:id="@+id/mainLayout">
+
+        <TextView
+                android:text="配置HomeAssistant服务地址"
+                android:layout_width="286dp"
+                android:layout_height="26dp" android:id="@+id/addressTextView"
+                app:layout_constraintStart_toStartOf="parent" android:layout_marginEnd="8dp"
+                app:layout_constraintEnd_toEndOf="parent" app:layout_constraintBottom_toBottomOf="parent"
+                android:layout_marginBottom="16dp" app:layout_constraintTop_toTopOf="parent"
+                android:layout_marginTop="24dp" android:layout_marginStart="8dp"
+                app:layout_constraintHorizontal_bias="0.318" app:layout_constraintVertical_bias="0.196"/>
+        <EditText
+                android:layout_width="322dp"
+                android:layout_height="52dp"
+                android:inputType="text|textUri"
+                android:ems="10"
+                android:id="@+id/urlTextView"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                android:layout_marginStart="8dp"
+                app:layout_constraintVertical_bias="0.0"
+                android:layout_marginEnd="8dp"
+                app:layout_constraintTop_toBottomOf="@+id/addressTextView" android:layout_marginTop="8dp"
+                android:layout_marginBottom="24dp" android:text="192.168.31.45"/>
+        <RadioGroup
+                android:layout_width="wrap_content"
+                android:layout_height="82dp"
+                android:orientation="horizontal"
+                app:layout_constraintTop_toBottomOf="@+id/urlTextView"
+                app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent" android:layout_marginTop="8dp"
+                android:layout_marginStart="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp"
+                app:layout_constraintHorizontal_bias="0.144" app:layout_constraintVertical_bias="0.0"
+                android:id="@+id/radioGroup">
+            <RadioButton
+                    android:text="http       "
+                    android:layout_width="wrap_content"
+                    android:layout_height="56dp" android:id="@+id/httpRadioButton" android:checked="true"/>
+            <RadioButton
+                    android:text="https"
+                    android:layout_width="wrap_content"
+                    android:layout_height="56dp" android:id="@+id/httpsRadioButton2"/>
+        </RadioGroup>
+        <Button
+                android:text="保存"
+                android:layout_width="322dp"
+                android:layout_height="60dp" android:id="@+id/saveButton"
+                app:layout_constraintTop_toBottomOf="@+id/radioGroup" app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent" app:layout_constraintBottom_toBottomOf="parent"
+                app:layout_constraintHorizontal_bias="0.505" app:layout_constraintVertical_bias="0.044"
+                android:background="@drawable/button_shape" android:textColor="@color/white"/>
+    </androidx.constraintlayout.widget.ConstraintLayout>
+    <androidx.constraintlayout.widget.ConstraintLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" android:id="@+id/computerLayout" android:visibility="invisible">
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+    <androidx.constraintlayout.widget.ConstraintLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" android:id="@+id/lightLayout" android:visibility="invisible">
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+</FrameLayout>