From 9b567ff5f83bfa60edc5771e96913eca6bdf3f66 Mon Sep 17 00:00:00 2001 From: Azat Sagutdinov Date: Tue, 9 Apr 2024 16:57:26 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=BE?= =?UTF-8?q?=D0=BD=D0=B0=D0=BB=20=D0=BC=D0=B5=D1=85=D0=B0=D0=BD=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=87.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 + app/src/dev/res/values/strings.xml | 11 + .../ru/tele2med/mobile/data/api/ApiService.kt | 29 + .../response/TechCheckupsListResponse.kt | 1 + .../data/api/entity/response/TechResponse.kt | 1 + .../mobile/data/repository/DataConverter.kt | 18 + .../data/repository/SosRepositoryImpl.kt | 28 + .../data/repository/TechRepositoryImpl.kt | 72 ++ .../mobile/di/module/interactorModule.kt | 4 +- .../mobile/di/module/presenterModule.kt | 35 + .../mobile/di/module/repositoryModule.kt | 20 +- .../tele2med/mobile/domain/entity/DataTech.kt | 27 + .../ru/tele2med/mobile/domain/entity/Tech.kt | 8 + .../domain/interactor/TechInteractor.kt | 5 +- .../domain/repository/TechRepository.kt | 4 +- .../mobile/presentation/router/NavRouter.kt | 6 + .../mobile/presentation/router/NavScreens.kt | 4 + .../ui/auth0/SplashAuth0Activity.kt | 2 +- .../presentation/ui/base/BasePresenter.kt | 6 +- .../menu/items/checkups/CheckupsFragment.kt | 2 - .../menu/items/checkups/CheckupsPresenter.kt | 1 - .../ui/menu/items/tech/TechAdapter.kt | 118 +-- .../ui/menu/items/tech/TechFragment.kt | 130 +-- .../ui/menu/items/tech/TechPresenter.kt | 74 +- .../ui/menu/items/tech/TechScreen.kt | 4 +- .../ui/menu/items/tech/TechView.kt | 7 + .../menu/items/tech/list/TechListAdapter.kt | 92 ++ .../menu/items/tech/list/TechListFragment.kt | 156 ++++ .../menu/items/tech/list/TechListPresenter.kt | 80 ++ .../{CheckupsView.kt => list/TechListView.kt} | 4 +- .../list/techCheckup/TechCheckupAdapter.kt | 52 ++ .../list/techCheckup/TechCheckupFragment.kt | 87 ++ .../list/techCheckup/TechCheckupPresenter.kt | 7 + .../list/techCheckup/TechCheckupScreen.kt | 16 + .../tech/list/techCheckup/TechCheckupView.kt | 7 + .../info/TechCheckupInfoFragment.kt | 255 ++++++ .../info/TechCheckupInfoPresenter.kt | 61 ++ .../techCheckup/info/TechCheckupInfoView.kt | 15 + .../tests/TechCheckupTestsFragment.kt | 269 ++++++ .../tests/TechCheckupTestsPresenter.kt | 61 ++ .../techCheckup/tests/TechCheckupTestsView.kt | 15 + .../ui/menu/items/tech/park/ParkFragment.kt | 49 ++ .../ui/menu/items/tech/park/ParkPresenter.kt | 27 + .../ui/menu/items/tech/park/ParkScreen.kt | 15 + .../ui/menu/items/tech/park/ParkView.kt | 9 + app/src/main/res/layout/fragment_park.xml | 14 + app/src/main/res/layout/fragment_tech.xml | 617 ++++++++++++++ .../main/res/layout/fragment_tech_checkup.xml | 786 ++++++++++++++++++ .../main/res/layout/fragment_tech_list.xml | 55 +- app/src/main/res/layout/fragment_techs.xml | 27 + app/src/main/res/layout/item_tech.xml | 96 +++ app/src/main/res/values/strings.xml | 2 + build.gradle | 105 +++ conf.ini | 6 + gradle.properties | 23 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 172 ++++ gradlew.bat | 84 ++ keystore.jks | Bin 0 -> 2250 bytes keystore_tele2med.jks | Bin 0 -> 2733 bytes lib/AndroidManifest.xml | 8 + lib/build.gradle | 19 + lib/build.xml | 92 ++ .../com/mapwithme/maps/api/BuildConfig.java | 10 + .../debug/aapt/AndroidManifest.xml | 13 + .../debug/aapt/output-metadata.json | 16 + .../aar_main_jar/debug/classes.jar | Bin 0 -> 12146 bytes .../debug/aar-metadata.properties | 2 + .../debug/annotationProcessors.json | 1 + .../debug/typedefs.txt | 0 .../compile_r_class_jar/debug/R.jar | Bin 0 -> 3091 bytes .../compile_symbol_list/debug/R.txt | 18 + .../debug-mergeJavaRes/merge-state | Bin 0 -> 462 bytes .../mergeDebugJniLibFolders/merger.xml | 2 + .../incremental/mergeDebugShaders/merger.xml | 2 + .../incremental/packageDebugAssets/merger.xml | 2 + .../compile-file-map.properties | 14 + .../merged.dir/values/values.xml | 13 + .../packageDebugResources/merger.xml | 8 + .../com/mapwithme/maps/api/BuildConfig.class | Bin 0 -> 618 bytes .../ru/mapswithme/maps/api/Const.class | Bin 0 -> 1705 bytes .../maps/api/DownloadMapsWithMeDialog.class | Bin 0 -> 1908 bytes .../mapswithme/maps/api/MWMPoint$Style.class | Bin 0 -> 2043 bytes .../ru/mapswithme/maps/api/MWMPoint.class | Bin 0 -> 3227 bytes .../ru/mapswithme/maps/api/MWMResponse.class | Bin 0 -> 2172 bytes .../mapswithme/maps/api/MapsWithMeApi.class | Bin 0 -> 4734 bytes .../ru/mapswithme/maps/api/MwmRequest.class | Bin 0 -> 6931 bytes .../debug/AndroidManifest.xml | 13 + .../local_only_symbol_list/debug/R-def.txt | 20 + .../manifest-merger-blame-debug-report.txt | 16 + .../merged_java_res/debug/out.jar | Bin 0 -> 22 bytes .../debug/output-metadata.json | 16 + .../debug/drawable/background_pattern.xml | 5 + .../debug/drawable/btn_back_gray.xml | 13 + .../debug/drawable/btn_back_gray_active.xml | 16 + .../debug/drawable/btn_back_green.xml | 14 + .../debug/drawable/btn_back_green_active.xml | 16 + .../debug/drawable/btn_gray_selector.xml | 7 + .../debug/drawable/btn_green_selector.xml | 7 + .../packaged_res/debug/drawable/gray.xml | 13 + .../packaged_res/debug/drawable/green.xml | 15 + .../packaged_res/debug/drawable/overflow.xml | 6 + .../packaged_res/debug/drawable/pattern.png | Bin 0 -> 67027 bytes .../packaged_res/debug/drawable/shadow.xml | 13 + .../debug/layout/dlg_install_mwm.xml | 59 ++ .../packaged_res/debug/values/values.xml | 13 + .../debug/package-aware-r.txt | 19 + lib/build/outputs/aar/mapsme-debug.aar | Bin 0 -> 85371 bytes .../logs/manifest-merger-debug-report.txt | 39 + .../source-classes-mapping.txt | 15 + lib/project.properties | 15 + lib/res/drawable/background_pattern.xml | 5 + lib/res/drawable/btn_back_gray.xml | 13 + lib/res/drawable/btn_back_gray_active.xml | 16 + lib/res/drawable/btn_back_green.xml | 14 + lib/res/drawable/btn_back_green_active.xml | 16 + lib/res/drawable/btn_gray_selector.xml | 7 + lib/res/drawable/btn_green_selector.xml | 7 + lib/res/drawable/gray.xml | 13 + lib/res/drawable/green.xml | 15 + lib/res/drawable/overflow.xml | 6 + lib/res/drawable/pattern.png | Bin 0 -> 67027 bytes lib/res/drawable/shadow.xml | 13 + lib/res/layout/dlg_install_mwm.xml | 59 ++ lib/res/values/strings.xml | 6 + lib/res/values/styles.xml | 10 + lib/src/ru/mapswithme/maps/api/Const.java | 55 ++ .../maps/api/DownloadMapsWithMeDialog.java | 64 ++ lib/src/ru/mapswithme/maps/api/MWMPoint.java | 164 ++++ .../ru/mapswithme/maps/api/MWMResponse.java | 77 ++ .../ru/mapswithme/maps/api/MapsWithMeApi.java | 159 ++++ .../ru/mapswithme/maps/api/MwmRequest.java | 174 ++++ library/.gitignore | 1 + library/build.gradle | 37 + library/consumer-rules.pro | 0 library/proguard-rules.pro | 21 + library/src/main/AndroidManifest.xml | 18 + .../java/ru/homesoft/encoder/FrameBuilder.kt | 215 +++++ .../java/ru/homesoft/encoder/FrameMuxer.kt | 37 + .../java/ru/homesoft/encoder/Mp4FrameMuxer.kt | 84 ++ .../main/java/ru/homesoft/encoder/Muxer.kt | 111 +++ .../ru/homesoft/encoder/MuxerConfiguration.kt | 48 ++ library/src/main/res/values/strings.xml | 2 + library/src/main/res/xml/file_paths.xml | 6 + settings.gradle | 5 + upload.sh | 53 ++ upload.sh.bak | 44 + 148 files changed, 5700 insertions(+), 334 deletions(-) create mode 100644 app/src/main/java/ru/tele2med/mobile/data/api/entity/response/TechCheckupsListResponse.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/data/api/entity/response/TechResponse.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/data/repository/SosRepositoryImpl.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/data/repository/TechRepositoryImpl.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/domain/entity/DataTech.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/domain/entity/Tech.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechView.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListAdapter.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListFragment.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListPresenter.kt rename app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/{CheckupsView.kt => list/TechListView.kt} (68%) create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupAdapter.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupFragment.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupPresenter.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupScreen.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupView.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/info/TechCheckupInfoFragment.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/info/TechCheckupInfoPresenter.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/info/TechCheckupInfoView.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/tests/TechCheckupTestsFragment.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/tests/TechCheckupTestsPresenter.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/tests/TechCheckupTestsView.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkFragment.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkPresenter.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkScreen.kt create mode 100644 app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkView.kt create mode 100644 app/src/main/res/layout/fragment_park.xml create mode 100644 app/src/main/res/layout/fragment_tech.xml create mode 100644 app/src/main/res/layout/fragment_tech_checkup.xml create mode 100644 app/src/main/res/layout/fragment_techs.xml create mode 100644 app/src/main/res/layout/item_tech.xml create mode 100644 build.gradle create mode 100644 conf.ini create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 keystore.jks create mode 100644 keystore_tele2med.jks create mode 100644 lib/AndroidManifest.xml create mode 100644 lib/build.gradle create mode 100644 lib/build.xml create mode 100644 lib/build/generated/source/buildConfig/debug/com/mapwithme/maps/api/BuildConfig.java create mode 100644 lib/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml create mode 100644 lib/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json create mode 100644 lib/build/intermediates/aar_main_jar/debug/classes.jar create mode 100644 lib/build/intermediates/aar_metadata/debug/aar-metadata.properties create mode 100644 lib/build/intermediates/annotation_processor_list/debug/annotationProcessors.json create mode 100644 lib/build/intermediates/annotations_typedef_file/debug/typedefs.txt create mode 100644 lib/build/intermediates/compile_r_class_jar/debug/R.jar create mode 100644 lib/build/intermediates/compile_symbol_list/debug/R.txt create mode 100644 lib/build/intermediates/incremental/debug-mergeJavaRes/merge-state create mode 100644 lib/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml create mode 100644 lib/build/intermediates/incremental/mergeDebugShaders/merger.xml create mode 100644 lib/build/intermediates/incremental/packageDebugAssets/merger.xml create mode 100644 lib/build/intermediates/incremental/packageDebugResources/compile-file-map.properties create mode 100644 lib/build/intermediates/incremental/packageDebugResources/merged.dir/values/values.xml create mode 100644 lib/build/intermediates/incremental/packageDebugResources/merger.xml create mode 100644 lib/build/intermediates/javac/debug/classes/com/mapwithme/maps/api/BuildConfig.class create mode 100644 lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/Const.class create mode 100644 lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/DownloadMapsWithMeDialog.class create mode 100644 lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MWMPoint$Style.class create mode 100644 lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MWMPoint.class create mode 100644 lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MWMResponse.class create mode 100644 lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MapsWithMeApi.class create mode 100644 lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MwmRequest.class create mode 100644 lib/build/intermediates/library_manifest/debug/AndroidManifest.xml create mode 100644 lib/build/intermediates/local_only_symbol_list/debug/R-def.txt create mode 100644 lib/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt create mode 100644 lib/build/intermediates/merged_java_res/debug/out.jar create mode 100644 lib/build/intermediates/packaged_manifests/debug/output-metadata.json create mode 100644 lib/build/intermediates/packaged_res/debug/drawable/background_pattern.xml create mode 100644 lib/build/intermediates/packaged_res/debug/drawable/btn_back_gray.xml create mode 100644 lib/build/intermediates/packaged_res/debug/drawable/btn_back_gray_active.xml create mode 100644 lib/build/intermediates/packaged_res/debug/drawable/btn_back_green.xml create mode 100644 lib/build/intermediates/packaged_res/debug/drawable/btn_back_green_active.xml create mode 100644 lib/build/intermediates/packaged_res/debug/drawable/btn_gray_selector.xml create mode 100644 lib/build/intermediates/packaged_res/debug/drawable/btn_green_selector.xml create mode 100644 lib/build/intermediates/packaged_res/debug/drawable/gray.xml create mode 100644 lib/build/intermediates/packaged_res/debug/drawable/green.xml create mode 100644 lib/build/intermediates/packaged_res/debug/drawable/overflow.xml create mode 100644 lib/build/intermediates/packaged_res/debug/drawable/pattern.png create mode 100644 lib/build/intermediates/packaged_res/debug/drawable/shadow.xml create mode 100644 lib/build/intermediates/packaged_res/debug/layout/dlg_install_mwm.xml create mode 100644 lib/build/intermediates/packaged_res/debug/values/values.xml create mode 100644 lib/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt create mode 100644 lib/build/outputs/aar/mapsme-debug.aar create mode 100644 lib/build/outputs/logs/manifest-merger-debug-report.txt create mode 100644 lib/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt create mode 100644 lib/project.properties create mode 100644 lib/res/drawable/background_pattern.xml create mode 100644 lib/res/drawable/btn_back_gray.xml create mode 100644 lib/res/drawable/btn_back_gray_active.xml create mode 100644 lib/res/drawable/btn_back_green.xml create mode 100644 lib/res/drawable/btn_back_green_active.xml create mode 100644 lib/res/drawable/btn_gray_selector.xml create mode 100644 lib/res/drawable/btn_green_selector.xml create mode 100644 lib/res/drawable/gray.xml create mode 100644 lib/res/drawable/green.xml create mode 100644 lib/res/drawable/overflow.xml create mode 100644 lib/res/drawable/pattern.png create mode 100644 lib/res/drawable/shadow.xml create mode 100644 lib/res/layout/dlg_install_mwm.xml create mode 100644 lib/res/values/strings.xml create mode 100644 lib/res/values/styles.xml create mode 100644 lib/src/ru/mapswithme/maps/api/Const.java create mode 100644 lib/src/ru/mapswithme/maps/api/DownloadMapsWithMeDialog.java create mode 100644 lib/src/ru/mapswithme/maps/api/MWMPoint.java create mode 100644 lib/src/ru/mapswithme/maps/api/MWMResponse.java create mode 100644 lib/src/ru/mapswithme/maps/api/MapsWithMeApi.java create mode 100644 lib/src/ru/mapswithme/maps/api/MwmRequest.java create mode 100644 library/.gitignore create mode 100644 library/build.gradle create mode 100644 library/consumer-rules.pro create mode 100644 library/proguard-rules.pro create mode 100644 library/src/main/AndroidManifest.xml create mode 100644 library/src/main/java/ru/homesoft/encoder/FrameBuilder.kt create mode 100644 library/src/main/java/ru/homesoft/encoder/FrameMuxer.kt create mode 100644 library/src/main/java/ru/homesoft/encoder/Mp4FrameMuxer.kt create mode 100644 library/src/main/java/ru/homesoft/encoder/Muxer.kt create mode 100644 library/src/main/java/ru/homesoft/encoder/MuxerConfiguration.kt create mode 100644 library/src/main/res/values/strings.xml create mode 100644 library/src/main/res/xml/file_paths.xml create mode 100644 settings.gradle create mode 100644 upload.sh create mode 100644 upload.sh.bak diff --git a/app/build.gradle b/app/build.gradle index 76223ea..c236a1c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -169,6 +169,8 @@ def getVersionNumber() { repositories { maven { url "http://maven.google.com/" + allowInsecureProtocol = true + } } diff --git a/app/src/dev/res/values/strings.xml b/app/src/dev/res/values/strings.xml index c358f4c..d798e07 100644 --- a/app/src/dev/res/values/strings.xml +++ b/app/src/dev/res/values/strings.xml @@ -244,6 +244,7 @@ Выйти Поиск устройства Поиск принтера + Технический осмотр Открыть боковое меню @@ -256,6 +257,9 @@ SOS sos + Парк + + Параметры Сводная панель @@ -335,6 +339,13 @@ Заезд в гараж/следующее место работ Дата и время заезда + Осмотры + + Информация + Проверки + + + На карте Списком Задание %1$d diff --git a/app/src/main/java/ru/tele2med/mobile/data/api/ApiService.kt b/app/src/main/java/ru/tele2med/mobile/data/api/ApiService.kt index af81978..ce1077f 100644 --- a/app/src/main/java/ru/tele2med/mobile/data/api/ApiService.kt +++ b/app/src/main/java/ru/tele2med/mobile/data/api/ApiService.kt @@ -275,6 +275,35 @@ interface ApiService { @Url url: Uri ): Completable + + @Multipart + // @POST("https://pdn.tele2med.ru/api3_/mobile/medicalCheckup") + @POST("${API_BASE_URL}waybills/tech_control/list") + fun getTechCheckupList( + @Part("filter") filter: RequestBody? = null, + @Part("offset") offset: RequestBody? = null, + @Part("limit") limit: RequestBody? = null, + @Part("tokenApp") tokenApp: RequestBody?, + @Part("sessId") sessId: RequestBody?, + @Part("uuid") uuid: RequestBody, + @Part("appUniqID") appUniqID: RequestBody, + @Header("token") token: String? = "iddqd", + @Header("Authorization") tokenUser: String? + ): Single + + + @Multipart + @POST("${API_BASE_URL}waybills/tech_control/show/{uniq_id}") + fun getTech( + @Path("uniq_id") uuid: String?, + @Part("tokenApp") tokenApp: RequestBody?, + @Part("sessId") sessId: RequestBody?, + @Part("appUniqID") appUniqID: RequestBody, + @Header("token") token: String? = "iddqd", + @Header("Authorization") tokenUser: String? + ): Single + + } /*-- Дальше OLD --*/ diff --git a/app/src/main/java/ru/tele2med/mobile/data/api/entity/response/TechCheckupsListResponse.kt b/app/src/main/java/ru/tele2med/mobile/data/api/entity/response/TechCheckupsListResponse.kt new file mode 100644 index 0000000..6f84d22 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/data/api/entity/response/TechCheckupsListResponse.kt @@ -0,0 +1 @@ +package ru.tele2med.mobile.data.api.entity.response import ru.tele2med.mobile.domain.entity.DataCheckup import ru.tele2med.mobile.domain.entity.DataTechCheckup data class TechCheckupsListResponse( val af: String, val status: String, val data: List, val total_count: Int, val message: String ) \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/data/api/entity/response/TechResponse.kt b/app/src/main/java/ru/tele2med/mobile/data/api/entity/response/TechResponse.kt new file mode 100644 index 0000000..155ddd0 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/data/api/entity/response/TechResponse.kt @@ -0,0 +1 @@ +package ru.tele2med.mobile.data.api.entity.response import ru.tele2med.mobile.domain.entity.DataQR import ru.tele2med.mobile.domain.entity.DataTech data class TechResponse( val af: String, val status: String, val message: String, val data: DataTech ) \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/data/repository/DataConverter.kt b/app/src/main/java/ru/tele2med/mobile/data/repository/DataConverter.kt index 7f3cb1e..e9b7e18 100644 --- a/app/src/main/java/ru/tele2med/mobile/data/repository/DataConverter.kt +++ b/app/src/main/java/ru/tele2med/mobile/data/repository/DataConverter.kt @@ -69,6 +69,24 @@ class DataConverter { total_count = list.total_count ) + fun toTechCheckupListAll(list: TechCheckupsListResponse): TechCheckupList = + TechCheckupList( + af = list.af, + status = list.status, + data = list.data, + total_count = list.total_count, + message = list.message + ) + + + fun toTech(tech: TechResponse): Tech = + Tech( + af = tech.af, + status = tech.status, + message = tech.message, + data = tech.data + ) + fun toDashboard(data: DashboardListResponse): DashboardResponseDto = DashboardResponseDto( af = data.af, diff --git a/app/src/main/java/ru/tele2med/mobile/data/repository/SosRepositoryImpl.kt b/app/src/main/java/ru/tele2med/mobile/data/repository/SosRepositoryImpl.kt new file mode 100644 index 0000000..a70b45d --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/data/repository/SosRepositoryImpl.kt @@ -0,0 +1,28 @@ +package ru.tele2med.mobile.data.repository + +import io.reactivex.Single +import okhttp3.MediaType +import okhttp3.RequestBody +import ru.tele2med.mobile.BuildConfig +import ru.tele2med.mobile.data.api.ApiService +import ru.tele2med.mobile.domain.entity.DefaultResponseDto +import ru.tele2med.mobile.domain.entity.ServerMessage +import ru.tele2med.mobile.domain.repository.SosRepository +import ru.tele2med.mobile.presentation.util.Prefs +import java.text.SimpleDateFormat +import java.util.* + +class SosRepositoryImpl( + private val apiService: ApiService, + private val dataConverter: DataConverter, + private val prefs: Prefs +) : SosRepository { + + val uuid = prefs.getUuid() ?: "" + val tokenApp = BuildConfig.TOKEN_APP + val tokenUser = prefs.getTokenUser() + override fun sendSos(lat: Double, lon: Double, message: String): Single { + TODO("Not yet implemented") + } + +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/data/repository/TechRepositoryImpl.kt b/app/src/main/java/ru/tele2med/mobile/data/repository/TechRepositoryImpl.kt new file mode 100644 index 0000000..477d225 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/data/repository/TechRepositoryImpl.kt @@ -0,0 +1,72 @@ +package ru.tele2med.mobile.data.repository + +import ru.tele2med.mobile.domain.entity.MedicalCheckupList +import ru.tele2med.mobile.domain.entity.QR +import ru.tele2med.mobile.domain.repository.QRRepository +import ru.tele2med.mobile.presentation.util.Prefs +import io.reactivex.Single +import okhttp3.MediaType +import okhttp3.RequestBody +import ru.tele2med.mobile.data.api.ApiService +import ru.tele2med.mobile.domain.entity.Tech +import ru.tele2med.mobile.domain.entity.TechCheckupList +import ru.tele2med.mobile.domain.repository.TechRepository + + +class TechRepositoryImpl( + private val apiService: ApiService, + private val dataConverter: DataConverter, + private val prefs: Prefs +) : TechRepository { + + val tokenApp = ru.tele2med.mobile.BuildConfig.TOKEN_APP + + + override fun getTech(id: String): Single = + apiService + .getTech( + uuid = id, + sessId = RequestBody.create( + MediaType.parse("text/plain"), + prefs.getSessId().toString() + ), + tokenApp = RequestBody.create(MediaType.parse("text/plain"), tokenApp), + tokenUser = "Bearer ${prefs.getTokenUser().toString()}", + appUniqID = RequestBody.create( + MediaType.parse("text/plain"), + prefs.getAppUniqId().toString() + ) + ) + .map(dataConverter::toTech) + + + override fun getTechCheckupAll(offset: Int, limit: Int): Single = + apiService + .getTechCheckupList( + limit = RequestBody.create( + MediaType.parse("text/plain"), + limit.toString() + ), + offset = RequestBody.create( + MediaType.parse("text/plain"), + offset.toString() + ), + sessId = RequestBody.create( + MediaType.parse("text/plain"), + prefs.getSessId().toString() + ), + uuid = RequestBody.create( + MediaType.parse("text/plain"), + prefs.getUuid().toString() + ), + tokenApp = RequestBody.create(MediaType.parse("text/plain"), tokenApp), + tokenUser = "Bearer ${prefs.getTokenUser().toString()}", + appUniqID = RequestBody.create( + MediaType.parse("text/plain"), + prefs.getAppUniqId().toString() + ) + ) + .map(dataConverter::toTechCheckupListAll) + + +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/di/module/interactorModule.kt b/app/src/main/java/ru/tele2med/mobile/di/module/interactorModule.kt index cae4212..60cb822 100644 --- a/app/src/main/java/ru/tele2med/mobile/di/module/interactorModule.kt +++ b/app/src/main/java/ru/tele2med/mobile/di/module/interactorModule.kt @@ -16,7 +16,9 @@ fun interactorModule() = Kodein.Module(name = "interactorModule") { DashboardInteractor(instance()) } - + bind() from provider { + TechInteractor(instance()) + } bind() from provider { QRInteractor(instance()) diff --git a/app/src/main/java/ru/tele2med/mobile/di/module/presenterModule.kt b/app/src/main/java/ru/tele2med/mobile/di/module/presenterModule.kt index dea0637..21e1dd0 100644 --- a/app/src/main/java/ru/tele2med/mobile/di/module/presenterModule.kt +++ b/app/src/main/java/ru/tele2med/mobile/di/module/presenterModule.kt @@ -47,6 +47,12 @@ import ru.tele2med.mobile.presentation.ui.menu.items.rfid.RfidPresenter import ru.tele2med.mobile.presentation.ui.menu.items.settingsLc.SettingsLcPresenter import ru.tele2med.mobile.presentation.ui.menu.items.settingsReview.SettingsReviewPresenter import ru.tele2med.mobile.presentation.ui.menu.items.status.statusList.StatusListPresenter +import ru.tele2med.mobile.presentation.ui.menu.items.tech.TechPresenter +import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.TechListPresenter +import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.TechCheckupPresenter +import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info.TechCheckupInfoPresenter +import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.tests.TechCheckupTestsPresenter +import ru.tele2med.mobile.presentation.ui.menu.items.tech.park.ParkPresenter import ru.tele2med.mobile.presentation.ui.models.UiConverter import ru.tele2med.mobile.presentation.ui.splash.SplashPresenter import ru.tele2med.mobile.presentation.util.MyDialogPresenter @@ -57,6 +63,35 @@ fun presenterModule() = Kodein.Module(name = "presenterModule") { QrPresenter(instance(), instance(), instance()) } + bind() from provider { + TechListPresenter(instance(), instance(), instance()) + } + + bind() from factory { stringId: String -> + TechCheckupInfoPresenter(instance(), instance(), stringId) + } + + bind() from factory { stringId: String -> + TechCheckupTestsPresenter(instance(), instance(), stringId) + } + + bind() from provider { + ParkPresenter(instance(), instance(), instance()) + } + + + bind() from provider { + TechPresenter() + } + + bind() from factory { stringId: String -> + TechCheckupPresenter() + } + + + + + bind() from provider { QrReviewPresenter(instance(), instance(), instance()) } diff --git a/app/src/main/java/ru/tele2med/mobile/di/module/repositoryModule.kt b/app/src/main/java/ru/tele2med/mobile/di/module/repositoryModule.kt index ea34ba1..463ad81 100644 --- a/app/src/main/java/ru/tele2med/mobile/di/module/repositoryModule.kt +++ b/app/src/main/java/ru/tele2med/mobile/di/module/repositoryModule.kt @@ -65,6 +65,8 @@ fun repoModule() = Kodein.Module(name = "repoModule") { ) } + + bind() with singleton { UploadFirstPhotoRepositoryImpl( instance(), @@ -81,6 +83,22 @@ fun repoModule() = Kodein.Module(name = "repoModule") { } + bind() with singleton { + SosRepositoryImpl( + instance(), + instance(), + instance() + ) + } + + bind() with singleton { + TechRepositoryImpl( + instance(), + instance(), + instance() + ) + } + bind() with singleton { @@ -116,6 +134,4 @@ fun repoModule() = Kodein.Module(name = "repoModule") { } - - } \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/domain/entity/DataTech.kt b/app/src/main/java/ru/tele2med/mobile/domain/entity/DataTech.kt new file mode 100644 index 0000000..66b4845 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/domain/entity/DataTech.kt @@ -0,0 +1,27 @@ +package ru.tele2med.mobile.domain.entity + +data class DataTech( + val id: String, + val uniq_id: String, + val vehicle_id: String, + val inspectiontype: String, + val vehicle_name: String, + val waybill_uuid: String, + val waybill_name: String, + val organization_id: String, + val mechanic_id: String, + val mechanic_name: String, + val result_id: String, + val result_name: String, + val checklist_uuid: String, + val datetime: String, + val date_create: String, + val date_update: String, + val date_delete: String, + val enabled: String, + val exam_state: String, + val exam_state_name: String, + val exam_state_description: String, + val date_: String, + val time_: String +) \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/domain/entity/Tech.kt b/app/src/main/java/ru/tele2med/mobile/domain/entity/Tech.kt new file mode 100644 index 0000000..3aa639c --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/domain/entity/Tech.kt @@ -0,0 +1,8 @@ +package ru.tele2med.mobile.domain.entity + +data class Tech( + val af: String, + val status: String, + val message: String, + val data: DataTech +) \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/domain/interactor/TechInteractor.kt b/app/src/main/java/ru/tele2med/mobile/domain/interactor/TechInteractor.kt index c21e121..d673b07 100644 --- a/app/src/main/java/ru/tele2med/mobile/domain/interactor/TechInteractor.kt +++ b/app/src/main/java/ru/tele2med/mobile/domain/interactor/TechInteractor.kt @@ -4,6 +4,7 @@ import ru.tele2med.mobile.domain.entity.MedicalCheckupList import ru.tele2med.mobile.domain.entity.QR import ru.tele2med.mobile.domain.repository.QRRepository import io.reactivex.Single +import ru.tele2med.mobile.domain.entity.Tech import ru.tele2med.mobile.domain.entity.TechCheckupList import ru.tele2med.mobile.domain.repository.TechRepository @@ -12,9 +13,7 @@ class TechInteractor( ) { - fun getQR(qrcode: String): Single = techRepository.getQR(qrcode) - fun getQRProd(qrcode: String): Single = techRepository.getQRProd(qrcode) - + fun getTech(id: String): Single = techRepository.getTech(id) fun getTechCheckupList(offset: Int, limit: Int): Single = techRepository.getTechCheckupAll(offset, limit) diff --git a/app/src/main/java/ru/tele2med/mobile/domain/repository/TechRepository.kt b/app/src/main/java/ru/tele2med/mobile/domain/repository/TechRepository.kt index 1a01c5d..428fdad 100644 --- a/app/src/main/java/ru/tele2med/mobile/domain/repository/TechRepository.kt +++ b/app/src/main/java/ru/tele2med/mobile/domain/repository/TechRepository.kt @@ -3,11 +3,11 @@ package ru.tele2med.mobile.domain.repository import ru.tele2med.mobile.domain.entity.MedicalCheckupList import ru.tele2med.mobile.domain.entity.QR import io.reactivex.Single +import ru.tele2med.mobile.domain.entity.Tech import ru.tele2med.mobile.domain.entity.TechCheckupList interface TechRepository { - fun getQR(qrcode: String): Single - fun getQRProd(qrcode: String): Single + fun getTech(id: String): Single fun getTechCheckupAll(offset: Int, limit: Int): Single } diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/router/NavRouter.kt b/app/src/main/java/ru/tele2med/mobile/presentation/router/NavRouter.kt index da34f22..a5601f9 100644 --- a/app/src/main/java/ru/tele2med/mobile/presentation/router/NavRouter.kt +++ b/app/src/main/java/ru/tele2med/mobile/presentation/router/NavRouter.kt @@ -1,6 +1,7 @@ package ru.tele2med.mobile.presentation.router import ru.tele2med.mobile.domain.entity.DataQR +import ru.tele2med.mobile.domain.entity.DataTech import ru.terrakok.cicerone.Router class NavRouter : Router() { @@ -117,6 +118,11 @@ class NavRouter : Router() { navigateTo(NavScreens.getMedicalCheckup(dataQR)) } + + fun openTechCheckupScreen(dataTech: DataTech) { + navigateTo(NavScreens.getTechCheckup(dataTech)) + } + fun openMedicalCheckupsScreen() { navigateTo(NavScreens.getMedicalCheckups()) } diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/router/NavScreens.kt b/app/src/main/java/ru/tele2med/mobile/presentation/router/NavScreens.kt index deeb664..f45e954 100644 --- a/app/src/main/java/ru/tele2med/mobile/presentation/router/NavScreens.kt +++ b/app/src/main/java/ru/tele2med/mobile/presentation/router/NavScreens.kt @@ -1,6 +1,7 @@ package ru.tele2med.mobile.presentation.router import ru.tele2med.mobile.domain.entity.DataQR +import ru.tele2med.mobile.domain.entity.DataTech import ru.tele2med.mobile.presentation.ui.auth.login.LoginScreen import ru.tele2med.mobile.presentation.ui.auth.number_enter.NumberEnterScreen import ru.tele2med.mobile.presentation.ui.auth.pin_change.PinChangeScreen @@ -38,6 +39,7 @@ import ru.tele2med.mobile.presentation.ui.menu.items.sos.SosScreen import ru.tele2med.mobile.presentation.ui.menu.items.stats.StatsScreen import ru.tele2med.mobile.presentation.ui.menu.items.status.StatusesScreen import ru.tele2med.mobile.presentation.ui.menu.items.tech.TechScreen +import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.TechCheckupScreen import ru.tele2med.mobile.presentation.ui.menu.items.tonometr.TonScreen object NavScreens { @@ -89,6 +91,8 @@ object NavScreens { fun getMedicalCheckup(dataQR: DataQR): MedicalCheckupScreen = MedicalCheckupScreen(dataQR) + fun getTechCheckup(dataTech: DataTech): TechCheckupScreen = TechCheckupScreen(dataTech) + fun getMedicalCheckups(): CheckupsScreen = CheckupsScreen() fun getAlkoScreen(): AlkoScreen = AlkoScreen() diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/auth0/SplashAuth0Activity.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/auth0/SplashAuth0Activity.kt index d274b89..54ef5c7 100644 --- a/app/src/main/java/ru/tele2med/mobile/presentation/ui/auth0/SplashAuth0Activity.kt +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/auth0/SplashAuth0Activity.kt @@ -173,7 +173,7 @@ class SplashAuth0Activity : BaseActivity(), SplashAuth0View { URL?.let { intent.launchUrl(this@SplashAuth0Activity, it) } - val action: String? = intent?.intent.action + val action: String? = intent.intent.action val data: Uri? = intent.intent.data println("actionSplash = $action") diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/base/BasePresenter.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/base/BasePresenter.kt index a737e34..86b126a 100644 --- a/app/src/main/java/ru/tele2med/mobile/presentation/ui/base/BasePresenter.kt +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/base/BasePresenter.kt @@ -28,7 +28,11 @@ abstract class BasePresenter : MvpPresenter() { when (t) { is ApiException -> viewState.showError(t.message) is IOException -> viewState.showError(R.string.not_internet_connection) - else -> viewState.showError(R.string.something_wrong) + else -> if (t.message != null) { + viewState.showError(t.message!!) + } else { + viewState.showError(R.string.something_wrong) + } } } diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/checkups/CheckupsFragment.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/checkups/CheckupsFragment.kt index 1f18fc4..0add361 100644 --- a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/checkups/CheckupsFragment.kt +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/checkups/CheckupsFragment.kt @@ -15,13 +15,11 @@ import ru.tele2med.mobile.presentation.ui.menu.MenuActivity import ru.tele2med.mobile.presentation.ui.menu.ReviewActivity import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuFragment import ru.tele2med.mobile.presentation.util.providePresenter -import kotlinx.android.synthetic.main.fragment_dashboard.* import kotlinx.android.synthetic.main.fragment_hello.recyclerView import kotlinx.android.synthetic.main.toolbar_with_help.* import org.jetbrains.anko.clearTask import org.jetbrains.anko.intentFor import org.jetbrains.anko.newTask -import ru.tele2med.mobile.presentation.ui.menu.items.tech.CheckupsView class CheckupsFragment : BaseMenuFragment(), CheckupsView { diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/checkups/CheckupsPresenter.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/checkups/CheckupsPresenter.kt index b4629b4..47ae2cb 100644 --- a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/checkups/CheckupsPresenter.kt +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/checkups/CheckupsPresenter.kt @@ -10,7 +10,6 @@ import ru.tele2med.mobile.presentation.ui.models.UiConverter import ru.tele2med.mobile.presentation.util.ioToMain import io.reactivex.rxkotlin.plusAssign import ru.tele2med.mobile.data.api.entity.exception.ApiException -import ru.tele2med.mobile.presentation.ui.menu.items.tech.CheckupsView @InjectViewState class CheckupsPresenter( diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechAdapter.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechAdapter.kt index 7472b93..22a340f 100644 --- a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechAdapter.kt +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechAdapter.kt @@ -1,94 +1,52 @@ package ru.tele2med.mobile.presentation.ui.menu.items.tech -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.ImageView -import android.widget.TextView -import androidx.core.content.ContextCompat -import androidx.recyclerview.widget.DiffUtil -import androidx.recyclerview.widget.ListAdapter -import androidx.recyclerview.widget.RecyclerView +import android.content.Context +import android.os.Bundle +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentManager +import androidx.fragment.app.FragmentStatePagerAdapter import ru.tele2med.mobile.R -import ru.tele2med.mobile.domain.entity.DataTechCheckup +import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.TechListFragment +import ru.tele2med.mobile.presentation.ui.menu.items.tech.park.ParkFragment -class TechAdapter( - val onItemClick: (checkupId: String) -> Unit -) : ListAdapter( - DIFF_CALLBACK -) { - companion object { - private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(p0: DataTechCheckup, p1: DataTechCheckup): Boolean = - p0.id == p1.id +class TechAdapter(val context: Context, fm: FragmentManager) : FragmentStatePagerAdapter(fm) { - override fun areContentsTheSame(p0: DataTechCheckup, p1: DataTechCheckup): Boolean = - p0 == p1 + private var fragments: MutableList = mutableListOf() + + override fun getItem(position: Int): Fragment { + return when (position) { + 0 -> { + val fragment = TechListFragment.getInstance() + + val arguments = Bundle() + fragment.arguments = arguments + fragments.add(fragment) + fragment + } + 1 -> { + val fragment = ParkFragment.getInstance() + val arguments = Bundle() + fragment.arguments = arguments + fragments.add(fragment) + fragment + } + else -> throw Exception(context.getString(R.string.unexpected_page)) } } - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - val inflater = LayoutInflater.from(parent.context) - return ViewHolder(inflater.inflate(R.layout.item_checkup, parent, false)) + override fun getCount(): Int { + return 2 } - override fun onBindViewHolder(holder: ViewHolder, position: Int) { - holder.bind(getItem(position)) - } - - inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { - private val checkupId: TextView = view.findViewById(R.id.tvCheckupId) - private val time: TextView = view.findViewById(R.id.tvTime) - private val fio: TextView = view.findViewById(R.id.tvFio) - private val eye: ImageView = view.findViewById(R.id.ivEye) - private val auto: ImageView = view.findViewById(R.id.ivAuto) - private val medic: ImageView = view.findViewById(R.id.ivTelemedic) - private val battery: ImageView = view.findViewById(R.id.ivBattery) - - - init { - view.setOnClickListener { - val notification = getItem(adapterPosition) - onItemClick(notification.uniq_id) - } - } - - fun bind(notification: DataTechCheckup) { - checkupId.text = "№ ${notification.id}" - time.text = notification.endmeasurmenttime - fio.text = notification.fio - - eye.setImageDrawable( - ContextCompat.getDrawable( - itemView.context, - if (notification.recognize == "1") R.drawable.ic_green_eye else R.drawable.ic_red_eye - ) + override fun getPageTitle(position: Int): CharSequence? { + val tabTitles = listOf( + context.getString(R.string.checkups_list_title), + context.getString(R.string.park_toolbar) ) - - auto.setImageDrawable( - ContextCompat.getDrawable( - itemView.context, - if (notification.exam_result_auto == "1") R.drawable.ic_green_auto else R.drawable.ic_red_auto - ) - ) - - medic.setImageDrawable( - ContextCompat.getDrawable( - itemView.context, - if (notification.exam_result_med == "1") R.drawable.ic_green_medic else R.drawable.ic_red_telemedic - ) - ) - - if (notification.exam_state == "2") { - battery.setImageResource(R.drawable.ic_battery_full) - } - if (notification.exam_state == "1") { - battery.setImageResource(R.drawable.ic_battery_middle) - } - if (notification.exam_state == "0") { - battery.setImageResource(R.drawable.ic_battery_low) - } - + return when (position) { + 0 -> tabTitles.first() + 1 -> tabTitles.last() + else -> throw Exception(context.getString(R.string.unexpected_page)) } } } \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechFragment.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechFragment.kt index a1b20bf..76f3109 100644 --- a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechFragment.kt +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechFragment.kt @@ -2,153 +2,55 @@ package ru.tele2med.mobile.presentation.ui.menu.items.tech import android.os.Bundle import android.view.View -import androidx.recyclerview.widget.LinearLayoutManager import com.arellomobile.mvp.presenter.InjectPresenter import com.arellomobile.mvp.presenter.ProvidePresenter +import kotlinx.android.synthetic.main.fragment_tasks.* import ru.tele2med.mobile.R -import ru.tele2med.mobile.domain.entity.DataCheckup -import ru.tele2med.mobile.presentation.ui.auth.AuthActivity import ru.tele2med.mobile.presentation.ui.base.BasePresenter -import ru.tele2med.mobile.presentation.ui.common.EndlessRecyclerViewScrollListener import ru.tele2med.mobile.presentation.ui.drawer.entity.ScreenType import ru.tele2med.mobile.presentation.ui.menu.MenuActivity -import ru.tele2med.mobile.presentation.ui.menu.ReviewActivity import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuFragment import ru.tele2med.mobile.presentation.util.providePresenter -import kotlinx.android.synthetic.main.fragment_hello.recyclerView -import kotlinx.android.synthetic.main.toolbar_with_help.* -import org.jetbrains.anko.clearTask -import org.jetbrains.anko.intentFor -import org.jetbrains.anko.newTask -import ru.tele2med.mobile.domain.entity.DataTechCheckup -class TechFragment : BaseMenuFragment(), CheckupsView { +class TechFragment : BaseMenuFragment(), TechView { override val screenType: ScreenType - get() = ScreenType.HELLO + get() = ScreenType.TASKS_FOR_TODAY @InjectPresenter lateinit var presenter: TechPresenter - private lateinit var layoutManager: LinearLayoutManager - - @ProvidePresenter fun initPresenter(): TechPresenter = providePresenter() override val layoutId: Int - get() = R.layout.fragment_tech_list + get() = R.layout.fragment_techs + override fun getPresenter(): BasePresenter<*> = presenter - private val adapter: TechAdapter by lazy { - TechAdapter { idcheckup -> - presenter.get(idcheckup) - } - } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - - when (activity) { - is ReviewActivity -> { - (activity as ReviewActivity).apply { - help.visibility = View.VISIBLE - settings.visibility = View.VISIBLE - phone.visibility = View.VISIBLE - menu.setOnClickListener { - println("click menu is ReviewActivity -> {") - onBackPressed() - } - title = "" - } - } - is MenuActivity -> { - (activity as MenuActivity).apply { - // addDrawerToggle() - help.visibility = View.VISIBLE - settings.visibility = View.VISIBLE - phone.visibility = View.VISIBLE - menu.setOnClickListener { - println("click menu is MenuActivity -> {") - - onBackPressed() - } - title = "" - } - } - } - - - - presenter.getCheckups() - - layoutManager = LinearLayoutManager(context) - recyclerView.layoutManager = layoutManager - recyclerView.adapter = adapter - val scrollListener = object : EndlessRecyclerViewScrollListener(layoutManager) { - override fun onLoadMore() { - presenter.getCheckups() - } - } - recyclerView.addOnScrollListener(scrollListener) - - - //setName() - setClickListeners() - - } - - override fun showCheckups(list: List) { - adapter.submitList(list) - - } - - override fun logOut() { (activity as MenuActivity).apply { - startActivity(intentFor().newTask().clearTask()) - stopUpdatesService() + addDrawerToggle() + title = getString(R.string.tech_checkup) } + initViewPager() } - private fun setClickListeners() { - when (activity) { - is ReviewActivity -> { - (activity as ReviewActivity).apply { - help.visibility = View.VISIBLE - settings.visibility = View.VISIBLE - phone.visibility = View.VISIBLE - menu.setOnClickListener { - println("click menu setClickListeners1") - onOpenDrawer() - } - title = "" - } - } - is MenuActivity -> { - (activity as MenuActivity).apply { - help.visibility = View.VISIBLE - settings.visibility = View.VISIBLE - phone.visibility = View.VISIBLE - menu.setOnClickListener { - println("click menu setClickListeners2") - onOpenDrawer() - } - title = "" - } - } + private fun initViewPager() { + context?.let { + + MyViewPager.adapter = TechAdapter(it, childFragmentManager) } - - + tabLayout.setupWithViewPager(MyViewPager) + tabLayout.getTabAt(0)?.select() + tabLayout.getTabAt(0)?.setIcon(R.drawable.ic_search) + tabLayout.getTabAt(1)?.setIcon(R.drawable.ic_tasks_list) } - private fun setName() { - //tvName.text = prefs.getCurrentUserName() - //tvName2.text = prefs.getAppUniqId() - } - - override fun getPresenter(): BasePresenter<*>? = null companion object { diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechPresenter.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechPresenter.kt index eb1757e..e136770 100644 --- a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechPresenter.kt +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechPresenter.kt @@ -1,77 +1,7 @@ package ru.tele2med.mobile.presentation.ui.menu.items.tech import com.arellomobile.mvp.InjectViewState -import ru.tele2med.mobile.domain.entity.DataCheckup -import ru.tele2med.mobile.domain.interactor.QRInteractor -import ru.tele2med.mobile.presentation.router.NavRouter -import ru.tele2med.mobile.presentation.ui.base.BasePresenter -import ru.tele2med.mobile.presentation.ui.base.entity.RestApiCodes -import ru.tele2med.mobile.presentation.ui.models.UiConverter -import ru.tele2med.mobile.presentation.util.ioToMain -import io.reactivex.rxkotlin.plusAssign -import ru.tele2med.mobile.data.api.entity.exception.ApiException -import ru.tele2med.mobile.domain.entity.DataTechCheckup -import ru.tele2med.mobile.domain.interactor.TechInteractor +import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuPresenter @InjectViewState -class TechPresenter( - private val techInteractor: TechInteractor, - private val uiConverter: UiConverter, - private val navRouter: NavRouter - -) : BasePresenter() { - private val currentCheckups = mutableListOf() // новые в начале - - - fun get(idcheckup: String) { - println("TechPresenter") - disposable += techInteractor - .getQR(idcheckup) - .ioToMain() - .doOnSubscribe { - viewState.showLoading() - } - .doAfterTerminate { - viewState.hideLoading() - } - .subscribe({ - - navRouter.openMedicalCheckupScreen(it.data) - }, { - if (it is ApiException) { - if (it.code == RestApiCodes.BadRequest.code) { - viewState.showError("QR-код некорректный, повторите попытку, или используйте другой QR-код") - } else { - this.handleError(it) - } - } else { - println("not it is com.") - this.handleError(it) - } - }) - - } - - - fun getCheckups() { - disposable += techInteractor - .getTechCheckupList( - offset = currentCheckups.size, - limit = 10 - ) - .map(uiConverter::toUiTechCheckups) - .ioToMain() - .baseLoadingHandle() - .baseHandleErrorSubscribe { - currentCheckups.addAll(it.data) - viewState.showCheckups(currentCheckups.toList()) - } - } - - - fun onNeedForRootScreen() { - // navRouter.newRootScreen(NavScreens.getHelloScreen()) - } - - -} \ No newline at end of file +class TechPresenter : BaseMenuPresenter() \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechScreen.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechScreen.kt index 7182021..71bbb4e 100644 --- a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechScreen.kt +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechScreen.kt @@ -1,13 +1,13 @@ package ru.tele2med.mobile.presentation.ui.menu.items.tech import androidx.fragment.app.Fragment -import ru.tele2med.mobile.presentation.ui.menu.items.checkups.CheckupsFragment +import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.TechListFragment import ru.terrakok.cicerone.android.support.SupportAppScreen class TechScreen : SupportAppScreen() { override fun getFragment(): Fragment { - return CheckupsFragment.getInstance() + return TechFragment.getInstance() } override fun getScreenKey(): String { diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechView.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechView.kt new file mode 100644 index 0000000..1120079 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/TechView.kt @@ -0,0 +1,7 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech + +import ru.tele2med.mobile.presentation.ui.base.BaseView + +interface TechView : BaseView { + +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListAdapter.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListAdapter.kt new file mode 100644 index 0000000..23d1052 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListAdapter.kt @@ -0,0 +1,92 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.TextView +import androidx.recyclerview.widget.DiffUtil +import androidx.recyclerview.widget.ListAdapter +import androidx.recyclerview.widget.RecyclerView +import ru.tele2med.mobile.R +import ru.tele2med.mobile.domain.entity.DataTechCheckup + +class TechListAdapter( + val onItemClick: (checkupId: String) -> Unit +) : ListAdapter( + DIFF_CALLBACK +) { + companion object { + private val DIFF_CALLBACK = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(p0: DataTechCheckup, p1: DataTechCheckup): Boolean = + p0.id == p1.id + + override fun areContentsTheSame(p0: DataTechCheckup, p1: DataTechCheckup): Boolean = + p0 == p1 + } + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { + val inflater = LayoutInflater.from(parent.context) + return ViewHolder(inflater.inflate(R.layout.item_tech, parent, false)) + } + + override fun onBindViewHolder(holder: ViewHolder, position: Int) { + holder.bind(getItem(position)) + } + + inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { + private val carName: TextView = view.findViewById(R.id.carName) + private val time: TextView = view.findViewById(R.id.tvTime) + private val fio: TextView = view.findViewById(R.id.tvFio) + private val eye: ImageView = view.findViewById(R.id.ivEye) + private val status: TextView = view.findViewById(R.id.tvStatus) + private val battery: ImageView = view.findViewById(R.id.ivBattery) + + + init { + view.setOnClickListener { + val list = getItem(adapterPosition) + onItemClick(list.uniq_id) + } + } + + fun bind(list: DataTechCheckup) { + carName.text = list.vehicle_name + time.text = list.datetime + //fio.text = list.fio + status.text = list.exam_state_name + /* eye.setImageDrawable( + ContextCompat.getDrawable( + itemView.context, + if (list.recognize == "1") R.drawable.ic_green_eye else R.drawable.ic_red_eye + ) + ) + + auto.setImageDrawable( + ContextCompat.getDrawable( + itemView.context, + if (list.exam_state == "1") R.drawable.ic_green_auto else R.drawable.ic_red_auto + ) + )*/ + + /* medic.setImageDrawable( + ContextCompat.getDrawable( + itemView.context, + if (list.exam_result_med == "1") R.drawable.ic_green_medic else R.drawable.ic_red_telemedic + ) + ) */ + + if (list.exam_state == "4") { + battery.setImageResource(R.drawable.ic_battery_full) + } + if (list.exam_state == "3") { + battery.setImageResource(R.drawable.ic_battery_middle) + } + if (list.exam_state == "0" || list.exam_state == "1" || list.exam_state == "2") { + battery.setImageResource(R.drawable.ic_battery_low) + } + + } + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListFragment.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListFragment.kt new file mode 100644 index 0000000..558ed6b --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListFragment.kt @@ -0,0 +1,156 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list + +import android.os.Bundle +import android.view.View +import androidx.recyclerview.widget.LinearLayoutManager +import com.arellomobile.mvp.presenter.InjectPresenter +import com.arellomobile.mvp.presenter.ProvidePresenter +import kotlinx.android.synthetic.main.fragment_tech_list.* +import ru.tele2med.mobile.R +import ru.tele2med.mobile.presentation.ui.auth.AuthActivity +import ru.tele2med.mobile.presentation.ui.base.BasePresenter +import ru.tele2med.mobile.presentation.ui.common.EndlessRecyclerViewScrollListener +import ru.tele2med.mobile.presentation.ui.drawer.entity.ScreenType +import ru.tele2med.mobile.presentation.ui.menu.MenuActivity +import ru.tele2med.mobile.presentation.ui.menu.ReviewActivity +import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuFragment +import ru.tele2med.mobile.presentation.util.providePresenter +import kotlinx.android.synthetic.main.toolbar_with_help.* +import org.jetbrains.anko.clearTask +import org.jetbrains.anko.intentFor +import org.jetbrains.anko.newTask +import ru.tele2med.mobile.domain.entity.DataTechCheckup + + +class TechListFragment : BaseMenuFragment(), TechListView { + + override val screenType: ScreenType + get() = ScreenType.HELLO + + @InjectPresenter + lateinit var presenter: TechListPresenter + + private lateinit var layoutManager: LinearLayoutManager + + + @ProvidePresenter + fun initPresenter(): TechListPresenter = providePresenter() + + override val layoutId: Int + get() = R.layout.fragment_tech_list + + + private val adapter: TechListAdapter by lazy { + TechListAdapter { idcheckup -> + presenter.get(idcheckup) + } + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + when (activity) { + is ReviewActivity -> { + (activity as ReviewActivity).apply { + help.visibility = View.VISIBLE + settings.visibility = View.VISIBLE + phone.visibility = View.VISIBLE + menu.setOnClickListener { + println("click menu is ReviewActivity -> {") + onBackPressed() + } + title = "" + } + } + is MenuActivity -> { + (activity as MenuActivity).apply { + // addDrawerToggle() + help.visibility = View.VISIBLE + settings.visibility = View.VISIBLE + phone.visibility = View.VISIBLE + menu.setOnClickListener { + println("click menu is MenuActivity -> {") + + onBackPressed() + } + title = "" + } + } + } + + + + // presenter.getCheckups() + + layoutManager = LinearLayoutManager(context) + recyclerView.layoutManager = layoutManager + recyclerView.adapter = adapter + val scrollListener = object : EndlessRecyclerViewScrollListener(layoutManager) { + override fun onLoadMore() { + presenter.getCheckups() + } + } + recyclerView.addOnScrollListener(scrollListener) + + + //setName() + setClickListeners() + + } + + override fun showCheckups(list: List) { + adapter.submitList(list) + + } + + override fun logOut() { + (activity as MenuActivity).apply { + startActivity(intentFor().newTask().clearTask()) + stopUpdatesService() + } + } + + private fun setClickListeners() { + when (activity) { + is ReviewActivity -> { + (activity as ReviewActivity).apply { + help.visibility = View.VISIBLE + settings.visibility = View.VISIBLE + phone.visibility = View.VISIBLE + menu.setOnClickListener { + println("click menu setClickListeners1") + onOpenDrawer() + } + title = "" + } + } + is MenuActivity -> { + (activity as MenuActivity).apply { + help.visibility = View.VISIBLE + settings.visibility = View.VISIBLE + phone.visibility = View.VISIBLE + menu.setOnClickListener { + println("click menu setClickListeners2") + + onOpenDrawer() + } + title = "" + } + } + } + + + } + + private fun setName() { + //tvName.text = prefs.getCurrentUserName() + //tvName2.text = prefs.getAppUniqId() + } + + override fun getPresenter(): BasePresenter<*>? = null + + + companion object { + fun getInstance() = TechListFragment() + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListPresenter.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListPresenter.kt new file mode 100644 index 0000000..7629428 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListPresenter.kt @@ -0,0 +1,80 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list + +import com.arellomobile.mvp.InjectViewState +import ru.tele2med.mobile.presentation.router.NavRouter +import ru.tele2med.mobile.presentation.ui.base.BasePresenter +import ru.tele2med.mobile.presentation.ui.base.entity.RestApiCodes +import ru.tele2med.mobile.presentation.ui.models.UiConverter +import ru.tele2med.mobile.presentation.util.ioToMain +import io.reactivex.rxkotlin.plusAssign +import ru.tele2med.mobile.data.api.entity.exception.ApiException +import ru.tele2med.mobile.domain.entity.DataTechCheckup +import ru.tele2med.mobile.domain.interactor.TechInteractor + +@InjectViewState +class TechListPresenter( + private val techInteractor: TechInteractor, + private val uiConverter: UiConverter, + private val navRouter: NavRouter + +) : BasePresenter() { + private val currentCheckups = mutableListOf() // новые в начале + + + override fun onFirstViewAttach() { + getCheckups() + } + + + fun get(idcheckup: String) { + println("TechPresenter") + disposable += techInteractor + .getTech(idcheckup) + .ioToMain() + .doOnSubscribe { + viewState.showLoading() + } + .doAfterTerminate { + viewState.hideLoading() + } + .subscribe({ + + navRouter.openTechCheckupScreen(it.data) + }, { + if (it is ApiException) { + if (it.code == RestApiCodes.BadRequest.code) { + viewState.showError("Идентификатор некорректный, повторите попытку, или используйте другую запись") + } else { + this.handleError(it) + } + } else { + println("not it is com.") + this.handleError(it) + } + }) + + } + + + fun getCheckups() { + disposable += techInteractor + .getTechCheckupList( + offset = currentCheckups.size, + limit = 10 + ) + .map(uiConverter::toUiTechCheckups) + .ioToMain() + .baseLoadingHandle() + .baseHandleErrorSubscribe { + currentCheckups.addAll(it.data) + viewState.showCheckups(currentCheckups.toList()) + } + } + + + fun onNeedForRootScreen() { + // navRouter.newRootScreen(NavScreens.getHelloScreen()) + } + + +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/CheckupsView.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListView.kt similarity index 68% rename from app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/CheckupsView.kt rename to app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListView.kt index ca6271b..8d0ff29 100644 --- a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/CheckupsView.kt +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/TechListView.kt @@ -1,10 +1,10 @@ -package ru.tele2med.mobile.presentation.ui.menu.items.tech +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list import ru.tele2med.mobile.domain.entity.DataCheckup import ru.tele2med.mobile.domain.entity.DataTechCheckup import ru.tele2med.mobile.presentation.ui.base.BaseView -interface CheckupsView : BaseView { +interface TechListView : BaseView { fun showCheckups(list: List) } \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupAdapter.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupAdapter.kt new file mode 100644 index 0000000..0c83c6b --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupAdapter.kt @@ -0,0 +1,52 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup + +import android.content.Context +import android.os.Bundle +import androidx.fragment.app.Fragment +import androidx.fragment.app.FragmentManager +import androidx.fragment.app.FragmentStatePagerAdapter +import ru.tele2med.mobile.R +import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info.TechCheckupInfoFragment +import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.tests.TechCheckupTestsFragment + +class TechCheckupAdapter(val context: Context, fm: FragmentManager, private var dataTech: String?) : FragmentStatePagerAdapter(fm) { + + private var fragments: MutableList = mutableListOf() + + override fun getItem(position: Int): Fragment { + return when (position) { + 0 -> { + val fragment = TechCheckupInfoFragment.getInstance(dataTech) + + val arguments = Bundle() + fragment.arguments = arguments + fragments.add(fragment) + fragment + } + 1 -> { + val fragment = TechCheckupTestsFragment.getInstance(dataTech) + val arguments = Bundle() + fragment.arguments = arguments + fragments.add(fragment) + fragment + } + else -> throw Exception(context.getString(R.string.unexpected_page)) + } + } + + override fun getCount(): Int { + return 2 + } + + override fun getPageTitle(position: Int): CharSequence? { + val tabTitles = listOf( + context.getString(R.string.checkups_info_title), + context.getString(R.string.checkups_tests_title) + ) + return when (position) { + 0 -> tabTitles.first() + 1 -> tabTitles.last() + else -> throw Exception(context.getString(R.string.unexpected_page)) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupFragment.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupFragment.kt new file mode 100644 index 0000000..6ec5348 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupFragment.kt @@ -0,0 +1,87 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup + +import android.os.Bundle +import android.util.Log +import android.view.View +import com.arellomobile.mvp.presenter.InjectPresenter +import com.arellomobile.mvp.presenter.ProvidePresenter +import com.google.gson.Gson +import kotlinx.android.synthetic.main.fragment_tasks.* +import ru.tele2med.mobile.R +import ru.tele2med.mobile.domain.entity.DataTech +import ru.tele2med.mobile.presentation.ui.base.BasePresenter +import ru.tele2med.mobile.presentation.ui.drawer.entity.ScreenType +import ru.tele2med.mobile.presentation.ui.menu.MenuActivity +import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuFragment +import ru.tele2med.mobile.presentation.util.providePresenter + + +class TechCheckupFragment : BaseMenuFragment(), TechCheckupView { + + override val screenType: ScreenType + get() = ScreenType.TASKS_FOR_TODAY + + @InjectPresenter + lateinit var presenter: TechCheckupPresenter + + @ProvidePresenter + fun initPresenter(): TechCheckupPresenter = + providePresenter(arguments?.getString(DATA_QR) ?: "") + + override val layoutId: Int + get() = R.layout.fragment_techs + + override fun getPresenter(): BasePresenter<*> = presenter + + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + (activity as MenuActivity).apply { + var dataString = arguments?.getString(DATA_QR) + + val gson = Gson() + val data = gson.fromJson(dataString, DataTech::class.java) + addDrawerToggle() + Log.v("TechCheckupFragment", "args = ${arguments?.getString(DATA_QR)}") + + title = data.vehicle_name + } + initViewPager() + } + + + private fun initViewPager() { + context?.let { + + + MyViewPager.adapter = TechCheckupAdapter( + it, childFragmentManager, arguments?.getString( + DATA_QR + ) + ) + } + tabLayout.setupWithViewPager(MyViewPager) + tabLayout.getTabAt(0)?.select() + tabLayout.getTabAt(0)?.setIcon(R.drawable.ic_search) + tabLayout.getTabAt(1)?.setIcon(R.drawable.ic_tasks_list) + } + + + companion object { + const val DATA_QR = "DATA_QR" + + fun getInstance(dataTech: DataTech): TechCheckupFragment { + val gson = Gson() + val string: String = gson.toJson(dataTech) + Log.v("TechCheckupFragment", "dataTech = $dataTech") + Log.v("TechCheckupFragment", "dataTechString = $string") + + return TechCheckupFragment().also { + it.arguments = Bundle().apply { + putString(DATA_QR, string) + } + } + + } + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupPresenter.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupPresenter.kt new file mode 100644 index 0000000..420828e --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupPresenter.kt @@ -0,0 +1,7 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup + +import com.arellomobile.mvp.InjectViewState +import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuPresenter + +@InjectViewState +class TechCheckupPresenter : BaseMenuPresenter() \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupScreen.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupScreen.kt new file mode 100644 index 0000000..9e96c8a --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupScreen.kt @@ -0,0 +1,16 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup + +import androidx.fragment.app.Fragment +import ru.tele2med.mobile.domain.entity.DataTech +import ru.terrakok.cicerone.android.support.SupportAppScreen + +class TechCheckupScreen(val dataTech: DataTech) : SupportAppScreen() { + + override fun getFragment(): Fragment { + return TechCheckupFragment.getInstance(dataTech) + } + + override fun getScreenKey(): String { + return TechCheckupFragment::class.java.name + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupView.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupView.kt new file mode 100644 index 0000000..10b8cc4 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/TechCheckupView.kt @@ -0,0 +1,7 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup + +import ru.tele2med.mobile.presentation.ui.base.BaseView + +interface TechCheckupView : BaseView { + +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/info/TechCheckupInfoFragment.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/info/TechCheckupInfoFragment.kt new file mode 100644 index 0000000..842e79e --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/info/TechCheckupInfoFragment.kt @@ -0,0 +1,255 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info + +import android.annotation.SuppressLint +import android.net.Uri +import android.os.Build +import android.os.Bundle +import android.util.Log +import android.view.View +import android.widget.MediaController +import androidx.annotation.RequiresApi +import androidx.core.net.toUri +import com.arellomobile.mvp.presenter.InjectPresenter +import com.arellomobile.mvp.presenter.ProvidePresenter +import com.bumptech.glide.Glide +import com.google.gson.Gson +import com.squareup.picasso.Picasso +import ru.tele2med.mobile.R +import ru.tele2med.mobile.domain.entity.DataQR +import ru.tele2med.mobile.presentation.ui.base.BasePresenter +import ru.tele2med.mobile.presentation.ui.drawer.entity.ScreenType +import ru.tele2med.mobile.presentation.ui.menu.MenuActivity +import ru.tele2med.mobile.presentation.ui.menu.ReviewActivity +import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuFragment +import ru.tele2med.mobile.presentation.util.providePresenter +import kotlinx.android.synthetic.main.fragment_medical_checkup.* +import kotlinx.android.synthetic.main.toolbar_with_help.* +import ru.tele2med.mobile.BuildConfig +import ru.tele2med.mobile.domain.entity.DataTech +import ru.tele2med.mobile.presentation.ui.auth.number_enter.NumberEnterFragment +import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.tests.TechCheckupTestsFragment +import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.tests.TechCheckupTestsPresenter + + +class TechCheckupInfoFragment : BaseMenuFragment(), TechCheckupInfoView { + + override val screenType: ScreenType + get() = ScreenType.QR + + @InjectPresenter + lateinit var presenter: TechCheckupInfoPresenter + + + @ProvidePresenter + fun initPresenter(): TechCheckupInfoPresenter = + providePresenter(arguments?.getString(DATA_QR) ?: "") + + override val layoutId: Int + get() = R.layout.fragment_tech_checkup + + private var root: View? = null // create a global variable which will hold your layout + + + @RequiresApi(Build.VERSION_CODES.O) + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + when (activity) { + is ReviewActivity -> { + (activity as ReviewActivity).apply { + help.visibility = View.GONE + title = "" + // title = getString(R.string.help_toolbar) + // supportActionBar?.setDisplayHomeAsUpEnabled(true) + // showOrHideHelpButton(false) + } + } + is MenuActivity -> { + (activity as MenuActivity).apply { + // addDrawerToggle() + showOrHideHelpButton(false) + title = "" + } + } + } + + tvDriverTitle.focusable + tvDriverTitle.requestFocus() + presenter.showCheckUp() + + initRecycler() + + } + + override fun setRefreshing(flag: Boolean) { + println("setRefreshing = $flag") + refresh.isRefreshing = flag + } + + private fun initRecycler() { + println("initRecycler") + + refresh.setOnRefreshListener { + println("setOnRefreshListener") + + presenter.showCheckUp() + + } + + } + + @SuppressLint("StringFormatInvalid") + override fun fillData(dataTech: DataTech) { + + println("СЕРВЕР = ${dataTech.mechanic_name}") + var profilePhoto: String + var profilePhotoUrl: Uri + var checkupPhoto: String + var checkupPhotoUrl: Uri + var checkupVideoString: String + var checkupVideoUrl: Uri + + + + /* profilePhoto = "${BuildConfig.API_BASE_URL}${dataQR.profilePhoto}" + profilePhotoUrl = profilePhoto.toUri() + checkupPhoto = + "${BuildConfig.API_BASE_URL}${dataQR.checkupPhoto?.replace("/media", "media")}" + checkupPhotoUrl = checkupPhoto.toUri() + checkupVideoString = + "${BuildConfig.API_BASE_URL}${dataQR.checkupVideo?.replace("/media", "media")}" + checkupVideoUrl = checkupVideoString.toUri() + + + tvMainInfoTitle.requestFocus() + + tvMainInfoTitle.text = resources.getString(R.string.block_title_main_info, dataQR.idcheckup) + tvDriverNumber.text = dataQR.login + tvSex.text = dataQR.sex_name + tvSurname.text = dataQR.lastname + tvName.text = dataQR.name + tvPatronymic.text = dataQR.oldlastname + tvBirthday.text = dataQR.birthday + tvOrgName.text = dataQR.organization + tvCheckupDate.text = dataQR.exam_date + tvCheckupBeginTime.text = dataQR.exam_timestart + tvCheckupEndTime.text = dataQR.exam_timeend + tvCheckupType.text = dataQR.inspectiontype + tvCheckupTerminal.text = dataQR.terminal_name + tvCheckupStatus.text = dataQR.exam_state_name + tvCheckupMedic.text = dataQR.medic_fio + tvResultAuto.text = dataQR.exam_result_auto_txt + tvResultMedic.text = dataQR.exam_result_med_txt + tvMedicComment.text = dataQR.medic_comment + tvCheckupResultTime.text = dataQR.exam_result_datetime + // ivCheckupPhoto.setImageURI(checkupPhotoUrl) + + + val mediaController = MediaController(requireContext()) + checkupVideo.setMediaController(mediaController) + mediaController.setMediaPlayer(checkupVideo) + + println("гружу видео $checkupVideoUrl") + println("гружу фото $checkupPhotoUrl") + + checkupVideo.setVideoURI(checkupVideoUrl) + checkupVideo.start() + // checkupVideo.background = null + println("гружу видео start") + // checkupVideo.background = resources.getDrawable(R.drawable.arrow) + /*() checkupVideo.setOnClickListener { + checkupVideo.background = null + checkupVideo.start() + } + + checkupVideo.resume() + checkupVideo.pause() */ + + Glide.with(this).load(checkupPhoto).into(ivCheckupPhoto); + + + // Picasso.get().load(checkupPhotoUrl).rotate(0f).into(ivCheckupPhoto) + Picasso.get().load(profilePhotoUrl).into(ivDriverPhoto) + + + if (dataQR.exam_result_auto == 1) { + tvResultAuto.setBackgroundColor(resources.getColor(R.color.real_green)) + tvResultAuto.setTextColor(resources.getColor(R.color.white)) + } else { + tvResultAuto.setBackgroundColor(resources.getColor(R.color.dark_red)) + tvResultAuto.setTextColor(resources.getColor(R.color.white)) + + } + + if (dataQR.exam_result_auto == 1) { + tvResultMedic.setBackgroundColor(resources.getColor(R.color.real_green)) + tvResultMedic.setTextColor(resources.getColor(R.color.white)) + } else { + tvResultMedic.setBackgroundColor(resources.getColor(R.color.dark_red)) + tvResultMedic.setTextColor(resources.getColor(R.color.white)) + } + + + if (!dataQR.alcotest.isNullOrEmpty()) { + println("не нул") + tvAlkotest.text = dataQR.alcotest + tvSyspressure.text = dataQR.syspressure + tvDiapressure.text = dataQR.diapressure + tvPulse.text = dataQR.pulse + tvCheckupTemperature.text = dataQR.temperature + tvComplaints.text = dataQR.complaints + tvCheckupReference.text = dataQR.epicrisis + } else { + tvCheckupAlkotestTitle.visibility = View.GONE + tvCheckupSyspressureTitle.visibility = View.GONE + tvCheckupDiapressureTitle.visibility = View.GONE + tvCheckupPulseTitle.visibility = View.GONE + tvCheckupTemperatureTitle.visibility = View.GONE + tvComplaintsTitle.visibility = View.GONE + tvCheckupReferenceTitle.visibility = View.GONE + + tvAlkotest.visibility = View.GONE + tvSyspressure.visibility = View.GONE + tvDiapressure.visibility = View.GONE + tvPulse.visibility = View.GONE + tvCheckupTemperature.visibility = View.GONE + tvComplaints.visibility = View.GONE + tvCheckupReference.visibility = View.GONE + + + divider14_.visibility = View.GONE + divider15_.visibility = View.GONE + divider16_.visibility = View.GONE + divider17_.visibility = View.GONE + divider18_.visibility = View.GONE + divider19_.visibility = View.GONE + divider20_.visibility = View.GONE */ + + + } + + + override fun getPresenter(): BasePresenter<*>? = null + + + companion object { + + private const val DATA_QR = "DATA_QR" + fun getInstance(dataTech: String?): TechCheckupInfoFragment { + val gson = Gson() + Log.v("TechCheckupInfoFragment", "dataTech = $dataTech") + + val string: String = gson.toJson(dataTech) + return TechCheckupInfoFragment().also { + it.arguments = Bundle().apply { + putString(TechCheckupInfoFragment.DATA_QR, dataTech) + } + } + + } + + private const val PERMISSION_CAMERA_REQUEST = 1 + private const val RATIO_4_3_VALUE = 4.0 / 3.0 + private const val RATIO_16_9_VALUE = 16.0 / 9.0 + } + +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/info/TechCheckupInfoPresenter.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/info/TechCheckupInfoPresenter.kt new file mode 100644 index 0000000..926cd3d --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/info/TechCheckupInfoPresenter.kt @@ -0,0 +1,61 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info + +import com.arellomobile.mvp.InjectViewState +import com.google.gson.Gson +import ru.tele2med.mobile.presentation.ui.base.BasePresenter +import ru.tele2med.mobile.presentation.ui.base.entity.RestApiCodes +import ru.tele2med.mobile.presentation.util.Prefs +import ru.tele2med.mobile.presentation.util.ioToMain +import io.reactivex.rxkotlin.plusAssign +import ru.tele2med.mobile.data.api.entity.exception.ApiException +import ru.tele2med.mobile.domain.entity.DataTech +import ru.tele2med.mobile.domain.interactor.TechInteractor + +@InjectViewState +class TechCheckupInfoPresenter( + private val techInteractor: TechInteractor, + private val prefs: Prefs, + private val stringId: String +) : BasePresenter() { + + fun onRefresh() { + + } + + fun showCheckUp() { + val gson = Gson() + val data = gson.fromJson(stringId, DataTech::class.java) + println("data RoleName = ${data}") + // viewState.fillData(data) + viewState.setRefreshing(false) + } + + fun get(code: String) { + println("qrcode4 $code") + + disposable += techInteractor + .getTech(code) + .ioToMain() + .doOnSubscribe { + viewState.showLoading() + } + .doAfterTerminate { + viewState.hideLoading() + } + .subscribe({ + + + }, { + if (it is ApiException) { + if (it.code == RestApiCodes.NotFound.code) { + } else { + this.handleError(it) + } + } else { + this.handleError(it) + } + }) + + } + +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/info/TechCheckupInfoView.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/info/TechCheckupInfoView.kt new file mode 100644 index 0000000..c15f181 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/info/TechCheckupInfoView.kt @@ -0,0 +1,15 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info + +import com.arellomobile.mvp.viewstate.strategy.AddToEndSingleStrategy +import com.arellomobile.mvp.viewstate.strategy.StateStrategyType +import ru.tele2med.mobile.domain.entity.DataQR +import ru.tele2med.mobile.domain.entity.DataTech +import ru.tele2med.mobile.presentation.ui.base.BaseView + + +interface TechCheckupInfoView : BaseView { + fun fillData(dataTech: DataTech) + + @StateStrategyType(AddToEndSingleStrategy::class) + fun setRefreshing(flag: Boolean) +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/tests/TechCheckupTestsFragment.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/tests/TechCheckupTestsFragment.kt new file mode 100644 index 0000000..dab8690 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/tests/TechCheckupTestsFragment.kt @@ -0,0 +1,269 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.tests + +import android.annotation.SuppressLint +import android.net.Uri +import android.os.Build +import android.os.Bundle +import android.util.Log +import android.view.View +import android.widget.MediaController +import androidx.annotation.RequiresApi +import androidx.core.net.toUri +import com.arellomobile.mvp.presenter.InjectPresenter +import com.arellomobile.mvp.presenter.ProvidePresenter +import com.bumptech.glide.Glide +import com.google.gson.Gson +import com.squareup.picasso.Picasso +import ru.tele2med.mobile.R +import ru.tele2med.mobile.domain.entity.DataQR +import ru.tele2med.mobile.presentation.ui.base.BasePresenter +import ru.tele2med.mobile.presentation.ui.drawer.entity.ScreenType +import ru.tele2med.mobile.presentation.ui.menu.MenuActivity +import ru.tele2med.mobile.presentation.ui.menu.ReviewActivity +import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuFragment +import ru.tele2med.mobile.presentation.util.providePresenter +import kotlinx.android.synthetic.main.fragment_medical_checkup.* +import kotlinx.android.synthetic.main.toolbar_with_help.* +import ru.tele2med.mobile.BuildConfig +import ru.tele2med.mobile.domain.entity.DataTech +import ru.tele2med.mobile.presentation.ui.menu.items.medicalCheckup.MedicalCheckupFragment +import ru.tele2med.mobile.presentation.ui.menu.items.medicalCheckup.MedicalCheckupPresenter +import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info.TechCheckupInfoFragment + + +class TechCheckupTestsFragment : BaseMenuFragment(), TechCheckupTestsView { + + override val screenType: ScreenType + get() = ScreenType.QR + + @InjectPresenter + lateinit var presenter: TechCheckupTestsPresenter + + + @ProvidePresenter + fun initPresenter(): TechCheckupTestsPresenter = + providePresenter(arguments?.getString(DATA_QR) ?: "") + + + override val layoutId: Int + get() = R.layout.fragment_tech_checkup + + private var root: View? = null // create a global variable which will hold your layout + + + @RequiresApi(Build.VERSION_CODES.O) + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + when (activity) { + is ReviewActivity -> { + (activity as ReviewActivity).apply { + help.visibility = View.GONE + title = "" + // title = getString(R.string.help_toolbar) + // supportActionBar?.setDisplayHomeAsUpEnabled(true) + // showOrHideHelpButton(false) + } + } + is MenuActivity -> { + (activity as MenuActivity).apply { + // addDrawerToggle() + showOrHideHelpButton(false) + title = "" + } + } + } + + tvDriverTitle.focusable + tvDriverTitle.requestFocus() + presenter.showCheckUp() + + initRecycler() + + } + + override fun setRefreshing(flag: Boolean) { + println("setRefreshing = $flag") + refresh.isRefreshing = flag + } + + private fun initRecycler() { + println("initRecycler") + + refresh.setOnRefreshListener { + println("setOnRefreshListener") + + presenter.showCheckUp() + + } + + } + + @SuppressLint("StringFormatInvalid") + override fun fillData(dataTech: DataTech) { + + println("СЕРВЕР = ${prefs.getServer()}") + /* var profilePhoto: String + var profilePhotoUrl: Uri + var checkupPhoto: String + var checkupPhotoUrl: Uri + var checkupVideoString: String + var checkupVideoUrl: Uri + + profilePhoto = "${BuildConfig.API_BASE_URL}${dataQR.profilePhoto}" + profilePhotoUrl = profilePhoto.toUri() + checkupPhoto = + "${BuildConfig.API_BASE_URL}${dataQR.checkupPhoto?.replace("/media", "media")}" + checkupPhotoUrl = checkupPhoto.toUri() + checkupVideoString = + "${BuildConfig.API_BASE_URL}${dataQR.checkupVideo?.replace("/media", "media")}" + checkupVideoUrl = checkupVideoString.toUri() + + + tvMainInfoTitle.requestFocus() + + tvMainInfoTitle.text = resources.getString(R.string.block_title_main_info, dataQR.idcheckup) + tvDriverNumber.text = dataQR.login + tvSex.text = dataQR.sex_name + tvSurname.text = dataQR.lastname + tvName.text = dataQR.name + tvPatronymic.text = dataQR.oldlastname + tvBirthday.text = dataQR.birthday + tvOrgName.text = dataQR.organization + tvCheckupDate.text = dataQR.exam_date + tvCheckupBeginTime.text = dataQR.exam_timestart + tvCheckupEndTime.text = dataQR.exam_timeend + tvCheckupType.text = dataQR.inspectiontype + tvCheckupTerminal.text = dataQR.terminal_name + tvCheckupStatus.text = dataQR.exam_state_name + tvCheckupMedic.text = dataQR.medic_fio + tvResultAuto.text = dataQR.exam_result_auto_txt + tvResultMedic.text = dataQR.exam_result_med_txt + tvMedicComment.text = dataQR.medic_comment + tvCheckupResultTime.text = dataQR.exam_result_datetime + // ivCheckupPhoto.setImageURI(checkupPhotoUrl) + + + val mediaController = MediaController(requireContext()) + checkupVideo.setMediaController(mediaController) + mediaController.setMediaPlayer(checkupVideo) + + println("гружу видео $checkupVideoUrl") + println("гружу фото $checkupPhotoUrl") + + checkupVideo.setVideoURI(checkupVideoUrl) + checkupVideo.start() + // checkupVideo.background = null + println("гружу видео start") + // checkupVideo.background = resources.getDrawable(R.drawable.arrow) + /*() checkupVideo.setOnClickListener { + checkupVideo.background = null + checkupVideo.start() + } + + checkupVideo.resume() + checkupVideo.pause() */ + + Glide.with(this).load(checkupPhoto).into(ivCheckupPhoto); + + + // Picasso.get().load(checkupPhotoUrl).rotate(0f).into(ivCheckupPhoto) + Picasso.get().load(profilePhotoUrl).into(ivDriverPhoto) + + + if (dataQR.exam_result_auto == 1) { + tvResultAuto.setBackgroundColor(resources.getColor(R.color.real_green)) + tvResultAuto.setTextColor(resources.getColor(R.color.white)) + } else { + tvResultAuto.setBackgroundColor(resources.getColor(R.color.dark_red)) + tvResultAuto.setTextColor(resources.getColor(R.color.white)) + + } + + if (dataQR.exam_result_auto == 1) { + tvResultMedic.setBackgroundColor(resources.getColor(R.color.real_green)) + tvResultMedic.setTextColor(resources.getColor(R.color.white)) + } else { + tvResultMedic.setBackgroundColor(resources.getColor(R.color.dark_red)) + tvResultMedic.setTextColor(resources.getColor(R.color.white)) + } + + + if (!dataQR.alcotest.isNullOrEmpty()) { + println("не нул") + tvAlkotest.text = dataQR.alcotest + tvSyspressure.text = dataQR.syspressure + tvDiapressure.text = dataQR.diapressure + tvPulse.text = dataQR.pulse + tvCheckupTemperature.text = dataQR.temperature + tvComplaints.text = dataQR.complaints + tvCheckupReference.text = dataQR.epicrisis + } else { + tvCheckupAlkotestTitle.visibility = View.GONE + tvCheckupSyspressureTitle.visibility = View.GONE + tvCheckupDiapressureTitle.visibility = View.GONE + tvCheckupPulseTitle.visibility = View.GONE + tvCheckupTemperatureTitle.visibility = View.GONE + tvComplaintsTitle.visibility = View.GONE + tvCheckupReferenceTitle.visibility = View.GONE + + tvAlkotest.visibility = View.GONE + tvSyspressure.visibility = View.GONE + tvDiapressure.visibility = View.GONE + tvPulse.visibility = View.GONE + tvCheckupTemperature.visibility = View.GONE + tvComplaints.visibility = View.GONE + tvCheckupReference.visibility = View.GONE + + + divider14_.visibility = View.GONE + divider15_.visibility = View.GONE + divider16_.visibility = View.GONE + divider17_.visibility = View.GONE + divider18_.visibility = View.GONE + divider19_.visibility = View.GONE + divider20_.visibility = View.GONE + + + }*/ + + } + + fun play(view: View?) { + checkupVideo.start() + } + + fun pause(view: View?) { + checkupVideo.pause() + } + + fun stop(view: View?) { + checkupVideo.stopPlayback() + checkupVideo.resume() + } + + + override fun getPresenter(): BasePresenter<*>? = null + + + companion object { + + private const val DATA_QR = "DATA_QR" + fun getInstance(dataTech: String?): TechCheckupTestsFragment { + val gson = Gson() + Log.v("TechCheckupTestsFragment", "dataTech = $dataTech") + + val string: String = gson.toJson(dataTech) + return TechCheckupTestsFragment().also { + it.arguments = Bundle().apply { + putString(DATA_QR, dataTech) + } + } + + } + + private const val PERMISSION_CAMERA_REQUEST = 1 + private const val RATIO_4_3_VALUE = 4.0 / 3.0 + private const val RATIO_16_9_VALUE = 16.0 / 9.0 + } + +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/tests/TechCheckupTestsPresenter.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/tests/TechCheckupTestsPresenter.kt new file mode 100644 index 0000000..bd3744a --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/tests/TechCheckupTestsPresenter.kt @@ -0,0 +1,61 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.tests + +import com.arellomobile.mvp.InjectViewState +import com.google.gson.Gson +import ru.tele2med.mobile.presentation.ui.base.BasePresenter +import ru.tele2med.mobile.presentation.ui.base.entity.RestApiCodes +import ru.tele2med.mobile.presentation.util.Prefs +import ru.tele2med.mobile.presentation.util.ioToMain +import io.reactivex.rxkotlin.plusAssign +import ru.tele2med.mobile.data.api.entity.exception.ApiException +import ru.tele2med.mobile.domain.entity.DataTech +import ru.tele2med.mobile.domain.interactor.TechInteractor + +@InjectViewState +class TechCheckupTestsPresenter( + private val techInteractor: TechInteractor, + private val prefs: Prefs, + private val stringId: String +) : BasePresenter() { + + fun onRefresh() { + + } + + fun showCheckUp() { + val gson = Gson() + val data = gson.fromJson(stringId, DataTech::class.java) + println("data stringId = ${stringId}") + // viewState.fillData(data) + viewState.setRefreshing(false) + } + + fun get(code: String) { + println("qrcode4 $code") + + disposable += techInteractor + .getTech(code) + .ioToMain() + .doOnSubscribe { + viewState.showLoading() + } + .doAfterTerminate { + viewState.hideLoading() + } + .subscribe({ + + + }, { + if (it is ApiException) { + if (it.code == RestApiCodes.NotFound.code) { + } else { + this.handleError(it) + } + } else { + this.handleError(it) + } + }) + + } + +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/tests/TechCheckupTestsView.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/tests/TechCheckupTestsView.kt new file mode 100644 index 0000000..da041b2 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/list/techCheckup/tests/TechCheckupTestsView.kt @@ -0,0 +1,15 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.tests + +import com.arellomobile.mvp.viewstate.strategy.AddToEndSingleStrategy +import com.arellomobile.mvp.viewstate.strategy.StateStrategyType +import ru.tele2med.mobile.domain.entity.DataQR +import ru.tele2med.mobile.domain.entity.DataTech +import ru.tele2med.mobile.presentation.ui.base.BaseView + + +interface TechCheckupTestsView : BaseView { + fun fillData(dataTech: DataTech) + + @StateStrategyType(AddToEndSingleStrategy::class) + fun setRefreshing(flag: Boolean) +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkFragment.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkFragment.kt new file mode 100644 index 0000000..6cc30db --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkFragment.kt @@ -0,0 +1,49 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.park + +import android.os.Bundle +import android.view.View +import com.arellomobile.mvp.presenter.InjectPresenter +import com.arellomobile.mvp.presenter.ProvidePresenter +import ru.tele2med.mobile.R +import ru.tele2med.mobile.presentation.ui.base.BasePresenter +import ru.tele2med.mobile.presentation.ui.drawer.entity.ScreenType +import ru.tele2med.mobile.presentation.ui.menu.MenuActivity +import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuFragment +import ru.tele2med.mobile.presentation.util.providePresenter + +class ParkFragment : BaseMenuFragment(), ParkView { + + override val screenType: ScreenType + get() = ScreenType.WITHOUT_BORDER + + @InjectPresenter + lateinit var presenter: ParkPresenter + + private var errorDialog: androidx.appcompat.app.AlertDialog? = null + + + @ProvidePresenter + fun initPresenter(): ParkPresenter = providePresenter() + + override fun getPresenter(): BasePresenter<*>? = presenter + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + (activity as MenuActivity).apply { + addDrawerToggle() + title = getString(R.string.park_toolbar) + } + + } + + + + override val layoutId: Int + get() = R.layout.fragment_park + + + + companion object { + fun getInstance() = ParkFragment() + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkPresenter.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkPresenter.kt new file mode 100644 index 0000000..0a94a8c --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkPresenter.kt @@ -0,0 +1,27 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.park + +import com.arellomobile.mvp.InjectViewState +import io.reactivex.rxkotlin.plusAssign +import ru.tele2med.mobile.domain.entity.Position +import ru.tele2med.mobile.domain.interactor.SosInteractor +import ru.tele2med.mobile.presentation.Changes +import ru.tele2med.mobile.presentation.router.NavRouter +import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuPresenter +import ru.tele2med.mobile.presentation.util.ioToMain + + +@InjectViewState +class ParkPresenter( + private val sosInteractor: SosInteractor, + private val navRouter: NavRouter, + private val changes: Changes +) : BaseMenuPresenter() { + + private var position: Position? = null + + override fun onFirstViewAttach() { + super.onFirstViewAttach() + + } + +} diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkScreen.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkScreen.kt new file mode 100644 index 0000000..0baa850 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkScreen.kt @@ -0,0 +1,15 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.park + +import androidx.fragment.app.Fragment +import ru.terrakok.cicerone.android.support.SupportAppScreen + +class ParkScreen : SupportAppScreen() { + + override fun getFragment(): Fragment { + return ParkFragment.getInstance() + } + + override fun getScreenKey(): String { + return ParkFragment::class.java.name + } +} \ No newline at end of file diff --git a/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkView.kt b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkView.kt new file mode 100644 index 0000000..c734220 --- /dev/null +++ b/app/src/main/java/ru/tele2med/mobile/presentation/ui/menu/items/tech/park/ParkView.kt @@ -0,0 +1,9 @@ +package ru.tele2med.mobile.presentation.ui.menu.items.tech.park + +import com.arellomobile.mvp.viewstate.strategy.SkipStrategy +import com.arellomobile.mvp.viewstate.strategy.StateStrategyType +import ru.tele2med.mobile.presentation.ui.base.BaseView + +interface ParkView : BaseView { + +} \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_park.xml b/app/src/main/res/layout/fragment_park.xml new file mode 100644 index 0000000..eebc8a7 --- /dev/null +++ b/app/src/main/res/layout/fragment_park.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_tech.xml b/app/src/main/res/layout/fragment_tech.xml new file mode 100644 index 0000000..fd4a144 --- /dev/null +++ b/app/src/main/res/layout/fragment_tech.xml @@ -0,0 +1,617 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +