mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
Shared items: Add tab for other
Resolves: #2029 Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
parent
26fde13292
commit
81a3e8216d
@ -213,12 +213,12 @@ class SharedItemsActivity : AppCompatActivity() {
|
|||||||
// binding.sharedItemsTabs.addTab(tabDeckCard)
|
// binding.sharedItemsTabs.addTab(tabDeckCard)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if(sharedItemTypes.contains(SharedItemType.OTHER)) {
|
if (sharedItemTypes.contains(SharedItemType.OTHER)) {
|
||||||
// val tabOther: TabLayout.Tab = binding.sharedItemsTabs.newTab()
|
val tabOther: TabLayout.Tab = binding.sharedItemsTabs.newTab()
|
||||||
// tabOther.tag = SharedItemType.OTHER
|
tabOther.tag = SharedItemType.OTHER
|
||||||
// tabOther.setText(R.string.shared_items_other)
|
tabOther.setText(R.string.shared_items_other)
|
||||||
// binding.sharedItemsTabs.addTab(tabOther)
|
binding.sharedItemsTabs.addTab(tabOther)
|
||||||
// }
|
}
|
||||||
|
|
||||||
binding.sharedItemsTabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
binding.sharedItemsTabs.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
||||||
override fun onTabSelected(tab: TabLayout.Tab) {
|
override fun onTabSelected(tab: TabLayout.Tab) {
|
||||||
|
@ -34,6 +34,7 @@ import com.nextcloud.talk.shareditems.activities.SharedItemsActivity
|
|||||||
import com.nextcloud.talk.shareditems.model.SharedFileItem
|
import com.nextcloud.talk.shareditems.model.SharedFileItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedItem
|
import com.nextcloud.talk.shareditems.model.SharedItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedLocationItem
|
import com.nextcloud.talk.shareditems.model.SharedLocationItem
|
||||||
|
import com.nextcloud.talk.shareditems.model.SharedOtherItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedPollItem
|
import com.nextcloud.talk.shareditems.model.SharedPollItem
|
||||||
|
|
||||||
class SharedItemsAdapter(
|
class SharedItemsAdapter(
|
||||||
@ -73,6 +74,7 @@ class SharedItemsAdapter(
|
|||||||
is SharedPollItem -> holder.onBind(item, ::showPoll)
|
is SharedPollItem -> holder.onBind(item, ::showPoll)
|
||||||
is SharedFileItem -> holder.onBind(item)
|
is SharedFileItem -> holder.onBind(item)
|
||||||
is SharedLocationItem -> holder.onBind(item)
|
is SharedLocationItem -> holder.onBind(item)
|
||||||
|
is SharedOtherItem -> holder.onBind(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ import com.nextcloud.talk.databinding.SharedItemListBinding
|
|||||||
import com.nextcloud.talk.shareditems.model.SharedFileItem
|
import com.nextcloud.talk.shareditems.model.SharedFileItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedItem
|
import com.nextcloud.talk.shareditems.model.SharedItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedLocationItem
|
import com.nextcloud.talk.shareditems.model.SharedLocationItem
|
||||||
|
import com.nextcloud.talk.shareditems.model.SharedOtherItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedPollItem
|
import com.nextcloud.talk.shareditems.model.SharedPollItem
|
||||||
import com.nextcloud.talk.utils.DateUtils
|
import com.nextcloud.talk.utils.DateUtils
|
||||||
|
|
||||||
@ -100,6 +101,18 @@ class SharedItemsListViewHolder(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onBind(item: SharedOtherItem) {
|
||||||
|
super.onBind(item)
|
||||||
|
|
||||||
|
binding.fileName.text = item.name
|
||||||
|
binding.fileMetadata.visibility = View.GONE
|
||||||
|
image.hierarchy.setPlaceholderImage(R.drawable.ic_mimetype_file)
|
||||||
|
image.setColorFilter(
|
||||||
|
ContextCompat.getColor(image.context, R.color.high_emphasis_menu_icon),
|
||||||
|
android.graphics.PorterDuff.Mode.SRC_IN
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val ONE_SECOND_IN_MILLIS = 1000
|
private const val ONE_SECOND_IN_MILLIS = 1000
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ import com.nextcloud.talk.data.user.model.User
|
|||||||
import com.nextcloud.talk.shareditems.model.SharedFileItem
|
import com.nextcloud.talk.shareditems.model.SharedFileItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedItem
|
import com.nextcloud.talk.shareditems.model.SharedItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedLocationItem
|
import com.nextcloud.talk.shareditems.model.SharedLocationItem
|
||||||
|
import com.nextcloud.talk.shareditems.model.SharedOtherItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedPollItem
|
import com.nextcloud.talk.shareditems.model.SharedPollItem
|
||||||
import com.nextcloud.talk.utils.ApiUtils
|
import com.nextcloud.talk.utils.ApiUtils
|
||||||
import com.nextcloud.talk.utils.DrawableUtils
|
import com.nextcloud.talk.utils.DrawableUtils
|
||||||
@ -131,6 +132,8 @@ abstract class SharedItemsViewHolder(
|
|||||||
|
|
||||||
open fun onBind(item: SharedLocationItem) {}
|
open fun onBind(item: SharedLocationItem) {}
|
||||||
|
|
||||||
|
open fun onBind(item: SharedOtherItem) {}
|
||||||
|
|
||||||
private fun staticImage(
|
private fun staticImage(
|
||||||
mimeType: String?,
|
mimeType: String?,
|
||||||
image: SimpleDraweeView
|
image: SimpleDraweeView
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Nextcloud Talk application
|
||||||
|
*
|
||||||
|
* @author Tim Krüger
|
||||||
|
* Copyright (C) 2022 Tim Krüger <t@timkrueger.me>
|
||||||
|
*
|
||||||
|
* 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.shareditems.model
|
||||||
|
|
||||||
|
data class SharedOtherItem(
|
||||||
|
override val id: String,
|
||||||
|
override val name: String,
|
||||||
|
override val actorId: String,
|
||||||
|
override val actorName: String,
|
||||||
|
) : SharedItem
|
@ -33,6 +33,7 @@ import com.nextcloud.talk.shareditems.model.SharedItem
|
|||||||
import com.nextcloud.talk.shareditems.model.SharedItemType
|
import com.nextcloud.talk.shareditems.model.SharedItemType
|
||||||
import com.nextcloud.talk.shareditems.model.SharedItems
|
import com.nextcloud.talk.shareditems.model.SharedItems
|
||||||
import com.nextcloud.talk.shareditems.model.SharedLocationItem
|
import com.nextcloud.talk.shareditems.model.SharedLocationItem
|
||||||
|
import com.nextcloud.talk.shareditems.model.SharedOtherItem
|
||||||
import com.nextcloud.talk.shareditems.model.SharedPollItem
|
import com.nextcloud.talk.shareditems.model.SharedPollItem
|
||||||
import com.nextcloud.talk.utils.ApiUtils
|
import com.nextcloud.talk.utils.ApiUtils
|
||||||
import io.reactivex.Observable
|
import io.reactivex.Observable
|
||||||
@ -121,6 +122,14 @@ class SharedItemsRepositoryImpl @Inject constructor(private val ncApi: NcApi) :
|
|||||||
Uri.parse(objectParameters["id"]!!.replace("geo:", "geo:0,0?z=11&q="))
|
Uri.parse(objectParameters["id"]!!.replace("geo:", "geo:0,0?z=11&q="))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
else -> {
|
||||||
|
items[it.value.id] = SharedOtherItem(
|
||||||
|
objectParameters["id"]!!,
|
||||||
|
objectParameters["name"]!!,
|
||||||
|
actorParameters["id"]!!,
|
||||||
|
actorParameters["name"]!!
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Item contains neither 'file' or 'object'.")
|
Log.w(TAG, "Item contains neither 'file' or 'object'.")
|
||||||
|
Loading…
Reference in New Issue
Block a user