From 6da6f7886a0370a6caeb6a7538c6174abeabcdd1 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Tue, 22 Sep 2020 22:37:39 +0530 Subject: [PATCH] tv: set layout manager from XML Signed-off-by: Harsh Shandilya --- .../main/java/com/wireguard/android/activity/TvMainActivity.kt | 2 -- ui/src/main/res/layout/tv_activity.xml | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt b/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt index 19e75d72..7b93f563 100644 --- a/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt +++ b/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt @@ -16,7 +16,6 @@ import androidx.core.view.forEach import androidx.databinding.DataBindingUtil import androidx.databinding.ObservableBoolean import androidx.lifecycle.lifecycleScope -import androidx.recyclerview.widget.GridLayoutManager import com.wireguard.android.Application import com.wireguard.android.R import com.wireguard.android.backend.GoBackend @@ -110,7 +109,6 @@ class TvMainActivity : AppCompatActivity() { binding.deleteButton.setOnClickListener { isDeleting.set(!isDeleting.get()) } - binding.tunnelList.layoutManager = GridLayoutManager(this, 3) binding.executePendingBindings() setContentView(binding.root) diff --git a/ui/src/main/res/layout/tv_activity.xml b/ui/src/main/res/layout/tv_activity.xml index 62c04076..75fe6490 100644 --- a/ui/src/main/res/layout/tv_activity.xml +++ b/ui/src/main/res/layout/tv_activity.xml @@ -57,9 +57,11 @@ app:configurationHandler="@{rowConfigurationHandler}" app:items="@{tunnels}" app:layout="@{@layout/tv_tunnel_list_item}" + app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" app:layout_constraintBottom_toTopOf="@id/delete_button" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/banner_logo" + app:spanCount="3" tools:itemCount="10" tools:listitem="@layout/tv_tunnel_list_item" />