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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_tech_checkup.xml b/app/src/main/res/layout/fragment_tech_checkup.xml
new file mode 100644
index 0000000..26d54b4
--- /dev/null
+++ b/app/src/main/res/layout/fragment_tech_checkup.xml
@@ -0,0 +1,786 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_tech_list.xml b/app/src/main/res/layout/fragment_tech_list.xml
index 2acdea5..9ea4b07 100644
--- a/app/src/main/res/layout/fragment_tech_list.xml
+++ b/app/src/main/res/layout/fragment_tech_list.xml
@@ -1,58 +1,13 @@
-
+ android:layout_height="match_parent"
+ android:orientation="vertical">
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_techs.xml b/app/src/main/res/layout/fragment_techs.xml
new file mode 100644
index 0000000..e5f79ea
--- /dev/null
+++ b/app/src/main/res/layout/fragment_techs.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_tech.xml b/app/src/main/res/layout/item_tech.xml
new file mode 100644
index 0000000..98c5d2d
--- /dev/null
+++ b/app/src/main/res/layout/item_tech.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 693e9eb..5dd87eb 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -481,4 +481,6 @@
Технический осмотр автомобиля
+
+ Hello blank fragment
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..ce8487b
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,105 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ ext {
+ kotlin_version = '1.6.0'
+ gradle_version = '4.1.1'
+ google_services_version = '4.3.3'
+ fabric_gradle_version = '1.31.2'
+
+ // Android
+ multidex_version = '2.0.1'
+ appcompat_version = '1.1.0'
+ ktx_version = '1.2.0'
+ constraint_version = '1.1.3'
+
+ // Google
+ material_version = '1.0.0'
+ crashlytics_version = '2.10.1'
+ play_services_location_version = '17.0.0'
+
+ // Db
+ // Room
+ room_version = '2.2.5'
+
+ // Di
+ kodein_version = '6.5.0'
+
+ // Moxy
+ moxy_version = '1.7.0'
+
+ // Rx
+ rx_kotlin_version = '2.3.0'
+ rx_android_version = '2.1.1'
+ rx_java_version = '2.2.6'
+ rx_relay_version = '2.1.0'
+
+ // OkHttp
+ okhttp_version = '3.12.1'
+
+ // Retrofit
+ retrofit_version = '2.5.0'
+
+ // Picasso
+ picasso_version = '2.71828'
+ picasso_transf_version = '2.2.1'
+
+ // Cicerone
+ cicerone_version = '5.0.0'
+
+ // Ui
+ santalu_mask_et_version = '1.1.1'
+ poovam_pin_et_version = '1.2.1'
+ cachapa_explayout_version = '2.9.2'
+
+ // Yandex maps
+ yandex_maps_version = '3.4.0'
+
+ // Anko
+ anko_version = '0.10.8'
+
+ // Debug
+ timber_version = '4.7.1'
+ debugdrawer_version = '0.8.0'
+ chuck_version = '1.1.0'
+ lynx_version = '1.1.0'
+
+ // Tests
+ mockk_version = '1.9.3'
+ junit_version = '5.3.1'
+ junit_ext_version = '1.1.1'
+ espresso_version = '3.2.0'
+ }
+ repositories {
+ google()
+ jcenter()
+ mavenCentral()
+ maven {
+ url 'https://maven.fabric.io/public'
+ }
+ }
+
+ dependencies {
+ classpath "com.android.tools.build:gradle:$gradle_version"
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
+ classpath "io.fabric.tools:gradle:$fabric_gradle_version"
+ classpath "com.google.gms:google-services:$google_services_version"
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ mavenCentral()
+ maven {
+ url 'https://jitpack.io'
+ }
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/conf.ini b/conf.ini
new file mode 100644
index 0000000..9fe2a5f
--- /dev/null
+++ b/conf.ini
@@ -0,0 +1,6 @@
+3.0
+Мобайл Теле2Мед
+mobile_tele2med
+02.08.2023 10:00:00
+010323_0800
+image from qr dont rotate
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..20e2618
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,23 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
+# Kotlin code style for this project: "official" or "obsolete":
+kotlin.code.style=official
+
+
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..f6b961f
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..d3b04d4
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Oct 26 10:31:11 MSK 2020
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/keystore.jks b/keystore.jks
new file mode 100644
index 0000000..37b81cc
Binary files /dev/null and b/keystore.jks differ
diff --git a/keystore_tele2med.jks b/keystore_tele2med.jks
new file mode 100644
index 0000000..3f78627
Binary files /dev/null and b/keystore_tele2med.jks differ
diff --git a/lib/AndroidManifest.xml b/lib/AndroidManifest.xml
new file mode 100644
index 0000000..1bea627
--- /dev/null
+++ b/lib/AndroidManifest.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build.gradle b/lib/build.gradle
new file mode 100644
index 0000000..3164db9
--- /dev/null
+++ b/lib/build.gradle
@@ -0,0 +1,19 @@
+apply plugin: 'android-library'
+
+android {
+
+ // Define these properties in the gradle.properties file in the root project folder
+ compileSdkVersion 33
+ buildToolsVersion "29.0.3"
+
+ defaultConfig {
+ minSdkVersion 26
+ targetSdkVersion 33
+ }
+
+ sourceSets.main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = ['src']
+ res.srcDirs = ['res']
+ }
+}
diff --git a/lib/build.xml b/lib/build.xml
new file mode 100644
index 0000000..dbb2595
--- /dev/null
+++ b/lib/build.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/build/generated/source/buildConfig/debug/com/mapwithme/maps/api/BuildConfig.java b/lib/build/generated/source/buildConfig/debug/com/mapwithme/maps/api/BuildConfig.java
new file mode 100644
index 0000000..d684e1d
--- /dev/null
+++ b/lib/build/generated/source/buildConfig/debug/com/mapwithme/maps/api/BuildConfig.java
@@ -0,0 +1,10 @@
+/**
+ * Automatically generated file. DO NOT MODIFY
+ */
+package com.mapwithme.maps.api;
+
+public final class BuildConfig {
+ public static final boolean DEBUG = Boolean.parseBoolean("true");
+ public static final String LIBRARY_PACKAGE_NAME = "com.mapwithme.maps.api";
+ public static final String BUILD_TYPE = "debug";
+}
diff --git a/lib/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml b/lib/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml
new file mode 100644
index 0000000..3349626
--- /dev/null
+++ b/lib/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json b/lib/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json
new file mode 100644
index 0000000..9d92d63
--- /dev/null
+++ b/lib/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json
@@ -0,0 +1,16 @@
+{
+ "version": 2,
+ "artifactType": {
+ "type": "AAPT_FRIENDLY_MERGED_MANIFESTS",
+ "kind": "Directory"
+ },
+ "applicationId": "com.mapwithme.maps.api",
+ "variantName": "debug",
+ "elements": [
+ {
+ "type": "SINGLE",
+ "filters": [],
+ "outputFile": "AndroidManifest.xml"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/lib/build/intermediates/aar_main_jar/debug/classes.jar b/lib/build/intermediates/aar_main_jar/debug/classes.jar
new file mode 100644
index 0000000..9996bf7
Binary files /dev/null and b/lib/build/intermediates/aar_main_jar/debug/classes.jar differ
diff --git a/lib/build/intermediates/aar_metadata/debug/aar-metadata.properties b/lib/build/intermediates/aar_metadata/debug/aar-metadata.properties
new file mode 100644
index 0000000..d8560bd
--- /dev/null
+++ b/lib/build/intermediates/aar_metadata/debug/aar-metadata.properties
@@ -0,0 +1,2 @@
+aarFormatVersion=1.0
+aarMetadataVersion=1.0
diff --git a/lib/build/intermediates/annotation_processor_list/debug/annotationProcessors.json b/lib/build/intermediates/annotation_processor_list/debug/annotationProcessors.json
new file mode 100644
index 0000000..9e26dfe
--- /dev/null
+++ b/lib/build/intermediates/annotation_processor_list/debug/annotationProcessors.json
@@ -0,0 +1 @@
+{}
\ No newline at end of file
diff --git a/lib/build/intermediates/annotations_typedef_file/debug/typedefs.txt b/lib/build/intermediates/annotations_typedef_file/debug/typedefs.txt
new file mode 100644
index 0000000..e69de29
diff --git a/lib/build/intermediates/compile_r_class_jar/debug/R.jar b/lib/build/intermediates/compile_r_class_jar/debug/R.jar
new file mode 100644
index 0000000..5994b0f
Binary files /dev/null and b/lib/build/intermediates/compile_r_class_jar/debug/R.jar differ
diff --git a/lib/build/intermediates/compile_symbol_list/debug/R.txt b/lib/build/intermediates/compile_symbol_list/debug/R.txt
new file mode 100644
index 0000000..709c7e3
--- /dev/null
+++ b/lib/build/intermediates/compile_symbol_list/debug/R.txt
@@ -0,0 +1,18 @@
+int drawable background_pattern 0x0
+int drawable btn_back_gray 0x0
+int drawable btn_back_gray_active 0x0
+int drawable btn_back_green 0x0
+int drawable btn_back_green_active 0x0
+int drawable btn_gray_selector 0x0
+int drawable btn_green_selector 0x0
+int drawable gray 0x0
+int drawable green 0x0
+int drawable overflow 0x0
+int drawable pattern 0x0
+int drawable shadow 0x0
+int id btn_pro 0x0
+int layout dlg_install_mwm 0x0
+int string down_pro 0x0
+int string mwm_should_be_installed 0x0
+int string url_pro 0x0
+int style promoButton 0x0
diff --git a/lib/build/intermediates/incremental/debug-mergeJavaRes/merge-state b/lib/build/intermediates/incremental/debug-mergeJavaRes/merge-state
new file mode 100644
index 0000000..d5ff387
Binary files /dev/null and b/lib/build/intermediates/incremental/debug-mergeJavaRes/merge-state differ
diff --git a/lib/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml b/lib/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml
new file mode 100644
index 0000000..5850f3a
--- /dev/null
+++ b/lib/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/incremental/mergeDebugShaders/merger.xml b/lib/build/intermediates/incremental/mergeDebugShaders/merger.xml
new file mode 100644
index 0000000..78b9387
--- /dev/null
+++ b/lib/build/intermediates/incremental/mergeDebugShaders/merger.xml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/incremental/packageDebugAssets/merger.xml b/lib/build/intermediates/incremental/packageDebugAssets/merger.xml
new file mode 100644
index 0000000..605a7b1
--- /dev/null
+++ b/lib/build/intermediates/incremental/packageDebugAssets/merger.xml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/incremental/packageDebugResources/compile-file-map.properties b/lib/build/intermediates/incremental/packageDebugResources/compile-file-map.properties
new file mode 100644
index 0000000..cdb26d7
--- /dev/null
+++ b/lib/build/intermediates/incremental/packageDebugResources/compile-file-map.properties
@@ -0,0 +1,14 @@
+#Tue Apr 09 14:49:42 MSK 2024
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\drawable\\overflow.xml=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\drawable\\overflow.xml
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\drawable\\btn_green_selector.xml=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\drawable\\btn_green_selector.xml
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\drawable\\btn_gray_selector.xml=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\drawable\\btn_gray_selector.xml
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\drawable\\green.xml=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\drawable\\green.xml
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\drawable\\btn_back_gray_active.xml=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\drawable\\btn_back_gray_active.xml
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\layout\\dlg_install_mwm.xml=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\layout\\dlg_install_mwm.xml
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\drawable\\pattern.png=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\drawable\\pattern.png
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\drawable\\gray.xml=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\drawable\\gray.xml
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\drawable\\btn_back_green_active.xml=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\drawable\\btn_back_green_active.xml
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\drawable\\background_pattern.xml=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\drawable\\background_pattern.xml
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\drawable\\shadow.xml=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\drawable\\shadow.xml
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\drawable\\btn_back_gray.xml=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\drawable\\btn_back_gray.xml
+F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\res\\drawable\\btn_back_green.xml=F\:\\24marchD\\android\\mobile_tele2med_2024\\lib\\build\\intermediates\\packaged_res\\debug\\drawable\\btn_back_green.xml
diff --git a/lib/build/intermediates/incremental/packageDebugResources/merged.dir/values/values.xml b/lib/build/intermediates/incremental/packageDebugResources/merged.dir/values/values.xml
new file mode 100644
index 0000000..588ce58
--- /dev/null
+++ b/lib/build/intermediates/incremental/packageDebugResources/merged.dir/values/values.xml
@@ -0,0 +1,13 @@
+
+
+ Download MAPS.ME
+ Offline maps are required to proceed. We have partnered with MAPS.ME to provide you with offline maps of the entire world.\nTo continue please download the app:
+ http://maps.me/get
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/incremental/packageDebugResources/merger.xml b/lib/build/intermediates/incremental/packageDebugResources/merger.xml
new file mode 100644
index 0000000..d37ed28
--- /dev/null
+++ b/lib/build/intermediates/incremental/packageDebugResources/merger.xml
@@ -0,0 +1,8 @@
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/javac/debug/classes/com/mapwithme/maps/api/BuildConfig.class b/lib/build/intermediates/javac/debug/classes/com/mapwithme/maps/api/BuildConfig.class
new file mode 100644
index 0000000..33e08ee
Binary files /dev/null and b/lib/build/intermediates/javac/debug/classes/com/mapwithme/maps/api/BuildConfig.class differ
diff --git a/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/Const.class b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/Const.class
new file mode 100644
index 0000000..612c655
Binary files /dev/null and b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/Const.class differ
diff --git a/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/DownloadMapsWithMeDialog.class b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/DownloadMapsWithMeDialog.class
new file mode 100644
index 0000000..81ec70b
Binary files /dev/null and b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/DownloadMapsWithMeDialog.class differ
diff --git a/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MWMPoint$Style.class b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MWMPoint$Style.class
new file mode 100644
index 0000000..6cd67dc
Binary files /dev/null and b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MWMPoint$Style.class differ
diff --git a/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MWMPoint.class b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MWMPoint.class
new file mode 100644
index 0000000..7d6046f
Binary files /dev/null and b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MWMPoint.class differ
diff --git a/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MWMResponse.class b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MWMResponse.class
new file mode 100644
index 0000000..819e21e
Binary files /dev/null and b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MWMResponse.class differ
diff --git a/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MapsWithMeApi.class b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MapsWithMeApi.class
new file mode 100644
index 0000000..64f6356
Binary files /dev/null and b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MapsWithMeApi.class differ
diff --git a/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MwmRequest.class b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MwmRequest.class
new file mode 100644
index 0000000..b75faf5
Binary files /dev/null and b/lib/build/intermediates/javac/debug/classes/ru/mapswithme/maps/api/MwmRequest.class differ
diff --git a/lib/build/intermediates/library_manifest/debug/AndroidManifest.xml b/lib/build/intermediates/library_manifest/debug/AndroidManifest.xml
new file mode 100644
index 0000000..3349626
--- /dev/null
+++ b/lib/build/intermediates/library_manifest/debug/AndroidManifest.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/local_only_symbol_list/debug/R-def.txt b/lib/build/intermediates/local_only_symbol_list/debug/R-def.txt
new file mode 100644
index 0000000..d2d6df8
--- /dev/null
+++ b/lib/build/intermediates/local_only_symbol_list/debug/R-def.txt
@@ -0,0 +1,20 @@
+R_DEF: Internal format may change without notice
+local
+drawable background_pattern
+drawable btn_back_gray
+drawable btn_back_gray_active
+drawable btn_back_green
+drawable btn_back_green_active
+drawable btn_gray_selector
+drawable btn_green_selector
+drawable gray
+drawable green
+drawable overflow
+drawable pattern
+drawable shadow
+id btn_pro
+layout dlg_install_mwm
+string down_pro
+string mwm_should_be_installed
+string url_pro
+style promoButton
diff --git a/lib/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt b/lib/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt
new file mode 100644
index 0000000..e0b775e
--- /dev/null
+++ b/lib/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt
@@ -0,0 +1,16 @@
+1
+2
+6
+7 F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+9 android:targetSdkVersion="33" />
+9-->F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+10
+11
+11-->F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:6:5-20
+12
+13
diff --git a/lib/build/intermediates/merged_java_res/debug/out.jar b/lib/build/intermediates/merged_java_res/debug/out.jar
new file mode 100644
index 0000000..15cb0ec
Binary files /dev/null and b/lib/build/intermediates/merged_java_res/debug/out.jar differ
diff --git a/lib/build/intermediates/packaged_manifests/debug/output-metadata.json b/lib/build/intermediates/packaged_manifests/debug/output-metadata.json
new file mode 100644
index 0000000..0863f17
--- /dev/null
+++ b/lib/build/intermediates/packaged_manifests/debug/output-metadata.json
@@ -0,0 +1,16 @@
+{
+ "version": 2,
+ "artifactType": {
+ "type": "PACKAGED_MANIFESTS",
+ "kind": "Directory"
+ },
+ "applicationId": "com.mapwithme.maps.api",
+ "variantName": "debug",
+ "elements": [
+ {
+ "type": "SINGLE",
+ "filters": [],
+ "outputFile": "../../library_manifest/debug/AndroidManifest.xml"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/lib/build/intermediates/packaged_res/debug/drawable/background_pattern.xml b/lib/build/intermediates/packaged_res/debug/drawable/background_pattern.xml
new file mode 100644
index 0000000..2293a51
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/drawable/background_pattern.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/lib/build/intermediates/packaged_res/debug/drawable/btn_back_gray.xml b/lib/build/intermediates/packaged_res/debug/drawable/btn_back_gray.xml
new file mode 100644
index 0000000..445902c
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/drawable/btn_back_gray.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/packaged_res/debug/drawable/btn_back_gray_active.xml b/lib/build/intermediates/packaged_res/debug/drawable/btn_back_gray_active.xml
new file mode 100644
index 0000000..a4d6310
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/drawable/btn_back_gray_active.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/packaged_res/debug/drawable/btn_back_green.xml b/lib/build/intermediates/packaged_res/debug/drawable/btn_back_green.xml
new file mode 100644
index 0000000..b647551
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/drawable/btn_back_green.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/packaged_res/debug/drawable/btn_back_green_active.xml b/lib/build/intermediates/packaged_res/debug/drawable/btn_back_green_active.xml
new file mode 100644
index 0000000..49e849f
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/drawable/btn_back_green_active.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/packaged_res/debug/drawable/btn_gray_selector.xml b/lib/build/intermediates/packaged_res/debug/drawable/btn_gray_selector.xml
new file mode 100644
index 0000000..3876bb0
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/drawable/btn_gray_selector.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/packaged_res/debug/drawable/btn_green_selector.xml b/lib/build/intermediates/packaged_res/debug/drawable/btn_green_selector.xml
new file mode 100644
index 0000000..61b78df
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/drawable/btn_green_selector.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/packaged_res/debug/drawable/gray.xml b/lib/build/intermediates/packaged_res/debug/drawable/gray.xml
new file mode 100644
index 0000000..f3fda93
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/drawable/gray.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/packaged_res/debug/drawable/green.xml b/lib/build/intermediates/packaged_res/debug/drawable/green.xml
new file mode 100644
index 0000000..c7afb64
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/drawable/green.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/packaged_res/debug/drawable/overflow.xml b/lib/build/intermediates/packaged_res/debug/drawable/overflow.xml
new file mode 100644
index 0000000..f507765
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/drawable/overflow.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/packaged_res/debug/drawable/pattern.png b/lib/build/intermediates/packaged_res/debug/drawable/pattern.png
new file mode 100644
index 0000000..33b8d96
Binary files /dev/null and b/lib/build/intermediates/packaged_res/debug/drawable/pattern.png differ
diff --git a/lib/build/intermediates/packaged_res/debug/drawable/shadow.xml b/lib/build/intermediates/packaged_res/debug/drawable/shadow.xml
new file mode 100644
index 0000000..4c241c4
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/drawable/shadow.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/packaged_res/debug/layout/dlg_install_mwm.xml b/lib/build/intermediates/packaged_res/debug/layout/dlg_install_mwm.xml
new file mode 100644
index 0000000..1858369
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/layout/dlg_install_mwm.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/packaged_res/debug/values/values.xml b/lib/build/intermediates/packaged_res/debug/values/values.xml
new file mode 100644
index 0000000..588ce58
--- /dev/null
+++ b/lib/build/intermediates/packaged_res/debug/values/values.xml
@@ -0,0 +1,13 @@
+
+
+ Download MAPS.ME
+ Offline maps are required to proceed. We have partnered with MAPS.ME to provide you with offline maps of the entire world.\nTo continue please download the app:
+ http://maps.me/get
+
+
\ No newline at end of file
diff --git a/lib/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt b/lib/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt
new file mode 100644
index 0000000..d506339
--- /dev/null
+++ b/lib/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt
@@ -0,0 +1,19 @@
+com.mapwithme.maps.api
+drawable background_pattern
+drawable btn_back_gray
+drawable btn_back_gray_active
+drawable btn_back_green
+drawable btn_back_green_active
+drawable btn_gray_selector
+drawable btn_green_selector
+drawable gray
+drawable green
+drawable overflow
+drawable pattern
+drawable shadow
+id btn_pro
+layout dlg_install_mwm
+string down_pro
+string mwm_should_be_installed
+string url_pro
+style promoButton
diff --git a/lib/build/outputs/aar/mapsme-debug.aar b/lib/build/outputs/aar/mapsme-debug.aar
new file mode 100644
index 0000000..f8fe76a
Binary files /dev/null and b/lib/build/outputs/aar/mapsme-debug.aar differ
diff --git a/lib/build/outputs/logs/manifest-merger-debug-report.txt b/lib/build/outputs/logs/manifest-merger-debug-report.txt
new file mode 100644
index 0000000..cc9e89e
--- /dev/null
+++ b/lib/build/outputs/logs/manifest-merger-debug-report.txt
@@ -0,0 +1,39 @@
+-- Merging decision tree log ---
+manifest
+ADDED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:1:1-8:12
+INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:1:1-8:12
+INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:1:1-8:12
+INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:1:1-8:12
+INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:1:1-8:12
+INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:1:1-8:12
+INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:1:1-8:12
+ package
+ ADDED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:2:5-37
+ INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+ INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+ android:versionName
+ ADDED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:4:5-30
+ INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+ INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+ xmlns:android
+ ADDED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:1:11-69
+ android:versionCode
+ ADDED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:3:5-28
+ INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+ INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+application
+ADDED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml:6:5-20
+uses-sdk
+INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml reason: use-sdk injection requested
+INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+ android:targetSdkVersion
+ INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+ ADDED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+ INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+ android:minSdkVersion
+ INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+ ADDED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
+ INJECTED from F:\24marchD\android\mobile_tele2med_2024\lib\AndroidManifest.xml
diff --git a/lib/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt b/lib/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt
new file mode 100644
index 0000000..f40e65a
--- /dev/null
+++ b/lib/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt
@@ -0,0 +1,15 @@
+ru/mapswithme/maps/api/MapsWithMeApi.java
+ ru.mapswithme.maps.api.MapsWithMeApi
+ru/mapswithme/maps/api/MWMPoint.java
+ ru.mapswithme.maps.api.MWMPoint
+ ru.mapswithme.maps.api.MWMPoint$Style
+com/mapwithme/maps/api/BuildConfig.java
+ com.mapwithme.maps.api.BuildConfig
+ru/mapswithme/maps/api/Const.java
+ ru.mapswithme.maps.api.Const
+ru/mapswithme/maps/api/MWMResponse.java
+ ru.mapswithme.maps.api.MWMResponse
+ru/mapswithme/maps/api/MwmRequest.java
+ ru.mapswithme.maps.api.MwmRequest
+ru/mapswithme/maps/api/DownloadMapsWithMeDialog.java
+ ru.mapswithme.maps.api.DownloadMapsWithMeDialog
diff --git a/lib/project.properties b/lib/project.properties
new file mode 100644
index 0000000..93c8c3c
--- /dev/null
+++ b/lib/project.properties
@@ -0,0 +1,15 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-21
+android.library=true
diff --git a/lib/res/drawable/background_pattern.xml b/lib/res/drawable/background_pattern.xml
new file mode 100644
index 0000000..2293a51
--- /dev/null
+++ b/lib/res/drawable/background_pattern.xml
@@ -0,0 +1,5 @@
+
+
diff --git a/lib/res/drawable/btn_back_gray.xml b/lib/res/drawable/btn_back_gray.xml
new file mode 100644
index 0000000..445902c
--- /dev/null
+++ b/lib/res/drawable/btn_back_gray.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/res/drawable/btn_back_gray_active.xml b/lib/res/drawable/btn_back_gray_active.xml
new file mode 100644
index 0000000..a4d6310
--- /dev/null
+++ b/lib/res/drawable/btn_back_gray_active.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/res/drawable/btn_back_green.xml b/lib/res/drawable/btn_back_green.xml
new file mode 100644
index 0000000..b647551
--- /dev/null
+++ b/lib/res/drawable/btn_back_green.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/res/drawable/btn_back_green_active.xml b/lib/res/drawable/btn_back_green_active.xml
new file mode 100644
index 0000000..49e849f
--- /dev/null
+++ b/lib/res/drawable/btn_back_green_active.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/res/drawable/btn_gray_selector.xml b/lib/res/drawable/btn_gray_selector.xml
new file mode 100644
index 0000000..3876bb0
--- /dev/null
+++ b/lib/res/drawable/btn_gray_selector.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/res/drawable/btn_green_selector.xml b/lib/res/drawable/btn_green_selector.xml
new file mode 100644
index 0000000..61b78df
--- /dev/null
+++ b/lib/res/drawable/btn_green_selector.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/res/drawable/gray.xml b/lib/res/drawable/gray.xml
new file mode 100644
index 0000000..f3fda93
--- /dev/null
+++ b/lib/res/drawable/gray.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/res/drawable/green.xml b/lib/res/drawable/green.xml
new file mode 100644
index 0000000..c7afb64
--- /dev/null
+++ b/lib/res/drawable/green.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/res/drawable/overflow.xml b/lib/res/drawable/overflow.xml
new file mode 100644
index 0000000..f507765
--- /dev/null
+++ b/lib/res/drawable/overflow.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/res/drawable/pattern.png b/lib/res/drawable/pattern.png
new file mode 100644
index 0000000..33b8d96
Binary files /dev/null and b/lib/res/drawable/pattern.png differ
diff --git a/lib/res/drawable/shadow.xml b/lib/res/drawable/shadow.xml
new file mode 100644
index 0000000..4c241c4
--- /dev/null
+++ b/lib/res/drawable/shadow.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/res/layout/dlg_install_mwm.xml b/lib/res/layout/dlg_install_mwm.xml
new file mode 100644
index 0000000..1858369
--- /dev/null
+++ b/lib/res/layout/dlg_install_mwm.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/res/values/strings.xml b/lib/res/values/strings.xml
new file mode 100644
index 0000000..d9e3f27
--- /dev/null
+++ b/lib/res/values/strings.xml
@@ -0,0 +1,6 @@
+
+
+ Offline maps are required to proceed. We have partnered with MAPS.ME to provide you with offline maps of the entire world.\nTo continue please download the app:
+ Download MAPS.ME
+ http://maps.me/get
+
\ No newline at end of file
diff --git a/lib/res/values/styles.xml b/lib/res/values/styles.xml
new file mode 100644
index 0000000..e9c52fa
--- /dev/null
+++ b/lib/res/values/styles.xml
@@ -0,0 +1,10 @@
+
+
+
+
diff --git a/lib/src/ru/mapswithme/maps/api/Const.java b/lib/src/ru/mapswithme/maps/api/Const.java
new file mode 100644
index 0000000..eba9f52
--- /dev/null
+++ b/lib/src/ru/mapswithme/maps/api/Const.java
@@ -0,0 +1,55 @@
+/******************************************************************************
+ Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list
+ of conditions and the following disclaimer. Redistributions in binary form must
+ reproduce the above copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ OF SUCH DAMAGE.
+******************************************************************************/
+package ru.mapswithme.maps.api;
+
+public class Const
+{
+
+ /* Request extras */
+ static final String AUTHORITY = "com.mapswithme.maps.api";
+ public static final String EXTRA_URL = AUTHORITY + ".url";
+ public static final String EXTRA_TITLE = AUTHORITY + ".title";
+ public static final String EXTRA_API_VERSION = AUTHORITY + ".version";
+ public static final String EXTRA_CALLER_APP_INFO = AUTHORITY + ".caller_app_info";
+ public static final String EXTRA_HAS_PENDING_INTENT = AUTHORITY + ".has_pen_intent";
+ public static final String EXTRA_CALLER_PENDING_INTENT = AUTHORITY + ".pending_intent";
+ public static final String EXTRA_RETURN_ON_BALLOON_CLICK = AUTHORITY + ".return_on_balloon_click";
+ public static final String EXTRA_PICK_POINT = AUTHORITY + ".pick_point";
+ public static final String EXTRA_CUSTOM_BUTTON_NAME = AUTHORITY + ".custom_button_name";
+
+
+ /* Response extras */
+ /* Point part-by-part*/
+ public static final String EXTRA_MWM_RESPONSE_POINT_NAME = AUTHORITY + ".point_name";
+ public static final String EXTRA_MWM_RESPONSE_POINT_LAT = AUTHORITY + ".point_lat";
+ public static final String EXTRA_MWM_RESPONSE_POINT_LON = AUTHORITY + ".point_lon";
+ public static final String EXTRA_MWM_RESPONSE_POINT_ID = AUTHORITY + ".point_id";
+ public static final String EXTRA_MWM_RESPONSE_ZOOM = AUTHORITY + ".zoom_level";
+
+
+ public static final String ACTION_MWM_REQUEST = AUTHORITY + ".request";
+ static final int API_VERSION = 2;
+ static final String CALLBACK_PREFIX = "mapswithme.client.";
+
+ private Const() {}
+}
diff --git a/lib/src/ru/mapswithme/maps/api/DownloadMapsWithMeDialog.java b/lib/src/ru/mapswithme/maps/api/DownloadMapsWithMeDialog.java
new file mode 100644
index 0000000..06802ce
--- /dev/null
+++ b/lib/src/ru/mapswithme/maps/api/DownloadMapsWithMeDialog.java
@@ -0,0 +1,64 @@
+/******************************************************************************
+ Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list
+ of conditions and the following disclaimer. Redistributions in binary form must
+ reproduce the above copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ OF SUCH DAMAGE.
+******************************************************************************/
+package ru.mapswithme.maps.api;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.content.Intent;
+import android.net.Uri;
+import android.view.View;
+import android.view.Window;
+
+import com.mapwithme.maps.api.R;
+
+public class DownloadMapsWithMeDialog extends Dialog implements android.view.View.OnClickListener
+{
+
+ public DownloadMapsWithMeDialog(Activity activity)
+ {
+ super(activity);
+
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ setContentView(R.layout.dlg_install_mwm);
+
+ findViewById(R.id.btn_pro).setOnClickListener(this);
+
+ setOwnerActivity(activity);
+ }
+
+
+ public void onDownloadButtonClicked(String url)
+ {
+ Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ getContext().startActivity(i);
+ dismiss();
+ }
+
+
+ @Override
+ public void onClick(View v)
+ {
+ String url = getContext().getString(R.string.url_pro);
+ onDownloadButtonClicked(url);
+ }
+}
diff --git a/lib/src/ru/mapswithme/maps/api/MWMPoint.java b/lib/src/ru/mapswithme/maps/api/MWMPoint.java
new file mode 100644
index 0000000..c406e55
--- /dev/null
+++ b/lib/src/ru/mapswithme/maps/api/MWMPoint.java
@@ -0,0 +1,164 @@
+/******************************************************************************
+ Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list
+ of conditions and the following disclaimer. Redistributions in binary form must
+ reproduce the above copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ OF SUCH DAMAGE.
+******************************************************************************/
+package ru.mapswithme.maps.api;
+
+import java.io.Serializable;
+
+/**
+ * POI wrapper object.
+ * Has its equals()
and hashCode()
methods overloaded
+ * so could be used in Hash(Map/Set/etc) classes.
+ */
+public final class MWMPoint implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ final private double mLat;
+ final private double mLon;
+ final private String mName;
+ private String mId;
+ private Style mStyle;
+
+ public MWMPoint(double lat, double lon, String name)
+ {
+ this(lat, lon, name, null);
+ }
+
+ public MWMPoint(double lat, double lon, String name, String id)
+ {
+ this.mLat = lat;
+ this.mLon = lon;
+ this.mName = name;
+ this.mId = id;
+ }
+
+ public MWMPoint(double lat, double lon, String name, String id, Style style)
+ {
+ this.mLat = lat;
+ this.mLon = lon;
+ this.mName = name;
+ this.mId = id;
+ this.mStyle = style;
+ }
+
+ public double getLat() { return mLat; }
+ public double getLon() { return mLon; }
+ public String getName() { return mName; }
+ public String getId() { return mId; }
+ public Style getStyle() { return mStyle; }
+
+ public String getStyleForUrl() { return (mStyle == null) ? null : mStyle.getName(); }
+
+ /**
+ * Sets string ID for this point. Internally it is not used to distinguish point,
+ * it's purpose to help clients code to associate point with domain objects of their application.
+ * @param id
+ */
+ public void setId(String id) { mId = id; }
+
+ /**
+ * Sets the style (appearance) for this point.
+ *
+ * @param style Style to use, or null for default (violet circle).
+ */
+ public void setStyle(Style style)
+ {
+ this.mStyle = style;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "MWMPoint [lat=" + mLat +
+ ", lon=" + mLon +
+ ", name=" + mName +
+ ", id=" + mId +
+ ", style=" + mStyle + "]";
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ long temp;
+ temp = Double.doubleToLongBits(mLat);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ temp = Double.doubleToLongBits(mLon);
+ result = prime * result + (int) (temp ^ (temp >>> 32));
+ result = prime * result + ((mName == null) ? 0 : mName.hashCode());
+ return result;
+ }
+
+ /**
+ * Two point are considered
+ * equal if they have they lat, lon, and name attributes equal.
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final MWMPoint other = (MWMPoint) obj;
+ if (Double.doubleToLongBits(mLat) != Double.doubleToLongBits(other.mLat))
+ return false;
+ if (Double.doubleToLongBits(mLon) != Double.doubleToLongBits(other.mLon))
+ return false;
+
+ return mName == null ? other.mName == null : mName.equals(other.mName);
+ }
+
+ /**
+ * Supported styles for MAPS.ME. Each appears as a small flag of the appropriate colour.
+ */
+ public enum Style
+ {
+ PlacemarkRed("placemark-red"),
+ PlacemarkBlue("placemark-blue"),
+ PlacemarkPurple("placemark-purple"),
+ PlacemarkYellow("placemark-yellow"),
+ PlacemarkPink("placemark-pink"),
+ PlacemarkBrown("placemark-brown"),
+ PlacemarkGreen("placemark-green"),
+ PlacemarkOrange("placemark-orange");
+
+ private String name;
+
+ private Style(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * @return name as it should appear in the MAPS.ME URL.
+ */
+ private String getName()
+ {
+ return name;
+ }
+ }
+}
diff --git a/lib/src/ru/mapswithme/maps/api/MWMResponse.java b/lib/src/ru/mapswithme/maps/api/MWMResponse.java
new file mode 100644
index 0000000..24d401a
--- /dev/null
+++ b/lib/src/ru/mapswithme/maps/api/MWMResponse.java
@@ -0,0 +1,77 @@
+/******************************************************************************
+ Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list
+ of conditions and the following disclaimer. Redistributions in binary form must
+ reproduce the above copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ OF SUCH DAMAGE.
+******************************************************************************/
+package ru.mapswithme.maps.api;
+
+import android.content.Context;
+import android.content.Intent;
+
+public class MWMResponse
+{
+ private MWMPoint mPoint;
+ private double mZoomLevel;
+
+ /**
+ *
+ * @return point, for which user requested more information in MapsWithMe application.
+ */
+ public MWMPoint getPoint() { return mPoint; }
+ public boolean hasPoint() { return mPoint != null; }
+ public double getZoomLevel() { return mZoomLevel; }
+
+ @Override
+ public String toString()
+ {
+ return "MWMResponse [SelectedPoint=" + mPoint + "]";
+ }
+
+ /**
+ * Factory method to extract response data from intent.
+ *
+ * @param context
+ * @param intent
+ * @return
+ */
+ public static MWMResponse extractFromIntent(Context context, Intent intent)
+ {
+ final MWMResponse response = new MWMResponse();
+ // parse point
+ final double lat = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LAT, INVALID_LL);
+ final double lon = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_POINT_LON, INVALID_LL);
+ final String name = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_NAME);
+ final String id = intent.getStringExtra(Const.EXTRA_MWM_RESPONSE_POINT_ID);
+
+ // parse additional info
+ response.mZoomLevel = intent.getDoubleExtra(Const.EXTRA_MWM_RESPONSE_ZOOM, 9);
+
+ if (lat != INVALID_LL && lon != INVALID_LL)
+ response.mPoint = new MWMPoint(lat, lon, name, id);
+ else
+ response.mPoint = null;
+
+ return response;
+ }
+
+ private final static double INVALID_LL = Double.MIN_VALUE;
+
+ private MWMResponse() {}
+}
diff --git a/lib/src/ru/mapswithme/maps/api/MapsWithMeApi.java b/lib/src/ru/mapswithme/maps/api/MapsWithMeApi.java
new file mode 100644
index 0000000..0886ec6
--- /dev/null
+++ b/lib/src/ru/mapswithme/maps/api/MapsWithMeApi.java
@@ -0,0 +1,159 @@
+/******************************************************************************
+ Copyright (c) 2013, MapsWithMe GmbH All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list
+ of conditions and the following disclaimer. Redistributions in binary form must
+ reproduce the above copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ OF SUCH DAMAGE.
+ ******************************************************************************/
+package ru.mapswithme.maps.api;
+
+import android.app.Activity;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.net.Uri;
+
+
+public final class MapsWithMeApi
+{
+
+ /**
+ * Most detailed level, buildings and trees are seen.
+ */
+ public static final double ZOOM_MAX = 19;
+ /**
+ * Least detailed level, continents are seen.
+ */
+ public static final double ZOOM_MIN = 1;
+
+
+ public static void showMapsWithMeUrl(Activity caller, PendingIntent pendingIntent, double zoomLevel, String url)
+ {
+ final Uri uri = Uri.parse(url);
+ final String latlon[] = uri.getQueryParameter("ll").split(",");
+ final double lat = Double.parseDouble(latlon[0]);
+ final double lon = Double.parseDouble(latlon[1]);
+ final String name = uri.getQueryParameter("n");
+ final String id = uri.getQueryParameter("id");
+
+ showPointsOnMap(caller, name, zoomLevel, pendingIntent, new MWMPoint(lat, lon, name, id));
+ }
+
+ public static void sendRequest(Activity caller, MwmRequest request)
+ {
+ final Intent mwmIntent = request.toIntent(caller);
+
+ if (isMapsWithMeInstalled(caller))
+ {
+ // Match activity for intent
+ final ActivityInfo aInfo = caller.getPackageManager().resolveActivity(mwmIntent, 0).activityInfo;
+ mwmIntent.setClassName(aInfo.packageName, aInfo.name);
+ caller.startActivity(mwmIntent);
+ }
+ else
+ (new DownloadMapsWithMeDialog(caller)).show();
+ }
+
+ /**
+ * Shows single point on the map.
+ *
+ * @param caller
+ * @param lat
+ * @param lon
+ * @param name
+ */
+ public static void showPointOnMap(Activity caller, double lat, double lon, String name)
+ {
+ showPointsOnMap(caller, (String) null, (PendingIntent) null, new MWMPoint(lat, lon, name));
+ }
+
+ /**
+ * Shows single point on the map using specified zoom level in range from
+ * {@link MapsWithMeApi#ZOOM_MIN} to {@link MapsWithMeApi#ZOOM_MAX}.
+ *
+ * @param caller
+ * @param lat
+ * @param lon
+ * @param name
+ * @param zoomLevel
+ */
+ public static void showPointOnMap(Activity caller, double lat, double lon, String name, double zoomLevel)
+ {
+ showPointsOnMap(caller, (String) null, zoomLevel, (PendingIntent) null, new MWMPoint(lat, lon, name));
+ }
+
+ /**
+ * Shows set of points on the map.
+ *
+ * @param caller
+ * @param title
+ * @param points
+ */
+ public static void showPointsOnMap(Activity caller, String title, MWMPoint... points)
+ {
+ showPointsOnMap(caller, title, null, points);
+ }
+
+ /**
+ * Shows set of points on the maps and allows MapsWithMeApplication to send
+ * {@link PendingIntent} provided by client application.
+ *
+ * @param caller
+ * @param title
+ * @param pendingIntent
+ * @param points
+ */
+ public static void showPointsOnMap(Activity caller, String title, PendingIntent pendingIntent, MWMPoint... points)
+ {
+ showPointsOnMap(caller, title, -1, pendingIntent, points);
+ }
+
+ private static void showPointsOnMap(Activity caller, String title, double zoomLevel, PendingIntent pendingIntent,
+ MWMPoint... points)
+ {
+ final MwmRequest request = new MwmRequest()
+ .setTitle(title)
+ .setZoomLevel(zoomLevel)
+ .setPendingIntent(pendingIntent)
+ .setPoints(points);
+ sendRequest(caller, request);
+ }
+
+ public static void pickPoint(Activity caller, String title, PendingIntent pi)
+ {
+ final MwmRequest request = new MwmRequest()
+ .setTitle(title)
+ .setPickPointMode(true)
+ .setPendingIntent(pi);
+ sendRequest(caller, request);
+ }
+
+ /**
+ * Detects if any version (Lite, Pro) of MapsWithMe, which supports API calls
+ * are installed on the device.
+ *
+ * @param context
+ * @return
+ */
+ public static boolean isMapsWithMeInstalled(Context context)
+ {
+ final Intent intent = new Intent(Const.ACTION_MWM_REQUEST);
+ return context.getPackageManager().resolveActivity(intent, 0) != null;
+ }
+}
diff --git a/lib/src/ru/mapswithme/maps/api/MwmRequest.java b/lib/src/ru/mapswithme/maps/api/MwmRequest.java
new file mode 100644
index 0000000..4ee1a15
--- /dev/null
+++ b/lib/src/ru/mapswithme/maps/api/MwmRequest.java
@@ -0,0 +1,174 @@
+package ru.mapswithme.maps.api;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Locale;
+
+import android.annotation.SuppressLint;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+
+public class MwmRequest
+{
+
+ // **
+ private List mPoints = new ArrayList();
+ private PendingIntent mPendingIntent;
+ private String mTitle;
+ private double mZoomLevel = 1;
+ private boolean mReturnOnBalloonClick;
+ private boolean mPickPoint = false;
+ private String mCustomButtonName = "";
+ // **
+
+ public MwmRequest setCustomButtonName(String buttonName)
+ {
+ mCustomButtonName = buttonName != null ? buttonName : "";
+ return this;
+ }
+
+ public MwmRequest setTitle(String title)
+ {
+ mTitle = title;
+ return this;
+ }
+
+ public MwmRequest setPickPointMode(boolean pickPoint)
+ {
+ mPickPoint = pickPoint;
+ return this;
+ }
+
+ public MwmRequest addPoint(MWMPoint point)
+ {
+ mPoints.add(point);
+ return this;
+ }
+
+ public MwmRequest addPoint(double lat, double lon, String name, String id)
+ {
+ return addPoint(new MWMPoint(lat, lon, name, id));
+ }
+
+ public MwmRequest setPoints(Collection points)
+ {
+ mPoints = new ArrayList(points);
+ return this;
+ }
+
+ public MwmRequest setReturnOnBalloonClick(boolean doReturn)
+ {
+ mReturnOnBalloonClick = doReturn;
+ return this;
+ }
+
+ public MwmRequest setZoomLevel(double zoomLevel)
+ {
+ mZoomLevel = zoomLevel;
+ return this;
+ }
+
+ public MwmRequest setPendingIntent(PendingIntent pi)
+ {
+ mPendingIntent = pi;
+ return this;
+ }
+
+ public Intent toIntent(Context context)
+ {
+ final Intent mwmIntent = new Intent(Const.ACTION_MWM_REQUEST);
+
+ // url
+ final String mwmUrl = createMwmUrl(context, mTitle, mZoomLevel, mPoints).toString();
+ mwmIntent.putExtra(Const.EXTRA_URL, mwmUrl);
+ // title
+ mwmIntent.putExtra(Const.EXTRA_TITLE, mTitle);
+ // more
+ mwmIntent.putExtra(Const.EXTRA_RETURN_ON_BALLOON_CLICK, mReturnOnBalloonClick);
+ // pick point
+ mwmIntent.putExtra(Const.EXTRA_PICK_POINT, mPickPoint);
+ // custom button name
+ mwmIntent.putExtra(Const.EXTRA_CUSTOM_BUTTON_NAME, mCustomButtonName);
+
+ final boolean hasIntent = mPendingIntent != null;
+ mwmIntent.putExtra(Const.EXTRA_HAS_PENDING_INTENT, hasIntent);
+ if (hasIntent)
+ mwmIntent.putExtra(Const.EXTRA_CALLER_PENDING_INTENT, mPendingIntent);
+
+ addCommonExtras(context, mwmIntent);
+
+ return mwmIntent;
+ }
+
+ /**
+ * @Hidden
+ * This method is internal only.
+ * Used for compatibility.
+ */
+ MwmRequest setPoints(MWMPoint[] points)
+ {
+ return setPoints(Arrays.asList(points));
+ }
+
+ // Below are utilities from MapsWithMeApi because we are not "Feature Envy"
+
+ private static StringBuilder createMwmUrl(Context context, String title, double zoomLevel, List points)
+ {
+ final StringBuilder urlBuilder = new StringBuilder("mapswithme://map?");
+ // version
+ urlBuilder.append("v=").append(Const.API_VERSION).append("&");
+ // back url, always not null
+ urlBuilder.append("backurl=").append(getCallbackAction(context)).append("&");
+ // title
+ appendIfNotNull(urlBuilder, "appname", title);
+ // zoom
+ appendIfNotNull(urlBuilder, "z", isValidZoomLevel(zoomLevel) ? String.valueOf(zoomLevel) : null);
+
+ // points
+ for (final MWMPoint point : points)
+ {
+ if (point != null)
+ {
+ urlBuilder.append("ll=").append(String.format(Locale.US, "%f,%f&", point.getLat(), point.getLon()));
+
+ appendIfNotNull(urlBuilder, "n", point.getName());
+ appendIfNotNull(urlBuilder, "id", point.getId());
+ appendIfNotNull(urlBuilder, "s", point.getStyleForUrl());
+ }
+ }
+
+ return urlBuilder;
+ }
+
+ private static String getCallbackAction(Context context)
+ {
+ return Const.CALLBACK_PREFIX + context.getPackageName();
+ }
+
+ @SuppressLint("NewApi")
+ private static Intent addCommonExtras(Context context, Intent intent)
+ {
+ intent.putExtra(Const.EXTRA_CALLER_APP_INFO, context.getApplicationInfo());
+ intent.putExtra(Const.EXTRA_API_VERSION, Const.API_VERSION);
+
+ return intent;
+ }
+
+ private static StringBuilder appendIfNotNull(StringBuilder builder, String key, String value)
+ {
+ if (value != null)
+ builder.append(key).append("=").append(Uri.encode(value)).append("&");
+
+ return builder;
+ }
+
+ private static boolean isValidZoomLevel(double zoom)
+ {
+ return zoom >= MapsWithMeApi.ZOOM_MIN && zoom <= MapsWithMeApi.ZOOM_MAX;
+ }
+
+}
diff --git a/library/.gitignore b/library/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/library/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/library/build.gradle b/library/build.gradle
new file mode 100644
index 0000000..61d63e4
--- /dev/null
+++ b/library/build.gradle
@@ -0,0 +1,37 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+
+android {
+ compileSdkVersion 33
+ buildToolsVersion "29.0.3"
+
+
+ defaultConfig {
+ minSdkVersion 26
+ targetSdkVersion 33
+ versionCode 2
+ versionName "2.0.0"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles 'consumer-rules.pro'
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+}
+
+dependencies {
+ implementation 'androidx.core:core:1.3.0'
+ implementation 'androidx.core:core-ktx:1.3.0'
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7"
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1"
+}
+repositories {
+ mavenCentral()
+}
diff --git a/library/consumer-rules.pro b/library/consumer-rules.pro
new file mode 100644
index 0000000..e69de29
diff --git a/library/proguard-rules.pro b/library/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/library/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/library/src/main/AndroidManifest.xml b/library/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..0815552
--- /dev/null
+++ b/library/src/main/AndroidManifest.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/library/src/main/java/ru/homesoft/encoder/FrameBuilder.kt b/library/src/main/java/ru/homesoft/encoder/FrameBuilder.kt
new file mode 100644
index 0000000..fcbd59f
--- /dev/null
+++ b/library/src/main/java/ru/homesoft/encoder/FrameBuilder.kt
@@ -0,0 +1,215 @@
+package ru.homesoft.encoder
+
+import android.content.Context
+import android.content.res.AssetFileDescriptor
+import android.graphics.Bitmap
+import android.graphics.BitmapFactory
+import android.graphics.Canvas
+import android.graphics.Rect
+import android.media.*
+import android.media.MediaCodecList.REGULAR_CODECS
+import android.os.Build
+import android.util.Log
+import android.view.Surface
+import androidx.annotation.RawRes
+import java.io.IOException
+import java.nio.ByteBuffer
+
+/*
+ * Copyright (C) 2020 Israel Flores
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const val TAG = "FrameBuilder"
+const val VERBOSE: Boolean = false
+const val SECOND_IN_USEC = 1000000
+const val TIMEOUT_USEC = 10000
+
+class FrameBuilder(
+ private val context: Context,
+ private val muxerConfig: MuxerConfig) {
+
+ private val mediaFormat: MediaFormat = run {
+ val format = MediaFormat.createVideoFormat(muxerConfig.mimeType, muxerConfig
+ .videoWidth, muxerConfig.videoHeight)
+
+ // Set some properties. Failing to specify some of these can cause the MediaCodec
+ // configure() call to throw an unhelpful exception.
+ format.setInteger(MediaFormat.KEY_COLOR_FORMAT,
+ MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface)
+ format.setInteger(MediaFormat.KEY_BIT_RATE, muxerConfig.bitrate)
+ format.setFloat(MediaFormat.KEY_FRAME_RATE, muxerConfig.framesPerSecond)
+ format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, muxerConfig.iFrameInterval)
+ format
+ }
+
+ private val mediaCodec: MediaCodec = run {
+ val codecs = MediaCodecList(REGULAR_CODECS)
+ MediaCodec.createByCodecName(codecs.findEncoderForFormat(mediaFormat))
+ }
+
+ private val bufferInfo: MediaCodec.BufferInfo = MediaCodec.BufferInfo()
+ private var frameMuxer: FrameMuxer = muxerConfig.frameMuxer
+
+ private var surface: Surface? = null
+ private var rect: Rect? = null
+
+
+ /**
+ * @throws IOException
+ */
+ fun start() {
+ mediaCodec.configure(mediaFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE)
+ surface = mediaCodec.createInputSurface()
+ mediaCodec.start()
+ drainCodec(false)
+ }
+
+ fun createFrame(image: Any) {
+ for (i in 0 until muxerConfig.framesPerImage) {
+ val canvas = createCanvas()
+ when (image) {
+ is Int -> {
+ Log.i(TAG, "Trying to decode as @DrawableRes")
+ val bitmap = BitmapFactory.decodeResource(context.resources, image)
+ drawBitmapAndPostCanvas(bitmap, canvas)
+ }
+ is Bitmap -> drawBitmapAndPostCanvas(image, canvas)
+ is Canvas -> postCanvasFrame(image)
+ else -> Log.e(TAG, "Image type $image is not supported. Try using a Canvas or a Bitmap")
+ }
+ }
+ }
+
+ private fun createCanvas(): Canvas? {
+ return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ surface?.lockHardwareCanvas()
+ } else {
+ surface?.lockCanvas(rect)
+ }
+ }
+
+ /**
+ *
+ * @param canvas acquired from createCanvas()
+ */
+ private fun drawBitmapAndPostCanvas(bitmap: Bitmap, canvas: Canvas?) {
+ canvas?.drawBitmap(bitmap, 0f, 0f, null)
+ postCanvasFrame(canvas)
+ }
+
+ /**
+ *
+ * @param canvas acquired from createCanvas()
+ */
+ private fun postCanvasFrame(canvas: Canvas?) {
+ surface?.unlockCanvasAndPost(canvas)
+ drainCodec(false)
+ }
+
+ /**
+ * Extracts all pending data from the encoder.
+ *
+ *
+ * If endOfStream is not set, this returns when there is no more data to drain. If it
+ * is set, we send EOS to the encoder, and then iterate until we see EOS on the output.
+ * Calling this with endOfStream set should be done once, right before stopping the muxer.
+ *
+ * Borrows heavily from https://bigflake.com/mediacodec/EncodeAndMuxTest.java.txt
+ */
+ private fun drainCodec(endOfStream: Boolean) {
+ if (VERBOSE) Log.d(TAG, "drainCodec($endOfStream)")
+ if (endOfStream) {
+ if (VERBOSE) Log.d(TAG, "sending EOS to encoder")
+ mediaCodec.signalEndOfInputStream()
+ }
+ var encoderOutputBuffers: Array? = mediaCodec.getOutputBuffers()
+ while (true) {
+ val encoderStatus: Int = mediaCodec.dequeueOutputBuffer(bufferInfo, TIMEOUT_USEC
+ .toLong())
+ if (encoderStatus == MediaCodec.INFO_TRY_AGAIN_LATER) {
+ // no output available yet
+ if (!endOfStream) {
+ break // out of while
+ } else {
+ if (VERBOSE) Log.d(TAG, "no output available, spinning to await EOS")
+ }
+ } else if (encoderStatus == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
+ // not expected for an encoder
+ encoderOutputBuffers = mediaCodec.getOutputBuffers()
+ } else if (encoderStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
+ // should happen before receiving buffers, and should only happen once
+ if (frameMuxer.isStarted()) {
+ throw RuntimeException("format changed twice")
+ }
+ val newFormat: MediaFormat = mediaCodec.outputFormat
+ Log.d(TAG, "encoder output format changed: $newFormat")
+
+ // now that we have the Magic Goodies, start the muxer
+ frameMuxer.start(newFormat)
+ } else if (encoderStatus < 0) {
+ Log.wtf(TAG, "unexpected result from encoder.dequeueOutputBuffer: $encoderStatus")
+ // let's ignore it
+ } else {
+ val encodedData = encoderOutputBuffers?.get(encoderStatus)
+ ?: throw RuntimeException("encoderOutputBuffer $encoderStatus was null")
+ if (bufferInfo.flags and MediaCodec.BUFFER_FLAG_CODEC_CONFIG != 0) {
+ // The codec config data was pulled out and fed to the muxer when we got
+ // the INFO_OUTPUT_FORMAT_CHANGED status. Ignore it.
+ if (VERBOSE) Log.d(TAG, "ignoring BUFFER_FLAG_CODEC_CONFIG")
+ bufferInfo.size = 0
+ }
+ if (bufferInfo.size != 0) {
+ if (!frameMuxer.isStarted()) {
+ throw RuntimeException("muxer hasn't started")
+ }
+ frameMuxer.muxVideoFrame(encodedData, bufferInfo)
+ if (VERBOSE) Log.d(TAG, "sent " + bufferInfo.size + " bytes to muxer")
+ }
+ mediaCodec.releaseOutputBuffer(encoderStatus, false)
+ if (bufferInfo.flags and MediaCodec.BUFFER_FLAG_END_OF_STREAM != 0) {
+ if (!endOfStream) {
+ Log.w(TAG, "reached end of stream unexpectedly")
+ } else {
+ if (VERBOSE) Log.d(TAG, "end of stream reached")
+ }
+ break // out of while
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Releases encoder resources. May be called after partial / failed initialization.
+ */
+ fun releaseVideoCodec() {
+ // Release the video layer
+ if (VERBOSE) Log.d(TAG, "releasing encoder objects")
+ drainCodec(true)
+ mediaCodec.stop()
+ mediaCodec.release()
+ surface?.release()
+ }
+
+ fun releaseAudioExtractor() {
+ // audioExtractor?.release()
+ }
+
+ fun releaseMuxer() {
+ // Release MediaMuxer
+ frameMuxer.release()
+ }
+
+}
diff --git a/library/src/main/java/ru/homesoft/encoder/FrameMuxer.kt b/library/src/main/java/ru/homesoft/encoder/FrameMuxer.kt
new file mode 100644
index 0000000..7c10b08
--- /dev/null
+++ b/library/src/main/java/ru/homesoft/encoder/FrameMuxer.kt
@@ -0,0 +1,37 @@
+package ru.homesoft.encoder
+
+import android.media.MediaCodec
+import android.media.MediaExtractor
+import android.media.MediaFormat
+import java.nio.ByteBuffer
+
+/*
+ * Copyright (C) 2020 Homesoft, LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+interface FrameMuxer {
+
+ fun isStarted(): Boolean
+
+ fun start(videoFormat: MediaFormat, audioExtractor: MediaExtractor? = null)
+
+ fun muxVideoFrame(byteBuffer: ByteBuffer, bufferInfo: MediaCodec.BufferInfo)
+
+ fun muxAudioFrame(encodedData: ByteBuffer, audioBufferInfo: MediaCodec.BufferInfo)
+
+ fun release()
+
+ fun getVideoTime(): Long
+
+}
diff --git a/library/src/main/java/ru/homesoft/encoder/Mp4FrameMuxer.kt b/library/src/main/java/ru/homesoft/encoder/Mp4FrameMuxer.kt
new file mode 100644
index 0000000..651c8f5
--- /dev/null
+++ b/library/src/main/java/ru/homesoft/encoder/Mp4FrameMuxer.kt
@@ -0,0 +1,84 @@
+package ru.homesoft.encoder
+
+import android.media.MediaCodec
+import android.media.MediaExtractor
+import android.media.MediaFormat
+import android.media.MediaMuxer
+import android.util.Log
+import java.nio.ByteBuffer
+import java.util.concurrent.TimeUnit
+
+/*
+ * Copyright (C) 2020 Homesoft, LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+class Mp4FrameMuxer(path: String, private val fps: Float) : FrameMuxer {
+ companion object {
+ private val TAG: String = Mp4FrameMuxer::class.java.simpleName
+ }
+
+ private val frameUsec: Long = run {
+ (TimeUnit.SECONDS.toMicros(1L) / fps).toLong()
+ }
+
+ private val muxer: MediaMuxer = MediaMuxer(path, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4)
+
+ private var started = false
+ private var videoTrackIndex = 0
+ private var audioTrackIndex = 0
+ private var videoFrames = 0
+ private var finalVideoTime: Long = 0
+
+ override fun isStarted(): Boolean {
+ return started
+ }
+
+ override fun start(videoFormat: MediaFormat, audioExtractor: MediaExtractor?) {
+ // now that we have the Magic Goodies, start the muxer
+ audioExtractor?.selectTrack(0)
+ val audioFormat = audioExtractor?.getTrackFormat(0)
+ videoTrackIndex = muxer.addTrack(videoFormat)
+ audioFormat?.run {
+ audioTrackIndex = muxer.addTrack(audioFormat)
+ Log.e("Audio format: %s", audioFormat.toString())
+ }
+ Log.d("Video format: %s", videoFormat.toString())
+ muxer.start()
+ started = true
+ }
+
+ override fun muxVideoFrame(encodedData: ByteBuffer, bufferInfo: MediaCodec.BufferInfo) {
+ // This code will break if the encoder supports B frames.
+ // Ideally we would use set the value in the encoder,
+ // don't know how to do that without using OpenGL
+ finalVideoTime = frameUsec * videoFrames++
+ bufferInfo.presentationTimeUs = finalVideoTime
+
+ muxer.writeSampleData(videoTrackIndex, encodedData, bufferInfo)
+ }
+
+ override fun muxAudioFrame(encodedData: ByteBuffer, audioBufferInfo: MediaCodec.BufferInfo) {
+ muxer.writeSampleData(audioTrackIndex, encodedData, audioBufferInfo)
+ }
+
+ override fun release() {
+ muxer.stop()
+ muxer.release()
+ }
+
+ override fun getVideoTime(): Long {
+ return finalVideoTime
+ }
+}
diff --git a/library/src/main/java/ru/homesoft/encoder/Muxer.kt b/library/src/main/java/ru/homesoft/encoder/Muxer.kt
new file mode 100644
index 0000000..39665d4
--- /dev/null
+++ b/library/src/main/java/ru/homesoft/encoder/Muxer.kt
@@ -0,0 +1,111 @@
+package ru.homesoft.encoder
+
+import android.content.Context
+import android.graphics.Bitmap
+import android.graphics.Canvas
+import android.media.MediaCodecList
+import android.media.MediaCodecList.REGULAR_CODECS
+import android.util.Log
+import androidx.annotation.RawRes
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Dispatchers
+import java.io.File
+import java.io.IOException
+
+/*
+ * Copyright (C) 2020 Israel Flores
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+class Muxer(private val context: Context, private val file: File) {
+ constructor(context: Context, config: MuxerConfig) : this(context, config.file) {
+ muxerConfig = config
+ }
+
+ companion object {
+ private val TAG = Muxer::class.java.simpleName
+ }
+
+ // Initialize a default configuration
+ private var muxerConfig: MuxerConfig = MuxerConfig(file)
+ private var muxingCompletionListener: MuxingCompletionListener? = null
+
+ /**
+ * Build the Muxer with a custom [MuxerConfig]
+ *
+ * @param config: muxer configuration object
+ */
+ fun setMuxerConfig(config: MuxerConfig) {
+ muxerConfig = config
+ }
+
+ fun getMuxerConfig() = muxerConfig
+
+ /**
+ * List containing images in any of the following formats:
+ * [Bitmap] [@DrawRes Int] [Canvas]
+ */
+ fun mux(imageList: List): MuxingResult {
+ // Returns on a callback a finished video
+ Log.d(TAG, "Generating video")
+ val frameBuilder = FrameBuilder(context, muxerConfig)
+
+ try {
+ frameBuilder.start()
+ } catch (e: IOException) {
+ Log.e(TAG, "Start Encoder Failed")
+ e.printStackTrace()
+ muxingCompletionListener?.onVideoError(e)
+ return MuxingError("Start encoder failed", e)
+ }
+
+ for (image in imageList) {
+ frameBuilder.createFrame(image)
+ }
+
+ // Release the video codec so we can mux in the audio frames separately
+ frameBuilder.releaseVideoCodec()
+
+ // Add audio
+
+
+ // Release everything
+ // frameBuilder.releaseAudioExtractor()
+ frameBuilder.releaseMuxer()
+
+ muxingCompletionListener?.onVideoSuccessful(file)
+ return MuxingSuccess(file)
+ }
+
+ suspend fun muxAsync(imageList: List): MuxingResult {
+ return mux(imageList)
+ }
+
+ fun setOnMuxingCompletedListener(muxingCompletionListener: MuxingCompletionListener) {
+ this.muxingCompletionListener = muxingCompletionListener
+ }
+}
+
+fun isCodecSupported(mimeType: String?): Boolean {
+ val codecs = MediaCodecList(REGULAR_CODECS)
+ for (codec in codecs.codecInfos) {
+ if (!codec.isEncoder) {
+ continue
+ }
+ for (type in codec.supportedTypes) {
+ if (type == mimeType) return true
+ }
+ }
+ return false
+}
diff --git a/library/src/main/java/ru/homesoft/encoder/MuxerConfiguration.kt b/library/src/main/java/ru/homesoft/encoder/MuxerConfiguration.kt
new file mode 100644
index 0000000..5e3fc10
--- /dev/null
+++ b/library/src/main/java/ru/homesoft/encoder/MuxerConfiguration.kt
@@ -0,0 +1,48 @@
+package ru.homesoft.encoder
+
+import android.media.MediaFormat
+import java.io.File
+
+/*
+ * Copyright (C) 2020 Israel Flores
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+data class MuxerConfig(
+ var file: File,
+ var videoWidth: Int = 320,
+ var videoHeight: Int = 240,
+ var mimeType: String = MediaFormat.MIMETYPE_VIDEO_AVC,
+ var framesPerImage: Int = 1,
+ var framesPerSecond: Float = 10F,
+ var bitrate: Int = 1500000,
+ var frameMuxer: FrameMuxer = Mp4FrameMuxer(file.absolutePath, framesPerSecond),
+ var iFrameInterval: Int = 10
+)
+
+interface MuxingCompletionListener {
+ fun onVideoSuccessful(file: File)
+ fun onVideoError(error: Throwable)
+}
+
+interface MuxingResult
+
+data class MuxingSuccess(
+ val file: File
+): MuxingResult
+
+data class MuxingError(
+ val message: String,
+ val exception: Exception
+): MuxingResult
diff --git a/library/src/main/res/values/strings.xml b/library/src/main/res/values/strings.xml
new file mode 100644
index 0000000..8542005
--- /dev/null
+++ b/library/src/main/res/values/strings.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/library/src/main/res/xml/file_paths.xml b/library/src/main/res/xml/file_paths.xml
new file mode 100644
index 0000000..abcd2b1
--- /dev/null
+++ b/library/src/main/res/xml/file_paths.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..e7bae4b
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,5 @@
+include ':library'
+include ':app', ':lib', ':mapsme'
+rootProject.name='Tis'
+project(':lib').projectDir = new File('api-android-master/lib')
+project(':mapsme').projectDir = new File('lib')
\ No newline at end of file
diff --git a/upload.sh b/upload.sh
new file mode 100644
index 0000000..1c39d7d
--- /dev/null
+++ b/upload.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+client="mobile_tele2med"
+curl --data-urlencode "task=get_new_ver" --data-urlencode "source=Frontend" --data-urlencode "key=IDDQD" --data-urlencode "client=$client" --data-urlencode "type=revision" --data-urlencode "comment=$1" "https://devweb.tele2med.ru/SoftwareVersion/index.php"
+
+eval "$(ssh-agent)"
+ssh-add "C:\Users\sag-a\.ssh\id_rsa"
+
+git add .
+git commit -m "$1"
+git push
+
+curl -o conf.ini "https://devweb.tele2med.ru/SoftwareVersion/index.php?task=get_last_build_new&source=Frontend&key=IDDQD&client=$client"
+readarray -t array <<< "$(cat './conf.ini')"
+#echo ${array[*]} 'Все записи в массиве'
+#echo ${!array[*]} 'Все индексы в массиве'
+#echo ${#array[*]} 'Количество записей в массиве'
+#echo ${#array[0]} 'Длина первой записи (нумерация с нуля)'
+splash_version=$(echo ${array[0]}|tr -d '\n\r')
+splash_subname=$(echo ${array[1]}|tr -d '\n\r')
+splash_name=$(echo ${array[2]}|tr -d '\n\r')
+splash_date=$(echo ${array[3]}|tr -d '\n\r')
+splash_date2=$(echo ${array[4]}|tr -d '\n\r')
+splash_comment=$(echo ${array[5]}|tr -d '\n\r')
+sed -i -e "/^ /s/=.*/=\"splash_version\">$splash_version<\/string>/" './app/src/main/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_version\">$splash_version<\/string>/" './app/src/montrans/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_version\">$splash_version<\/string>/" './app/src/tis/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_version\">$splash_version<\/string>/" './app/src/tisDemo/res/values/strings.xml'
+#sed -i -e "/^ /s/=.*/=\"splash_subname\">$splash_subname<\/string>/" './app/src/main/res/values/strings.xml'
+#sed -i -e "/^ /s/=.*/=\"splash_name\">$splash_name<\/string>/" './app/src/main/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_date\">$splash_date<\/string>/" './app/src/main/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_comment\">$splash_comment<\/string>/" './app/src/main/res/values/strings.xml'
+sed -i -e "/^ def splash_date =/s/=.*/= \"${splash_date2}\"/" './app/build.gradle'
+sed -i -e "/^ def splash_version =/s/=.*/= \"${splash_version}\"/" './app/build.gradle'
+#sed -i -e "/^ /s/=.*/=\"splash_subname\">$splash_subname<\/string>/" './app/src/montrans/res/values/strings.xml'
+#sed -i -e "/^ /s/=.*/=\"splash_name\">$splash_name<\/string>/" './app/src/montrans/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_date\">$splash_date<\/string>/" './app/src/montrans/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_comment\">$splash_comment<\/string>/" './app/src/montrans/res/values/strings.xml'
+sed -i -e "/^ def splash_date =/s/=.*/= \"${splash_date2}\"/" './app/build.gradle'
+sed -i -e "/^ def splash_version =/s/=.*/= \"${splash_version}\"/" './app/build.gradle'
+#sed -i -e "/^ /s/=.*/=\"splash_subname\">$splash_subname<\/string>/" './app/src/tis/res/values/strings.xml'
+#sed -i -e "/^ /s/=.*/=\"splash_name\">$splash_name<\/string>/" './app/src/tis/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_date\">$splash_date<\/string>/" './app/src/tis/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_comment\">$splash_comment<\/string>/" './app/src/tis/res/values/strings.xml'
+sed -i -e "/^ def splash_date =/s/=.*/= \"${splash_date2}\"/" './app/build.gradle'
+sed -i -e "/^ def splash_version =/s/=.*/= \"${splash_version}\"/" './app/build.gradle'
+#sed -i -e "/^ /s/=.*/=\"splash_subname\">$splash_subname<\/string>/" './app/src/tis/res/values/strings.xml'
+#sed -i -e "/^ /s/=.*/=\"splash_name\">$splash_name<\/string>/" './app/src/tis/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_date\">$splash_date<\/string>/" './app/src/tisDemo/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_comment\">$splash_comment<\/string>/" './app/src/tisDemo/res/values/strings.xml'
+sed -i -e "/^ def splash_date =/s/=.*/= \"${splash_date2}\"/" './app/build.gradle'
+sed -i -e "/^ def splash_version =/s/=.*/= \"${splash_version}\"/" './app/build.gradle'
+sed -i -e "/^ def splash_version =/s/=.*/= \"${splash_version}\"/" './app/build.gradle'
+sed -i -e "/^ def splash_date =/s/=.*/= \"${splash_date2}\"/" './app/build.gradle'
diff --git a/upload.sh.bak b/upload.sh.bak
new file mode 100644
index 0000000..53bda65
--- /dev/null
+++ b/upload.sh.bak
@@ -0,0 +1,44 @@
+#!/bin/bash
+client="mobile_tele2med"
+curl --data-urlencode "task=get_new_ver" --data-urlencode "source=Frontend" --data-urlencode "key=IDDQD" --data-urlencode "client=$client" --data-urlencode "type=revision" --data-urlencode "comment=$1" "https://devweb.tele2med.ru/SoftwareVersion/index.php"
+
+eval "$(ssh-agent)"
+ssh-add "C:\Users\sag-a\.ssh\id_rsa"
+
+git add .
+git commit -m "$1"
+git push
+
+curl -o conf.ini "https://devweb.tele2med.ru/SoftwareVersion/index.php?task=get_last_build_new&source=Frontend&key=IDDQD&client=$client"
+readarray -t array <<< "$(cat './conf.ini')"
+#echo ${array[*]} 'Все записи в массиве'
+#echo ${!array[*]} 'Все индексы в массиве'
+#echo ${#array[*]} 'Количество записей в массиве'
+#echo ${#array[0]} 'Длина первой записи (нумерация с нуля)'
+splash_version=$(echo ${array[0]}|tr -d '\n\r')
+splash_subname=$(echo ${array[1]}|tr -d '\n\r')
+splash_name=$(echo ${array[2]}|tr -d '\n\r')
+splash_date=$(echo ${array[3]}|tr -d '\n\r')
+splash_date2=$(echo ${array[4]}|tr -d '\n\r')
+splash_comment=$(echo ${array[5]}|tr -d '\n\r')
+sed -i -e "/^ /s/=.*/=\"splash_version\">$splash_version<\/string>/" './app/src/main/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_version\">$splash_version<\/string>/" './app/src/montrans/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_version\">$splash_version<\/string>/" './app/src/tis/res/values/strings.xml'
+#sed -i -e "/^ /s/=.*/=\"splash_subname\">$splash_subname<\/string>/" './app/src/main/res/values/strings.xml'
+#sed -i -e "/^ /s/=.*/=\"splash_name\">$splash_name<\/string>/" './app/src/main/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_date\">$splash_date<\/string>/" './app/src/main/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_comment\">$splash_comment<\/string>/" './app/src/main/res/values/strings.xml'
+sed -i -e "/^ def splash_date =/s/=.*/= \"${splash_date2}\"/" './app/build.gradle'
+sed -i -e "/^ def splash_version =/s/=.*/= \"${splash_version}\"/" './app/build.gradle'
+#sed -i -e "/^ /s/=.*/=\"splash_subname\">$splash_subname<\/string>/" './app/src/montrans/res/values/strings.xml'
+#sed -i -e "/^ /s/=.*/=\"splash_name\">$splash_name<\/string>/" './app/src/montrans/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_date\">$splash_date<\/string>/" './app/src/montrans/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_comment\">$splash_comment<\/string>/" './app/src/montrans/res/values/strings.xml'
+sed -i -e "/^ def splash_date =/s/=.*/= \"${splash_date2}\"/" './app/build.gradle'
+sed -i -e "/^ def splash_version =/s/=.*/= \"${splash_version}\"/" './app/build.gradle'
+#sed -i -e "/^ /s/=.*/=\"splash_subname\">$splash_subname<\/string>/" './app/src/tis/res/values/strings.xml'
+#sed -i -e "/^ /s/=.*/=\"splash_name\">$splash_name<\/string>/" './app/src/tis/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_date\">$splash_date<\/string>/" './app/src/tis/res/values/strings.xml'
+sed -i -e "/^ /s/=.*/=\"splash_comment\">$splash_comment<\/string>/" './app/src/tis/res/values/strings.xml'
+sed -i -e "/^ def splash_date =/s/=.*/= \"${splash_date2}\"/" './app/build.gradle'
+sed -i -e "/^ def splash_version =/s/=.*/= \"${splash_version}\"/" './app/build.gradle'
\ No newline at end of file