initial commit

This commit is contained in:
2025-04-08 14:22:36 -04:00
commit 7eea5c9ca1
75 changed files with 8548 additions and 0 deletions

15
.gitignore vendored Normal file
View File

@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

3
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

6
.idea/AndroidProjectSystem.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>

123
.idea/codeStyles/Project.xml generated Normal file
View File

@@ -0,0 +1,123 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

6
.idea/compiler.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="21" />
</component>
</project>

18
.idea/deploymentTargetSelector.xml generated Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-04-03T16:08:16.340902800Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="Default" identifier="serial=192.168.11.180:37459;connection=024bbef4" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
</selectionStates>
</component>
</project>

20
.idea/gradle.xml generated Normal file
View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveExternalAnnotations" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

6
.idea/kotlinc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="2.0.0" />
</component>
</project>

10
.idea/migrations.xml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

10
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

17
.idea/runConfigurations.xml generated Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
</set>
</option>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

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

1
app/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

63
app/build.gradle.kts Normal file
View File

@@ -0,0 +1,63 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
}
android {
namespace = "com.zefie.zkiosk"
compileSdk = 35
defaultConfig {
applicationId = "com.zefie.zkiosk"
minSdk = 30
targetSdk = 35
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
buildFeatures {
compose = true
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.androidx.appcompat)
implementation(libs.material)
implementation(libs.libvlc.all)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}

21
app/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,24 @@
package com.zefie.zkiosk
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.zefie.zkiosk", appContext.packageName)
}
}

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat"
>
<activity
android:name=".MainActivity"
android:exported="true"
android:theme="@style/Theme.AppCompat">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,434 @@
/*-------------------------
Simple reset
--------------------------*/
*{
margin:0;
padding:0;
}
/*-------------------------
General Styles
--------------------------*/
html{
background-color: #1f0626;
overflow:hidden;
}
body{
font:32px/1.3 Arial, sans-serif;
color: #cacaca;
z-index:1;
}
a, a:visited {
outline:none;
color:#389dc1;
}
a:hover{
text-decoration:none;
}
section, footer, header, aside{
display: block;
}
/*-------------------------
The clocks
--------------------------*/
#clock{
transform: scale(1.8);
transform-origin: 0 0;
width:370px;
margin:5px 5px 5px 5px;
position:relative;
}
#clock .display{
text-align:center;
padding: 40px 20px 20px;
border-radius:6px;
position:relative;
height: 62px;
}
#clock .date {
font-style: italic;
font:15px/1.3 Arial, sans-serif;
}
/*-------------------------
Dark color theme
--------------------------*/
#clock.dark{
background-color:#19041f;
color:#8f32a8;
}
#clock.dark .digits div span{
background-color:#8f32a8;
border-color:#8f32a8;
}
#clock.dark .alarm{
background:url('../img/alarm_dark.jpg');
}
#clock.dark .display{
background-color:#19041f;
box-shadow:0 1px 1px rgba(0,0,0,0.08) inset, 0 1px 1px #000;
}
#clock.dark .digits div.dots:before,
#clock.dark .digits div.dots:after{
background-color:#8f32a8;
}
/*-------------------------
The Digits
--------------------------*/
#clock .digits div{
text-align:left;
position:relative;
width: 28px;
height:50px;
display:inline-block;
margin:0 4px;
}
#clock .digits div span{
opacity:0;
position:absolute;
-webkit-transition:0.25s;
-moz-transition:0.25s;
transition:0.25s;
}
#clock .digits div span:before,
#clock .digits div span:after{
content:'';
position:absolute;
width:0;
height:0;
border:5px solid transparent;
}
#clock .digits .d1{ height:5px;width:16px;top:0;left:6px;}
#clock .digits .d1:before{ border-width:0 5px 5px 0;border-right-color:inherit;left:-5px;}
#clock .digits .d1:after{ border-width:0 0 5px 5px;border-left-color:inherit;right:-5px;}
#clock .digits .d2{ height:5px;width:16px;top:24px;left:6px;}
#clock .digits .d2:before{ border-width:3px 4px 2px;border-right-color:inherit;left:-8px;}
#clock .digits .d2:after{ border-width:3px 4px 2px;border-left-color:inherit;right:-8px;}
#clock .digits .d3{ height:5px;width:16px;top:48px;left:6px;}
#clock .digits .d3:before{ border-width:5px 5px 0 0;border-right-color:inherit;left:-5px;}
#clock .digits .d3:after{ border-width:5px 0 0 5px;border-left-color:inherit;right:-5px;}
#clock .digits .d4{ width:5px;height:14px;top:7px;left:0;}
#clock .digits .d4:before{ border-width:0 5px 5px 0;border-bottom-color:inherit;top:-5px;}
#clock .digits .d4:after{ border-width:0 0 5px 5px;border-left-color:inherit;bottom:-5px;}
#clock .digits .d5{ width:5px;height:14px;top:7px;right:0;}
#clock .digits .d5:before{ border-width:0 0 5px 5px;border-bottom-color:inherit;top:-5px;}
#clock .digits .d5:after{ border-width:5px 0 0 5px;border-top-color:inherit;bottom:-5px;}
#clock .digits .d6{ width:5px;height:14px;top:32px;left:0;}
#clock .digits .d6:before{ border-width:0 5px 5px 0;border-bottom-color:inherit;top:-5px;}
#clock .digits .d6:after{ border-width:0 0 5px 5px;border-left-color:inherit;bottom:-5px;}
#clock .digits .d7{ width:5px;height:14px;top:32px;right:0;}
#clock .digits .d7:before{ border-width:0 0 5px 5px;border-bottom-color:inherit;top:-5px;}
#clock .digits .d7:after{ border-width:5px 0 0 5px;border-top-color:inherit;bottom:-5px;}
/* 1 */
#clock .digits div.one .d5,
#clock .digits div.one .d7{
opacity:1;
}
/* 2 */
#clock .digits div.two .d1,
#clock .digits div.two .d5,
#clock .digits div.two .d2,
#clock .digits div.two .d6,
#clock .digits div.two .d3{
opacity:1;
}
/* 3 */
#clock .digits div.three .d1,
#clock .digits div.three .d5,
#clock .digits div.three .d2,
#clock .digits div.three .d7,
#clock .digits div.three .d3{
opacity:1;
}
/* 4 */
#clock .digits div.four .d5,
#clock .digits div.four .d2,
#clock .digits div.four .d4,
#clock .digits div.four .d7{
opacity:1;
}
/* 5 */
#clock .digits div.five .d1,
#clock .digits div.five .d2,
#clock .digits div.five .d4,
#clock .digits div.five .d3,
#clock .digits div.five .d7{
opacity:1;
}
/* 6 */
#clock .digits div.six .d1,
#clock .digits div.six .d2,
#clock .digits div.six .d4,
#clock .digits div.six .d3,
#clock .digits div.six .d6,
#clock .digits div.six .d7{
opacity:1;
}
/* 7 */
#clock .digits div.seven .d1,
#clock .digits div.seven .d5,
#clock .digits div.seven .d7{
opacity:1;
}
/* 8 */
#clock .digits div.eight .d1,
#clock .digits div.eight .d2,
#clock .digits div.eight .d3,
#clock .digits div.eight .d4,
#clock .digits div.eight .d5,
#clock .digits div.eight .d6,
#clock .digits div.eight .d7{
opacity:1;
}
/* 9 */
#clock .digits div.nine .d1,
#clock .digits div.nine .d2,
#clock .digits div.nine .d3,
#clock .digits div.nine .d4,
#clock .digits div.nine .d5,
#clock .digits div.nine .d7{
opacity:1;
}
/* 0 */
#clock .digits div.zero .d1,
#clock .digits div.zero .d3,
#clock .digits div.zero .d4,
#clock .digits div.zero .d5,
#clock .digits div.zero .d6,
#clock .digits div.zero .d7{
opacity:1;
}
/* The dots */
#clock .digits div.dots{
width:5px;
}
#clock .digits div.dots:before,
#clock .digits div.dots:after{
width:5px;
height:5px;
content:'';
position:absolute;
left:0;
top:14px;
}
#clock .digits div.dots:after{
top:34px;
}
/*-------------------------
Weekdays
--------------------------*/
#clock .weekdays{
font-size:12px;
position:absolute;
width:100%;
top:10px;
left:0;
text-align:center;
}
#clock .weekdays span{
opacity:0.2;
padding:0 10px;
}
#clock .weekdays span.active{
opacity:1;
}
/*-------------------------
AM/PM
--------------------------*/
#clock .ampm{
position:absolute;
bottom:24px;
right:20px;
font-size:12px;
}
/*-------------------------
zefie's shit
--------------------------*/
.rounded {
border: 3px solid #000;
border-radius: 10px;
}
#roofcam {
margin-left: 15px;
margin-top: 10px;
}
#doppler {
position: absolute;
top: 1142px;
left: 2051px;
zoom: 88%;
}
#currentwx {
position: absolute;
top: 14px;
left: 1806px;
width: 700px;
}
#wx #icon {
position: relative;
top: -42px;
left: -20px;
}
#wx #description {
position: relative;
top: -188px;
left: 345px;
}
#wx #location {
position: relative;
top: -398px;
left: 160px;
}
#wx #wind {
position: relative;
top: -148px;
left: 17px;
}
#wx #temp {
position: absolute;
top: 6px;
left: 170px;
margin: 0 auto;
text-align: center;
color: #fff;
font-size: 3em;
}
#wx #feels_like {
position: absolute;
top: 64px;
left: 348px;
margin: 0 auto;
text-align: center;
}
#forecast {
position: relative;
top: -124px;
left: 20px;
}
.forecast_day img {
vertical-align: middle;
}
.forecast_day {
padding-top: 4px;
margin-bottom: 4px;
border-top: 2px solid #CDCDCD;
width: 620px;
}
#currentwx .rounded {
max-height: 978px;
position: relative;
left: -3px;
}
#roofcam .rounded,
#videoPlayer {
height: 1000px;
width: 1770px;
}
#videoPlayer2 {
position: absolute;
top: 7px;
left: 1130px;
height: 375px;
width: 655px;
}
.forecast_icon {
margin: -5px 0px -5px 10px;
}
#dopplerimg {
width: 790px;
height: 446px;
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,104 @@
$(function(){
// Cache some selectors
var clock = $('#clock'),
alarm = clock.find('.alarm'),
ampm = clock.find('.ampm'),
date = clock.find('.date');
// Map digits to their names (this will be an array)
var digit_to_name = 'zero one two three four five six seven eight nine'.split(' ');
// This object will hold the digit elements
var digits = {};
// Positions for the hours, minutes, and seconds
var positions = [
'h1', 'h2', ':', 'm1', 'm2', ':', 's1', 's2'
];
// Generate the digits with the needed markup,
// and add them to the clock
var digit_holder = clock.find('.digits');
$.each(positions, function(){
if(this == ':'){
digit_holder.append('<div class="dots">');
}
else{
var pos = $('<div>');
for(var i=1; i<8; i++){
pos.append('<span class="d' + i + '">');
}
// Set the digits as key:value pairs in the digits object
digits[this] = pos;
// Add the digit elements to the page
digit_holder.append(pos);
}
});
// Add the weekday names
var weekday_names = 'SUN MON TUE WED THU FRI SAT'.split(' '),
weekday_holder = clock.find('.weekdays');
$.each(weekday_names, function(){
weekday_holder.append('<span>' + this + '</span>');
});
var weekdays = clock.find('.weekdays span');
// Run a timer every second and update the clock
(function update_time(){
// Use moment.js to output the current time as a string
// hh is for the hours in 12-hour format,
// mm - minutes, ss-seconds (all with leading zeroes),
// d is for day of week and A is for AM/PM
var now = moment().format("hhmmssdA");
digits.h1.attr('class', digit_to_name[now[0]]);
digits.h2.attr('class', digit_to_name[now[1]]);
digits.m1.attr('class', digit_to_name[now[2]]);
digits.m2.attr('class', digit_to_name[now[3]]);
digits.s1.attr('class', digit_to_name[now[4]]);
digits.s2.attr('class', digit_to_name[now[5]]);
// The library returns Sunday as the first day of the week.
// Stupid, I know. Lets shift all the days one position down,
// and make Sunday last
var dow = now[6];
// Mark the active day of the week
weekdays.removeClass('active').eq(dow).addClass('active');
// Set the am/pm text:
ampm.text(now[7]+now[8]);
// Set Date
date.text(new Date().toLocaleDateString('en-us', { weekday:"long", year:"numeric", month:"long", day:"numeric"}));
// Schedule this function to be run again in 1 sec
setTimeout(update_time, 1000);
})();
// Switch the theme
$('a.button').click(function(){
clock.toggleClass('light dark');
});
});

View File

@@ -0,0 +1,102 @@
let mseQueue = [],
mseSourceBuffer, mseStreamingStarted = false, videoSound=false;
function startPlay() {
let host = "192.168.11.22:8083";
let uuid = $('#uuid').val();
let channel = $('#channel').val();
location.protocol == 'https:' ? potocol = 'wss' : potocol = 'ws';
let url = potocol + '://' + host + '/stream/' + uuid + '/channel/' + channel + '/mse?uuid=' + uuid + '&channel=' + channel;
let mse = new MediaSource();
$("#videoPlayer")[0].src = window.URL.createObjectURL(mse);
mse.addEventListener('sourceopen', function() {
let ws = new WebSocket(url);
ws.binaryType = "arraybuffer";
ws.onopen = function(event) {
console.log('Connect to ws');
}
ws.onclose = function(event) {
console.log('Disconnected from ws, reloading in 5 seconds');
doReload();
}
ws.onmessage = function(event) {
let data = new Uint8Array(event.data);
if (data[0] == 9) {
decoded_arr = data.slice(1);
if (window.TextDecoder) {
mimeCodec = new TextDecoder("utf-8").decode(decoded_arr);
} else {
mimeCodec = Utf8ArrayToStr(decoded_arr);
}
if(mimeCodec.indexOf(',')>0){
videoSound=true;
}
mseSourceBuffer = mse.addSourceBuffer('video/mp4; codecs="' + mimeCodec + '"');
mseSourceBuffer.mode = "segments"
mseSourceBuffer.addEventListener("updateend", pushPacket);
} else {
readPacket(event.data);
}
};
}, false);
}
function pushPacket() {
if (!mseSourceBuffer.updating) {
if (mseQueue.length > 0) {
packet = mseQueue.shift();
mseSourceBuffer.appendBuffer(packet);
} else {
mseStreamingStarted = false;
}
}
if ($("#videoPlayer")[0].buffered.length > 0) {
if (typeof document.hidden !== "undefined" && document.hidden && !videoSound) {
$("#videoPlayer")[0].currentTime = $("#videoPlayer")[0].buffered.end(($("#videoPlayer")[0].buffered.length - 1)) - 0.5;
}
}
}
function readPacket(packet) {
if (!mseStreamingStarted) {
mseSourceBuffer.appendBuffer(packet);
mseStreamingStarted = true;
return;
}
mseQueue.push(packet);
if (!mseSourceBuffer.updating) {
pushPacket();
}
}
function doReload() {
setTimeout(function() {
location.reload();
}, 5000);
}
/*
$("#videoPlayer")[0].addEventListener('loadeddata', () => {
$("#videoPlayer")[0].play();
let browser = browserDetector();
if (!browser.safari) {
makePic();
}
});
*/
$("#videoPlayer")[0].addEventListener('pause', () => {
if ($("#videoPlayer")[0].currentTime > $("#videoPlayer")[0].buffered.end(($("#videoPlayer")[0].buffered.length - 1))) {
$("#videoPlayer")[0].currentTime = $("#videoPlayer")[0].buffered.end(($("#videoPlayer")[0].buffered.length - 1)) - 0.1;
$("#videoPlayer")[0].play();
}
});
$("#videoPlayer")[0].addEventListener('error', () => {
console.log('video_error. reloading in 5 seconds.');
doReload();
});

View File

@@ -0,0 +1,96 @@
let mseQueue2 = [],
mseSourceBuffer2, mseStreamingStarted2 = false, videoSound2=false;
function startPlay2() {
let host = "192.168.11.22:8083";
let uuid = $('#uuid2').val();
let channel = $('#channel2').val();
location.protocol == 'https:' ? potocol = 'wss' : potocol = 'ws';
let url = potocol + '://' + host + '/stream/' + uuid + '/channel/' + channel + '/mse?uuid=' + uuid + '&channel=' + channel;
let mse = new MediaSource();
$("#videoPlayer2")[0].src = window.URL.createObjectURL(mse);
mse.addEventListener('sourceopen', function() {
let ws = new WebSocket(url);
ws.binaryType = "arraybuffer";
ws.onopen = function(event) {
console.log('Connect to ws');
}
ws.onclose = function(event) {
console.log('Disconnected from ws, reloading in 5 seconds');
doReload();
}
ws.onmessage = function(event) {
let data = new Uint8Array(event.data);
if (data[0] == 9) {
decoded_arr = data.slice(1);
if (window.TextDecoder) {
mimeCodec = new TextDecoder("utf-8").decode(decoded_arr);
} else {
mimeCodec = Utf8ArrayToStr(decoded_arr);
}
if(mimeCodec.indexOf(',')>0){
videoSound2=true;
}
mseSourceBuffer2 = mse.addSourceBuffer('video/mp4; codecs="' + mimeCodec + '"');
mseSourceBuffer2.mode = "segments"
mseSourceBuffer2.addEventListener("updateend", pushPacket2);
} else {
readPacket2(event.data);
}
};
}, false);
}
function pushPacket2() {
if (!mseSourceBuffer2.updating) {
if (mseQueue2.length > 0) {
packet = mseQueue2.shift();
mseSourceBuffer2.appendBuffer(packet);
} else {
mseStreamingStarted2 = false;
}
}
if ($("#videoPlayer2")[0].buffered.length > 0) {
if (typeof document.hidden !== "undefined" && document.hidden && !videoSound2) {
$("#videoPlayer2")[0].currentTime = $("#videoPlayer2")[0].buffered.end(($("#videoPlayer2")[0].buffered.length - 1)) - 0.5;
}
}
}
function readPacket2(packet) {
if (!mseStreamingStarted2) {
mseSourceBuffer2.appendBuffer(packet);
mseStreamingStarted2 = true;
return;
}
mseQueue2.push(packet);
if (!mseSourceBuffer2.updating) {
pushPacket2();
}
}
/*
$("#videoPlayer")[0].addEventListener('loadeddata', () => {
$("#videoPlayer")[0].play();
let browser = browserDetector();
if (!browser.safari) {
makePic();
}
});
*/
$("#videoPlayer2")[0].addEventListener('pause', () => {
if ($("#videoPlayer2")[0].currentTime > $("#videoPlayer2")[0].buffered.end(($("#videoPlayer2")[0].buffered.length - 1))) {
$("#videoPlayer2")[0].currentTime = $("#videoPlayer2")[0].buffered.end(($("#videoPlayer2")[0].buffered.length - 1)) - 0.1;
$("#videoPlayer2")[0].play();
}
});
$("#videoPlayer2")[0].addEventListener('error', () => {
console.log('video_error. reloading in 5 seconds.');
doReload();
});

View File

@@ -0,0 +1,116 @@
function weatherBalloon( cityID ) {
var key = '48954b66c9d54116dd164d4e1bcd1210';
fetch('https://api.openweathermap.org/data/2.5/weather?id=' + cityID+ '&appid=' + key + '&units=Imperial')
.then(function(resp) { return resp.json() }) // Convert data to json
.then(function(data) {
drawCurrentWX(data);
})
.catch(function() {
// catch any errors
});
}
function futureCast( cityID ) {
var key = '48954b66c9d54116dd164d4e1bcd1210';
fetch('https://api.openweathermap.org/data/2.5/forecast?id=' + cityID+ '&appid=' + key + '&units=Imperial')
.then(function(resp) { return resp.json() }) // Convert data to json
.then(function(data) {
//days = new Array(data.list[0],data.list[7],data.list[15],data.list[23],data.list[31],data.list[39]);
//drawFutureWX(days);
drawFutureWX(data.list);
})
.catch(function() {
// catch any errors
});
}
function updateWX() {
document.getElementById('dopplerimg').src = "https://radar.weather.gov/ridge/standard/KENX_loop.gif?refreshed="+(Date.now()/1000);
weatherBalloon( 5129540 );
futureCast( 5129540 );
setTimeout(function() {
updateWX();
}, 300000); // 5 min
}
function drawCurrentWX( d ) {
let compassSector = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N"];
var windDirection = compassSector[(d.wind.deg / 22.5).toFixed(0)];
const desc = d.weather[0].description.split(" ");
for (let i = 0; i < desc.length; i++) {
desc[i] = desc[i][0].toUpperCase() + desc[i].substr(1);
}
document.getElementById('description').innerHTML = desc.join(" ").split(",").join(" ");
document.getElementById('wind').innerHTML = "Wind "+ windDirection + " at " + Math.round(d.wind.speed,0) +"mph";
if (d.wind.gust > 0 && Math.round(d.wind.gust,0) != Math.round(d.wind.speed,0)) document.getElementById('wind').innerHTML += " (gusting to "+Math.round(d.wind.gust,0)+"mph)";
document.getElementById('temp').innerHTML = Math.round(d.main.temp,0) + '&deg;';
if (Math.round(d.main.feels_like,0) != Math.round(d.main.temp,0)) document.getElementById('feels_like').innerHTML = "Feels like: "+Math.round(d.main.feels_like,0)+ '&deg;';
document.getElementById('icon').innerHTML = "<img src=\"https://openweathermap.org/img/wn/"+d.weather[0].icon+"@4x.png\">";
}
function isToday(date) {
var today = new Date();
return date.getDate() == today.getDate() &&
date.getMonth() == today.getMonth() &&
date.getFullYear() == today.getFullYear()
}
let compassSector = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N"];
var currentDay = null;
var count = 0;
var forecastHTML = "";
var limit = 3;
function drawTheFuture(d) {
if (count > limit) return;
var dob = new Date(d.dt * 1000);
var today = new Date();
today.setHours(0,0,0,0);
today = today.getTime();
var dow = dob.toLocaleDateString("en-US", { weekday: 'long' });
var id = "day0";
var time = 0;
var day = "";
if (!isToday(dob)) {
j = 0;
fcday = dob.getTime();
while (fcday - today >= 0) {
today = today + 86400000;
j++;
}
id = "day"+j;
}
var time = dob.getHours();
var ampm = time >= 12 ? 'pm' : 'am';
time = time % 12;
time = time ? time : 12; // the hour '0' should be '12'
time = time + ampm;
if (currentDay != id && currentDay != null) {
forecastHTML += "</tr></table></div>"
document.getElementById(id).innerHTML = forecastHTML;
forecastHTML = "";
}
if (currentDay != id) {
count++;
if (count > limit) return;
if (id == "day0") day = "Today";
else day = dow;
forecastHTML += "<div class=\"forecast_day\"><strong>"+day+"</strong><br><table class=\"forecast_ext\"><tr>";
currentDay = id;
}
var windDirection = compassSector[(d.wind.deg / 22.5).toFixed(0)];
forecastHTML += "<td><center>"+time+"<br><img class=\"forecast_icon\" src=\"https://openweathermap.org/img/wn/"+d.weather[0].icon+"@2x.png\"><br>"+Math.round(d.main.temp,0) + '&deg;'+"<br>"+ Math.round(d.wind.speed,0) +"mph</center></td>";
}
function drawFutureWX( d ) {
forecastHTML = "";
currentDay = null;
count = 0;
for (i=0; i < d.length; i++) {
if (i % 4 != 0) drawTheFuture(d[i]);
}
}

View File

@@ -0,0 +1,245 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Digital Clock</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700&display=swap');
@font-face {
font-family: 'RetroClock';
src: url('assets/fonts/digital-7_mono.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
body {
margin: 0;
padding: 0;
background-color: #1a001f;
color: #b84dff;
font-family: 'Orbitron', monospace;
}
#clock {
padding-top: 50px;
padding-left: 260px;
transform: scale(1.5);
}
.clock-container {
background-color: #0d0010;
border-radius: 10px;
padding: 30px 40px;
box-shadow: 0 0 20px #6600cc;
text-align: center;
width: 500px;
height: 150px;
}
.days {
display: flex;
justify-content: space-around;
font-size: 14px;
margin-bottom: 10px;
color: #664080;
}
.days .active {
color: #cc66ff;
}
.time {
margin-top: 25px;
margin-left: 50px;
font-size: 110px;
font-family: RetroClock;
letter-spacing: 4px;
}
.ampm {
font-size: 18px;
vertical-align: super;
}
.date {
margin-top: 25px;
font-size: 24px;
color: #cc66ff;
}
#calendar {
position: relative;
top: -240px;
left: 915px;
margin: 0;
padding: 0;
background-color: #1a001f;
}
.calendar-container {
width: 400px;
height: 300px;
border: 1px solid #222;
font-family: Arial, sans-serif;
box-sizing: border-box;
display: flex;
flex-direction: column;
}
.calendar-header {
background: #230023;
text-align: center;
color: #fff;
padding: 10px;
font-weight: bold;
border-bottom: 1px solid #222;
}
.calendar-body {
display: grid;
grid-template-columns: repeat(7, 1fr);
grid-auto-rows: 1fr;
flex: 1;
}
.calendar-day {
border: 1px solid #333;
text-align: center;
padding: 5px;
color: #ddd;
box-sizing: border-box;
}
.calendar-day.header {
background: #560056;
color: #eee;
font-weight: bold;
}
.calendar-day.today {
background-color: #8d2b68; /* Highlight color */
}
</style>
</head>
<body>
<div id="clock">
<div class="clock-container">
<div class="days">
<span id="day-0">SUN</span>
<span id="day-1">MON</span>
<span id="day-2">TUE</span>
<span id="day-3">WED</span>
<span id="day-4">THU</span>
<span id="day-5">FRI</span>
<span id="day-6">SAT</span>
</div>
<div class="time" id="time">--:--:-- <span class="ampm" id="ampm">--</span></div>
<br>
<div class="date" id="date">Loading...</div>
</div>
</div>
<script>
function updateClock() {
const now = new Date();
let hours = now.getHours();
const minutes = now.getMinutes();
const seconds = now.getSeconds();
const ampm = hours >= 12 ? 'PM' : 'AM';
// Convert to 12-hour format
hours = hours % 12 || 12;
const pad = num => num.toString().padStart(2, '0');
const timeStr = `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
document.getElementById('time').innerHTML = `${timeStr} <span class="ampm">${ampm}</span>`;
// Day highlight
const day = now.getDay();
for (let i = 0; i < 7; i++) {
document.getElementById(`day-${i}`).classList.remove('active');
}
document.getElementById(`day-${day}`).classList.add('active');
// Date string
const dateStr = now.toLocaleDateString('en-US', {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'
});
document.getElementById('date').textContent = dateStr;
}
setInterval(updateClock, 1000);
updateClock(); // Initial call
</script>
<div id="calendar">
<div class="calendar-container">
<div class="calendar-header" id="calendar-header"></div>
<div class="calendar-body" id="calendar-body"></div>
</div>
</div>
<script>
function generateCalendar() {
const today = new Date();
const currentDay = today.getDate();
const currentMonth = today.getMonth();
const currentYear = today.getFullYear();
// Month names for the header
const monthNames = [
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'
];
document.getElementById('calendar-header').textContent = monthNames[currentMonth] + ' ' + currentYear;
// Determine first day of the month and total days in the month
const firstDay = new Date(currentYear, currentMonth, 1).getDay();
const daysInMonth = new Date(currentYear, currentMonth + 1, 0).getDate();
const calendarBody = document.getElementById('calendar-body');
calendarBody.innerHTML = ''; // Clear any previous calendar
// Create weekday headers
const dayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
dayNames.forEach(day => {
const headerCell = document.createElement('div');
headerCell.className = 'calendar-day header';
headerCell.textContent = day;
calendarBody.appendChild(headerCell);
});
// Add empty cells for days before the first day of the month
for (let i = 0; i < firstDay; i++) {
const emptyCell = document.createElement('div');
emptyCell.className = 'calendar-day';
calendarBody.appendChild(emptyCell);
}
// Create cells for each day of the month
for (let day = 1; day <= daysInMonth; day++) {
const dayCell = document.createElement('div');
dayCell.className = 'calendar-day';
dayCell.textContent = day;
// Highlight the current day if it's this month
if (day === currentDay) {
dayCell.classList.add('today');
}
calendarBody.appendChild(dayCell);
}
}
function scheduleMidnightRefresh() {
const now = new Date();
// Set up next midnight
const nextMidnight = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
const timeToMidnight = nextMidnight - now;
setTimeout(function() {
generateCalendar(); // Refresh the calendar
scheduleMidnightRefresh(); // Re-schedule for the next midnight
}, timeToMidnight);
}
// Generate the calendar on page load
generateCalendar();
scheduleMidnightRefresh();
</script>
</body>
</html>

View File

@@ -0,0 +1,55 @@
<html>
<head>
<style>
body {
margin: 0;
padding: 0;
background: black;
}
img {
width: 100%;
height: auto;
}
</style>
</head>
<body>
<img id="wxImage" src="https://radar.weather.gov/ridge/standard/KENX_loop.gif" />
<script>
// Define intervals in milliseconds
const normalInterval = 300000; // 5 minutes
const retryInterval = 30000; // 30 seconds on failure
let currentTimeout = normalInterval;
const img = document.getElementById('wxImage');
let timer;
img.onload = function() {
clearTimeout(timer);
console.log("Image loaded successfully.");
// Reset to normal interval after a successful load
currentTimeout = normalInterval;
scheduleNextLoad();
};
img.onerror = function() {
clearTimeout(timer);
console.error("Image failed to load.");
// Use the retry interval on error
currentTimeout = retryInterval;
scheduleNextLoad();
};
function loadImage() {
img.src = `https://radar.weather.gov/ridge/standard/KENX_loop.gif?ts=${Date.now()}`;
}
// Function to schedule the next load
function scheduleNextLoad() {
timer = setTimeout(loadImage, currentTimeout);
}
// Start the first load
scheduleNextLoad();
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

View File

@@ -0,0 +1,320 @@
package com.zefie.zkiosk
import android.annotation.SuppressLint
import android.os.Bundle
import android.graphics.Rect
import android.os.PowerManager
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.floatingactionbutton.FloatingActionButton
import org.videolan.libvlc.util.VLCVideoLayout
import android.os.Build
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import android.webkit.WebView
import android.widget.PopupWindow
import android.widget.RelativeLayout
import android.widget.SeekBar
import android.widget.TextView
import java.util.Locale
class MainActivity : AppCompatActivity() {
private lateinit var vlcPlayer1: VLCPlayer
private lateinit var vlcPlayer2: VLCPlayer
private lateinit var videoLayout1: VLCVideoLayout
private lateinit var videoLayout2: VLCVideoLayout
private lateinit var wakeLock: PowerManager.WakeLock
private lateinit var pauseButton: FloatingActionButton
private lateinit var switchButton: FloatingActionButton
private lateinit var restartButton: FloatingActionButton
private lateinit var wxWebView: WebView
private lateinit var clockWebView: WebView
private lateinit var popupWindow: PopupWindow
private lateinit var popupText: TextView
private var switchSeconds: Long = 10
private val handler = android.os.Handler()
private var showingFirst = true
private var switcherPaused = false
@SuppressLint("SetJavaScriptEnabled")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
goFullscreen()
supportActionBar?.hide()
switchButton = findViewById(R.id.switchButton)
pauseButton = findViewById(R.id.pauseButton)
videoLayout1 = findViewById(R.id.videoLayout1)
videoLayout2 = findViewById(R.id.videoLayout2)
restartButton = findViewById(R.id.restartButton)
vlcPlayer1 = VLCPlayer(this, videoLayout1)
vlcPlayer2 = VLCPlayer(this, videoLayout2)
val seekBar = findViewById<SeekBar>(R.id.durationSlider)
setupSliderPopup(seekBar)
wxWebView = findViewById(R.id.wxWebView)
clockWebView = findViewById(R.id.clockWebView)
videoLayout1.postDelayed({ toggleVideoLayouts() }, 100)
videoLayout1.postDelayed({ toggleVideoLayouts() }, 500)
wxWebView.settings.loadWithOverviewMode = true
wxWebView.settings.useWideViewPort = true
wxWebView.settings.builtInZoomControls = false
wxWebView.settings.displayZoomControls = false
wxWebView.settings.javaScriptEnabled = true
wxWebView.settings.cacheMode = android.webkit.WebSettings.LOAD_NO_CACHE
clockWebView.settings.loadWithOverviewMode = true
clockWebView.settings.useWideViewPort = true
clockWebView.settings.builtInZoomControls = false
clockWebView.settings.displayZoomControls = false
clockWebView.settings.javaScriptEnabled = true
wxWebView.loadUrl("file:///android_asset/radar.html")
clockWebView.loadUrl("file:///android_asset/clock.html")
startPlayer(1)
startPlayer(2)
pauseButton.setOnClickListener() {
onPauseButtonPressed()
}
switchButton.setOnClickListener {
onSwitchButtonPressed()
}
restartButton.setOnClickListener {
restartCurrentStream()
}
switchSeconds = seekBar.progress.toLong();
startVisibilityToggle()
acquireWakeLock()
}
private fun setupSliderPopup(seekBar: SeekBar) {
val inflater = LayoutInflater.from(this)
val popupView = inflater.inflate(R.layout.popup_slider_value, null)
popupText = popupView.findViewById(R.id.popupText)
popupWindow = PopupWindow(
popupView,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
false
)
popupWindow.isOutsideTouchable = false
popupWindow.isTouchable = false
popupWindow.elevation = 8f
seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onStartTrackingTouch(seekBar: SeekBar) {
updatePopup(seekBar)
popupWindow.showAtLocation(seekBar, Gravity.NO_GRAVITY, 0, 0)
}
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
if (fromUser) {
updatePopup(seekBar)
}
switchSeconds = progress.toLong()
handler.removeCallbacks(toggleRunnable) // Stop the scheduled toggling
handler.postDelayed(toggleRunnable, switchSeconds * 1000) // Restart auto-toggle after 10 seconds
}
override fun onStopTrackingTouch(seekBar: SeekBar) {
popupWindow.dismiss()
}
})
}
private fun updatePopup(seekBar: SeekBar) {
val progress = seekBar.progress
popupText.text = String.format(Locale.US, "%d seconds", progress)
// Get SeekBar thumb position
val location = IntArray(2)
seekBar.getLocationOnScreen(location)
val sliderLeft = location[0]
val sliderTop = location[1]
val availableWidth = seekBar.width - seekBar.paddingLeft - seekBar.paddingRight
val thumbX = sliderLeft + seekBar.paddingLeft + (availableWidth * progress / seekBar.max)
val thumbY = sliderTop - popupWindow.contentView.measuredHeight - 20 // 20px above the thumb
popupWindow.contentView.measure(
View.MeasureSpec.UNSPECIFIED,
View.MeasureSpec.UNSPECIFIED
)
val popupWidth = popupWindow.contentView.measuredWidth
val xOffset = thumbX - popupWidth / 2
popupWindow.update(xOffset, thumbY, -1, -1)
}
private fun goFullscreen() {
val decorView = window.decorView
val uiOptions: Int =
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or
View.SYSTEM_UI_FLAG_FULLSCREEN or
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
decorView.systemUiVisibility = uiOptions
}
@SuppressLint("AuthLeak")
private fun startPlayer(index: Int) {
if (index == 1) {
vlcPlayer1.stop()
vlcPlayer1.playRTSP("rtsp://192.168.11.82/video1")
}
if (index == 2) {
vlcPlayer2.stop()
vlcPlayer2.playRTSP("rtsp://viewer:viewer@192.168.11.81/video1")
}
}
private fun restartCurrentStream() {
// Restart the visible stream by stopping and starting it again
if (showingFirst) {
startPlayer(1)
} else {
startPlayer(2)
}
}
private fun acquireWakeLock() {
val powerManager = getSystemService(POWER_SERVICE) as PowerManager
// Create a wake lock with the full-screen flag and the CPU flag
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK or PowerManager.ACQUIRE_CAUSES_WAKEUP, "MyApp:WakeLock")
wakeLock.acquire() // Acquiring the wake lock
}
private fun startVisibilityToggle() {
handler.postDelayed(toggleRunnable, switchSeconds * 1000) // Start after 10 seconds
}
private val toggleRunnable = object : Runnable {
override fun run() {
toggleVideoLayouts()
handler.postDelayed(this, switchSeconds * 1000) // Toggle every 10 seconds
}
}
private fun toggleVideoLayouts() {
val layout1 = findViewById<View>(R.id.relativeView1)
val layout2 = findViewById<View>(R.id.relativeView2)
layout1.post {
// Save current positions
val x1 = layout1.x
val y1 = layout1.y
val x2 = layout2.x
val y2 = layout2.y
// Swap positions
layout1.x = x2
layout1.y = y2
layout2.x = x1
layout2.y = y1
// Get current layout params
val params1 = layout1.layoutParams as RelativeLayout.LayoutParams
val params2 = layout2.layoutParams as RelativeLayout.LayoutParams
// Swap width & height manually (not whole objects)
val tempWidth = params1.width
val tempHeight = params1.height
params1.width = params2.width
params1.height = params2.height
params2.width = tempWidth
params2.height = tempHeight
// Swap margins
val tempMargins = Rect(
params1.leftMargin,
params1.topMargin,
params1.rightMargin,
params1.bottomMargin
)
params1.setMargins(
params2.leftMargin,
params2.topMargin,
params2.rightMargin,
params2.bottomMargin
)
params2.setMargins(
tempMargins.left,
tempMargins.top,
tempMargins.right,
tempMargins.bottom
)
layout1.layoutParams = params1
layout2.layoutParams = params2
if (layout1.x < 0) {
layout1.x = 0f
}
layout1.requestLayout()
layout2.requestLayout()
}
showingFirst = !showingFirst
}
private fun onPauseButtonPressed() {
if (switcherPaused) {
handler.postDelayed(toggleRunnable, switchSeconds * 1000)
pauseButton.setImageResource(android.R.drawable.ic_media_pause)
} else {
handler.removeCallbacks(toggleRunnable)
pauseButton.setImageResource(android.R.drawable.ic_media_play)
}
switcherPaused = !switcherPaused
}
// Call this function when the switch button is pressed
private fun onSwitchButtonPressed() {
if (!switcherPaused) {
handler.removeCallbacks(toggleRunnable) // Stop the scheduled toggling
}
toggleVideoLayouts() // Instantly switch layouts
if (!switcherPaused) {
handler.postDelayed(toggleRunnable, switchSeconds * 1000) // Restart auto-toggle after 10 seconds
}
}
override fun onPause() {
super.onPause()
wakeLock.release()
}
override fun onResume() {
super.onResume()
acquireWakeLock()
}
override fun onDestroy() {
super.onDestroy()
vlcPlayer1.release()
vlcPlayer2.release()
handler.removeCallbacksAndMessages(null)
wakeLock.release()
}
}

View File

@@ -0,0 +1,108 @@
package com.zefie.zkiosk
import android.content.Context
import android.net.Uri
import android.os.Handler
import android.os.Looper
import org.videolan.libvlc.LibVLC
import org.videolan.libvlc.Media
import org.videolan.libvlc.MediaPlayer
import org.videolan.libvlc.util.VLCVideoLayout
class VLCPlayer(context: Context, private val videoLayout: VLCVideoLayout) {
private val libVLC: LibVLC = LibVLC(context, arrayListOf("--rtsp-tcp",
"--quiet",
"--no-drop-late-frames",
"--no-skip-frames",
"--verbose=0"))
private val mediaPlayer: MediaPlayer = MediaPlayer(libVLC)
private var streamUrl: String? = null
private val handler = Handler(Looper.getMainLooper())
private var lastPlaybackTime: Long = 0
private var lastProgressCheck: Long = 0
private var watchdogRunnable: Runnable? = null
init {
mediaPlayer.attachViews(videoLayout, null, false, true)
// Listen for errors
mediaPlayer.setEventListener { event ->
if (event.type == MediaPlayer.Event.EncounteredError ||
event.type == MediaPlayer.Event.EndReached) {
restartStream()
}
}
}
fun playRTSP(url: String) {
streamUrl = url
val media = Media(libVLC, Uri.parse(url))
media.setHWDecoderEnabled(true, false)
media.addOption(":network-caching=250") // Adjust caching to handle jitter
mediaPlayer.media = media
media.release()
mediaPlayer.play()
mediaPlayer.volume = 0
startWatchdog()
}
private fun startWatchdog() {
lastPlaybackTime = mediaPlayer.time
lastProgressCheck = System.currentTimeMillis()
watchdogRunnable = object : Runnable {
override fun run() {
val currentTime = mediaPlayer.time
val currentPosition = mediaPlayer.position
val stats = mediaPlayer.media?.stats
val decodedVideo = stats?.decodedVideo ?: 0
val now = System.currentTimeMillis()
val noTimeProgress = currentTime == lastPlaybackTime || currentTime == 0L
val noPositionProgress = currentPosition == 0f
val noFramesDecoded = decodedVideo == 0
val stalled = noTimeProgress && noPositionProgress && noFramesDecoded
if (stalled) {
val freezeDuration = now - lastProgressCheck
if (freezeDuration > 8000) {
restartStream()
return
}
} else {
lastProgressCheck = now
lastPlaybackTime = currentTime
}
handler.postDelayed(this, 3000)
}
}
handler.post(watchdogRunnable!!)
}
private fun restartStream() {
if (streamUrl != null) {
handler.postDelayed({
mediaPlayer.stop()
playRTSP(streamUrl!!) // Restart the stream
}, 2000) // Wait 2 seconds before restarting
}
}
var volume: Int
get() = mediaPlayer.volume
set(value) {
mediaPlayer.volume = value
}
fun stop() {
watchdogRunnable?.let { handler.removeCallbacks(it) }
mediaPlayer.stop()
}
fun release() {
watchdogRunnable?.let { handler.removeCallbacks(it) }
mediaPlayer.release()
libVLC.release()
}
}

View File

@@ -0,0 +1,11 @@
package com.zefie.zkiosk.ui.theme
import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)
val Pink80 = Color(0xFFEFB8C8)
val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)

View File

@@ -0,0 +1,58 @@
package com.zefie.zkiosk.ui.theme
import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
private val DarkColorScheme = darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80
)
private val LightColorScheme = lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40
/* Other default colors to override
background = Color(0xFFFFFBFE),
surface = Color(0xFFFFFBFE),
onPrimary = Color.White,
onSecondary = Color.White,
onTertiary = Color.White,
onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/
)
@Composable
fun ZkioskTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}
darkTheme -> DarkColorScheme
else -> LightColorScheme
}
MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = content
)
}

View File

@@ -0,0 +1,34 @@
package com.zefie.zkiosk.ui.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with
val Typography = Typography(
bodyLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 22.sp,
lineHeight = 28.sp,
letterSpacing = 0.sp
),
labelSmall = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Medium,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
)

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>

View File

@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#88000000" />
<corners android:radius="12dp" />
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#CC000000"/>
<corners android:radius="8dp"/>
</shape>

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="300px">
<WebView
android:id="@+id/clockWebView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeView1"
android:layout_width="1387px"
android:layout_height="780px"
android:layout_marginTop="300px"
android:layout_marginStart="0px">
<org.videolan.libvlc.util.VLCVideoLayout
android:id="@+id/videoLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeView2"
android:layout_marginTop="300px"
android:layout_marginLeft="1387px"
android:layout_width="533px"
android:layout_height="300px">
<org.videolan.libvlc.util.VLCVideoLayout
android:id="@+id/videoLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"/>
</RelativeLayout>
<RelativeLayout
android:layout_marginTop="600px"
android:layout_marginLeft="1387px"
android:layout_width="533px"
android:layout_height="478px">
<WebView
android:id="@+id/wxWebView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/switchButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_media_next"
android:layout_toStartOf="@id/pauseButton"
android:layout_alignParentTop="true"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:contentDescription="@string/switchButtonDesc"
app:backgroundTint="@color/purple_200"
android:layout_marginBottom="16dp"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/pauseButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_media_pause"
android:layout_alignParentTop="true"
app:backgroundTint="@color/purple_200"
android:layout_toStartOf="@id/restartButton"
android:contentDescription="@string/pauseButtonDesc"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="16dp"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/restartButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_revert"
app:backgroundTint="@color/purple_200"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:contentDescription="@string/restartButtonDesc"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="16dp"/>
<RelativeLayout
android:id="@+id/sliderContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_toStartOf="@id/switchButton"
android:background="@drawable/slider_background"
android:layout_marginTop="75dp"
android:padding="8dp"
android:elevation="8dp">
<SeekBar
android:id="@+id/durationSlider"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:min="3"
android:max="30"
android:progress="10"
android:thumbTint="@color/white"
android:progressTint="@color/white" />
</RelativeLayout>
</RelativeLayout>

View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="300px">
<WebView
android:id="@+id/clockWebView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeView1"
android:layout_width="match_parent"
android:layout_height="608px"
android:layout_marginTop="300px"
android:layout_marginStart="0px">
<org.videolan.libvlc.util.VLCVideoLayout
android:id="@+id/videoLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeView2"
android:layout_marginTop="908px"
android:layout_marginLeft="0px"
android:layout_width="match_parent"
android:layout_height="608px">
<org.videolan.libvlc.util.VLCVideoLayout
android:id="@+id/videoLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"/>
</RelativeLayout>
<RelativeLayout
android:layout_marginTop="1516px"
android:layout_marginLeft="0px"
android:layout_width="533px"
android:layout_height="478px">
<WebView
android:id="@+id/wxWebView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/switchButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_media_next"
android:layout_toStartOf="@id/pauseButton"
android:layout_alignParentBottom="true"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:contentDescription="@string/switchButtonDesc"
app:backgroundTint="@color/purple_200"
android:layout_marginBottom="16dp"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/pauseButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_media_pause"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
app:backgroundTint="@color/purple_200"
android:contentDescription="@string/pauseButtonDesc"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="16dp"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/restartButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_revert"
app:backgroundTint="@color/purple_200"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@id/pauseButton"
android:contentDescription="@string/restartButtonDesc"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="16dp"/>
<RelativeLayout
android:id="@+id/sliderContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_toStartOf="@id/switchButton"
android:background="@drawable/slider_background"
android:layout_marginTop="75dp"
android:padding="8dp"
android:elevation="8dp">
<SeekBar
android:id="@+id/durationSlider"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:min="3"
android:max="30"
android:progress="10"
android:thumbTint="@color/white"
android:progressTint="@color/white" />
</RelativeLayout>
</RelativeLayout>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/popupText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="10"
android:textColor="@android:color/white"
android:textSize="14sp"
android:background="@drawable/slider_value_background"
android:elevation="4dp" />

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>

View File

@@ -0,0 +1,6 @@
<resources>
<string name="app_name">zkiosk</string>
<string name="pauseButtonDesc">Toggle Automatic Camera Switching</string>
<string name="switchButtonDesc">Skip to next Camera</string>
<string name="restartButtonDesc">Restart Stream</string>
</resources>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Zkiosk" parent="android:Theme.Material.Light.NoActionBar" />
</resources>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

6
build.gradle.kts Normal file
View File

@@ -0,0 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose) apply false
}

23
gradle.properties Normal file
View File

@@ -0,0 +1,23 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

38
gradle/libs.versions.toml Normal file
View File

@@ -0,0 +1,38 @@
[versions]
agp = "8.8.2"
appcompat = "1.7.0"
kotlin = "2.0.0"
coreKtx = "1.15.0"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
libvlcAll = "3.6.0"
lifecycleRuntimeKtx = "2.8.7"
activityCompose = "1.10.1"
composeBom = "2025.03.01"
material = "1.12.0"
[libraries]
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
libvlc-all = { module = "org.videolan.android:libvlc-all", version.ref = "libvlcAll" }
material = { module = "com.google.android.material:material", version.ref = "material" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Sun Mar 02 16:14:47 EST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

185
gradlew vendored Normal file
View File

@@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

89
gradlew.bat vendored Normal file
View File

@@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

23
settings.gradle.kts Normal file
View File

@@ -0,0 +1,23 @@
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "zkiosk"
include(":app")