Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DemoTuyaKotlin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Nguyễn Cường
DemoTuyaKotlin
Commits
4a198700
Commit
4a198700
authored
Mar 02, 2024
by
vunguyencuong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug RecyclerView
parent
446a7e24
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
25 deletions
+55
-25
RoomFragment.kt
...a/com/tuya/appsdk/sample/viettelhome/home/RoomFragment.kt
+13
-4
fragment_device.xml
app/src/main/res/layout/fragment_device.xml
+1
-1
fragment_list_device_item.xml
app/src/main/res/layout/fragment_list_device_item.xml
+15
-12
fragment_room.xml
app/src/main/res/layout/fragment_room.xml
+24
-6
item_device.xml
app/src/main/res/layout/item_device.xml
+1
-1
my_nav.xml
app/src/main/res/navigation/my_nav.xml
+1
-1
No files found.
app/src/main/java/com/tuya/appsdk/sample/viettelhome/home/RoomFragment.kt
View file @
4a198700
package
com.tuya.appsdk.sample.viettelhome.home
import
android.os.Bundle
import
android.util.Log
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
...
...
@@ -11,6 +12,7 @@ import com.tuya.appsdk.sample.databinding.FragmentListDeviceItemBinding
import
com.tuya.appsdk.sample.databinding.FragmentRoomBinding
import
com.tuya.appsdk.sample.viettelhome.adapter.DeviceAdapter
import
com.tuya.appsdk.sample.viettelhome.device.Device
import
kotlin.math.log
class
RoomFragment
:
Fragment
()
{
...
...
@@ -29,11 +31,18 @@ class RoomFragment : Fragment() {
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
{
binding
=
FragmentRoomBinding
.
inflate
(
layoutInflater
)
binding
.
layoutListDevice
.
recycleListDeviceItem
.
apply
{
layoutManager
=
LinearLayoutManager
(
requireContext
())
binding
=
FragmentRoomBinding
.
inflate
(
inflater
)
return
binding
.
root
}
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
// binding.layoutListDevice.recycleListDeviceItem.apply {
// adapter = DeviceAdapter(demoList)
// }
binding
.
recycleListDeviceItem
.
apply
{
Log
.
d
(
"check"
,
"onViewCreated: done"
)
adapter
=
DeviceAdapter
(
demoList
)
}
return
binding
.
root
}
}
\ No newline at end of file
app/src/main/res/layout/fragment_device.xml
View file @
4a198700
...
...
@@ -96,7 +96,7 @@
app:tabIndicatorFullWidth=
"true"
app:tabMode=
"scrollable"
app:tabGravity=
"center"
android:layout_marginStart=
"16dp"
/>
android:layout_marginStart=
"16dp"
/>
<androidx.viewpager2.widget.ViewPager2
android:id=
"@+id/viewpager2"
...
...
app/src/main/res/layout/fragment_list_device_item.xml
View file @
4a198700
...
...
@@ -3,6 +3,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:background=
"@drawable/bg_background_radius_15"
>
<TextView
...
...
@@ -50,16 +51,18 @@
android:layout_marginStart=
"16dp"
android:layout_marginEnd=
"16dp"
android:layout_marginTop=
"8dp"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recycle_list_device_item"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/tv_detail_list_item"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_marginTop=
"16dp"
android:layout_marginStart=
"16dp"
android:layout_marginEnd=
"16dp"
/>
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/recycle_list_device_item"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- app:layout_constraintTop_toBottomOf="@id/tv_detail_list_item"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:layout_marginStart="16dp"-->
<!-- android:layout_marginEnd="16dp"-->
<!-- app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"-->
<!-- android:orientation="vertical"-->
<!-- tools:listitem="@layout/item_device"-->
<!-- android:background="@color/red"/>-->
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_room.xml
View file @
4a198700
...
...
@@ -7,7 +7,8 @@
tools:context=
".viettelhome.room.RoomFragment"
android:background=
"#F5F5F5"
>
<LinearLayout
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recycle_list_device_item"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toTopOf=
"parent"
...
...
@@ -15,13 +16,30 @@
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_marginTop=
"16dp"
android:layout_marginStart=
"16dp"
android:layout_marginEnd=
"16dp"
>
android:layout_marginEnd=
"16dp"
app:layoutManager=
"androidx.recyclerview.widget.LinearLayoutManager"
android:orientation=
"vertical"
tools:listitem=
"@layout/item_device"
/>
<include
android:id=
"@+id/layout_list_device"
layout=
"@layout/fragment_list_device_item"
/>
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="0dp"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- android:layout_marginTop="16dp"-->
<!-- android:layout_marginStart="16dp"-->
<!-- android:layout_marginEnd="16dp">-->
<!-- <include-->
<!-- android:id="@+id/layout_list_device"-->
<!-- android:layout_height="300dp"-->
<!-- android:layout_width="match_parent"-->
<!-- layout= "@layout/fragment_list_device_item"-->
<!-- />-->
</LinearLayout
>
<!-- </LinearLayout>--
>
<!-- <ImageView-->
<!-- android:id="@+id/img_bg_device_in_room"-->
...
...
app/src/main/res/layout/item_device.xml
View file @
4a198700
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
60dp
"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<ImageView
...
...
app/src/main/res/navigation/my_nav.xml
View file @
4a198700
...
...
@@ -3,7 +3,7 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/my_nav"
app:startDestination=
"@id/
login
Fragment"
>
app:startDestination=
"@id/
homeManage
Fragment"
>
<fragment
android:id=
"@+id/loginFragment"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment