mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 15:05:44 +03:00
create narrow(er) interface for file selection
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
ed09934c7a
commit
80eccf3176
7 changed files with 38 additions and 14 deletions
|
@ -20,6 +20,7 @@
|
|||
|
||||
package com.nextcloud.talk.interfaces
|
||||
|
||||
@Deprecated("To be replaced with com.nextcloud.talk.remotefilebrowser.SelectionInterface")
|
||||
interface SelectionInterface {
|
||||
fun toggleBrowserItemSelection(path: String)
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Mario Danic
|
||||
* @author Andy Scherzinger
|
||||
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
||||
* Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.nextcloud.talk.remotefilebrowser
|
||||
|
||||
interface SelectionInterface {
|
||||
fun isPathSelected(path: String): Boolean
|
||||
}
|
|
@ -2,7 +2,9 @@
|
|||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* @author Álvaro Brey
|
||||
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
||||
* Copyright (C) 2022 Álvaro Brey <alvaro.brey@nextcloud.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -38,7 +40,7 @@ import autodagger.AutoInjector
|
|||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.databinding.ActivityRemoteFileBrowserBinding
|
||||
import com.nextcloud.talk.interfaces.SelectionInterface
|
||||
import com.nextcloud.talk.remotefilebrowser.SelectionInterface
|
||||
import com.nextcloud.talk.remotefilebrowser.adapters.RemoteFileBrowserItemsAdapter
|
||||
import com.nextcloud.talk.remotefilebrowser.viewmodels.RemoteFileBrowserItemsViewModel
|
||||
import com.nextcloud.talk.ui.dialog.SortingOrderDialogFragment
|
||||
|
@ -121,7 +123,7 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
|||
|
||||
// TODO make mimeTypeSelectionFilter a bundled arg for the activity
|
||||
val mimeTypeSelectionFilter = "image/"
|
||||
// TODO do not needlesly recreate adapter if it can be reused
|
||||
// TODO do not needlessly recreate adapter if it can be reused
|
||||
val adapter = RemoteFileBrowserItemsAdapter(
|
||||
showGrid = showGrid,
|
||||
mimeTypeSelectionFilter = mimeTypeSelectionFilter,
|
||||
|
@ -240,16 +242,8 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
|||
const val REQUEST_CODE_SELECT_AVATAR = 22
|
||||
}
|
||||
|
||||
override fun toggleBrowserItemSelection(path: String) {
|
||||
// unused, viewmodel gets called directly
|
||||
}
|
||||
|
||||
override fun isPathSelected(path: String): Boolean {
|
||||
// TODO figure out a better way to do this. Narrower interface?
|
||||
return viewModel.isPathSelected(path)
|
||||
}
|
||||
|
||||
override fun shouldOnlySelectOneImageFile(): Boolean {
|
||||
return true // unused
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ import android.view.LayoutInflater
|
|||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.nextcloud.talk.databinding.RvItemBrowserFileBinding
|
||||
import com.nextcloud.talk.interfaces.SelectionInterface
|
||||
import com.nextcloud.talk.models.database.UserEntity
|
||||
import com.nextcloud.talk.remotefilebrowser.SelectionInterface
|
||||
import com.nextcloud.talk.remotefilebrowser.model.RemoteFileBrowserItem
|
||||
|
||||
class RemoteFileBrowserItemsAdapter(
|
||||
|
|
|
@ -30,8 +30,8 @@ import com.facebook.drawee.view.SimpleDraweeView
|
|||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.databinding.RvItemBrowserFileBinding
|
||||
import com.nextcloud.talk.interfaces.SelectionInterface
|
||||
import com.nextcloud.talk.models.database.UserEntity
|
||||
import com.nextcloud.talk.remotefilebrowser.SelectionInterface
|
||||
import com.nextcloud.talk.remotefilebrowser.model.RemoteFileBrowserItem
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.DateUtils.getLocalDateTimeStringFromTimestamp
|
||||
|
|
|
@ -25,8 +25,8 @@ import androidx.core.content.ContextCompat
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.facebook.drawee.view.SimpleDraweeView
|
||||
import com.nextcloud.talk.interfaces.SelectionInterface
|
||||
import com.nextcloud.talk.models.database.UserEntity
|
||||
import com.nextcloud.talk.remotefilebrowser.SelectionInterface
|
||||
import com.nextcloud.talk.remotefilebrowser.model.RemoteFileBrowserItem
|
||||
import com.nextcloud.talk.utils.DrawableUtils
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
* Nextcloud Talk application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* Copyright (C) 202 Andy Scherzinger <info@andy-scherzinger.de>
|
||||
* @author Álvaro Brey
|
||||
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
|
||||
* Copyright (C) 2022 Álvaro Brey <alvaro.brey@nextcloud.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
Loading…
Reference in a new issue