From 264877119619f32e33c0dc133cd48fbc81994c1e Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Tue, 23 Aug 2022 17:19:03 +0300 Subject: [PATCH] Create custom view for other sessions. --- .../devices/v2/list/OtherSessionsView.kt | 43 +++++++++++++++++++ ...ssion_list.xml => view_other_sessions.xml} | 15 ++++--- 2 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 vector/src/main/java/im/vector/app/features/settings/devices/v2/list/OtherSessionsView.kt rename vector/src/main/res/layout/{view_other_session_list.xml => view_other_sessions.xml} (77%) diff --git a/vector/src/main/java/im/vector/app/features/settings/devices/v2/list/OtherSessionsView.kt b/vector/src/main/java/im/vector/app/features/settings/devices/v2/list/OtherSessionsView.kt new file mode 100644 index 0000000000..6275901556 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/settings/devices/v2/list/OtherSessionsView.kt @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2022 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.settings.devices.v2.list + +import android.content.Context +import android.util.AttributeSet +import androidx.constraintlayout.widget.ConstraintLayout +import im.vector.app.R +import im.vector.app.databinding.ViewOtherSessionsBinding +import im.vector.app.features.settings.devices.DeviceFullInfo +import timber.log.Timber + +class OtherSessionsView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr) { + + private val views: ViewOtherSessionsBinding + + init { + inflate(context, R.layout.view_other_sessions, this) + views = ViewOtherSessionsBinding.bind(this) + } + + fun update(devices: List) { + Timber.d("OtherSessionsView. Devices: " + devices.size) + } +} diff --git a/vector/src/main/res/layout/view_other_session_list.xml b/vector/src/main/res/layout/view_other_sessions.xml similarity index 77% rename from vector/src/main/res/layout/view_other_session_list.xml rename to vector/src/main/res/layout/view_other_sessions.xml index 34d34437fb..aacbbe8ffe 100644 --- a/vector/src/main/res/layout/view_other_session_list.xml +++ b/vector/src/main/res/layout/view_other_sessions.xml @@ -1,27 +1,28 @@ + android:layout_width="match_parent" + android:layout_height="match_parent"> + app:layout_constraintTop_toTopOf="parent" + tools:listitem="@layout/item_other_session" />