Commit 0e5dd9ee authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

fix switcher && walls-furniture condition

parent ffdb56e4
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<AndroidXmlCodeStyleSettings>
<option name="ARRANGEMENT_SETTINGS_MIGRATED_TO_191" value="true" />
</AndroidXmlCodeStyleSettings>
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
......
......@@ -148,7 +148,7 @@
</profile-state>
</entry>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
......
......@@ -91,7 +91,6 @@ class EstateScreenController :
override fun switchElectric(): Observable<Pair<Int, Boolean>> =
electricSwitcher.switchMatch()
override fun planTypesTabSelected(): Observable<Int> =
planTypesTabLayout.selections()
.debounce (200L, TimeUnit.MILLISECONDS)
......@@ -238,6 +237,11 @@ class EstateScreenController :
bottomNavigationController.hide()
setToolbar()
bindRecycler()
detachDisposable.add(
furnSwitcher.clicks()
.filter { !furnSwitcher.isEnabled }
.subscribe { snackbar.showSnackBar("Мебелировка не доступна") }
)
}
override fun render(viewState: EstateScreenViewState) {
......@@ -343,8 +347,16 @@ class EstateScreenController :
is FeatureModel.Furniture -> {
furnContainer.setGone(false)
furnTitle.text = it.featureTitle
furnSwitcher.findViewById<SwitchMaterial>(R.id.switch1).isChecked =
it.switchedOn
val fSwitcher = furnSwitcher.findViewById<SwitchMaterial>(R.id.switch1)
fSwitcher.isChecked = it.switchedOn
// val fSwitcher = furnSwitcher.findViewById<SwitchMaterial>(R.id.switch1)
val wls = plan
.features
.firstOrNull { feature -> feature is FeatureModel.Walls }
?.switchedOn
fSwitcher.isEnabled = wls ?: true
furnitureDivider.setGone(false)
}
is FeatureModel.Walls ->{
......
......@@ -40,6 +40,11 @@ class EstateScreenPresenter @Inject constructor(
private fun getPlan(plan: PlanPresetModel): Observable<EstateScreenViewState> =
interactor.getPlan(plan)
.map<EstateScreenViewState> { EstateScreenViewState.LoadPlan(it) }
.startWith(
Observable.just<EstateScreenViewState>(
EstateScreenViewState.PlanTypeSelected(plan)
)
)
override fun bindIntents() {
......@@ -53,17 +58,18 @@ class EstateScreenPresenter @Inject constructor(
val fetchPlan = intent(EstateScreen::planTypesTabSelected)
.map { planList?.get(it) }
.flatMap {planPreset ->
.flatMap { planPreset ->
interactor.getPlan(planPreset)
.map<EstateScreenViewState> { plan -> EstateScreenViewState.LoadPlan(plan) }
.startWith(
Observable.just<EstateScreenViewState>(
EstateScreenViewState.PlanTypeSelected(planPreset)
)
)
.startWith(
Observable.just<EstateScreenViewState>(
EstateScreenViewState.ShowEstateInfo(
showType
,if (showType== InfoShowType.COMMON_INFO)
......@@ -74,6 +80,7 @@ class EstateScreenPresenter @Inject constructor(
)
}
val switchSizes = intent(EstateScreen::switchSizes)
.map { pair ->
val plan = planList?.first { it.planId == pair.first }
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:width="http://schemas.android.com/apk/res-auto">
<item android:state_enabled="false">
<layer-list>
<item>
<shape android:shape="rectangle"
android:dither="true"
android:useLevel="false">
<size android:width="48dp" android:height="24dp"/>
<corners android:radius="12dp"/>
</shape>
</item>
<item
android:right="8dp">
<bitmap
android:width="14dp"
android:height="15dp"
android:src="@drawable/ic_bell_off"
android:tintMode="multiply"
android:gravity="end"
android:tint="@color/colorPrimaryDark" />
</item>
</layer-list>
</item>
<item android:state_checked="false">
<layer-list>
<item>
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/colorAccent">
android:color="@color/colorOpacityBackgroundInv">
</item>
<item android:state_checked="true"
android:color="@color/colorAccent">
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:width="http://schemas.android.com/apk/res-auto">
<item android:state_enabled="false">
<layer-list>
<item>
<shape android:shape="rectangle"
android:dither="true"
android:useLevel="false">
<size android:width="48dp" android:height="24dp"/>
<corners android:radius="12dp"/>
</shape>
</item>
</layer-list>
</item>
<item android:state_checked="false">
<layer-list>
<item>
<shape android:shape="rectangle"
android:dither="true"
android:useLevel="false">
<size android:width="48dp" android:height="24dp"/>
<corners android:radius="12dp"/>
</shape>
</item>
</layer-list>
</item>
<item android:state_checked="true">
<layer-list>
<item>
<shape android:shape="rectangle"
android:dither="true"
android:useLevel="false">
<size android:width="48dp" android:height="24dp"/>
<solid android:color="#FFFFFFFF"/>
<corners android:radius="12dp" />
</shape>
</item>
</layer-list>
</item>
</selector>
\ No newline at end of file
......@@ -8,6 +8,7 @@
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switch1"
style="@style/BellSwitchStyle"
android:layout_width="48dp"
android:layout_height="24dp"
android:height="24dp"
......
......@@ -97,7 +97,7 @@
<include
android:id="@+id/sizes_switcher"
layout="@layout/bell_switch_view"
layout="@layout/switch_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
......@@ -140,7 +140,7 @@
<include
android:id="@+id/furniture_switcher"
layout="@layout/bell_switch_view"
layout="@layout/switch_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
......@@ -183,7 +183,7 @@
<include
android:id="@+id/electricity_switcher"
layout="@layout/bell_switch_view"
layout="@layout/switch_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
......@@ -227,7 +227,7 @@
<include
android:id="@+id/walls_switcher"
layout="@layout/bell_switch_view"
layout="@layout/switch_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bell_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switch1"
android:layout_width="48dp"
android:layout_height="24dp"
android:height="24dp"
android:checked="false"
app:switchMinWidth="48dp" />
</LinearLayout>
\ No newline at end of file
......@@ -10,9 +10,7 @@
<item name="colorAccent">@color/colorAccent</item>
<item name="materialCardViewStyle">@style/Widget.Biganto.MaterialCardView</item>
<item name="switchStyle">
@style/Widget.MaterialComponents.CompoundButton.Switch.BellSwitchStyle
</item>
<item name="switchStyle">@style/Widget.MaterialComponents.CompoundButton.Switch.AccentSwitch</item>
<item name="colorControlActivated">@color/colorAccent</item>
<item name="colorControlHighlight">@color/colorAccent</item>
<item name="colorControlNormal">@color/colorAccent</item>
......
......@@ -10,7 +10,7 @@
<item name="colorAccent">@color/colorAccent</item>
<item name="materialCardViewStyle">@style/Widget.Biganto.MaterialCardView</item>
<item name="switchStyle">@style/Widget.MaterialComponents.CompoundButton.Switch.BellSwitchStyle</item>
<item name="switchStyle">@style/Widget.MaterialComponents.CompoundButton.Switch.AccentSwitch</item>
<item name="colorControlActivated">@color/colorAccent</item>
<item name="colorControlHighlight">@color/colorAccent</item>
<item name="colorControlNormal">@color/colorAccent</item>
......@@ -25,13 +25,20 @@
<item name="android:windowBackground">@color/colorAccent</item>
</style>
<style name="Widget.MaterialComponents.CompoundButton.Switch.BellSwitchStyle" >
<style name="BellSwitchStyle" parent="Widget.MaterialComponents.CompoundButton.Switch">
<item name="track" >@drawable/bell_switch_track</item>
<item name="android:thumb" >@drawable/bell_switcher</item>
<item name="thumbTint">@color/colorPrimaryDark</item>
<item name="trackTint">@drawable/bell_switch_track_tint</item>
</style>
<style name="Widget.MaterialComponents.CompoundButton.Switch.AccentSwitch" >
<item name="track" >@drawable/switch_track</item>
<item name="android:thumb" >@drawable/bell_switcher</item>
<item name="thumbTint">@color/colorPrimaryDark</item>
<item name="trackTint">@drawable/bell_switch_track_tint</item>
</style>
<style name="Widget.Biganto.MaterialCardView" parent="Widget.MaterialComponents.CardView">
<item name="cardUseCompatPadding">false</item>
<item name="strokeWidth">0dp</item>
......
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