• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.car.docklib.view
18 
19 import android.content.Context
20 import android.util.AttributeSet
21 import android.widget.FrameLayout
22 import androidx.recyclerview.widget.RecyclerView
23 import com.android.car.docklib.R
24 
25 class DockView
26 @JvmOverloads
27 constructor(
28     context: Context,
29     attrs: AttributeSet? = null,
30     defStyleAttr: Int = 0,
31     defStyleRes: Int = 0
32 ) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) {
33 
34     private val recyclerView: RecyclerView
35 
36     init {
37         inflate(context, R.layout.dock_view, this)
38         recyclerView = requireViewById(R.id.recycler_view)
39     }
40 
getAdapternull41     fun getAdapter() = recyclerView.adapter as DockAdapter
42 
43     fun setAdapter(adapter: DockAdapter) {
44         recyclerView.adapter = adapter
45     }
46 }
47