A prototype

This commit is contained in:
2025-12-25 13:22:26 +01:00
commit 2f4820028f
59 changed files with 2344 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package net.tinsae.clocked
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("net.tinsae.clocked", appContext.packageName)
}
}

View File

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

View File

@@ -0,0 +1,86 @@
package net.tinsae.clocked
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import net.tinsae.clocked.ui.theme.ClockedTheme
@Composable
fun LoginScreen(onLoginSuccess: () -> Unit, modifier: Modifier = Modifier) {
var email by rememberSaveable { mutableStateOf("") }
var password by rememberSaveable { mutableStateOf("") }
Scaffold(modifier = modifier.fillMaxSize()) { innerPadding ->
// 1. Use imePadding() to automatically handle keyboard insets.
// 2. Add verticalScroll to allow scrolling on small screens.
Column(
modifier = Modifier
.padding(innerPadding)
.fillMaxSize()
.imePadding() // Automatically adds padding when the keyboard is open
.verticalScroll(rememberScrollState()) // Allows scrolling if content is too large
.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text(
text = "Welcome to Clocked",
style = MaterialTheme.typography.headlineLarge
)
Spacer(modifier = Modifier.height(32.dp))
OutlinedTextField(
value = email,
onValueChange = { email = it },
label = { Text("Email") },
modifier = Modifier.fillMaxWidth(),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Email),
singleLine = true
)
Spacer(modifier = Modifier.height(16.dp))
OutlinedTextField(
value = password,
onValueChange = { password = it },
label = { Text("Password") },
modifier = Modifier.fillMaxWidth(),
visualTransformation = PasswordVisualTransformation(),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
singleLine = true
)
Spacer(modifier = Modifier.height(32.dp))
Button(
onClick = onLoginSuccess,
modifier = Modifier.fillMaxWidth()
) {
Text("Log In")
}
}
}
}
@Preview(showBackground = true)
@Composable
private fun LoginScreenPreview() {
ClockedTheme {
LoginScreen(onLoginSuccess = {})
}
}

View File

@@ -0,0 +1,170 @@
package net.tinsae.clocked
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawing
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.List
import androidx.compose.material.icons.filled.AccountBox
import androidx.compose.material.icons.filled.Home
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewScreenSizes
import androidx.compose.ui.unit.dp
import net.tinsae.clocked.dashboard.DashboardScreen
import net.tinsae.clocked.history.HistoryScreen
import net.tinsae.clocked.ui.theme.ClockedTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
ClockedTheme {
// The root of the app now decides whether to show Login or Main content
AppEntry()
}
}
}
}
@Composable
fun AppEntry() {
// For now, we'll fake authentication. In a real app, this would come from a ViewModel or repository.
var isAuthenticated by rememberSaveable { mutableStateOf(true) } // Start as not authenticated
if (isAuthenticated) {
// If authenticated, show the main app UI
ClockedApp()
} else {
// If not, show the Login screen
LoginScreen(onLoginSuccess = { })
}
}
@PreviewScreenSizes
@Composable
fun ClockedApp() {
var currentDestination by rememberSaveable { mutableStateOf(AppDestinations.HOME) }
Scaffold(
modifier = Modifier.fillMaxSize(), // Removed background for clarity
topBar = {
Box(
modifier = Modifier
.fillMaxWidth()
// Apply padding ONLY for the top safe area (status bar)
.padding(WindowInsets.safeDrawing.only(WindowInsetsSides.Top).asPaddingValues())
.background(MaterialTheme.colorScheme.surface),
contentAlignment = Alignment.CenterStart
) {
Text(
modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),
text = stringResource(R.string.app_name),
style = MaterialTheme.typography.titleLarge,
fontWeight = FontWeight.Bold
)
}
},
) { innerPadding -> // This padding from the parent Scaffold accounts for the TopBar.
//val layoutDirection = LocalLayoutDirection.current
val contentPadding = PaddingValues(
// Respect the horizontal padding for gestures, etc.
//start = innerPadding.calculateStartPadding(layoutDirection),
//end = innerPadding.calculateEndPadding(layoutDirection),
// Respect the top padding to stay below the top bar.
top = innerPadding.calculateTopPadding(),
// CRITICAL: Ignore the bottom padding from the parent Scaffold.
bottom = 0.dp
)
NavigationSuiteScaffold(
// Apply our custom-calculated padding.
modifier = Modifier.padding(contentPadding),
navigationSuiteItems = {
AppDestinations.entries.forEach {
item(
icon = { Icon(it.icon, contentDescription = it.label) },
label = { Text(it.label) },
selected = it == currentDestination,
onClick = { currentDestination = it }
)
}
}
) {
// The router now shows the correct screen based on the destination.
when (currentDestination) {
AppDestinations.HOME -> DashboardScreen(modifier = Modifier.fillMaxSize())
AppDestinations.HISTORY -> HistoryScreen(modifier = Modifier.fillMaxSize())
AppDestinations.PROFILE -> Greeting(name = "Profile", modifier = Modifier.fillMaxSize())
}
}
}
}
enum class AppDestinations(
val label: String,
val icon: ImageVector,
) {
HOME("Home", Icons.Default.Home),
HISTORY("History", Icons.AutoMirrored.Filled.List),
PROFILE("Profile", Icons.Default.AccountBox),
}
@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Scaffold(modifier = modifier) { innerPadding ->
Text(
text = "Hello $name!",
modifier = Modifier.padding(innerPadding)
)
}
}
/*
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
ClockedTheme {
Greeting("Android")
}
}
*/
// --- PREVIEW THE ACTUAL APP ENTRY POINT ---
@Preview(showBackground = true)
@Composable
fun AppEntryPreview() {
ClockedTheme {
// This preview will correctly show the LoginScreen because isAuthenticated starts as false.
AppEntry()
}
}

View File

