mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-24 22:15:41 +03:00
pass DateUtils instance to viewHolder
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
6aece2940e
commit
96176c4f1c
3 changed files with 12 additions and 9 deletions
|
@ -46,6 +46,7 @@ import com.nextcloud.talk.remotefilebrowser.adapters.RemoteFileBrowserItemsAdapt
|
|||
import com.nextcloud.talk.remotefilebrowser.viewmodels.RemoteFileBrowserItemsViewModel
|
||||
import com.nextcloud.talk.ui.dialog.SortingOrderDialogFragment
|
||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||
import com.nextcloud.talk.utils.DateUtils
|
||||
import com.nextcloud.talk.utils.DisplayUtils
|
||||
import com.nextcloud.talk.utils.FileSortOrder
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_MIME_TYPE_FILTER
|
||||
|
@ -64,6 +65,9 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
|||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
@Inject
|
||||
lateinit var dateUtils: DateUtils
|
||||
|
||||
private lateinit var binding: ActivityRemoteFileBrowserBinding
|
||||
private lateinit var viewModel: RemoteFileBrowserItemsViewModel
|
||||
|
||||
|
@ -169,6 +173,7 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
|||
user = currentUserProvider.currentUser.blockingGet(),
|
||||
selectionInterface = this,
|
||||
viewThemeUtils = viewThemeUtils,
|
||||
dateUtils = dateUtils,
|
||||
onItemClicked = viewModel::onItemClicked
|
||||
)
|
||||
adapter.items = remoteFileBrowserItems
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.nextcloud.talk.databinding.RvItemBrowserFileBinding
|
|||
import com.nextcloud.talk.remotefilebrowser.SelectionInterface
|
||||
import com.nextcloud.talk.remotefilebrowser.model.RemoteFileBrowserItem
|
||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||
import com.nextcloud.talk.utils.DateUtils
|
||||
|
||||
class RemoteFileBrowserItemsAdapter(
|
||||
private val showGrid: Boolean = false,
|
||||
|
@ -36,6 +37,7 @@ class RemoteFileBrowserItemsAdapter(
|
|||
private val user: User,
|
||||
private val selectionInterface: SelectionInterface,
|
||||
private val viewThemeUtils: ViewThemeUtils,
|
||||
private val dateUtils: DateUtils,
|
||||
private val onItemClicked: (RemoteFileBrowserItem) -> Unit
|
||||
) : RecyclerView.Adapter<RemoteFileBrowserItemsViewHolder>() {
|
||||
|
||||
|
@ -52,7 +54,8 @@ class RemoteFileBrowserItemsAdapter(
|
|||
mimeTypeSelectionFilter,
|
||||
user,
|
||||
selectionInterface,
|
||||
viewThemeUtils
|
||||
viewThemeUtils,
|
||||
dateUtils
|
||||
) {
|
||||
onItemClicked(items[it])
|
||||
}
|
||||
|
@ -66,7 +69,8 @@ class RemoteFileBrowserItemsAdapter(
|
|||
mimeTypeSelectionFilter,
|
||||
user,
|
||||
selectionInterface,
|
||||
viewThemeUtils
|
||||
viewThemeUtils,
|
||||
dateUtils
|
||||
) {
|
||||
onItemClicked(items[it])
|
||||
}
|
||||
|
|
|
@ -23,9 +23,7 @@ package com.nextcloud.talk.remotefilebrowser.adapters
|
|||
import android.text.format.Formatter
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import autodagger.AutoInjector
|
||||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.data.user.model.User
|
||||
import com.nextcloud.talk.databinding.RvItemBrowserFileBinding
|
||||
import com.nextcloud.talk.extensions.loadImage
|
||||
|
@ -35,21 +33,17 @@ import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
|||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.DateUtils
|
||||
import com.nextcloud.talk.utils.Mimetype.FOLDER
|
||||
import javax.inject.Inject
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication::class)
|
||||
class RemoteFileBrowserItemsListViewHolder(
|
||||
override val binding: RvItemBrowserFileBinding,
|
||||
mimeTypeSelectionFilter: String?,
|
||||
currentUser: User,
|
||||
selectionInterface: SelectionInterface,
|
||||
private val viewThemeUtils: ViewThemeUtils,
|
||||
private val dateUtils: DateUtils,
|
||||
onItemClicked: (Int) -> Unit
|
||||
) : RemoteFileBrowserItemsViewHolder(binding, mimeTypeSelectionFilter, currentUser, selectionInterface) {
|
||||
|
||||
@Inject
|
||||
lateinit var dateUtils: DateUtils
|
||||
|
||||
override val fileIcon: ImageView
|
||||
get() = binding.fileIcon
|
||||
|
||||
|
|
Loading…
Reference in a new issue