diff --git a/GiletaProject/GiletaProject.xcodeproj/project.pbxproj b/GiletaProject/GiletaProject.xcodeproj/project.pbxproj new file mode 100644 index 0000000..b99b9c8 --- /dev/null +++ b/GiletaProject/GiletaProject.xcodeproj/project.pbxproj @@ -0,0 +1,348 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXFileReference section */ + 117A7BD82EDBFBC400387C7C /* GiletaProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GiletaProject.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + 117A7BEA2EDBFBC400387C7C /* Exceptions for "GiletaProject" folder in "GiletaProject" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Info.plist, + ); + target = 117A7BD72EDBFBC400387C7C /* GiletaProject */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 117A7BDA2EDBFBC400387C7C /* GiletaProject */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + 117A7BEA2EDBFBC400387C7C /* Exceptions for "GiletaProject" folder in "GiletaProject" target */, + ); + path = GiletaProject; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 117A7BD52EDBFBC400387C7C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 117A7BCF2EDBFBC400387C7C = { + isa = PBXGroup; + children = ( + 117A7BDA2EDBFBC400387C7C /* GiletaProject */, + 117A7BD92EDBFBC400387C7C /* Products */, + ); + sourceTree = ""; + }; + 117A7BD92EDBFBC400387C7C /* Products */ = { + isa = PBXGroup; + children = ( + 117A7BD82EDBFBC400387C7C /* GiletaProject.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 117A7BD72EDBFBC400387C7C /* GiletaProject */ = { + isa = PBXNativeTarget; + buildConfigurationList = 117A7BEB2EDBFBC400387C7C /* Build configuration list for PBXNativeTarget "GiletaProject" */; + buildPhases = ( + 117A7BD42EDBFBC400387C7C /* Sources */, + 117A7BD52EDBFBC400387C7C /* Frameworks */, + 117A7BD62EDBFBC400387C7C /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 117A7BDA2EDBFBC400387C7C /* GiletaProject */, + ); + name = GiletaProject; + packageProductDependencies = ( + ); + productName = GiletaProject; + productReference = 117A7BD82EDBFBC400387C7C /* GiletaProject.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 117A7BD02EDBFBC400387C7C /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 2600; + LastUpgradeCheck = 2600; + TargetAttributes = { + 117A7BD72EDBFBC400387C7C = { + CreatedOnToolsVersion = 26.0.1; + }; + }; + }; + buildConfigurationList = 117A7BD32EDBFBC400387C7C /* Build configuration list for PBXProject "GiletaProject" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 117A7BCF2EDBFBC400387C7C; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 117A7BD92EDBFBC400387C7C /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 117A7BD72EDBFBC400387C7C /* GiletaProject */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 117A7BD62EDBFBC400387C7C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 117A7BD42EDBFBC400387C7C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 117A7BEC2EDBFBC400387C7C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = G479H54RSF; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = GiletaProject/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "-23.GiletaProject"; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 117A7BED2EDBFBC400387C7C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = G479H54RSF; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = GiletaProject/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "-23.GiletaProject"; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 117A7BEE2EDBFBC400387C7C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 26.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 117A7BEF2EDBFBC400387C7C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 26.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 117A7BD32EDBFBC400387C7C /* Build configuration list for PBXProject "GiletaProject" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 117A7BEE2EDBFBC400387C7C /* Debug */, + 117A7BEF2EDBFBC400387C7C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 117A7BEB2EDBFBC400387C7C /* Build configuration list for PBXNativeTarget "GiletaProject" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 117A7BEC2EDBFBC400387C7C /* Debug */, + 117A7BED2EDBFBC400387C7C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 117A7BD02EDBFBC400387C7C /* Project object */; +} diff --git a/GiletaProject/GiletaProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/GiletaProject/GiletaProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/GiletaProject/GiletaProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/GiletaProject/GiletaProject.xcodeproj/project.xcworkspace/xcuserdata/alexander.xcuserdatad/UserInterfaceState.xcuserstate b/GiletaProject/GiletaProject.xcodeproj/project.xcworkspace/xcuserdata/alexander.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..43e4e13 Binary files /dev/null and b/GiletaProject/GiletaProject.xcodeproj/project.xcworkspace/xcuserdata/alexander.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/GiletaProject/GiletaProject.xcodeproj/xcuserdata/alexander.xcuserdatad/xcschemes/xcschememanagement.plist b/GiletaProject/GiletaProject.xcodeproj/xcuserdata/alexander.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..5242946 --- /dev/null +++ b/GiletaProject/GiletaProject.xcodeproj/xcuserdata/alexander.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + GiletaProject.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/GiletaProject/GiletaProject/AppDelegate.swift b/GiletaProject/GiletaProject/AppDelegate.swift new file mode 100644 index 0000000..1d6ed85 --- /dev/null +++ b/GiletaProject/GiletaProject/AppDelegate.swift @@ -0,0 +1,34 @@ +// +// AppDelegate.swift +// GiletaProject +// +// Created by Alexander on 30.11.2025. +// + +import UIKit + +@main +class AppDelegate: UIResponder, UIApplicationDelegate { + + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + } + + +} + diff --git a/GiletaProject/GiletaProject/Assets.xcassets/AccentColor.colorset/Contents.json b/GiletaProject/GiletaProject/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/GiletaProject/GiletaProject/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GiletaProject/GiletaProject/Assets.xcassets/AppIcon.appiconset/Contents.json b/GiletaProject/GiletaProject/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2305880 --- /dev/null +++ b/GiletaProject/GiletaProject/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,35 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "tinted" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GiletaProject/GiletaProject/Assets.xcassets/Contents.json b/GiletaProject/GiletaProject/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/GiletaProject/GiletaProject/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/GiletaProject/GiletaProject/Base.lproj/LaunchScreen.storyboard b/GiletaProject/GiletaProject/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/GiletaProject/GiletaProject/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GiletaProject/GiletaProject/Base.lproj/Main.storyboard b/GiletaProject/GiletaProject/Base.lproj/Main.storyboard new file mode 100644 index 0000000..25a7638 --- /dev/null +++ b/GiletaProject/GiletaProject/Base.lproj/Main.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GiletaProject/GiletaProject/CreateTaskViewController.swift b/GiletaProject/GiletaProject/CreateTaskViewController.swift new file mode 100644 index 0000000..a9a082c --- /dev/null +++ b/GiletaProject/GiletaProject/CreateTaskViewController.swift @@ -0,0 +1,186 @@ +// +// CreateTaskViewController.swift +// GiletaProject +// +// Created by Alexander on 30.11.2025. +// + +import UIKit + +class CreateTaskViewController: UIViewController { + + var onSave: ((Task) -> Void)? + + private let titleField: UITextField = { + let field = UITextField() + field.placeholder = "Название задачи" + field.borderStyle = .roundedRect + return field + }() + + private let descriptionField: UITextView = { + let tv = UITextView() + tv.layer.borderWidth = 1 + tv.layer.cornerRadius = 8 + tv.layer.borderColor = UIColor.secondaryLabel.cgColor + tv.textContainerInset = UIEdgeInsets(top: 8, left: 6, bottom: 8, right: 6) + tv.font = .systemFont(ofSize: 16) + return tv + }() + + private var priority: Int = 1 + private var flagged: Bool = false + private var priorityButtonsArray: [UIButton] = [] + private var flagButtonRef: UIButton! + + private let dateSwitch = UISwitch() + + private let datePicker: UIDatePicker = { + let picker = UIDatePicker() + picker.datePickerMode = .dateAndTime + picker.minimumDate = Date() + picker.isHidden = true + return picker + }() + + override func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = .systemBackground + title = "Новая задача" + + navigationItem.rightBarButtonItem = UIBarButtonItem( + title: "Сохранить", + style: .done, + target: self, + action: #selector(saveTapped) + ) + + layoutUI() + addKeyboardHideGesture() + } + + private func layoutUI() { + let stack = UIStackView(arrangedSubviews: [ + titleField, + descriptionField, + makePriorityButtons(), + makeFlagButton(), + makeDeadlineRow(), + datePicker + ]) + + stack.axis = .vertical + stack.spacing = 16 + + view.addSubview(stack) + + stack.translatesAutoresizingMaskIntoConstraints = false + NSLayoutConstraint.activate([ + stack.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16), + stack.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -16), + stack.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 16), + descriptionField.heightAnchor.constraint(equalToConstant: 120) + ]) + + dateSwitch.addTarget(self, action: #selector(toggleDatePicker), for: .valueChanged) + } + + private func makePriorityButtons() -> UIStackView { + priorityButtonsArray = (1...3).map { num in + let btn = UIButton(type: .system) + btn.setTitle("P\(num)", for: .normal) + btn.tag = num + btn.layer.borderWidth = 1 + btn.layer.cornerRadius = 8 + btn.layer.borderColor = UIColor.secondaryLabel.cgColor + btn.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium) + btn.addTarget(self, action: #selector(setPriority(_:)), for: .touchUpInside) + return btn + } + + updatePriorityUI() + + let stack = UIStackView(arrangedSubviews: priorityButtonsArray) + stack.axis = .horizontal + stack.spacing = 12 + stack.distribution = .fillEqually + + return stack + } + + + @objc private func setPriority(_ sender: UIButton) { + priority = sender.tag + updatePriorityUI() + } + + private func updatePriorityUI() { + for btn in priorityButtonsArray { + if btn.tag == priority { + btn.backgroundColor = .systemBlue + btn.setTitleColor(.white, for: .normal) + } else { + btn.backgroundColor = .clear + btn.setTitleColor(.systemBlue, for: .normal) + } + } + } + + private func makeFlagButton() -> UIButton { + flagButtonRef = UIButton(type: .system) + flagButtonRef.setTitle("⚑ Флаг", for: .normal) + flagButtonRef.addTarget(self, action: #selector(toggleFlag), for: .touchUpInside) + updateFlagUI() + return flagButtonRef + } + + @objc private func toggleFlag() { + flagged.toggle() + updateFlagUI() + } + + private func updateFlagUI() { + flagButtonRef.tintColor = flagged ? .systemRed : .systemBlue + } + + private func makeDeadlineRow() -> UIStackView { + let label = UILabel() + label.text = "Дедлайн" + + let row = UIStackView(arrangedSubviews: [label, dateSwitch]) + row.axis = .horizontal + row.distribution = .equalSpacing + return row + } + + @objc private func toggleDatePicker() { + UIView.animate(withDuration: 0.25) { + self.datePicker.isHidden = !self.dateSwitch.isOn + } + } + + @objc private func saveTapped() { + guard let title = titleField.text, !title.isEmpty else { return } + + let task = Task( + title: title, + description: descriptionField.text ?? "", + priority: priority, + flagged: flagged, + deadline: dateSwitch.isOn ? datePicker.date : nil + ) + + onSave?(task) + navigationController?.popViewController(animated: true) + } + + private func addKeyboardHideGesture() { + let tap = UITapGestureRecognizer(target: self, action: #selector(hideKeyboard)) + view.addGestureRecognizer(tap) + } + + @objc private func hideKeyboard() { + view.endEditing(true) + } +} diff --git a/GiletaProject/GiletaProject/Info.plist b/GiletaProject/GiletaProject/Info.plist new file mode 100644 index 0000000..dd3c9af --- /dev/null +++ b/GiletaProject/GiletaProject/Info.plist @@ -0,0 +1,25 @@ + + + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + + diff --git a/GiletaProject/GiletaProject/MainTabBarController.swift b/GiletaProject/GiletaProject/MainTabBarController.swift new file mode 100644 index 0000000..844c277 --- /dev/null +++ b/GiletaProject/GiletaProject/MainTabBarController.swift @@ -0,0 +1,28 @@ +// +// MainTabBarController.swift +// GiletaProject +// +// Created by Alexander on 30.11.2025. +// +import UIKit + +class MainTabBarController: UITabBarController { + + override func viewDidLoad() { + super.viewDidLoad() + + viewControllers = [ + createNavController(vc: UIViewController(), title: "Главная", icon: "house"), + createNavController(vc: TasksViewController(), title: "Задачи", icon: "checklist"), + createNavController(vc: UIViewController(), title: "Записи", icon: "note.text") + ] + } + + private func createNavController(vc: UIViewController, title: String, icon: String) -> UINavigationController { + vc.title = title + let nav = UINavigationController(rootViewController: vc) + nav.tabBarItem.title = title + nav.tabBarItem.image = UIImage(systemName: icon) + return nav + } +} diff --git a/GiletaProject/GiletaProject/SceneDelegate.swift b/GiletaProject/GiletaProject/SceneDelegate.swift new file mode 100644 index 0000000..bfd83c2 --- /dev/null +++ b/GiletaProject/GiletaProject/SceneDelegate.swift @@ -0,0 +1,55 @@ +// +// SceneDelegate.swift +// GiletaProject +// +// Created by Alexander on 30.11.2025. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + guard let windowScene = (scene as? UIWindowScene) else { return } + + window = UIWindow(windowScene: windowScene) + + let tabBar = MainTabBarController() + window?.rootViewController = tabBar + window?.makeKeyAndVisible() + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + } + + +} + diff --git a/GiletaProject/GiletaProject/Task.swift b/GiletaProject/GiletaProject/Task.swift new file mode 100644 index 0000000..9b7f7b2 --- /dev/null +++ b/GiletaProject/GiletaProject/Task.swift @@ -0,0 +1,16 @@ +// +// Task.swift +// GiletaProject +// +// Created by Alexander on 30.11.2025. +// +import UIKit + +struct Task { + var title: String + var description: String? + var priority: Int + var flagged: Bool + var deadline: Date? + var isCompleted: Bool = false +} diff --git a/GiletaProject/GiletaProject/TaskCell.swift b/GiletaProject/GiletaProject/TaskCell.swift new file mode 100644 index 0000000..0c3058d --- /dev/null +++ b/GiletaProject/GiletaProject/TaskCell.swift @@ -0,0 +1,100 @@ +import UIKit + +class TaskCell: UITableViewCell { + + var onComplete: (() -> Void)? + + private let titleLabel = UILabel() + private let descriptionLabel = UILabel() + private let priorityLabel = UILabel() + private let flagLabel = UILabel() // будет справа + private let deadlineLabel = UILabel() + + private let checkButton: UIButton = { + let btn = UIButton(type: .system) + btn.setImage(UIImage(systemName: "circle"), for: .normal) + return btn + }() + + private let infoStack: UIStackView = UIStackView() + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + + checkButton.addTarget(self, action: #selector(toggleComplete), for: .touchUpInside) + + // ЛЕВЫЙ вертикальный стек с информацией о задаче + infoStack.axis = .vertical + infoStack.spacing = 4 + infoStack.alignment = .leading + infoStack.addArrangedSubview(titleLabel) + infoStack.addArrangedSubview(descriptionLabel) + infoStack.addArrangedSubview(priorityLabel) + // ❌ БЫЛО: infoStack.addArrangedSubview(flagLabel) + infoStack.addArrangedSubview(deadlineLabel) + + // НАСТРОЙКА flagLabel, который будет справа + flagLabel.font = .systemFont(ofSize: 14) + flagLabel.textAlignment = .right + flagLabel.setContentHuggingPriority(.required, for: .horizontal) + flagLabel.setContentCompressionResistancePriority(.required, for: .horizontal) + + // ГОРИЗОНТАЛЬНЫЙ стек: чекбокс слева, инфо по центру, флаг справа + let mainStack = UIStackView(arrangedSubviews: [checkButton, infoStack, flagLabel]) + mainStack.axis = .horizontal + mainStack.spacing = 12 + mainStack.alignment = .top + mainStack.distribution = .fill + + contentView.addSubview(mainStack) + mainStack.translatesAutoresizingMaskIntoConstraints = false + NSLayoutConstraint.activate([ + mainStack.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16), + mainStack.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -16), + mainStack.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 12), + mainStack.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -12) + ]) + + titleLabel.font = .boldSystemFont(ofSize: 16) + descriptionLabel.font = .systemFont(ofSize: 14) + descriptionLabel.textColor = .secondaryLabel + priorityLabel.font = .systemFont(ofSize: 14) + deadlineLabel.font = .systemFont(ofSize: 14) + deadlineLabel.textColor = .systemRed + } + + @objc private func toggleComplete() { + onComplete?() + } + + func configure(with task: Task) { + titleLabel.text = task.title + descriptionLabel.text = task.description + priorityLabel.text = "Приоритет: P\(task.priority)" + + // флаг справа + if task.flagged { + flagLabel.text = "⚑" + flagLabel.isHidden = false + } else { + flagLabel.text = nil + flagLabel.isHidden = true + } + + if let deadline = task.deadline { + let formatter = DateFormatter() + formatter.dateStyle = .short + formatter.timeStyle = .short + deadlineLabel.text = "Дедлайн: \(formatter.string(from: deadline))" + } else { + deadlineLabel.text = "" + } + + let icon = task.isCompleted ? "checkmark.circle.fill" : "circle" + checkButton.setImage(UIImage(systemName: icon), for: .normal) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/GiletaProject/GiletaProject/TasksViewController.swift b/GiletaProject/GiletaProject/TasksViewController.swift new file mode 100644 index 0000000..fc053c5 --- /dev/null +++ b/GiletaProject/GiletaProject/TasksViewController.swift @@ -0,0 +1,114 @@ +import UIKit + +class TasksViewController: UIViewController { + + private var tasks: [Task] = [] + private var sections: [Int] = [] + + private let tableView = UITableView() + private let emptyLabel: UILabel = { + let label = UILabel() + label.text = "Задач нет" + label.textAlignment = .center + label.font = .systemFont(ofSize: 20) + return label + }() + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .systemBackground + title = "Задачи" + + navigationItem.rightBarButtonItem = UIBarButtonItem( + barButtonSystemItem: .add, + target: self, + action: #selector(addTapped) + ) + + setupTable() + sortTasks() + rebuildSections() + updateView() + } + + private func setupTable() { + tableView.frame = view.bounds + tableView.autoresizingMask = [.flexibleWidth, .flexibleHeight] + tableView.dataSource = self + tableView.delegate = self + tableView.register(TaskCell.self, forCellReuseIdentifier: "TaskCell") + tableView.rowHeight = UITableView.automaticDimension + tableView.estimatedRowHeight = 100 + view.addSubview(tableView) + } + + private func updateView() { + if tasks.isEmpty { + tableView.isHidden = true + emptyLabel.frame = view.bounds + view.addSubview(emptyLabel) + } else { + tableView.isHidden = false + emptyLabel.removeFromSuperview() + } + } + + private func sortTasks() { + tasks.sort { $0.priority > $1.priority } + } + + private func rebuildSections() { + let uniquePriorities = Set(tasks.map { $0.priority }) + sections = uniquePriorities.sorted(by: >) + } + + private func taskInfo(for indexPath: IndexPath) -> (task: Task, globalIndex: Int) { + let priority = sections[indexPath.section] + let filtered = tasks.enumerated().filter { $0.element.priority == priority } + let pair = filtered[indexPath.row] + return (pair.element, pair.offset) + } + + @objc private func addTapped() { + let vc = CreateTaskViewController() + vc.onSave = { [weak self] task in + guard let self = self else { return } + self.tasks.append(task) + self.sortTasks() + self.rebuildSections() + self.tableView.reloadData() + self.updateView() + } + navigationController?.pushViewController(vc, animated: true) + } +} + +extension TasksViewController: UITableViewDataSource, UITableViewDelegate { + func numberOfSections(in tableView: UITableView) -> Int { + sections.count + } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + let priority = sections[section] + return tasks.filter { $0.priority == priority }.count + } + + func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + let priority = sections[section] + return "Приоритет P\(priority)" + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "TaskCell", for: indexPath) as! TaskCell + let info = taskInfo(for: indexPath) + cell.configure(with: info.task) + + cell.onComplete = { [weak self, weak tableView] in + guard let self = self, let tableView = tableView else { return } + self.tasks[info.globalIndex].isCompleted.toggle() + tableView.reloadRows(at: [indexPath], with: .automatic) + } + + return cell + } +} diff --git a/GiletaProjectNotIOS/TaskAppNotIOS.zip b/GiletaProjectNotIOS/TaskAppNotIOS.zip new file mode 100644 index 0000000..628ee58 Binary files /dev/null and b/GiletaProjectNotIOS/TaskAppNotIOS.zip differ diff --git a/GiletaProjectNotIOS/app/build.gradle.kts b/GiletaProjectNotIOS/app/build.gradle.kts new file mode 100644 index 0000000..88fc6d4 --- /dev/null +++ b/GiletaProjectNotIOS/app/build.gradle.kts @@ -0,0 +1,62 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.compose) +} + +android { + namespace = "com.example.taskapp" + compileSdk { + version = release(36) + } + + defaultConfig { + applicationId = "com.example.taskapp" + minSdk = 24 + targetSdk = 36 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + kotlinOptions { + jvmTarget = "11" + } + buildFeatures { + compose = true + } +} + +dependencies { + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.lifecycle.runtime.ktx) + implementation(libs.androidx.activity.compose) + implementation(platform(libs.androidx.compose.bom)) + implementation("androidx.compose.material:material-icons-extended:1.7.5") + implementation(libs.androidx.compose.ui) + implementation(libs.androidx.compose.ui.graphics) + implementation(libs.androidx.compose.ui.tooling.preview) + implementation(libs.androidx.compose.material3) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.junit) + androidTestImplementation(libs.androidx.espresso.core) + androidTestImplementation(platform(libs.androidx.compose.bom)) + androidTestImplementation(libs.androidx.compose.ui.test.junit4) + debugImplementation(libs.androidx.compose.ui.tooling) + debugImplementation(libs.androidx.compose.ui.test.manifest) + implementation("androidx.navigation:navigation-compose:2.7.0") +} \ No newline at end of file diff --git a/GiletaProjectNotIOS/app/proguard-rules.pro b/GiletaProjectNotIOS/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/GiletaProjectNotIOS/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/GiletaProjectNotIOS/app/src/androidTest/java/com/example/taskapp/ExampleInstrumentedTest.kt b/GiletaProjectNotIOS/app/src/androidTest/java/com/example/taskapp/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..1365fe7 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/androidTest/java/com/example/taskapp/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.example.taskapp + +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.example.taskapp", appContext.packageName) + } +} \ No newline at end of file diff --git a/GiletaProjectNotIOS/app/src/main/AndroidManifest.xml b/GiletaProjectNotIOS/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..8651d91 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/MainActivity.kt b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/MainActivity.kt new file mode 100644 index 0000000..76a91e8 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/MainActivity.kt @@ -0,0 +1,21 @@ +package com.example.taskapp + +import android.os.Bundle +import androidx.activity.ComponentActivity +import androidx.activity.compose.setContent +import com.example.taskapp.ui.navigation.AppNav +import com.example.taskapp.ui.theme.TaskAppTheme +import com.example.taskapp.viewmodel.TasksViewModel + +class MainActivity : ComponentActivity() { + private val tasksViewModel = TasksViewModel() + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContent { + TaskAppTheme { + AppNav(tasksViewModel) + } + } + } +} diff --git a/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/model/Task.kt b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/model/Task.kt new file mode 100644 index 0000000..4ba129c --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/model/Task.kt @@ -0,0 +1,13 @@ +package com.example.taskapp.model + +import java.util.* + +data class Task( + val id: UUID = UUID.randomUUID(), + val title: String, + val description: String? = null, + val priority: Int = 1, + val flag: Boolean = false, + val dueDate: Date? = null, + var isCompleted: Boolean = false +) diff --git a/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/components/TaskCard.kt b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/components/TaskCard.kt new file mode 100644 index 0000000..46fbc7a --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/components/TaskCard.kt @@ -0,0 +1,55 @@ +package com.example.taskapp.components + +import androidx.compose.foundation.layout.* +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Flag +import androidx.compose.material3.Card +import androidx.compose.material3.Checkbox +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import com.example.taskapp.model.Task + +@Composable +fun TaskCard(task: Task, onCheckedChange: () -> Unit) { + Card( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 4.dp) + ) { + Row( + modifier = Modifier + .fillMaxWidth() + .padding(16.dp), + verticalAlignment = Alignment.CenterVertically + ) { + Checkbox( + checked = task.isCompleted, + onCheckedChange = { onCheckedChange() } + ) + + Spacer(modifier = Modifier.width(16.dp)) + + Column( + modifier = Modifier.weight(1f) + ) { + Text(task.title, style = MaterialTheme.typography.titleMedium) + task.description?.let { Text(it) } + Text("Приоритет: ${task.priority}") + task.dueDate?.let { Text("Срок: $it") } + } + + if (task.flag) { + Spacer(modifier = Modifier.width(8.dp)) + Icon( + imageVector = Icons.Filled.Flag, + contentDescription = "Флаг" + ) + } + } + } +} diff --git a/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/navigation/NavGraph.kt b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/navigation/NavGraph.kt new file mode 100644 index 0000000..f1ceedc --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/navigation/NavGraph.kt @@ -0,0 +1,23 @@ +package com.example.taskapp.ui.navigation + +import androidx.compose.runtime.Composable +import androidx.navigation.compose.NavHost +import androidx.navigation.compose.composable +import androidx.navigation.compose.rememberNavController +import com.example.taskapp.ui.screens.AddTaskScreen +import com.example.taskapp.ui.screens.MainScreen +import com.example.taskapp.viewmodel.TasksViewModel + +sealed class Screen(val route: String) { + object Main : Screen("main") + object AddTask : Screen("add_task") +} + +@Composable +fun AppNav(viewModel: TasksViewModel) { + val navController = rememberNavController() + NavHost(navController, startDestination = Screen.Main.route) { + composable(Screen.Main.route) { MainScreen(navController, viewModel) } + composable(Screen.AddTask.route) { AddTaskScreen(navController, viewModel) } + } +} diff --git a/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/screens/AddTaskScreen.kt b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/screens/AddTaskScreen.kt new file mode 100644 index 0000000..4271701 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/screens/AddTaskScreen.kt @@ -0,0 +1,147 @@ +package com.example.taskapp.ui.screens + +import androidx.compose.ui.Alignment +import androidx.compose.foundation.layout.* +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material3.* +import androidx.compose.runtime.* +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import androidx.navigation.NavHostController +import com.example.taskapp.model.Task +import com.example.taskapp.viewmodel.TasksViewModel +import java.util.* +import android.app.DatePickerDialog +import android.app.TimePickerDialog +import androidx.compose.material3.Switch +import androidx.compose.ui.draw.alpha +import androidx.compose.ui.platform.LocalContext +import java.text.SimpleDateFormat + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun AddTaskScreen(navController: NavHostController, viewModel: TasksViewModel) { + var title by remember { mutableStateOf("") } + var description by remember { mutableStateOf("") } + var priority by remember { mutableStateOf(1) } + var flag by remember { mutableStateOf(false) } + var dueDate by remember { mutableStateOf(null) } + var enableDate by remember { mutableStateOf(false) } + + val context = LocalContext.current + val calendar = Calendar.getInstance() + val dateFormat = SimpleDateFormat("dd.MM.yyyy HH:mm", Locale.getDefault()) + + Scaffold( + topBar = { + TopAppBar( + title = { Text("Создать задачу") }, + navigationIcon = { + IconButton(onClick = { navController.popBackStack() }) { + Icon(Icons.Default.ArrowBack, contentDescription = "Назад") + } + } + ) + }, + content = { padding -> + Column( + modifier = Modifier + .padding(padding) + .padding(16.dp) + ) { + OutlinedTextField( + value = title, + onValueChange = { title = it }, + label = { Text("Название задачи") }, + modifier = Modifier.fillMaxWidth() + ) + Spacer(modifier = Modifier.height(8.dp)) + OutlinedTextField( + value = description, + onValueChange = { description = it }, + label = { Text("Описание задачи (опционально)") }, + modifier = Modifier.fillMaxWidth() + ) + Spacer(modifier = Modifier.height(8.dp)) + Text("Приоритет") + Row { + (1..3).forEach { p -> + val isSelected = priority == p + + Button( + onClick = { priority = p }, + modifier = Modifier.alpha(if (isSelected) 1f else 0.5f), + colors = ButtonDefaults.buttonColors( + containerColor = MaterialTheme.colorScheme.primary, + contentColor = MaterialTheme.colorScheme.onPrimary + ) + ) { + Text("$p") + } + + Spacer(modifier = Modifier.width(8.dp)) + } + } + + Spacer(modifier = Modifier.height(8.dp)) + Row(verticalAlignment = Alignment.CenterVertically) { + Checkbox(checked = flag, onCheckedChange = { flag = it }) + Text("Флаг") + } + Spacer(modifier = Modifier.height(8.dp)) + Row(verticalAlignment = Alignment.CenterVertically) { + Text("Срок выполнения") + Spacer(modifier = Modifier.width(8.dp)) + Switch(checked = enableDate, onCheckedChange = { enableDate = it }) + } + if (enableDate) { + Button(onClick = { + DatePickerDialog( + context, + { _, year, month, dayOfMonth -> + calendar.set(year, month, dayOfMonth) + TimePickerDialog( + context, + { _, hour, minute -> + calendar.set(Calendar.HOUR_OF_DAY, hour) + calendar.set(Calendar.MINUTE, minute) + dueDate = calendar.time + }, + calendar.get(Calendar.HOUR_OF_DAY), + calendar.get(Calendar.MINUTE), + true + ).show() + }, + calendar.get(Calendar.YEAR), + calendar.get(Calendar.MONTH), + calendar.get(Calendar.DAY_OF_MONTH) + ).show() + }) { + Text(dueDate?.let { dateFormat.format(it) } ?: "Выбрать дату") + } + } + Spacer(modifier = Modifier.height(16.dp)) + Button( + onClick = { + if (title.isNotBlank()) { + viewModel.addTask( + Task( + title = title, + description = description.ifBlank { null }, + priority = priority, + flag = flag, + dueDate = if (enableDate) dueDate else null + ) + ) + navController.popBackStack() + } + }, + modifier = Modifier.fillMaxWidth() + ) { + Text("Сохранить") + } + } + } + ) +} diff --git a/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/screens/MainScreen.kt b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/screens/MainScreen.kt new file mode 100644 index 0000000..f343cd5 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/screens/MainScreen.kt @@ -0,0 +1,105 @@ +package com.example.taskapp.ui.screens + +import androidx.compose.foundation.layout.* +import androidx.compose.material3.* +import androidx.compose.runtime.* +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import androidx.navigation.NavHostController +import com.example.taskapp.viewmodel.TasksViewModel +import com.example.taskapp.ui.screens.TasksTab + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun MainScreen(navController: NavHostController, viewModel: TasksViewModel) { + var selectedTab by remember { mutableStateOf(0) } + val tabs = listOf("Главная", "Задачи", "Записи") + + Scaffold { padding -> + Box( + modifier = Modifier + .fillMaxSize() + .padding(padding) + ) { + when (selectedTab) { + 0 -> { + Column( + modifier = Modifier + .fillMaxSize() + .padding(16.dp) + ) { + Text( + text = "Главная", + style = MaterialTheme.typography.titleLarge + ) + } + } + + 1 -> { + Column( + modifier = Modifier.fillMaxSize() + ) { + Text( + text = "Задачи", + style = MaterialTheme.typography.titleLarge, + modifier = Modifier.padding(16.dp) + ) + TasksTab( + viewModel = viewModel, + modifier = Modifier + .fillMaxSize() + .padding(horizontal = 16.dp) + ) + } + } + + 2 -> { + Column( + modifier = Modifier + .fillMaxSize() + .padding(16.dp) + ) { + Text( + text = "Записи", + style = MaterialTheme.typography.titleLarge + ) + } + } + } + + if (selectedTab == 1) { + FloatingActionButton( + onClick = { navController.navigate("add_task") }, + modifier = Modifier + .align(Alignment.TopEnd) + .padding(16.dp) + ) { + Text("+") + } + } + + TabRow( + selectedTabIndex = selectedTab, + modifier = Modifier + .align(Alignment.BottomCenter) + .fillMaxWidth() + .height(60.dp) + ) { + tabs.forEachIndexed { index, title -> + Tab( + selected = selectedTab == index, + onClick = { selectedTab = index }, + modifier = Modifier.height(60.dp), + text = { + Text( + text = title, + style = MaterialTheme.typography.titleLarge + ) + } + ) + } + } + } + } +} diff --git a/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/screens/TasksTab.kt b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/screens/TasksTab.kt new file mode 100644 index 0000000..b744379 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/screens/TasksTab.kt @@ -0,0 +1,56 @@ +package com.example.taskapp.ui.screens + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.items +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import androidx.compose.foundation.layout.padding +import com.example.taskapp.viewmodel.TasksViewModel +import com.example.taskapp.components.TaskCard + +@Composable +fun TasksTab(viewModel: TasksViewModel, modifier: Modifier = Modifier) { + val tasks = viewModel.tasks + + if (tasks.isEmpty()) { + Box( + modifier = modifier.fillMaxSize(), + contentAlignment = Alignment.Center + ) { + Text("Задач нет") + } + } else { + val grouped = tasks + .sortedWith(compareByDescending { it.priority }.thenBy { it.title }) + .groupBy { it.priority } + + val priorities = grouped.keys.sortedDescending() + + LazyColumn( + modifier = modifier.fillMaxSize() + ) { + priorities.forEach { priority -> + val groupTasks = grouped[priority].orEmpty() + if (groupTasks.isNotEmpty()) { + item { + Text( + text = "Приоритет $priority", + style = MaterialTheme.typography.titleMedium, + modifier = Modifier + .padding(top = 12.dp, bottom = 4.dp) + ) + } + items(groupTasks) { task -> + TaskCard(task) { viewModel.toggleTaskCompletion(task) } + } + } + } + } + } +} diff --git a/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/theme/Color.kt b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/theme/Color.kt new file mode 100644 index 0000000..37c754f --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/theme/Color.kt @@ -0,0 +1,11 @@ +package com.example.taskapp.ui.theme + +import androidx.compose.ui.graphics.Color + +val Purple80 = Color(0xFFD0BCFF) +val PurpleGrey80 = Color(0xFFCCC2DC) +val Pink80 = Color(0xFFEFB8C8) + +val Purple40 = Color(0xFF6650a4) +val PurpleGrey40 = Color(0xFF625b71) +val Pink40 = Color(0xFF7D5260) \ No newline at end of file diff --git a/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/theme/Theme.kt b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/theme/Theme.kt new file mode 100644 index 0000000..05a3d27 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/theme/Theme.kt @@ -0,0 +1,58 @@ +package com.example.taskapp.ui.theme + +import android.app.Activity +import android.os.Build +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalContext + +private val DarkColorScheme = darkColorScheme( + primary = Purple80, + secondary = PurpleGrey80, + tertiary = Pink80 +) + +private val LightColorScheme = lightColorScheme( + primary = Purple40, + secondary = PurpleGrey40, + tertiary = Pink40 + + /* Other default colors to override + background = Color(0xFFFFFBFE), + surface = Color(0xFFFFFBFE), + onPrimary = Color.White, + onSecondary = Color.White, + onTertiary = Color.White, + onBackground = Color(0xFF1C1B1F), + onSurface = Color(0xFF1C1B1F), + */ +) + +@Composable +fun TaskAppTheme( + darkTheme: Boolean = isSystemInDarkTheme(), + // Dynamic color is available on Android 12+ + dynamicColor: Boolean = true, + content: @Composable () -> Unit +) { + val colorScheme = when { + dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) + } + + darkTheme -> DarkColorScheme + else -> LightColorScheme + } + + MaterialTheme( + colorScheme = colorScheme, + typography = Typography, + content = content + ) +} \ No newline at end of file diff --git a/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/theme/Type.kt b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/theme/Type.kt new file mode 100644 index 0000000..0d0b384 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/ui/theme/Type.kt @@ -0,0 +1,34 @@ +package com.example.taskapp.ui.theme + +import androidx.compose.material3.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + bodyLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp, + lineHeight = 24.sp, + letterSpacing = 0.5.sp + ) + /* Other default text styles to override + titleLarge = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 22.sp, + lineHeight = 28.sp, + letterSpacing = 0.sp + ), + labelSmall = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Medium, + fontSize = 11.sp, + lineHeight = 16.sp, + letterSpacing = 0.5.sp + ) + */ +) \ No newline at end of file diff --git a/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/viewmodel/TasksViewModel.kt b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/viewmodel/TasksViewModel.kt new file mode 100644 index 0000000..9a95f12 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/java/com/example/taskapp/viewmodel/TasksViewModel.kt @@ -0,0 +1,20 @@ +package com.example.taskapp.viewmodel + +import androidx.compose.runtime.mutableStateListOf +import androidx.lifecycle.ViewModel +import com.example.taskapp.model.Task + +class TasksViewModel : ViewModel() { + val tasks = mutableStateListOf() + + fun addTask(task: Task) { + tasks.add(task) + } + + fun toggleTaskCompletion(task: Task) { + val index = tasks.indexOf(task) + if (index != -1) { + tasks[index] = tasks[index].copy(isCompleted = !task.isCompleted) + } + } +} diff --git a/GiletaProjectNotIOS/app/src/main/res/drawable/ic_launcher_background.xml b/GiletaProjectNotIOS/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GiletaProjectNotIOS/app/src/main/res/drawable/ic_launcher_foreground.xml b/GiletaProjectNotIOS/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/GiletaProjectNotIOS/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/GiletaProjectNotIOS/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/GiletaProjectNotIOS/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/GiletaProjectNotIOS/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..6f3b755 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/GiletaProjectNotIOS/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/GiletaProjectNotIOS/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 0000000..c209e78 Binary files /dev/null and b/GiletaProjectNotIOS/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/GiletaProjectNotIOS/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/GiletaProjectNotIOS/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 0000000..b2dfe3d Binary files /dev/null and b/GiletaProjectNotIOS/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/GiletaProjectNotIOS/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/GiletaProjectNotIOS/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 0000000..4f0f1d6 Binary files /dev/null and b/GiletaProjectNotIOS/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/GiletaProjectNotIOS/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/GiletaProjectNotIOS/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 0000000..62b611d Binary files /dev/null and b/GiletaProjectNotIOS/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/GiletaProjectNotIOS/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/GiletaProjectNotIOS/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 0000000..948a307 Binary files /dev/null and b/GiletaProjectNotIOS/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/GiletaProjectNotIOS/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/GiletaProjectNotIOS/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..1b9a695 Binary files /dev/null and b/GiletaProjectNotIOS/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/GiletaProjectNotIOS/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/GiletaProjectNotIOS/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 0000000..28d4b77 Binary files /dev/null and b/GiletaProjectNotIOS/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/GiletaProjectNotIOS/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/GiletaProjectNotIOS/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9287f50 Binary files /dev/null and b/GiletaProjectNotIOS/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/GiletaProjectNotIOS/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/GiletaProjectNotIOS/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 0000000..aa7d642 Binary files /dev/null and b/GiletaProjectNotIOS/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/GiletaProjectNotIOS/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/GiletaProjectNotIOS/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 0000000..9126ae3 Binary files /dev/null and b/GiletaProjectNotIOS/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/GiletaProjectNotIOS/app/src/main/res/values/colors.xml b/GiletaProjectNotIOS/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..f8c6127 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/res/values/colors.xml @@ -0,0 +1,10 @@ + + + #FFBB86FC + #FF6200EE + #FF3700B3 + #FF03DAC5 + #FF018786 + #FF000000 + #FFFFFFFF + \ No newline at end of file diff --git a/GiletaProjectNotIOS/app/src/main/res/values/strings.xml b/GiletaProjectNotIOS/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..512f81f --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + TaskApp + \ No newline at end of file diff --git a/GiletaProjectNotIOS/app/src/main/res/values/themes.xml b/GiletaProjectNotIOS/app/src/main/res/values/themes.xml new file mode 100644 index 0000000..5ca83a0 --- /dev/null +++ b/GiletaProjectNotIOS/app/src/main/res/values/themes.xml @@ -0,0 +1,5 @@ + + + +