From ebe766796c9a0994ab7d822917070f41bef07a17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=BE=D0=B7=D1=8B=D1=80=D0=B5=D0=B2=20=D0=90=D0=BB?= =?UTF-8?q?=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Fri, 12 Jan 2024 12:01:25 +0300 Subject: [PATCH 1/9] create domain layer --- app/src/main/AndroidManifest.xml | 2 +- .../basicarchitecture/data/WizardCache.kt | 8 ++ .../basicarchitecture/domain/Model/Address.kt | 7 ++ .../domain/Model/Interests.kt | 5 ++ .../basicarchitecture/domain/Model/Person.kt | 7 ++ .../basicarchitecture/domain/Repository.kt | 4 + .../domain/getData/GetAddressPerson.kt | 4 + .../domain/getData/GetAllInterestsUseCase.kt | 4 + .../domain/getData/GetInfoPersonUseCase.kt | 4 + .../getData/GetInterestsPersonUseCase.kt | 4 + .../domain/getData/GetPersonsUseCase.kt | 4 + .../domain/setData/SetAddressUseCase.kt | 9 ++ .../setData/SetInterestsPersonUseCase.kt | 10 +++ .../domain/setData/SetPersonUseCase.kt | 11 +++ .../{ => presentation}/MainActivity.kt | 3 +- app/src/main/res/drawable/calendar.xml | 5 ++ app/src/main/res/layout/activity_main.xml | 5 +- .../res/layout/first_and_second_screen.xml | 83 +++++++++++++++++++ app/src/main/res/values/colors.xml | 2 + app/src/main/res/values/strings.xml | 4 + 20 files changed, 181 insertions(+), 4 deletions(-) create mode 100644 app/src/main/java/ru/otus/basicarchitecture/data/WizardCache.kt create mode 100644 app/src/main/java/ru/otus/basicarchitecture/domain/Model/Address.kt create mode 100644 app/src/main/java/ru/otus/basicarchitecture/domain/Model/Interests.kt create mode 100644 app/src/main/java/ru/otus/basicarchitecture/domain/Model/Person.kt create mode 100644 app/src/main/java/ru/otus/basicarchitecture/domain/Repository.kt create mode 100644 app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetAddressPerson.kt create mode 100644 app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetAllInterestsUseCase.kt create mode 100644 app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetInfoPersonUseCase.kt create mode 100644 app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetInterestsPersonUseCase.kt create mode 100644 app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetPersonsUseCase.kt create mode 100644 app/src/main/java/ru/otus/basicarchitecture/domain/setData/SetAddressUseCase.kt create mode 100644 app/src/main/java/ru/otus/basicarchitecture/domain/setData/SetInterestsPersonUseCase.kt create mode 100644 app/src/main/java/ru/otus/basicarchitecture/domain/setData/SetPersonUseCase.kt rename app/src/main/java/ru/otus/basicarchitecture/{ => presentation}/MainActivity.kt (76%) create mode 100644 app/src/main/res/drawable/calendar.xml create mode 100644 app/src/main/res/layout/first_and_second_screen.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1e81fea..80369e1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,7 +13,7 @@ android:theme="@style/Theme.BasicArchitecture" tools:targetApi="31"> diff --git a/app/src/main/java/ru/otus/basicarchitecture/data/WizardCache.kt b/app/src/main/java/ru/otus/basicarchitecture/data/WizardCache.kt new file mode 100644 index 0000000..cf80929 --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/data/WizardCache.kt @@ -0,0 +1,8 @@ +package ru.otus.basicarchitecture.data + +class WizardCache { + + private val _listInterests: List = emptyList() + + +} \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/domain/Model/Address.kt b/app/src/main/java/ru/otus/basicarchitecture/domain/Model/Address.kt new file mode 100644 index 0000000..6e2ec6e --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/domain/Model/Address.kt @@ -0,0 +1,7 @@ +package ru.otus.basicarchitecture.domain.Model + +data class Address( + val country: String, + val city: String, + val address: String +) \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/domain/Model/Interests.kt b/app/src/main/java/ru/otus/basicarchitecture/domain/Model/Interests.kt new file mode 100644 index 0000000..c8f6b7b --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/domain/Model/Interests.kt @@ -0,0 +1,5 @@ +package ru.otus.basicarchitecture.domain.Model + +data class Interests ( + val interests: String +) \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/domain/Model/Person.kt b/app/src/main/java/ru/otus/basicarchitecture/domain/Model/Person.kt new file mode 100644 index 0000000..69e5f7f --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/domain/Model/Person.kt @@ -0,0 +1,7 @@ +package ru.otus.basicarchitecture.domain.Model + +data class Person( + val firstName: String, + val surName: String, + val dateOfBirth: String +) \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/domain/Repository.kt b/app/src/main/java/ru/otus/basicarchitecture/domain/Repository.kt new file mode 100644 index 0000000..455b0e3 --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/domain/Repository.kt @@ -0,0 +1,4 @@ +package ru.otus.basicarchitecture.domain + +interface Repository { +} \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetAddressPerson.kt b/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetAddressPerson.kt new file mode 100644 index 0000000..5f7b9ae --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetAddressPerson.kt @@ -0,0 +1,4 @@ +package ru.otus.basicarchitecture.domain.getData + +class GetAddressPerson { +} \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetAllInterestsUseCase.kt b/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetAllInterestsUseCase.kt new file mode 100644 index 0000000..b6b3dfd --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetAllInterestsUseCase.kt @@ -0,0 +1,4 @@ +package ru.otus.basicarchitecture.domain.getData + +class GetAllInterestsUseCase { +} \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetInfoPersonUseCase.kt b/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetInfoPersonUseCase.kt new file mode 100644 index 0000000..e957c98 --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetInfoPersonUseCase.kt @@ -0,0 +1,4 @@ +package ru.otus.basicarchitecture.domain.getData + +class GetInfoPersonUseCase { +} \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetInterestsPersonUseCase.kt b/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetInterestsPersonUseCase.kt new file mode 100644 index 0000000..c934031 --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetInterestsPersonUseCase.kt @@ -0,0 +1,4 @@ +package ru.otus.basicarchitecture.domain.getData + +class GetInterestsPersonUseCase { +} \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetPersonsUseCase.kt b/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetPersonsUseCase.kt new file mode 100644 index 0000000..55f99d6 --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/domain/getData/GetPersonsUseCase.kt @@ -0,0 +1,4 @@ +package ru.otus.basicarchitecture.domain.getData + +class GetPersonsUseCase { +} \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/domain/setData/SetAddressUseCase.kt b/app/src/main/java/ru/otus/basicarchitecture/domain/setData/SetAddressUseCase.kt new file mode 100644 index 0000000..1dc4a96 --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/domain/setData/SetAddressUseCase.kt @@ -0,0 +1,9 @@ +package ru.otus.basicarchitecture.domain.setData + +import ru.otus.basicarchitecture.domain.Model.Address + +class SetAddressUseCase { + fun setAddress(address: Address, idPerson: Int){ + TODO() + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/domain/setData/SetInterestsPersonUseCase.kt b/app/src/main/java/ru/otus/basicarchitecture/domain/setData/SetInterestsPersonUseCase.kt new file mode 100644 index 0000000..6d4d7e2 --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/domain/setData/SetInterestsPersonUseCase.kt @@ -0,0 +1,10 @@ +package ru.otus.basicarchitecture.domain.setData + +import ru.otus.basicarchitecture.domain.Model.Interests +import ru.otus.basicarchitecture.domain.Model.Person + +class SetInterestsPersonUseCase { + fun setInterests(interests: Interests, idPerson: Person){ + TODO() + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/domain/setData/SetPersonUseCase.kt b/app/src/main/java/ru/otus/basicarchitecture/domain/setData/SetPersonUseCase.kt new file mode 100644 index 0000000..c0a241d --- /dev/null +++ b/app/src/main/java/ru/otus/basicarchitecture/domain/setData/SetPersonUseCase.kt @@ -0,0 +1,11 @@ +package ru.otus.basicarchitecture.domain.setData + +import ru.otus.basicarchitecture.domain.Model.Person + +class SetPersonUseCase { + fun setPerson(person: Person) : Int { + TODO() + val personId = 0 + return personId + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/otus/basicarchitecture/MainActivity.kt b/app/src/main/java/ru/otus/basicarchitecture/presentation/MainActivity.kt similarity index 76% rename from app/src/main/java/ru/otus/basicarchitecture/MainActivity.kt rename to app/src/main/java/ru/otus/basicarchitecture/presentation/MainActivity.kt index 623aba9..c03e893 100644 --- a/app/src/main/java/ru/otus/basicarchitecture/MainActivity.kt +++ b/app/src/main/java/ru/otus/basicarchitecture/presentation/MainActivity.kt @@ -1,7 +1,8 @@ -package ru.otus.basicarchitecture +package ru.otus.basicarchitecture.presentation import androidx.appcompat.app.AppCompatActivity import android.os.Bundle +import ru.otus.basicarchitecture.R class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { diff --git a/app/src/main/res/drawable/calendar.xml b/app/src/main/res/drawable/calendar.xml new file mode 100644 index 0000000..9580bfa --- /dev/null +++ b/app/src/main/res/drawable/calendar.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 0b15a20..5d2615d 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,9 +1,10 @@ - + tools:context=".presentation.MainActivity"> \ No newline at end of file diff --git a/app/src/main/res/layout/first_and_second_screen.xml b/app/src/main/res/layout/first_and_second_screen.xml new file mode 100644 index 0000000..8980180 --- /dev/null +++ b/app/src/main/res/layout/first_and_second_screen.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + +