Initial commit (files only)
No files matched your search
@@ -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
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
@@ -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>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<bytecodeTargetLevel target="21" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="deploymentTargetSelector">
|
||||||
|
<selectionStates>
|
||||||
|
<SelectionState runConfigName="app">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
</SelectionState>
|
||||||
|
</selectionStates>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?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>
|
||||||
|
</GradleProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="ComposePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="ComposePreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="ComposePreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="ComposePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="GlancePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="GlancePreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="GlancePreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="GlancePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewApiLevelMustBeValid" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewDeviceShouldUseNewSpec" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewParameterProviderOnFirstParameter" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
<option name="previewFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
@@ -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>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<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>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
kotlin version: 2.0.21
|
||||||
|
error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output:
|
||||||
|
1. Kotlin compile daemon is ready
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Screenity
|
||||||
|
by Robin Schanbacher (robin@schanbros.de)
|
||||||
|

|
||||||
|
|
||||||
|
# What does it do?
|
||||||
|
If you install Screenity on all your devices (currently just android possible), it shows you all your screentime – from all devices.
|
||||||
|
|
||||||
|
# What is it able to do?
|
||||||
|
- collect your screentime and send it to a self-hosted server
|
||||||
|
- show your today's, local's and each device's screentime
|
||||||
|
- multiple accounts
|
||||||
|
|
||||||
|
# What is planned to implement?
|
||||||
|
- Widgets
|
||||||
|
- filters
|
||||||
|
- admin-page (web)
|
||||||
|
- internal und extetnal connection to server
|
||||||
|
- optimize and publish server files
|
||||||
|
|
||||||
|
# Else
|
||||||
|
As you hopefully noticed, the project is very new. It is also my first bigger project, so i'm sorry for the mistakes i'll make :)
|
||||||
|
Since i'm currently lerning Kotlin with Jetpack Compose, this is a project for my personal education. If i've enough experience, i'll try to start more projects.
|
||||||
|
|
||||||
|
Since i'm still a student i'd be glad for any help. Thank you!
|
||||||
|
|
||||||
|
[](https://apps.obtainium.imranr.dev/redirect?r=obtainium://add/https://github.com/RobinS-T470s/Screenity)
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
name: Android Build & Release
|
||||||
|
|
||||||
|
# Der Bot startet nur, wenn du ein "Tag" pushst (z.B. v1.0)
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Java einrichten
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '17'
|
||||||
|
distribution: 'temurin'
|
||||||
|
cache: gradle
|
||||||
|
|
||||||
|
- name: Berechtigung für Gradle setzen
|
||||||
|
run: chmod +x gradlew
|
||||||
|
|
||||||
|
- name: APK bauen (Debug Version)
|
||||||
|
run: ./gradlew assembleDebug
|
||||||
|
|
||||||
|
- name: Release erstellen und APK hochladen
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: app/build/outputs/apk/debug/*.apk
|
||||||
|
name: Release ${{ github.ref_name }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
import org.gradle.kotlin.dsl.create
|
||||||
|
import org.gradle.kotlin.dsl.getByName
|
||||||
|
import org.gradle.kotlin.dsl.release
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application)
|
||||||
|
alias(libs.plugins.kotlin.android)
|
||||||
|
alias(libs.plugins.kotlin.compose)
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = "de.schanbro.screenity"
|
||||||
|
compileSdk = 36
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "de.schanbro.screenity"
|
||||||
|
minSdk = 29
|
||||||
|
targetSdk = 36
|
||||||
|
|
||||||
|
val gitVersion = System.getenv("APP_VERSION") ?: "0.0.1-local"
|
||||||
|
versionName = gitVersion.removePrefix("v")
|
||||||
|
versionCode = (System.currentTimeMillis() / 600000).toInt()
|
||||||
|
|
||||||
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
create("release") {
|
||||||
|
storeFile = file("keystore.jks")
|
||||||
|
storePassword = System.getenv("KEY_STORE_PASSWORD")
|
||||||
|
keyAlias = System.getenv("ALIAS")
|
||||||
|
keyPassword = System.getenv("KEY_PASSWORD")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
isMinifyEnabled = false
|
||||||
|
// Hier kommt alles in EINEN Block:
|
||||||
|
signingConfig = signingConfigs.getByName("release")
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "11"
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
compose = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional: Damit die Datei auf GitHub auch den richtigen Namen hat
|
||||||
|
applicationVariants.all {
|
||||||
|
outputs.all {
|
||||||
|
val output = this as com.android.build.gradle.internal.api.ApkVariantOutputImpl
|
||||||
|
output.outputFileName = "Screenity-${versionName}.apk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(libs.androidx.compose.animation)
|
||||||
|
val workVersion = "2.9.0" // Prüfe hier gern auf die aktuellste Version
|
||||||
|
implementation("androidx.work:work-runtime-ktx:$workVersion")
|
||||||
|
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.compose.ui)
|
||||||
|
implementation(libs.androidx.compose.ui.graphics)
|
||||||
|
implementation(libs.androidx.compose.ui.tooling.preview)
|
||||||
|
implementation(libs.androidx.compose.material3)
|
||||||
|
implementation(libs.androidx.navigation.compose)
|
||||||
|
implementation(libs.androidx.ui)
|
||||||
|
implementation(libs.androidx.material3)
|
||||||
|
implementation(libs.androidx.ui.graphics)
|
||||||
|
testImplementation(libs.junit)
|
||||||
|
androidTestImplementation(libs.androidx.junit)
|
||||||
|
androidTestImplementation(libs.androidx.espresso.core)
|
||||||
|
androidTestImplementation(platform(libs.androidx.compose.bom))
|
||||||
|
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
|
||||||
|
debugImplementation(libs.androidx.compose.ui.tooling)
|
||||||
|
debugImplementation(libs.androidx.compose.ui.test.manifest)
|
||||||
|
implementation("androidx.compose.material:material-icons-extended")
|
||||||
|
implementation("com.squareup.okhttp3:okhttp:4.12.0")
|
||||||
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
|
implementation("androidx.glance:glance-appwidget:1.1.0") // Oder aktuellste Version
|
||||||
|
implementation("androidx.glance:glance-material3:1.1.0")
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
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("de.schanbro.screenity", appContext.packageName)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?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.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:icon="@mipmap/screenity_edited"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/screenity_edited_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.Screenity">
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@style/Theme.Screenity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".WidgetConfigActivity"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name=".ScreentimeWidgetReceiver"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data
|
||||||
|
android:name="android.appwidget.provider"
|
||||||
|
android:resource="@xml/screentime_widget_info" />
|
||||||
|
</receiver>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.provider.Settings
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
import okhttp3.*
|
||||||
|
import okhttp3.MediaType.Companion.toMediaType
|
||||||
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
data class DeviceFullData(
|
||||||
|
val device_id: String,
|
||||||
|
val device_name: String,
|
||||||
|
val reports: Map<String, DayReport>
|
||||||
|
)
|
||||||
|
|
||||||
|
// --- NETZWERK LOGIK ---
|
||||||
|
suspend fun sendDataToServer(
|
||||||
|
context: Context,
|
||||||
|
url: String,
|
||||||
|
totalMs: Long,
|
||||||
|
usageList: List<AppUsageInfo>,
|
||||||
|
detailedEvents: List<ScreenEvent>
|
||||||
|
): Boolean = withContext(Dispatchers.IO) {
|
||||||
|
if (url.isBlank()) return@withContext false
|
||||||
|
val client = OkHttpClient()
|
||||||
|
val reportData = mapOf(
|
||||||
|
"device_id" to Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID),
|
||||||
|
"device_name" to android.os.Build.MODEL,
|
||||||
|
"report_date" to SimpleDateFormat("yyyy-MM-dd", Locale.US).format(Date()),
|
||||||
|
"total_screen_time_ms" to totalMs,
|
||||||
|
"apps" to usageList.map { mapOf("app_name" to it.appName, "usage_ms" to it.usageMs) }
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
val body = Gson().toJson(reportData).toRequestBody("application/json".toMediaType())
|
||||||
|
val request = Request.Builder().url("${url.trim().removeSuffix("/")}/report").post(body).build()
|
||||||
|
client.newCall(request).execute().isSuccessful
|
||||||
|
} catch (e: Exception) { false }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getSummaryFromServer(url: String): ServerSummary = withContext(Dispatchers.IO) {
|
||||||
|
val client = OkHttpClient()
|
||||||
|
val request = Request.Builder().url("${url.trim().removeSuffix("/")}/summary").build()
|
||||||
|
val response = client.newCall(request).execute()
|
||||||
|
if (!response.isSuccessful) throw Exception("Code: ${response.code}")
|
||||||
|
Gson().fromJson(response.body?.string(), ServerSummary::class.java)
|
||||||
|
}
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Refresh
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun DeviceDetailScreen(deviceId: String, onBack: () -> Unit) {
|
||||||
|
val context = LocalContext.current
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
val prefs = remember { context.getSharedPreferences("ScreenityPrefs", Context.MODE_PRIVATE) }
|
||||||
|
val serverUrl = prefs.getString("server_url", "") ?: ""
|
||||||
|
|
||||||
|
var isLoading by remember { mutableStateOf(true) }
|
||||||
|
var appsFromToday by remember { mutableStateOf<List<AppUsageDetail>>(emptyList()) }
|
||||||
|
var deviceName by remember { mutableStateOf("Gerät") }
|
||||||
|
|
||||||
|
val todayStr = SimpleDateFormat("yyyy-MM-dd", Locale.US).format(Date())
|
||||||
|
|
||||||
|
fun fetch() {
|
||||||
|
android.util.Log.d("SCREENITY_CHECK", "1. fetch() gestartet für ID: $deviceId")
|
||||||
|
if (serverUrl.isBlank()) return
|
||||||
|
|
||||||
|
scope.launch {
|
||||||
|
isLoading = true
|
||||||
|
try {
|
||||||
|
val client = OkHttpClient()
|
||||||
|
val fullUrl = "${serverUrl.trim().removeSuffix("/")}/summary"
|
||||||
|
val request = Request.Builder().url(fullUrl).build()
|
||||||
|
|
||||||
|
val response = withContext(Dispatchers.IO) { client.newCall(request).execute() }
|
||||||
|
|
||||||
|
if (response.isSuccessful) {
|
||||||
|
// WICHTIG: Body nur einmal auslesen und in Variable speichern
|
||||||
|
val responseBodyString = withContext(Dispatchers.IO) { response.body?.string() } ?: ""
|
||||||
|
android.util.Log.d("SCREENITY_CHECK", "2. JSON geladen, Länge: ${responseBodyString.length}")
|
||||||
|
|
||||||
|
if (responseBodyString.isNotBlank()) {
|
||||||
|
try {
|
||||||
|
val fullSummary = Gson().fromJson(responseBodyString, ServerSummary::class.java)
|
||||||
|
|
||||||
|
// Gerät in der Liste suchen
|
||||||
|
val device = fullSummary.devices.find { it.device_id.trim() == deviceId.trim() }
|
||||||
|
|
||||||
|
if (device != null) {
|
||||||
|
deviceName = device.device_name
|
||||||
|
android.util.Log.d("SCREENITY_CHECK", "3. Gerät gefunden: ${device.device_name}")
|
||||||
|
|
||||||
|
// Report für heute heraussuchen
|
||||||
|
val report = device.reports?.get(todayStr)
|
||||||
|
if (report != null) {
|
||||||
|
appsFromToday = report.apps ?: emptyList()
|
||||||
|
android.util.Log.d("SCREENITY_CHECK", "4. Apps für heute gefunden: ${appsFromToday.size}")
|
||||||
|
} else {
|
||||||
|
android.util.Log.w("SCREENITY_CHECK", "Hinweis: Kein Report für $todayStr vorhanden.")
|
||||||
|
// Debug: Zeige welche Tage da sind
|
||||||
|
android.util.Log.d("SCREENITY_CHECK", "Verfügbare Tage: ${device.reports?.keys}")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
android.util.Log.e("SCREENITY_CHECK", "Fehler: Gerät mit ID $deviceId nicht in Liste.")
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
android.util.Log.e("SCREENITY_CHECK", "Parsing-Fehler: ${e.message}")
|
||||||
|
android.util.Log.d("SCREENITY_CHECK", "Fehlerhaftes JSON: $responseBodyString")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
android.util.Log.e("SCREENITY_CHECK", "Server Fehler-Code: ${response.code}")
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
android.util.Log.e("SCREENITY_CHECK", "Netzwerk-Fehler: ${e.message}")
|
||||||
|
}
|
||||||
|
isLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LaunchedEffect(Unit) { fetch() }
|
||||||
|
|
||||||
|
ScreenWrapper(
|
||||||
|
title = "Details: $deviceName",
|
||||||
|
headerAction = {
|
||||||
|
IconButton(onClick = { fetch() }) {
|
||||||
|
Icon(Icons.Default.Refresh, contentDescription = "Aktualisieren")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
if (isLoading) {
|
||||||
|
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||||
|
CircularProgressIndicator()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Column(Modifier.fillMaxSize()) {
|
||||||
|
Text(
|
||||||
|
text = "App-Nutzung heute ($todayStr):",
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
color = MaterialTheme.colorScheme.primary,
|
||||||
|
modifier = Modifier.padding(bottom = 16.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
if (appsFromToday.isEmpty()) {
|
||||||
|
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||||
|
Text("Keine detaillierten Daten für heute gefunden.", style = MaterialTheme.typography.bodyMedium)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LazyColumn(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentPadding = PaddingValues(bottom = 24.dp)
|
||||||
|
) {
|
||||||
|
items(appsFromToday.sortedByDescending { it.usage_ms }) { app ->
|
||||||
|
AppUsageRow(app)
|
||||||
|
HorizontalDivider(modifier = Modifier.padding(vertical = 4.dp), thickness = 0.5.dp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun AppUsageRow(app: AppUsageDetail) {
|
||||||
|
val h = app.usage_ms / 3600000
|
||||||
|
val m = (app.usage_ms % 3600000) / 60000
|
||||||
|
val s = (app.usage_ms % 60000) / 1000
|
||||||
|
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 12.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = app.app_name,
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
style = MaterialTheme.typography.bodyLarge
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = if (h > 0) String.format("%dh %02dm", h, m) else String.format("%dm %02ds", m, s),
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontFamily = androidx.compose.ui.text.font.FontFamily.Monospace
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import android.app.usage.UsageEvents
|
||||||
|
import android.app.usage.UsageStatsManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.provider.Settings
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.CloudUpload
|
||||||
|
import androidx.compose.material.icons.filled.Refresh
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
import okhttp3.MediaType.Companion.toMediaType
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
data class DeviceSummary(
|
||||||
|
val device_id: String,
|
||||||
|
val device_name: String,
|
||||||
|
val total_screen_time_hours: Double,
|
||||||
|
val today_ms: Long,
|
||||||
|
val reports: Map<String, DayReport>? // Wichtig: Hier müssen die Reports drin sein!
|
||||||
|
)
|
||||||
|
|
||||||
|
data class DayReport(
|
||||||
|
@SerializedName("total_screen_time_ms") val totalMs: Long,
|
||||||
|
val apps: List<AppUsageDetail>? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
data class AppUsageDetail(
|
||||||
|
@SerializedName("app_name") val app_name: String,
|
||||||
|
@SerializedName("usage_ms") val usage_ms: Long
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun DevicesScreen(onNavigateToDetail: (String) -> Unit) {
|
||||||
|
val context = LocalContext.current
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
val prefs = remember { context.getSharedPreferences("ScreenityPrefs", Context.MODE_PRIVATE) }
|
||||||
|
val serverUrl = prefs.getString("server_url", "") ?: ""
|
||||||
|
|
||||||
|
var devicesList by remember { mutableStateOf(emptyList<DeviceSummary>()) }
|
||||||
|
var isLoading by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
fun fetch() {
|
||||||
|
if (serverUrl.isBlank()) return
|
||||||
|
scope.launch {
|
||||||
|
isLoading = true
|
||||||
|
try {
|
||||||
|
val result = getSummaryFromServer(serverUrl)
|
||||||
|
// Hier greifen wir auf die Liste der Geräte zu:
|
||||||
|
val fetchedDevices = result.devices
|
||||||
|
devicesList = fetchedDevices
|
||||||
|
|
||||||
|
// --- AB HIER NEU: Echte Geräte für das Widget sichern ---
|
||||||
|
// Wir ziehen uns alle Gerätenamen aus der Liste heraus
|
||||||
|
val deviceNames = fetchedDevices.map { it.device_name }.toSet()
|
||||||
|
|
||||||
|
// Wir speichern das Set in den SharedPreferences ab
|
||||||
|
prefs.edit().putStringSet("known_device_ids", deviceNames).apply()
|
||||||
|
// --- ENDE NEU ---
|
||||||
|
|
||||||
|
} catch (e: Exception) {
|
||||||
|
// Fehlerbehandlung (z.B. Loggen oder Toast)
|
||||||
|
}
|
||||||
|
isLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LaunchedEffect(Unit) { fetch() }
|
||||||
|
|
||||||
|
ScreenWrapper(
|
||||||
|
title = stringResource(R.string.devices_overview),
|
||||||
|
headerAction = {
|
||||||
|
IconButton(onClick = { fetch() }) {
|
||||||
|
Icon(Icons.Default.Refresh, contentDescription = null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
if (isLoading) {
|
||||||
|
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||||
|
CircularProgressIndicator()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LazyColumn(modifier = Modifier.fillMaxSize()) {
|
||||||
|
items(
|
||||||
|
items = devicesList,
|
||||||
|
key = { it.device_id }
|
||||||
|
) { device ->
|
||||||
|
DeviceUsageRow(
|
||||||
|
device = device,
|
||||||
|
onClick = { onNavigateToDetail(device.device_id) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun DeviceUsageRow(device: DeviceSummary, onClick: () -> Unit) {
|
||||||
|
val h = device.today_ms / 3600000
|
||||||
|
val m = (device.today_ms % 3600000) / 60000
|
||||||
|
|
||||||
|
Card(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 6.dp)
|
||||||
|
.clickable { onClick() },
|
||||||
|
elevation = CardDefaults.cardElevation(2.dp)
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.padding(16.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
|
Text(device.device_name, style = MaterialTheme.typography.titleMedium)
|
||||||
|
Text("ID: ${device.device_id.take(8)}...", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
text = String.format("%dh %02dm", h, m),
|
||||||
|
fontFamily = androidx.compose.ui.text.font.FontFamily.Monospace,
|
||||||
|
style = MaterialTheme.typography.titleLarge,
|
||||||
|
color = MaterialTheme.colorScheme.primary
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,288 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import android.app.usage.UsageEvents
|
||||||
|
import android.app.usage.UsageStatsManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.provider.Settings
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.CloudUpload
|
||||||
|
import androidx.compose.material.icons.filled.Refresh
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
import okhttp3.MediaType.Companion.toMediaType
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
// --- DATENMODELL ---
|
||||||
|
data class AppUsageInfo(
|
||||||
|
val appName: String,
|
||||||
|
val usageMs: Long
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
@Preview
|
||||||
|
fun LocalScreen() {
|
||||||
|
val context = LocalContext.current
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
val snackbarHostState = remember { SnackbarHostState() }
|
||||||
|
val prefs = remember { context.getSharedPreferences("ScreenityPrefs", Context.MODE_PRIVATE) }
|
||||||
|
val serverUrl = prefs.getString("server_url", "") ?: ""
|
||||||
|
|
||||||
|
var usageList by remember { mutableStateOf<List<AppUsageInfo>>(emptyList()) }
|
||||||
|
var totalMs by remember { mutableLongStateOf(0L) }
|
||||||
|
val detailedEvents = getDetailedEvents(context)
|
||||||
|
var isSending by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
fun load() {
|
||||||
|
scope.launch {
|
||||||
|
// getTodayUsageEvents solltest du am besten auch auf suspend umstellen!
|
||||||
|
usageList = getTodayUsageEvents(context)
|
||||||
|
|
||||||
|
// Hier rufen wir unsere neue asynchrone Funktion auf
|
||||||
|
totalMs = getTotalScreenTime(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Beim ersten Start des Screens laden
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
|
Scaffold(snackbarHost = { SnackbarHost(snackbarHostState) }) { padding ->
|
||||||
|
ScreenWrapper(
|
||||||
|
title = stringResource(R.string.this_device),
|
||||||
|
headerAction = {
|
||||||
|
IconButton(onClick = { load() }) { Icon(Icons.Default.Refresh, null) }
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
TotalTimeCard(totalMs)
|
||||||
|
Spacer(Modifier.height(12.dp))
|
||||||
|
|
||||||
|
val successMessage = stringResource(R.string.sent)
|
||||||
|
val errorMessage = stringResource(R.string.error)
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
scope.launch {
|
||||||
|
isSending = true
|
||||||
|
val ok = sendDataToServer(context, serverUrl, totalMs, usageList, detailedEvents)
|
||||||
|
snackbarHostState.showSnackbar(if(ok) successMessage else errorMessage)
|
||||||
|
isSending = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
enabled = !isSending && serverUrl.isNotBlank()
|
||||||
|
) {
|
||||||
|
if (isSending) CircularProgressIndicator(Modifier.size(20.dp))
|
||||||
|
else Text(stringResource(R.string.upload_data))
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(Modifier.height(12.dp)) // Kleiner Abstand zur Liste
|
||||||
|
|
||||||
|
LazyColumn(Modifier.weight(1f)) {
|
||||||
|
items(usageList) { app -> AppUsageRow(app) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- UI KOMPONENTEN ---
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun TotalTimeCard(totalMs: Long) {
|
||||||
|
val h = totalMs / 3600000
|
||||||
|
val m = (totalMs % 3600000) / 60000
|
||||||
|
val s = (totalMs % 60000) / 1000
|
||||||
|
|
||||||
|
Card(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.primaryContainer)
|
||||||
|
) {
|
||||||
|
Column(Modifier.padding(16.dp)) {
|
||||||
|
Text(text = stringResource(R.string.all_time), style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary)
|
||||||
|
Text(
|
||||||
|
text = String.format("%02dh %02dm %02ds", h, m, s),
|
||||||
|
style = MaterialTheme.typography.displayMedium,
|
||||||
|
fontFamily = androidx.compose.ui.text.font.FontFamily.Monospace
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun AppUsageRow(app: AppUsageInfo) {
|
||||||
|
val hours = app.usageMs / 3600000
|
||||||
|
val minutes = (app.usageMs % 3600000) / 60000
|
||||||
|
val seconds = (app.usageMs % 60000) / 1000
|
||||||
|
|
||||||
|
Card(modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp)) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.padding(16.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(app.appName, modifier = Modifier.weight(1f), style = MaterialTheme.typography.titleSmall)
|
||||||
|
Text(
|
||||||
|
text = String.format("%02dh %02dm %02ds", hours, minutes, seconds),
|
||||||
|
fontFamily = androidx.compose.ui.text.font.FontFamily.Monospace,
|
||||||
|
color = MaterialTheme.colorScheme.primary,
|
||||||
|
style = MaterialTheme.typography.bodyMedium
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- SYSTEM LOGIK (PROFI-METHODEN) ---
|
||||||
|
|
||||||
|
suspend fun getTodayUsageEvents(context: Context): List<AppUsageInfo> = withContext(Dispatchers.IO) {
|
||||||
|
val usm = context.getSystemService(Context.USAGE_STATS_SERVICE) as UsageStatsManager
|
||||||
|
val calendar = Calendar.getInstance().apply {
|
||||||
|
set(Calendar.HOUR_OF_DAY, 0); set(Calendar.MINUTE, 0); set(Calendar.SECOND, 0); set(Calendar.MILLISECOND, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
val events = usm.queryEvents(calendar.timeInMillis, System.currentTimeMillis())
|
||||||
|
val event = UsageEvents.Event()
|
||||||
|
|
||||||
|
val appUsageMap = mutableMapOf<String, Long>()
|
||||||
|
val openApps = mutableMapOf<String, Long>()
|
||||||
|
|
||||||
|
var lastActivePackageName: String? = null
|
||||||
|
var screenOnTime: Long? = null
|
||||||
|
|
||||||
|
while (events.hasNextEvent()) {
|
||||||
|
events.getNextEvent(event)
|
||||||
|
val packageName = event.packageName
|
||||||
|
|
||||||
|
when (event.eventType) {
|
||||||
|
UsageEvents.Event.MOVE_TO_FOREGROUND -> {
|
||||||
|
// Wenn der Bildschirm gerade erst angegangen ist UND direkt eine NEUE App startet,
|
||||||
|
// löschen wir den Verdacht, dass die alte App weiterlief!
|
||||||
|
if (screenOnTime != null && packageName != lastActivePackageName) {
|
||||||
|
screenOnTime = null
|
||||||
|
}
|
||||||
|
|
||||||
|
// Falls der Verdacht stimmte und die ALTE App weiterlief:
|
||||||
|
if (screenOnTime != null && lastActivePackageName != null) {
|
||||||
|
openApps[lastActivePackageName] = screenOnTime!!
|
||||||
|
screenOnTime = null
|
||||||
|
}
|
||||||
|
|
||||||
|
openApps[packageName] = event.timeStamp
|
||||||
|
lastActivePackageName = packageName
|
||||||
|
}
|
||||||
|
|
||||||
|
UsageEvents.Event.MOVE_TO_BACKGROUND -> {
|
||||||
|
val start = openApps.remove(packageName)
|
||||||
|
if (start != null) {
|
||||||
|
val duration = event.timeStamp - start
|
||||||
|
appUsageMap[packageName] = appUsageMap.getOrDefault(packageName, 0L) + duration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UsageEvents.Event.SCREEN_NON_INTERACTIVE -> {
|
||||||
|
val now = event.timeStamp
|
||||||
|
openApps.forEach { (pkg, start) ->
|
||||||
|
appUsageMap[pkg] = appUsageMap.getOrDefault(pkg, 0L) + (now - start)
|
||||||
|
}
|
||||||
|
openApps.clear()
|
||||||
|
screenOnTime = null
|
||||||
|
}
|
||||||
|
|
||||||
|
UsageEvents.Event.SCREEN_INTERACTIVE -> {
|
||||||
|
// Wir merken uns NUR den Zeitpunkt. Wir tragen die App noch nicht als "laufend" ein!
|
||||||
|
// Wir warten ab, was das nächste Event sagt.
|
||||||
|
screenOnTime = event.timeStamp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Am Ende der Schleife: Falls der Bildschirm an ging und DANACH kein Event mehr kam,
|
||||||
|
// lief die letzte App tatsächlich weiter.
|
||||||
|
if (screenOnTime != null && lastActivePackageName != null) {
|
||||||
|
openApps[lastActivePackageName] = screenOnTime!!
|
||||||
|
}
|
||||||
|
|
||||||
|
// Abrechnung bis JETZT
|
||||||
|
val now = System.currentTimeMillis()
|
||||||
|
openApps.forEach { (pkg, start) ->
|
||||||
|
appUsageMap[pkg] = appUsageMap.getOrDefault(pkg, 0L) + (now - start)
|
||||||
|
}
|
||||||
|
|
||||||
|
val pm = context.packageManager
|
||||||
|
appUsageMap.map { (pkg, ms) ->
|
||||||
|
val name = try { pm.getApplicationLabel(pm.getApplicationInfo(pkg, 0)).toString() } catch (e: Exception) { pkg }
|
||||||
|
AppUsageInfo(name, ms)
|
||||||
|
}.sortedByDescending { it.usageMs }
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getTotalScreenTime(context: Context): Long = withContext(Dispatchers.IO) {
|
||||||
|
val usm = context.getSystemService(Context.USAGE_STATS_SERVICE) as UsageStatsManager
|
||||||
|
val calendar = Calendar.getInstance().apply {
|
||||||
|
set(Calendar.HOUR_OF_DAY, 0)
|
||||||
|
set(Calendar.MINUTE, 0)
|
||||||
|
set(Calendar.SECOND, 0)
|
||||||
|
set(Calendar.MILLISECOND, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
val events = usm.queryEvents(calendar.timeInMillis, System.currentTimeMillis())
|
||||||
|
val event = UsageEvents.Event()
|
||||||
|
|
||||||
|
var totalTime = 0L
|
||||||
|
var sessionStartTime = 0L
|
||||||
|
val openApps = mutableSetOf<String>()
|
||||||
|
|
||||||
|
while (events.hasNextEvent()) {
|
||||||
|
events.getNextEvent(event)
|
||||||
|
val packageName = event.packageName
|
||||||
|
|
||||||
|
when (event.eventType) {
|
||||||
|
UsageEvents.Event.MOVE_TO_FOREGROUND -> {
|
||||||
|
if (openApps.isEmpty()) {
|
||||||
|
sessionStartTime = event.timeStamp
|
||||||
|
}
|
||||||
|
openApps.add(packageName)
|
||||||
|
}
|
||||||
|
|
||||||
|
UsageEvents.Event.MOVE_TO_BACKGROUND -> {
|
||||||
|
openApps.remove(packageName)
|
||||||
|
if (openApps.isEmpty() && sessionStartTime != 0L) {
|
||||||
|
totalTime += (event.timeStamp - sessionStartTime)
|
||||||
|
sessionStartTime = 0L
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UsageEvents.Event.SCREEN_NON_INTERACTIVE -> {
|
||||||
|
if (sessionStartTime != 0L) {
|
||||||
|
totalTime += (event.timeStamp - sessionStartTime)
|
||||||
|
sessionStartTime = 0L
|
||||||
|
}
|
||||||
|
openApps.clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sessionStartTime != 0L) {
|
||||||
|
totalTime += (System.currentTimeMillis() - sessionStartTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Das Ergebnis wird automatisch zurückgegeben
|
||||||
|
return@withContext totalTime
|
||||||
|
}
|
||||||
@@ -0,0 +1,268 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.activity.ComponentActivity
|
||||||
|
import androidx.activity.compose.setContent
|
||||||
|
import androidx.activity.enableEdgeToEdge
|
||||||
|
import androidx.compose.animation.core.tween
|
||||||
|
import androidx.compose.animation.fadeIn
|
||||||
|
import androidx.compose.animation.fadeOut
|
||||||
|
import androidx.compose.animation.scaleIn
|
||||||
|
import androidx.compose.animation.scaleOut
|
||||||
|
import androidx.compose.animation.slideInHorizontally
|
||||||
|
import androidx.compose.animation.slideOutHorizontally
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.List
|
||||||
|
import androidx.compose.material.icons.filled.Edit
|
||||||
|
import androidx.compose.material.icons.filled.Info
|
||||||
|
import androidx.compose.material.icons.filled.Today
|
||||||
|
import androidx.compose.material.icons.filled.Devices
|
||||||
|
import androidx.compose.material.icons.filled.Settings
|
||||||
|
import androidx.compose.material3.Button
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.NavigationBar
|
||||||
|
import androidx.compose.material3.NavigationBarItem
|
||||||
|
import androidx.compose.material3.OutlinedTextField
|
||||||
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TopAppBar
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateListOf
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.navigation.compose.NavHost
|
||||||
|
import androidx.navigation.compose.composable
|
||||||
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
|
import androidx.navigation.compose.rememberNavController
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.material.icons.filled.PinDrop
|
||||||
|
import de.schanbro.screenity.ui.theme.ScreenityTheme
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.work.Constraints
|
||||||
|
import androidx.work.ExistingPeriodicWorkPolicy
|
||||||
|
import androidx.work.NetworkType
|
||||||
|
import androidx.work.PeriodicWorkRequestBuilder
|
||||||
|
import androidx.work.WorkManager
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
sealed class Screen(val route: String) {
|
||||||
|
object Today : Screen("today_screen")
|
||||||
|
|
||||||
|
object Local : Screen("local_screen")
|
||||||
|
object Devices : Screen("devices_screen")
|
||||||
|
object Settings : Screen("settings_screen")
|
||||||
|
object DeviceDetail : Screen("device_detail/{deviceId}")
|
||||||
|
}
|
||||||
|
|
||||||
|
class MainActivity : ComponentActivity() {
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
enableEdgeToEdge()
|
||||||
|
setContent {
|
||||||
|
ScreenityTheme {
|
||||||
|
val context = androidx.compose.ui.platform.LocalContext.current
|
||||||
|
val prefs = remember { context.getSharedPreferences("ScreenityPrefs", android.content.Context.MODE_PRIVATE) }
|
||||||
|
var serverUrl by remember {
|
||||||
|
mutableStateOf(prefs.getString("server_url", "") ?: "")
|
||||||
|
}
|
||||||
|
|
||||||
|
val savedInterval = prefs.getInt("upload_interval_mins", 15)
|
||||||
|
|
||||||
|
if (serverUrl.isBlank()) {
|
||||||
|
// Zeige Setup, wenn keine URL da ist
|
||||||
|
SetupScreen(onUrlSaved = { neueUrl ->
|
||||||
|
prefs.edit().putString("server_url", neueUrl).apply()
|
||||||
|
serverUrl = neueUrl // State-Update triggert Re-Composition
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
LaunchedEffect(serverUrl) {
|
||||||
|
if (serverUrl.isNotBlank()) {
|
||||||
|
// 1. SOFORTIGER UPLOAD BEIM APP-START
|
||||||
|
val totalMs = getTotalScreenTime(context)
|
||||||
|
val usageList = getTodayUsageEvents(context)
|
||||||
|
val detailedEvents = getDetailedEvents(applicationContext)
|
||||||
|
sendDataToServer(context, serverUrl, totalMs, usageList, detailedEvents)
|
||||||
|
|
||||||
|
// 2. 15-MINUTEN-AUTOMATISIERUNG EINRICHTEN
|
||||||
|
val constraints = Constraints.Builder()
|
||||||
|
.setRequiredNetworkType(NetworkType.CONNECTED) // Nur wenn Internet da ist
|
||||||
|
.build()
|
||||||
|
|
||||||
|
val uploadWorkRequest = PeriodicWorkRequestBuilder<UploadWorker>(
|
||||||
|
15, TimeUnit.MINUTES // Alle 15 Minuten (Minimum bei Android!)
|
||||||
|
)
|
||||||
|
.setConstraints(constraints)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
// Dem System übergeben
|
||||||
|
WorkManager.getInstance(context).enqueueUniquePeriodicWork(
|
||||||
|
"ScreentimeUploadWork",
|
||||||
|
ExistingPeriodicWorkPolicy.KEEP, // Behält den alten Timer, falls die App neu startet
|
||||||
|
uploadWorkRequest
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val navController = rememberNavController()
|
||||||
|
val currentBackStack by navController.currentBackStackEntryAsState()
|
||||||
|
val currentRoute = currentBackStack?.destination?.route
|
||||||
|
Scaffold(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
topBar = {
|
||||||
|
TopAppBar(
|
||||||
|
title = { Text(stringResource(R.string.app_name)) },
|
||||||
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.primaryContainer,
|
||||||
|
titleContentColor = MaterialTheme.colorScheme.primary
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
bottomBar = {
|
||||||
|
NavigationBar {
|
||||||
|
NavigationBarItem(
|
||||||
|
selected = currentRoute == Screen.Today.route,
|
||||||
|
onClick = { navController.navigate(Screen.Today.route) },
|
||||||
|
icon = { Icon(Icons.Default.Today, contentDescription = null) },
|
||||||
|
label = { Text(stringResource(R.string.Today)) }
|
||||||
|
)
|
||||||
|
NavigationBarItem(
|
||||||
|
selected = currentRoute == Screen.Local.route,
|
||||||
|
onClick = { navController.navigate(Screen.Local.route) },
|
||||||
|
icon = { Icon(Icons.Default.PinDrop, contentDescription = null) },
|
||||||
|
label = { Text(stringResource(R.string.Local)) }
|
||||||
|
)
|
||||||
|
NavigationBarItem(
|
||||||
|
selected = currentRoute == Screen.Devices.route,
|
||||||
|
onClick = { navController.navigate(Screen.Devices.route) },
|
||||||
|
icon = {
|
||||||
|
Icon(
|
||||||
|
Icons.Default.Devices,
|
||||||
|
contentDescription = null
|
||||||
|
)
|
||||||
|
},
|
||||||
|
label = { Text(stringResource(R.string.Devices)) }
|
||||||
|
)
|
||||||
|
NavigationBarItem(
|
||||||
|
selected = currentRoute == Screen.Settings.route,
|
||||||
|
onClick = { navController.navigate(Screen.Settings.route) },
|
||||||
|
icon = {
|
||||||
|
Icon(
|
||||||
|
Icons.Default.Settings,
|
||||||
|
contentDescription = null
|
||||||
|
)
|
||||||
|
},
|
||||||
|
label = { Text(stringResource(R.string.Settings)) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) { innerPadding ->
|
||||||
|
NavHost(
|
||||||
|
navController = navController,
|
||||||
|
startDestination = de.schanbro.screenity.Screen.Today.route,
|
||||||
|
modifier = Modifier.padding(innerPadding),
|
||||||
|
enterTransition = { fadeIn(animationSpec = tween(220)) + scaleIn(initialScale = 0.92f) },
|
||||||
|
exitTransition = { fadeOut(animationSpec = tween(90)) },
|
||||||
|
popEnterTransition = { fadeIn(animationSpec = tween(220)) },
|
||||||
|
popExitTransition = { fadeOut(animationSpec = tween(90)) + scaleOut(targetScale = 0.92f) }
|
||||||
|
) {
|
||||||
|
composable(de.schanbro.screenity.Screen.Today.route) {
|
||||||
|
TodayScreen()
|
||||||
|
}
|
||||||
|
composable(de.schanbro.screenity.Screen.Local.route) {
|
||||||
|
LocalScreen()
|
||||||
|
}
|
||||||
|
composable(de.schanbro.screenity.Screen.Devices.route) {
|
||||||
|
DevicesScreen(onNavigateToDetail = { id ->
|
||||||
|
navController.navigate("device_detail/$id")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
composable(de.schanbro.screenity.Screen.Settings.route) {
|
||||||
|
SettingsScreen()
|
||||||
|
}
|
||||||
|
composable(Screen.DeviceDetail.route) { backStackEntry ->
|
||||||
|
val deviceId = backStackEntry.arguments?.getString("deviceId") ?: ""
|
||||||
|
DeviceDetailScreen(
|
||||||
|
deviceId = deviceId,
|
||||||
|
onBack = { navController.popBackStack() } // Geht zurück zum TodayScreen
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun SetupScreen(onUrlSaved: (String) -> Unit) {
|
||||||
|
var urlInput by remember { mutableStateOf("") }
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.fillMaxSize().padding(24.dp),
|
||||||
|
verticalArrangement = Arrangement.Center,
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
Text(stringResource(R.string.welcome)+"!", style = MaterialTheme.typography.headlineSmall)
|
||||||
|
Text(stringResource(R.string.pls_enter_url))
|
||||||
|
|
||||||
|
Spacer(Modifier.height(16.dp))
|
||||||
|
|
||||||
|
OutlinedTextField(
|
||||||
|
value = urlInput,
|
||||||
|
onValueChange = { urlInput = it },
|
||||||
|
label = { Text(stringResource(R.string.ex_server_url)) },
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
placeholder = { Text("http://...") }
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(Modifier.height(16.dp))
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = { if (urlInput.isNotBlank()) onUrlSaved(urlInput) },
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
enabled = urlInput.startsWith("http") // Kleine Sicherheitssperre
|
||||||
|
) {
|
||||||
|
Text(stringResource(R.string.connect_and_start))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateUploadWork(context: Context, intervalMinutes: Long) {
|
||||||
|
val constraints = Constraints.Builder()
|
||||||
|
.setRequiredNetworkType(NetworkType.CONNECTED)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
val uploadWorkRequest = PeriodicWorkRequestBuilder<UploadWorker>(
|
||||||
|
intervalMinutes, TimeUnit.MINUTES
|
||||||
|
)
|
||||||
|
.setConstraints(constraints)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
// UPDATE steht hier für "REPLACE"
|
||||||
|
// Wenn sich das Intervall ändert, bricht Android den alten Timer ab
|
||||||
|
// und fängt mit der neuen Zeit von vorne an zu zählen!
|
||||||
|
WorkManager.getInstance(context).enqueueUniquePeriodicWork(
|
||||||
|
"ScreentimeUploadWork",
|
||||||
|
ExistingPeriodicWorkPolicy.REPLACE,
|
||||||
|
uploadWorkRequest
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.glance.GlanceId
|
||||||
|
import androidx.glance.GlanceModifier
|
||||||
|
import androidx.glance.appwidget.GlanceAppWidget
|
||||||
|
import androidx.glance.appwidget.GlanceAppWidgetReceiver
|
||||||
|
import androidx.glance.appwidget.GlanceAppWidgetManager
|
||||||
|
import androidx.glance.appwidget.provideContent
|
||||||
|
import androidx.glance.background
|
||||||
|
import androidx.glance.layout.*
|
||||||
|
import androidx.glance.text.FontWeight
|
||||||
|
import androidx.glance.text.Text
|
||||||
|
import androidx.glance.text.TextStyle
|
||||||
|
import androidx.glance.unit.ColorProvider
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
class ScreentimeWidget : GlanceAppWidget() {
|
||||||
|
|
||||||
|
override suspend fun provideGlance(context: Context, id: GlanceId) {
|
||||||
|
val appWidgetId = GlanceAppWidgetManager(context).getAppWidgetId(id)
|
||||||
|
val prefs = context.getSharedPreferences("ScreenityPrefs", Context.MODE_PRIVATE)
|
||||||
|
|
||||||
|
// 1. Welche Geräte hat der Nutzer in der Config gewählt?
|
||||||
|
val selectedDevices = prefs.getStringSet("widget_${appWidgetId}_devices", emptySet()) ?: emptySet()
|
||||||
|
val serverUrl = prefs.getString("server_url", "") ?: ""
|
||||||
|
|
||||||
|
var totalMs = 0L
|
||||||
|
|
||||||
|
// 2. ECHTE DATEN VOM SERVER HOLEN
|
||||||
|
if (serverUrl.isNotBlank()) {
|
||||||
|
try {
|
||||||
|
val result = withContext(Dispatchers.IO) {
|
||||||
|
getSummaryFromServer(serverUrl)
|
||||||
|
}
|
||||||
|
|
||||||
|
// HIER IST DIE KORREKTUR: Wir greifen erst auf .devices zu!
|
||||||
|
val allDevices = result.devices
|
||||||
|
|
||||||
|
// Jetzt können wir filtern
|
||||||
|
val filteredDevices = allDevices.filter { it.device_id in selectedDevices || it.device_name in selectedDevices }
|
||||||
|
totalMs = filteredDevices.sumOf { it.today_ms }
|
||||||
|
|
||||||
|
} catch (e: Exception) {
|
||||||
|
// Bei Netzwerkfehlern bleibt totalMs einfach auf 0 oder du nimmst einen Cache
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zeit in Stunden und Minuten umrechnen
|
||||||
|
val hours = totalMs / 3600000
|
||||||
|
val minutes = (totalMs % 3600000) / 60000
|
||||||
|
val totalTimeText = String.format("%02dh %02dm", hours, minutes)
|
||||||
|
|
||||||
|
provideContent {
|
||||||
|
Column(
|
||||||
|
modifier = GlanceModifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.White)
|
||||||
|
.padding(12.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "Gesamtzeit",
|
||||||
|
style = TextStyle(fontWeight = FontWeight.Bold, color = ColorProvider(Color.Black))
|
||||||
|
)
|
||||||
|
Spacer(GlanceModifier.height(4.dp))
|
||||||
|
Text(
|
||||||
|
text = totalTimeText,
|
||||||
|
style = TextStyle(fontWeight = FontWeight.Bold, color = ColorProvider(Color.Blue))
|
||||||
|
)
|
||||||
|
Spacer(GlanceModifier.height(4.dp))
|
||||||
|
Text(
|
||||||
|
text = "${selectedDevices.size} Geräte",
|
||||||
|
style = TextStyle(color = ColorProvider(Color.Gray))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ScreentimeWidgetReceiver : GlanceAppWidgetReceiver() {
|
||||||
|
override val glanceAppWidget: GlanceAppWidget = ScreentimeWidget()
|
||||||
|
}
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.CheckCircle
|
||||||
|
import androidx.compose.material.icons.filled.Error
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import de.schanbro.screenity.ui.theme.SuccessGreen
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
|
// 1. ConnectionState erweitert, um Fehlermeldungen direkt mitzuführen
|
||||||
|
sealed class ConnectionState {
|
||||||
|
object Idle : ConnectionState()
|
||||||
|
object Loading : ConnectionState()
|
||||||
|
object Success : ConnectionState()
|
||||||
|
data class Error(val message: String) : ConnectionState() // Fehler trägt seine Nachricht selbst!
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun SettingsScreen() {
|
||||||
|
val context = LocalContext.current
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
val prefs = remember { context.getSharedPreferences("ScreenityPrefs", Context.MODE_PRIVATE) }
|
||||||
|
|
||||||
|
var urlInput by remember { mutableStateOf(prefs.getString("server_url", "") ?: "") }
|
||||||
|
var status by remember { mutableStateOf<ConnectionState>(ConnectionState.Idle) }
|
||||||
|
|
||||||
|
// Intervall auslesen (Standard: 15 Minuten)
|
||||||
|
var selectedInterval by remember { mutableIntStateOf(prefs.getInt("upload_interval_mins", 15)) }
|
||||||
|
|
||||||
|
ScreenWrapper(title = stringResource(R.string.Settings)) {
|
||||||
|
|
||||||
|
OutlinedTextField(
|
||||||
|
value = urlInput,
|
||||||
|
onValueChange = { urlInput = it; status = ConnectionState.Idle },
|
||||||
|
label = { Text(stringResource(R.string.server_url)) },
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(Modifier.height(24.dp))
|
||||||
|
|
||||||
|
// --- MATERIAL 3 SLIDER ---
|
||||||
|
Text(
|
||||||
|
text = "Upload-Intervall: $selectedInterval Minuten",
|
||||||
|
style = MaterialTheme.typography.titleSmall
|
||||||
|
)
|
||||||
|
|
||||||
|
Slider(
|
||||||
|
value = selectedInterval.toFloat(),
|
||||||
|
onValueChange = {
|
||||||
|
selectedInterval = it.roundToInt()
|
||||||
|
},
|
||||||
|
valueRange = 15f..120f,
|
||||||
|
steps = 6
|
||||||
|
)
|
||||||
|
|
||||||
|
// Kleine Beschriftung unter dem Slider
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Text("15 min", style = MaterialTheme.typography.bodySmall)
|
||||||
|
Text("120 min", style = MaterialTheme.typography.bodySmall)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(Modifier.height(32.dp))
|
||||||
|
|
||||||
|
val errorMessage = stringResource(R.string.error)
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
// 1. Einstellungen speichern
|
||||||
|
prefs.edit()
|
||||||
|
.putString("server_url", urlInput)
|
||||||
|
.putInt("upload_interval_mins", selectedInterval)
|
||||||
|
.apply()
|
||||||
|
|
||||||
|
// 2. WorkManager mit neuem Intervall updaten!
|
||||||
|
updateUploadWork(context, selectedInterval.toLong())
|
||||||
|
|
||||||
|
scope.launch {
|
||||||
|
status = ConnectionState.Loading
|
||||||
|
try {
|
||||||
|
getSummaryFromServer(urlInput)
|
||||||
|
status = ConnectionState.Success
|
||||||
|
} catch (e: Exception) {
|
||||||
|
val detail = e.localizedMessage ?: errorMessage
|
||||||
|
status = ConnectionState.Error(detail)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Text(stringResource(R.string.save_and_try))
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(Modifier.height(24.dp))
|
||||||
|
|
||||||
|
ConnectionStatusWidget(state = status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ConnectionStatusWidget(state: ConnectionState) {
|
||||||
|
when (state) {
|
||||||
|
is ConnectionState.Loading -> {
|
||||||
|
Box(Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
|
||||||
|
CircularProgressIndicator()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is ConnectionState.Success -> {
|
||||||
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
|
Icon(Icons.Default.CheckCircle, "OK", tint = SuccessGreen)
|
||||||
|
Spacer(Modifier.width(8.dp))
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.connection_successful),
|
||||||
|
color = SuccessGreen,
|
||||||
|
style = MaterialTheme.typography.titleSmall
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
is ConnectionState.Error -> {
|
||||||
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
|
Icon(Icons.Default.Error, stringResource(R.string.error), tint = MaterialTheme.colorScheme.error)
|
||||||
|
Spacer(Modifier.width(8.dp))
|
||||||
|
Column {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.server_not_reachable),
|
||||||
|
color = MaterialTheme.colorScheme.error,
|
||||||
|
style = MaterialTheme.typography.titleSmall
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = state.message,
|
||||||
|
color = MaterialTheme.colorScheme.error,
|
||||||
|
style = MaterialTheme.typography.bodySmall
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
|
// Das ist wie eine CSS-Klasse für die Screen-Struktur!
|
||||||
|
@Composable
|
||||||
|
fun ScreenWrapper(
|
||||||
|
title: String,
|
||||||
|
headerAction: @Composable (() -> Unit)? = null,
|
||||||
|
content: @Composable ColumnScope.() -> Unit
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(16.dp) // Zentrales Padding für die gesamte App
|
||||||
|
) {
|
||||||
|
// Einheitlicher Header für alle Screens
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.Top
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = title,
|
||||||
|
style = MaterialTheme.typography.headlineMedium,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface
|
||||||
|
)
|
||||||
|
headerAction?.invoke()
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(Modifier.height(16.dp))
|
||||||
|
|
||||||
|
// Hier wird der eigentliche Inhalt des Screens eingesetzt
|
||||||
|
content()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import android.app.usage.UsageEvents
|
||||||
|
import android.app.usage.UsageStatsManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.provider.Settings
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.CloudUpload
|
||||||
|
import androidx.compose.material.icons.filled.Refresh
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
import okhttp3.MediaType.Companion.toMediaType
|
||||||
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
data class ServerSummary(
|
||||||
|
val devices: List<DeviceSummary>,
|
||||||
|
val total_all_devices_hours: Double,
|
||||||
|
val today_total_all_devices_ms: Long
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun TodayScreen() {
|
||||||
|
val context = LocalContext.current
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
val prefs = remember { context.getSharedPreferences("ScreenityPrefs", Context.MODE_PRIVATE) }
|
||||||
|
val serverUrl = prefs.getString("server_url", "") ?: ""
|
||||||
|
|
||||||
|
var summary by remember { mutableStateOf<ServerSummary?>(null) }
|
||||||
|
var isLoading by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
fun fetch() {
|
||||||
|
if (serverUrl.isBlank()) return
|
||||||
|
scope.launch {
|
||||||
|
isLoading = true
|
||||||
|
try {
|
||||||
|
summary = getSummaryFromServer(serverUrl)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
}
|
||||||
|
isLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LaunchedEffect(Unit) { fetch() }
|
||||||
|
|
||||||
|
ScreenWrapper(
|
||||||
|
title = stringResource(R.string.all_time),
|
||||||
|
headerAction = {
|
||||||
|
IconButton(onClick = { fetch() }) {
|
||||||
|
Icon(Icons.Default.Refresh, contentDescription = null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
if (isLoading) {
|
||||||
|
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||||
|
CircularProgressIndicator()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
summary?.let {
|
||||||
|
// Nutzt die bereits definierte Card für die große Anzeige
|
||||||
|
TotalAllDevicesCard(it.today_total_all_devices_ms)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun TotalAllDevicesCard(totalMs: Long) {
|
||||||
|
val h = totalMs / 3600000
|
||||||
|
val m = (totalMs % 3600000) / 60000
|
||||||
|
val s = (totalMs % 60000) / 1000
|
||||||
|
|
||||||
|
Card(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(bottom = 16.dp),
|
||||||
|
colors = CardDefaults.cardColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.tertiaryContainer
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Column(Modifier.padding(16.dp)) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.all_time),
|
||||||
|
style = MaterialTheme.typography.titleSmall,
|
||||||
|
color = MaterialTheme.colorScheme.onTertiary
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = String.format("%02dh %02dm %02ds", h, m, s),
|
||||||
|
style = MaterialTheme.typography.displayMedium,
|
||||||
|
fontFamily = androidx.compose.ui.text.font.FontFamily.Monospace
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.work.CoroutineWorker
|
||||||
|
import androidx.work.WorkerParameters
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
|
class UploadWorker(
|
||||||
|
appContext: Context,
|
||||||
|
workerParams: WorkerParameters
|
||||||
|
) : CoroutineWorker(appContext, workerParams) {
|
||||||
|
|
||||||
|
override suspend fun doWork(): Result = withContext(Dispatchers.IO) {
|
||||||
|
val prefs = applicationContext.getSharedPreferences("ScreenityPrefs", Context.MODE_PRIVATE)
|
||||||
|
val serverUrl = prefs.getString("server_url", "") ?: ""
|
||||||
|
|
||||||
|
if (serverUrl.isBlank()) {
|
||||||
|
return@withContext Result.failure()
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. Daten sammeln (Nutzt deine optimierten Funktionen!)
|
||||||
|
val totalMs = getTotalScreenTime(applicationContext)
|
||||||
|
val usageList = getTodayUsageEvents(applicationContext)
|
||||||
|
val detailedEvents = getDetailedEvents(applicationContext)
|
||||||
|
|
||||||
|
// 2. An den Server senden (deine bestehende Funktion)
|
||||||
|
val success = sendDataToServer(
|
||||||
|
applicationContext,
|
||||||
|
serverUrl,
|
||||||
|
totalMs,
|
||||||
|
usageList,
|
||||||
|
detailedEvents
|
||||||
|
)
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
Result.success()
|
||||||
|
} else {
|
||||||
|
Result.retry() // Android versucht es später nochmal, falls der Server offline war
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Result.failure()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.app.usage.UsageEvents
|
||||||
|
import android.app.usage.UsageStatsManager
|
||||||
|
import android.content.Context
|
||||||
|
import java.util.Calendar
|
||||||
|
|
||||||
|
data class ScreenEvent(
|
||||||
|
val timestamp: Long,
|
||||||
|
val type: String, // "SCREEN_ON", "SCREEN_OFF", "APP_OPEN", "APP_CLOSE"
|
||||||
|
val packageName: String? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
@SuppressLint("ServiceCast")
|
||||||
|
fun getDetailedEvents(context: Context): List<ScreenEvent> {
|
||||||
|
val usageStatsManager = context.getSystemService(Context.USAGE_STATS_SERVICE) as UsageStatsManager
|
||||||
|
val calendar = Calendar.getInstance()
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY, 0)
|
||||||
|
calendar.set(Calendar.MINUTE, 0)
|
||||||
|
calendar.set(Calendar.SECOND, 0)
|
||||||
|
|
||||||
|
val events = usageStatsManager.queryEvents(calendar.timeInMillis, System.currentTimeMillis())
|
||||||
|
val eventList = mutableListOf<ScreenEvent>()
|
||||||
|
val event = UsageEvents.Event()
|
||||||
|
|
||||||
|
while (events.hasNextEvent()) {
|
||||||
|
events.getNextEvent(event)
|
||||||
|
val type = when (event.eventType) {
|
||||||
|
UsageEvents.Event.SCREEN_INTERACTIVE -> "SCREEN_ON"
|
||||||
|
UsageEvents.Event.SCREEN_NON_INTERACTIVE -> "SCREEN_OFF"
|
||||||
|
UsageEvents.Event.ACTIVITY_RESUMED -> "APP_OPEN"
|
||||||
|
UsageEvents.Event.ACTIVITY_PAUSED -> "APP_CLOSE"
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type != null) {
|
||||||
|
eventList.add(ScreenEvent(
|
||||||
|
timestamp = event.timeStamp,
|
||||||
|
type = type,
|
||||||
|
packageName = if (type.startsWith("APP")) event.packageName else null
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return eventList
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.appwidget.AppWidgetManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.activity.ComponentActivity
|
||||||
|
import androidx.activity.compose.setContent
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
|
class WidgetConfigActivity : ComponentActivity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
val appWidgetId = intent?.extras?.getInt(
|
||||||
|
AppWidgetManager.EXTRA_APPWIDGET_ID,
|
||||||
|
AppWidgetManager.INVALID_APPWIDGET_ID
|
||||||
|
) ?: AppWidgetManager.INVALID_APPWIDGET_ID
|
||||||
|
|
||||||
|
if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
|
||||||
|
finish()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
setContent {
|
||||||
|
MaterialTheme {
|
||||||
|
Surface(modifier = Modifier.fillMaxSize()) {
|
||||||
|
WidgetConfigScreen(appWidgetId = appWidgetId) {
|
||||||
|
val resultValue = Intent().apply {
|
||||||
|
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
|
||||||
|
}
|
||||||
|
setResult(Activity.RESULT_OK, resultValue)
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun WidgetConfigScreen(appWidgetId: Int, onFinished: () -> Unit) {
|
||||||
|
val context = LocalContext.current
|
||||||
|
val prefs = remember { context.getSharedPreferences("ScreenityPrefs", Context.MODE_PRIVATE) }
|
||||||
|
|
||||||
|
// ECHTE DATEN: Wir lesen die bekannten Geräte-IDs aus den SharedPreferences
|
||||||
|
// (Diese Liste füllst du am besten immer auf, wenn du Daten vom Server erfolgreich abrufst)
|
||||||
|
val deviceIds = remember {
|
||||||
|
prefs.getStringSet("known_device_ids", setOf("Dieses Gerät")) ?: setOf("Dieses Gerät")
|
||||||
|
}.toList()
|
||||||
|
|
||||||
|
val selectedDevices = remember { mutableStateListOf<String>() }
|
||||||
|
|
||||||
|
Column(modifier = Modifier.padding(16.dp)) {
|
||||||
|
Text("Widget konfigurieren", style = MaterialTheme.typography.headlineSmall)
|
||||||
|
Spacer(Modifier.height(8.dp))
|
||||||
|
Text("Wähle die Geräte aus, deren Zeit addiert werden soll:", style = MaterialTheme.typography.bodyMedium)
|
||||||
|
|
||||||
|
Spacer(Modifier.height(16.dp))
|
||||||
|
|
||||||
|
// LazyColumn für den Fall, dass du sehr viele Geräte hast
|
||||||
|
LazyColumn(modifier = Modifier.weight(1f)) {
|
||||||
|
items(deviceIds) { deviceId ->
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(deviceId, style = MaterialTheme.typography.bodyLarge)
|
||||||
|
Checkbox(
|
||||||
|
checked = selectedDevices.contains(deviceId),
|
||||||
|
onCheckedChange = { checked ->
|
||||||
|
if (checked) selectedDevices.add(deviceId) else selectedDevices.remove(deviceId)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(Modifier.height(16.dp))
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
// Konfiguration für dieses spezifische Widget speichern
|
||||||
|
prefs.edit().putStringSet("widget_${appWidgetId}_devices", selectedDevices.toSet()).apply()
|
||||||
|
onFinished()
|
||||||
|
},
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
enabled = selectedDevices.isNotEmpty()
|
||||||
|
) {
|
||||||
|
Text("Widget erstellen")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package de.schanbro.screenity.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)
|
||||||
|
val SuccessGreen = Color(0xFF4CAF50)
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package de.schanbro.screenity.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 ScreenityTheme(
|
||||||
|
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
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package de.schanbro.screenity.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(
|
||||||
|
displayMedium = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Black,
|
||||||
|
fontSize = 32.sp,
|
||||||
|
lineHeight = 40.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
headlineLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Black,
|
||||||
|
fontSize = 32.sp,
|
||||||
|
lineHeight = 40.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
headlineMedium = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Black,
|
||||||
|
fontSize = 28.sp,
|
||||||
|
lineHeight = 36.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
headlineSmall = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 24.sp,
|
||||||
|
lineHeight = 32.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
titleLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 20.sp,
|
||||||
|
lineHeight = 28.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
titleMedium = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 18.sp,
|
||||||
|
lineHeight = 24.sp,
|
||||||
|
letterSpacing = 0.15.sp
|
||||||
|
),
|
||||||
|
titleSmall = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
lineHeight = 20.sp,
|
||||||
|
letterSpacing = 0.1.sp
|
||||||
|
),
|
||||||
|
bodyLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
lineHeight = 24.sp,
|
||||||
|
letterSpacing = 0.5.sp
|
||||||
|
),
|
||||||
|
bodyMedium = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
lineHeight = 20.sp,
|
||||||
|
letterSpacing = 0.25.sp
|
||||||
|
),
|
||||||
|
labelSmall = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
lineHeight = 16.sp,
|
||||||
|
letterSpacing = 0.5.sp
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="123.38dp"
|
||||||
|
android:height="123.45dp"
|
||||||
|
android:viewportWidth="123.38"
|
||||||
|
android:viewportHeight="123.45">
|
||||||
|
<path
|
||||||
|
android:pathData="M10.44,92.38 L82.86,19.62A32.17,32.02 90,1 0,50.46 73.01L72.92,50.44A32.17,32.02 90,1 1,40.52 103.83l72.42,-72.76"
|
||||||
|
android:strokeWidth="5.1"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:strokeLineCap="square"/>
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#1976D2"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
</vector>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<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="123.38"
|
||||||
|
android:viewportHeight="123.45">
|
||||||
|
<group android:scaleX="0.6871102"
|
||||||
|
android:scaleY="0.6875"
|
||||||
|
android:translateX="20.08758"
|
||||||
|
android:translateY="16.538586">
|
||||||
|
<path
|
||||||
|
android:pathData="M10.44,92.38 L82.86,19.62A32.17,32.02 90,1 0,50.46 73.01L72.92,50.44A32.17,32.02 90,1 1,40.52 103.83l72.42,-72.76"
|
||||||
|
android:strokeWidth="5.1"
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:strokeColor="#000000"
|
||||||
|
android:fillType="evenOdd"
|
||||||
|
android:strokeLineCap="square"/>
|
||||||
|
</group>
|
||||||
|
</vector>
|
||||||
@@ -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="@color/screenity_edited_background"/>
|
||||||
|
<foreground android:drawable="@drawable/screenity_edited_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
@@ -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="@color/screenity_edited_background"/>
|
||||||
|
<foreground android:drawable="@drawable/screenity_edited_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?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="@drawable/ic_launcher_foreground" />
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?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="@drawable/ic_launcher_foreground" />
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
|
</adaptive-icon>
|
||||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 982 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="Today">Today</string>
|
||||||
|
<string name="Devices">Devices</string>
|
||||||
|
<string name="Settings">Settings</string>
|
||||||
|
<string name="welcome">Welcome</string>
|
||||||
|
<string name="pls_enter_url">Please enter the server-URL to start.</string>
|
||||||
|
<string name="local_usagetime">Local time of usage</string>
|
||||||
|
<string name="refresh">Refresh</string>
|
||||||
|
<string name="no_data_permission">Couldn\'t find any data. Did you gave the permission?</string>
|
||||||
|
<string name="open_settings">Open settings!</string>
|
||||||
|
<string name="Local">Local</string>
|
||||||
|
<string name="all_time">All time</string>
|
||||||
|
<string name="ex_server_url">Server-URL (e. g. http://192.168.178.50:5000)</string>
|
||||||
|
<string name="connect_and_start">Connect and start</string>
|
||||||
|
<string name="devices_overview">Overview of devices</string>
|
||||||
|
<string name="all_devices_together">All devices combined</string>
|
||||||
|
<string name="this_device">This divice</string>
|
||||||
|
<string name="sent">Sent</string>
|
||||||
|
<string name="error">Error</string>
|
||||||
|
<string name="upload_data">Upload data</string>
|
||||||
|
<string name="server_url">Server-URL</string>
|
||||||
|
<string name="save_and_try">Save and try</string>
|
||||||
|
<string name="connection_successful">Connection successful!</string>
|
||||||
|
<string name="server_not_reachable">Server not reachable</string>
|
||||||
|
<string name="server_response">Server responses with code:</string>
|
||||||
|
<string name="unknown_network_error">Unknown network error</string>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="Today">Aujourd’hui</string>
|
||||||
|
<string name="Devices">Appareils</string>
|
||||||
|
<string name="Settings">Paramètres</string>
|
||||||
|
<string name="welcome">Bienvenue</string>
|
||||||
|
<string name="pls_enter_url">Veuillez saisir l’URL du serveur pour démarrer</string>
|
||||||
|
<string name="local_usagetime">Temps locale de utiliser</string>
|
||||||
|
<string name="refresh">Acutaliser</string>
|
||||||
|
<string name="no_data_permission">Grrrr les francais!!!</string>
|
||||||
|
<string name="open_settings">Ouvrir les parametrès!</string>
|
||||||
|
<string name="Local">Locale</string>
|
||||||
|
<string name="all_time">Tout les temps</string>
|
||||||
|
<string name="ex_server_url">L\'URL du serveur (p. e. http://192.168.178.50:5000)</string>
|
||||||
|
<string name="connect_and_start">Connecter et parir</string>
|
||||||
|
<string name="devices_overview">\?</string>
|
||||||
|
<string name="all_devices_together">\?</string>
|
||||||
|
<string name="this_device">Ce appareil</string>
|
||||||
|
<string name="sent">\?</string>
|
||||||
|
<string name="error">\?</string>
|
||||||
|
<string name="upload_data">\?</string>
|
||||||
|
<string name="server_url">L\'URL du serveur</string>
|
||||||
|
<string name="save_and_try">Saver et essayer</string>
|
||||||
|
<string name="connection_successful">\?</string>
|
||||||
|
<string name="server_not_reachable">\?</string>
|
||||||
|
<string name="server_response">Codé:</string>
|
||||||
|
<string name="unknown_network_error">\?</string>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="Today">\?</string>
|
||||||
|
<string name="server_response">\?</string>
|
||||||
|
<string name="unknown_network_error">\?</string>
|
||||||
|
<string name="Devices">\?</string>
|
||||||
|
<string name="Settings">\?</string>
|
||||||
|
<string name="welcome">\?</string>
|
||||||
|
<string name="pls_enter_url">\?</string>
|
||||||
|
<string name="local_usagetime">\?</string>
|
||||||
|
<string name="all_time">\?</string>
|
||||||
|
<string name="ex_server_url">\?</string>
|
||||||
|
<string name="refresh">\?</string>
|
||||||
|
<string name="no_data_permission">\?</string>
|
||||||
|
<string name="open_settings">\?</string>
|
||||||
|
<string name="Local">\?</string>
|
||||||
|
<string name="connect_and_start">\?</string>
|
||||||
|
<string name="devices_overview">\?</string>
|
||||||
|
<string name="all_devices_together">\?</string>
|
||||||
|
<string name="this_device">\?</string>
|
||||||
|
<string name="sent">\?</string>
|
||||||
|
<string name="error">\?</string>
|
||||||
|
<string name="upload_data">\?</string>
|
||||||
|
<string name="server_url">\?</string>
|
||||||
|
<string name="save_and_try">\?</string>
|
||||||
|
<string name="connection_successful">\?</string>
|
||||||
|
<string name="server_not_reachable">\?</string>
|
||||||
|
</resources>
|
||||||
@@ -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>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="screenity_edited_background">#3DDC84</color>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name" translatable="false">Screenity</string>
|
||||||
|
<string name="Today">Heute</string>
|
||||||
|
<string name="Devices">Geräte</string>
|
||||||
|
<string name="Settings">Einstellungen</string>
|
||||||
|
<string name="welcome">Willkommen</string>
|
||||||
|
<string name="pls_enter_url">Bitte gib die Server-URL ein, um zu starten.</string>
|
||||||
|
<string name="local_usagetime">Lokale Nutzungszeit</string>
|
||||||
|
<string name="refresh">Aktualisieren</string>
|
||||||
|
<string name="no_data_permission">Keine Daten gefunden. Hast du die Berechtigung erteilt?</string>
|
||||||
|
<string name="open_settings">Einstellungen öffnen!</string>
|
||||||
|
<string name="Local">Lokal</string>
|
||||||
|
<string name="all_time">Gesamte Bildschirmzeit</string>
|
||||||
|
<string name="ex_server_url">Server URL (z.B. http://192.168.178.50:5000)</string>
|
||||||
|
<string name="connect_and_start">Verbinden und Starten</string>
|
||||||
|
<string name="devices_overview">Geräteübersicht</string>
|
||||||
|
<string name="all_devices_together">Alle Geräte kombiniert</string>
|
||||||
|
<string name="this_device">Dieses Gerät</string>
|
||||||
|
<string name="sent">Gesendet</string>
|
||||||
|
<string name="error">Fehler</string>
|
||||||
|
<string name="upload_data">Daten hochladen</string>
|
||||||
|
<string name="server_url">Server URL</string>
|
||||||
|
<string name="save_and_try">Speichern und testen</string>
|
||||||
|
<string name="connection_successful">Verbindung erfolgreich!</string>
|
||||||
|
<string name="server_not_reachable">Server nicht erreichbar</string>
|
||||||
|
<string name="server_response">Server antwortet mit Code:</string>
|
||||||
|
<string name="unknown_network_error">Unbekannter Netzwerkfehler</string>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="Theme.Screenity" parent="android:Theme.Material.Light.NoActionBar" />
|
||||||
|
</resources>
|
||||||
@@ -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 than 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>
|
||||||
@@ -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>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:minWidth="110dp"
|
||||||
|
android:minHeight="110dp"
|
||||||
|
android:updatePeriodMillis="900000"
|
||||||
|
android:configure="de.schanbro.screenity.WidgetConfigActivity"
|
||||||
|
android:resizeMode="horizontal|vertical"
|
||||||
|
android:widgetCategory="home_screen">
|
||||||
|
</appwidget-provider>
|
||||||
|
After Width: | Height: | Size: 30 KiB |
@@ -0,0 +1,17 @@
|
|||||||
|
package de.schanbro.screenity
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
fun addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
[versions]
|
||||||
|
agp = "8.13.2"
|
||||||
|
kotlin = "2.0.21"
|
||||||
|
coreKtx = "1.18.0"
|
||||||
|
junit = "4.13.2"
|
||||||
|
junitVersion = "1.3.0"
|
||||||
|
espressoCore = "3.7.0"
|
||||||
|
lifecycleRuntimeKtx = "2.10.0"
|
||||||
|
activityCompose = "1.13.0"
|
||||||
|
composeBom = "2024.09.00"
|
||||||
|
navigationCompose = "2.9.7"
|
||||||
|
ui = "1.10.6"
|
||||||
|
material3 = "1.4.0"
|
||||||
|
uiGraphics = "1.10.6"
|
||||||
|
animation = "1.10.6"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
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-compose-ui = { group = "androidx.compose.ui", name = "ui" }
|
||||||
|
androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
|
||||||
|
androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
|
||||||
|
androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
||||||
|
androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
||||||
|
androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||||
|
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||||
|
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }
|
||||||
|
androidx-ui = { group = "androidx.compose.ui", name = "ui", version.ref = "ui" }
|
||||||
|
androidx-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
|
||||||
|
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics", version.ref = "uiGraphics" }
|
||||||
|
androidx-compose-animation = { group = "androidx.compose.animation", name = "animation", version.ref = "animation" }
|
||||||
|
|
||||||
|
[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" }
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#Tue Mar 31 11:46:03 CEST 2026
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -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" "$@"
|
||||||
@@ -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
|
||||||
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1 @@
|
|||||||
|
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
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
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
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
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 = "Screenity"
|
||||||
|
include(":app")
|
||||||
|
|
||||||