mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-21 20:45:29 +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.remotefilebrowser.viewmodels.RemoteFileBrowserItemsViewModel
|
||||||
import com.nextcloud.talk.ui.dialog.SortingOrderDialogFragment
|
import com.nextcloud.talk.ui.dialog.SortingOrderDialogFragment
|
||||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||||
|
import com.nextcloud.talk.utils.DateUtils
|
||||||
import com.nextcloud.talk.utils.DisplayUtils
|
import com.nextcloud.talk.utils.DisplayUtils
|
||||||
import com.nextcloud.talk.utils.FileSortOrder
|
import com.nextcloud.talk.utils.FileSortOrder
|
||||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_MIME_TYPE_FILTER
|
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_MIME_TYPE_FILTER
|
||||||
|
@ -64,6 +65,9 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var viewThemeUtils: ViewThemeUtils
|
lateinit var viewThemeUtils: ViewThemeUtils
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var dateUtils: DateUtils
|
||||||
|
|
||||||
private lateinit var binding: ActivityRemoteFileBrowserBinding
|
private lateinit var binding: ActivityRemoteFileBrowserBinding
|
||||||
private lateinit var viewModel: RemoteFileBrowserItemsViewModel
|
private lateinit var viewModel: RemoteFileBrowserItemsViewModel
|
||||||
|
|
||||||
|
@ -169,6 +173,7 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
||||||
user = currentUserProvider.currentUser.blockingGet(),
|
user = currentUserProvider.currentUser.blockingGet(),
|
||||||
selectionInterface = this,
|
selectionInterface = this,
|
||||||
viewThemeUtils = viewThemeUtils,
|
viewThemeUtils = viewThemeUtils,
|
||||||
|
dateUtils = dateUtils,
|
||||||
onItemClicked = viewModel::onItemClicked
|
onItemClicked = viewModel::onItemClicked
|
||||||
)
|
)
|
||||||
adapter.items = remoteFileBrowserItems
|
adapter.items = remoteFileBrowserItems
|
||||||
|
|
|
@ -29,6 +29,7 @@ import com.nextcloud.talk.databinding.RvItemBrowserFileBinding
|
||||||
import com.nextcloud.talk.remotefilebrowser.SelectionInterface
|
import com.nextcloud.talk.remotefilebrowser.SelectionInterface
|
||||||
import com.nextcloud.talk.remotefilebrowser.model.RemoteFileBrowserItem
|
import com.nextcloud.talk.remotefilebrowser.model.RemoteFileBrowserItem
|
||||||
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
import com.nextcloud.talk.ui.theme.ViewThemeUtils
|
||||||
|
import com.nextcloud.talk.utils.DateUtils
|
||||||
|
|
||||||
class RemoteFileBrowserItemsAdapter(
|
class RemoteFileBrowserItemsAdapter(
|
||||||
private val showGrid: Boolean = false,
|
private val showGrid: Boolean = false,
|
||||||
|
@ -36,6 +37,7 @@ class RemoteFileBrowserItemsAdapter(
|
||||||
private val user: User,
|
private val user: User,
|
||||||
private val selectionInterface: SelectionInterface,
|
private val selectionInterface: SelectionInterface,
|
||||||
private val viewThemeUtils: ViewThemeUtils,
|
private val viewThemeUtils: ViewThemeUtils,
|
||||||
|
private val dateUtils: DateUtils,
|
||||||
private val onItemClicked: (RemoteFileBrowserItem) -> Unit
|
private val onItemClicked: (RemoteFileBrowserItem) -> Unit
|
||||||
) : RecyclerView.Adapter<RemoteFileBrowserItemsViewHolder>() {
|
) : RecyclerView.Adapter<RemoteFileBrowserItemsViewHolder>() {
|
||||||
|
|
||||||
|
@ -52,7 +54,8 @@ class RemoteFileBrowserItemsAdapter(
|
||||||
mimeTypeSelectionFilter,
|
mimeTypeSelectionFilter,
|
||||||
user,
|
user,
|
||||||
selectionInterface,
|
selectionInterface,
|
||||||
viewThemeUtils
|
viewThemeUtils,
|
||||||
|
dateUtils
|
||||||
) {
|
) {
|
||||||
onItemClicked(items[it])
|
onItemClicked(items[it])
|
||||||
}
|
}
|
||||||
|
@ -66,7 +69,8 @@ class RemoteFileBrowserItemsAdapter(
|
||||||
mimeTypeSelectionFilter,
|
mimeTypeSelectionFilter,
|
||||||
user,
|
user,
|
||||||
selectionInterface,
|
selectionInterface,
|
||||||
viewThemeUtils
|
viewThemeUtils,
|
||||||
|
dateUtils
|
||||||
) {
|
) {
|
||||||
onItemClicked(items[it])
|
onItemClicked(items[it])
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,7 @@ package com.nextcloud.talk.remotefilebrowser.adapters
|
||||||
import android.text.format.Formatter
|
import android.text.format.Formatter
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import autodagger.AutoInjector
|
|
||||||
import com.nextcloud.talk.R
|
import com.nextcloud.talk.R
|
||||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
|
||||||
import com.nextcloud.talk.data.user.model.User
|
import com.nextcloud.talk.data.user.model.User
|
||||||
import com.nextcloud.talk.databinding.RvItemBrowserFileBinding
|
import com.nextcloud.talk.databinding.RvItemBrowserFileBinding
|
||||||
import com.nextcloud.talk.extensions.loadImage
|
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.ApiUtils
|
||||||
import com.nextcloud.talk.utils.DateUtils
|
import com.nextcloud.talk.utils.DateUtils
|
||||||
import com.nextcloud.talk.utils.Mimetype.FOLDER
|
import com.nextcloud.talk.utils.Mimetype.FOLDER
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication::class)
|
|
||||||
class RemoteFileBrowserItemsListViewHolder(
|
class RemoteFileBrowserItemsListViewHolder(
|
||||||
override val binding: RvItemBrowserFileBinding,
|
override val binding: RvItemBrowserFileBinding,
|
||||||
mimeTypeSelectionFilter: String?,
|
mimeTypeSelectionFilter: String?,
|
||||||
currentUser: User,
|
currentUser: User,
|
||||||
selectionInterface: SelectionInterface,
|
selectionInterface: SelectionInterface,
|
||||||
private val viewThemeUtils: ViewThemeUtils,
|
private val viewThemeUtils: ViewThemeUtils,
|
||||||
|
private val dateUtils: DateUtils,
|
||||||
onItemClicked: (Int) -> Unit
|
onItemClicked: (Int) -> Unit
|
||||||
) : RemoteFileBrowserItemsViewHolder(binding, mimeTypeSelectionFilter, currentUser, selectionInterface) {
|
) : RemoteFileBrowserItemsViewHolder(binding, mimeTypeSelectionFilter, currentUser, selectionInterface) {
|
||||||
|
|
||||||
@Inject
|
|
||||||
lateinit var dateUtils: DateUtils
|
|
||||||
|
|
||||||
override val fileIcon: ImageView
|
override val fileIcon: ImageView
|
||||||
get() = binding.fileIcon
|
get() = binding.fileIcon
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue