You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to FirebaseUI and thanks for submitting an issue!
Please take a look at open issues, as well as resolved issues, to see if your issue is either already being addressed, or has been solved by someone else.
If not, please feel free to fill in the following info so we can help faster!
Step 1: Are you in the right place?
For issues or feature requests related to the code in this repository file a GitHub issue.
For general technical questions, post a question on StackOverflow tagged appropriately.
For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel
Step 2: Describe your environment
Android device: Android 13+
Android OS version: target sdk 34
Google Play Services version: _____
Firebase/Play Services SDK version: 33.1.0
FirebaseUI version: 8.0.2
Step 3: Describe the problem:
I am unable to override getItem function when extending the FirestorePagingAdapter. The build fails saying 'getItem' is final and cannot be overriden. I need to override getItem because I am trying to insert a header item in the list.
Steps to reproduce:
Observed Results:
What happened? This could be a description, logcat output, etc.
Build fails:
Expected Results:
What did you expect to happen?
Expected to be able to override this function as it is marked protected in PagingDataAdapter class
Relevant Code:
class VideoFirebaseAdapter(var context: Context,
private var showCategory: Boolean = true,
options: FirestorePagingOptions<VideoMetadata>,
private val hasHeader:Boolean = false)
:FirestorePagingAdapter<VideoMetadata, RecyclerView.ViewHolder>(options) {
private val TYPE_HEADER = 0
private val TYPE_ITEM = 1
val TAG = "VideoAdapter"
var config = ImageLoaderConfiguration.Builder(this.context)
.build()!!
private val loader: ImageLoader = ImageLoader.getInstance()
init {
loader.init(config)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return if (hasHeader && viewType == TYPE_HEADER) {
getHeaderVH(parent, viewType)!!
} else {
val itemView = LayoutInflater.from(context).inflate(R.layout.video_item, parent, false)
VideoListItemVH(itemView, showCategory, context, loader)
}
}
abstract fun getHeaderVH(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder?
override fun getItemViewType(position: Int): Int {
return TYPE_ITEM
return if (hasHeader && position == 0)
TYPE_HEADER
else
TYPE_ITEM
}
override fun getItemCount(): Int {
return if (hasHeader)
super.getItemCount() + 1
else
super.getItemCount()
}
// fails to override saying getItem is final
override fun getItem(position: Int): DocumentSnapshot? {
if(hasHeader) {
if(position==0) return super.getItem(0) // This will be ignored!
return super.getItem(position-1)
}
return super.getItem(position)
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int, video: VideoMetadata) {
if (hasHeader && holder !is VideoListItemVH) {
return
} else {
(holder as VideoListItemVH).bind(video)
}
}
}
The text was updated successfully, but these errors were encountered:
Welcome to FirebaseUI and thanks for submitting an issue!
Please take a look at open issues, as well as resolved issues, to see if your issue is either already being addressed, or has been solved by someone else.
If not, please feel free to fill in the following info so we can help faster!
Step 1: Are you in the right place?
Step 2: Describe your environment
Step 3: Describe the problem:
I am unable to override getItem function when extending the FirestorePagingAdapter. The build fails saying 'getItem' is final and cannot be overriden. I need to override getItem because I am trying to insert a header item in the list.
Steps to reproduce:
Observed Results:
logcat
output, etc.Build fails:
Expected Results:
Expected to be able to override this function as it is marked protected in PagingDataAdapter class
Relevant Code:
The text was updated successfully, but these errors were encountered: