Commit 1e9e9d41 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

added other stuff to settings screen

parent 68e88c00
......@@ -10,7 +10,7 @@ import butterknife.ButterKnife
import com.biganto.visual.roompark.BuildConfig
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.presentation.screen.splash.SplashScreenController
import com.biganto.visual.roompark.view_utils.app_bar.DragControlAppBarLayoutBehaviour
import com.biganto.visual.roompark.util.view_utils.app_bar.DragControlAppBarLayoutBehaviour
import com.bluelinelabs.conductor.Conductor
import com.bluelinelabs.conductor.Router
import com.bluelinelabs.conductor.RouterTransaction
......
......@@ -15,7 +15,7 @@ import com.biganto.visual.roompark.base.ICollapsingToolBar
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.mosby.mvi.BigantoMviController
import com.biganto.visual.roompark.di.dagger.ActivityModule
import com.biganto.visual.roompark.view_utils.snackbar.ISnackBarProvider
import com.biganto.visual.roompark.util.view_utils.snackbar.ISnackBarProvider
import com.hannesdorfmann.mosby3.mvi.MviBasePresenter
import io.reactivex.disposables.CompositeDisposable
......
......@@ -6,8 +6,8 @@ import android.content.res.Resources
import com.biganto.visual.roompark.base.BaseRoomParkActivity
import com.biganto.visual.roompark.base.ICollapsingToolBar
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.view_utils.snackbar.ISnackBarProvider
import com.biganto.visual.roompark.view_utils.snackbar.SnackBarProvider
import com.biganto.visual.roompark.util.view_utils.snackbar.ISnackBarProvider
import com.biganto.visual.roompark.util.view_utils.snackbar.SnackBarProvider
import dagger.Binds
import dagger.Module
import dagger.Provides
......
......@@ -9,7 +9,7 @@ import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.presentation.screen.deals.util.DealsListAdapter
import com.biganto.visual.roompark.view_utils.grid.CeilsDecoration
import com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import timber.log.Timber
import javax.inject.Inject
......
......@@ -12,8 +12,9 @@ import butterknife.ButterKnife
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.domain.model.StatusModel
import com.biganto.visual.roompark.presentation.screen.deals.DealPreviewModel
import com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressAnimationState
import com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
import com.biganto.visual.roompark.util.extensions.toRubly
import com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressAnimationState
import com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
import com.google.android.material.textview.MaterialTextView
/**
......@@ -113,10 +114,7 @@ class DealViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
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 Int.toRubly(): String {
return String.format("%,d \u20BD",this).replace(',',' ')
}
}
fun createStatusView(mainContainer: LinearLayout,container:ViewGroup,list:List<StatusModel>,currentStatus:Int, isVertical:Boolean){
......
......@@ -9,7 +9,7 @@ import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.presentation.screen.favorites.util.FavoritesListAdapter
import com.biganto.visual.roompark.view_utils.grid.CeilsDecoration
import com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import timber.log.Timber
import javax.inject.Inject
......
package com.biganto.visual.roompark.presentation.screen.settings
import android.annotation.SuppressLint
import android.view.View
import android.widget.ImageView
import androidx.recyclerview.widget.LinearLayoutManager
......@@ -9,7 +10,9 @@ import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.presentation.screen.settings.util.CahcedListAdapter
import com.biganto.visual.roompark.presentation.screen.settings.util.PushListAdapter
import com.biganto.visual.roompark.util.extensions.bytesToSize
import com.google.android.material.textview.MaterialTextView
import timber.log.Timber
import javax.inject.Inject
......@@ -58,6 +61,12 @@ class SettingsScreenController :
LinearLayoutManager(activity, RecyclerView.VERTICAL, false)
pushRecycler.adapter = PushListAdapter()
pushRecycler.itemAnimator = null
cachedRecycler.isNestedScrollingEnabled = true
cachedRecycler.layoutManager =
LinearLayoutManager(activity, RecyclerView.VERTICAL, false)
cachedRecycler.adapter = CahcedListAdapter()
cachedRecycler.itemAnimator = null
}
override fun render(viewState: SettingsScreenViewState) {
......@@ -74,8 +83,14 @@ class SettingsScreenController :
}
@SuppressLint("SetTextI18n")
private fun render(viewState: SettingsScreenViewState.LoadSettingsList){
(pushRecycler.adapter as PushListAdapter).setItems(viewState.settings.pushItems)
toursDownloaderTitle.text = viewState.settings.offlineStoreData[0].title +
"(${viewState.settings.offlineStoreData[0].amountBytes.bytesToSize()})"
flatDownloaderTitle.text = viewState.settings.offlineStoreData[1].title +
"(${viewState.settings.offlineStoreData[1].amountBytes.bytesToSize()})"
(cachedRecycler.adapter as CahcedListAdapter).setItems(viewState.settings.cachedData)
}
private fun getComponent() = DaggerSettingsScreenComponent.factory()
......
......@@ -8,7 +8,9 @@ import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView
import butterknife.ButterKnife
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.domain.model.CachedDataModel
import com.biganto.visual.roompark.domain.model.PushSwitchModel
import com.biganto.visual.roompark.util.extensions.bytesToSize
import com.google.android.material.switchmaterial.SwitchMaterial
import com.google.android.material.textview.MaterialTextView
import timber.log.Timber
......@@ -85,6 +87,29 @@ class PushViewHolder(itemView: View) : CommonViewHolder<PushSwitchModel>(itemVie
bellTitle.text = model.title
switcher.findViewById<SwitchMaterial>(R.id.switch1).isChecked = model.switchState
}
}
class CahcedListAdapter : CommonRecyclerAdapter<CachedViewHolder,CachedDataModel>() {
override val vhKlazz: KClass<CachedViewHolder>
get() = CachedViewHolder::class
override fun getVhLayout(): Int = R.layout.text_description_viewholder
}
class CachedViewHolder(itemView: View) : CommonViewHolder<CachedDataModel>(itemView) {
@BindView(R.id.descriptionTitle)
lateinit var title:MaterialTextView
@BindView(R.id.descriptionText)
lateinit var description:MaterialTextView
override fun onViewBound(model: CachedDataModel) {
Timber.d("model is : $model")
title.text = model.title
description.text = model.amountBytes.bytesToSize()
}
}
package com.biganto.visual.roompark.util.extensions
import java.text.DecimalFormat
/**
* Created by Vladislav Bogdashkin on 23.10.2019.
*/
fun Int.toRubly() = String.format("%,d \u20BD",this).replace(',',' ')
fun Long.bytesToSize():String{
if (this==-1L) return "~"
var scale=0
var rest:Long=this
var least=0f
while (rest>=1024) {
least=(rest%1024).toFloat()
rest /= 1024
scale++
}
least/=102.4f
return when(scale)
{
0->"$rest.${least.format(0)}B"
1->"$rest.${least.format(0)}Kb"
2->"$rest.${least.format(0)}Mb"
3->"$rest.${least.format(0)}Gb"
4->"$rest.${least.format(0)}Tb"
else ->"$rest${least.format(0)}Bb" //BigantoByte
}
}
fun Float.format(fracDigits: Int): String {
val df = DecimalFormat()
df.maximumFractionDigits = fracDigits
return df.format(this)
}
package com.biganto.visual.roompark.view_utils.app_bar
package com.biganto.visual.roompark.util.view_utils.app_bar
import android.content.Context
import android.util.AttributeSet
......
package com.biganto.visual.roompark.view_utils.grid
package com.biganto.visual.roompark.util.view_utils.grid
import android.graphics.Rect
import android.view.View
......
package com.biganto.visual.roompark.view_utils.image_view
package com.biganto.visual.roompark.util.view_utils.image_view
import android.content.Context
import android.graphics.Canvas
......
package com.biganto.visual.roompark.view_utils.snackbar
package com.biganto.visual.roompark.util.view_utils.snackbar
import android.app.Activity
import android.view.View
import androidx.core.content.ContextCompat
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.view_utils.snackbar.SnackBarMessageType.*
import com.biganto.visual.roompark.util.view_utils.snackbar.SnackBarMessageType.*
import com.google.android.material.snackbar.Snackbar
import javax.inject.Inject
......
package com.biganto.visual.roompark.view_utils.status_progress_view
package com.biganto.visual.roompark.util.view_utils.status_progress_view
import android.content.Context
import android.graphics.Canvas
......
......@@ -9,7 +9,7 @@
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="false">
<com.biganto.visual.roompark.view_utils.image_view.RoundedImageView
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
......
......@@ -25,7 +25,7 @@
android:theme="@style/ThemeOverlay.AppCompat.Light"
app:elevation="0dp"
app:expanded="false"
app:layout_behavior=".view_utils.app_bar.DragControlAppBarLayoutBehaviour"
app:layout_behavior=".util.view_utils.app_bar.DragControlAppBarLayoutBehaviour"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
......
......@@ -9,7 +9,7 @@
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="false">
<com.biganto.visual.roompark.view_utils.image_view.RoundedImageView
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
......
......@@ -9,7 +9,7 @@
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="false">
<com.biganto.visual.roompark.view_utils.image_view.RoundedImageView
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
......
......@@ -7,7 +7,7 @@
android:layout_height="wrap_content"
android:background="@color/colorFeedViewHolderBackground">
<com.biganto.visual.roompark.view_utils.image_view.RoundedImageView
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
android:id="@+id/imageHolder"
android:layout_width="128dp"
android:layout_height="128dp"
......
......@@ -8,7 +8,7 @@
android:background="@color/colorFeedViewHolderBackground"
android:orientation="vertical">
<com.biganto.visual.roompark.view_utils.image_view.RoundedImageView
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
android:id="@+id/imageHolder"
android:layout_width="60dp"
android:layout_height="60dp"
......
<?xml version="1.0" encoding="utf-8"?>
<com.biganto.visual.roompark.view_utils.image_view.RoundedImageView
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="80dp"
android:layout_height="80dp"
......
......@@ -8,7 +8,7 @@
android:orientation="vertical"
android:weightSum="3">
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:layout_width="wrap_content"
android:layout_height="24dp"
app:direction="vertical"
......@@ -18,7 +18,7 @@
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil2"
android:layout_width="match_parent"
android:layout_height="24dp"
......@@ -29,7 +29,7 @@
app:isEnable="true"
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil4"
android:layout_width="match_parent"
android:layout_height="24dp"
......@@ -40,7 +40,7 @@
app:isEnable="true"
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil5"
android:layout_width="match_parent"
android:layout_height="24dp"
......@@ -51,7 +51,7 @@
app:isEnable="true"
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil6"
android:layout_width="match_parent"
android:layout_height="24dp"
......@@ -62,7 +62,7 @@
app:isEnable="true"
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil3"
android:layout_width="match_parent"
android:layout_height="24dp"
......@@ -73,7 +73,7 @@
app:isEnable="true"
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:layout_width="wrap_content"
android:layout_height="24dp"
android:scaleType="fitEnd"
......@@ -84,7 +84,7 @@
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:layout_width="wrap_content"
android:layout_height="24dp"
android:scaleType="fitEnd"
......@@ -95,7 +95,7 @@
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_weight="1"
......@@ -107,7 +107,7 @@
app:nextEnable="false" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_weight="1"
......
......@@ -8,7 +8,7 @@
android:orientation="horizontal"
android:weightSum="10">
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
......@@ -19,7 +19,7 @@
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
......@@ -31,7 +31,7 @@
app:isEnable="true"
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil4"
android:layout_width="wrap_content"
android:layout_height="match_parent"
......@@ -43,7 +43,7 @@
app:isEnable="true"
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil5"
android:layout_width="wrap_content"
android:layout_height="match_parent"
......@@ -55,7 +55,7 @@
app:isEnable="true"
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil6"
android:layout_width="wrap_content"
android:layout_height="match_parent"
......@@ -67,7 +67,7 @@
app:isEnable="true"
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil3"
android:layout_width="wrap_content"
android:layout_height="match_parent"
......@@ -79,7 +79,7 @@
app:isEnable="true"
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
......@@ -91,7 +91,7 @@
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
......@@ -103,7 +103,7 @@
app:nextEnable="true" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
......@@ -115,7 +115,7 @@
app:nextEnable="false" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
......@@ -140,11 +143,5 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
\ No newline at end of file
</LinearLayout>
</androidx.core.widget.NestedScrollView>
\ No newline at end of file
......@@ -14,7 +14,7 @@
android:layout_height="64dp"
android:orientation="vertical">
<com.biganto.visual.roompark.view_utils.image_view.RoundedImageView
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
android:id="@+id/roundedImageView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
......
......@@ -10,7 +10,7 @@
android:layout_height="160dp"
android:orientation="vertical">
<com.biganto.visual.roompark.view_utils.image_view.RoundedImageView
<com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
android:id="@+id/roundedImageView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil>
\ No newline at end of file
</com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil>
\ No newline at end of file
......@@ -7,7 +7,7 @@
android:background="@drawable/gradient_background_accent">
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil"
android:layout_width="16dp"
android:layout_height="0dp"
......@@ -37,7 +37,7 @@
app:layout_constraintStart_toEndOf="@+id/statusProgressCeil"
app:layout_constraintTop_toTopOf="parent" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil8"
android:layout_width="16dp"
android:layout_height="0dp"
......@@ -67,7 +67,7 @@
app:layout_constraintTop_toBottomOf="@+id/textView20" />
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil81"
android:layout_width="16dp"
android:layout_height="0dp"
......@@ -99,7 +99,7 @@
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/statusProgressCeil813"
android:layout_width="16dp"
android:layout_height="0dp"
......
......@@ -7,6 +7,7 @@
android:weightSum="1">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/descriptionTitle"
style="@style/Default_TextView.Header_Text"
android:layout_width="0dp"
android:layout_height="wrap_content"
......@@ -15,6 +16,7 @@
android:text="блабла" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/descriptionText"
style="@style/Default_TextView.Notice_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
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