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="screenY" value="3120" />
</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>
<option name="api" value="33" />
<option name="brand" value="google" />
@@ -754,6 +766,18 @@
<option name="screenX" value="1008" />
<option name="screenY" value="2244" />
</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>
<option name="api" value="30" />
<option name="brand" value="motorola" />
@@ -1044,6 +1068,18 @@
<option name="screenX" value="1080" />
<option name="screenY" value="2340" />
</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>
<option name="api" value="36" />
<option name="brand" value="samsung" />
@@ -1116,6 +1152,18 @@
<option name="screenX" value="1080" />
<option name="screenY" value="2400" />
</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>
<option name="api" value="33" />
<option name="brand" value="google" />

View File

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

View File

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

View File

@@ -8,8 +8,10 @@
#include <android/asset_manager.h>
#include <RmlUi/Core.h>
#include "RmlUi_Renderer_GL3.h"
#include <ranges>
#include <span>
#include <ranges>
#include <chrono>
#include <format>
using namespace aidl::com::omixlab::mosis;
using namespace aidl::android::hardware;
@@ -128,6 +130,14 @@ void Kernel::main_loop()
Rml::LoadFontFace("LatoLatin-Regular.ttf");
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.
Rml::ElementDocument* document = context->LoadDocument("demo.rml");
document->Show();
@@ -147,6 +157,10 @@ void Kernel::main_loop()
glClear(GL_COLOR_BUFFER_BIT);
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();
rmlui_render_interface.SetViewport(540, 960);
rmlui_render_interface.BeginFrame();

View File

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