mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Use overlay method for GroupfolderListAdapter
Signed-off-by: Alper Ozturk <alperozturk@lions-macbook.local> Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
9870a80e87
commit
ca09000327
8 changed files with 12 additions and 189 deletions
|
@ -23,15 +23,18 @@
|
|||
package com.owncloud.android.ui.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.nextcloud.android.lib.resources.groupfolders.Groupfolder
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.databinding.ListItemBinding
|
||||
import com.owncloud.android.ui.interfaces.GroupfolderListInterface
|
||||
import com.owncloud.android.utils.DrawableUtil
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils
|
||||
import java.io.File
|
||||
|
||||
|
@ -43,18 +46,17 @@ class GroupfolderListAdapter(
|
|||
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
lateinit var list: List<Groupfolder>
|
||||
|
||||
private val folderIcon = viewThemeUtils.platform.tintPrimaryDrawable(
|
||||
context,
|
||||
AppCompatResources.getDrawable(
|
||||
context,
|
||||
R.drawable.folder_group
|
||||
)
|
||||
)
|
||||
|
||||
fun setData(result: Map<String, Groupfolder>) {
|
||||
list = result.values.sortedBy { it.mountPoint }
|
||||
}
|
||||
|
||||
private fun getFolderIcon(): LayerDrawable? {
|
||||
val folderDrawable = ContextCompat.getDrawable(context, R.drawable.folder) ?: return null
|
||||
val overlayDrawable = ContextCompat.getDrawable(context, R.drawable.ic_folder_overlay_account_group) ?: return null
|
||||
val drawableUtil = DrawableUtil()
|
||||
return drawableUtil.addDrawableAsOverlay(folderDrawable, overlayDrawable, 6)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
return OCFileListItemViewHolder(
|
||||
ListItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
|
@ -82,7 +84,7 @@ class GroupfolderListAdapter(
|
|||
localFileIndicator.visibility = View.GONE
|
||||
favorite.visibility = View.GONE
|
||||
|
||||
thumbnail.setImageDrawable(folderIcon)
|
||||
thumbnail.setImageDrawable(getFolderIcon())
|
||||
|
||||
itemLayout.setOnClickListener { groupfolderListInterface.onFolderClick(groupfolder.mountPoint) }
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<!--
|
||||
@author Google LLC
|
||||
@author Andy Scherzinger
|
||||
Copyright (C) 2018 Google LLC
|
||||
Copyright (C) 2023 Andy Scherzinger
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#0082c9"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M10,4L12,6L20,6C21.1,6 22,6.89 22,8L22,18C22,19.097 21.097,20 20,20L4,20C2.903,20 2,19.097 2,18L2,6C2,4.89 2.89,4 4,4L10,4ZM8.412,17.286L15.576,17.286L15.576,16.262L8.412,16.262L8.412,17.286ZM10.459,15.239L13.529,15.239L13.529,12.168L15.576,12.168L11.994,8.586L8.412,12.168L10.459,12.168L10.459,15.239Z" />
|
||||
</vector>
|
|
@ -1,10 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#0082c9"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M4,4C2.9,4 2,4.9 2,6V18C2,19.1 2.9,20 4,20H20C21.1,20 22,19.1 22,18V8C22,6.9 21.1,6 20,6H12L10,4M11,10C12.3,10 13.4,10.8 13.8,12H20V14H18V16H16V14H13.8C13.4,15.2 12.3,16 11,16C9.3,16 8,14.7 8,13S9.3,10 11,10M11,12C10.4,12 10,12.4 10,13C10,13.6 10.4,14 11,14C11.6,14 12,13.6 12,13S11.6,12 11,12Z"/>
|
||||
</vector>
|
|
@ -1,28 +0,0 @@
|
|||
<!--
|
||||
@author Google LLC
|
||||
@author Andy Scherzinger
|
||||
Copyright (C) 2018 Google LLC
|
||||
Copyright (C) 2020 Andy Scherzinger
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#0082c9"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M10,4L4,4C2.89,4 2,4.89 2,6L2,18C2,19.097 2.903,20 4,20L20,20C21.097,20 22,19.097 22,18L22,8C22,6.89 21.1,6 20,6L12,6L10,4ZM8.453,9.652L10.823,9.652L11.616,10.403L8.453,10.403L8.453,16.403L14.776,16.403L14.776,13.402L15.569,14.151L15.569,16.403C15.569,16.817 15.216,17.152 14.778,17.152L8.451,17.152C8.013,17.152 7.661,16.817 7.661,16.403L7.661,10.403C7.661,9.987 8.014,9.652 8.453,9.652ZM11.616,8.903L16.361,8.903L16.361,13.402L14.776,11.902L12.404,14.152L10.823,12.651L13.196,10.405L11.616,8.903Z" />
|
||||
</vector>
|
|
@ -1,28 +0,0 @@
|
|||
<!--
|
||||
@author Google LLC
|
||||
@author Andy Scherzinger
|
||||
Copyright (C) 2018 Google LLC
|
||||
Copyright (C) 2020 Andy Scherzinger
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#0082c9"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M4,4C2.89,4 2,4.89 2,6L2,18C2,19.1046 2.8954,20 4,20L20,20C21.1046,20 22,19.1046 22,18L22,8C22,6.89 21.1,6 20,6L12,6L10,4L4,4zM10.2246,8.6348A2.03,2.03 0,0 1,12.3125 10.6641A2.03,2.03 0,0 1,10.2832 12.6934A2.03,2.03 0,0 1,10.2246 8.6348zM13.7637,8.6348A2.03,2.03 0,0 1,13.7637 12.6934A1.9662,1.9662 0,0 1,12.6445 12.3516A2.9,2.9 0,0 0,12.6445 8.9766A1.9662,1.9662 0,0 1,13.7637 8.6348zM10.2832,13.8535C14.3432,13.8535 14.3438,16.1738 14.3438,16.1738L14.3438,17.334L6.2227,17.334L6.2227,16.1738C6.2227,16.1738 6.2232,13.8535 10.2832,13.8535zM14.3086,13.8535C17.8234,14.0681 17.8223,16.1738 17.8223,16.1738L17.8223,17.334L15.5039,17.334L15.5039,16.1738A3.0856,3.0856 0,0 0,14.3086 13.8535z" />
|
||||
</vector>
|
|
@ -1,28 +0,0 @@
|
|||
<!--
|
||||
@author Google LLC
|
||||
@author Andy Scherzinger
|
||||
Copyright (C) 2018 Google LLC
|
||||
Copyright (C) 2020 Andy Scherzinger
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#0082c9"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M4,4C2.89,4 2,4.89 2,6L2,18C2,19.1046 2.8954,20 4,20L20,20C21.1046,20 22,19.1046 22,18L22,8C22,6.89 21.1,6 20,6L12,6L10,4L4,4zM12.0254,8.6133A2.0714,2.0714 0,0 1,14.0977 10.6855L14.0977,11.5137L14.5117,11.5137A0.8286,0.8286 0,0 1,15.3398 12.3418L15.3398,16.4844A0.8286,0.8286 0,0 1,14.5117 17.3145L9.5391,17.3145A0.8286,0.8286 0,0 1,8.7109 16.4844L8.7109,12.3418C8.7109,11.8819 9.0833,11.5137 9.5391,11.5137L9.9531,11.5137L9.9531,10.6855A2.0714,2.0714 0,0 1,12.0254 8.6133zM12.0254,9.4414A1.2429,1.2429 0,0 0,10.7832 10.6855L10.7832,11.5137L13.2676,11.5137L13.2676,10.6855A1.2429,1.2429 0,0 0,12.0254 9.4414zM12.0254,13.5859A0.8286,0.8286 0,0 0,11.1973 14.4141A0.8286,0.8286 0,0 0,12.0254 15.2422A0.8286,0.8286 0,0 0,12.8535 14.4141C12.8535,13.9542 12.4811,13.5859 12.0254,13.5859z"/>
|
||||
</vector>
|
|
@ -1,28 +0,0 @@
|
|||
<!--
|
||||
@author Google LLC
|
||||
@author Andy Scherzinger
|
||||
Copyright (C) 2018 Google LLC
|
||||
Copyright (C) 2020 Andy Scherzinger
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#0082c9"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M4,4C2.89,4 2,4.89 2,6L2,18C2,19.1046 2.8954,20 4,20L20,20C21.1046,20 22,19.1046 22,18L22,8C22,6.89 21.1,6 20,6L12,6L10,4L4,4zM14.3125,8.7168C14.834,8.7168 15.3554,8.914 15.75,9.3086C16.5391,10.0977 16.5391,11.3933 15.75,12.1836L14.4668,13.4668C14.5201,12.9852 14.4446,12.4989 14.2363,12.0547L14.9297,11.3613C15.2789,11.0133 15.2777,10.4801 14.9297,10.1309C14.5817,9.7816 14.0453,9.7816 13.6973,10.1309L11.6445,12.1836A0.8577,0.8577 0,0 0,11.8867 13.582L11.041,14.4297C10.962,14.3715 10.8933,14.3086 10.8223,14.2363A2.0414,2.0414 0,0 1,10.8223 11.3613L12.875,9.3086C13.2696,8.914 13.791,8.7168 14.3125,8.7168zM13.0684,11.5801A1.9152,1.9152 0,0 1,13.2852 11.7715A2.0414,2.0414 0,0 1,13.2852 14.6465L13.2852,14.6484L11.2324,16.7012C10.4433,17.4915 9.1465,17.4903 8.3574,16.7012C7.5683,15.9121 7.5683,14.6165 8.3574,13.8262L9.6406,12.543A2.6271,2.6271 0,0 0,9.873 13.9551L9.1797,14.6484C8.8317,14.9964 8.8311,15.5309 9.1797,15.8789C9.5283,16.2269 10.0629,16.2281 10.4121,15.8789L12.4648,13.8262A0.8577,0.8577 0,0 0,12.2207 12.4277L13.0684,11.5801z" />
|
||||
</vector>
|
|
@ -1,28 +0,0 @@
|
|||
<!--
|
||||
@author Google LLC
|
||||
@author Andy Scherzinger
|
||||
Copyright (C) 2018 Google LLC
|
||||
Copyright (C) 2020 Andy Scherzinger
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#0082c9"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M4,4C2.89,4 2,4.89 2,6L2,18A2,2 0,0 0,4 20L20,20A2,2 0,0 0,22 18L22,8C22,6.89 21.1,6 20,6L12,6L10,4L4,4zM14.9336,8.168A1.45,1.45 0,0 1,16.3828 9.6191A1.45,1.45 0,0 1,14.9336 11.0684C14.5518,11.0684 14.2083,10.9194 13.9473,10.6777L10.5391,12.6641C10.5632,12.7752 10.584,12.886 10.584,13.002C10.584,13.118 10.5632,13.2287 10.5391,13.3398L13.9863,15.3457C14.2377,15.1185 14.5663,14.9746 14.9336,14.9746A1.4113,1.4113 0,0 1,16.3457 16.3848C16.3457,17.1629 15.7118,17.791 14.9336,17.791C14.1554,17.791 13.5215,17.1629 13.5215,16.3848C13.5215,16.2736 13.5364,16.1679 13.5605,16.0664L10.1191,14.0605C9.8581,14.3022 9.5146,14.4512 9.1328,14.4512A1.45,1.45 0,0 1,7.6836 13.002A1.45,1.45 0,0 1,9.1328 11.5527C9.5146,11.5527 9.8581,11.7017 10.1191,11.9434L13.5273,9.957C13.5032,9.8459 13.4844,9.7351 13.4844,9.6191A1.45,1.45 0,0 1,14.9336 8.168z" />
|
||||
</vector>
|
Loading…
Reference in a new issue