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

dialogchangeHandler usage

parent a70ac3cc
...@@ -5,6 +5,8 @@ import android.view.LayoutInflater ...@@ -5,6 +5,8 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.annotation.LayoutRes import androidx.annotation.LayoutRes
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView import butterknife.BindView
import com.biganto.visual.roompark.R import com.biganto.visual.roompark.R
...@@ -13,6 +15,7 @@ import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyc ...@@ -13,6 +15,7 @@ import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyc
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
import com.bluelinelabs.conductor.Controller import com.bluelinelabs.conductor.Controller
import com.google.android.material.textview.MaterialTextView import com.google.android.material.textview.MaterialTextView
import timber.log.Timber
/** /**
...@@ -35,13 +38,35 @@ class ChooseResolutionDialogController : Controller { ...@@ -35,13 +38,35 @@ class ChooseResolutionDialogController : Controller {
lateinit var recyclerView : RecyclerView lateinit var recyclerView : RecyclerView
// override fun onAttach(view: View) {
// tempSystemUiFlag = activity?.window?.decorView?.systemUiVisibility
// activity?.window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
// super.onAttach(view)
// }
//
// private var tempSystemUiFlag : Int? = null
// override fun onDetach(view: View) {
// activity?.window?.decorView?.systemUiVisibility = tempSystemUiFlag?:View.SYSTEM_UI_FLAG_LAYOUT_STABLE
// super.onDetach(view)
// }
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup): View { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup): View {
val view = inflater.inflate(getLayoutId(), container, false) val view = inflater.inflate(getLayoutId(), container, false)
recyclerView = view.findViewById(R.id.photoSizesRecyclerView) recyclerView = view.findViewById(R.id.photoSizesRecyclerView)
recyclerView.layoutManager =
LinearLayoutManager(activity, RecyclerView.VERTICAL, false)
recyclerView.adapter = PhotoSizeAdapter() recyclerView.adapter = PhotoSizeAdapter()
recyclerView.itemAnimator = null
recyclerView.addItemDecoration(
DividerItemDecoration(activity,DividerItemDecoration.VERTICAL)
)
args.getParcelableArrayList<PhotoResolutionModel>(PHOTOS_KEY)?.let { args.getParcelableArrayList<PhotoResolutionModel>(PHOTOS_KEY)?.let {
Timber.d("items; $it")
Timber.d("recyclerView; $recyclerView")
(recyclerView.adapter as PhotoSizeAdapter).setItems(it) (recyclerView.adapter as PhotoSizeAdapter).setItems(it)
(recyclerView.adapter as PhotoSizeAdapter).notifyDataSetChanged()
} }
return view return view
...@@ -60,19 +85,18 @@ class ChooseResolutionDialogController : Controller { ...@@ -60,19 +85,18 @@ class ChooseResolutionDialogController : Controller {
} }
private class PhotoSizeAdapter:CommonRecyclerAdapter<PhotoSizeViewHolder,PhotoResolutionModel>(){ internal class PhotoSizeAdapter:CommonRecyclerAdapter<PhotoSizeViewHolder,PhotoResolutionModel>(){
override val vhKlazz = PhotoSizeViewHolder::class override val vhKlazz = PhotoSizeViewHolder::class
override fun getVhLayout(): Int = R.layout.choose_size_viewholder override fun getVhLayout(): Int = R.layout.choose_size_viewholder
} }
private class PhotoSizeViewHolder(itemView: View) :CommonViewHolder<PhotoResolutionModel>(itemView){ internal class PhotoSizeViewHolder(itemView: View) :CommonViewHolder<PhotoResolutionModel>(itemView){
@BindView(R.id.size_text) @BindView(R.id.size_text)
lateinit var textView : MaterialTextView lateinit var textView : MaterialTextView
override fun onViewBound(model: PhotoResolutionModel) { override fun onViewBound(model: PhotoResolutionModel) {
textView.text = model.resName Timber.d("resname: ${model.resName}")
textView.text = "${model.resWidth}x${model.resHeight}"
} }
} }
\ No newline at end of file
...@@ -13,6 +13,7 @@ import com.biganto.visual.roompark.R ...@@ -13,6 +13,7 @@ import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity 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.conductor.dialogs.change_handler.DialogChangeHandler
import com.biganto.visual.roompark.domain.model.AlbumPreviewModel import com.biganto.visual.roompark.domain.model.AlbumPreviewModel
import com.biganto.visual.roompark.domain.model.PhotoModel import com.biganto.visual.roompark.domain.model.PhotoModel
import com.biganto.visual.roompark.presentation.screen.albums.util.AlbumListAdapter import com.biganto.visual.roompark.presentation.screen.albums.util.AlbumListAdapter
...@@ -20,8 +21,6 @@ import com.biganto.visual.roompark.presentation.screen.albums.util.AlbumsHeaderA ...@@ -20,8 +21,6 @@ import com.biganto.visual.roompark.presentation.screen.albums.util.AlbumsHeaderA
import com.biganto.visual.roompark.presentation.screen.photo.PhotoScreenController import com.biganto.visual.roompark.presentation.screen.photo.PhotoScreenController
import com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration import com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import com.bluelinelabs.conductor.RouterTransaction import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.request.target.SimpleTarget import com.bumptech.glide.request.target.SimpleTarget
import com.bumptech.glide.request.target.Target import com.bumptech.glide.request.target.Target
...@@ -151,8 +150,8 @@ class AlbumsScreenController : ...@@ -151,8 +150,8 @@ class AlbumsScreenController :
private fun render(viewState: AlbumsScreenViewState.PhotoSelected){ private fun render(viewState: AlbumsScreenViewState.PhotoSelected){
router.pushController(RouterTransaction.with(PhotoScreenController(viewState.photoId)) router.pushController(RouterTransaction.with(PhotoScreenController(viewState.photoId))
.pushChangeHandler(VerticalChangeHandler()) .pushChangeHandler(DialogChangeHandler())
.popChangeHandler(FadeChangeHandler(false)) .popChangeHandler(DialogChangeHandler())
) )
} }
......
...@@ -2,15 +2,20 @@ package com.biganto.visual.roompark.presentation.screen.photo ...@@ -2,15 +2,20 @@ package com.biganto.visual.roompark.presentation.screen.photo
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.widget.ImageView
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import androidx.viewpager2.widget.ViewPager2 import androidx.viewpager2.widget.ViewPager2
import butterknife.BindView import butterknife.BindView
import butterknife.OnClick
import com.biganto.visual.roompark.R import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity 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.conductor.dialogs.ChooseResolutionDialogController
import com.biganto.visual.roompark.conductor.dialogs.change_handler.DialogChangeHandler
import com.biganto.visual.roompark.presentation.screen.photo.util.PhotoPreviewSlider import com.biganto.visual.roompark.presentation.screen.photo.util.PhotoPreviewSlider
import com.biganto.visual.roompark.presentation.screen.photo.util.PhotosAdapter import com.biganto.visual.roompark.presentation.screen.photo.util.PhotosAdapter
import com.bluelinelabs.conductor.RouterTransaction
import com.google.android.material.textview.MaterialTextView import com.google.android.material.textview.MaterialTextView
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
...@@ -42,6 +47,20 @@ class PhotoScreenController : ...@@ -42,6 +47,20 @@ class PhotoScreenController :
@BindView(R.id.photosPreviewSlider) @BindView(R.id.photosPreviewSlider)
lateinit var slider: PhotoPreviewSlider lateinit var slider: PhotoPreviewSlider
@BindView(R.id.choose_size_button)
lateinit var chooseSizeButton : ImageView
@OnClick(R.id.choose_size_button)
fun onSwitchSize(){
router.pushController(RouterTransaction.with(ChooseResolutionDialogController(ArrayList(
(photoViewPager.adapter as PhotosAdapter)
.getItem(photoViewPager.currentItem).resolutionList
)
)).pushChangeHandler(DialogChangeHandler())
.popChangeHandler(DialogChangeHandler())
)
}
override fun onAttach(view: View) { override fun onAttach(view: View) {
tempSystemUiFlag = activity?.window?.decorView?.systemUiVisibility tempSystemUiFlag = activity?.window?.decorView?.systemUiVisibility
activity?.window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN activity?.window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_FULLSCREEN
...@@ -50,7 +69,7 @@ class PhotoScreenController : ...@@ -50,7 +69,7 @@ class PhotoScreenController :
private var tempSystemUiFlag : Int? = null private var tempSystemUiFlag : Int? = null
override fun onDetach(view: View) { override fun onDetach(view: View) {
activity?.window?.decorView?.systemUiVisibility = tempSystemUiFlag?:View.SYSTEM_UI_FLAG_LAYOUT_STABLE // activity?.window?.decorView?.systemUiVisibility = tempSystemUiFlag?:View.SYSTEM_UI_FLAG_LAYOUT_STABLE
super.onDetach(view) super.onDetach(view)
} }
......
...@@ -28,9 +28,10 @@ class PhotosAdapter : CommonRecyclerAdapter<PhotosViewHolder, PhotoModel>() { ...@@ -28,9 +28,10 @@ class PhotosAdapter : CommonRecyclerAdapter<PhotosViewHolder, PhotoModel>() {
val ret = list.map { it.resolutionList.lowelest()?.url?: error("No res urls!")}.toList() val ret = list.map { it.resolutionList.lowelest()?.url?: error("No res urls!")}.toList()
Timber.d("$ret") Timber.d("$ret")
return ret return ret
} }
fun getItem(index:Int) = list[index]
fun indexById(id:Int):Int = list.indexOfFirst { it.photoId == id } fun indexById(id:Int):Int = list.indexOfFirst { it.photoId == id }
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linearLayout7" android:id="@+id/linearLayout7"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="@color/colorPrimary">
<FrameLayout <FrameLayout
android:id="@+id/frameLayout2" android:id="@+id/frameLayout2"
...@@ -25,8 +26,9 @@ ...@@ -25,8 +26,9 @@
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:text="ОТКРЫТЬ\nВ ДРУГОМ РАЗМЕРЕ" android:text="ОТКРЫТЬ\nВ ДРУГОМ РАЗМЕРЕ"
android:textAlignment="center" android:textAlignment="viewStart"
app:layout_constraintBottom_toTopOf="@+id/include4" app:layout_constraintBottom_toTopOf="@+id/include4"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />
...@@ -36,6 +38,7 @@ ...@@ -36,6 +38,7 @@
layout="@layout/horizontal_divider" layout="@layout/horizontal_divider"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="1dp" android:layout_height="1dp"
android:layout_marginStart="16dp"
app:layout_constraintBottom_toTopOf="@+id/photoSizesRecyclerView" app:layout_constraintBottom_toTopOf="@+id/photoSizesRecyclerView"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />
...@@ -44,6 +47,7 @@ ...@@ -44,6 +47,7 @@
android:id="@+id/photoSizesRecyclerView" android:id="@+id/photoSizesRecyclerView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp"
app:layout_constraintBottom_toTopOf="@+id/materialTextView" app:layout_constraintBottom_toTopOf="@+id/materialTextView"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />
...@@ -52,9 +56,10 @@ ...@@ -52,9 +56,10 @@
android:id="@+id/materialTextView" android:id="@+id/materialTextView"
style="@style/Default_TextView.Cancel_Text" style="@style/Default_TextView.Cancel_Text"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="144dp" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:paddingBottom="44dp" android:paddingTop="32dp"
android:paddingBottom="64dp"
android:text="ОТМЕНА" android:text="ОТМЕНА"
android:textAlignment="gravity" android:textAlignment="gravity"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
app:srcCompat="@drawable/iic_full_view" /> app:srcCompat="@drawable/iic_full_view" />
<ImageView <ImageView
android:id="@+id/change_size_button" android:id="@+id/choose_size_button"
android:layout_width="24dp" android:layout_width="24dp"
android:layout_height="24dp" android:layout_height="24dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="invisible" android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/change_size_button" app:layout_constraintEnd_toStartOf="@+id/choose_size_button"
app:layout_constraintStart_toEndOf="@+id/show_full_button" app:layout_constraintStart_toEndOf="@+id/show_full_button"
app:layout_constraintTop_toTopOf="@+id/guideline2" app:layout_constraintTop_toTopOf="@+id/guideline2"
app:layout_constraintVertical_bias="0.0" /> app:layout_constraintVertical_bias="0.0" />
......
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