Initial commit
@@ -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,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="dev.sweep.assistant.components.SweepConfig">
|
||||||
|
<option name="autoApprovedTools">
|
||||||
|
<set>
|
||||||
|
<option value="list_files" />
|
||||||
|
<option value="read_file" />
|
||||||
|
<option value="search_files" />
|
||||||
|
<option value="find_usages" />
|
||||||
|
<option value="get_errors" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AppInsightsSettings">
|
||||||
|
<option name="tabSettings">
|
||||||
|
<map>
|
||||||
|
<entry key="Android Vitals">
|
||||||
|
<value>
|
||||||
|
<InsightsFilterSettings>
|
||||||
|
<option name="connection">
|
||||||
|
<ConnectionSetting>
|
||||||
|
<option name="appId" value="com.yaros.RadioUrl" />
|
||||||
|
</ConnectionSetting>
|
||||||
|
</option>
|
||||||
|
<option name="signal" value="SIGNAL_UNSPECIFIED" />
|
||||||
|
<option name="timeIntervalDays" value="SEVEN_DAYS" />
|
||||||
|
<option name="visibilityType" value="ALL" />
|
||||||
|
</InsightsFilterSettings>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="Android vitals">
|
||||||
|
<value>
|
||||||
|
<InsightsFilterSettings>
|
||||||
|
<option name="connection">
|
||||||
|
<ConnectionSetting>
|
||||||
|
<option name="appId" value="com.yaros.RadioUrl" />
|
||||||
|
</ConnectionSetting>
|
||||||
|
</option>
|
||||||
|
<option name="signal" value="SIGNAL_UNSPECIFIED" />
|
||||||
|
<option name="timeIntervalDays" value="SEVEN_DAYS" />
|
||||||
|
<option name="visibilityType" value="ALL" />
|
||||||
|
</InsightsFilterSettings>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="Firebase Crashlytics">
|
||||||
|
<value>
|
||||||
|
<InsightsFilterSettings>
|
||||||
|
<option name="connection">
|
||||||
|
<ConnectionSetting>
|
||||||
|
<option name="appId" value="com.yaros.shiftmanager" />
|
||||||
|
<option name="mobileSdkAppId" value="1:221091718064:android:c5ca694f79c4f1d6f02c75" />
|
||||||
|
<option name="projectId" value="shiftmanageryaroshumster" />
|
||||||
|
<option name="projectNumber" value="221091718064" />
|
||||||
|
</ConnectionSetting>
|
||||||
|
</option>
|
||||||
|
<option name="signal" value="SIGNAL_UNSPECIFIED" />
|
||||||
|
<option name="timeIntervalDays" value="THIRTY_DAYS" />
|
||||||
|
<option name="visibilityType" value="ALL" />
|
||||||
|
</InsightsFilterSettings>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<JetCodeStyleSettings>
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</JetCodeStyleSettings>
|
||||||
|
<codeStyleSettings language="XML">
|
||||||
|
<option name="FORCE_REARRANGE_MODE" value="1" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||||
|
</indentOptions>
|
||||||
|
<arrangement>
|
||||||
|
<rules>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:android</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>xmlns:.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:id</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*:name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>name</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>style</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>ANDROID_ATTRIBUTE_ORDER</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<rule>
|
||||||
|
<match>
|
||||||
|
<AND>
|
||||||
|
<NAME>.*</NAME>
|
||||||
|
<XML_ATTRIBUTE />
|
||||||
|
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
||||||
|
</AND>
|
||||||
|
</match>
|
||||||
|
<order>BY_NAME</order>
|
||||||
|
</rule>
|
||||||
|
</section>
|
||||||
|
</rules>
|
||||||
|
</arrangement>
|
||||||
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
@@ -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,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="deploymentTargetSelector">
|
||||||
|
<selectionStates>
|
||||||
|
<SelectionState runConfigName="app">
|
||||||
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
|
<DropdownSelection timestamp="2024-10-25T17:05:46.170528Z">
|
||||||
|
<Target type="DEFAULT_BOOT">
|
||||||
|
<handle>
|
||||||
|
<DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\Yaros\.android\avd\Pixel_7_Pro_API_34.avd" />
|
||||||
|
</handle>
|
||||||
|
</Target>
|
||||||
|
</DropdownSelection>
|
||||||
|
<DialogSelection />
|
||||||
|
</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,62 @@
|
|||||||
|
<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" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="ComposePreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="ComposePreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="ComposePreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" 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" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewApiLevelMustBeValid" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewDeviceShouldUseNewSpec" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewParameterProviderOnFirstParameter" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||||
|
<option name="composableFile" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="KotlinJpsPluginSettings">
|
||||||
|
<option name="version" value="1.9.0" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -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,329 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="direct_access_persist.xml">
|
||||||
|
<option name="deviceSelectionList">
|
||||||
|
<list>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="27" />
|
||||||
|
<option name="brand" value="DOCOMO" />
|
||||||
|
<option name="codename" value="F01L" />
|
||||||
|
<option name="id" value="F01L" />
|
||||||
|
<option name="manufacturer" value="FUJITSU" />
|
||||||
|
<option name="name" value="F-01L" />
|
||||||
|
<option name="screenDensity" value="360" />
|
||||||
|
<option name="screenX" value="720" />
|
||||||
|
<option name="screenY" value="1280" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="28" />
|
||||||
|
<option name="brand" value="DOCOMO" />
|
||||||
|
<option name="codename" value="SH-01L" />
|
||||||
|
<option name="id" value="SH-01L" />
|
||||||
|
<option name="manufacturer" value="SHARP" />
|
||||||
|
<option name="name" value="AQUOS sense2 SH-01L" />
|
||||||
|
<option name="screenDensity" value="480" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2160" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="Lenovo" />
|
||||||
|
<option name="codename" value="TB370FU" />
|
||||||
|
<option name="id" value="TB370FU" />
|
||||||
|
<option name="manufacturer" value="Lenovo" />
|
||||||
|
<option name="name" value="Tab P12" />
|
||||||
|
<option name="screenDensity" value="340" />
|
||||||
|
<option name="screenX" value="1840" />
|
||||||
|
<option name="screenY" value="2944" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="31" />
|
||||||
|
<option name="brand" value="samsung" />
|
||||||
|
<option name="codename" value="a51" />
|
||||||
|
<option name="id" value="a51" />
|
||||||
|
<option name="manufacturer" value="Samsung" />
|
||||||
|
<option name="name" value="Galaxy A51" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2400" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="akita" />
|
||||||
|
<option name="id" value="akita" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 8a" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2400" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="33" />
|
||||||
|
<option name="brand" value="samsung" />
|
||||||
|
<option name="codename" value="b0q" />
|
||||||
|
<option name="id" value="b0q" />
|
||||||
|
<option name="manufacturer" value="Samsung" />
|
||||||
|
<option name="name" value="Galaxy S22 Ultra" />
|
||||||
|
<option name="screenDensity" value="600" />
|
||||||
|
<option name="screenX" value="1440" />
|
||||||
|
<option name="screenY" value="3088" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="32" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="bluejay" />
|
||||||
|
<option name="id" value="bluejay" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 6a" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2400" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="caiman" />
|
||||||
|
<option name="id" value="caiman" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 9 Pro" />
|
||||||
|
<option name="screenDensity" value="360" />
|
||||||
|
<option name="screenX" value="960" />
|
||||||
|
<option name="screenY" value="2142" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="comet" />
|
||||||
|
<option name="id" value="comet" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 9 Pro Fold" />
|
||||||
|
<option name="screenDensity" value="390" />
|
||||||
|
<option name="screenX" value="2076" />
|
||||||
|
<option name="screenY" value="2152" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="29" />
|
||||||
|
<option name="brand" value="samsung" />
|
||||||
|
<option name="codename" value="crownqlteue" />
|
||||||
|
<option name="id" value="crownqlteue" />
|
||||||
|
<option name="manufacturer" value="Samsung" />
|
||||||
|
<option name="name" value="Galaxy Note9" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="2220" />
|
||||||
|
<option name="screenY" value="1080" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="samsung" />
|
||||||
|
<option name="codename" value="dm3q" />
|
||||||
|
<option name="id" value="dm3q" />
|
||||||
|
<option name="manufacturer" value="Samsung" />
|
||||||
|
<option name="name" value="Galaxy S23 Ultra" />
|
||||||
|
<option name="screenDensity" value="600" />
|
||||||
|
<option name="screenX" value="1440" />
|
||||||
|
<option name="screenY" value="3088" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="samsung" />
|
||||||
|
<option name="codename" value="e1q" />
|
||||||
|
<option name="id" value="e1q" />
|
||||||
|
<option name="manufacturer" value="Samsung" />
|
||||||
|
<option name="name" value="Galaxy S24" />
|
||||||
|
<option name="screenDensity" value="480" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2340" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="33" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="felix" />
|
||||||
|
<option name="id" value="felix" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel Fold" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="2208" />
|
||||||
|
<option name="screenY" value="1840" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="felix" />
|
||||||
|
<option name="id" value="felix" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel Fold" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="2208" />
|
||||||
|
<option name="screenY" value="1840" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="33" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="felix_camera" />
|
||||||
|
<option name="id" value="felix_camera" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel Fold (Camera-enabled)" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="2208" />
|
||||||
|
<option name="screenY" value="1840" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="33" />
|
||||||
|
<option name="brand" value="samsung" />
|
||||||
|
<option name="codename" value="gts8uwifi" />
|
||||||
|
<option name="id" value="gts8uwifi" />
|
||||||
|
<option name="manufacturer" value="Samsung" />
|
||||||
|
<option name="name" value="Galaxy Tab S8 Ultra" />
|
||||||
|
<option name="screenDensity" value="320" />
|
||||||
|
<option name="screenX" value="1848" />
|
||||||
|
<option name="screenY" value="2960" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="husky" />
|
||||||
|
<option name="id" value="husky" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 8 Pro" />
|
||||||
|
<option name="screenDensity" value="390" />
|
||||||
|
<option name="screenX" value="1008" />
|
||||||
|
<option name="screenY" value="2244" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="30" />
|
||||||
|
<option name="brand" value="motorola" />
|
||||||
|
<option name="codename" value="java" />
|
||||||
|
<option name="id" value="java" />
|
||||||
|
<option name="manufacturer" value="Motorola" />
|
||||||
|
<option name="name" value="G20" />
|
||||||
|
<option name="screenDensity" value="280" />
|
||||||
|
<option name="screenX" value="720" />
|
||||||
|
<option name="screenY" value="1600" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="komodo" />
|
||||||
|
<option name="id" value="komodo" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 9 Pro XL" />
|
||||||
|
<option name="screenDensity" value="360" />
|
||||||
|
<option name="screenX" value="1008" />
|
||||||
|
<option name="screenY" value="2244" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="33" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="lynx" />
|
||||||
|
<option name="id" value="lynx" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 7a" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2400" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="31" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="oriole" />
|
||||||
|
<option name="id" value="oriole" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 6" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2400" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="33" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="panther" />
|
||||||
|
<option name="id" value="panther" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 7" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2400" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="samsung" />
|
||||||
|
<option name="codename" value="q5q" />
|
||||||
|
<option name="id" value="q5q" />
|
||||||
|
<option name="manufacturer" value="Samsung" />
|
||||||
|
<option name="name" value="Galaxy Z Fold5" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="1812" />
|
||||||
|
<option name="screenY" value="2176" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="samsung" />
|
||||||
|
<option name="codename" value="q6q" />
|
||||||
|
<option name="id" value="q6q" />
|
||||||
|
<option name="manufacturer" value="Samsung" />
|
||||||
|
<option name="name" value="SM-F956B" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="1856" />
|
||||||
|
<option name="screenY" value="2160" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="30" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="r11" />
|
||||||
|
<option name="id" value="r11" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel Watch" />
|
||||||
|
<option name="screenDensity" value="320" />
|
||||||
|
<option name="screenX" value="384" />
|
||||||
|
<option name="screenY" value="384" />
|
||||||
|
<option name="type" value="WEAR_OS" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="30" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="redfin" />
|
||||||
|
<option name="id" value="redfin" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 5" />
|
||||||
|
<option name="screenDensity" value="440" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2340" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="shiba" />
|
||||||
|
<option name="id" value="shiba" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 8" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2400" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="33" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="tangorpro" />
|
||||||
|
<option name="id" value="tangorpro" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel Tablet" />
|
||||||
|
<option name="screenDensity" value="320" />
|
||||||
|
<option name="screenX" value="1600" />
|
||||||
|
<option name="screenY" value="2560" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
<PersistentDeviceSelectionData>
|
||||||
|
<option name="api" value="34" />
|
||||||
|
<option name="brand" value="google" />
|
||||||
|
<option name="codename" value="tokay" />
|
||||||
|
<option name="id" value="tokay" />
|
||||||
|
<option name="manufacturer" value="Google" />
|
||||||
|
<option name="name" value="Pixel 9" />
|
||||||
|
<option name="screenDensity" value="420" />
|
||||||
|
<option name="screenX" value="1080" />
|
||||||
|
<option name="screenY" value="2424" />
|
||||||
|
</PersistentDeviceSelectionData>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</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 @@
|
|||||||
|
/build
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application)
|
||||||
|
alias(libs.plugins.jetbrains.kotlin.android)
|
||||||
|
alias(libs.plugins.google.gms.google.services)
|
||||||
|
id 'kotlin-kapt'
|
||||||
|
id 'dagger.hilt.android.plugin'
|
||||||
|
alias(libs.plugins.kotlin.compose)
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = 'com.yaros.shiftmanager'
|
||||||
|
compileSdk 36
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.yaros.shiftmanager"
|
||||||
|
minSdk 24
|
||||||
|
targetSdk 34
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
vectorDrawables {
|
||||||
|
useSupportLibrary = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
coreLibraryDesugaringEnabled = true
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = '1.8'
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
compose = true
|
||||||
|
}
|
||||||
|
packaging {
|
||||||
|
resources {
|
||||||
|
excludes += '/META-INF/{AL2.0,LGPL2.1}'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation libs.androidx.room.runtime
|
||||||
|
|
||||||
|
// Hilt
|
||||||
|
implementation("com.google.dagger:hilt-android:2.59.2") // ← Update this
|
||||||
|
kapt("com.google.dagger:hilt-compiler:2.59.2") // ← Update this
|
||||||
|
|
||||||
|
// Room (ensure versions are consistent)
|
||||||
|
|
||||||
|
implementation("androidx.room:room-runtime:2.8.4")
|
||||||
|
implementation("androidx.room:room-ktx:2.8.4")
|
||||||
|
kapt("androidx.room:room-compiler:2.8.4")
|
||||||
|
implementation 'com.google.code.gson:gson:2.14.0'
|
||||||
|
|
||||||
|
// If using Hilt with Room, also add:
|
||||||
|
implementation("androidx.hilt:hilt-common:1.3.0")
|
||||||
|
kapt("androidx.hilt:hilt-compiler:1.3.0")
|
||||||
|
implementation libs.androidx.room.ktx
|
||||||
|
implementation libs.androidx.datastore.preferences
|
||||||
|
implementation(libs.vico.compose)
|
||||||
|
coreLibraryDesugaring libs.desugar.jdk.libs
|
||||||
|
implementation("com.kizitonwose.calendar:view:2.10.1")
|
||||||
|
implementation("com.kizitonwose.calendar:compose:2.10.1")
|
||||||
|
implementation(libs.vico.compose.m2)
|
||||||
|
implementation(libs.vico.compose.m3)
|
||||||
|
implementation(libs.vico.core)
|
||||||
|
implementation(libs.vico.views)
|
||||||
|
implementation libs.hilt.android
|
||||||
|
kapt libs.dagger.hilt.compiler
|
||||||
|
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.navigation.compose)
|
||||||
|
implementation libs.androidx.ui
|
||||||
|
implementation libs.androidx.ui.graphics
|
||||||
|
implementation libs.androidx.ui.tooling.preview
|
||||||
|
implementation libs.androidx.material3
|
||||||
|
implementation libs.firebase.auth
|
||||||
|
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
|
||||||
|
testImplementation libs.junit
|
||||||
|
androidTestImplementation libs.androidx.junit
|
||||||
|
androidTestImplementation libs.androidx.espresso.core
|
||||||
|
androidTestImplementation platform(libs.androidx.compose.bom)
|
||||||
|
androidTestImplementation libs.androidx.ui.test.junit4
|
||||||
|
debugImplementation libs.androidx.ui.tooling
|
||||||
|
debugImplementation libs.androidx.ui.test.manifest
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "221091718064",
|
||||||
|
"project_id": "shiftmanageryaroshumster",
|
||||||
|
"storage_bucket": "shiftmanageryaroshumster.appspot.com"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:221091718064:android:c5ca694f79c4f1d6f02c75",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.yaros.shiftmanager"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDMJMZrKLkVNujMh71dqh0J3_z3qtpQkBY"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
@@ -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 com.yaros.shiftmanager
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
fun useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
assertEquals("com.yaros.shiftmanager", appContext.packageName)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?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:name=".ShiftManagerApplication"
|
||||||
|
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.ShiftManager"
|
||||||
|
tools:targetApi="31">
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@style/Theme.ShiftManager">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.room.Database
|
||||||
|
import androidx.room.Room
|
||||||
|
import androidx.room.RoomDatabase
|
||||||
|
import androidx.room.TypeConverter
|
||||||
|
import androidx.room.TypeConverters
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.reflect.TypeToken
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
@Database(
|
||||||
|
entities = [Income::class, Shift::class, TaxReminder::class, ShiftTemplate::class],
|
||||||
|
version = 2,
|
||||||
|
exportSchema = false
|
||||||
|
)
|
||||||
|
@TypeConverters(Converters::class)
|
||||||
|
abstract class AppDatabase : RoomDatabase() {
|
||||||
|
abstract fun incomeDao(): IncomeDao
|
||||||
|
abstract fun shiftDao(): ShiftDao
|
||||||
|
abstract fun taxReminderDao(): TaxReminderDao
|
||||||
|
abstract fun shiftTemplateDao(): ShiftTemplateDao
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@Volatile
|
||||||
|
private var INSTANCE: AppDatabase? = null
|
||||||
|
|
||||||
|
val MIGRATION_1_2 = object : Migration(1, 2) {
|
||||||
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
|
db.execSQL("ALTER TABLE shifts ADD COLUMN hoursWorked REAL NOT NULL DEFAULT 0.0")
|
||||||
|
db.execSQL("ALTER TABLE shifts ADD COLUMN hourlyRate REAL NOT NULL DEFAULT 0.0")
|
||||||
|
db.execSQL("ALTER TABLE shifts ADD COLUMN isCompleted INTEGER NOT NULL DEFAULT 0")
|
||||||
|
db.execSQL("ALTER TABLE shifts ADD COLUMN templateId TEXT DEFAULT NULL")
|
||||||
|
db.execSQL("""CREATE TABLE IF NOT EXISTS shift_templates (
|
||||||
|
id TEXT NOT NULL PRIMARY KEY,
|
||||||
|
name TEXT NOT NULL,
|
||||||
|
hourlyRate REAL NOT NULL,
|
||||||
|
coefficientRules TEXT NOT NULL DEFAULT '[]'
|
||||||
|
)""")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getInstance(context: Context): AppDatabase {
|
||||||
|
return INSTANCE ?: synchronized(this) {
|
||||||
|
val instance = Room.databaseBuilder(
|
||||||
|
context.applicationContext,
|
||||||
|
AppDatabase::class.java,
|
||||||
|
"shift_manager_database"
|
||||||
|
)
|
||||||
|
.addMigrations(MIGRATION_1_2)
|
||||||
|
.build()
|
||||||
|
INSTANCE = instance
|
||||||
|
instance
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add this class to handle Date conversions for Room
|
||||||
|
class Converters {
|
||||||
|
private val gson = Gson()
|
||||||
|
|
||||||
|
// --- 1. Ваши старые конвертеры для Date ---
|
||||||
|
@TypeConverter
|
||||||
|
fun fromTimestamp(value: Long?): Date? {
|
||||||
|
return value?.let { Date(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeConverter
|
||||||
|
fun dateToTimestamp(date: Date?): Long? {
|
||||||
|
return date?.time
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- 2. Конвертеры для Enum ShiftType ---
|
||||||
|
// Room не умеет сохранять enum напрямую, поэтому сохраняем его имя (String)
|
||||||
|
@TypeConverter
|
||||||
|
fun fromShiftType(value: ShiftType?): String? {
|
||||||
|
return value?.name
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeConverter
|
||||||
|
fun toShiftType(value: String?): ShiftType? {
|
||||||
|
return value?.let { ShiftType.valueOf(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- 3. Новые конвертеры для сложного объекта RecurringPattern ---
|
||||||
|
// Преобразуем объект в JSON-строку для сохранения в БД
|
||||||
|
@TypeConverter
|
||||||
|
fun fromRecurringPattern(pattern: RecurringPattern?): String? {
|
||||||
|
return gson.toJson(pattern)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Преобразуем JSON-строку из БД обратно в объект
|
||||||
|
@TypeConverter
|
||||||
|
fun toRecurringPattern(patternString: String?): RecurringPattern? {
|
||||||
|
if (patternString == null) return null
|
||||||
|
val type = object : TypeToken<RecurringPattern>() {}.type
|
||||||
|
return gson.fromJson(patternString, type)
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- 4. Конвертеры для List<CoefficientRule> ---
|
||||||
|
@TypeConverter
|
||||||
|
fun fromCoefficientRules(rules: List<CoefficientRule>?): String? {
|
||||||
|
return gson.toJson(rules ?: emptyList<CoefficientRule>())
|
||||||
|
}
|
||||||
|
|
||||||
|
@TypeConverter
|
||||||
|
fun toCoefficientRules(json: String?): List<CoefficientRule> {
|
||||||
|
if (json == null) return emptyList()
|
||||||
|
val type = object : TypeToken<List<CoefficientRule>>() {}.type
|
||||||
|
return gson.fromJson(json, type) ?: emptyList()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import com.google.firebase.auth.FirebaseAuth
|
||||||
|
import com.google.firebase.auth.FirebaseUser
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.tasks.await
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class AuthRepository @Inject constructor() {
|
||||||
|
private val auth: FirebaseAuth = FirebaseAuth.getInstance()
|
||||||
|
|
||||||
|
suspend fun signUp(email: String, password: String): Result<FirebaseUser> {
|
||||||
|
return try {
|
||||||
|
val result = auth.createUserWithEmailAndPassword(email, password).await()
|
||||||
|
Result.success(result.user!!)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Result.failure(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun signIn(email: String, password: String): Result<FirebaseUser> {
|
||||||
|
return try {
|
||||||
|
val result = auth.signInWithEmailAndPassword(email, password).await()
|
||||||
|
Result.success(result.user!!)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Result.failure(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun signOut() {
|
||||||
|
auth.signOut()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getCurrentUser(): FirebaseUser? {
|
||||||
|
return auth.currentUser
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
|
class AuthViewModel @Inject constructor(private val repository: AuthRepository) : ViewModel() {
|
||||||
|
private val _user = MutableStateFlow<FirebaseUser?>(repository.getCurrentUser())
|
||||||
|
val user: StateFlow<FirebaseUser?> = _user.asStateFlow()
|
||||||
|
|
||||||
|
fun signUp(email: String, password: String) = viewModelScope.launch {
|
||||||
|
repository.signUp(email, password).onSuccess { _user.value = it }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun signIn(email: String, password: String) = viewModelScope.launch {
|
||||||
|
repository.signIn(email, password).onSuccess { _user.value = it }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun signOut() {
|
||||||
|
repository.signOut()
|
||||||
|
_user.value = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun AuthScreen(viewModel: AuthViewModel, onAuthSuccess: () -> Unit) {
|
||||||
|
var email by remember { mutableStateOf("") }
|
||||||
|
var password by remember { mutableStateOf("") }
|
||||||
|
var isSignUp by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
val user by viewModel.user.collectAsState()
|
||||||
|
|
||||||
|
LaunchedEffect(user) {
|
||||||
|
if (user != null) {
|
||||||
|
onAuthSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(16.dp),
|
||||||
|
verticalArrangement = Arrangement.Center
|
||||||
|
) {
|
||||||
|
TextField(
|
||||||
|
value = email,
|
||||||
|
onValueChange = { email = it },
|
||||||
|
label = { Text("Email") },
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
TextField(
|
||||||
|
value = password,
|
||||||
|
onValueChange = { password = it },
|
||||||
|
label = { Text("Password") },
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
if (isSignUp) {
|
||||||
|
viewModel.signUp(email, password)
|
||||||
|
} else {
|
||||||
|
viewModel.signIn(email, password)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Text(if (isSignUp) "Sign Up" else "Sign In")
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
TextButton(
|
||||||
|
onClick = { isSignUp = !isSignUp },
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
Text(if (isSignUp) "Already have an account? Sign In" else "Don't have an account? Sign Up")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,551 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
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.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Add
|
||||||
|
import androidx.compose.material.icons.filled.ArrowBack
|
||||||
|
import androidx.compose.material.icons.filled.ArrowForward
|
||||||
|
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.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
|
import java.time.DayOfWeek
|
||||||
|
import java.time.LocalDate
|
||||||
|
import java.time.YearMonth
|
||||||
|
import java.time.ZoneId
|
||||||
|
import java.time.format.TextStyle
|
||||||
|
import java.time.temporal.TemporalAdjusters
|
||||||
|
import java.time.temporal.WeekFields
|
||||||
|
import java.util.*
|
||||||
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
|
// ─────────────────── Calendar Screen ───────────────────
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun CalendarScreen(viewModel: ShiftViewModel = hiltViewModel()) {
|
||||||
|
val currentMonth by viewModel.currentMonth.collectAsState()
|
||||||
|
val monthShifts by viewModel.monthShifts.collectAsState()
|
||||||
|
val templates by viewModel.allTemplates.collectAsState()
|
||||||
|
|
||||||
|
var selectedDate by remember { mutableStateOf(LocalDate.now()) }
|
||||||
|
var showAddDialog by remember { mutableStateOf(false) }
|
||||||
|
var editingShift by remember { mutableStateOf<Shift?>(null) }
|
||||||
|
|
||||||
|
Scaffold(
|
||||||
|
floatingActionButton = {
|
||||||
|
FloatingActionButton(onClick = {
|
||||||
|
editingShift = null
|
||||||
|
showAddDialog = true
|
||||||
|
}) {
|
||||||
|
Icon(Icons.Default.Add, contentDescription = "Add Shift")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) { paddingValues ->
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(paddingValues)
|
||||||
|
.fillMaxSize()
|
||||||
|
.verticalScroll(rememberScrollState())
|
||||||
|
) {
|
||||||
|
// ── Month navigation header ──
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp, vertical = 8.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
IconButton(onClick = { viewModel.previousMonth() }) {
|
||||||
|
Icon(Icons.Default.ArrowBack, contentDescription = "Previous month")
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
text = currentMonth.month.getDisplayName(TextStyle.FULL, Locale.getDefault()) +
|
||||||
|
" ${currentMonth.year}",
|
||||||
|
style = MaterialTheme.typography.titleLarge,
|
||||||
|
fontWeight = FontWeight.Bold
|
||||||
|
)
|
||||||
|
IconButton(onClick = { viewModel.nextMonth() }) {
|
||||||
|
Icon(Icons.Default.ArrowForward, contentDescription = "Next month")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Day-of-week headers ──
|
||||||
|
val firstDayOfWeek = WeekFields.of(Locale.getDefault()).firstDayOfWeek
|
||||||
|
val orderedDays = DayOfWeek.entries.let { all ->
|
||||||
|
val idx = all.indexOf(firstDayOfWeek)
|
||||||
|
all.drop(idx) + all.take(idx)
|
||||||
|
}
|
||||||
|
Row(modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp)) {
|
||||||
|
orderedDays.forEach { dow ->
|
||||||
|
Text(
|
||||||
|
text = dow.getDisplayName(TextStyle.SHORT, Locale.getDefault()),
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Calendar grid ──
|
||||||
|
CalendarGrid(
|
||||||
|
yearMonth = currentMonth,
|
||||||
|
shifts = monthShifts,
|
||||||
|
selectedDate = selectedDate,
|
||||||
|
onDateSelected = { selectedDate = it }
|
||||||
|
)
|
||||||
|
|
||||||
|
// ── Shifts for selected date ──
|
||||||
|
val shiftsForSelected = monthShifts.filter { shift ->
|
||||||
|
shift.startTime.toInstant()
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toLocalDate() == selectedDate
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalDivider(modifier = Modifier.padding(vertical = 4.dp))
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = "Shifts on ${selectedDate.dayOfMonth} ${selectedDate.month.getDisplayName(TextStyle.SHORT, Locale.getDefault())}",
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
if (shiftsForSelected.isEmpty()) {
|
||||||
|
Text(
|
||||||
|
text = "No shifts — tap + to add one",
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
modifier = Modifier.padding(16.dp)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
shiftsForSelected.forEach { shift ->
|
||||||
|
ShiftCard(
|
||||||
|
shift = shift,
|
||||||
|
templates = templates,
|
||||||
|
onClick = {
|
||||||
|
editingShift = shift
|
||||||
|
showAddDialog = true
|
||||||
|
},
|
||||||
|
onDelete = { viewModel.deleteShift(shift) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showAddDialog) {
|
||||||
|
AddShiftDialog(
|
||||||
|
selectedDate = selectedDate,
|
||||||
|
templates = templates,
|
||||||
|
existingShift = editingShift,
|
||||||
|
onDismiss = { showAddDialog = false },
|
||||||
|
onSave = { shift ->
|
||||||
|
if (editingShift != null) viewModel.updateShift(shift)
|
||||||
|
else viewModel.insertShift(shift)
|
||||||
|
showAddDialog = false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─────────────────── Calendar Grid ───────────────────
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun CalendarGrid(
|
||||||
|
yearMonth: YearMonth,
|
||||||
|
shifts: List<Shift>,
|
||||||
|
selectedDate: LocalDate,
|
||||||
|
onDateSelected: (LocalDate) -> Unit
|
||||||
|
) {
|
||||||
|
val firstDayOfMonth = yearMonth.atDay(1)
|
||||||
|
val firstDayOfWeek = WeekFields.of(Locale.getDefault()).firstDayOfWeek
|
||||||
|
val gridStart = firstDayOfMonth.with(TemporalAdjusters.previousOrSame(firstDayOfWeek))
|
||||||
|
|
||||||
|
// 6 weeks × 7 days covers any month
|
||||||
|
val gridDays = (0 until 42).map { gridStart.plusDays(it.toLong()) }
|
||||||
|
|
||||||
|
Column(modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp)) {
|
||||||
|
gridDays.chunked(7).forEach { week ->
|
||||||
|
Row(modifier = Modifier.fillMaxWidth()) {
|
||||||
|
week.forEach { date ->
|
||||||
|
val isCurrentMonth = date.monthValue == yearMonth.monthValue &&
|
||||||
|
date.year == yearMonth.year
|
||||||
|
val dayShifts = shifts.filter { shift ->
|
||||||
|
shift.startTime.toInstant()
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toLocalDate() == date
|
||||||
|
}
|
||||||
|
DayCell(
|
||||||
|
date = date,
|
||||||
|
shifts = dayShifts,
|
||||||
|
isSelected = date == selectedDate,
|
||||||
|
isInMonth = isCurrentMonth,
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
onClick = { if (isCurrentMonth) onDateSelected(date) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─────────────────── Day Cell ───────────────────
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun DayCell(
|
||||||
|
date: LocalDate,
|
||||||
|
shifts: List<Shift>,
|
||||||
|
isSelected: Boolean,
|
||||||
|
isInMonth: Boolean,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
onClick: () -> Unit
|
||||||
|
) {
|
||||||
|
val hasDayShift = shifts.any { it.type == ShiftType.DAY }
|
||||||
|
val hasNightShift = shifts.any { it.type == ShiftType.NIGHT }
|
||||||
|
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
modifier = modifier
|
||||||
|
.aspectRatio(1f)
|
||||||
|
.padding(2.dp)
|
||||||
|
.clickable(enabled = isInMonth) { onClick() }
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.fillMaxWidth()
|
||||||
|
.background(
|
||||||
|
if (isSelected) MaterialTheme.colorScheme.primaryContainer
|
||||||
|
else Color.Transparent,
|
||||||
|
CircleShape
|
||||||
|
),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = date.dayOfMonth.toString(),
|
||||||
|
color = when {
|
||||||
|
!isInMonth -> MaterialTheme.colorScheme.onSurface.copy(alpha = 0.2f)
|
||||||
|
isSelected -> MaterialTheme.colorScheme.onPrimaryContainer
|
||||||
|
else -> MaterialTheme.colorScheme.onSurface
|
||||||
|
},
|
||||||
|
style = MaterialTheme.typography.bodySmall
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shift type indicators
|
||||||
|
if (isInMonth && shifts.isNotEmpty()) {
|
||||||
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.Center,
|
||||||
|
modifier = Modifier.height(8.dp)
|
||||||
|
) {
|
||||||
|
if (hasDayShift) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(5.dp)
|
||||||
|
.background(Color(0xFFFFC107), CircleShape)
|
||||||
|
)
|
||||||
|
Spacer(Modifier.width(2.dp))
|
||||||
|
}
|
||||||
|
if (hasNightShift) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(5.dp)
|
||||||
|
.background(Color(0xFF2196F3), CircleShape)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Spacer(Modifier.height(8.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─────────────────── Shift Card ───────────────────
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun ShiftCard(
|
||||||
|
shift: Shift,
|
||||||
|
templates: List<ShiftTemplate>,
|
||||||
|
onClick: () -> Unit,
|
||||||
|
onDelete: () -> Unit
|
||||||
|
) {
|
||||||
|
val template = templates.find { it.id == shift.templateId }
|
||||||
|
val typeLabel = when (shift.type) {
|
||||||
|
ShiftType.DAY -> "Day"
|
||||||
|
ShiftType.NIGHT -> "Night"
|
||||||
|
ShiftType.WEEKEND -> "Weekend"
|
||||||
|
}
|
||||||
|
val typeColor = when (shift.type) {
|
||||||
|
ShiftType.DAY -> Color(0xFFFFC107)
|
||||||
|
ShiftType.NIGHT -> Color(0xFF2196F3)
|
||||||
|
ShiftType.WEEKEND -> Color(0xFF9C27B0)
|
||||||
|
}
|
||||||
|
|
||||||
|
Card(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 12.dp, vertical = 4.dp)
|
||||||
|
.clickable { onClick() },
|
||||||
|
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant)
|
||||||
|
) {
|
||||||
|
Row(modifier = Modifier.padding(12.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||||
|
// Color strip
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.width(4.dp)
|
||||||
|
.height(48.dp)
|
||||||
|
.background(typeColor, MaterialTheme.shapes.small)
|
||||||
|
)
|
||||||
|
Spacer(Modifier.width(12.dp))
|
||||||
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
|
Text(
|
||||||
|
text = template?.name ?: shift.title.ifBlank { typeLabel },
|
||||||
|
style = MaterialTheme.typography.titleSmall
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = "${String.format(Locale.getDefault(), "%.1f", shift.hoursWorked)} h · $typeLabel",
|
||||||
|
style = MaterialTheme.typography.bodySmall,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Column(horizontalAlignment = Alignment.End) {
|
||||||
|
val earnings = if (template != null) {
|
||||||
|
ShiftViewModel.calculateEarnings(
|
||||||
|
shift.hourlyRate, shift.hoursWorked, template.coefficientRules
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
shift.hourlyRate * shift.hoursWorked
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
text = "$${String.format(Locale.getDefault(), "%.2f", earnings)}",
|
||||||
|
style = MaterialTheme.typography.titleSmall,
|
||||||
|
color = MaterialTheme.colorScheme.primary
|
||||||
|
)
|
||||||
|
if (shift.isCompleted) {
|
||||||
|
Text(
|
||||||
|
text = "Completed",
|
||||||
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
color = Color(0xFF4CAF50)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IconButton(onClick = onDelete) {
|
||||||
|
Text("✕", color = MaterialTheme.colorScheme.error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─────────────────── Add / Edit Shift Dialog ───────────────────
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
private fun AddShiftDialog(
|
||||||
|
selectedDate: LocalDate,
|
||||||
|
templates: List<ShiftTemplate>,
|
||||||
|
existingShift: Shift?,
|
||||||
|
onDismiss: () -> Unit,
|
||||||
|
onSave: (Shift) -> Unit
|
||||||
|
) {
|
||||||
|
var title by remember { mutableStateOf(existingShift?.title ?: "") }
|
||||||
|
var selectedTemplateId by remember { mutableStateOf(existingShift?.templateId) }
|
||||||
|
var hoursText by remember {
|
||||||
|
mutableStateOf(
|
||||||
|
if (existingShift != null && existingShift.hoursWorked > 0)
|
||||||
|
existingShift.hoursWorked.toString() else ""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
var rateText by remember {
|
||||||
|
mutableStateOf(
|
||||||
|
if (existingShift != null && existingShift.hourlyRate > 0)
|
||||||
|
existingShift.hourlyRate.toString() else ""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
var shiftType by remember { mutableStateOf(existingShift?.type ?: ShiftType.DAY) }
|
||||||
|
var isCompleted by remember { mutableStateOf(existingShift?.isCompleted ?: true) }
|
||||||
|
var startTime by remember {
|
||||||
|
mutableStateOf(
|
||||||
|
existingShift?.startTime?.toInstant()?.atZone(ZoneId.systemDefault())?.toLocalTime()
|
||||||
|
?: java.time.LocalTime.of(9, 0)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
var showTimePicker by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
val selectedTemplate = templates.find { it.id == selectedTemplateId }
|
||||||
|
|
||||||
|
// Auto-fill rate from template
|
||||||
|
LaunchedEffect(selectedTemplate) {
|
||||||
|
selectedTemplate?.let { rateText = it.hourlyRate.toString() }
|
||||||
|
}
|
||||||
|
|
||||||
|
AlertDialog(
|
||||||
|
onDismissRequest = onDismiss,
|
||||||
|
title = { Text(if (existingShift != null) "Edit Shift" else "Add Shift") },
|
||||||
|
text = {
|
||||||
|
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
|
|
||||||
|
// Template picker
|
||||||
|
if (templates.isNotEmpty()) {
|
||||||
|
Text("Template", style = MaterialTheme.typography.labelMedium)
|
||||||
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
templates.forEach { tmpl ->
|
||||||
|
FilterChip(
|
||||||
|
selected = selectedTemplateId == tmpl.id,
|
||||||
|
onClick = {
|
||||||
|
selectedTemplateId =
|
||||||
|
if (selectedTemplateId == tmpl.id) null else tmpl.id
|
||||||
|
},
|
||||||
|
label = { Text(tmpl.name, style = MaterialTheme.typography.labelSmall) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OutlinedTextField(
|
||||||
|
value = title,
|
||||||
|
onValueChange = { title = it },
|
||||||
|
label = { Text("Title (optional)") },
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
singleLine = true
|
||||||
|
)
|
||||||
|
|
||||||
|
// Shift type
|
||||||
|
Text("Type", style = MaterialTheme.typography.labelMedium)
|
||||||
|
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||||
|
ShiftType.entries.forEach { type ->
|
||||||
|
FilterChip(
|
||||||
|
selected = shiftType == type,
|
||||||
|
onClick = { shiftType = type },
|
||||||
|
label = {
|
||||||
|
Text(
|
||||||
|
when (type) {
|
||||||
|
ShiftType.DAY -> "Day"
|
||||||
|
ShiftType.NIGHT -> "Night"
|
||||||
|
ShiftType.WEEKEND -> "Weekend"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
|
OutlinedTextField(
|
||||||
|
value = hoursText,
|
||||||
|
onValueChange = { hoursText = it },
|
||||||
|
label = { Text("Hours") },
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
singleLine = true
|
||||||
|
)
|
||||||
|
OutlinedTextField(
|
||||||
|
value = rateText,
|
||||||
|
onValueChange = { rateText = it },
|
||||||
|
label = { Text("$/hour") },
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
singleLine = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start time button
|
||||||
|
OutlinedButton(onClick = { showTimePicker = true }) {
|
||||||
|
Text(
|
||||||
|
"Start: ${
|
||||||
|
String.format(
|
||||||
|
Locale.getDefault(),
|
||||||
|
"%02d:%02d",
|
||||||
|
startTime.hour,
|
||||||
|
startTime.minute
|
||||||
|
)
|
||||||
|
}"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
|
Checkbox(checked = isCompleted, onCheckedChange = { isCompleted = it })
|
||||||
|
Text("Completed")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Earnings preview
|
||||||
|
val hours = hoursText.toDoubleOrNull() ?: 0.0
|
||||||
|
val rate = rateText.toDoubleOrNull() ?: 0.0
|
||||||
|
val earnings = if (selectedTemplate != null) {
|
||||||
|
ShiftViewModel.calculateEarnings(rate, hours, selectedTemplate.coefficientRules)
|
||||||
|
} else {
|
||||||
|
rate * hours
|
||||||
|
}
|
||||||
|
if (hours > 0 && rate > 0) {
|
||||||
|
Text(
|
||||||
|
text = "Earnings: $${String.format(Locale.getDefault(), "%.2f", earnings)}",
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
color = MaterialTheme.colorScheme.primary
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
confirmButton = {
|
||||||
|
Button(onClick = {
|
||||||
|
val hours = hoursText.toDoubleOrNull() ?: 0.0
|
||||||
|
val rate = rateText.toDoubleOrNull() ?: 0.0
|
||||||
|
val startDateTime = selectedDate.atTime(startTime)
|
||||||
|
val endDateTime = startDateTime.plusHours(hours.toLong())
|
||||||
|
.plusMinutes(((hours % 1) * 60).roundToInt().toLong())
|
||||||
|
val zone = ZoneId.systemDefault()
|
||||||
|
val shift = Shift(
|
||||||
|
id = existingShift?.id ?: UUID.randomUUID().toString(),
|
||||||
|
title = title.ifBlank {
|
||||||
|
when (shiftType) {
|
||||||
|
ShiftType.DAY -> "Day Shift"
|
||||||
|
ShiftType.NIGHT -> "Night Shift"
|
||||||
|
ShiftType.WEEKEND -> "Weekend Shift"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
startTime = Date.from(startDateTime.atZone(zone).toInstant()),
|
||||||
|
endTime = Date.from(endDateTime.atZone(zone).toInstant()),
|
||||||
|
type = shiftType,
|
||||||
|
hoursWorked = hours,
|
||||||
|
hourlyRate = rate,
|
||||||
|
isCompleted = isCompleted,
|
||||||
|
templateId = selectedTemplateId
|
||||||
|
)
|
||||||
|
onSave(shift)
|
||||||
|
}) { Text("Save") }
|
||||||
|
},
|
||||||
|
dismissButton = { TextButton(onClick = onDismiss) { Text("Cancel") } }
|
||||||
|
)
|
||||||
|
|
||||||
|
if (showTimePicker) {
|
||||||
|
val pickerState = rememberTimePickerState(
|
||||||
|
initialHour = startTime.hour,
|
||||||
|
initialMinute = startTime.minute,
|
||||||
|
is24Hour = true
|
||||||
|
)
|
||||||
|
AlertDialog(
|
||||||
|
onDismissRequest = { showTimePicker = false },
|
||||||
|
title = { Text("Shift start time") },
|
||||||
|
text = { TimePicker(state = pickerState) },
|
||||||
|
confirmButton = {
|
||||||
|
Button(onClick = {
|
||||||
|
startTime = java.time.LocalTime.of(pickerState.hour, pickerState.minute)
|
||||||
|
showTimePicker = false
|
||||||
|
}) { Text("OK") }
|
||||||
|
},
|
||||||
|
dismissButton = {
|
||||||
|
TextButton(onClick = { showTimePicker = false }) { Text("Cancel") }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.room.Room
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.Provides
|
||||||
|
import dagger.hilt.InstallIn
|
||||||
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
|
import dagger.hilt.components.SingletonComponent
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Module
|
||||||
|
@InstallIn(SingletonComponent::class)
|
||||||
|
object DatabaseModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideDatabase(@ApplicationContext context: Context): AppDatabase {
|
||||||
|
return Room.databaseBuilder(
|
||||||
|
context,
|
||||||
|
AppDatabase::class.java,
|
||||||
|
"shift_manager_database"
|
||||||
|
)
|
||||||
|
.addMigrations(AppDatabase.MIGRATION_1_2)
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
fun provideIncomeDao(database: AppDatabase): IncomeDao = database.incomeDao()
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
fun provideShiftDao(database: AppDatabase): ShiftDao = database.shiftDao()
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
fun provideTaxReminderDao(database: AppDatabase): TaxReminderDao = database.taxReminderDao()
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
fun provideShiftTemplateDao(database: AppDatabase): ShiftTemplateDao = database.shiftTemplateDao()
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.asLiveData
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import androidx.room.*
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
|
import android.content.Context
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import java.util.*
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@Entity(tableName = "incomes")
|
||||||
|
data class Income(
|
||||||
|
@PrimaryKey val id: String = UUID.randomUUID().toString(),
|
||||||
|
val shiftId: String,
|
||||||
|
val amount: Double,
|
||||||
|
val type: IncomeType,
|
||||||
|
val date: Date
|
||||||
|
)
|
||||||
|
|
||||||
|
enum class IncomeType {
|
||||||
|
REGULAR, TIPS, BONUS
|
||||||
|
}
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface IncomeDao {
|
||||||
|
@Query("SELECT * FROM incomes")
|
||||||
|
fun getAllIncomes(): Flow<List<Income>>
|
||||||
|
|
||||||
|
@Query("SELECT * FROM incomes WHERE date BETWEEN :startDate AND :endDate")
|
||||||
|
fun getIncomesForPeriod(startDate: Date, endDate: Date): Flow<List<Income>>
|
||||||
|
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
suspend fun insertIncome(income: Income)
|
||||||
|
|
||||||
|
@Update
|
||||||
|
suspend fun updateIncome(income: Income)
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
suspend fun deleteIncome(income: Income)
|
||||||
|
}
|
||||||
|
|
||||||
|
class IncomeRepository @Inject constructor(private val incomeDao: IncomeDao) {
|
||||||
|
val allIncomes: Flow<List<Income>> = incomeDao.getAllIncomes()
|
||||||
|
|
||||||
|
fun getIncomesForPeriod(startDate: Date, endDate: Date): Flow<List<Income>> {
|
||||||
|
return incomeDao.getIncomesForPeriod(startDate, endDate)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun insertIncome(income: Income) {
|
||||||
|
incomeDao.insertIncome(income)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun updateIncome(income: Income) {
|
||||||
|
incomeDao.updateIncome(income)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun deleteIncome(income: Income) {
|
||||||
|
incomeDao.deleteIncome(income)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
|
class IncomeViewModel @Inject constructor(private val repository: IncomeRepository) : ViewModel() {
|
||||||
|
val allIncomes: LiveData<List<Income>> = repository.allIncomes.asLiveData()
|
||||||
|
|
||||||
|
fun getIncomesForPeriod(startDate: Date, endDate: Date): LiveData<List<Income>> {
|
||||||
|
return repository.getIncomesForPeriod(startDate, endDate).asLiveData()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun insertIncome(income: Income) = viewModelScope.launch {
|
||||||
|
repository.insertIncome(income)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateIncome(income: Income) = viewModelScope.launch {
|
||||||
|
repository.updateIncome(income)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteIncome(income: Income) = viewModelScope.launch {
|
||||||
|
repository.deleteIncome(income)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.activity.ComponentActivity
|
||||||
|
import androidx.activity.compose.setContent
|
||||||
|
import androidx.activity.viewModels
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.material3.NavigationBar
|
||||||
|
import androidx.compose.material3.NavigationBarItem
|
||||||
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.collectAsState
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
|
||||||
|
@AndroidEntryPoint
|
||||||
|
class MainActivity : ComponentActivity() {
|
||||||
|
private val settingsViewModel: SettingsViewModel by viewModels()
|
||||||
|
private val incomeViewModel: IncomeViewModel by viewModels()
|
||||||
|
private val shiftViewModel: ShiftViewModel by viewModels()
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
setContent {
|
||||||
|
val themeMode by settingsViewModel.themeMode.collectAsState()
|
||||||
|
|
||||||
|
AppTheme(themeMode = themeMode) {
|
||||||
|
MainScreen(
|
||||||
|
shiftViewModel = shiftViewModel,
|
||||||
|
incomeViewModel = incomeViewModel,
|
||||||
|
settingsViewModel = settingsViewModel
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun MainScreen(
|
||||||
|
shiftViewModel: ShiftViewModel,
|
||||||
|
incomeViewModel: IncomeViewModel,
|
||||||
|
settingsViewModel: SettingsViewModel
|
||||||
|
) {
|
||||||
|
val navigationItems = listOf("Shifts", "Templates", "Income", "Settings")
|
||||||
|
val (selectedItem, setSelectedItem) = remember { mutableStateOf(0) }
|
||||||
|
|
||||||
|
Scaffold(
|
||||||
|
bottomBar = {
|
||||||
|
NavigationBar {
|
||||||
|
navigationItems.forEachIndexed { index, item ->
|
||||||
|
NavigationBarItem(
|
||||||
|
icon = {
|
||||||
|
Text(
|
||||||
|
when (index) {
|
||||||
|
0 -> "📅"
|
||||||
|
1 -> "📋"
|
||||||
|
2 -> "💰"
|
||||||
|
3 -> "⚙️"
|
||||||
|
else -> "📌"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
label = { Text(item) },
|
||||||
|
selected = selectedItem == index,
|
||||||
|
onClick = { setSelectedItem(index) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) { paddingValues ->
|
||||||
|
Column(modifier = Modifier.padding(paddingValues)) {
|
||||||
|
when (selectedItem) {
|
||||||
|
0 -> CalendarScreen(shiftViewModel)
|
||||||
|
1 -> ShiftTemplatesScreen(shiftViewModel)
|
||||||
|
2 -> StatisticsScreen(incomeViewModel)
|
||||||
|
3 -> SettingsScreen(settingsViewModel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
//package com.yaros.shiftmanager
|
||||||
|
//
|
||||||
|
//import android.app.NotificationChannel
|
||||||
|
//import android.app.NotificationManager
|
||||||
|
//import android.content.Context
|
||||||
|
//import android.os.Build
|
||||||
|
//import androidx.core.app.NotificationCompat
|
||||||
|
//import androidx.core.app.NotificationManagerCompat
|
||||||
|
//import androidx.work.*
|
||||||
|
//import com.yaros.shiftmanager.*
|
||||||
|
//import java.util.concurrent.TimeUnit
|
||||||
|
//
|
||||||
|
//class NotificationHelper(private val context: Context) {
|
||||||
|
// private val channelId = "ShiftManagerChannel"
|
||||||
|
// private val notificationId = 1
|
||||||
|
//
|
||||||
|
// init {
|
||||||
|
// createNotificationChannel()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private fun createNotificationChannel() {
|
||||||
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
// val name = "Shift Manager"
|
||||||
|
// val descriptionText = "Notifications for upcoming shifts"
|
||||||
|
// val importance = NotificationManager.IMPORTANCE_DEFAULT
|
||||||
|
// val channel = NotificationChannel(channelId, name, importance).apply {
|
||||||
|
// description = descriptionText
|
||||||
|
// }
|
||||||
|
// val notificationManager: NotificationManager =
|
||||||
|
// context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||||
|
// notificationManager.createNotificationChannel(channel)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// fun showShiftNotification(shift: Shift) {
|
||||||
|
// val builder = NotificationCompat.Builder(context, channelId)
|
||||||
|
// .setSmallIcon(R.drawable.ic_notification)
|
||||||
|
// .setContentTitle("Upcoming Shift")
|
||||||
|
// .setContentText("You have a ${shift.type} shift starting at ${shift.startTime}")
|
||||||
|
// .setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||||
|
// .setAutoCancel(true)
|
||||||
|
//
|
||||||
|
// with(NotificationManagerCompat.from(context)) {
|
||||||
|
// notify(notificationId, builder.build())
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//class ShiftNotificationWorker(
|
||||||
|
// context: Context,
|
||||||
|
// params: WorkerParameters
|
||||||
|
//) : Worker(context, params) {
|
||||||
|
// override fun doWork(): Result {
|
||||||
|
// val shiftId = inputData.getString("shiftId") ?: return Result.failure()
|
||||||
|
// val shift = // Retrieve shift from database using shiftId
|
||||||
|
// NotificationHelper(applicationContext).showShiftNotification(shift)
|
||||||
|
// return Result.success()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// companion object {
|
||||||
|
// fun scheduleNotification(context: Context, shift: Shift) {
|
||||||
|
// val notificationWork = OneTimeWorkRequestBuilder<ShiftNotificationWorker>()
|
||||||
|
// .setInputData(workDataOf("shiftId" to shift.id))
|
||||||
|
// .setInitialDelay(calculateInitialDelay(shift), TimeUnit.MILLISECONDS)
|
||||||
|
// .build()
|
||||||
|
//
|
||||||
|
// WorkManager.getInstance(context).enqueue(notificationWork)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private fun calculateInitialDelay(shift: Shift): Long {
|
||||||
|
// val currentTime = System.currentTimeMillis()
|
||||||
|
// return shift.startTime.time - currentTime - TimeUnit.HOURS.toMillis(1) // Notify 1 hour before shift
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.datastore.core.DataStore
|
||||||
|
import androidx.datastore.preferences.core.*
|
||||||
|
import androidx.datastore.preferences.preferencesDataStore
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
|
import kotlinx.coroutines.flow.*
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "settings")
|
||||||
|
|
||||||
|
class SettingsRepository @Inject constructor(@ApplicationContext private val context: Context) {
|
||||||
|
private val dataStore = context.dataStore
|
||||||
|
|
||||||
|
val themeFlow: Flow<ThemeMode> = dataStore.data.map { preferences ->
|
||||||
|
ThemeMode.valueOf(preferences[PreferencesKeys.THEME_MODE] ?: ThemeMode.SYSTEM.name)
|
||||||
|
}
|
||||||
|
|
||||||
|
val displayModeFlow: Flow<DisplayMode> = dataStore.data.map { preferences ->
|
||||||
|
DisplayMode.valueOf(preferences[PreferencesKeys.DISPLAY_MODE] ?: DisplayMode.WEEKLY.name)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun setThemeMode(themeMode: ThemeMode) {
|
||||||
|
dataStore.edit { preferences ->
|
||||||
|
preferences[PreferencesKeys.THEME_MODE] = themeMode.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun setDisplayMode(displayMode: DisplayMode) {
|
||||||
|
dataStore.edit { preferences ->
|
||||||
|
preferences[PreferencesKeys.DISPLAY_MODE] = displayMode.name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private object PreferencesKeys {
|
||||||
|
val THEME_MODE = stringPreferencesKey("theme_mode")
|
||||||
|
val DISPLAY_MODE = stringPreferencesKey("display_mode")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class ThemeMode {
|
||||||
|
LIGHT, DARK, SYSTEM
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class DisplayMode {
|
||||||
|
WEEKLY, MONTHLY
|
||||||
|
}
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
|
class SettingsViewModel @Inject constructor(private val repository: SettingsRepository) : ViewModel() {
|
||||||
|
val themeMode: StateFlow<ThemeMode> = repository.themeFlow.stateIn(
|
||||||
|
viewModelScope,
|
||||||
|
SharingStarted.WhileSubscribed(5000),
|
||||||
|
ThemeMode.SYSTEM
|
||||||
|
)
|
||||||
|
|
||||||
|
val displayMode: StateFlow<DisplayMode> = repository.displayModeFlow.stateIn(
|
||||||
|
viewModelScope,
|
||||||
|
SharingStarted.WhileSubscribed(5000),
|
||||||
|
DisplayMode.WEEKLY
|
||||||
|
)
|
||||||
|
|
||||||
|
fun setThemeMode(themeMode: ThemeMode) = viewModelScope.launch {
|
||||||
|
repository.setThemeMode(themeMode)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setDisplayMode(displayMode: DisplayMode) = viewModelScope.launch {
|
||||||
|
repository.setDisplayMode(displayMode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun SettingsScreen(viewModel: SettingsViewModel) {
|
||||||
|
val themeMode by viewModel.themeMode.collectAsState()
|
||||||
|
val displayMode by viewModel.displayMode.collectAsState()
|
||||||
|
|
||||||
|
Column(modifier = Modifier.padding(16.dp)) {
|
||||||
|
Text("Settings", style = MaterialTheme.typography.titleLarge)
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
ThemeModeSelector(themeMode) { viewModel.setThemeMode(it) }
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
DisplayModeSelector(displayMode) { viewModel.setDisplayMode(it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ThemeModeSelector(currentMode: ThemeMode, onModeSelected: (ThemeMode) -> Unit) {
|
||||||
|
Column {
|
||||||
|
Text("Theme Mode", style = MaterialTheme.typography.titleMedium)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
ThemeMode.values().forEach { mode ->
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 8.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Text(mode.name)
|
||||||
|
RadioButton(
|
||||||
|
selected = mode == currentMode,
|
||||||
|
onClick = { onModeSelected(mode) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun DisplayModeSelector(currentMode: DisplayMode, onModeSelected: (DisplayMode) -> Unit) {
|
||||||
|
Column {
|
||||||
|
Text("Display Mode", style = MaterialTheme.typography.titleMedium)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
DisplayMode.values().forEach { mode ->
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 8.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Text(mode.name)
|
||||||
|
RadioButton(
|
||||||
|
selected = mode == currentMode,
|
||||||
|
onClick = { onModeSelected(mode) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun AppTheme(
|
||||||
|
themeMode: ThemeMode,
|
||||||
|
content: @Composable () -> Unit
|
||||||
|
) {
|
||||||
|
val darkTheme = when (themeMode) {
|
||||||
|
ThemeMode.LIGHT -> false
|
||||||
|
ThemeMode.DARK -> true
|
||||||
|
ThemeMode.SYSTEM -> isSystemInDarkTheme()
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialTheme(
|
||||||
|
colorScheme = if (darkTheme) darkColorScheme() else lightColorScheme(),
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import androidx.room.*
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
|
import kotlinx.coroutines.flow.*
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import java.time.LocalDate
|
||||||
|
import java.time.YearMonth
|
||||||
|
import java.time.ZoneId
|
||||||
|
import java.util.*
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
// ─────────────────── Shift Entity ───────────────────
|
||||||
|
|
||||||
|
@Entity(tableName = "shifts")
|
||||||
|
data class Shift(
|
||||||
|
@PrimaryKey val id: String = UUID.randomUUID().toString(),
|
||||||
|
val title: String,
|
||||||
|
val startTime: Date,
|
||||||
|
val endTime: Date,
|
||||||
|
val type: ShiftType,
|
||||||
|
val isRecurring: Boolean = false,
|
||||||
|
val recurringPattern: RecurringPattern? = null,
|
||||||
|
val hoursWorked: Double = 0.0,
|
||||||
|
val hourlyRate: Double = 0.0,
|
||||||
|
val isCompleted: Boolean = false,
|
||||||
|
val templateId: String? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
enum class ShiftType {
|
||||||
|
DAY, NIGHT, WEEKEND
|
||||||
|
}
|
||||||
|
|
||||||
|
data class RecurringPattern(
|
||||||
|
val frequency: RecurringFrequency,
|
||||||
|
val interval: Int,
|
||||||
|
val daysOfWeek: List<Int>? = null,
|
||||||
|
val endDate: Date? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
enum class RecurringFrequency {
|
||||||
|
DAILY, WEEKLY, MONTHLY
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─────────────────── ShiftTemplate Entity ───────────────────
|
||||||
|
|
||||||
|
@Entity(tableName = "shift_templates")
|
||||||
|
data class ShiftTemplate(
|
||||||
|
@PrimaryKey val id: String = UUID.randomUUID().toString(),
|
||||||
|
val name: String,
|
||||||
|
val hourlyRate: Double,
|
||||||
|
val coefficientRules: List<CoefficientRule> = emptyList()
|
||||||
|
)
|
||||||
|
|
||||||
|
data class CoefficientRule(
|
||||||
|
val startHour: Int, // 0-23
|
||||||
|
val endHour: Int, // 0-23 (next day if < startHour)
|
||||||
|
val coefficient: Double // e.g. 1.4 = +40%
|
||||||
|
)
|
||||||
|
|
||||||
|
// ─────────────────── DAOs ───────────────────
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface ShiftDao {
|
||||||
|
@Query("SELECT * FROM shifts")
|
||||||
|
fun getAllShifts(): Flow<List<Shift>>
|
||||||
|
|
||||||
|
@Query("SELECT * FROM shifts WHERE startTime >= :start AND startTime < :end ORDER BY startTime ASC")
|
||||||
|
fun getShiftsForMonth(start: Date, end: Date): Flow<List<Shift>>
|
||||||
|
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
suspend fun insertShift(shift: Shift)
|
||||||
|
|
||||||
|
@Update
|
||||||
|
suspend fun updateShift(shift: Shift)
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
suspend fun deleteShift(shift: Shift)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface ShiftTemplateDao {
|
||||||
|
@Query("SELECT * FROM shift_templates")
|
||||||
|
fun getAllTemplates(): Flow<List<ShiftTemplate>>
|
||||||
|
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
suspend fun insertTemplate(template: ShiftTemplate)
|
||||||
|
|
||||||
|
@Update
|
||||||
|
suspend fun updateTemplate(template: ShiftTemplate)
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
suspend fun deleteTemplate(template: ShiftTemplate)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─────────────────── Repositories ───────────────────
|
||||||
|
|
||||||
|
class ShiftRepository @Inject constructor(private val shiftDao: ShiftDao) {
|
||||||
|
val allShifts: Flow<List<Shift>> = shiftDao.getAllShifts()
|
||||||
|
|
||||||
|
fun getShiftsForMonth(yearMonth: YearMonth): Flow<List<Shift>> {
|
||||||
|
val start = yearMonth.atDay(1).atStartOfDay(ZoneId.systemDefault()).toInstant().let { Date.from(it) }
|
||||||
|
val end = yearMonth.plusMonths(1).atDay(1).atStartOfDay(ZoneId.systemDefault()).toInstant().let { Date.from(it) }
|
||||||
|
return shiftDao.getShiftsForMonth(start, end)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun insertShift(shift: Shift) = shiftDao.insertShift(shift)
|
||||||
|
suspend fun updateShift(shift: Shift) = shiftDao.updateShift(shift)
|
||||||
|
suspend fun deleteShift(shift: Shift) = shiftDao.deleteShift(shift)
|
||||||
|
}
|
||||||
|
|
||||||
|
class ShiftTemplateRepository @Inject constructor(private val dao: ShiftTemplateDao) {
|
||||||
|
val allTemplates: Flow<List<ShiftTemplate>> = dao.getAllTemplates()
|
||||||
|
suspend fun insertTemplate(template: ShiftTemplate) = dao.insertTemplate(template)
|
||||||
|
suspend fun updateTemplate(template: ShiftTemplate) = dao.updateTemplate(template)
|
||||||
|
suspend fun deleteTemplate(template: ShiftTemplate) = dao.deleteTemplate(template)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─────────────────── ViewModels ───────────────────
|
||||||
|
|
||||||
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
|
@HiltViewModel
|
||||||
|
class ShiftViewModel @Inject constructor(
|
||||||
|
private val repository: ShiftRepository,
|
||||||
|
private val templateRepository: ShiftTemplateRepository
|
||||||
|
) : ViewModel() {
|
||||||
|
|
||||||
|
private val _currentMonth = MutableStateFlow(YearMonth.now())
|
||||||
|
val currentMonth: StateFlow<YearMonth> = _currentMonth.asStateFlow()
|
||||||
|
|
||||||
|
val monthShifts: StateFlow<List<Shift>> = _currentMonth
|
||||||
|
.flatMapLatest { month -> repository.getShiftsForMonth(month) }
|
||||||
|
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), emptyList())
|
||||||
|
|
||||||
|
val allTemplates: StateFlow<List<ShiftTemplate>> = templateRepository.allTemplates
|
||||||
|
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), emptyList())
|
||||||
|
|
||||||
|
fun setMonth(month: YearMonth) { _currentMonth.value = month }
|
||||||
|
fun nextMonth() { _currentMonth.value = _currentMonth.value.plusMonths(1) }
|
||||||
|
fun previousMonth() { _currentMonth.value = _currentMonth.value.minusMonths(1) }
|
||||||
|
|
||||||
|
fun insertShift(shift: Shift) = viewModelScope.launch { repository.insertShift(shift) }
|
||||||
|
fun updateShift(shift: Shift) = viewModelScope.launch { repository.updateShift(shift) }
|
||||||
|
fun deleteShift(shift: Shift) = viewModelScope.launch { repository.deleteShift(shift) }
|
||||||
|
|
||||||
|
fun insertTemplate(template: ShiftTemplate) = viewModelScope.launch { templateRepository.insertTemplate(template) }
|
||||||
|
fun updateTemplate(template: ShiftTemplate) = viewModelScope.launch { templateRepository.updateTemplate(template) }
|
||||||
|
fun deleteTemplate(template: ShiftTemplate) = viewModelScope.launch { templateRepository.deleteTemplate(template) }
|
||||||
|
|
||||||
|
fun shiftsForDate(date: LocalDate): List<Shift> {
|
||||||
|
return monthShifts.value.filter { shift ->
|
||||||
|
shift.startTime.toInstant()
|
||||||
|
.atZone(ZoneId.systemDefault())
|
||||||
|
.toLocalDate() == date
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun calculateEarnings(baseRate: Double, hoursWorked: Double, rules: List<CoefficientRule>): Double {
|
||||||
|
if (rules.isEmpty()) return baseRate * hoursWorked
|
||||||
|
val hoursByCoefficient = mutableListOf<Double>()
|
||||||
|
for (i in 0 until hoursWorked.toInt().coerceAtMost(24)) {
|
||||||
|
val coeff = rules.firstOrNull { rule ->
|
||||||
|
if (rule.startHour <= rule.endHour)
|
||||||
|
i >= rule.startHour && i < rule.endHour
|
||||||
|
else
|
||||||
|
i >= rule.startHour || i < rule.endHour
|
||||||
|
}?.coefficient ?: 1.0
|
||||||
|
hoursByCoefficient.add(coeff)
|
||||||
|
}
|
||||||
|
return hoursByCoefficient.sumOf { baseRate * it }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import dagger.hilt.android.HiltAndroidApp
|
||||||
|
|
||||||
|
@HiltAndroidApp
|
||||||
|
class ShiftManagerApplication : Application()
|
||||||
@@ -0,0 +1,285 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
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.Add
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.runtime.snapshots.SnapshotStateList
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
|
import java.util.Locale
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
// ─────────────────── Templates Screen ───────────────────
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ShiftTemplatesScreen(viewModel: ShiftViewModel = hiltViewModel()) {
|
||||||
|
val templates by viewModel.allTemplates.collectAsState()
|
||||||
|
|
||||||
|
var showDialog by remember { mutableStateOf(false) }
|
||||||
|
var editingTemplate by remember { mutableStateOf<ShiftTemplate?>(null) }
|
||||||
|
|
||||||
|
Scaffold(
|
||||||
|
floatingActionButton = {
|
||||||
|
FloatingActionButton(onClick = {
|
||||||
|
editingTemplate = null
|
||||||
|
showDialog = true
|
||||||
|
}) {
|
||||||
|
Icon(Icons.Default.Add, contentDescription = "Add Template")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) { paddingValues ->
|
||||||
|
Column(modifier = Modifier.padding(paddingValues).fillMaxSize()) {
|
||||||
|
Text(
|
||||||
|
text = "Shift Templates",
|
||||||
|
style = MaterialTheme.typography.headlineSmall,
|
||||||
|
modifier = Modifier.padding(16.dp)
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = "Create templates with hourly rates and night/weekend coefficients",
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
|
modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
if (templates.isEmpty()) {
|
||||||
|
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||||
|
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||||
|
Text(
|
||||||
|
"No templates yet",
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
Spacer(Modifier.height(8.dp))
|
||||||
|
Text(
|
||||||
|
"Tap + to create your first shift template",
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LazyColumn(modifier = Modifier.fillMaxWidth()) {
|
||||||
|
items(templates) { template ->
|
||||||
|
TemplateCard(
|
||||||
|
template = template,
|
||||||
|
onEdit = {
|
||||||
|
editingTemplate = template
|
||||||
|
showDialog = true
|
||||||
|
},
|
||||||
|
onDelete = { viewModel.deleteTemplate(template) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showDialog) {
|
||||||
|
TemplateDialog(
|
||||||
|
existingTemplate = editingTemplate,
|
||||||
|
onDismiss = { showDialog = false },
|
||||||
|
onSave = { template ->
|
||||||
|
if (editingTemplate != null) viewModel.updateTemplate(template)
|
||||||
|
else viewModel.insertTemplate(template)
|
||||||
|
showDialog = false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─────────────────── Template Card ───────────────────
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun TemplateCard(
|
||||||
|
template: ShiftTemplate,
|
||||||
|
onEdit: () -> Unit,
|
||||||
|
onDelete: () -> Unit
|
||||||
|
) {
|
||||||
|
Card(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 12.dp, vertical = 6.dp),
|
||||||
|
onClick = onEdit
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.padding(16.dp)) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(template.name, style = MaterialTheme.typography.titleMedium)
|
||||||
|
IconButton(onClick = onDelete) {
|
||||||
|
Text("✕", color = MaterialTheme.colorScheme.error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = "Base rate: $${String.format(Locale.getDefault(), "%.2f", template.hourlyRate)}/hr",
|
||||||
|
style = MaterialTheme.typography.bodyMedium
|
||||||
|
)
|
||||||
|
|
||||||
|
if (template.coefficientRules.isNotEmpty()) {
|
||||||
|
Spacer(Modifier.height(8.dp))
|
||||||
|
Text("Coefficient rules:", style = MaterialTheme.typography.labelMedium)
|
||||||
|
template.coefficientRules.forEach { rule ->
|
||||||
|
val percent = ((rule.coefficient - 1.0) * 100).toInt()
|
||||||
|
val sign = if (percent > 0) "+" else ""
|
||||||
|
Text(
|
||||||
|
text = " ${String.format(Locale.getDefault(), "%02d:00", rule.startHour)} – " +
|
||||||
|
"${String.format(Locale.getDefault(), "%02d:00", rule.endHour)} → " +
|
||||||
|
"${sign}${percent}% (×${String.format(Locale.getDefault(), "%.1f", rule.coefficient)})",
|
||||||
|
style = MaterialTheme.typography.bodySmall,
|
||||||
|
color = MaterialTheme.colorScheme.primary
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─────────────────── Template Dialog ───────────────────
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun TemplateDialog(
|
||||||
|
existingTemplate: ShiftTemplate?,
|
||||||
|
onDismiss: () -> Unit,
|
||||||
|
onSave: (ShiftTemplate) -> Unit
|
||||||
|
) {
|
||||||
|
var name by remember { mutableStateOf(existingTemplate?.name ?: "") }
|
||||||
|
var rateText by remember {
|
||||||
|
mutableStateOf(
|
||||||
|
if (existingTemplate != null) existingTemplate.hourlyRate.toString() else ""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val rules = remember {
|
||||||
|
mutableStateListOf<CoefficientRule>().also {
|
||||||
|
it.addAll(existingTemplate?.coefficientRules ?: emptyList())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// New rule fields
|
||||||
|
var newStartHour by remember { mutableStateOf("") }
|
||||||
|
var newEndHour by remember { mutableStateOf("") }
|
||||||
|
var newCoefficient by remember { mutableStateOf("") }
|
||||||
|
|
||||||
|
AlertDialog(
|
||||||
|
onDismissRequest = onDismiss,
|
||||||
|
title = { Text(if (existingTemplate != null) "Edit Template" else "New Template") },
|
||||||
|
text = {
|
||||||
|
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||||
|
OutlinedTextField(
|
||||||
|
value = name,
|
||||||
|
onValueChange = { name = it },
|
||||||
|
label = { Text("Template name (e.g. Day Shift, Night Shift)") },
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
singleLine = true
|
||||||
|
)
|
||||||
|
OutlinedTextField(
|
||||||
|
value = rateText,
|
||||||
|
onValueChange = { rateText = it },
|
||||||
|
label = { Text("Base hourly rate ($)") },
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
singleLine = true
|
||||||
|
)
|
||||||
|
|
||||||
|
Divider()
|
||||||
|
Text("Coefficient rules", style = MaterialTheme.typography.labelLarge)
|
||||||
|
Text(
|
||||||
|
"Example: 00:00–06:00 → 1.4 means +40% for hours between midnight and 6 AM",
|
||||||
|
style = MaterialTheme.typography.bodySmall,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
|
||||||
|
// Existing rules
|
||||||
|
rules.forEachIndexed { index, rule ->
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "${String.format(Locale.getDefault(), "%02d:00", rule.startHour)}–" +
|
||||||
|
"${String.format(Locale.getDefault(), "%02d:00", rule.endHour)} → " +
|
||||||
|
"×${String.format(Locale.getDefault(), "%.1f", rule.coefficient)}",
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
)
|
||||||
|
IconButton(onClick = { rules.removeAt(index) }) {
|
||||||
|
Text("✕", color = MaterialTheme.colorScheme.error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add new rule row
|
||||||
|
Text("Add rule:", style = MaterialTheme.typography.labelSmall)
|
||||||
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
OutlinedTextField(
|
||||||
|
value = newStartHour,
|
||||||
|
onValueChange = { newStartHour = it.filter { c -> c.isDigit() }.take(2) },
|
||||||
|
label = { Text("From") },
|
||||||
|
placeholder = { Text("00") },
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
singleLine = true
|
||||||
|
)
|
||||||
|
Text("–")
|
||||||
|
OutlinedTextField(
|
||||||
|
value = newEndHour,
|
||||||
|
onValueChange = { newEndHour = it.filter { c -> c.isDigit() }.take(2) },
|
||||||
|
label = { Text("To") },
|
||||||
|
placeholder = { Text("06") },
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
singleLine = true
|
||||||
|
)
|
||||||
|
OutlinedTextField(
|
||||||
|
value = newCoefficient,
|
||||||
|
onValueChange = { newCoefficient = it },
|
||||||
|
label = { Text("×") },
|
||||||
|
placeholder = { Text("1.4") },
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
singleLine = true
|
||||||
|
)
|
||||||
|
FilledTonalButton(
|
||||||
|
onClick = {
|
||||||
|
val start = newStartHour.toIntOrNull() ?: return@FilledTonalButton
|
||||||
|
val end = newEndHour.toIntOrNull() ?: return@FilledTonalButton
|
||||||
|
val coeff = newCoefficient.toDoubleOrNull() ?: return@FilledTonalButton
|
||||||
|
if (start !in 0..23 || end !in 0..23) return@FilledTonalButton
|
||||||
|
rules.add(CoefficientRule(start, end, coeff))
|
||||||
|
newStartHour = ""
|
||||||
|
newEndHour = ""
|
||||||
|
newCoefficient = ""
|
||||||
|
},
|
||||||
|
modifier = Modifier.size(40.dp),
|
||||||
|
contentPadding = PaddingValues(0.dp)
|
||||||
|
) {
|
||||||
|
Text("+")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
confirmButton = {
|
||||||
|
Button(onClick = {
|
||||||
|
val rate = rateText.toDoubleOrNull() ?: return@Button
|
||||||
|
val template = ShiftTemplate(
|
||||||
|
id = existingTemplate?.id ?: UUID.randomUUID().toString(),
|
||||||
|
name = name.ifBlank { "Untitled Template" },
|
||||||
|
hourlyRate = rate,
|
||||||
|
coefficientRules = rules.toList()
|
||||||
|
)
|
||||||
|
onSave(template)
|
||||||
|
}) { Text("Save") }
|
||||||
|
},
|
||||||
|
dismissButton = {
|
||||||
|
TextButton(onClick = onDismiss) { Text("Cancel") }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.material3.Button
|
||||||
|
import androidx.compose.material3.ButtonDefaults
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import java.util.Calendar
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun StatisticsScreen(incomeViewModel: IncomeViewModel) {
|
||||||
|
var selectedPeriod by remember { mutableStateOf(StatisticsPeriod.MONTH) }
|
||||||
|
var incomes by remember { mutableStateOf<List<Income>>(emptyList()) }
|
||||||
|
|
||||||
|
LaunchedEffect(selectedPeriod) {
|
||||||
|
val (startDate, endDate) = getDateRangeForPeriod(selectedPeriod)
|
||||||
|
incomeViewModel.getIncomesForPeriod(startDate, endDate).observeForever { incomes = it }
|
||||||
|
}
|
||||||
|
|
||||||
|
Column(modifier = Modifier.padding(16.dp)) {
|
||||||
|
PeriodSelector(selectedPeriod) { selectedPeriod = it }
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
IncomeChart(incomes)
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
IncomeBreakdown(incomes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun PeriodSelector(selectedPeriod: StatisticsPeriod, onPeriodSelected: (StatisticsPeriod) -> Unit) {
|
||||||
|
Row {
|
||||||
|
StatisticsPeriod.entries.forEach { period ->
|
||||||
|
Button(
|
||||||
|
onClick = { onPeriodSelected(period) },
|
||||||
|
modifier = Modifier.padding(4.dp),
|
||||||
|
colors = ButtonDefaults.buttonColors(
|
||||||
|
containerColor = if (period == selectedPeriod) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.secondary
|
||||||
|
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Text(period.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun IncomeChart(incomes: List<Income>) {
|
||||||
|
// Placeholder for chart - Vico chart implementation
|
||||||
|
Text("Income Chart: ${incomes.size} entries")
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun IncomeBreakdown(incomes: List<Income>) {
|
||||||
|
val totalIncome = incomes.sumOf { it.amount }
|
||||||
|
val regularIncome = incomes.filter { it.type == IncomeType.REGULAR }.sumOf { it.amount }
|
||||||
|
val tipsIncome = incomes.filter { it.type == IncomeType.TIPS }.sumOf { it.amount }
|
||||||
|
val bonusIncome = incomes.filter { it.type == IncomeType.BONUS }.sumOf { it.amount }
|
||||||
|
|
||||||
|
Column {
|
||||||
|
Text("Total Income: $${String.format(Locale.US, "%.2f", totalIncome)}", style = MaterialTheme.typography.titleLarge)
|
||||||
|
Text("Regular Income: $${String.format(Locale.US, "%.2f", regularIncome)}", style = MaterialTheme.typography.bodyLarge)
|
||||||
|
Text("Tips: $${String.format(Locale.US, "%.2f", tipsIncome)}", style = MaterialTheme.typography.bodyLarge)
|
||||||
|
Text("Bonuses: $${String.format(Locale.US, "%.2f", bonusIncome)}", style = MaterialTheme.typography.bodyLarge)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class StatisticsPeriod {
|
||||||
|
WEEK, MONTH, YEAR
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getDateRangeForPeriod(period: StatisticsPeriod): Pair<Date, Date> {
|
||||||
|
val calendar = Calendar.getInstance()
|
||||||
|
val endDate = calendar.time
|
||||||
|
calendar.add(when (period) {
|
||||||
|
StatisticsPeriod.WEEK -> Calendar.WEEK_OF_YEAR
|
||||||
|
StatisticsPeriod.MONTH -> Calendar.MONTH
|
||||||
|
StatisticsPeriod.YEAR -> Calendar.YEAR
|
||||||
|
}, -1)
|
||||||
|
val startDate = calendar.time
|
||||||
|
return Pair(startDate, endDate)
|
||||||
|
}
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
import androidx.compose.foundation.*
|
||||||
|
import androidx.compose.foundation.layout.Arrangement.Absolute.SpaceBetween
|
||||||
|
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.padding
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.ui.*
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.lifecycle.*
|
||||||
|
import androidx.room.*
|
||||||
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import kotlinx.coroutines.*
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
import kotlinx.coroutines.flow.stateIn
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@Entity(tableName = "tax_reminders")
|
||||||
|
data class TaxReminder(
|
||||||
|
@PrimaryKey val id: String = UUID.randomUUID().toString(),
|
||||||
|
val dueDate: Date,
|
||||||
|
val description: String,
|
||||||
|
val isCompleted: Boolean = false
|
||||||
|
)
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface TaxReminderDao {
|
||||||
|
@Query("SELECT * FROM tax_reminders")
|
||||||
|
fun getAllTaxReminders(): Flow<List<TaxReminder>>
|
||||||
|
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
suspend fun insertTaxReminder(taxReminder: TaxReminder)
|
||||||
|
|
||||||
|
@Update
|
||||||
|
suspend fun updateTaxReminder(taxReminder: TaxReminder)
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
suspend fun deleteTaxReminder(taxReminder: TaxReminder)
|
||||||
|
}
|
||||||
|
|
||||||
|
class TaxReminderRepository @Inject constructor(private val taxReminderDao: TaxReminderDao) {
|
||||||
|
val allTaxReminders: Flow<List<TaxReminder>> = taxReminderDao.getAllTaxReminders()
|
||||||
|
|
||||||
|
suspend fun insertTaxReminder(taxReminder: TaxReminder) {
|
||||||
|
taxReminderDao.insertTaxReminder(taxReminder)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun updateTaxReminder(taxReminder: TaxReminder) {
|
||||||
|
taxReminderDao.updateTaxReminder(taxReminder)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun deleteTaxReminder(taxReminder: TaxReminder) {
|
||||||
|
taxReminderDao.deleteTaxReminder(taxReminder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@HiltViewModel
|
||||||
|
class TaxReminderViewModel @Inject constructor(private val repository: TaxReminderRepository) : ViewModel() {
|
||||||
|
val allTaxReminders: StateFlow<List<TaxReminder>> = repository.allTaxReminders.stateIn(
|
||||||
|
viewModelScope,
|
||||||
|
SharingStarted.Lazily,
|
||||||
|
emptyList()
|
||||||
|
)
|
||||||
|
|
||||||
|
fun insertTaxReminder(taxReminder: TaxReminder) = viewModelScope.launch {
|
||||||
|
repository.insertTaxReminder(taxReminder)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateTaxReminder(taxReminder: TaxReminder) = viewModelScope.launch {
|
||||||
|
repository.updateTaxReminder(taxReminder)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteTaxReminder(taxReminder: TaxReminder) = viewModelScope.launch {
|
||||||
|
repository.deleteTaxReminder(taxReminder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun TaxReminderScreen(viewModel: TaxReminderViewModel) {
|
||||||
|
val taxReminders by viewModel.allTaxReminders.collectAsState(initial = emptyList())
|
||||||
|
|
||||||
|
Column(modifier = Modifier.padding(16.dp)) {
|
||||||
|
Text("Tax Reminders", style = MaterialTheme.typography.titleLarge)
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
LazyColumn {
|
||||||
|
items(taxReminders) { reminder ->
|
||||||
|
TaxReminderItem(reminder, viewModel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
AddTaxReminderButton(viewModel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun TaxReminderItem(reminder: TaxReminder, viewModel: TaxReminderViewModel) {
|
||||||
|
Card(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(8.dp)
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(16.dp)
|
||||||
|
.fillMaxWidth(),
|
||||||
|
horizontalArrangement = SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Column {
|
||||||
|
Text(reminder.description, style = MaterialTheme.typography.bodyLarge)
|
||||||
|
Text(
|
||||||
|
"Due: ${SimpleDateFormat("MMM dd, yyyy", Locale.getDefault()).format(reminder.dueDate)}",
|
||||||
|
style = MaterialTheme.typography.bodyMedium
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Checkbox(
|
||||||
|
checked = reminder.isCompleted,
|
||||||
|
onCheckedChange = { isChecked ->
|
||||||
|
viewModel.updateTaxReminder(reminder.copy(isCompleted = isChecked))
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun AddTaxReminderButton(viewModel: TaxReminderViewModel) {
|
||||||
|
var showDialog by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
Button(onClick = { showDialog = true }) {
|
||||||
|
Text("Add Tax Reminder")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showDialog) {
|
||||||
|
AddTaxReminderDialog(
|
||||||
|
onDismiss = { showDialog = false },
|
||||||
|
onAdd = { description, dueDate ->
|
||||||
|
viewModel.insertTaxReminder(TaxReminder(description = description, dueDate = dueDate))
|
||||||
|
showDialog = false
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun AddTaxReminderDialog(onDismiss: () -> Unit, onAdd: (String, Date) -> Unit) {
|
||||||
|
var description by remember { mutableStateOf("") }
|
||||||
|
var dueDate by remember { mutableStateOf(Date()) }
|
||||||
|
|
||||||
|
AlertDialog(
|
||||||
|
onDismissRequest = onDismiss,
|
||||||
|
title = { Text("Add Tax Reminder") },
|
||||||
|
text = {
|
||||||
|
Column {
|
||||||
|
TextField(
|
||||||
|
value = description,
|
||||||
|
onValueChange = { description = it },
|
||||||
|
label = { Text("Description") }
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
// Add a DatePicker here for selecting dueDate
|
||||||
|
}
|
||||||
|
},
|
||||||
|
confirmButton = {
|
||||||
|
Button(onClick = { onAdd(description, dueDate) }) {
|
||||||
|
Text("Add")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dismissButton = {
|
||||||
|
Button(onClick = onDismiss) {
|
||||||
|
Text("Cancel")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -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>
|
||||||
@@ -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,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: 982 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
@@ -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,3 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">ShiftManager</string>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="Theme.ShiftManager" 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 that API 31
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore
|
||||||
|
-->
|
||||||
|
<full-backup-content>
|
||||||
|
<!--
|
||||||
|
<include domain="sharedpref" path="."/>
|
||||||
|
<exclude domain="sharedpref" path="device.xml"/>
|
||||||
|
-->
|
||||||
|
</full-backup-content>
|
||||||
@@ -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,17 @@
|
|||||||
|
package com.yaros.shiftmanager
|
||||||
|
|
||||||
|
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,12 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
buildscript {
|
||||||
|
dependencies {
|
||||||
|
classpath(libs.hilt.android.gradle.plugin)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application) apply false
|
||||||
|
alias(libs.plugins.jetbrains.kotlin.android) apply false
|
||||||
|
alias(libs.plugins.google.gms.google.services) apply false
|
||||||
|
alias(libs.plugins.kotlin.compose) apply false
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# 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
|
||||||
|
android.defaults.buildfeatures.resvalues=true
|
||||||
|
android.sdk.defaultTargetSdkToCompileSdkIfUnset=false
|
||||||
|
android.enableAppCompileTimeRClass=false
|
||||||
|
android.usesSdkInManifest.disallowed=false
|
||||||
|
android.uniquePackageNames=false
|
||||||
|
android.dependency.useConstraints=true
|
||||||
|
android.r8.strictFullModeForKeepRules=false
|
||||||
|
android.r8.optimizedResourceShrinking=false
|
||||||
|
android.builtInKotlin=false
|
||||||
|
android.newDsl=false
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
[versions]
|
||||||
|
agp = "9.1.1"
|
||||||
|
datastorePreferences = "1.2.1"
|
||||||
|
desugar_jdk_libs = "2.1.5"
|
||||||
|
hiltAndroid = "2.49"
|
||||||
|
hiltAndroidGradlePlugin = "2.57.2"
|
||||||
|
hiltCompiler = "2.52"
|
||||||
|
kotlin = "2.2.10"
|
||||||
|
coreKtx = "1.13.1"
|
||||||
|
junit = "4.13.2"
|
||||||
|
junitVersion = "1.2.1"
|
||||||
|
roomRuntime = "2.8.4"
|
||||||
|
vico = "2.0.0-beta.2"
|
||||||
|
espressoCore = "3.6.1"
|
||||||
|
lifecycleRuntimeKtx = "2.8.6"
|
||||||
|
activityCompose = "1.9.3"
|
||||||
|
composeBom = "2024.10.00"
|
||||||
|
navigationCompose = "2.8.3"
|
||||||
|
googleGmsGoogleServices = "4.4.2"
|
||||||
|
firebaseAuth = "23.1.0"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
|
androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" }
|
||||||
|
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "roomRuntime" }
|
||||||
|
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "roomRuntime" }
|
||||||
|
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "roomRuntime" }
|
||||||
|
dagger-hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hiltCompiler" }
|
||||||
|
desugar_jdk_libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar_jdk_libs" }
|
||||||
|
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hiltAndroid" }
|
||||||
|
hilt-android-gradle-plugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hiltAndroidGradlePlugin" }
|
||||||
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||||
|
vico-compose = { group = "com.patrykandpatrick.vico", name = "compose", version.ref = "vico" }
|
||||||
|
vico-compose-m2 = { group = "com.patrykandpatrick.vico", name = "compose-m2", version.ref = "vico" }
|
||||||
|
vico-compose-m3 = { group = "com.patrykandpatrick.vico", name = "compose-m3", version.ref = "vico" }
|
||||||
|
vico-core = { group = "com.patrykandpatrick.vico", name = "core", version.ref = "vico" }
|
||||||
|
vico-views = { group = "com.patrykandpatrick.vico", name = "views", version.ref = "vico" }
|
||||||
|
androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationCompose" }
|
||||||
|
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||||
|
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||||
|
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
|
||||||
|
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
|
||||||
|
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
|
||||||
|
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
|
||||||
|
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
|
||||||
|
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
|
||||||
|
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
||||||
|
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
||||||
|
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||||
|
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||||
|
firebase-auth = { group = "com.google.firebase", name = "firebase-auth", version.ref = "firebaseAuth" }
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
|
google-gms-google-services = { id = "com.google.gms.google-services", version.ref = "googleGmsGoogleServices" }
|
||||||
|
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#Fri Oct 25 20:02:21 MSK 2024
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-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
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
google {
|
||||||
|
content {
|
||||||
|
includeGroupByRegex("com\\.android.*")
|
||||||
|
includeGroupByRegex("com\\.google.*")
|
||||||
|
includeGroupByRegex("androidx.*")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plugins {
|
||||||
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "ShiftManager"
|
||||||
|
include ':app'
|
||||||