feat: add phone session list + event log empty-shell screens

This commit is contained in:
2026-09-01 19:00:47 +08:00
parent 7dc1a2665f
commit 9458957de5
8 changed files with 123 additions and 2 deletions
+6 -1
View File
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:label="@string/app_name" android:label="@string/app_name"
@@ -17,5 +16,11 @@
<activity <activity
android:name=".SettingsActivity" android:name=".SettingsActivity"
android:exported="false" /> android:exported="false" />
<activity
android:name=".SessionListActivity"
android:exported="false" />
<activity
android:name=".EventLogActivity"
android:exported="false" />
</application> </application>
</manifest> </manifest>
@@ -0,0 +1,20 @@
package com.dshwatch.app;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import androidx.appcompat.app.AppCompatActivity;
public class EventLogActivity extends AppCompatActivity {
private final String[] events = { "(空壳) 事件流待接入", "onStatus / onEvent -> watch" };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event_log);
ListView list = findViewById(R.id.event_list);
list.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, events));
}
}
@@ -101,6 +101,22 @@ public class MainActivity extends AppCompatActivity {
} }
}); });
Button sessions = findViewById(R.id.btn_sessions);
sessions.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, SessionListActivity.class));
}
});
Button events = findViewById(R.id.btn_events);
events.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, EventLogActivity.class));
}
});
Button refresh = findViewById(R.id.btn_refresh); Button refresh = findViewById(R.id.btn_refresh);
refresh.setOnClickListener(new View.OnClickListener() { refresh.setOnClickListener(new View.OnClickListener() {
@Override @Override
@@ -0,0 +1,20 @@
package com.dshwatch.app;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import androidx.appcompat.app.AppCompatActivity;
public class SessionListActivity extends AppCompatActivity {
private final String[] sessions = { "会话 demo-1", "会话 demo-2", "会话 demo-3", "(空壳列表)" };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_session_list);
ListView list = findViewById(R.id.session_list);
list.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, sessions));
}
}
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
android:background="@color/deep_blue">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="事件流(空壳)"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
<ListView
android:id="@+id/event_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp"
android:divider="@color/light_blue"
android:dividerHeight="1dp" />
</LinearLayout>
+14
View File
@@ -38,6 +38,20 @@
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:text="@string/btn_settings" /> android:text="@string/btn_settings" />
<Button
android:id="@+id/btn_sessions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/btn_sessions" />
<Button
android:id="@+id/btn_events"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/btn_events" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
android:background="@color/deep_blue">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="会话列表(空壳)"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
<ListView
android:id="@+id/session_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp"
android:divider="@color/light_blue"
android:dividerHeight="1dp" />
</LinearLayout>
+2
View File
@@ -4,6 +4,8 @@
<string name="status_disconnected">未连接(空壳)</string> <string name="status_disconnected">未连接(空壳)</string>
<string name="btn_refresh">刷新状态</string> <string name="btn_refresh">刷新状态</string>
<string name="btn_settings">设置</string> <string name="btn_settings">设置</string>
<string name="btn_sessions">会话列表</string>
<string name="btn_events">事件流</string>
<string name="settings_title">设置</string> <string name="settings_title">设置</string>
<string name="label_server">服务器地址</string> <string name="label_server">服务器地址</string>
<string name="hint_server">ws://host:port</string> <string name="hint_server">ws://host:port</string>