add data model

This commit is contained in:
2026-01-14 14:47:57 +01:00
parent c101d647dd
commit 4d5b4c2455
5 changed files with 80 additions and 26 deletions

View File

@@ -548,6 +548,18 @@
<option name="screenX" value="1440" /> <option name="screenX" value="1440" />
<option name="screenY" value="3120" /> <option name="screenY" value="3120" />
</PersistentDeviceSelectionData> </PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="36" />
<option name="brand" value="samsung" />
<option name="codename" value="e3qksx" />
<option name="id" value="e3qksx" />
<option name="labId" value="google" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy S24 Ultra" />
<option name="screenDensity" value="450" />
<option name="screenX" value="1440" />
<option name="screenY" value="3120" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData> <PersistentDeviceSelectionData>
<option name="api" value="33" /> <option name="api" value="33" />
<option name="brand" value="google" /> <option name="brand" value="google" />
@@ -754,6 +766,18 @@
<option name="screenX" value="1008" /> <option name="screenX" value="1008" />
<option name="screenY" value="2244" /> <option name="screenY" value="2244" />
</PersistentDeviceSelectionData> </PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="35" />
<option name="brand" value="google" />
<option name="codename" value="husky" />
<option name="id" value="husky" />
<option name="labId" value="google" />
<option name="manufacturer" value="Google" />
<option name="name" value="Pixel 8 Pro" />
<option name="screenDensity" value="390" />
<option name="screenX" value="1008" />
<option name="screenY" value="2244" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData> <PersistentDeviceSelectionData>
<option name="api" value="30" /> <option name="api" value="30" />
<option name="brand" value="motorola" /> <option name="brand" value="motorola" />
@@ -1044,6 +1068,18 @@
<option name="screenX" value="1080" /> <option name="screenX" value="1080" />
<option name="screenY" value="2340" /> <option name="screenY" value="2340" />
</PersistentDeviceSelectionData> </PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="36" />
<option name="brand" value="samsung" />
<option name="codename" value="r11s" />
<option name="id" value="r11s" />
<option name="labId" value="google" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="SM-S711N" />
<option name="screenDensity" value="450" />
<option name="screenX" value="1080" />
<option name="screenY" value="2340" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData> <PersistentDeviceSelectionData>
<option name="api" value="36" /> <option name="api" value="36" />
<option name="brand" value="samsung" /> <option name="brand" value="samsung" />
@@ -1116,6 +1152,18 @@
<option name="screenX" value="1080" /> <option name="screenX" value="1080" />
<option name="screenY" value="2400" /> <option name="screenY" value="2400" />
</PersistentDeviceSelectionData> </PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="35" />
<option name="brand" value="samsung" />
<option name="codename" value="t2q" />
<option name="id" value="t2q" />
<option name="labId" value="google" />
<option name="manufacturer" value="Samsung" />
<option name="name" value="Galaxy S21 Plus" />
<option name="screenDensity" value="394" />
<option name="screenX" value="1080" />
<option name="screenY" value="2400" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData> <PersistentDeviceSelectionData>
<option name="api" value="33" /> <option name="api" value="33" />
<option name="brand" value="google" /> <option name="brand" value="google" />

View File

@@ -5,15 +5,11 @@
<title>Fullscreen Mobile UI</title> <title>Fullscreen Mobile UI</title>
</head> </head>
<body> <body>
<div id="status-bar"> <div id="status-bar" data-model="status-data">
<span class="time">22:47</span> <span class="time">{{time}}</span>
<div class="status-icons"> <div class="status-icons">
<span class="icon">📶</span> <span class="icon">📶</span>
<span class="icon">🔋</span> <span class="icon">🔋</span>
<span class="icon">📶</span>
<span class="icon">🔋</span>
<span class="icon">📶</span>
<span class="icon">🔋</span>
</div> </div>
</div> </div>
@@ -27,9 +23,6 @@
<div class="nav-item">Home</div> <div class="nav-item">Home</div>
<div class="nav-item">Apps</div> <div class="nav-item">Apps</div>
<div class="nav-item">Settings</div> <div class="nav-item">Settings</div>
<div class="nav-item">Home</div>
<div class="nav-item">Apps</div>
<div class="nav-item">Settings</div>
</div> </div>
</body> </body>
</rml> </rml>

View File

@@ -11,21 +11,21 @@ body {
/* Status Bar pinned to top */ /* Status Bar pinned to top */
#status-bar { #status-bar {
font-size: 3em;
display: block; display: block;
height: 140px; padding: 30px;
padding: 10px 20px 0; height: 35px;
background-color: rgba(255, 0, 0, 0.2); background-color: gray;
} }
.time { .time {
float: left; float: left;
font-weight: bold; font-weight: bold;
font-size: 2em;
} }
.status-icons { .status-icons {
float: right; float: right;
font-size: 2em; font-family: Noto Emoji
} }
.icon { .icon {
@@ -46,7 +46,7 @@ body {
} }
h1 { h1 {
font-size: 2.5em; font-size: 5em;
font-weight: bold; font-weight: bold;
} }
@@ -84,27 +84,25 @@ h1 {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
height: 65px; height: 150px;
background-color: #16161a; background-color: gray;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
align-items: center; align-items: center;
border-top: 1px solid #333;
} }
.nav-item { .nav-item {
font-size: 1.9em; font-size: 3em;
color: #888; color: black;
background-color: red; background-color: #AAAAAA;
width: 100px; width: 150px;
height: 100px; height: 100px;
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
line-height: 90px; line-height: 100px;
border-radius: 10px; border-radius: 10px;
} }
.nav-item:hover { .nav-item:hover {
color: #3498db; background-color: white;
background-color: blue;
} }

View File

@@ -8,8 +8,10 @@
#include <android/asset_manager.h> #include <android/asset_manager.h>
#include <RmlUi/Core.h> #include <RmlUi/Core.h>
#include "RmlUi_Renderer_GL3.h" #include "RmlUi_Renderer_GL3.h"
#include <ranges>
#include <span> #include <span>
#include <ranges>
#include <chrono>
#include <format>
using namespace aidl::com::omixlab::mosis; using namespace aidl::com::omixlab::mosis;
using namespace aidl::android::hardware; using namespace aidl::android::hardware;
@@ -128,6 +130,14 @@ void Kernel::main_loop()
Rml::LoadFontFace("LatoLatin-Regular.ttf"); Rml::LoadFontFace("LatoLatin-Regular.ttf");
Rml::LoadFontFace("NotoEmoji-Regular.ttf", true); Rml::LoadFontFace("NotoEmoji-Regular.ttf", true);
std::string status_time = "0";
Rml::DataModelHandle status_time_handle;
if (Rml::DataModelConstructor status_data_ctor = context->CreateDataModel("status-data"))
{
status_data_ctor.Bind("time", &status_time);
status_time_handle = status_data_ctor.GetModelHandle();
}
// Now we are ready to load our document. // Now we are ready to load our document.
Rml::ElementDocument* document = context->LoadDocument("demo.rml"); Rml::ElementDocument* document = context->LoadDocument("demo.rml");
document->Show(); document->Show();
@@ -147,6 +157,10 @@ void Kernel::main_loop()
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
glViewport(0, 0, 540, 960); glViewport(0, 0, 540, 960);
status_time = std::format("{:%H:%M:%S}",
std::chrono::floor<std::chrono::seconds>(std::chrono::system_clock::now()));
status_time_handle.DirtyAllVariables();
context->Update(); context->Update();
rmlui_render_interface.SetViewport(540, 960); rmlui_render_interface.SetViewport(540, 960);
rmlui_render_interface.BeginFrame(); rmlui_render_interface.BeginFrame();

View File

@@ -39,6 +39,7 @@ class MainActivity : ComponentActivity() {
statusText.value = "Service Connected" statusText.value = "Service Connected"
remote_service = IMosisService.Stub.asInterface(service) remote_service = IMosisService.Stub.asInterface(service)
serviceConnected(service) serviceConnected(service)
initOS()
} }
override fun onServiceDisconnected(arg0: ComponentName) { override fun onServiceDisconnected(arg0: ComponentName) {