@@ -0,0 +1,205 @@
package net.tinsae.clocked.components
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.detectHorizontalDragGestures
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.LocalConfiguration // Use stable LocalConfiguration
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import kotlinx.coroutines.launch
import net.tinsae.clocked.data.Log
import net.tinsae.clocked.service.deleteLog
import net.tinsae.clocked.service.editLog
import net.tinsae.clocked.service.getRecentLogs
import net.tinsae.clocked.ui.theme.cyan
import net.tinsae.clocked.ui.theme.red
import net.tinsae.clocked.util.Util.formatDuration
import net.tinsae.clocked.util.Util.formatTimestampToLocalDateString
import kotlin.math.roundToInt
@Composable
fun ActivityList(
items: List<Log>,
modifier: Modifier = Modifier
) {
var mutableItems by remember { mutableStateOf(items) }
// State to hold the log that should be shown in the dialog. Null means no dialog.
var selectedLogForDialog by remember { mutableStateOf<Log?>(null) }
Column(modifier = modifier.fillMaxWidth()) {
Text(
text = "Recent Activity",
style = MaterialTheme.typography.titleLarge,
modifier = Modifier.padding(horizontal = 16.dp)
)
Spacer(modifier = Modifier.height(8.dp))
LazyColumn {
items(mutableItems, key = { it.id }) { log ->
ActivityItem(
log = log,
onEdit = { editLog(log) },
onDelete = {
if (deleteLog(log)) {
mutableItems = mutableItems.filter { it.id != log.id }
}
},
// When the item is clicked, set it as the selected log for the dialog
onClick = { selectedLogForDialog = log }
)
}
}
}
// When a log is selected, show the dialog.
selectedLogForDialog?.let { log ->
DetailsDialog(
log = log,
onDismiss = { selectedLogForDialog = null }
)
}
}
@Composable
fun ActivityItem(
log: Log,
onDelete: () -> Unit,
onEdit: () -> Unit,
onClick: () -> Unit, // Add onClick callback
modifier: Modifier = Modifier
) {
val coroutineScope = rememberCoroutineScope()
var offsetX by remember { mutableStateOf(0f) }
val animatedOffsetX by animateFloatAsState(targetValue = offsetX, label = "offset")
// Use stable LocalConfiguration
val density = LocalDensity.current
val configuration = LocalConfiguration.current
val screenWidthPx = with(density) { configuration.screenWidthDp.dp.toPx() }
val editThreshold = screenWidthPx * 0.4f
val deleteThreshold = -screenWidthPx * 0.4f
Box(
modifier = modifier
.padding(vertical = 4.dp)
.fillMaxWidth()
) {
// Background content (icons)
Row(
modifier = Modifier
.matchParentSize()
.clip(MaterialTheme.shapes.medium)
.background(if (animatedOffsetX > 0) cyan else red)
.padding(horizontal = 20.dp),
verticalAlignment = Alignment.CenterVertically
) {
if (animatedOffsetX > 0) { // Swiping right
Icon(
imageVector = Icons.Default.Edit,
contentDescription = "Edit",
tint = Color.White
)
}
Spacer(modifier = Modifier.weight(1f))
if (animatedOffsetX < 0) { // Swiping left
Icon(
imageVector = Icons.Default.Delete,
contentDescription = "Delete",
tint = Color.White
)
}
}
// --- Foreground content (the Card) ---
Card(
modifier = Modifier
.offset { IntOffset(animatedOffsetX.roundToInt(), 0) }
.pointerInput(Unit) {
detectHorizontalDragGestures(
onDragEnd = {
coroutineScope.launch {
when {
offsetX > editThreshold -> {
onEdit()
offsetX = 0f
}
offsetX < deleteThreshold -> onDelete()
else -> offsetX = 0f
}
}
}
) { change, dragAmount ->
change.consume()
offsetX += dragAmount
}
}
.fillMaxWidth()
.clip(MaterialTheme.shapes.medium)
// Use the onClick callback here
.clickable { onClick() },
elevation = CardDefaults.cardElevation(defaultElevation = 2.dp)
) {
Column {
Row(
modifier = Modifier.padding(start = 16.dp, top = 12.dp, end = 16.dp),
verticalAlignment = Alignment.CenterVertically
) {
Text(
modifier = Modifier.weight(1f),
text = formatTimestampToLocalDateString(log.timestamp),
style = MaterialTheme.typography.bodyLarge,
fontWeight = FontWeight.SemiBold
)
Text(text = formatDuration(log.duration), style = MaterialTheme.typography.bodyLarge)
}
Text(
text = log.reason ?: "",
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.padding(start = 16.dp, end = 16.dp, bottom = 12.dp, top = 4.dp)
)
}
}
}
}
@Composable
@Preview(showBackground = true)
fun ActivityItemPreview() {
ActivityList(items = getRecentLogs())
}

View File

@@ -0,0 +1,68 @@
package net.tinsae.clocked.components
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import net.tinsae.clocked.data.Log
import net.tinsae.clocked.util.Util.formatDuration
import net.tinsae.clocked.util.Util.formatTimestampToLocalDateString
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DetailsDialog(log: Log, onDismiss: () -> Unit) {
ModalBottomSheet(
onDismissRequest = onDismiss,
) {
Column(
modifier = Modifier
.padding(16.dp)
.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
Text(text = "Log Details", style = MaterialTheme.typography.titleLarge)
Spacer(modifier = Modifier.height(12.dp))
DetailRow("Date:", formatTimestampToLocalDateString(log.timestamp))
DetailRow("Type:", log.type.toString())
DetailRow("Duration:", formatDuration(log.duration))
DetailRow("Reason:", log.reason ?: "No reason provided")
Spacer(modifier = Modifier.height(12.dp))
Button(
onClick = onDismiss,
modifier = Modifier.align(Alignment.End)
) {
Text("Close")
}
}
}
}
@Composable
private fun DetailRow(label: String, value: String) {
// buildAnnotatedString allows mixing different styles in one Text composable.
Text(
buildAnnotatedString {
withStyle(style = SpanStyle(fontWeight = FontWeight.Bold)) {
append(label)
}
append(" ")
append(value)
},
style = MaterialTheme.typography.bodyLarge // Use a slightly larger font style
)
}

View File

@@ -0,0 +1,136 @@
package net.tinsae.clocked.dashboard
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Button
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import net.tinsae.clocked.components.ActivityList
import net.tinsae.clocked.service.deleteLog
import net.tinsae.clocked.service.editLog
import net.tinsae.clocked.service.getRecentLogs
import net.tinsae.clocked.ui.theme.ClockedTheme
import net.tinsae.clocked.ui.theme.cyan
import net.tinsae.clocked.ui.theme.green
import net.tinsae.clocked.ui.theme.red
@Composable
fun DashboardScreen(modifier: Modifier = Modifier) {
Column(
modifier = modifier
.fillMaxSize()
.padding(16.dp,0.dp)
) {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween
) {
SummaryCard(title = "Overtime", value = "+12h 30m", color = green, modifier = Modifier.weight(1f))
Spacer(modifier = Modifier.width(16.dp))
SummaryCard(title = "Time Off", value = "6h 00m", color = red, modifier = Modifier.weight(1f))
}
// ADDED: Manual spacer
Spacer(modifier = Modifier.height(16.dp))
NetBalanceCard(value = "+6h 30m")
// ADDED: Manual spacer
Spacer(modifier = Modifier.height(16.dp))
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceAround
) {
ActionButton(text = "+ Overtime", modifier = Modifier.weight(1f))
Spacer(modifier = Modifier.width(16.dp))
ActionButton(text = " Time Off", modifier = Modifier.weight(1f))
}
// ADDED: Manual spacer
Spacer(modifier = Modifier.height(16.dp))
// This section now works as expected
val recentLogs by remember { mutableStateOf(getRecentLogs()) }
ActivityList(
items = recentLogs,
modifier = Modifier.weight(1f)
)
}
}
@Composable
fun SummaryCard(title: String, value: String, color: Color, modifier: Modifier = Modifier) {
Card(
modifier = modifier,
elevation = CardDefaults.cardElevation(defaultElevation = 4.dp)
) {
Column(
modifier = Modifier.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text(text = title, style = MaterialTheme.typography.titleMedium)
Spacer(modifier = Modifier.height(8.dp))
Text(text = value, style = MaterialTheme.typography.headlineMedium, color = color, fontWeight = FontWeight.Bold)
}
}
}
@Composable
fun NetBalanceCard(value: String, modifier: Modifier = Modifier) {
Card(
modifier = modifier.fillMaxWidth(),
elevation = CardDefaults.cardElevation(defaultElevation = 4.dp)
) {
Column(
modifier = Modifier.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text(text = "Net Balance", style = MaterialTheme. typography.titleLarge)
Spacer(modifier = Modifier.height(8.dp))
Text(text = value, style = MaterialTheme.typography.headlineLarge, color = cyan, fontWeight = FontWeight.Bold)
}
}
}
@Composable
fun ActionButton(text: String, modifier: Modifier = Modifier) {
Button(
onClick = { /*TODO*/ },
modifier = modifier.fillMaxWidth() ) {
Text(text = text, fontSize = 16.sp, modifier = Modifier.padding(6.dp))
}
}
@Preview(showBackground = true)
@Composable
fun DashboardScreenPreview() {
ClockedTheme {
DashboardScreen()
}
}

View File

@@ -0,0 +1,16 @@
package net.tinsae.clocked.data
import java.time.Duration
import java.time.Instant
data class Log(
val id: Int,
val duration: Duration,
val reason: String?,
val type: EntryType,
val timestamp: Instant
)
enum class EntryType {
OVERTIME, TIME_OFF
}

View File

@@ -0,0 +1,159 @@
package net.tinsae.clocked.history
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.PrimaryTabRow
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Tab
import androidx.compose.material3.TabRow
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import net.tinsae.clocked.components.ActivityItem
import net.tinsae.clocked.components.DetailsDialog
import net.tinsae.clocked.data.Log
import net.tinsae.clocked.service.deleteLog
import net.tinsae.clocked.service.editLog
import net.tinsae.clocked.service.getAllLogs
import net.tinsae.clocked.service.getOvertimeLogs
import net.tinsae.clocked.service.getTimeOffLogs
import net.tinsae.clocked.ui.theme.ClockedTheme
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter
// Helper to format the Instant into a readable string like "Tue 18"
fun formatTimestampToDayAndDate(instant: Instant): String {
val formatter = DateTimeFormatter.ofPattern("E d").withZone(ZoneId.systemDefault())
return formatter.format(instant)
}
// Helper to format the Instant into a month and year like "March 2025"
fun formatTimestampToMonthYear(instant: Instant): String {
val formatter = DateTimeFormatter.ofPattern("MMMM yyyy").withZone(ZoneId.systemDefault())
return formatter.format(instant)
}
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun HistoryScreen(modifier: Modifier = Modifier) {
var allEntries by remember { mutableStateOf(getAllLogs()) }
val overTimes by remember { mutableStateOf( getOvertimeLogs())}
val timeOffs by remember { mutableStateOf( getTimeOffLogs())}
var selectedLogForDialog by remember { mutableStateOf<Log?>(null) }
val tabs = listOf("All", "Overtime", "Time Off")
var selectedTabIndex by remember { mutableIntStateOf(0) }
// Filter the list based on the selected tab
// I want this done in service. so I have functions for them
val filteredEntries = remember(selectedTabIndex) {
when (tabs[selectedTabIndex]) {
"Overtime" -> overTimes
"Time Off" -> timeOffs
else -> allEntries
}
}
// Group the filtered entries by month and year
val groupedEntries = remember(filteredEntries) {
// SIMPLIFIED: No need to destructure a Pair
filteredEntries.groupBy { log ->
formatTimestampToMonthYear(log.timestamp)
}
}
Column(
modifier = modifier
.fillMaxSize()
.fillMaxSize()
) {
PrimaryTabRow (selectedTabIndex = selectedTabIndex) {
tabs.forEachIndexed { index, title ->
Tab(
selected = selectedTabIndex == index,
onClick = { selectedTabIndex = index },
text = { Text(title) }
)
}
}
LazyColumn(
modifier = Modifier
.fillMaxWidth()
//.padding(horizontal = 16.dp)
) {
// Iterate through the grouped map
groupedEntries.forEach { (monthYear, entries) ->
// Add a sticky header for the month
stickyHeader {
MonthHeader(text = monthYear)
}
// Add the items for that month
items(entries, key = { it.id }) { entry ->
ActivityItem(log = entry,
modifier = Modifier.padding(horizontal = 16.dp),
onDelete = { deleteLog(entry) },
onEdit = { editLog(entry) },
onClick = { selectedLogForDialog = entry }
)
}
}
}
}
// When a log is selected, show the dialog.
selectedLogForDialog?.let { log ->
DetailsDialog(
log = log,
onDismiss = { selectedLogForDialog = null }
)
}
}
@Composable
fun MonthHeader(text: String, modifier: Modifier = Modifier) {
Surface(
modifier = modifier
.fillMaxWidth()
// Use the theme's background color to overlay content correctly
.background(MaterialTheme.colorScheme.background)
) {
Text(
text = text,
style = MaterialTheme.typography.titleLarge,
fontWeight = FontWeight.Bold,
modifier = Modifier.padding(16.dp)
)
}
}
@Preview(showBackground = true)
@Composable
fun HistoryScreenPreview() {
ClockedTheme {
HistoryScreen()
}
}

View File

@@ -0,0 +1,82 @@
package net.tinsae.clocked.service
import net.tinsae.clocked.data.EntryType
import net.tinsae.clocked.data.Log
import android.util.Log as LOG
import java.time.Duration
import java.time.Instant
import java.time.temporal.ChronoUnit
import kotlin.random.Random
// --- Data for programmatic generation ---
private val overtimeReasons = listOf("Project deadline", "Production hotfix", "Client demo preparation", "Server maintenance", "Completed quarterly reports", "Feature implementation")
private val timeOffReasons = listOf("Left early", "Doctor's appointment", "Personal errand", "Family matter", "Vacation day - Completed quarterly reports")
// UPDATED: Values are now in ISO 8601 format, matching Supabase's INTERVAL output
private val overtimeValues = listOf("PT1H", "PT2H30M", "PT45M", "PT3H15M", "PT1H45M")
private val timeOffValues = listOf("-PT8H", "-PT4H", "-PT1H30M", "-PT2H")
// --- Programmatically generate a list of 30 random logs ---
private fun generateRandomLogs(): List<Log> {
val logs = mutableListOf<Log>()
for (i in 1..30) {
val randomDaysAgo = Random.nextLong(0, 365)
val timestamp = Instant.now().minus(randomDaysAgo, ChronoUnit.DAYS)
val isOvertime = Random.nextBoolean()
val log = if (isOvertime) {
Log(
id = i,
// Use Duration.parse() to convert the string to a Duration object
duration = Duration.parse(overtimeValues.random()),
reason = if (Random.nextBoolean()) overtimeReasons.random() else null,
type = EntryType.OVERTIME,
timestamp = timestamp
)
} else {
Log(
id = i,
// Use Duration.parse() here as well
duration = Duration.parse(timeOffValues.random()),
reason = if (Random.nextBoolean()) timeOffReasons.random() else null,
type = EntryType.TIME_OFF,
timestamp = timestamp
)
}
logs.add(log)
}
return logs
}
val logs: List<Log> = generateRandomLogs().sortedByDescending { it.timestamp }
fun getAllLogs(): List<Log> {
return logs
}
fun getOvertimeLogs(): List<Log> {
return logs.filter { it.type == EntryType.OVERTIME }
}
fun getTimeOffLogs(): List<Log> {
return logs.filter { it.type == EntryType.TIME_OFF }
}
fun getRecentLogs(): List<Log> {
// This function can now be simplified as the main list is already sorted
// We'll just take the most recent 7 items.
return logs.take(7)
}
fun deleteLog(log: Log): Boolean {
logs.filter { it.id != log.id }
LOG.d("TAG","Deleted log with ID: ${log.id}")
return logs.contains(log)
}
fun editLog(log: Log): Boolean{
LOG.d("TAG","Edited log with ID: ${log.id}")
return logs.contains(log)
}

View File

@@ -0,0 +1,11 @@
package net.tinsae.clocked.ui.theme
import androidx.compose.ui.graphics.Color
val red = Color(0xFFFF5722)
val orange = Color(0xFFFF9800)
val cyan = Color(0xFF4597BE)
val green = Color(0xFF4CAF50)
val yellow = Color(0xFFFFC107)
val blue = Color(0xFF3F51B5)

View File

