Commit b9a650c5 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

update strings

parent 59ed84a4
...@@ -91,10 +91,6 @@ class RoomParkMainActivity( ...@@ -91,10 +91,6 @@ class RoomParkMainActivity(
headerToolbar.setGone(header==null) headerToolbar.setGone(header==null)
statusToolbar.setGone(status==null) statusToolbar.setGone(status==null)
header?.let { header?.let {
Timber.d("bb: ${it.backButton}")
Timber.d("bt: ${it.backTitle}")
Timber.d("itTitle: ${it.title}")
Timber.d("switcher: ${it.switcher} - ${it.switcher?:false}")
headerToolbarBack.setGone(!it.backButton) headerToolbarBack.setGone(!it.backButton)
headerToolbarBack.text = it.backTitle?:"" headerToolbarBack.text = it.backTitle?:""
headerToolbar.findViewById<MaterialTextView>(R.id.toolbar_title).text = it.title?:"" headerToolbar.findViewById<MaterialTextView>(R.id.toolbar_title).text = it.title?:""
...@@ -102,7 +98,6 @@ class RoomParkMainActivity( ...@@ -102,7 +98,6 @@ class RoomParkMainActivity(
} }
status?.let { status?.let {
Timber.d(" inda status")
statusToolbar.status_icon.setGone(it.state == null) statusToolbar.status_icon.setGone(it.state == null)
statusToolbar.status_title.setGone(it.state == null) statusToolbar.status_title.setGone(it.state == null)
it.state?.let { state -> it.state?.let { state ->
......
...@@ -32,6 +32,7 @@ class FeedsInteractor @Inject constructor( ...@@ -32,6 +32,7 @@ class FeedsInteractor @Inject constructor(
// else -> error("unknown feedId") // else -> error("unknown feedId")
// } // }
// ) // )
fun fetchArticles(feedAlias:String,pageSize:Int,startIndex:Int): Observable<ArticlesPreviewModel> = fun fetchArticles(feedAlias:String,pageSize:Int,startIndex:Int): Observable<ArticlesPreviewModel> =
feedsUseCase.fetchArticlesPage(feedAlias,pageSize,startIndex) feedsUseCase.fetchArticlesPage(feedAlias,pageSize,startIndex)
......
package com.biganto.visual.roompark.domain.model
import androidx.annotation.StringRes
import com.biganto.visual.roompark.R
data class DealPreviewModel(
val id:String,
val type:String,
val name:String,
val building:Int?,
val section:Int?,
val floor:Int?,
val area: Float?,
val statusNo : Int,
val dealSum : Int,
val dealPayout : Int,
val dealToPay : Int,
val dealTourIds : List<Int?>?,
val isViewed: Boolean = true,
val statusList : List<StatusModel>
){
constructor(data:Pair<DealModel,List<StatusModel>>) : this(
data.first.id,
data.first.estate.type,
data.first.estate.number,
data.first.estate.commonInfo?.building,
data.first.estate.commonInfo?.section_begin,
data.first.estate.commonInfo?.floor,
data.first.estate.commonInfo?.area,
data.first.statusId,
data.first.opportunitySum,
data.first.paymentSum,
data.first.amount_pay_sum,
arrayListOf<Int?>(data.first.estate.multitourId),
false,
data.second
)
}
@StringRes
fun DealPreviewModel.typeDoubleString() =
when(this.type){
"flat" -> R.string.estate_type_flat_long
"parking" -> R.string.estate_type_parking_long
"storage" -> R.string.estate_type_store_long
else -> R.string.estate_type_other_long
}
@StringRes
fun DealPreviewModel.typeShortString() =
when(this.type){
"flat" -> R.string.estate_type_flat_short
"parking" -> R.string.estate_type_parking_short
"storage" -> R.string.estate_type_store_short
else -> R.string.estate_type_other_short
}
\ No newline at end of file
package com.biganto.visual.roompark.domain.model package com.biganto.visual.roompark.domain.model
import androidx.annotation.StringRes
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.data.repository.db.requrey.model.DealEntity import com.biganto.visual.roompark.data.repository.db.requrey.model.DealEntity
import com.biganto.visual.roompark.data.repository.db.requrey.model.EstateEntity import com.biganto.visual.roompark.data.repository.db.requrey.model.EstateEntity
import com.biganto.visual.roompark.data.repository.db.requrey.model.ExplicationEntity import com.biganto.visual.roompark.data.repository.db.requrey.model.ExplicationEntity
...@@ -58,6 +60,22 @@ data class EstateModel( ...@@ -58,6 +60,22 @@ data class EstateModel(
val url:String? val url:String?
) )
@StringRes fun EstateModel.typeDoubleString() =
when(this.type){
"flat" -> R.string.estate_type_flat_long
"parking" -> R.string.estate_type_parking_long
"storage" -> R.string.estate_type_store_long
else -> R.string.estate_type_other_long
}
@StringRes fun EstateModel.typeShortString() =
when(this.type){
"flat" -> R.string.estate_type_flat_short
"parking" -> R.string.estate_type_parking_short
"storage" -> R.string.estate_type_store_short
else -> R.string.estate_type_other_short
}
fun fromEntity(entity:EstateEntity): EstateModel { fun fromEntity(entity:EstateEntity): EstateModel {
val model = EstateModel( val model = EstateModel(
id = entity.id, id = entity.id,
......
...@@ -7,7 +7,7 @@ import javax.inject.Inject ...@@ -7,7 +7,7 @@ import javax.inject.Inject
* Created by Vladislav Bogdashkin on 24.09.2019. * Created by Vladislav Bogdashkin on 24.09.2019.
*/ */
class EstateUseCase @Inject constructor( class EstateUseCase @Inject constructor(
private val contract: DealContract private val contract: DealContract
) { ) {
......
package com.biganto.visual.roompark.presentation.screen.deals package com.biganto.visual.roompark.presentation.screen.deals
import com.biganto.visual.roompark.conductor.BigantoBaseContract import com.biganto.visual.roompark.conductor.BigantoBaseContract
import com.biganto.visual.roompark.domain.model.DealModel
import com.biganto.visual.roompark.domain.model.StatusModel
/** /**
* Created by Vladislav Bogdashkin on 30.09.2019. * Created by Vladislav Bogdashkin on 30.09.2019.
...@@ -12,36 +10,3 @@ interface DealsScreen : BigantoBaseContract<DealsScreenViewState> { ...@@ -12,36 +10,3 @@ interface DealsScreen : BigantoBaseContract<DealsScreenViewState> {
} }
data class DealPreviewModel(
val id:String,
val type:String,
val name:String,
val building:Int?,
val section:Int?,
val floor:Int?,
val area: Float?,
val statusNo : Int,
val dealSum : Int,
val dealPayout : Int,
val dealToPay : Int,
val dealTourIds : List<Int?>?,
val isViewed: Boolean = true,
val statusList : List<StatusModel>
){
constructor(data:Pair<DealModel,List<StatusModel>>) : this(
data.first.id,
data.first.estate.type,
data.first.estate.number,
data.first.estate.commonInfo?.building,
data.first.estate.commonInfo?.section_begin,
data.first.estate.commonInfo?.floor,
data.first.estate.commonInfo?.area,
data.first.statusId,
data.first.opportunitySum,
data.first.paymentSum,
data.first.amount_pay_sum,
arrayListOf<Int?>(data.first.estate.multitourId),
false,
data.second
)
}
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.deals ...@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.deals
import com.biganto.visual.roompark.conductor.BigantoBasePresenter import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import com.biganto.visual.roompark.domain.interactor.DealsInteractor import com.biganto.visual.roompark.domain.interactor.DealsInteractor
import com.biganto.visual.roompark.domain.model.DealPreviewModel
import com.biganto.visual.roompark.util.monades.ExceptionString import com.biganto.visual.roompark.util.monades.ExceptionString
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
...@@ -28,7 +29,11 @@ class DealsScreenPresenter @Inject constructor( ...@@ -28,7 +29,11 @@ class DealsScreenPresenter @Inject constructor(
val fetchDeals = interactor.fetchDeals() val fetchDeals = interactor.fetchDeals()
.flatMap { deals -> .flatMap { deals ->
getStatusList getStatusList
.map { List(deals.size) { index -> DealPreviewModel(Pair(deals[index], it)) } } .map { List(deals.size) { index ->
DealPreviewModel(
Pair(deals[index], it)
)
} }
} }
.map(DealsScreenViewState::DealsLoaded) .map(DealsScreenViewState::DealsLoaded)
......
package com.biganto.visual.roompark.presentation.screen.deals package com.biganto.visual.roompark.presentation.screen.deals
import com.biganto.visual.roompark.conductor.BigantoBaseViewState import com.biganto.visual.roompark.conductor.BigantoBaseViewState
import com.biganto.visual.roompark.domain.model.DealPreviewModel
import com.biganto.visual.roompark.util.monades.ExceptionString import com.biganto.visual.roompark.util.monades.ExceptionString
/** /**
......
...@@ -9,8 +9,9 @@ import android.widget.TextView ...@@ -9,8 +9,9 @@ import android.widget.TextView
import butterknife.BindView import butterknife.BindView
import butterknife.ButterKnife import butterknife.ButterKnife
import com.biganto.visual.roompark.R import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.domain.model.DealPreviewModel
import com.biganto.visual.roompark.domain.model.StatusModel import com.biganto.visual.roompark.domain.model.StatusModel
import com.biganto.visual.roompark.presentation.screen.deals.DealPreviewModel import com.biganto.visual.roompark.domain.model.typeDoubleString
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import com.biganto.visual.roompark.util.extensions.toRubly import com.biganto.visual.roompark.util.extensions.toRubly
...@@ -22,7 +23,7 @@ import com.google.android.material.textview.MaterialTextView ...@@ -22,7 +23,7 @@ import com.google.android.material.textview.MaterialTextView
* Created by Vladislav Bogdashkin on 16.10.2019. * Created by Vladislav Bogdashkin on 16.10.2019.
*/ */
class DealsListAdapter : CommonRecyclerAdapter<DealViewHolder,DealPreviewModel>() { class DealsListAdapter : CommonRecyclerAdapter<DealViewHolder, DealPreviewModel>() {
override val vhKlazz = DealViewHolder::class override val vhKlazz = DealViewHolder::class
override fun getVhLayout() = R.layout.deal_card_viewholder override fun getVhLayout() = R.layout.deal_card_viewholder
} }
...@@ -62,7 +63,8 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi ...@@ -62,7 +63,8 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi
override fun onViewBound(model: DealPreviewModel) { override fun onViewBound(model: DealPreviewModel) {
val fullObjName = "${typeName(model.type)}\n№${model.name}" val fullObjName = "${typeName(model.type)}\n№${model.name}"
estateTitle.text = fullObjName estateTitle.text =
itemView.context.resources?.getString(model.typeDoubleString(),model.name)
renderCommonInfo(model) renderCommonInfo(model)
if (model.dealTourIds.isNullOrEmpty()) startTour.visibility = View.GONE if (model.dealTourIds.isNullOrEmpty()) startTour.visibility = View.GONE
...@@ -82,7 +84,7 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi ...@@ -82,7 +84,7 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi
statusLayout.invalidate() statusLayout.invalidate()
} }
private fun renderCommonInfo(info:DealPreviewModel){ private fun renderCommonInfo(info: DealPreviewModel){
if (info.building == null) info1.visibility = View.GONE if (info.building == null) info1.visibility = View.GONE
else { info1.title().text = "Корпус"; info1.text().text = info.building.toString()} else { info1.title().text = "Корпус"; info1.text().text = info.building.toString()}
......
...@@ -18,6 +18,7 @@ import com.biganto.visual.roompark.base.RoomParkMainActivity ...@@ -18,6 +18,7 @@ import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.domain.model.FeatureModel import com.biganto.visual.roompark.domain.model.FeatureModel
import com.biganto.visual.roompark.domain.model.PlanPresetModel import com.biganto.visual.roompark.domain.model.PlanPresetModel
import com.biganto.visual.roompark.domain.model.typeShortString
import com.biganto.visual.roompark.presentation.screen.estate.util.FlatInfoAdapter import com.biganto.visual.roompark.presentation.screen.estate.util.FlatInfoAdapter
import com.google.android.material.switchmaterial.SwitchMaterial import com.google.android.material.switchmaterial.SwitchMaterial
import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
...@@ -205,10 +206,17 @@ class EstateScreenController : ...@@ -205,10 +206,17 @@ class EstateScreenController :
private fun render(viewState: EstateScreenViewState.LoadEstate) { private fun render(viewState: EstateScreenViewState.LoadEstate) {
toolBar.setToolbar(
HeaderToolbarModel(
true,null
,resources?.getString(viewState.estate.typeShortString(),viewState.estate.number)
,null)
)
} }
private fun render(viewState: EstateScreenViewState.ShowEstateInfo) { private fun render(viewState: EstateScreenViewState.ShowEstateInfo) {
(flatInfoRecyclerView.adapter as FlatInfoAdapter).setItems(viewState.info) (flatInfoRecyclerView.adapter as FlatInfoAdapter).setItems(viewState.info)
} }
......
...@@ -7,8 +7,10 @@ import butterknife.ButterKnife ...@@ -7,8 +7,10 @@ import butterknife.ButterKnife
import com.biganto.visual.roompark.R import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.domain.model.CommonInfoModel import com.biganto.visual.roompark.domain.model.CommonInfoModel
import com.biganto.visual.roompark.domain.model.EstateModel import com.biganto.visual.roompark.domain.model.EstateModel
import com.biganto.visual.roompark.domain.model.typeDoubleString
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import com.biganto.visual.roompark.util.extensions.setGone
/** /**
* Created by Vladislav Bogdashkin on 16.10.2019. * Created by Vladislav Bogdashkin on 16.10.2019.
...@@ -35,25 +37,17 @@ class FavoriteViewHolder(itemView: View) : CommonViewHolder<EstateModel>(itemVie ...@@ -35,25 +37,17 @@ class FavoriteViewHolder(itemView: View) : CommonViewHolder<EstateModel>(itemVie
@BindView(R.id.info_ceil_7) lateinit var info7:View @BindView(R.id.info_ceil_7) lateinit var info7:View
@BindView(R.id.info_ceil_8) lateinit var info8:View @BindView(R.id.info_ceil_8) lateinit var info8:View
fun typeName(type:String) = when(type){
"flat" -> "КВАРТИРА"
"parking" -> "МАШИНОМЕСТО"
"storage" -> "КЛАДОВКА"
else -> "ОБЪЕКТ"
}
init { init {
ButterKnife.bind(this, itemView) ButterKnife.bind(this, itemView)
} }
override fun onViewBound(model: EstateModel) { override fun onViewBound(model: EstateModel) {
val fullObjName = "${typeName(model.type)}\n${model.number}" estateTitle.text =
estateTitle.text = fullObjName itemView.context.resources?.getString(model.typeDoubleString(),model.number)
if (model.commonInfo == null) commonInfo.visibility = View.GONE commonInfo.setGone(model.commonInfo == null)
else {commonInfo.visibility = View.VISIBLE; renderCommonInfo(model.commonInfo)} model.commonInfo?.let {renderCommonInfo(it)}
if (model.type == "flat") startTour.visibility = View.VISIBLE startTour.setGone(model.type != "flat")
else startTour.visibility = View.GONE
} }
private fun renderCommonInfo(info:CommonInfoModel){ private fun renderCommonInfo(info:CommonInfoModel){
...@@ -71,10 +65,10 @@ class FavoriteViewHolder(itemView: View) : CommonViewHolder<EstateModel>(itemVie ...@@ -71,10 +65,10 @@ class FavoriteViewHolder(itemView: View) : CommonViewHolder<EstateModel>(itemVie
else { info4.title().text = "Общая, м²"; info4.text().text = info.area.toString()} else { info4.title().text = "Общая, м²"; info4.text().text = info.area.toString()}
if (info.price_meter == null) info1.visibility = View.GONE if (info.price_meter == null) info1.visibility = View.GONE
else { info5.title().text = "Цена за м²"; info5.text().text = info.price_meter.toRubly()} else { info5.title().text = "Цена за м²"; info5.text().text = info.price_meter.toRubles()}
if (info.price == null) info1.visibility = View.GONE if (info.price == null) info1.visibility = View.GONE
else { info6.title().text = "Стоимость"; info6.text().text = info.price.toRubly()} else { info6.title().text = "Стоимость"; info6.text().text = info.price.toRubles()}
if (true) info7.visibility = View.GONE if (true) info7.visibility = View.GONE
else { info7.title().text = "вщщ"; info7.text().text = info.building.toString()} else { info7.title().text = "вщщ"; info7.text().text = info.building.toString()}
...@@ -86,8 +80,7 @@ class FavoriteViewHolder(itemView: View) : CommonViewHolder<EstateModel>(itemVie ...@@ -86,8 +80,7 @@ class FavoriteViewHolder(itemView: View) : CommonViewHolder<EstateModel>(itemVie
private fun View.title() = this.findViewById<TextView>(R.id.info_ceil_header) private fun View.title() = this.findViewById<TextView>(R.id.info_ceil_header)
private fun View.text() = this.findViewById<TextView>(R.id.info_ceil_content) private fun View.text() = this.findViewById<TextView>(R.id.info_ceil_content)
private fun Int.toRubly(): String { private fun Int.toRubles(): String {
return String.format("%,d \u20BD",this).replace(',',' ') return String.format("%,d \u20BD",this).replace(',',' ')
} }
......
...@@ -14,22 +14,23 @@ ...@@ -14,22 +14,23 @@
<include <include
android:id="@+id/feedsBlock" android:id="@+id/feedsBlock"
layout="@layout/feeds_block_view" layout="@layout/feeds_block_view"
android:layout_height="426dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/dev_progress_header" android:id="@+id/dev_progress_header"
style="@style/Header_TextView.Main_Header" style="@style/Header_TextView.Main_Header"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="24dp" android:layout_marginEnd="16dp"
android:layout_marginEnd="16dp" android:text="ХОД\nСТРОИТЕЛЬСТВА"
android:text="ХОД\nСТРОИТЕЛЬСТВА" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/feedsBlock" /> app:layout_constraintTop_toBottomOf="@+id/feedsBlock" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/dev_progress_recycler_view" android:id="@+id/dev_progress_recycler_view"
...@@ -55,5 +56,5 @@ ...@@ -55,5 +56,5 @@
app:layout_constraintTop_toBottomOf="@+id/dev_progress_recycler_view" app:layout_constraintTop_toBottomOf="@+id/dev_progress_recycler_view"
tools:listitem="@layout/cam_button_viewholder" /> tools:listitem="@layout/cam_button_viewholder" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
\ No newline at end of file
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:gravity="start|center_vertical" android:gravity="start|center_vertical"
android:text="НОВОСТИ" android:text="НОВОСТИ\nИРКУТСКА"
android:textAlignment="gravity" android:textAlignment="gravity"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
......
...@@ -81,6 +81,14 @@ ...@@ -81,6 +81,14 @@
<string name="deal_back_chevron_title">МОИ\nСДЕЛКИ</string> <string name="deal_back_chevron_title">МОИ\nСДЕЛКИ</string>
<string name="news_header">НОВОСТИ</string> <string name="news_header">НОВОСТИ</string>
<string name="blog_header">БЛОГ</string> <string name="blog_header">БЛОГ</string>
<string name="estate_type_flat_long">КВАРТИРА\n№%s</string>
<string name="estate_type_parking_long">МАШИНОМЕСТО\n%s</string>
<string name="estate_type_store_long">КЛАДОВКА\n%s</string>
<string name="estate_type_other_long">ОБЪЕКТ\n%s</string>
<string name="estate_type_flat_short">кв.№%s</string>
<string name="estate_type_parking_short">м\\м %s</string>
<string name="estate_type_store_short">кл.%s</string>
<string name="estate_type_other_short">об.%s</string>
<!--endregion--> <!--endregion-->
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment