2019-01-28 17:46:39 +01:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
package org.mozilla.fenix.home.sessions
|
|
|
|
|
2019-01-30 03:59:19 +01:00
|
|
|
import android.view.LayoutInflater
|
2019-01-28 17:46:39 +01:00
|
|
|
import android.view.ViewGroup
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
2019-01-30 03:59:19 +01:00
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
2019-01-28 17:46:39 +01:00
|
|
|
import io.reactivex.functions.Consumer
|
2019-01-30 03:59:19 +01:00
|
|
|
import org.mozilla.fenix.R
|
2019-01-28 17:46:39 +01:00
|
|
|
import org.mozilla.fenix.mvi.ActionBusFactory
|
|
|
|
import org.mozilla.fenix.mvi.UIView
|
|
|
|
|
2019-01-30 03:59:19 +01:00
|
|
|
class SessionsUIView(container: ViewGroup, bus: ActionBusFactory) :
|
|
|
|
UIView<SessionsState>(container, bus) {
|
2019-01-28 17:46:39 +01:00
|
|
|
|
2019-01-30 03:59:19 +01:00
|
|
|
override val view: RecyclerView = LayoutInflater.from(container.context)
|
|
|
|
.inflate(R.layout.component_sessions, container, true)
|
|
|
|
.findViewById(R.id.session_list)
|
2019-01-28 17:46:39 +01:00
|
|
|
|
2019-01-30 03:59:19 +01:00
|
|
|
private val sessionsAdapter = SessionsAdapter()
|
2019-01-29 20:20:29 +01:00
|
|
|
|
2019-01-28 17:46:39 +01:00
|
|
|
init {
|
2019-01-30 03:59:19 +01:00
|
|
|
view.apply {
|
2019-01-30 00:51:51 +01:00
|
|
|
layoutManager = LinearLayoutManager(container.context)
|
2019-01-30 03:59:19 +01:00
|
|
|
adapter = sessionsAdapter
|
2019-01-28 17:46:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun updateView() = Consumer<SessionsState> {
|
|
|
|
}
|
|
|
|
}
|