mirror of
https://gitlab.shinice.net/pixeldroid/PixelDroid
synced 2024-12-24 22:11:31 +01:00
Merge branch 'crash_fix' into 'master'
Crash fix See merge request pixeldroid/PixelDroid!367
This commit is contained in:
commit
71f55d1be0
@ -123,7 +123,7 @@ dependencies {
|
||||
implementation "androidx.annotation:annotation:1.2.0"
|
||||
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
||||
implementation "androidx.activity:activity-ktx:1.2.3"
|
||||
implementation 'androidx.fragment:fragment-ktx:1.3.4'
|
||||
implementation 'androidx.fragment:fragment-ktx:1.3.5'
|
||||
|
||||
// Use the most recent version of CameraX
|
||||
def cameraX_version = '1.0.0'
|
||||
@ -203,7 +203,7 @@ dependencies {
|
||||
|
||||
// debugImplementation required vs testImplementation: https://issuetracker.google.com/issues/128612536
|
||||
//noinspection FragmentGradleConfiguration
|
||||
stagingImplementation("androidx.fragment:fragment-testing:1.3.4") {
|
||||
stagingImplementation("androidx.fragment:fragment-testing:1.3.5") {
|
||||
exclude group:'androidx.test', module:'monitor'
|
||||
}
|
||||
|
||||
|
@ -88,8 +88,8 @@ class PostFeedFragment<T: FeedContentDatabase>: CachedFeedFragment<T>() {
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
val uiModel = getItem(position) as Status
|
||||
uiModel.let {
|
||||
val uiModel = getItem(position) as Status?
|
||||
uiModel?.let {
|
||||
(holder as StatusViewHolder).bind(it, apiHolder, db, lifecycleScope, displayDimensionsInPx)
|
||||
}
|
||||
}
|
||||
|
@ -91,13 +91,10 @@ class UncachedPostsFragment : UncachedFeedFragment<Status>() {
|
||||
return StatusViewHolder.create(parent)
|
||||
}
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return R.layout.post_fragment
|
||||
}
|
||||
override fun getItemViewType(position: Int): Int = R.layout.post_fragment
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
val uiModel = getItem(position) as Status
|
||||
uiModel.let {
|
||||
getItem(position)?.let {
|
||||
(holder as StatusViewHolder).bind(it, apiHolder, db, lifecycleScope, displayDimensionsInPx)
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ class SearchDiscoverFragment : BaseFragment() {
|
||||
* [RecyclerView.Adapter] that can display a list of [Status]s' thumbnails for the discover view
|
||||
*/
|
||||
class DiscoverRecyclerViewAdapter: RecyclerView.Adapter<ProfilePostViewHolder>() {
|
||||
private val posts: ArrayList<Status> = ArrayList()
|
||||
private val posts: ArrayList<Status?> = ArrayList()
|
||||
|
||||
fun addPosts(newPosts : List<Status>) {
|
||||
posts.clear()
|
||||
@ -116,12 +116,12 @@ class SearchDiscoverFragment : BaseFragment() {
|
||||
|
||||
override fun onBindViewHolder(holder: ProfilePostViewHolder, position: Int) {
|
||||
val post = posts[position]
|
||||
if(post.media_attachments?.size ?: 0 > 1) {
|
||||
if(post?.media_attachments?.size ?: 0 > 1) {
|
||||
holder.albumIcon.visibility = View.VISIBLE
|
||||
} else {
|
||||
holder.albumIcon.visibility = View.GONE
|
||||
}
|
||||
ImageConverter.setSquareImageFromURL(holder.postView, post.media_attachments?.firstOrNull()?.preview_url, holder.postPreview, post.media_attachments?.firstOrNull()?.blurhash)
|
||||
ImageConverter.setSquareImageFromURL(holder.postView, post?.media_attachments?.firstOrNull()?.preview_url, holder.postPreview, post?.media_attachments?.firstOrNull()?.blurhash)
|
||||
holder.postPreview.setOnClickListener {
|
||||
val intent = Intent(holder.postView.context, PostActivity::class.java)
|
||||
intent.putExtra(Status.POST_TAG, post)
|
||||
|
Loading…
Reference in New Issue
Block a user