@@ -0,0 +1,57 @@
package net.tinsae.clocked.ui.theme
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 = red,
secondary = orange,
tertiary = cyan
)
private val LightColorScheme = lightColorScheme(
primary = green,
secondary = yellow,
tertiary = blue
/* 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 ClockedTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}
darkTheme -> DarkColorScheme
else -> LightColorScheme
}
MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = content
)
}

View File

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

View File

@@ -0,0 +1,48 @@
package net.tinsae.clocked.util
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle
import java.time.Duration
object Util {
fun formatTimestampToLocalDateString(instant: Instant): String {
val formatter = DateTimeFormatter
.ofLocalizedDate(FormatStyle.MEDIUM) // Creates a locale-aware date format
.withZone(ZoneId.systemDefault()) // Converts the UTC Instant to the user's local time zone
return formatter.format(instant)
}
fun formatDuration(duration: Duration): String {
if (duration.isZero) {
return "0m"
}
val totalMinutes = duration.toMinutes()
val sign = if (totalMinutes < 0) "" else "+"
val absMinutes = kotlin.math.abs(totalMinutes)
val hours = absMinutes / 60
val minutes = absMinutes % 60
return buildString {
append(sign)
if (hours > 0) {
append("${hours}h")
}
if (minutes > 0) {
if (hours > 0) append(" ")
append("${minutes}m")
}
}
}
fun formatTimestampToMonthYear(instant: Instant): String {
val formatter = DateTimeFormatter.ofPattern("MMMM yyyy").withZone(ZoneId.systemDefault())
return formatter.format(instant)
}
}

114
app/src/main/res/README.md Normal file
View File

@@ -0,0 +1,114 @@
# UI frames.
#### Main /Dash board
```
┌──────────────────────────────┐
│ Clocked │
│ │
│ ┌─────────────┐ ┌──────────┐ │
│ │ Overtime │ │ Time Off │ │
│ │ +12h 30m │ │ 6h 00m │ │
│ └─────────────┘ └──────────┘ │
│ │
│ ┌──────────────────────────┐ │
│ │ Net Balance │ │
│ │ +6h 30m │ │
│ └──────────────────────────┘ │
│ │
│ ┌────────────┐ ┌───────────┐ │
│ │ + Overtime │ │ Time │ │
│ │ │ │ Off │ │
│ └────────────┘ └───────────┘ │
│ │
│ Recent Activity │
│ +2h 00m • Tue │
1h 30m • Mon │
│ +45m • Fri │
│ See all → │
└──────────────────────────────┘
```
#### Entry form
```
┌──────────────────────────────┐
│ Add Entry │
│ │
│ Type │
│ [ Overtime | Time Off ] │
│ │
│ Date │
│ [ Tue, Mar 18 ▼ ] │
│ │
│ Duration │
│ [ 02 ] h [ 30 ] m │
│ │
│ Reason (optional) │
│ [ Project deadline ] │
│ │
│ │
│ [Save Entry] │
└──────────────────────────────┘
```
#### History of entries
```
┌──────────────────────────────┐
│ History │
│ [ All | Overtime | Time Off ]│
│ │
│ March 2025 │
│ +2h 00m Tue 18 │
│ Project deadline │
│ │
1h 30m Mon 16 │
│ Left early │
│ │
│ February 2025 │
│ +3h 15m Fri 28 │
│ │
└──────────────────────────────┘
```
#### Entry detail
```
┌──────────────────────────────┐
│ Entry Details │
│ │
│ Type: Overtime │
│ Date: Tue, Mar 18 │
│ Duration: 2h 00m │
│ Reason: Project deadline│
│ │
│ [ Edit ] [ Delete ] │
└──────────────────────────────┘
```
#### Settings
```
┌──────────────────────────────┐
│ Settings │
│ │
│ Data │
│ ────────────────────────── │
│ Export to CSV → │
│ │
│ Preferences │
│ ────────────────────────── │
│ Default duration 8h │
│ Time rounding 15 min │
│ Week starts on Monday │
│ │
│ Appearance │
│ ────────────────────────── │
│ Theme System │
│ │
│ About │
│ ────────────────────────── │
│ App version 1.0.0 │
└──────────────────────────────┘
```

View File

@@ -0,0 +1,170 @@
<?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="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

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

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<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>

View File

@@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

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

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">Clocked</string>
</resources>

View File

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

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older 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>

View File

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

View File

@@ -0,0 +1,17 @@
package net.tinsae.clocked
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)
}
}