Modern Apps git

← Modern-Apps.git

new app: clock

Commit
6791258d4da55cc5f8d81a5411180fa45e6ec96a
Author
Vayun Mathur <[email protected]>
When
2026-03-04 05:23 UTC (9 months ago)
Parents
141cb73

Diff

.github/ISSUE_TEMPLATE/bug_report.yml
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlindex 7c81a88423..238e306610 100644--- a/.github/ISSUE_TEMPLATE/bug_report.yml+++ b/.github/ISSUE_TEMPLATE/bug_report.yml@@ -10,6 +10,7 @@ body:       description: Which app is experiencing the issue?       options:         - calendar+        - clock         - contacts         - crypto         - files
.github/ISSUE_TEMPLATE/feature_request.yml
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.ymlindex 84e5b6120c..5df9f068e8 100644--- a/.github/ISSUE_TEMPLATE/feature_request.yml+++ b/.github/ISSUE_TEMPLATE/feature_request.yml@@ -10,6 +10,7 @@ body:       description: Which app is this feature for?       options:         - calendar+        - clock         - contacts         - crypto         - files
.github/workflows/issue_labeler.yml
diff --git a/.github/workflows/issue_labeler.yml b/.github/workflows/issue_labeler.ymlindex 81e02395a7..f3a5be69ab 100644--- a/.github/workflows/issue_labeler.yml+++ b/.github/workflows/issue_labeler.yml@@ -21,7 +21,7 @@ jobs:                          if (match && match[1]) {               const selectedApp = match[1].trim().toLowerCase();-              const validApps = ['calendar', 'contacts', 'crypto', 'files', 'findfamily', 'chess', 'unblockjam', 'wordmaker', 'health', 'maps', 'music', 'notes', 'openassistant', 'passwords', 'pdf', 'photos', 'youpipe'];+              const validApps = ['calendar', 'clock', 'contacts', 'crypto', 'files', 'findfamily', 'chess', 'unblockjam', 'wordmaker', 'health', 'maps', 'music', 'notes', 'openassistant', 'passwords', 'pdf', 'photos', 'youpipe'];                            if (validApps.includes(selectedApp)) {                 await github.rest.issues.addLabels({
.idea/deploymentTargetSelector.xml
diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xmlindex 6e15c5b995..c7a267b95a 100644--- a/.idea/deploymentTargetSelector.xml+++ b/.idea/deploymentTargetSelector.xml@@ -64,6 +64,9 @@       <SelectionState runConfigName="music">         <option name="selectionMode" value="DROPDOWN" />       </SelectionState>+      <SelectionState runConfigName="clock">+        <option name="selectionMode" value="DROPDOWN" />+      </SelectionState>     </selectionStates>   </component> </project>\ No newline at end of file
.idea/gradle.xml
diff --git a/.idea/gradle.xml b/.idea/gradle.xmlindex 7563b08246..91c1c11524 100644--- a/.idea/gradle.xml+++ b/.idea/gradle.xml@@ -27,6 +27,7 @@             <option value="$PROJECT_DIR$/../NewPipeExtractor/timeago-generator" />             <option value="$PROJECT_DIR$" />             <option value="$PROJECT_DIR$/calendar" />+            <option value="$PROJECT_DIR$/clock" />             <option value="$PROJECT_DIR$/contacts" />             <option value="$PROJECT_DIR$/crypto" />             <option value="$PROJECT_DIR$/files" />
clock/.gitignore
diff --git a/clock/.gitignore b/clock/.gitignorenew file mode 100644index 0000000000..42afabfd2a--- /dev/null+++ b/clock/.gitignore@@ -0,0 +1 @@+/build\ No newline at end of file
clock/build.gradle.kts
diff --git a/clock/build.gradle.kts b/clock/build.gradle.ktsnew file mode 100644index 0000000000..a44142595e--- /dev/null+++ b/clock/build.gradle.kts@@ -0,0 +1,8 @@+dependencies {+    implementation(libs.androidx.navigation3.runtime)+}+android {+    defaultConfig {+        applicationId = "com.vayunmathur.clock"+    }+}\ No newline at end of file
clock/proguard-rules.pro
diff --git a/clock/proguard-rules.pro b/clock/proguard-rules.pronew file mode 100644index 0000000000..481bb43481--- /dev/null+++ b/clock/proguard-rules.pro@@ -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\ No newline at end of file
clock/src/main/AndroidManifest.xml
diff --git a/clock/src/main/AndroidManifest.xml b/clock/src/main/AndroidManifest.xmlnew file mode 100644index 0000000000..dc8970b481--- /dev/null+++ b/clock/src/main/AndroidManifest.xml@@ -0,0 +1,24 @@+<?xml version="1.0" encoding="utf-8"?>+<manifest xmlns:android="http://schemas.android.com/apk/res/android">++    <application+        android:allowBackup="true"+        android:dataExtractionRules="@xml/data_extraction_rules"+        android:icon="@mipmap/ic_launcher"+        android:label="@string/app_name"+        android:roundIcon="@mipmap/ic_launcher"+        android:supportsRtl="true"+        android:theme="@style/Theme.General">+        <activity+            android:name=".MainActivity"+            android:exported="true"+            android:theme="@style/Theme.General">+            <intent-filter>+                <action android:name="android.intent.action.MAIN" />++                <category android:name="android.intent.category.LAUNCHER" />+            </intent-filter>+        </activity>+    </application>++</manifest>\ No newline at end of file
clock/src/main/ic_launcher-playstore.png
diff --git a/clock/src/main/ic_launcher-playstore.png b/clock/src/main/ic_launcher-playstore.pngnew file mode 100644index 0000000000..d5b4f337e5Binary files /dev/null and b/clock/src/main/ic_launcher-playstore.png differ
clock/src/main/java/com/vayunmathur/clock/MainActivity.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/MainActivity.kt b/clock/src/main/java/com/vayunmathur/clock/MainActivity.ktnew file mode 100644index 0000000000..84d34d9393--- /dev/null+++ b/clock/src/main/java/com/vayunmathur/clock/MainActivity.kt@@ -0,0 +1,67 @@+package com.vayunmathur.clock++import android.os.Bundle+import androidx.activity.ComponentActivity+import androidx.activity.compose.setContent+import androidx.activity.enableEdgeToEdge+import androidx.compose.runtime.Composable+import androidx.navigation3.runtime.NavKey+import com.vayunmathur.clock.ui.AlarmPage+import com.vayunmathur.clock.ui.ClockPage+import com.vayunmathur.clock.ui.StopwatchPage+import com.vayunmathur.clock.ui.TimerPage+import com.vayunmathur.library.ui.DynamicTheme+import com.vayunmathur.library.util.BottomBarItem+import com.vayunmathur.library.util.MainNavigation+import com.vayunmathur.library.util.rememberNavBackStack+import kotlinx.serialization.Serializable++class MainActivity : ComponentActivity() {+    override fun onCreate(savedInstanceState: Bundle?) {+        super.onCreate(savedInstanceState)+        enableEdgeToEdge()+        setContent {+            DynamicTheme {+                Navigation()+            }+        }+    }+}++@Serializable+sealed interface Route : NavKey {+    @Serializable+    data object Alarm: Route+    @Serializable+    data object Clock: Route+    @Serializable+    data object Timer: Route+    @Serializable+    data object Stopwatch: Route+}++val MAIN_PAGES = listOf(+    BottomBarItem("Alarm", Route.Alarm, R.drawable.baseline_access_alarm_24),+    BottomBarItem("Clock", Route.Clock, R.drawable.baseline_access_time_24),+    BottomBarItem("Timer", Route.Timer, R.drawable.baseline_hourglass_bottom_24),+    BottomBarItem("Stopwatch", Route.Stopwatch, R.drawable.outline_timer_24)+)++@Composable+fun Navigation() {+    val backStack = rememberNavBackStack<Route>(Route.Alarm)+    MainNavigation(backStack) {+        entry<Route.Alarm> {+            AlarmPage(backStack)+        }+        entry<Route.Clock> {+            ClockPage(backStack)+        }+        entry<Route.Timer> {+            TimerPage(backStack)+        }+        entry<Route.Stopwatch> {+            StopwatchPage(backStack)+        }+    }+}\ No newline at end of file
clock/src/main/java/com/vayunmathur/clock/ui/AlarmPage.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/AlarmPage.kt b/clock/src/main/java/com/vayunmathur/clock/ui/AlarmPage.ktnew file mode 100644index 0000000000..eb7b405746--- /dev/null+++ b/clock/src/main/java/com/vayunmathur/clock/ui/AlarmPage.kt@@ -0,0 +1,28 @@+package com.vayunmathur.clock.ui++import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.padding+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.Scaffold+import androidx.compose.material3.Text+import androidx.compose.material3.TopAppBar+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.navigation3.runtime.NavBackStack+import com.vayunmathur.clock.MAIN_PAGES+import com.vayunmathur.clock.Route+import com.vayunmathur.library.util.BottomNavBar++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun AlarmPage(backStack: NavBackStack<Route>) {+    Scaffold(topBar = {+        TopAppBar({Text("Alarm")})+    }, bottomBar = {+        BottomNavBar(backStack, MAIN_PAGES, Route.Alarm)+    }) { paddingValues ->+        Column(Modifier.padding(paddingValues)) {++        }+    }+}\ No newline at end of file
clock/src/main/java/com/vayunmathur/clock/ui/ClockPage.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/ClockPage.kt b/clock/src/main/java/com/vayunmathur/clock/ui/ClockPage.ktnew file mode 100644index 0000000000..c687eca2f0--- /dev/null+++ b/clock/src/main/java/com/vayunmathur/clock/ui/ClockPage.kt@@ -0,0 +1,28 @@+package com.vayunmathur.clock.ui++import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.padding+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.Scaffold+import androidx.compose.material3.Text+import androidx.compose.material3.TopAppBar+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.navigation3.runtime.NavBackStack+import com.vayunmathur.clock.MAIN_PAGES+import com.vayunmathur.clock.Route+import com.vayunmathur.library.util.BottomNavBar++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun ClockPage(backStack: NavBackStack<Route>) {+    Scaffold(topBar = {+        TopAppBar({Text("Clock")})+    }, bottomBar = {+        BottomNavBar(backStack, MAIN_PAGES, Route.Clock)+    }) { paddingValues ->+        Column(Modifier.padding(paddingValues)) {++        }+    }+}\ No newline at end of file
clock/src/main/java/com/vayunmathur/clock/ui/StopwatchPage.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/StopwatchPage.kt b/clock/src/main/java/com/vayunmathur/clock/ui/StopwatchPage.ktnew file mode 100644index 0000000000..606c1f859d--- /dev/null+++ b/clock/src/main/java/com/vayunmathur/clock/ui/StopwatchPage.kt@@ -0,0 +1,28 @@+package com.vayunmathur.clock.ui++import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.padding+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.Scaffold+import androidx.compose.material3.Text+import androidx.compose.material3.TopAppBar+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.navigation3.runtime.NavBackStack+import com.vayunmathur.clock.MAIN_PAGES+import com.vayunmathur.clock.Route+import com.vayunmathur.library.util.BottomNavBar++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun StopwatchPage(backStack: NavBackStack<Route>) {+    Scaffold(topBar = {+        TopAppBar({Text("Stopwatch")})+    }, bottomBar = {+        BottomNavBar(backStack, MAIN_PAGES, Route.Stopwatch)+    }) { paddingValues ->+        Column(Modifier.padding(paddingValues)) {++        }+    }+}\ No newline at end of file
clock/src/main/java/com/vayunmathur/clock/ui/TimerPage.kt
diff --git a/clock/src/main/java/com/vayunmathur/clock/ui/TimerPage.kt b/clock/src/main/java/com/vayunmathur/clock/ui/TimerPage.ktnew file mode 100644index 0000000000..c746c78198--- /dev/null+++ b/clock/src/main/java/com/vayunmathur/clock/ui/TimerPage.kt@@ -0,0 +1,28 @@+package com.vayunmathur.clock.ui++import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.padding+import androidx.compose.material3.ExperimentalMaterial3Api+import androidx.compose.material3.Scaffold+import androidx.compose.material3.Text+import androidx.compose.material3.TopAppBar+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.navigation3.runtime.NavBackStack+import com.vayunmathur.clock.MAIN_PAGES+import com.vayunmathur.clock.Route+import com.vayunmathur.library.util.BottomNavBar++@OptIn(ExperimentalMaterial3Api::class)+@Composable+fun TimerPage(backStack: NavBackStack<Route>) {+    Scaffold(topBar = {+        TopAppBar({Text("Timer")})+    }, bottomBar = {+        BottomNavBar(backStack, MAIN_PAGES, Route.Timer)+    }) { paddingValues ->+        Column(Modifier.padding(paddingValues)) {++        }+    }+}\ No newline at end of file
clock/src/main/res/drawable/baseline_access_alarm_24.xml
diff --git a/clock/src/main/res/drawable/baseline_access_alarm_24.xml b/clock/src/main/res/drawable/baseline_access_alarm_24.xmlnew file mode 100644index 0000000000..21dce83218--- /dev/null+++ b/clock/src/main/res/drawable/baseline_access_alarm_24.xml@@ -0,0 +1,5 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">+      +    <path android:fillColor="@android:color/white" android:pathData="M22,5.72l-4.6,-3.86 -1.29,1.53 4.6,3.86L22,5.72zM7.88,3.39L6.6,1.86 2,5.71l1.29,1.53 4.59,-3.85zM12.5,8L11,8v6l4.75,2.85 0.75,-1.23 -4,-2.37L12.5,8zM12,4c-4.97,0 -9,4.03 -9,9s4.02,9 9,9c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,20c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"/>+    +</vector>
clock/src/main/res/drawable/baseline_access_time_24.xml
diff --git a/clock/src/main/res/drawable/baseline_access_time_24.xml b/clock/src/main/res/drawable/baseline_access_time_24.xmlnew file mode 100644index 0000000000..f3db4e441e--- /dev/null+++ b/clock/src/main/res/drawable/baseline_access_time_24.xml@@ -0,0 +1,7 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">+      +    <path android:fillColor="@android:color/white" android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>+      +    <path android:fillColor="@android:color/white" android:pathData="M12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>+    +</vector>
clock/src/main/res/drawable/baseline_hourglass_bottom_24.xml
diff --git a/clock/src/main/res/drawable/baseline_hourglass_bottom_24.xml b/clock/src/main/res/drawable/baseline_hourglass_bottom_24.xmlnew file mode 100644index 0000000000..281d7cd6dd--- /dev/null+++ b/clock/src/main/res/drawable/baseline_hourglass_bottom_24.xml@@ -0,0 +1,5 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">+      +    <path android:fillColor="@android:color/white" android:pathData="M18,22l-0.01,-6L14,12l3.99,-4.01L18,2H6v6l4,4l-4,3.99V22H18zM8,7.5V4h8v3.5l-4,4L8,7.5z"/>+    +</vector>
clock/src/main/res/drawable/ic_launcher_foreground.xml
diff --git a/clock/src/main/res/drawable/ic_launcher_foreground.xml b/clock/src/main/res/drawable/ic_launcher_foreground.xmlnew file mode 100644index 0000000000..2c3ff45304--- /dev/null+++ b/clock/src/main/res/drawable/ic_launcher_foreground.xml@@ -0,0 +1,15 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android"+    android:width="108dp"+    android:height="108dp"+    android:viewportWidth="24"+    android:viewportHeight="24"+    android:tint="#000000">+  <group android:scaleX="0.522"+      android:scaleY="0.522"+      android:translateX="5.736"+      android:translateY="5.736">+    <path+        android:fillColor="@android:color/white"+        android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM12.5,7L11,7v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>+  </group>+</vector>
clock/src/main/res/drawable/outline_timer_24.xml
diff --git a/clock/src/main/res/drawable/outline_timer_24.xml b/clock/src/main/res/drawable/outline_timer_24.xmlnew file mode 100644index 0000000000..c3fcad4bd4--- /dev/null+++ b/clock/src/main/res/drawable/outline_timer_24.xml@@ -0,0 +1,5 @@+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="960" android:viewportWidth="960" android:width="24dp">+      +    <path android:fillColor="@android:color/white" android:pathData="M360,120L360,40L600,40L600,120L360,120ZM440,560L520,560L520,320L440,320L440,560ZM340.5,851.5Q275,823 226,774Q177,725 148.5,659.5Q120,594 120,520Q120,446 148.5,380.5Q177,315 226,266Q275,217 340.5,188.5Q406,160 480,160Q542,160 599,180Q656,200 706,238L762,182L818,238L762,294Q800,344 820,401Q840,458 840,520Q840,594 811.5,659.5Q783,725 734,774Q685,823 619.5,851.5Q554,880 480,880Q406,880 340.5,851.5ZM678,718Q760,636 760,520Q760,404 678,322Q596,240 480,240Q364,240 282,322Q200,404 200,520Q200,636 282,718Q364,800 480,800Q596,800 678,718ZM480,520Q480,520 480,520Q480,520 480,520Q480,520 480,520Q480,520 480,520Q480,520 480,520Q480,520 480,520Q480,520 480,520Q480,520 480,520Z"/>+    +</vector>
clock/src/main/res/mipmap-anydpi/ic_launcher.xml
diff --git a/clock/src/main/res/mipmap-anydpi/ic_launcher.xml b/clock/src/main/res/mipmap-anydpi/ic_launcher.xmlnew file mode 100644index 0000000000..7353dbd1fd--- /dev/null+++ b/clock/src/main/res/mipmap-anydpi/ic_launcher.xml@@ -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/ic_launcher_background"/>+    <foreground android:drawable="@drawable/ic_launcher_foreground"/>+</adaptive-icon>\ No newline at end of file
clock/src/main/res/values/strings.xml
diff --git a/clock/src/main/res/values/strings.xml b/clock/src/main/res/values/strings.xmlnew file mode 100644index 0000000000..0d2b9cec71--- /dev/null+++ b/clock/src/main/res/values/strings.xml@@ -0,0 +1,3 @@+<resources>+    <string name="app_name">Clock</string>+</resources>\ No newline at end of file
gradle/libs.versions.toml
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex 864b618591..1abe4ff17e 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -44,6 +44,9 @@ cryptographyCore = "0.5.0" sol4k = "0.7.0" libphonenumber = "9.0.24" kotlinCsvJvm = "1.10.0"+junit = "4.13.2"+junitVersion = "1.3.0"+espressoCore = "3.7.0"  [libraries] # AndroidX Core & Lifecycle@@ -120,6 +123,13 @@ cryptography-provider-jdk = { module = "dev.whyoleg.cryptography:cryptography-pr jaudiotagger = { module = "net.jthink:jaudiotagger", version.ref = "jaudiotagger" } sol4k = { group = "org.sol4k", name = "sol4k", version.ref = "sol4k" } libphonenumber = { module = "com.googlecode.libphonenumber:libphonenumber", version.ref = "libphonenumber" }+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-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" }  [plugins] android-application = { id = "com.android.application", version.ref = "agp" }
metadata_data/clock.md
diff --git a/metadata_data/clock.md b/metadata_data/clock.mdnew file mode 100644index 0000000000..0261bc10b2--- /dev/null+++ b/metadata_data/clock.md@@ -0,0 +1 @@+A simple open-source clock app\ No newline at end of file
settings.gradle.kts
diff --git a/settings.gradle.kts b/settings.gradle.ktsindex 2bda00ce16..18947dc0a9 100644--- a/settings.gradle.kts+++ b/settings.gradle.kts@@ -48,3 +48,4 @@ include(":games:chess") include(":games:unblockjam") include(":games:wordmaker") include(":music")+include(":clock")