tv: set layout manager from XML

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-09-22 22:37:39 +05:30 committed by Jason A. Donenfeld
parent 8c2029870f
commit 6da6f7886a
2 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,6 @@ import androidx.core.view.forEach
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.databinding.ObservableBoolean import androidx.databinding.ObservableBoolean
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager
import com.wireguard.android.Application import com.wireguard.android.Application
import com.wireguard.android.R import com.wireguard.android.R
import com.wireguard.android.backend.GoBackend import com.wireguard.android.backend.GoBackend
@ -110,7 +109,6 @@ class TvMainActivity : AppCompatActivity() {
binding.deleteButton.setOnClickListener { binding.deleteButton.setOnClickListener {
isDeleting.set(!isDeleting.get()) isDeleting.set(!isDeleting.get())
} }
binding.tunnelList.layoutManager = GridLayoutManager(this, 3)
binding.executePendingBindings() binding.executePendingBindings()
setContentView(binding.root) setContentView(binding.root)

View File

@ -57,9 +57,11 @@
app:configurationHandler="@{rowConfigurationHandler}" app:configurationHandler="@{rowConfigurationHandler}"
app:items="@{tunnels}" app:items="@{tunnels}"
app:layout="@{@layout/tv_tunnel_list_item}" app:layout="@{@layout/tv_tunnel_list_item}"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintBottom_toTopOf="@id/delete_button" app:layout_constraintBottom_toTopOf="@id/delete_button"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/banner_logo" app:layout_constraintTop_toBottomOf="@id/banner_logo"
app:spanCount="3"
tools:itemCount="10" tools:itemCount="10"
tools:listitem="@layout/tv_tunnel_list_item" /> tools:listitem="@layout/tv_tunnel_list_item" />